5544c1b
From c84ed39e601ff69d93e0ad81d92cb7234ad5d4cd Mon Sep 17 00:00:00 2001
93b7e38
From: Hans de Goede <hdegoede@redhat.com>
5544c1b
Date: Mon, 10 Sep 2012 12:44:10 +0200
5544c1b
Subject: [PATCH] ehci: Fix interrupts stopping when Interrupt Threshold
5544c1b
 Control is 8
93b7e38
93b7e38
If Interrupt Threshold Control is 8 or a multiple of 8, then
93b7e38
s->usbsts_frindex can become exactly 0x4000, at which point
93b7e38
(s->usbsts_frindex > s->frindex) will never become true, as
93b7e38
s->usbsts_frindex will not be lowered / reset in this case.
93b7e38
93b7e38
This patch fixes this.
93b7e38
93b7e38
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
5544c1b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5544c1b
(cherry picked from commit ffa1f2e088eb7e3d57f2fc35f21e7bdb23e592c5)
5544c1b
5544c1b
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
93b7e38
---
93b7e38
 hw/usb/hcd-ehci.c | 2 +-
93b7e38
 1 file changed, 1 insertion(+), 1 deletion(-)
93b7e38
93b7e38
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
93b7e38
index f5ba8e1..54273d7 100644
93b7e38
--- a/hw/usb/hcd-ehci.c
93b7e38
+++ b/hw/usb/hcd-ehci.c
93b7e38
@@ -2413,7 +2413,7 @@ static void ehci_update_frindex(EHCIState *ehci, int frames)
93b7e38
         if (ehci->frindex == 0x00004000) {
93b7e38
             ehci_raise_irq(ehci, USBSTS_FLR);
93b7e38
             ehci->frindex = 0;
93b7e38
-            if (ehci->usbsts_frindex > 0x00004000) {
93b7e38
+            if (ehci->usbsts_frindex >= 0x00004000) {
93b7e38
                 ehci->usbsts_frindex -= 0x00004000;
93b7e38
             } else {
93b7e38
                 ehci->usbsts_frindex = 0;