Patchwork [for-1.2,10/11] ehci: Fix interrupt endpoints no longer working

login
register
mail settings
Submitter Gerd Hoffmann
Date Aug. 31, 2012, 2:19 p.m.
Message ID <1346422762-15877-11-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/180976/
State New
Headers show

Comments

Gerd Hoffmann - Aug. 31, 2012, 2:19 p.m.
From: Hans de Goede <hdegoede@redhat.com>

One of the recent changes (likely the addition of queuing support) has broken
interrupt endpoints, this patch fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/usb/hcd-ehci.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index eca1431..017342b 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1987,10 +1987,19 @@  static int ehci_state_fetchqtd(EHCIQueue *q)
         ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH);
         again = 1;
     } else if (p != NULL) {
-        if (p->async == EHCI_ASYNC_INFLIGHT) {
+        switch (p->async) {
+        case EHCI_ASYNC_NONE:
+            /* Previously nacked packet (likely interrupt ep) */
+           ehci_set_state(q->ehci, q->async, EST_EXECUTE);
+           break;
+        case EHCI_ASYNC_INFLIGHT:
+            /* Unfinyshed async handled packet, go horizontal */
             ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH);
-        } else {
+            break;
+        case EHCI_ASYNC_FINISHED:
+            /* Should never happen, as this case is caught by fetchqh */
             ehci_set_state(q->ehci, q->async, EST_EXECUTING);
+            break;
         }
         again = 1;
     } else {