[SeaBIOS] [PATCH 4/4] ohci: Update usb command timeouts to use usb_xfer_time()

Kevin O'Connor kevin at koconnor.net
Sat Jun 14 20:08:53 CEST 2014


Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/hw/usb-ohci.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/hw/usb-ohci.c b/src/hw/usb-ohci.c
index d55b64a..f566c4b 100644
--- a/src/hw/usb-ohci.c
+++ b/src/hw/usb-ohci.c
@@ -434,10 +434,9 @@ ohci_alloc_pipe(struct usbdevice_s *usbdev
 }
 
 static int
-wait_ed(struct ohci_ed *ed)
+wait_ed(struct ohci_ed *ed, int timeout)
 {
-    // XXX - 500ms just a guess
-    u32 end = timer_calc(500);
+    u32 end = timer_calc(timeout);
     for (;;) {
         if (ed->hwHeadP == ed->hwTailP)
             return 0;
@@ -497,7 +496,7 @@ ohci_control(struct usb_pipe *p, int dir, const void *cmd, int cmdsize
     pipe->ed.hwINFO &= ~ED_SKIP;
     writel(&cntl->regs->cmdstatus, OHCI_CLF);
 
-    int ret = wait_ed(&pipe->ed);
+    int ret = wait_ed(&pipe->ed, usb_xfer_time(p, datasize));
     pipe->ed.hwINFO |= ED_SKIP;
     if (ret)
         ohci_waittick(cntl);
-- 
1.9.3




More information about the SeaBIOS mailing list