[SeaBIOS] [PATCH 2/2] usb: Eliminate USB controller setup thread

Kevin O'Connor kevin at koconnor.net
Tue Feb 2 21:03:37 CET 2016


There are no longer any sleep or yield calls during the usb controller
device scans, so there is no need to run these device scans in a
separate thread.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/hw/usb-ehci.c |  1 -
 src/hw/usb-ohci.c |  1 -
 src/hw/usb-uhci.c |  1 -
 src/hw/usb-xhci.c |  1 -
 src/hw/usb.c      | 16 +++++-----------
 5 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/hw/usb-ehci.c b/src/hw/usb-ehci.c
index 010746c..6cc22a5 100644
--- a/src/hw/usb-ehci.c
+++ b/src/hw/usb-ehci.c
@@ -295,7 +295,6 @@ fail:
 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);
diff --git a/src/hw/usb-ohci.c b/src/hw/usb-ohci.c
index 7ed964f..0c0bf60 100644
--- a/src/hw/usb-ohci.c
+++ b/src/hw/usb-ohci.c
@@ -277,7 +277,6 @@ ohci_controller_setup(struct pci_device *pci)
     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);
diff --git a/src/hw/usb-uhci.c b/src/hw/usb-uhci.c
index 6d8aa47..7a11510 100644
--- a/src/hw/usb-uhci.c
+++ b/src/hw/usb-uhci.c
@@ -250,7 +250,6 @@ uhci_controller_setup(struct pci_device *pci)
         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;
diff --git a/src/hw/usb-xhci.c b/src/hw/usb-xhci.c
index 089cae7..ad541ab 100644
--- a/src/hw/usb-xhci.c
+++ b/src/hw/usb-xhci.c
@@ -534,7 +534,6 @@ xhci_controller_setup(struct pci_device *pci)
     }
     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);
diff --git a/src/hw/usb.c b/src/hw/usb.c
index 2bffd25..20731d1 100644
--- a/src/hw/usb.c
+++ b/src/hw/usb.c
@@ -485,21 +485,15 @@ usb_enumerate(struct usbhub_s *hub)
 }
 
 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();
 }
-- 
2.5.0




More information about the SeaBIOS mailing list