1b1995d
From cbb6384d32c4926822ba9216992253deef9ef3b5 Mon Sep 17 00:00:00 2001
1b1995d
From: Hans de Goede <hdegoede@redhat.com>
1b1995d
Date: Fri, 2 Mar 2012 11:02:04 +0100
1b1995d
Subject: [PATCH 131/140] usb-ehci: Rip the queues when the async or period
1b1995d
 schedule is halted
1b1995d
1b1995d
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1b1995d
---
1b1995d
 hw/usb-ehci.c |    5 ++++-
1b1995d
 1 file changed, 4 insertions(+), 1 deletion(-)
1b1995d
1b1995d
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
1b1995d
index b8ba483..11eded7 100644
1b1995d
--- a/hw/usb-ehci.c
1b1995d
+++ b/hw/usb-ehci.c
1b1995d
@@ -1054,7 +1054,8 @@ static void ehci_mem_writel(void *ptr, target_phys_addr_t addr, uint32_t val)
1b1995d
 
1b1995d
         if (!(val & USBCMD_RUNSTOP) && (s->usbcmd & USBCMD_RUNSTOP)) {
1b1995d
             qemu_del_timer(s->frame_timer);
1b1995d
-            // TODO - should finish out some stuff before setting halt
1b1995d
+            ehci_queues_rip_all(s, 0);
1b1995d
+            ehci_queues_rip_all(s, 1);
1b1995d
             ehci_set_usbsts(s, USBSTS_HALT);
1b1995d
         }
1b1995d
 
1b1995d
@@ -2116,6 +2117,7 @@ static void ehci_advance_async_state(EHCIState *ehci)
1b1995d
 
1b1995d
     case EST_ACTIVE:
1b1995d
         if ( !(ehci->usbcmd & USBCMD_ASE)) {
1b1995d
+            ehci_queues_rip_all(ehci, async);
1b1995d
             ehci_clear_usbsts(ehci, USBSTS_ASS);
1b1995d
             ehci_set_state(ehci, async, EST_INACTIVE);
1b1995d
             break;
1b1995d
@@ -2176,6 +2178,7 @@ static void ehci_advance_periodic_state(EHCIState *ehci)
1b1995d
 
1b1995d
     case EST_ACTIVE:
1b1995d
         if ( !(ehci->frindex & 7) && !(ehci->usbcmd & USBCMD_PSE)) {
1b1995d
+            ehci_queues_rip_all(ehci, async);
1b1995d
             ehci_clear_usbsts(ehci, USBSTS_PSS);
1b1995d
             ehci_set_state(ehci, async, EST_INACTIVE);
1b1995d
             break;
1b1995d
-- 
1b1995d
1.7.9.3
1b1995d