|
|
5544c1 |
From f9416f401c9eac3f69b4705a999c6ea1ff457016 Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
c8dfc6 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
Date: Fri, 17 Aug 2012 14:05:21 +0200
|
|
|
5544c1 |
Subject: [PATCH] xhci: rip out background transfer code
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
original xhci code (the one which used libusb directly) used to use
|
|
Hans de Goede |
c8dfc6 |
'background transfers' for iso streams. In upstream qemu the iso
|
|
Hans de Goede |
c8dfc6 |
stream buffering is handled by usb-host & usb-redir, so we will
|
|
Hans de Goede |
c8dfc6 |
never ever need this. It has been left in as reference, but is dead
|
|
Hans de Goede |
c8dfc6 |
code anyway. Rip it out.
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
5544c1 |
(cherry picked from commit 331e9406f152b6bae6859a153d36e5076c58901d)
|
|
|
5544c1 |
|
|
|
5544c1 |
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
|
|
Hans de Goede |
c8dfc6 |
---
|
|
Hans de Goede |
c8dfc6 |
hw/usb/hcd-xhci.c | 223 +-----------------------------------------------------
|
|
Hans de Goede |
c8dfc6 |
1 file changed, 4 insertions(+), 219 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 3eb27fa..c0a2476 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 |
@@ -45,8 +45,6 @@
|
|
Hans de Goede |
c8dfc6 |
#define MAXPORTS (USB2_PORTS+USB3_PORTS)
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
#define TD_QUEUE 24
|
|
Hans de Goede |
c8dfc6 |
-#define BG_XFERS 8
|
|
Hans de Goede |
c8dfc6 |
-#define BG_PKTS 8
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
/* Very pessimistic, let's hope it's enough for all cases */
|
|
Hans de Goede |
c8dfc6 |
#define EV_QUEUE (((3*TD_QUEUE)+16)*MAXSLOTS)
|
|
Hans de Goede |
c8dfc6 |
@@ -311,13 +309,11 @@ typedef struct XHCITransfer {
|
|
Hans de Goede |
c8dfc6 |
bool running_retry;
|
|
Hans de Goede |
c8dfc6 |
bool cancelled;
|
|
Hans de Goede |
c8dfc6 |
bool complete;
|
|
Hans de Goede |
c8dfc6 |
- bool backgrounded;
|
|
Hans de Goede |
c8dfc6 |
unsigned int iso_pkts;
|
|
Hans de Goede |
c8dfc6 |
unsigned int slotid;
|
|
Hans de Goede |
c8dfc6 |
unsigned int epid;
|
|
Hans de Goede |
c8dfc6 |
bool in_xfer;
|
|
Hans de Goede |
c8dfc6 |
bool iso_xfer;
|
|
Hans de Goede |
c8dfc6 |
- bool bg_xfer;
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
unsigned int trb_count;
|
|
Hans de Goede |
c8dfc6 |
unsigned int trb_alloced;
|
|
Hans de Goede |
c8dfc6 |
@@ -340,14 +336,9 @@ typedef struct XHCIEPContext {
|
|
Hans de Goede |
c8dfc6 |
unsigned int comp_xfer;
|
|
Hans de Goede |
c8dfc6 |
XHCITransfer transfers[TD_QUEUE];
|
|
Hans de Goede |
c8dfc6 |
XHCITransfer *retry;
|
|
Hans de Goede |
c8dfc6 |
- bool bg_running;
|
|
Hans de Goede |
c8dfc6 |
- bool bg_updating;
|
|
Hans de Goede |
c8dfc6 |
- unsigned int next_bg;
|
|
Hans de Goede |
c8dfc6 |
- XHCITransfer bg_transfers[BG_XFERS];
|
|
Hans de Goede |
c8dfc6 |
EPType type;
|
|
Hans de Goede |
c8dfc6 |
dma_addr_t pctx;
|
|
Hans de Goede |
c8dfc6 |
unsigned int max_psize;
|
|
Hans de Goede |
c8dfc6 |
- bool has_bg;
|
|
Hans de Goede |
c8dfc6 |
uint32_t state;
|
|
Hans de Goede |
c8dfc6 |
} XHCIEPContext;
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
@@ -866,10 +857,6 @@ static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
|
|
Hans de Goede |
c8dfc6 |
epctx->pctx = pctx;
|
|
Hans de Goede |
c8dfc6 |
epctx->max_psize = ctx[1]>>16;
|
|
Hans de Goede |
c8dfc6 |
epctx->max_psize *= 1+((ctx[1]>>8)&0xff);
|
|
Hans de Goede |
c8dfc6 |
- epctx->has_bg = false;
|
|
Hans de Goede |
c8dfc6 |
- if (epctx->type == ET_ISO_IN) {
|
|
Hans de Goede |
c8dfc6 |
- epctx->has_bg = true;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
DPRINTF("xhci: endpoint %d.%d max transaction (burst) size is %d\n",
|
|
Hans de Goede |
c8dfc6 |
epid/2, epid%2, epctx->max_psize);
|
|
Hans de Goede |
c8dfc6 |
for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) {
|
|
Hans de Goede |
c8dfc6 |
@@ -916,9 +903,6 @@ static int xhci_ep_nuke_xfers(XHCIState *xhci, unsigned int slotid,
|
|
Hans de Goede |
c8dfc6 |
t->running_retry = 0;
|
|
Hans de Goede |
c8dfc6 |
epctx->retry = NULL;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
- if (t->backgrounded) {
|
|
Hans de Goede |
c8dfc6 |
- t->backgrounded = 0;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
if (t->trbs) {
|
|
Hans de Goede |
c8dfc6 |
g_free(t->trbs);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
@@ -932,25 +916,6 @@ static int xhci_ep_nuke_xfers(XHCIState *xhci, unsigned int slotid,
|
|
Hans de Goede |
c8dfc6 |
t->data_length = t->data_alloced = 0;
|
|
Hans de Goede |
c8dfc6 |
xferi = (xferi + 1) % TD_QUEUE;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
- if (epctx->has_bg) {
|
|
Hans de Goede |
c8dfc6 |
- xferi = epctx->next_bg;
|
|
Hans de Goede |
c8dfc6 |
- for (i = 0; i < BG_XFERS; i++) {
|
|
Hans de Goede |
c8dfc6 |
- XHCITransfer *t = &epctx->bg_transfers[xferi];
|
|
Hans de Goede |
c8dfc6 |
- if (t->running_async) {
|
|
Hans de Goede |
c8dfc6 |
- usb_cancel_packet(&t->packet);
|
|
Hans de Goede |
c8dfc6 |
- t->running_async = 0;
|
|
Hans de Goede |
c8dfc6 |
- t->cancelled = 1;
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("xhci: cancelling bg transfer %d, waiting for it to complete...\n", i);
|
|
Hans de Goede |
c8dfc6 |
- killed++;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- if (t->data) {
|
|
Hans de Goede |
c8dfc6 |
- g_free(t->data);
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- t->data = NULL;
|
|
Hans de Goede |
c8dfc6 |
- xferi = (xferi + 1) % BG_XFERS;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
return killed;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
@@ -1231,160 +1196,6 @@ static void xhci_stall_ep(XHCITransfer *xfer)
|
|
Hans de Goede |
c8dfc6 |
static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer,
|
|
Hans de Goede |
c8dfc6 |
XHCIEPContext *epctx);
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
-static void xhci_bg_update(XHCIState *xhci, XHCIEPContext *epctx)
|
|
Hans de Goede |
c8dfc6 |
-{
|
|
Hans de Goede |
c8dfc6 |
- if (epctx->bg_updating) {
|
|
Hans de Goede |
c8dfc6 |
- return;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("xhci_bg_update(%p, %p)\n", xhci, epctx);
|
|
Hans de Goede |
c8dfc6 |
- assert(epctx->has_bg);
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("xhci: fg=%d bg=%d\n", epctx->comp_xfer, epctx->next_bg);
|
|
Hans de Goede |
c8dfc6 |
- epctx->bg_updating = 1;
|
|
Hans de Goede |
c8dfc6 |
- while (epctx->transfers[epctx->comp_xfer].backgrounded &&
|
|
Hans de Goede |
c8dfc6 |
- epctx->bg_transfers[epctx->next_bg].complete) {
|
|
Hans de Goede |
c8dfc6 |
- XHCITransfer *fg = &epctx->transfers[epctx->comp_xfer];
|
|
Hans de Goede |
c8dfc6 |
- XHCITransfer *bg = &epctx->bg_transfers[epctx->next_bg];
|
|
Hans de Goede |
c8dfc6 |
-#if 0
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("xhci: completing fg %d from bg %d.%d (stat: %d)\n",
|
|
Hans de Goede |
c8dfc6 |
- epctx->comp_xfer, epctx->next_bg, bg->cur_pkt,
|
|
Hans de Goede |
c8dfc6 |
- bg->usbxfer->iso_packet_desc[bg->cur_pkt].status
|
|
Hans de Goede |
c8dfc6 |
- );
|
|
Hans de Goede |
c8dfc6 |
-#endif
|
|
Hans de Goede |
c8dfc6 |
- assert(epctx->type == ET_ISO_IN);
|
|
Hans de Goede |
c8dfc6 |
- assert(bg->iso_xfer);
|
|
Hans de Goede |
c8dfc6 |
- assert(bg->in_xfer);
|
|
Hans de Goede |
c8dfc6 |
- uint8_t *p = bg->data + bg->cur_pkt * bg->pktsize;
|
|
Hans de Goede |
c8dfc6 |
-#if 0
|
|
Hans de Goede |
c8dfc6 |
- int len = bg->usbxfer->iso_packet_desc[bg->cur_pkt].actual_length;
|
|
Hans de Goede |
c8dfc6 |
- fg->status = libusb_to_ccode(bg->usbxfer->iso_packet_desc[bg->cur_pkt].status);
|
|
Hans de Goede |
c8dfc6 |
-#else
|
|
Hans de Goede |
c8dfc6 |
- int len = 0;
|
|
Hans de Goede |
c8dfc6 |
- FIXME();
|
|
Hans de Goede |
c8dfc6 |
-#endif
|
|
Hans de Goede |
c8dfc6 |
- fg->complete = 1;
|
|
Hans de Goede |
c8dfc6 |
- fg->backgrounded = 0;
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- if (fg->status == CC_STALL_ERROR) {
|
|
Hans de Goede |
c8dfc6 |
- xhci_stall_ep(fg);
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- xhci_xfer_data(fg, p, len, 1, 0, 1);
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- epctx->comp_xfer++;
|
|
Hans de Goede |
c8dfc6 |
- if (epctx->comp_xfer == TD_QUEUE) {
|
|
Hans de Goede |
c8dfc6 |
- epctx->comp_xfer = 0;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("next fg xfer: %d\n", epctx->comp_xfer);
|
|
Hans de Goede |
c8dfc6 |
- bg->cur_pkt++;
|
|
Hans de Goede |
c8dfc6 |
- if (bg->cur_pkt == bg->pkts) {
|
|
Hans de Goede |
c8dfc6 |
- bg->complete = 0;
|
|
Hans de Goede |
c8dfc6 |
- if (xhci_submit(xhci, bg, epctx) < 0) {
|
|
Hans de Goede |
c8dfc6 |
- fprintf(stderr, "xhci: bg resubmit failed\n");
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- epctx->next_bg++;
|
|
Hans de Goede |
c8dfc6 |
- if (epctx->next_bg == BG_XFERS) {
|
|
Hans de Goede |
c8dfc6 |
- epctx->next_bg = 0;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("next bg xfer: %d\n", epctx->next_bg);
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- xhci_kick_ep(xhci, fg->slotid, fg->epid);
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- epctx->bg_updating = 0;
|
|
Hans de Goede |
c8dfc6 |
-}
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
-#if 0
|
|
Hans de Goede |
c8dfc6 |
-static void xhci_xfer_cb(struct libusb_transfer *transfer)
|
|
Hans de Goede |
c8dfc6 |
-{
|
|
Hans de Goede |
c8dfc6 |
- XHCIState *xhci;
|
|
Hans de Goede |
c8dfc6 |
- XHCITransfer *xfer;
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- xfer = (XHCITransfer *)transfer->user_data;
|
|
Hans de Goede |
c8dfc6 |
- xhci = xfer->xhci;
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("xhci_xfer_cb(slot=%d, ep=%d, status=%d)\n", xfer->slotid,
|
|
Hans de Goede |
c8dfc6 |
- xfer->epid, transfer->status);
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- assert(xfer->slotid >= 1 && xfer->slotid <= MAXSLOTS);
|
|
Hans de Goede |
c8dfc6 |
- assert(xfer->epid >= 1 && xfer->epid <= 31);
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- if (xfer->cancelled) {
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("xhci: transfer cancelled, not reporting anything\n");
|
|
Hans de Goede |
c8dfc6 |
- xfer->running = 0;
|
|
Hans de Goede |
c8dfc6 |
- return;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- XHCIEPContext *epctx;
|
|
Hans de Goede |
c8dfc6 |
- XHCISlot *slot;
|
|
Hans de Goede |
c8dfc6 |
- slot = &xhci->slots[xfer->slotid-1];
|
|
Hans de Goede |
c8dfc6 |
- assert(slot->eps[xfer->epid-1]);
|
|
Hans de Goede |
c8dfc6 |
- epctx = slot->eps[xfer->epid-1];
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- if (xfer->bg_xfer) {
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("xhci: background transfer, updating\n");
|
|
Hans de Goede |
c8dfc6 |
- xfer->complete = 1;
|
|
Hans de Goede |
c8dfc6 |
- xfer->running = 0;
|
|
Hans de Goede |
c8dfc6 |
- xhci_bg_update(xhci, epctx);
|
|
Hans de Goede |
c8dfc6 |
- return;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- if (xfer->iso_xfer) {
|
|
Hans de Goede |
c8dfc6 |
- transfer->status = transfer->iso_packet_desc[0].status;
|
|
Hans de Goede |
c8dfc6 |
- transfer->actual_length = transfer->iso_packet_desc[0].actual_length;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- xfer->status = libusb_to_ccode(transfer->status);
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- xfer->complete = 1;
|
|
Hans de Goede |
c8dfc6 |
- xfer->running = 0;
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- if (transfer->status == LIBUSB_TRANSFER_STALL)
|
|
Hans de Goede |
c8dfc6 |
- xhci_stall_ep(xhci, epctx, xfer);
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("xhci: transfer actual length = %d\n", transfer->actual_length);
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- if (xfer->in_xfer) {
|
|
Hans de Goede |
c8dfc6 |
- if (xfer->epid == 1) {
|
|
Hans de Goede |
c8dfc6 |
- xhci_xfer_data(xhci, xfer, xfer->data + 8,
|
|
Hans de Goede |
c8dfc6 |
- transfer->actual_length, 1, 0, 1);
|
|
Hans de Goede |
c8dfc6 |
- } else {
|
|
Hans de Goede |
c8dfc6 |
- xhci_xfer_data(xhci, xfer, xfer->data,
|
|
Hans de Goede |
c8dfc6 |
- transfer->actual_length, 1, 0, 1);
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- } else {
|
|
Hans de Goede |
c8dfc6 |
- xhci_xfer_data(xhci, xfer, NULL, transfer->actual_length, 0, 0, 1);
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- xhci_kick_ep(xhci, xfer->slotid, xfer->epid);
|
|
Hans de Goede |
c8dfc6 |
-}
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
-static int xhci_hle_control(XHCIState *xhci, XHCITransfer *xfer,
|
|
Hans de Goede |
c8dfc6 |
- uint8_t bmRequestType, uint8_t bRequest,
|
|
Hans de Goede |
c8dfc6 |
- uint16_t wValue, uint16_t wIndex, uint16_t wLength)
|
|
Hans de Goede |
c8dfc6 |
-{
|
|
Hans de Goede |
c8dfc6 |
- uint16_t type_req = (bmRequestType << 8) | bRequest;
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- switch (type_req) {
|
|
Hans de Goede |
c8dfc6 |
- case 0x0000 | USB_REQ_SET_CONFIGURATION:
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("xhci: HLE switch configuration\n");
|
|
Hans de Goede |
c8dfc6 |
- return xhci_switch_config(xhci, xfer->slotid, wValue) == 0;
|
|
Hans de Goede |
c8dfc6 |
- case 0x0100 | USB_REQ_SET_INTERFACE:
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("xhci: HLE set interface altsetting\n");
|
|
Hans de Goede |
c8dfc6 |
- return xhci_set_iface_alt(xhci, xfer->slotid, wIndex, wValue) == 0;
|
|
Hans de Goede |
c8dfc6 |
- case 0x0200 | USB_REQ_CLEAR_FEATURE:
|
|
Hans de Goede |
c8dfc6 |
- if (wValue == 0) { // endpoint halt
|
|
Hans de Goede |
c8dfc6 |
- DPRINTF("xhci: HLE clear halt\n");
|
|
Hans de Goede |
c8dfc6 |
- return xhci_clear_halt(xhci, xfer->slotid, wIndex);
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- case 0x0000 | USB_REQ_SET_ADDRESS:
|
|
Hans de Goede |
c8dfc6 |
- fprintf(stderr, "xhci: warn: illegal SET_ADDRESS request\n");
|
|
Hans de Goede |
c8dfc6 |
- return 0;
|
|
Hans de Goede |
c8dfc6 |
- default:
|
|
Hans de Goede |
c8dfc6 |
- return 0;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
-}
|
|
Hans de Goede |
c8dfc6 |
-#endif
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
static int xhci_setup_packet(XHCITransfer *xfer, USBDevice *dev)
|
|
Hans de Goede |
c8dfc6 |
{
|
|
Hans de Goede |
c8dfc6 |
USBEndpoint *ep;
|
|
Hans de Goede |
c8dfc6 |
@@ -1559,9 +1370,7 @@ static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext *epctx
|
|
Hans de Goede |
c8dfc6 |
xfer->data_alloced = xfer->data_length;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
if (epctx->type == ET_ISO_IN || epctx->type == ET_ISO_OUT) {
|
|
Hans de Goede |
c8dfc6 |
- if (!xfer->bg_xfer) {
|
|
Hans de Goede |
c8dfc6 |
- xfer->pkts = 1;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
+ xfer->pkts = 1;
|
|
Hans de Goede |
c8dfc6 |
} else {
|
|
Hans de Goede |
c8dfc6 |
xfer->pkts = 0;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
@@ -1620,32 +1429,8 @@ static int xhci_fire_transfer(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
trace_usb_xhci_xfer_start(xfer, xfer->slotid, xfer->epid, length);
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
- if (!epctx->has_bg) {
|
|
Hans de Goede |
c8dfc6 |
- xfer->data_length = length;
|
|
Hans de Goede |
c8dfc6 |
- xfer->backgrounded = 0;
|
|
Hans de Goede |
c8dfc6 |
- return xhci_submit(xhci, xfer, epctx);
|
|
Hans de Goede |
c8dfc6 |
- } else {
|
|
Hans de Goede |
c8dfc6 |
- if (!epctx->bg_running) {
|
|
Hans de Goede |
c8dfc6 |
- for (i = 0; i < BG_XFERS; i++) {
|
|
Hans de Goede |
c8dfc6 |
- XHCITransfer *t = &epctx->bg_transfers[i];
|
|
Hans de Goede |
c8dfc6 |
- t->xhci = xhci;
|
|
Hans de Goede |
c8dfc6 |
- t->epid = xfer->epid;
|
|
Hans de Goede |
c8dfc6 |
- t->slotid = xfer->slotid;
|
|
Hans de Goede |
c8dfc6 |
- t->pkts = BG_PKTS;
|
|
Hans de Goede |
c8dfc6 |
- t->pktsize = epctx->max_psize;
|
|
Hans de Goede |
c8dfc6 |
- t->data_length = t->pkts * t->pktsize;
|
|
Hans de Goede |
c8dfc6 |
- t->bg_xfer = 1;
|
|
Hans de Goede |
c8dfc6 |
- if (xhci_submit(xhci, t, epctx) < 0) {
|
|
Hans de Goede |
c8dfc6 |
- fprintf(stderr, "xhci: bg submit failed\n");
|
|
Hans de Goede |
c8dfc6 |
- return -1;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- epctx->bg_running = 1;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
- xfer->backgrounded = 1;
|
|
Hans de Goede |
c8dfc6 |
- xhci_bg_update(xhci, epctx);
|
|
Hans de Goede |
c8dfc6 |
- return 0;
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
+ xfer->data_length = length;
|
|
Hans de Goede |
c8dfc6 |
+ return xhci_submit(xhci, xfer, epctx);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, unsigned int epid)
|
|
Hans de Goede |
c8dfc6 |
@@ -1695,7 +1480,7 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, unsigned int epid
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
while (1) {
|
|
Hans de Goede |
c8dfc6 |
XHCITransfer *xfer = &epctx->transfers[epctx->next_xfer];
|
|
Hans de Goede |
c8dfc6 |
- if (xfer->running_async || xfer->running_retry || xfer->backgrounded) {
|
|
Hans de Goede |
c8dfc6 |
+ if (xfer->running_async || xfer->running_retry) {
|
|
Hans de Goede |
c8dfc6 |
break;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
length = xhci_ring_chain_length(xhci, &epctx->ring);
|
|
Hans de Goede |
c8dfc6 |
--
|
|
|
5544c1 |
1.7.12.1
|
|
Hans de Goede |
c8dfc6 |
|