]> xenbits.xensource.com Git - seabios.git/commitdiff
ehci: Only delay UHCI/OHCI port scan until after EHCI setup completes
authorKevin O'Connor <kevin@koconnor.net>
Tue, 2 Feb 2016 19:28:13 +0000 (14:28 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 3 Feb 2016 03:36:41 +0000 (22:36 -0500)
EHCI controller setup needs to occur prior to checking any UHCI or
OHCI ports to ensure a high speed device is not mistakenly configured
on a full speed "companion" controller.  However, only the UHCI/OHCI
port scan needs to be delayed, not the full UHCI/OHCI controller init.

This change moves back the ehci controller setup check until port
scan in UHCI/OHCI.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/hw/usb-ehci.c
src/hw/usb-ehci.h
src/hw/usb-ohci.c
src/hw/usb-uhci.c

index 41f8579ce922a164395460b70fe36ac4885d10ac..a502d36479c87e5eef403a1a929fbd4b1fbd6ab3 100644 (file)
@@ -337,10 +337,14 @@ ehci_setup(void)
         if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_EHCI)
             ehci_controller_setup(pci);
     }
+}
 
-    // 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)
+// Wait for all EHCI controllers to initialize.  This forces OHCI/UHCI
+// setup to always be after any EHCI ports are routed to EHCI.
+void
+ehci_wait_controllers(void)
+{
+    while (CONFIG_USB_EHCI && CONFIG_THREADS && PendingEHCI)
         yield();
 }
 
index 88f7b6a1e95cd77b4c82521b9be7521bbf257f48..0442188b2c645d8af8e96bbef2c984bafbb22a5d 100644 (file)
@@ -3,6 +3,7 @@
 
 // usb-ehci.c
 void ehci_setup(void);
+void ehci_wait_controllers(void);
 struct usbdevice_s;
 struct usb_endpoint_descriptor;
 struct usb_pipe;
index 42f8a0681c77673f959ae500133f18b41277be5d..7ed964f445ac699d0521820a5a5c8e882d40803f 100644 (file)
@@ -14,6 +14,7 @@
 #include "pci_regs.h" // PCI_BASE_ADDRESS_0
 #include "string.h" // memset
 #include "usb.h" // struct usb_s
+#include "usb-ehci.h" // ehci_wait_controllers
 #include "usb-ohci.h" // struct ohci_hcca
 #include "util.h" // msleep
 #include "x86.h" // readl
@@ -96,6 +97,8 @@ static int
 check_ohci_ports(struct usb_ohci_s *cntl)
 {
     ASSERT32FLAT();
+    // Wait for ehci init - in case this is a "companion controller"
+    ehci_wait_controllers();
     // Turn on power for all devices on roothub.
     u32 rha = readl(&cntl->regs->roothub_a);
     rha &= ~(RH_A_PSM | RH_A_OCPM);
index 69c33ee3bda87ec342f2e832adb8b6dbf28a2e16..6d8aa4751924adfee954bd14cfe255f03eefc534 100644 (file)
@@ -13,6 +13,7 @@
 #include "pci_regs.h" // PCI_BASE_ADDRESS_4
 #include "string.h" // memset
 #include "usb.h" // struct usb_s
+#include "usb-ehci.h" // ehci_wait_controllers
 #include "usb-uhci.h" // USBLEGSUP
 #include "util.h" // msleep
 #include "x86.h" // outw
@@ -94,6 +95,9 @@ static int
 check_uhci_ports(struct usb_uhci_s *cntl)
 {
     ASSERT32FLAT();
+    // Wait for ehci init - in case this is a "companion controller"
+    ehci_wait_controllers();
+
     struct usbhub_s hub;
     memset(&hub, 0, sizeof(hub));
     hub.cntl = &cntl->usb;