|
Hans de Goede |
c8dfc6 |
From 11ba203517cc28be513ac31c12762c4519e98ee5 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
|
|
Hans de Goede |
c8dfc6 |
Subject: [PATCH 351/366] 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
|
|
Hans de Goede |
c8dfc6 |
index 68a19ab..d6ab0c6 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;
|
|
Hans de Goede |
c8dfc6 |
@@ -2255,7 +2265,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 |
|
|
Hans de Goede |
c8dfc6 |
@@ -2285,7 +2295,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 |
}
|
|
Hans de Goede |
c8dfc6 |
@@ -2564,7 +2574,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 |
--
|
|
Hans de Goede |
c8dfc6 |
1.7.12
|
|
Hans de Goede |
c8dfc6 |
|