[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/13] hw/usb-ohci.c: Fix handling of remote wakeup
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 11/13] hw/usb-ohci.c: Fix handling of remote wakeup corner cases |
Date: |
Fri, 24 Jun 2011 12:59:33 +0200 |
From: Peter Maydell <address@hidden>
Correct a number of minor errors in the OHCI wakeup implementation:
* when the port is suspended but the controller is not, raise RHSC
* when the controller is suspended but the port is not, raise RD
* when the controller is suspended, move it to resume state
These fix some edge cases where a USB device might not successfully get
the attention of the guest OS if it tried to do so at the wrong time.
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb-ohci.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 5d2ae01..1c29b9f 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -373,14 +373,25 @@ static void ohci_wakeup(USBDevice *dev)
OHCIState *s = container_of(bus, OHCIState, bus);
int portnum = dev->port->index;
OHCIPort *port = &s->rhport[portnum];
+ uint32_t intr = 0;
if (port->ctrl & OHCI_PORT_PSS) {
DPRINTF("usb-ohci: port %d: wakeup\n", portnum);
port->ctrl |= OHCI_PORT_PSSC;
port->ctrl &= ~OHCI_PORT_PSS;
- if ((s->ctl & OHCI_CTL_HCFS) == OHCI_USB_SUSPEND) {
- ohci_set_interrupt(s, OHCI_INTR_RD);
- }
+ intr = OHCI_INTR_RHSC;
+ }
+ /* Note that the controller can be suspended even if this port is not */
+ if ((s->ctl & OHCI_CTL_HCFS) == OHCI_USB_SUSPEND) {
+ DPRINTF("usb-ohci: remote-wakeup: SUSPEND->RESUME\n");
+ /* This is the one state transition the controller can do by itself */
+ s->ctl &= ~OHCI_CTL_HCFS;
+ s->ctl |= OHCI_USB_RESUME;
+ /* In suspend mode only ResumeDetected is possible, not RHSC:
+ * see the OHCI spec 5.1.2.3.
+ */
+ intr = OHCI_INTR_RD;
}
+ ohci_set_interrupt(s, intr);
}
/* Reset the controller */
--
1.7.1
- [Qemu-devel] [PULL] usb patch queue, (continued)
- [Qemu-devel] [PULL] usb patch queue, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 03/13] usb-linux: track inflight iso urb count, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 04/13] ehci: add freq + maxframes properties, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 02/13] usb-linux: make iso urb count contigurable, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 01/13] usb-linux: add get_endp(), Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 06/13] usb-bus: Don't allow attaching a device to a bus with no free ports, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 05/13] ehci: switch to nanoseconds, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 09/13] usb-linux: allow "compatible" high speed devices to connect at fullspeed, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 08/13] usb: Add a speedmask to devices, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 13/13] usb: ignore USB_DT_DEBUG, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 11/13] hw/usb-ohci.c: Fix handling of remote wakeup corner cases,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 07/13] usb: Proper error propagation for usb_device_attach errors, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 12/13] usb-storage: Turn drive serial into a qdev property usb-storage.serial, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 10/13] usb-bus: Don't allow speed mismatch while attaching devices, Gerd Hoffmann, 2011/06/24
- Re: [Qemu-devel] [PULL] usb patch queue, Hans de Goede, 2011/06/24
- Re: [Qemu-devel] [PULL] usb patch queue, Anthony Liguori, 2011/06/27