[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/36] xhci: Add a xhci_ep_nuke_one_xfer helper func
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 09/36] xhci: Add a xhci_ep_nuke_one_xfer helper function |
Date: |
Thu, 25 Oct 2012 14:51:42 +0200 |
From: Hans de Goede <address@hidden>
Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/hcd-xhci.c | 49 ++++++++++++++++++++++++++++++-------------------
1 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 37b3dbb..47d5702 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1082,6 +1082,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, waiting for it to complete\n");
+ 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)
{
@@ -1103,25 +1132,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.1
- [Qemu-devel] [PATCH 13/36] usb: Move short-not-ok handling to the core, (continued)
- [Qemu-devel] [PATCH 13/36] usb: Move short-not-ok handling to the core, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 17/36] uhci: cleanup: Add an unlink call to uhci_async_cancel(), Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 25/36] uhci: Immediately free queues on device disconnect, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 14/36] usb: Add an int_req flag to USBPacket, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 36/36] xhci: fix usb name in caps, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 23/36] uhci: Make uhci_fill_queue() actually operate on an UHCIQueue, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 05/36] ehci: Improve latency of interrupt delivery and async schedule scanning, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 24/36] uhci: Store ep in UHCIQueue, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 19/36] uhci: Drop unnecessary forward declaration of some static functions, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 26/36] uhci: Verify queue has not been changed by guest, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 09/36] xhci: Add a xhci_ep_nuke_one_xfer helper function,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 07/36] ehci: Detect going in circles when filling the queue, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 04/36] ehci: Set int flag on a short input packet, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 22/36] uhci: Add uhci_read_td() helper function, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 31/36] uhci: Use only one queue for ctrl endpoints, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 30/36] uhci: Retry to fill the queue while waiting for td completion, Gerd Hoffmann, 2012/10/25
- [Qemu-devel] [PATCH 35/36] xhci: make number of interrupters and slots configurable, Gerd Hoffmann, 2012/10/25
- Re: [Qemu-devel] [PULL 00/36] usb patch queue, Anthony Liguori, 2012/10/29