Prep version for next release.
[seabios.git] / src / usb-ehci.c
index 1f683c8c8cb452e4d45379534fd5dd18d651cccb..f11924afcf91725bb3c46b7d62d87aeb022c6c91 100644 (file)
@@ -194,10 +194,11 @@ configure_ehci(void *data)
         cmd = readl(&cntl->regs->usbcmd);
         if (!(cmd & CMD_HCRESET))
             break;
-        if (check_time(end)) {
+        if (check_tsc(end)) {
             warn_timeout();
             goto fail;
         }
+        yield();
     }
 
     // Disable interrupts (just to be safe).
@@ -264,6 +265,7 @@ ehci_init(u16 bdf, int busid, int compbdf)
     struct usb_ehci_s *cntl = malloc_tmphigh(sizeof(*cntl));
     memset(cntl, 0, sizeof(*cntl));
     cntl->usb.busid = busid;
+    cntl->usb.bdf = bdf;
     cntl->usb.type = USB_TYPE_EHCI;
     cntl->caps = caps;
     cntl->regs = (void*)caps + readb(&caps->caplength);
@@ -313,7 +315,7 @@ ehci_wait_qh(struct usb_ehci_s *cntl, struct ehci_qh *qh)
         if (qh->qtd_next & EHCI_PTR_TERM)
             // XXX - confirm
             return 0;
-        if (check_time(end)) {
+        if (check_tsc(end)) {
             warn_timeout();
             return -1;
         }
@@ -340,7 +342,7 @@ ehci_waittick(struct usb_ehci_s *cntl)
             if (!(cmd & CMD_IAAD))
                 break;
         }
-        if (check_time(end)) {
+        if (check_tsc(end)) {
             warn_timeout();
             return;
         }
@@ -353,7 +355,7 @@ ehci_waittick(struct usb_ehci_s *cntl)
         sts = readl(&cntl->regs->usbsts);
         if (sts & STS_IAA)
             break;
-        if (check_time(end)) {
+        if (check_tsc(end)) {
             warn_timeout();
             return;
         }
@@ -565,7 +567,7 @@ ehci_wait_td(struct ehci_qtd *td)
         status = td->token;
         if (!(status & QTD_STS_ACTIVE))
             break;
-        if (check_time(end)) {
+        if (check_tsc(end)) {
             warn_timeout();
             return -1;
         }