summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-10-24 18:14:03 +0200
committerHans de Goede <hdegoede@redhat.com>2012-11-04 15:47:35 +0100
commit7a019a2cc9be5520b0cbb6da05d41a9ff2e09576 (patch)
tree120b90d992b6391021b375e31999a9a3ca5d6e3c
parenta37c0403726114014bafa50b16a149bd002532e8 (diff)
ehci: Detect going in circles when filling the queue
For ctrl endpoints Windows (atleast Win7) creates circular td lists, so far these were not a problem because we would stop filling the queue if altnext was set. Since further patches in this patchset remove the altnext check this does become a problem and we need detection for going in circles. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--hw/usb/hcd-ehci.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index b6c50de93..8548bf432 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2073,7 +2073,7 @@ static int ehci_fill_queue(EHCIPacket *p)
{
EHCIQueue *q = p->queue;
EHCIqtd qtd = p->qtd;
- uint32_t qtdaddr;
+ uint32_t qtdaddr, start_addr = p->qtdaddr;
for (;;) {
if (NLPTR_TBIT(qtd.altnext) == 0) {
@@ -2083,6 +2083,13 @@ static int ehci_fill_queue(EHCIPacket *p)
break;
}
qtdaddr = qtd.next;
+ /*
+ * Detect circular td lists, Windows creates these, counting on the
+ * active bit going low after execution to make the queue stop.
+ */
+ if (qtdaddr == start_addr) {
+ break;
+ }
get_dwords(q->ehci, NLPTR_GET(qtdaddr),
(uint32_t *) &qtd, sizeof(EHCIqtd) >> 2);
ehci_trace_qtd(q, NLPTR_GET(qtdaddr), &qtd);