qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/2] When the XHCI host controller is switched to th


From: Sebastian Bauer
Subject: [Qemu-devel] [PATCH 1/2] When the XHCI host controller is switched to the running mode, set the ccs bit for each port, to which a device is already attached.
Date: Fri, 26 Oct 2012 10:29:07 +0200

---
 hw/usb/hcd-xhci.c |   25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 37b3dbb..4c81dcc 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -990,10 +990,29 @@ static void xhci_er_reset(XHCIState *xhci, int v)
             v, intr->er_start, intr->er_size);
 }
 
+static void xhci_set_port_csc(XHCIState* xhci, XHCIPort* port, int set)
+{
+    port->portsc |= PORTSC_CSC;
+    XHCIEvent ev = { ER_PORT_STATUS_CHANGE, CC_SUCCESS, port->portnr << 24 };
+    xhci_event(xhci, &ev, 0);
+    DPRINTF("xhci: port change event for port %d\n", port->portnr);
+}
+
 static void xhci_run(XHCIState *xhci)
 {
+    int i;
+
     trace_usb_xhci_run();
     xhci->usbsts &= ~USBSTS_HCH;
+
+    for (i=0;i<MAXPORTS;i++) {
+        if (xhci->ports[i].uport) {
+            if (xhci->ports[i].portsc & PORTSC_CCS) {
+                xhci_set_port_csc(xhci,&xhci->ports[i],1);
+            }
+        }
+    }
+
     xhci->mfindex_start = qemu_get_clock_ns(vm_clock);
 }
 
@@ -2307,11 +2326,7 @@ static void xhci_update_port(XHCIState *xhci, XHCIPort 
*port, int is_detach)
     }
 
     if (xhci_running(xhci)) {
-        port->portsc |= PORTSC_CSC;
-        XHCIEvent ev = { ER_PORT_STATUS_CHANGE, CC_SUCCESS,
-                         port->portnr << 24};
-        xhci_event(xhci, &ev, 0);
-        DPRINTF("xhci: port change event for port %d\n", port->portnr);
+       xhci_set_port_csc(xhci, port, 1);
     }
 }
 
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]