struct usb_pipe pipe;
};
-static int PendingEHCIPorts;
+static int PendingEHCI;
/****************************************************************
if (!(portsc & PORT_CONNECT))
// No device present
- goto doneearly;
+ return -1;
if ((portsc & PORT_LINESTATUS_MASK) == PORT_LINESTATUS_KSTATE) {
// low speed device
writel(portreg, portsc | PORT_OWNER);
- goto doneearly;
+ return -1;
}
// XXX - if just powered up, need to wait for USB_TIME_ATTDB?
writel(portreg, portsc);
msleep(USB_TIME_DRSTR);
return 0;
-
-doneearly:
- PendingEHCIPorts--;
- return -1;
}
// Reset device on port
writel(portreg, portsc);
msleep(EHCI_TIME_POSTRESET);
- int rv = -1;
portsc = readl(portreg);
if (!(portsc & PORT_CONNECT))
// No longer connected
- goto resetfail;
+ return -1;
if (!(portsc & PORT_PE)) {
// full speed device
writel(portreg, portsc | PORT_OWNER);
- goto resetfail;
+ return -1;
}
- rv = USB_HIGHSPEED;
-resetfail:
- PendingEHCIPorts--;
- return rv;
+ return USB_HIGHSPEED;
}
// Disable port
struct ehci_qh *async_qh = memalign_high(EHCI_QH_ALIGN, sizeof(*async_qh));
if (!fl || !intr_qh || !async_qh) {
warn_noalloc();
+ PendingEHCI--;
goto fail;
}
break;
if (timer_check(end)) {
warn_timeout();
+ PendingEHCI--;
goto fail;
}
yield();
// Set default of high speed for root hub.
writel(&cntl->regs->configflag, 1);
+ PendingEHCI--;
// Find devices
int count = check_ehci_ports(cntl);
cntl->regs = (void*)caps + readb(&caps->caplength);
if (hcc_params & HCC_64BIT_ADDR)
cntl->regs->ctrldssegment = 0;
- PendingEHCIPorts += cntl->checkports;
+ PendingEHCI++;
dprintf(1, "EHCI init on dev %02x:%02x.%x (regs=%p)\n"
, pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf)
ehci_controller_setup(pci);
}
- // Wait for all EHCI ports to initialize. This forces OHCI/UHCI
- // setup to always be after any EHCI ports are set to low speed.
- while (PendingEHCIPorts)
+ // Wait for all EHCI controllers to initialize. This forces OHCI/UHCI
+ // setup to always be after any EHCI ports are routed to EHCI.
+ while (PendingEHCI)
yield();
}