[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/22] xhci: Add a xhci_ep_nuke_one_xfer helper func
From: |
Hans de Goede |
Subject: |
[Qemu-devel] [PATCH 08/22] xhci: Add a xhci_ep_nuke_one_xfer helper function |
Date: |
Mon, 15 Oct 2012 12:38:17 +0200 |
Signed-off-by: Hans de Goede <address@hidden>
---
hw/usb/hcd-xhci.c | 49 ++++++++++++++++++++++++++++++-------------------
1 file changed, 30 insertions(+), 19 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index e0ca690..0d90578 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1081,6 +1081,35 @@ static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned
int slotid,
return CC_SUCCESS;
}
+static int xhci_ep_nuke_one_xfer(XHCITransfer *t)
+{
+ int killed = 0;
+
+ if (t->running_async) {
+ usb_cancel_packet(&t->packet);
+ t->running_async = 0;
+ t->cancelled = 1;
+ DPRINTF("xhci: cancelling transfer %d, waiting for it to
complete...\n", i);
+ killed = 1;
+ }
+ if (t->running_retry) {
+ XHCIEPContext *epctx = t->xhci->slots[t->slotid-1].eps[t->epid-1];
+ if (epctx) {
+ epctx->retry = NULL;
+ qemu_del_timer(epctx->kick_timer);
+ }
+ t->running_retry = 0;
+ }
+ if (t->trbs) {
+ g_free(t->trbs);
+ }
+
+ t->trbs = NULL;
+ t->trb_count = t->trb_alloced = 0;
+
+ return killed;
+}
+
static int xhci_ep_nuke_xfers(XHCIState *xhci, unsigned int slotid,
unsigned int epid)
{
@@ -1102,25 +1131,7 @@ static int xhci_ep_nuke_xfers(XHCIState *xhci, unsigned
int slotid,
xferi = epctx->next_xfer;
for (i = 0; i < TD_QUEUE; i++) {
- XHCITransfer *t = &epctx->transfers[xferi];
- if (t->running_async) {
- usb_cancel_packet(&t->packet);
- t->running_async = 0;
- t->cancelled = 1;
- DPRINTF("xhci: cancelling transfer %d, waiting for it to
complete...\n", i);
- killed++;
- }
- if (t->running_retry) {
- t->running_retry = 0;
- epctx->retry = NULL;
- qemu_del_timer(epctx->kick_timer);
- }
- if (t->trbs) {
- g_free(t->trbs);
- }
-
- t->trbs = NULL;
- t->trb_count = t->trb_alloced = 0;
+ killed += xhci_ep_nuke_one_xfer(&epctx->transfers[xferi]);
xferi = (xferi + 1) % TD_QUEUE;
}
return killed;
--
1.7.12.1
- [Qemu-devel] [PATCH 03/22] ehci: Get rid of packet tbytes field, (continued)
[Qemu-devel] [PATCH 02/22] uhci: Move checks to continue queuing to uhci_fill_queue(), Hans de Goede, 2012/10/15
[Qemu-devel] [PATCH 04/22] ehci: Set int flag on a short input packet, Hans de Goede, 2012/10/15
[Qemu-devel] [PATCH 07/22] ehci: Detect going in circles when filling the queue, Hans de Goede, 2012/10/15
[Qemu-devel] [PATCH 08/22] xhci: Add a xhci_ep_nuke_one_xfer helper function,
Hans de Goede <=
[Qemu-devel] [PATCH 05/22] ehci: Improve latency of interrupt delivery and async schedule scanning, Hans de Goede, 2012/10/15
[Qemu-devel] [PATCH 10/22] usb: Add USB_RET_ADD_TO_QUEUE packet result code, Hans de Goede, 2012/10/15
[Qemu-devel] [PATCH 09/22] usb: Rename __usb_packet_complete to usb_packet_complete_one, Hans de Goede, 2012/10/15
[Qemu-devel] [PATCH 13/22] usb: Add an int_req flag to USBPacket, Hans de Goede, 2012/10/15
[Qemu-devel] [PATCH 16/22] usb-redir: When a packet contains data on a stall, ignore the stall, Hans de Goede, 2012/10/15
[Qemu-devel] [PATCH 17/22] usb-redir: Add support for 32 bits bulk packet length, Hans de Goede, 2012/10/15
[Qemu-devel] [PATCH 12/22] usb: Move short-not-ok handling to the core, Hans de Goede, 2012/10/15
[Qemu-devel] [PATCH 11/22] usb: Move clearing of queue on halt to the core, Hans de Goede, 2012/10/15