grml...
[seabios.git] / src / usb-uhci.c
index 47026952b6b57cc2fbd7d3d0d624533ada12078e..a78dbcaf63e679ac55d1c8f3fc11fd93454ec6b0 100644 (file)
@@ -248,13 +248,14 @@ wait_pipe(struct uhci_pipe *pipe, int timeout)
             return 0;
         if (check_tsc(end)) {
             warn_timeout();
+            u16 iobase = GET_FLATPTR(pipe->iobase);
             struct uhci_td *td = (void*)(el_link & ~UHCI_PTR_BITS);
             dprintf(1, "Timeout on wait_pipe %p (td=%p s=%x c=%x/%x)\n"
                     , pipe, (void*)el_link, GET_FLATPTR(td->status)
-                    , inw(pipe->iobase + USBCMD)
-                    , inw(pipe->iobase + USBSTS));
+                    , inw(iobase + USBCMD)
+                    , inw(iobase + USBSTS));
             SET_FLATPTR(pipe->qh.element, UHCI_PTR_TERM);
-            uhci_waittick(pipe->iobase);
+            uhci_waittick(iobase);
             return -1;
         }
         yield();
@@ -483,16 +484,8 @@ uhci_send_bulk(struct usb_pipe *p, int dir, void *data, int datasize)
         data += transfer;
         datasize -= transfer;
     }
-    int i;
-    for (i=0; i<STACKTDS; i++) {
-        struct uhci_td *td = &tds[tdpos++ % STACKTDS];
-        int ret = wait_td(td);
-        if (ret)
-            goto fail;
-    }
-
     SET_FLATPTR(pipe->toggle, !!toggle);
-    return 0;
+    return wait_pipe(pipe, 5000);
 fail:
     dprintf(1, "uhci_send_bulk failed\n");
     SET_FLATPTR(pipe->qh.element, UHCI_PTR_TERM);