[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/31] usb-ehci: fix error handling.
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 10/31] usb-ehci: fix error handling. |
Date: |
Mon, 6 Jun 2011 14:39:01 +0200 |
Set the correct bits for nodev, stall and babble errors.
Raise errint irq. Fix state transition from WRITEBACK
to the next state.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb-ehci.c | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index cf10dfc..2bbb5e4 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -1114,10 +1114,10 @@ err:
switch(q->usb_status) {
case USB_RET_NODEV:
- fprintf(stderr, "USB no device\n");
+ q->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_XACTERR);
+ ehci_record_interrupt(q->ehci, USBSTS_ERRINT);
break;
case USB_RET_STALL:
- fprintf(stderr, "USB stall\n");
q->qh.token |= QTD_TOKEN_HALT;
ehci_record_interrupt(q->ehci, USBSTS_ERRINT);
break;
@@ -1133,8 +1133,7 @@ err:
}
break;
case USB_RET_BABBLE:
- fprintf(stderr, "USB babble TODO\n");
- q->qh.token |= QTD_TOKEN_BABBLE;
+ q->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_BABBLE);
ehci_record_interrupt(q->ehci, USBSTS_ERRINT);
break;
default:
@@ -1792,15 +1791,21 @@ static int ehci_state_writeback(EHCIQueue *q, int async)
put_dwords(NLPTR_GET(q->qtdaddr),(uint32_t *) &q->qh.next_qtd,
sizeof(EHCIqtd) >> 2);
- /* TODO confirm next state. For now, keep going if async
- * but stop after one qtd if periodic
+ /*
+ * EHCI specs say go horizontal here.
+ *
+ * We can also advance the queue here for performance reasons. We
+ * need to take care to only take that shortcut in case we've
+ * processed the qtd just written back without errors, i.e. halt
+ * bit is clear.
*/
- //if (async) {
+ if (q->qh.token & QTD_TOKEN_HALT) {
+ ehci_set_state(q->ehci, async, EST_HORIZONTALQH);
+ again = 1;
+ } else {
ehci_set_state(q->ehci, async, EST_ADVANCEQUEUE);
again = 1;
- //} else {
- // ehci_set_state(ehci, async, EST_ACTIVE);
- //}
+ }
return again;
}
--
1.7.1
- [Qemu-devel] [PATCH 14/31] Fix USB mouse Set_Protocol behavior, (continued)
[Qemu-devel] [PATCH 12/31] usb: cancel async packets on unplug, Gerd Hoffmann, 2011/06/06
[Qemu-devel] [PATCH 06/31] usb-ehci: trace buffer copy, Gerd Hoffmann, 2011/06/06
[Qemu-devel] [PATCH 09/31] usb-ehci: fix offset writeback in ehci_buffer_rw, Gerd Hoffmann, 2011/06/06
[Qemu-devel] [PATCH 10/31] usb-ehci: fix error handling.,
Gerd Hoffmann <=
[Qemu-devel] [PATCH 05/31] usb-ehci: improve mmio tracing, Gerd Hoffmann, 2011/06/06
[Qemu-devel] [PATCH 08/31] usb-ehci: multiqueue support, Gerd Hoffmann, 2011/06/06
[Qemu-devel] [PATCH 18/31] usb: documentation update, Gerd Hoffmann, 2011/06/06
[Qemu-devel] [PATCH 19/31] usb-linux: Get speed from sysfs rather then from the connectinfo ioctl, Gerd Hoffmann, 2011/06/06
[Qemu-devel] [PATCH 07/31] usb-ehci: add queue data struct, Gerd Hoffmann, 2011/06/06
[Qemu-devel] [PATCH 23/31] usb-linux: Don't try to open the same device twice, Gerd Hoffmann, 2011/06/06
[Qemu-devel] [PATCH 22/31] usb-linux: Ensure devep != 0, Gerd Hoffmann, 2011/06/06
[Qemu-devel] [PATCH 21/31] usb-linux: Don't do perror when errno is not set, Gerd Hoffmann, 2011/06/06