uhci: egsm fix
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 26 Jun 2013 15:05:06 +0000 (17:05 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 30 Jul 2013 08:26:19 +0000 (10:26 +0200)
When the guest goes suspend the uhci controller while there are
pending resume requests on the ports go signal global resume
instantly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-uhci.c

index cb44abc7bcbd2b9e87cc24a4f11650b43472db39..ac8283313e20a6b6d1d1c298a00abcd79b830730 100644 (file)
@@ -189,6 +189,7 @@ typedef struct UHCI_QH {
 
 static void uhci_async_cancel(UHCIAsync *async);
 static void uhci_queue_fill(UHCIQueue *q, UHCI_TD *td);
+static void uhci_resume(void *opaque);
 
 static inline int32_t uhci_queue_token(UHCI_TD *td)
 {
@@ -498,6 +499,12 @@ static void uhci_port_write(void *opaque, hwaddr addr,
             return;
         }
         s->cmd = val;
+        if (val & UHCI_CMD_EGSM) {
+            if ((s->ports[0].ctrl & UHCI_PORT_RD) ||
+                (s->ports[1].ctrl & UHCI_PORT_RD)) {
+                uhci_resume(s);
+            }
+        }
         break;
     case 0x02:
         s->status &= ~val;