]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
MdeMdeModulePkg/Ehci: Add logic to dispatch OHCI driver first if the companion contro...
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / EhciDxe / Ehci.c
index 787bdc13a022f9cffd4a22f103774ccf8bb001ea..59891b814a5d8ea87c1cdd59d1d197bb3e9ea157 100644 (file)
@@ -6,9 +6,10 @@
   Control, Bulk, Interrupt and Isochronous requests to Usb2.0 device.\r
 \r
   Note that EhciDxe driver is enhanced to guarantee that the EHCI controller get attached\r
-  to the EHCI controller before the UHCI driver attaches to the companion UHCI controller. \r
-  This way avoids the control transfer on a shared port between EHCI and companion host\r
-  controller when UHCI gets attached earlier than EHCI and a USB 2.0 device inserts.\r
+  to the EHCI controller before a UHCI or OHCI driver attaches to the companion UHCI or \r
+  OHCI controller.  This way avoids the control transfer on a shared port between EHCI \r
+  and companion host controller when UHCI or OHCI gets attached earlier than EHCI and a \r
+  USB 2.0 device inserts.\r
 \r
 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
@@ -1403,7 +1404,7 @@ EhcDriverBindingSupported (
   // Test whether the controller belongs to Ehci type\r
   //\r
   if ((UsbClassCReg.BaseCode != PCI_CLASS_SERIAL) || (UsbClassCReg.SubClassCode != PCI_CLASS_SERIAL_USB)\r
-      || ((UsbClassCReg.ProgInterface != PCI_IF_EHCI) && (UsbClassCReg.ProgInterface !=PCI_IF_UHCI))) {\r
+      || ((UsbClassCReg.ProgInterface != PCI_IF_EHCI) && (UsbClassCReg.ProgInterface != PCI_IF_UHCI) && (UsbClassCReg.ProgInterface != PCI_IF_OHCI))) {\r
 \r
     Status = EFI_UNSUPPORTED;\r
   }\r
@@ -1690,10 +1691,10 @@ EhcDriverBindingStart (
   EFI_HANDLE              *HandleBuffer;\r
   UINTN                   NumberOfHandles;\r
   UINTN                   Index;\r
-  UINTN                   UhciSegmentNumber;\r
-  UINTN                   UhciBusNumber;\r
-  UINTN                   UhciDeviceNumber;\r
-  UINTN                   UhciFunctionNumber;\r
+  UINTN                   CompanionSegmentNumber;\r
+  UINTN                   CompanionBusNumber;\r
+  UINTN                   CompanionDeviceNumber;\r
+  UINTN                   CompanionFunctionNumber;\r
   UINTN                   EhciSegmentNumber;\r
   UINTN                   EhciBusNumber;\r
   UINTN                   EhciDeviceNumber;\r
@@ -1783,19 +1784,19 @@ EhcDriverBindingStart (
     goto CLOSE_PCIIO;\r
   }\r
   //\r
-  // determine if the device is UHCI host controller or not. If yes, then find out the \r
+  // Determine if the device is UHCI or OHCI host controller or not. If yes, then find out the \r
   // companion usb ehci host controller and force EHCI driver get attached to it before\r
-  // UHCI driver attaches to UHCI host controller.\r
+  // UHCI or OHCI driver attaches to UHCI or OHCI host controller.\r
   //\r
-  if ((UsbClassCReg.ProgInterface == PCI_IF_UHCI) &&\r
+  if ((UsbClassCReg.ProgInterface == PCI_IF_UHCI || UsbClassCReg.ProgInterface == PCI_IF_OHCI) &&\r
        (UsbClassCReg.BaseCode == PCI_CLASS_SERIAL) && \r
        (UsbClassCReg.SubClassCode == PCI_CLASS_SERIAL_USB)) {\r
     Status = PciIo->GetLocation (\r
                     PciIo,\r
-                    &UhciSegmentNumber,\r
-                    &UhciBusNumber,\r
-                    &UhciDeviceNumber,\r
-                    &UhciFunctionNumber\r
+                    &CompanionSegmentNumber,\r
+                    &CompanionBusNumber,\r
+                    &CompanionDeviceNumber,\r
+                    &CompanionFunctionNumber\r
                     );\r
     if (EFI_ERROR (Status)) {\r
       goto CLOSE_PCIIO;\r
@@ -1853,7 +1854,7 @@ EhcDriverBindingStart (
         // Currently, the judgment on the companion usb host controller is through the\r
         // same bus number, which may vary on different platform.\r
         //\r
-        if (EhciBusNumber == UhciBusNumber) {\r
+        if (EhciBusNumber == CompanionBusNumber) {\r
           gBS->CloseProtocol (\r
                     Controller,\r
                     &gEfiPciIoProtocolGuid,\r
@@ -2081,7 +2082,7 @@ EhcDriverBindingStop (
 \r
   //\r
   // Disable routing of all ports to EHCI controller, so all ports are \r
-  // routed back to the UHCI controller.\r
+  // routed back to the UHCI or OHCI controller.\r
   //\r
   EhcClearOpRegBit (Ehc, EHC_CONFIG_FLAG_OFFSET, CONFIGFLAG_ROUTE_EHC);\r
 \r