* [Qemu-devel] [PATCH] ehci: honor frame expiration, async list picks up where it left off
@ 2010-07-09 19:19 David Ahern
0 siblings, 0 replies; only message in thread
From: David Ahern @ 2010-07-09 19:19 UTC (permalink / raw)
To: qemu-devel; +Cc: jan.kiszka, David Ahern
Per Section 4 of the EHCI spec the HC should not start transactions that
will not be completed before the end of the micro-frame. For async
lists processing in the next frame should pick up where it left off.
However, when debugging is enabled we need to allow an overrun since the
printfs take too much time.
Signed-off-by: David Ahern <daahern@cisco.com>
---
hw/usb-ehci.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 6e455a2..53ee1fb 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -1308,14 +1308,10 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async, int *state)
int again = 0;
uint32_t entry = ehci->fetch_addr;
-#if 0
- if (qemu_get_clock(vm_clock) / 1000 > ehci->frame_end_usec) {
+#if EHCI_DEBUG == 0
+ if (qemu_get_clock(vm_clock) / 1000 >= ehci->frame_end_usec) {
if (async) {
-/* TO-DO: supposed to be saving the horizontal QH and picking up
- * from there on next frame
- */
- printf("FETCHENTRY: FRAME timer elapsed, exit state machine\n");
- *state = EST_ACTIVE;
+ DPRINTF("FETCHENTRY: FRAME timer elapsed, exit state machine\n");
goto out;
} else {
DPRINTF("FETCHENTRY: WARNING "
@@ -1773,8 +1769,9 @@ static int ehci_advance_state(EHCIState *ehci,
static void ehci_advance_async_state(EHCIState *ehci)
{
EHCIqh qh;
+ int state = ehci->astate;
- switch(ehci->astate) {
+ switch(state) {
case EST_INACTIVE:
if (!(ehci->usbcmd & USBCMD_ASE)) {
break;
@@ -1815,13 +1812,16 @@ static void ehci_advance_async_state(EHCIState *ehci)
break;
}
- ehci->astate = ehci_advance_state(ehci, 1, EST_WAITLISTHEAD);
- break;
+ state = EST_WAITLISTHEAD;
+ /* fall through */
+
+ case EST_FETCHENTRY:
+ /* fall through */
case EST_EXECUTING:
get_dwords(NLPTR_GET(ehci->qhaddr), (uint32_t *) &qh,
sizeof(EHCIqh) >> 2);
- ehci->astate = ehci_advance_state(ehci, 1, EST_EXECUTING);
+ ehci->astate = ehci_advance_state(ehci, 1, state);
break;
default:
@@ -1905,7 +1905,7 @@ static void ehci_frame_timer(void *opaque)
usec_now = t_now / 1000;
usec_elapsed = usec_now - ehci->last_run_usec;
frames = usec_elapsed / FRAME_TIMER_USEC;
- ehci->frame_end_usec = usec_now + FRAME_TIMER_USEC;
+ ehci->frame_end_usec = usec_now + FRAME_TIMER_USEC - 10;
for(i = 0; i < frames; i++) {
if ( !(ehci->usbsts & USBSTS_HALT)) {
--
1.7.1.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-07-09 19:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-09 19:19 [Qemu-devel] [PATCH] ehci: honor frame expiration, async list picks up where it left off David Ahern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).