|
Hans de Goede |
3f1f29 |
From 555ef05ebba2bf68abace047e39b12de75b71181 Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
3f1f29 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
3f1f29 |
Date: Fri, 24 Jun 2011 14:36:13 +0200
|
|
Hans de Goede |
3f1f29 |
Subject: [PATCH 11/35] usb-ehci: Fix handling of PED and PEDC port status
|
|
Hans de Goede |
3f1f29 |
bits
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
The PED bit should only be set for highspeed devices and the PEDC bit
|
|
Hans de Goede |
3f1f29 |
should not be set on "normal" PED bit changes, only on io errors.
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
3f1f29 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
3f1f29 |
---
|
|
Hans de Goede |
3f1f29 |
hw/usb-ehci.c | 24 +++++++++++-------------
|
|
Hans de Goede |
3f1f29 |
1 files changed, 11 insertions(+), 13 deletions(-)
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
|
|
Hans de Goede |
3f1f29 |
index d85e0a9..973c342 100644
|
|
Hans de Goede |
3f1f29 |
--- a/hw/usb-ehci.c
|
|
Hans de Goede |
3f1f29 |
+++ b/hw/usb-ehci.c
|
|
Hans de Goede |
3f1f29 |
@@ -106,7 +106,7 @@
|
|
Hans de Goede |
3f1f29 |
* Bits that are reserved or are read-only are masked out of values
|
|
Hans de Goede |
3f1f29 |
* written to us by software
|
|
Hans de Goede |
3f1f29 |
*/
|
|
Hans de Goede |
3f1f29 |
-#define PORTSC_RO_MASK 0x007021c4
|
|
Hans de Goede |
3f1f29 |
+#define PORTSC_RO_MASK 0x007021c0
|
|
Hans de Goede |
3f1f29 |
#define PORTSC_RWC_MASK 0x0000002a
|
|
Hans de Goede |
3f1f29 |
#define PORTSC_WKOC_E (1 << 22) // Wake on Over Current Enable
|
|
Hans de Goede |
3f1f29 |
#define PORTSC_WKDS_E (1 << 21) // Wake on Disconnect Enable
|
|
Hans de Goede |
3f1f29 |
@@ -752,7 +752,7 @@ static void ehci_detach(USBPort *port)
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
ehci_queues_rip_device(s, port->dev);
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
- *portsc &= ~PORTSC_CONNECT;
|
|
Hans de Goede |
3f1f29 |
+ *portsc &= ~(PORTSC_CONNECT|PORTSC_PED);
|
|
Hans de Goede |
3f1f29 |
*portsc |= PORTSC_CSC;
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
/*
|
|
Hans de Goede |
3f1f29 |
@@ -847,16 +847,14 @@ static void ehci_mem_writew(void *ptr, target_phys_addr_t addr, uint32_t val)
|
|
Hans de Goede |
3f1f29 |
static void handle_port_status_write(EHCIState *s, int port, uint32_t val)
|
|
Hans de Goede |
3f1f29 |
{
|
|
Hans de Goede |
3f1f29 |
uint32_t *portsc = &s->portsc[port];
|
|
Hans de Goede |
3f1f29 |
- int rwc;
|
|
Hans de Goede |
3f1f29 |
USBDevice *dev = s->ports[port].dev;
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
- rwc = val & PORTSC_RWC_MASK;
|
|
Hans de Goede |
3f1f29 |
+ /* Clear rwc bits */
|
|
Hans de Goede |
3f1f29 |
+ *portsc &= ~(val & PORTSC_RWC_MASK);
|
|
Hans de Goede |
3f1f29 |
+ /* The guest may clear, but not set the PED bit */
|
|
Hans de Goede |
3f1f29 |
+ *portsc &= val | ~PORTSC_PED;
|
|
Hans de Goede |
3f1f29 |
val &= PORTSC_RO_MASK;
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
- // handle_read_write_clear(&val, portsc, PORTSC_PEDC | PORTSC_CSC);
|
|
Hans de Goede |
3f1f29 |
-
|
|
Hans de Goede |
3f1f29 |
- *portsc &= ~rwc;
|
|
Hans de Goede |
3f1f29 |
-
|
|
Hans de Goede |
3f1f29 |
if ((val & PORTSC_PRESET) && !(*portsc & PORTSC_PRESET)) {
|
|
Hans de Goede |
3f1f29 |
trace_usb_ehci_port_reset(port, 1);
|
|
Hans de Goede |
3f1f29 |
}
|
|
Hans de Goede |
3f1f29 |
@@ -869,13 +867,13 @@ static void handle_port_status_write(EHCIState *s, int port, uint32_t val)
|
|
Hans de Goede |
3f1f29 |
*portsc &= ~PORTSC_CSC;
|
|
Hans de Goede |
3f1f29 |
}
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
- /* Table 2.16 Set the enable bit(and enable bit change) to indicate
|
|
Hans de Goede |
3f1f29 |
+ /*
|
|
Hans de Goede |
3f1f29 |
+ * Table 2.16 Set the enable bit(and enable bit change) to indicate
|
|
Hans de Goede |
3f1f29 |
* to SW that this port has a high speed device attached
|
|
Hans de Goede |
3f1f29 |
- *
|
|
Hans de Goede |
3f1f29 |
- * TODO - when to disable?
|
|
Hans de Goede |
3f1f29 |
*/
|
|
Hans de Goede |
3f1f29 |
- val |= PORTSC_PED;
|
|
Hans de Goede |
3f1f29 |
- val |= PORTSC_PEDC;
|
|
Hans de Goede |
3f1f29 |
+ if (dev && (dev->speedmask & USB_SPEED_MASK_HIGH)) {
|
|
Hans de Goede |
3f1f29 |
+ val |= PORTSC_PED;
|
|
Hans de Goede |
3f1f29 |
+ }
|
|
Hans de Goede |
3f1f29 |
}
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
*portsc &= ~PORTSC_RO_MASK;
|
|
Hans de Goede |
3f1f29 |
--
|
|
Hans de Goede |
3f1f29 |
1.7.5.1
|
|
Hans de Goede |
3f1f29 |
|