static void
ehci_controller_setup(struct pci_device *pci)
{
- wait_preempt(); // Avoid pci_config_readl when preempting
u16 bdf = pci->bdf;
u32 baseaddr = pci_config_readl(bdf, PCI_BASE_ADDRESS_0);
struct ehci_caps *caps = (void*)(baseaddr & PCI_BASE_ADDRESS_MEM_MASK);
cntl->usb.pci = pci;
cntl->usb.type = USB_TYPE_OHCI;
- wait_preempt(); // Avoid pci_config_readl when preempting
u16 bdf = pci->bdf;
u32 baseaddr = pci_config_readl(bdf, PCI_BASE_ADDRESS_0);
cntl->regs = (void*)(baseaddr & PCI_BASE_ADDRESS_MEM_MASK);
warn_noalloc();
return;
}
- wait_preempt(); // Avoid pci_config_readl when preempting
memset(cntl, 0, sizeof(*cntl));
cntl->usb.pci = pci;
cntl->usb.type = USB_TYPE_UHCI;
}
memset(xhci, 0, sizeof(*xhci));
- wait_preempt(); // Avoid pci_config_readl when preempting
xhci->baseaddr = pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_0)
& PCI_BASE_ADDRESS_MEM_MASK;
xhci->caps = (void*)(xhci->baseaddr);
yield();
}
-void
-__usb_setup(void *data)
-{
- dprintf(3, "init usb\n");
- xhci_setup();
- ehci_setup();
- uhci_setup();
- ohci_setup();
-}
-
void
usb_setup(void)
{
ASSERT32FLAT();
if (! CONFIG_USB)
return;
+ dprintf(3, "init usb\n");
usb_time_sigatt = romfile_loadint("etc/usb-time-sigatt", USB_TIME_SIGATT);
- run_thread(__usb_setup, NULL);
+ xhci_setup();
+ ehci_setup();
+ uhci_setup();
+ ohci_setup();
}