MdeMdeModulePkg/Ehci: Add logic to dispatch OHCI driver first if the companion controller is OHCI.

Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Elvin Li <elvin.li@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14022 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
erictian 2012-12-25 06:35:11 +00:00
parent b3b1e97b55
commit 51f65b3739
1 changed files with 18 additions and 17 deletions

View File

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