From d1e5e7f1df58bd1e6d4561f19b863902fcc51734 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 21 Sep 2012 18:57:28 -0300 Subject: [RHEL6 qemu-kvm PATCH 07/23] ehci: create ehci_update_frindex RH-Author: Hans de Goede Message-id: <1348253864-3050-7-git-send-email-hdegoede@redhat.com> Patchwork-id: 42183 O-Subject: [RHEL-6.4 qemu-kvm PATCH 06/22] ehci: create ehci_update_frindex Bugzilla: 805172 RH-Acked-by: Uri Lublin RH-Acked-by: Arnon Gilboa RH-Acked-by: Gerd Hoffmann From: Gerd Hoffmann Factor out code from ehci_frame_timer. Signed-off-by: Gerd Hoffmann Upstream commit: 6ceced0b2ed52cdfb474d144dce54bf9afa613ce Conflicts: hw/usb-ehci.c --- hw/usb-ehci.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) Signed-off-by: Eduardo Habkost --- hw/usb-ehci.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c index ccf304d..d86a526 100644 --- a/hw/usb-ehci.c +++ b/hw/usb-ehci.c @@ -2115,6 +2115,28 @@ static void ehci_advance_periodic_state(EHCIState *ehci) } } +static void ehci_update_frindex(EHCIState *ehci, int frames) +{ + int i; + + if (ehci->usbsts & USBSTS_HALT) { + return; + } + + for (i = 0; i < frames; i++) { + ehci->frindex += 8; + + if (ehci->frindex == 0x00002000) { + ehci_set_interrupt(ehci, USBSTS_FLR); + } + + if (ehci->frindex == 0x00004000) { + ehci_set_interrupt(ehci, USBSTS_FLR); + ehci->frindex = 0; + } + } +} + static void ehci_frame_timer(void *opaque) { EHCIState *ehci = opaque; @@ -2138,18 +2160,7 @@ static void ehci_frame_timer(void *opaque) ehci->frame_end_usec = usec_now + FRAME_TIMER_USEC - 10; for (i = 0; i < frames; i++) { - if ( !(ehci->usbsts & USBSTS_HALT)) { - ehci->frindex += 8; - - if (ehci->frindex == 0x00002000) { - ehci_set_interrupt(ehci, USBSTS_FLR); - } - - if (ehci->frindex == 0x00004000) { - ehci_set_interrupt(ehci, USBSTS_FLR); - ehci->frindex = 0; - } - } + ehci_update_frindex(ehci, 1); if (frames - i > ehci->maxframes) { skipped_frames++; -- 1.7.11.4