diff mbox

usb: usb tablet freeze when save/restore guest os

Message ID 33183CC9F5247A488A2544077AF19020815E81B0@SZXEMA503-MBS.china.huawei.com
State New
Headers show

Commit Message

Gonglei (Arei) May 13, 2014, 9:34 a.m. UTC
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 hw/usb/hcd-uhci.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox

Patch

diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 0820244..fe0ad81 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -680,6 +680,12 @@  static void uhci_wakeup(USBPort *port1)
 {
     UHCIState *s = port1->opaque;
     UHCIPort *port = &s->ports[port1->index];
+    uint8_t *pci_conf = s->dev.config;
+
+    /* Do not resume UHCI when UHCI PIRQ was disabled */
+    if (pci_conf[0xc1] == 0x00 && pci_conf[0xc0] == 0x00) {
+        return;
+    }

     if (port->ctrl & UHCI_PORT_SUSPEND && !(port->ctrl & UHCI_PORT_RD)) {
         port->ctrl |= UHCI_PORT_RD;
@@ -1241,6 +1247,10 @@  static int usb_uhci_common_initfn(PCIDevice *dev)
     /* TODO: reset value should be 0. */
     pci_conf[USB_SBRN] = USB_RELEASE_1; // release number

+    /* LEGACY SUPPORT REGISTER - UHCI11D 5.2.1 */
+    pci_conf[0xc0] |= 0x00;
+    pci_conf[0xc1] |= 0x20; /* Enable USB PIRQ */
+
     pci_config_set_interrupt_pin(pci_conf, u->info.irq_pin + 1);

     if (s->masterbus) {