render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0622-xhci-pick-target-interrupter.patch

5544c1
From d6968ced27f697b26d7a1d5b44f15eeb300a9fd6 Mon Sep 17 00:00:00 2001
Hans de Goede c8dfc6
From: Gerd Hoffmann <kraxel@redhat.com>
Hans de Goede c8dfc6
Date: Fri, 31 Aug 2012 15:30:51 +0200
5544c1
Subject: [PATCH] xhci: pick target interrupter
Hans de Goede c8dfc6
Hans de Goede c8dfc6
Pick the correct interrupter when queuing an event.
Hans de Goede c8dfc6
Hans de Goede c8dfc6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Hans de Goede c8dfc6
---
Hans de Goede c8dfc6
 hw/usb/hcd-xhci.c | 22 ++++++++++++++++------
Hans de Goede c8dfc6
 1 file changed, 16 insertions(+), 6 deletions(-)
Hans de Goede c8dfc6
Hans de Goede c8dfc6
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
5544c1
index 6b3ff16..3b03c6c 100644
Hans de Goede c8dfc6
--- a/hw/usb/hcd-xhci.c
Hans de Goede c8dfc6
+++ b/hw/usb/hcd-xhci.c
Hans de Goede c8dfc6
@@ -264,6 +264,10 @@ typedef enum TRBCCode {
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
 #define TRB_LK_TC           (1<<1)
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
+#define TRB_INTR_SHIFT          22
Hans de Goede c8dfc6
+#define TRB_INTR_MASK       0x3ff
Hans de Goede c8dfc6
+#define TRB_INTR(t)         (((t).status >> TRB_INTR_SHIFT) & TRB_INTR_MASK)
Hans de Goede c8dfc6
+
Hans de Goede c8dfc6
 #define EP_TYPE_MASK        0x7
Hans de Goede c8dfc6
 #define EP_TYPE_SHIFT           3
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
@@ -806,10 +810,16 @@ static void xhci_events_update(XHCIState *xhci, int v)
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
 static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v)
Hans de Goede c8dfc6
 {
Hans de Goede c8dfc6
-    XHCIInterrupter *intr = &xhci->intr[v];
Hans de Goede c8dfc6
+    XHCIInterrupter *intr;
Hans de Goede c8dfc6
     dma_addr_t erdp;
Hans de Goede c8dfc6
     unsigned int dp_idx;
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
+    if (v >= MAXINTRS) {
Hans de Goede c8dfc6
+        DPRINTF("intr nr out of range (%d >= %d)\n", v, MAXINTRS);
Hans de Goede c8dfc6
+        return;
Hans de Goede c8dfc6
+    }
Hans de Goede c8dfc6
+    intr = &xhci->intr[v];
Hans de Goede c8dfc6
+
Hans de Goede c8dfc6
     if (intr->er_full) {
Hans de Goede c8dfc6
         DPRINTF("xhci_event(): ER full, queueing\n");
Hans de Goede c8dfc6
         if (((intr->ev_buffer_put+1) % EV_QUEUE) == intr->ev_buffer_get) {
Hans de Goede c8dfc6
@@ -1377,7 +1387,7 @@ static void xhci_xfer_report(XHCITransfer *xfer)
Hans de Goede c8dfc6
                 DPRINTF("xhci_xfer_data: EDTLA=%d\n", event.length);
Hans de Goede c8dfc6
                 edtla = 0;
Hans de Goede c8dfc6
             }
Hans de Goede c8dfc6
-            xhci_event(xhci, &event, 0 /* FIXME */);
Hans de Goede c8dfc6
+            xhci_event(xhci, &event, TRB_INTR(*trb));
Hans de Goede c8dfc6
             reported = 1;
Hans de Goede c8dfc6
             if (xfer->status != CC_SUCCESS) {
Hans de Goede c8dfc6
                 return;
5544c1
@@ -2253,7 +2263,7 @@ static void xhci_process_commands(XHCIState *xhci)
Hans de Goede c8dfc6
             break;
Hans de Goede c8dfc6
         }
Hans de Goede c8dfc6
         event.slotid = slotid;
Hans de Goede c8dfc6
-        xhci_event(xhci, &event, 0 /* FIXME */);
Hans de Goede c8dfc6
+        xhci_event(xhci, &event, 0);
Hans de Goede c8dfc6
     }
Hans de Goede c8dfc6
 }
Hans de Goede c8dfc6
 
5544c1
@@ -2283,7 +2293,7 @@ static void xhci_update_port(XHCIState *xhci, XHCIPort *port, int is_detach)
Hans de Goede c8dfc6
         port->portsc |= PORTSC_CSC;
Hans de Goede c8dfc6
         XHCIEvent ev = { ER_PORT_STATUS_CHANGE, CC_SUCCESS,
Hans de Goede c8dfc6
                          port->portnr << 24};
Hans de Goede c8dfc6
-        xhci_event(xhci, &ev, 0 /* FIXME */);
Hans de Goede c8dfc6
+        xhci_event(xhci, &ev, 0);
Hans de Goede c8dfc6
         DPRINTF("xhci: port change event for port %d\n", port->portnr);
Hans de Goede c8dfc6
     }
Hans de Goede c8dfc6
 }
5544c1
@@ -2562,7 +2572,7 @@ static void xhci_oper_write(XHCIState *xhci, uint32_t reg, uint32_t val)
Hans de Goede c8dfc6
         if (xhci->crcr_low & (CRCR_CA|CRCR_CS) && (xhci->crcr_low & CRCR_CRR)) {
Hans de Goede c8dfc6
             XHCIEvent event = {ER_COMMAND_COMPLETE, CC_COMMAND_RING_STOPPED};
Hans de Goede c8dfc6
             xhci->crcr_low &= ~CRCR_CRR;
Hans de Goede c8dfc6
-            xhci_event(xhci, &event, 0 /* FIXME */);
Hans de Goede c8dfc6
+            xhci_event(xhci, &event, 0);
Hans de Goede c8dfc6
             DPRINTF("xhci: command ring stopped (CRCR=%08x)\n", xhci->crcr_low);
Hans de Goede c8dfc6
         } else {
Hans de Goede c8dfc6
             dma_addr_t base = xhci_addr64(xhci->crcr_low & ~0x3f, val);
Hans de Goede c8dfc6
@@ -2807,7 +2817,7 @@ static void xhci_wakeup(USBPort *usbport)
Hans de Goede c8dfc6
         return;
Hans de Goede c8dfc6
     }
Hans de Goede c8dfc6
     port->portsc |= PORTSC_PLC;
Hans de Goede c8dfc6
-    xhci_event(xhci, &ev, 0 /* FIXME */);
Hans de Goede c8dfc6
+    xhci_event(xhci, &ev, 0);
Hans de Goede c8dfc6
 }
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
 static void xhci_complete(USBPort *port, USBPacket *packet)
Hans de Goede c8dfc6
-- 
5544c1
1.7.12.1
Hans de Goede c8dfc6