From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXtp1-0008SP-NJ for qemu-devel@nongnu.org; Fri, 25 May 2012 08:40:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXtou-0001BX-0E for qemu-devel@nongnu.org; Fri, 25 May 2012 08:40:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXtot-0001A3-OD for qemu-devel@nongnu.org; Fri, 25 May 2012 08:40:39 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4PCec8w010898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 25 May 2012 08:40:38 -0400 From: Gerd Hoffmann Date: Fri, 25 May 2012 14:40:29 +0200 Message-Id: <1337949634-5264-15-git-send-email-kraxel@redhat.com> In-Reply-To: <1337949634-5264-1-git-send-email-kraxel@redhat.com> References: <1337949634-5264-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 13/18] ehci: update status bits in ehci_set_state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Update the status register in the ehci_set_state function, to make sure the guest-visible register is in sync with our internal schedule state. Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-ehci.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index d9c0f0f..0a550f9 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -591,9 +591,19 @@ static void ehci_set_state(EHCIState *s, int async, int state) if (async) { trace_usb_ehci_state("async", state2str(state)); s->astate = state; + if (s->astate == EST_INACTIVE) { + ehci_clear_usbsts(s, USBSTS_ASS); + } else { + ehci_set_usbsts(s, USBSTS_ASS); + } } else { trace_usb_ehci_state("periodic", state2str(state)); s->pstate = state; + if (s->pstate == EST_INACTIVE) { + ehci_clear_usbsts(s, USBSTS_PSS); + } else { + ehci_set_usbsts(s, USBSTS_PSS); + } } } @@ -2170,14 +2180,12 @@ static void ehci_advance_async_state(EHCIState *ehci) if (!ehci_async_enabled(ehci)) { break; } - ehci_set_usbsts(ehci, USBSTS_ASS); ehci_set_state(ehci, async, EST_ACTIVE); // No break, fall through to ACTIVE case EST_ACTIVE: if (!ehci_async_enabled(ehci)) { ehci_queues_rip_all(ehci, async); - ehci_clear_usbsts(ehci, USBSTS_ASS); ehci_set_state(ehci, async, EST_INACTIVE); break; } @@ -2229,7 +2237,6 @@ static void ehci_advance_periodic_state(EHCIState *ehci) switch(ehci_get_state(ehci, async)) { case EST_INACTIVE: if (!(ehci->frindex & 7) && ehci_periodic_enabled(ehci)) { - ehci_set_usbsts(ehci, USBSTS_PSS); ehci_set_state(ehci, async, EST_ACTIVE); // No break, fall through to ACTIVE } else @@ -2238,7 +2245,6 @@ static void ehci_advance_periodic_state(EHCIState *ehci) case EST_ACTIVE: if (!(ehci->frindex & 7) && !ehci_periodic_enabled(ehci)) { ehci_queues_rip_all(ehci, async); - ehci_clear_usbsts(ehci, USBSTS_PSS); ehci_set_state(ehci, async, EST_INACTIVE); break; } -- 1.7.1