diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-01-23 09:41:04 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-01-23 09:41:04 +0000 |
commit | ea5632e56d882e39ae60e8de85711298f627b9e5 (patch) | |
tree | 12de168f2c93da4506b5c96eb841d6424c38f56e | |
parent | 7113867d543baabb3f0cb0ea42ec735ab9410fb0 (diff) | |
download | edk2-platforms-ea5632e56d882e39ae60e8de85711298f627b9e5.tar.xz |
1. Remove USB HC Protocol installing from Uhci module. It only installs USB2 HC protocol.
2. Restore Incompatible Pci Device Support Protocol in PciBus module.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4617 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf | 5 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 75 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.c | 7 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.h | 18 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/UhciDxe/ComponentName.c | 12 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c | 982 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h | 2 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf | 1 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c | 6 |
9 files changed, 306 insertions, 802 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf index 3e43bc7328..beb9bfcd80 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf @@ -32,8 +32,8 @@ #
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
-# DRIVER_BINDING = gPciBusDriverBinding
-# COMPONENT_NAME = gPciBusComponentName
+# DRIVER_BINDING = gPciBusDriverBinding
+# COMPONENT_NAME = gPciBusComponentName
#
[Sources.common]
@@ -106,6 +106,7 @@ gEfiPciPlatformProtocolGuid # PROTOCOL TO_START
gEfiPciRootBridgeIoProtocolGuid # PROTOCOL TO_START
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
+ gEfiIncompatiblePciDeviceSupportProtocolGuid # PROTOCOL TO_START
[FeaturePcd.common]
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index 4c9c800147..be316effdc 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -1,13 +1,13 @@ /**@file
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -294,9 +294,7 @@ Returns: //
// Update the bar information for this PCI device so as to support some specific device
//
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT) {
- UpdatePciInfo (PciIoDevice);
- }
+ UpdatePciInfo (PciIoDevice);
if (PciIoDevice->DevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -1216,21 +1214,54 @@ Returns: EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
Configuration = NULL;
+ Status = EFI_SUCCESS;
- //
- // Check whether the device belongs to incompatible devices or not
- // If it is , then get its special requirement in the ACPI table
- //
- PciDeviceInfo.VendorID = PciIoDevice->Pci.Hdr.VendorId;
- PciDeviceInfo.DeviceID = PciIoDevice->Pci.Hdr.DeviceId;
- PciDeviceInfo.RevisionID = PciIoDevice->Pci.Hdr.RevisionID;
- PciDeviceInfo.SubsystemVendorID = PciIoDevice->Pci.Device.SubsystemVendorID;
- PciDeviceInfo.SubsystemID = PciIoDevice->Pci.Device.SubsystemID;
+ if (gEfiIncompatiblePciDeviceSupport == NULL) {
+ //
+ // It can only be supported after the Incompatible PCI Device
+ // Support Protocol has been installed
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiIncompatiblePciDeviceSupportProtocolGuid,
+ NULL,
+ (VOID **) &gEfiIncompatiblePciDeviceSupport
+ );
+ }
+ if (Status == EFI_SUCCESS) {
+ //
+ // Check whether the device belongs to incompatible devices from protocol or not
+ // If it is , then get its special requirement in the ACPI table
+ //
+ Status = gEfiIncompatiblePciDeviceSupport->CheckDevice (
+ gEfiIncompatiblePciDeviceSupport,
+ PciIoDevice->Pci.Hdr.VendorId,
+ PciIoDevice->Pci.Hdr.DeviceId,
+ PciIoDevice->Pci.Hdr.RevisionID,
+ PciIoDevice->Pci.Device.SubsystemVendorID,
+ PciIoDevice->Pci.Device.SubsystemID,
+ &Configuration
+ );
- Status = PciResourceUpdateCheck (&PciDeviceInfo, &Configuration);
+ }
if (EFI_ERROR (Status)) {
- return Status;
+ //
+ // Check whether the device belongs to incompatible devices from library or not
+ // If it is , then get its special requirement in the ACPI table
+ //
+ if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT) {
+ PciDeviceInfo.VendorID = PciIoDevice->Pci.Hdr.VendorId;
+ PciDeviceInfo.DeviceID = PciIoDevice->Pci.Hdr.DeviceId;
+ PciDeviceInfo.RevisionID = PciIoDevice->Pci.Hdr.RevisionID;
+ PciDeviceInfo.SubsystemVendorID = PciIoDevice->Pci.Device.SubsystemVendorID;
+ PciDeviceInfo.SubsystemID = PciIoDevice->Pci.Device.SubsystemID;
+
+ Status = PciResourceUpdateCheck (&PciDeviceInfo, &Configuration);
+ }
+ }
+
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
}
//
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.c index ebf817b96f..a8e50fcb28 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.c @@ -27,6 +27,7 @@ EFI_DRIVER_BINDING_PROTOCOL gPciBusDriverBinding = { NULL
};
+EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL *gEfiIncompatiblePciDeviceSupport = NULL;
EFI_HANDLE gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];
UINTN gPciHostBridgeNumber;
BOOLEAN gFullEnumeration;
@@ -215,6 +216,12 @@ Returns: {
EFI_STATUS Status;
+ Status = gBS->LocateProtocol (
+ &gEfiIncompatiblePciDeviceSupportProtocolGuid,
+ NULL,
+ (VOID **) &gEfiIncompatiblePciDeviceSupport
+ );
+
//
// If PCI Platform protocol is available, get it now.
// If the platform implements this, it must be installed before BDS phase
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.h index 448a9dbb16..9db1dde553 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.h @@ -1,13 +1,13 @@ /**@file
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -32,6 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Guid/PciOptionRomTable.h>
#include <Protocol/BusSpecificDriverOverride.h>
#include <Protocol/UgaIo.h>
+#include <Protocol/IncompatiblePciDeviceSupport.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
@@ -237,6 +238,7 @@ typedef struct _PCI_IO_DEVICE { //
// Global Variables
//
+extern EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL *gEfiIncompatiblePciDeviceSupport;
extern EFI_DRIVER_BINDING_PROTOCOL gPciBusDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gPciBusComponentName2;
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/ComponentName.c b/MdeModulePkg/Bus/Pci/UhciDxe/ComponentName.c index 6be0e73b90..732dc6af4f 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/ComponentName.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/ComponentName.c @@ -308,9 +308,9 @@ UhciComponentNameGetControllerName ( OUT CHAR16 **ControllerName
)
{
- EFI_STATUS Status;
- USB_HC_DEV *UhciDev;
- EFI_USB_HC_PROTOCOL *UsbHc;
+ EFI_STATUS Status;
+ USB_HC_DEV *UhciDev;
+ EFI_USB2_HC_PROTOCOL *Usb2Hc;
//
// This is a device driver, so ChildHandle must be NULL.
@@ -336,8 +336,8 @@ UhciComponentNameGetControllerName ( //
Status = gBS->OpenProtocol (
ControllerHandle,
- &gEfiUsbHcProtocolGuid,
- (VOID **) &UsbHc,
+ &gEfiUsb2HcProtocolGuid,
+ (VOID **) &Usb2Hc,
gUhciDriverBinding.DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -347,7 +347,7 @@ UhciComponentNameGetControllerName ( return Status;
}
- UhciDev = UHC_FROM_USB_HC_PROTO (UsbHc);
+ UhciDev = UHC_FROM_USB2_HC_PROTO (Usb2Hc);
return LookupUnicodeString2 (
Language,
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c index b52510041f..487ca0360c 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c @@ -24,32 +24,38 @@ Revision History #include "Uhci.h"
-
/**
- Provides software reset for the USB host controller.
+ Provides software reset for the USB host controller according to UEFI 2.0 spec.
- This : A pointer to the EFI_USB_HC_PROTOCOL instance.
- Attributes: A bit mask of the reset operation to perform.
+ @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
+ @param Attributes A bit mask of the reset operation to perform. See
+ below for a list of the supported bit mask values.
@return EFI_SUCCESS : The reset operation succeeded.
@return EFI_INVALID_PARAMETER : Attributes is not valid.
- @return EFI_DEVICE_ERROR : An error was encountered while attempting
- @return to perform the reset operation.
+ @return EFI_UNSUPPORTED : This type of reset is not currently supported
+ @return EFI_DEVICE_ERROR : Other errors
**/
STATIC
EFI_STATUS
EFIAPI
-UhciReset (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT16 Attributes
+Uhci2Reset (
+ IN EFI_USB2_HC_PROTOCOL *This,
+ IN UINT16 Attributes
)
{
USB_HC_DEV *Uhc;
EFI_TPL OldTpl;
+ if ((Attributes == EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG) ||
+ (Attributes == EFI_USB_HC_RESET_HOST_WITH_DEBUG)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
+
OldTpl = gBS->RaiseTPL (UHCI_TPL);
- Uhc = UHC_FROM_USB_HC_PROTO (This);
switch (Attributes) {
case EFI_USB_HC_RESET_GLOBAL:
@@ -104,23 +110,22 @@ ON_INVAILD_PARAMETER: /**
- Retrieves current state of the USB host controller.
+ Retrieves current state of the USB host controller according to UEFI 2.0 spec.
- This : A pointer to the EFI_USB_HC_PROTOCOL instance.
- State : A pointer to the EFI_USB_HC_STATE data structure that
- indicates current state of the USB host controller.
+ @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
+ @param State Variable to receive current device state
- @return EFI_SUCCESS : State was returned
- @return EFI_INVALID_PARAMETER : State is NULL.
- @return EFI_DEVICE_ERROR : An error was encountered
+ @return EFI_SUCCESS : The state is returned
+ @return EFI_INVALID_PARAMETER : State is not valid.
+ @return EFI_DEVICE_ERROR : Other errors2006
**/
STATIC
EFI_STATUS
EFIAPI
-UhciGetState (
- IN EFI_USB_HC_PROTOCOL *This,
- OUT EFI_USB_HC_STATE *State
+Uhci2GetState (
+ IN CONST EFI_USB2_HC_PROTOCOL *This,
+ OUT EFI_USB_HC_STATE *State
)
{
USB_HC_DEV *Uhc;
@@ -131,7 +136,7 @@ UhciGetState ( return EFI_INVALID_PARAMETER;
}
- Uhc = UHC_FROM_USB_HC_PROTO (This);
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
UsbCmd = UhciReadReg (Uhc->PciIo, USBCMD_OFFSET);
UsbSts = UhciReadReg (Uhc->PciIo, USBSTS_OFFSET);
@@ -151,21 +156,22 @@ UhciGetState ( /**
- Sets the USB host controller to a specific state.
+ Sets the USB host controller to a specific state according to UEFI 2.0 spec.
- This : A pointer to the EFI_USB_HC_PROTOCOL instance.
- State : Indicates the state of the host controller that will be set.
+ @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
+ @param State Indicates the state of the host controller that will
+ be set.
- @return EFI_SUCCESS : The USB host controller was successfully set
+ @return EFI_SUCCESS : Host controller was successfully placed in the state
@return EFI_INVALID_PARAMETER : State is invalid.
- @return EFI_DEVICE_ERROR : Failed to set the state specified
+ @return EFI_DEVICE_ERROR : Failed to set the state
**/
STATIC
EFI_STATUS
EFIAPI
-UhciSetState (
- IN EFI_USB_HC_PROTOCOL *This,
+Uhci2SetState (
+ IN EFI_USB2_HC_PROTOCOL *This,
IN EFI_USB_HC_STATE State
)
{
@@ -175,8 +181,8 @@ UhciSetState ( EFI_STATUS Status;
UINT16 UsbCmd;
- Uhc = UHC_FROM_USB_HC_PROTO (This);
- Status = UhciGetState (This, &CurState);
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
+ Status = Uhci2GetState (This, &CurState);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
@@ -231,7 +237,7 @@ UhciSetState ( break;
case EfiUsbHcStateSuspend:
- Status = UhciSetState (This, EfiUsbHcStateHalt);
+ Status = Uhci2SetState (This, EfiUsbHcStateHalt);
if (EFI_ERROR (Status)) {
Status = EFI_DEVICE_ERROR;
@@ -256,24 +262,29 @@ ON_EXIT: return Status;
}
-
/**
- Retrieves the number of root hub ports.
+ Retrieves capabilities of USB host controller according to UEFI 2.0 spec.
- This : A pointer to the EFI_USB_HC_PROTOCOL instance.
- PortNumber : A pointer to the number of the root hub ports.
+ @param This A pointer to the EFI_USB2_HC_PROTOCOL instance
+ @param MaxSpeed A pointer to the max speed USB host controller
+ supports.
+ @param PortNumber A pointer to the number of root hub ports.
+ @param Is64BitCapable A pointer to an integer to show whether USB host
+ controller supports 64-bit memory addressing.
- @return EFI_SUCCESS : The port number was retrieved successfully.
- @return EFI_INVALID_PARAMETER : PortNumber is NULL.
+ @return EFI_SUCCESS : capabilities were retrieved successfully.
+ @return EFI_INVALID_PARAMETER : MaxSpeed or PortNumber or Is64BitCapable is NULL.
@return EFI_DEVICE_ERROR : An error was encountered
**/
STATIC
EFI_STATUS
EFIAPI
-UhciGetRootHubPortNumber (
- IN EFI_USB_HC_PROTOCOL *This,
- OUT UINT8 *PortNumber
+Uhci2GetCapability (
+ IN EFI_USB2_HC_PROTOCOL *This,
+ OUT UINT8 *MaxSpeed,
+ OUT UINT8 *PortNumber,
+ OUT UINT8 *Is64BitCapable
)
{
USB_HC_DEV *Uhc;
@@ -281,12 +292,15 @@ UhciGetRootHubPortNumber ( UINT16 PortSC;
UINT32 Index;
- Uhc = UHC_FROM_USB_HC_PROTO (This);
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
- if (PortNumber == NULL) {
+ if ((NULL == MaxSpeed) || (NULL == PortNumber) || (NULL == Is64BitCapable)) {
return EFI_INVALID_PARAMETER;
}
+ *MaxSpeed = EFI_USB_SPEED_FULL;
+ *Is64BitCapable = (UINT8) FALSE;
+
*PortNumber = 0;
for (Index = 0; Index < USB_MAX_ROOTHUB_PORT; Index++) {
@@ -306,36 +320,38 @@ UhciGetRootHubPortNumber ( Uhc->RootPorts = *PortNumber;
- UHCI_DEBUG (("UhciGetRootHubPortNumber: %d ports\n", Uhc->RootPorts));
+ UHCI_DEBUG (("Uhci2GetCapability: %d ports\n", Uhc->RootPorts));
return EFI_SUCCESS;
}
/**
- Retrieves the current status of a USB root hub port.
+ Retrieves the current status of a USB root hub port according to UEFI 2.0 spec.
- This : A pointer to the EFI_USB_HC_PROTOCOL.
- PortNumber : Specifies the root hub port. This value is zero-based.
- PortStatus : A pointer to the current port status bits and port status change bits.
+ @param This A pointer to the EFI_USB2_HC_PROTOCOL.
+ @param PortNumber The port to get status
+ @param PortStatus A pointer to the current port status bits and port
+ status change bits.
- @return EFI_SUCCESS : The port status was returned in PortStatus.
+ @return EFI_SUCCESS : status of the USB root hub port was returned in PortStatus.
@return EFI_INVALID_PARAMETER : PortNumber is invalid.
@return EFI_DEVICE_ERROR : Can't read register
**/
+STATIC
EFI_STATUS
EFIAPI
-UhciGetRootHubPortStatus (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS *PortStatus
+Uhci2GetRootHubPortStatus (
+ IN CONST EFI_USB2_HC_PROTOCOL *This,
+ IN CONST UINT8 PortNumber,
+ OUT EFI_USB_PORT_STATUS *PortStatus
)
{
USB_HC_DEV *Uhc;
UINT32 Offset;
UINT16 PortSC;
- Uhc = UHC_FROM_USB_HC_PROTO (This);
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
if (PortStatus == NULL) {
return EFI_INVALID_PARAMETER;
@@ -360,7 +376,7 @@ UhciGetRootHubPortStatus ( }
if (PortSC & USBPORTSC_SUSP) {
- UHCI_DEBUG (("UhciGetRootHubPortStatus: port %d is suspended\n", PortNumber));
+ UHCI_DEBUG (("Uhci2GetRootHubPortStatus: port %d is suspended\n", PortNumber));
PortStatus->PortStatus |= USB_PORT_STAT_SUSPEND;
}
@@ -390,15 +406,15 @@ UhciGetRootHubPortStatus ( /**
- Sets a feature for the specified root hub port.
+ Sets a feature for the specified root hub port according to UEFI 2.0 spec.
- This : A pointer to the EFI_USB_HC_PROTOCOL.
- PortNumber : Specifies the root hub port whose feature
- is requested to be set.
- PortFeature : Indicates the feature selector associated
- with the feature set request.
+ @param This A pointer to the EFI_USB2_HC_PROTOCOL.
+ @param PortNumber Specifies the root hub port whose feature is
+ requested to be set.
+ @param PortFeature Indicates the feature selector associated with the
+ feature set request.
- @return EFI_SUCCESS : The feature was set for the port.
+ @return EFI_SUCCESS : PortFeature was set for the root port
@return EFI_INVALID_PARAMETER : PortNumber is invalid or PortFeature is invalid.
@return EFI_DEVICE_ERROR : Can't read register
@@ -406,10 +422,10 @@ UhciGetRootHubPortStatus ( STATIC
EFI_STATUS
EFIAPI
-UhciSetRootHubPortFeature (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
+Uhci2SetRootHubPortFeature (
+ IN EFI_USB2_HC_PROTOCOL *This,
+ IN UINT8 PortNumber,
+ IN EFI_USB_PORT_FEATURE PortFeature
)
{
USB_HC_DEV *Uhc;
@@ -418,7 +434,7 @@ UhciSetRootHubPortFeature ( UINT16 PortSC;
UINT16 Command;
- Uhc = UHC_FROM_USB_HC_PROTO (This);
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
if (PortNumber >= Uhc->RootPorts) {
return EFI_INVALID_PARAMETER;
@@ -470,15 +486,15 @@ UhciSetRootHubPortFeature ( /**
- Clears a feature for the specified root hub port.
+ Clears a feature for the specified root hub port according to Uefi 2.0 spec.
- This : A pointer to the EFI_USB_HC_PROTOCOL instance.
- PortNumber : Specifies the root hub port whose feature
- is requested to be cleared.
- PortFeature : Indicates the feature selector associated with the
- feature clear request.
+ @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
+ @param PortNumber Specifies the root hub port whose feature is
+ requested to be cleared.
+ @param PortFeature Indicates the feature selector associated with the
+ feature clear request.
- @return EFI_SUCCESS : The feature was cleared for the port.
+ @return EFI_SUCCESS : PortFeature was cleared for the USB root hub port
@return EFI_INVALID_PARAMETER : PortNumber is invalid or PortFeature is invalid.
@return EFI_DEVICE_ERROR : Can't read register
@@ -486,10 +502,10 @@ UhciSetRootHubPortFeature ( STATIC
EFI_STATUS
EFIAPI
-UhciClearRootHubPortFeature (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
+Uhci2ClearRootHubPortFeature (
+ IN EFI_USB2_HC_PROTOCOL *This,
+ IN UINT8 PortNumber,
+ IN EFI_USB_PORT_FEATURE PortFeature
)
{
USB_HC_DEV *Uhc;
@@ -497,7 +513,7 @@ UhciClearRootHubPortFeature ( UINT32 Offset;
UINT16 PortSC;
- Uhc = UHC_FROM_USB_HC_PROTO (This);
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
if (PortNumber >= Uhc->RootPorts) {
return EFI_INVALID_PARAMETER;
@@ -574,21 +590,21 @@ UhciClearRootHubPortFeature ( /**
- Submits control transfer to a target USB device.
+ Submits control transfer to a target USB device accroding to UEFI 2.0 spec..
- This : A pointer to the EFI_USB_HC_PROTOCOL instance.
- DeviceAddress : Usb device address
- IsSlowDevice : Whether the device is of slow speed or full speed
- MaximumPacketLength : maximum packet size of the default control endpoint
+ This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
+ DeviceAddress : Target device address
+ DeviceSpeed : Device speed
+ MaximumPacketLength : Maximum packet size of the target endpoint
Request : USB device request to send
- TransferDirection : Specifies the data direction for the transfer.
- Data : Data buffer to transmit from or receive into
- DataLength : Number of bytes of the data
- TimeOut : Maximum time, in microseconds
- TransferResult : Return result in this
+ TransferDirection : Data direction of the Data stage in control transfer
+ Data : Data to transmit/receive in data stage
+ DataLength : Length of the data
+ TimeOut : Maximum time, in microseconds, for transfer to complete.
+ TransferResult : Variable to receive the transfer result
- @return EFI_SUCCESS : Transfer was completed successfully.
- @return EFI_OUT_OF_RESOURCES : Failed due to a lack of resources.
+ @return EFI_SUCCESS : The control transfer was completed successfully.
+ @return EFI_OUT_OF_RESOURCES : Failed due to lack of resource.
@return EFI_INVALID_PARAMETER : Some parameters are invalid.
@return EFI_TIMEOUT : Failed due to timeout.
@return EFI_DEVICE_ERROR : Failed due to host controller or device error.
@@ -597,17 +613,18 @@ UhciClearRootHubPortFeature ( STATIC
EFI_STATUS
EFIAPI
-UhciControlTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN BOOLEAN IsSlowDevice,
- IN UINT8 MaximumPacketLength,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data, OPTIONAL
- IN OUT UINTN *DataLength, OPTIONAL
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
+Uhci2ControlTransfer (
+ IN EFI_USB2_HC_PROTOCOL *This,
+ IN UINT8 DeviceAddress,
+ IN UINT8 DeviceSpeed,
+ IN UINTN MaximumPacketLength,
+ IN EFI_USB_DEVICE_REQUEST *Request,
+ IN EFI_USB_DATA_DIRECTION TransferDirection,
+ IN OUT VOID *Data,
+ IN OUT UINTN *DataLength,
+ IN UINTN TimeOut,
+ IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
+ OUT UINT32 *TransferResult
)
{
USB_HC_DEV *Uhc;
@@ -620,14 +637,17 @@ UhciControlTransfer ( VOID *RequestMap;
UINT8 *DataPhy;
VOID *DataMap;
+ BOOLEAN IsSlowDevice;
- Uhc = UHC_FROM_USB_HC_PROTO (This);
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
TDs = NULL;
DataPhy = NULL;
DataMap = NULL;
RequestPhy = NULL;
RequestMap = NULL;
+ IsSlowDevice = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
+
//
// Parameters Checking
//
@@ -688,7 +708,7 @@ UhciControlTransfer ( RequestPhy,
DataPhy,
*DataLength,
- MaximumPacketLength,
+ (UINT8) MaximumPacketLength,
IsSlowDevice
);
@@ -726,18 +746,23 @@ ON_EXIT: }
+
/**
- Submits bulk transfer to a bulk endpoint of a USB device.
+ Submits bulk transfer to a bulk endpoint of a USB device
- This :A pointer to the EFI_USB_HC_PROTOCOL instance.
- DeviceAddress : Usb device address
- EndPointAddress : Endpoint number and endpoint direction
+ This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
+ DeviceAddress : Target device address
+ EndPointAddress : Endpoint number and direction
+ DeviceSpeed : Device speed
MaximumPacketLength : Maximum packet size of the target endpoint
- Data : Data buffer to transmit from or receive into
- DataLength : Length of the data buffer
- DataToggle : On input, data toggle to use, on output, the next toggle
- TimeOut : Indicates the maximum time
- TransferResult : Variable to receive the transfer result
+ DataBuffersNumber : Number of data buffers prepared for the transfer.
+ Data : Array of pointers to the buffers of data
+ DataLength : On input, size of the data buffer, On output,
+ actually transferred data size.
+ DataToggle : On input, data toggle to use; On output, next data toggle
+ Translator : A pointr to the transaction translator data.
+ TimeOut : Maximum time out, in microseconds
+ TransferResult : Variable to receive transfer result
@return EFI_SUCCESS : The bulk transfer was completed successfully.
@return EFI_OUT_OF_RESOURCES : Failed due to lack of resource.
@@ -749,16 +774,19 @@ ON_EXIT: STATIC
EFI_STATUS
EFIAPI
-UhciBulkTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
+Uhci2BulkTransfer (
+ IN EFI_USB2_HC_PROTOCOL *This,
+ IN UINT8 DeviceAddress,
+ IN UINT8 EndPointAddress,
+ IN UINT8 DeviceSpeed,
+ IN UINTN MaximumPacketLength,
+ IN UINT8 DataBuffersNumber,
+ IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
+ IN OUT UINTN *DataLength,
+ IN OUT UINT8 *DataToggle,
+ IN UINTN TimeOut,
+ IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
+ OUT UINT32 *TransferResult
)
{
EFI_USB_DATA_DIRECTION Direction;
@@ -772,10 +800,14 @@ UhciBulkTransfer ( UINT8 *DataPhy;
VOID *DataMap;
- Uhc = UHC_FROM_USB_HC_PROTO (This);
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
DataPhy = NULL;
DataMap = NULL;
+ if (DeviceSpeed == EFI_USB_SPEED_LOW) {
+ return EFI_INVALID_PARAMETER;
+ }
+
if ((DataLength == NULL) || (Data == NULL) || (TransferResult == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -818,7 +850,7 @@ UhciBulkTransfer ( Direction = EfiUsbDataOut;
}
- Status = UhciMapUserData (Uhc, Direction, Data, DataLength, &PktId, &DataPhy, &DataMap);
+ Status = UhciMapUserData (Uhc, Direction, *Data, DataLength, &PktId, &DataPhy, &DataMap);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
@@ -833,7 +865,7 @@ UhciBulkTransfer ( DataPhy,
*DataLength,
DataToggle,
- MaximumPacketLength,
+ (UINT8) MaximumPacketLength,
FALSE
);
@@ -870,45 +902,49 @@ ON_EXIT: /**
- Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.
+ Submits an asynchronous interrupt transfer to an
+ interrupt endpoint of a USB device according to UEFI 2.0 spec.
- This : A pointer to the EFI_USB_HC_PROTOCOL instance.
+ This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
DeviceAddress : Target device address
- EndPointAddress : Endpoint number with direction
- IsSlowDevice : Whether the target device is slow device or full-speed device.
+ EndPointAddress : Endpoint number and direction
+ DeviceSpeed : Device speed
MaximumPacketLength : Maximum packet size of the target endpoint
- IsNewTransfer : If TRUE, submit a new async interrupt transfer, otherwise
- cancel an existed one
- DataToggle : On input, the data toggle to use; On output, next data toggle
+ IsNewTransfer : If TRUE, submit a new transfer, if FALSE cancel old transfer
+ DataToggle : On input, data toggle to use; On output, next data toggle
PollingInterval : Interrupt poll rate in milliseconds
- DataLength : Length of data to receive
+ DataLength : On input, size of the data buffer, On output,
+ actually transferred data size.
+ Translator : A pointr to the transaction translator data.
CallBackFunction : Function to call periodically
Context : User context
- @return EFI_SUCCESS : Request is submitted or cancelled
+ @return EFI_SUCCESS : Transfer was submitted
@return EFI_INVALID_PARAMETER : Some parameters are invalid.
@return EFI_OUT_OF_RESOURCES : Failed due to a lack of resources.
- @return EFI_DEVICE_ERROR : Failed to due to device error
+ @return EFI_DEVICE_ERROR : Can't read register
**/
STATIC
EFI_STATUS
EFIAPI
-UhciAsyncInterruptTransfer (
- IN EFI_USB_HC_PROTOCOL * This,
+Uhci2AsyncInterruptTransfer (
+ IN EFI_USB2_HC_PROTOCOL *This,
IN UINT8 DeviceAddress,
IN UINT8 EndPointAddress,
- IN BOOLEAN IsSlowDevice,
- IN UINT8 MaximumPacketLength,
+ IN UINT8 DeviceSpeed,
+ IN UINTN MaximumPacketLength,
IN BOOLEAN IsNewTransfer,
IN OUT UINT8 *DataToggle,
- IN UINTN PollingInterval, OPTIONAL
- IN UINTN DataLength, OPTIONAL
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction, OPTIONAL
- IN VOID *Context OPTIONAL
+ IN UINTN PollingInterval,
+ IN UINTN DataLength,
+ IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
+ IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
+ IN VOID *Context
)
{
USB_HC_DEV *Uhc;
+ BOOLEAN IsSlowDevice;
UHCI_QH_SW *Qh;
UHCI_TD_SW *IntTds;
EFI_TPL OldTpl;
@@ -918,13 +954,15 @@ UhciAsyncInterruptTransfer ( VOID *DataMap;
UINT8 PktId;
- Uhc = UHC_FROM_USB_HC_PROTO (This);
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
Qh = NULL;
IntTds = NULL;
DataPtr = NULL;
DataPhy = NULL;
DataMap = NULL;
+ IsSlowDevice = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
+
if ((EndPointAddress & 0x80) == 0) {
return EFI_INVALID_PARAMETER;
}
@@ -1006,7 +1044,7 @@ UhciAsyncInterruptTransfer ( DataPhy,
DataLength,
DataToggle,
- MaximumPacketLength,
+ (UINT8) MaximumPacketLength,
IsSlowDevice
);
@@ -1059,43 +1097,46 @@ FREE_DATA: return Status;
}
-
/**
- Submits synchronous interrupt transfer to an interrupt endpoint of a USB device.
+ Submits synchronous interrupt transfer to an interrupt endpoint
+ of a USB device according to UEFI 2.0 spec.
- This : A pointer to the EFI_USB_HC_PROTOCOL instance.
- DeviceAddress : Device address of the target USB device
+ This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
+ DeviceAddress : Target device address
EndPointAddress : Endpoint number and direction
- IsSlowDevice : Whether the target device is of slow speed or full speed
- MaximumPacketLength : Maximum packet size of target endpoint
- Data : Data to transmit or receive
- DataLength : On input, data length to transmit or buffer size.
- On output, the number of bytes transferred.
+ DeviceSpeed : Device speed
+ MaximumPacketLength : Maximum packet size of the target endpoint
+ DataBuffersNumber : Number of data buffers prepared for the transfer.
+ Data : Array of pointers to the buffers of data
+ DataLength : On input, size of the data buffer, On output,
+ actually transferred data size.
DataToggle : On input, data toggle to use; On output, next data toggle
- TimeOut : Maximum time, in microseconds, transfer is allowed to complete.
+ TimeOut : Maximum time out, in microseconds
+ Translator : A pointr to the transaction translator data.
TransferResult : Variable to receive transfer result
- @return EFI_SUCCESS : Transfer was completed successfully.
+ @return EFI_SUCCESS : The transfer was completed successfully.
@return EFI_OUT_OF_RESOURCES : Failed due to lack of resource.
@return EFI_INVALID_PARAMETER : Some parameters are invalid.
@return EFI_TIMEOUT : Failed due to timeout.
- @return EFI_DEVICE_ERROR : Failed due to host controller or device error
+ @return EFI_DEVICE_ERROR : Failed due to host controller or device error.
**/
STATIC
EFI_STATUS
EFIAPI
-UhciSyncInterruptTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN BOOLEAN IsSlowDevice,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
+Uhci2SyncInterruptTransfer (
+ IN EFI_USB2_HC_PROTOCOL *This,
+ IN UINT8 DeviceAddress,
+ IN UINT8 EndPointAddress,
+ IN UINT8 DeviceSpeed,
+ IN UINTN MaximumPacketLength,
+ IN OUT VOID *Data,
+ IN OUT UINTN *DataLength,
+ IN OUT UINT8 *DataToggle,
+ IN UINTN TimeOut,
+ IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
+ OUT UINT32 *TransferResult
)
{
EFI_STATUS Status;
@@ -1106,12 +1147,19 @@ UhciSyncInterruptTransfer ( UINT8 *DataPhy;
VOID *DataMap;
UINT8 PktId;
+ BOOLEAN IsSlowDevice;
- Uhc = UHC_FROM_USB_HC_PROTO (This);
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
DataPhy = NULL;
DataMap = NULL;
TDs = NULL;
+ if (DeviceSpeed == EFI_USB_SPEED_HIGH) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ IsSlowDevice = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
+
if ((DataLength == NULL) || (Data == NULL) || (TransferResult == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -1170,7 +1218,7 @@ UhciSyncInterruptTransfer ( DataPhy,
*DataLength,
DataToggle,
- MaximumPacketLength,
+ (UINT8) MaximumPacketLength,
IsSlowDevice
);
@@ -1203,546 +1251,6 @@ ON_EXIT: /**
- Submits isochronous transfer to a target USB device.
-
- This : A pointer to the EFI_USB_HC_PROTOCOL instance.
- DeviceAddress : Target device address
- EndPointAddress : End point address withdirection
- MaximumPacketLength : Maximum packet size of the endpoint
- Data : Data to transmit or receive
- DataLength : Bytes of the data
- TransferResult : Variable to receive the result
-
- @return EFI_UNSUPPORTED
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-UhciIsochronousTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN UINTN DataLength,
- OUT UINT32 *TransferResult
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-
-/**
- Submits Async isochronous transfer to a target USB device.
-
- This : A pointer to the EFI_USB_HC_PROTOCOL instance.
- DeviceAddress : Target device address
- EndPointAddress : End point address withdirection
- MaximumPacketLength : Maximum packet size of the endpoint
- Data : Data to transmit or receive
- IsochronousCallBack : Function to call when the transfer completes
- Context : User context
-
- @return EFI_UNSUPPORTED
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-UhciAsyncIsochronousTransfer (
- IN EFI_USB_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN UINTN DataLength,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
- IN VOID *Context OPTIONAL
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-
-
-/**
- Provides software reset for the USB host controller according to UEFI 2.0 spec.
-
- @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
- @param Attributes A bit mask of the reset operation to perform. See
- below for a list of the supported bit mask values.
-
- @return EFI_SUCCESS : The reset operation succeeded.
- @return EFI_INVALID_PARAMETER : Attributes is not valid.
- @return EFI_UNSUPPORTED : This type of reset is not currently supported
- @return EFI_DEVICE_ERROR : Other errors
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Uhci2Reset (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT16 Attributes
- )
-{
- USB_HC_DEV *UhciDev;
-
- UhciDev = UHC_FROM_USB2_HC_PROTO (This);
-
- if ((Attributes == EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG) ||
- (Attributes == EFI_USB_HC_RESET_HOST_WITH_DEBUG)) {
- return EFI_UNSUPPORTED;
- }
-
- return UhciReset (&UhciDev->UsbHc, Attributes);
-}
-
-
-/**
- Retrieves current state of the USB host controller according to UEFI 2.0 spec.
-
- @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
- @param State Variable to receive current device state
-
- @return EFI_SUCCESS : The state is returned
- @return EFI_INVALID_PARAMETER : State is not valid.
- @return EFI_DEVICE_ERROR : Other errors2006
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Uhci2GetState (
- IN CONST EFI_USB2_HC_PROTOCOL *This,
- OUT EFI_USB_HC_STATE *State
- )
-{
- USB_HC_DEV *Uhc;
-
- Uhc = UHC_FROM_USB2_HC_PROTO (This);
- return UhciGetState (&Uhc->UsbHc, State);
-}
-
-
-/**
- Sets the USB host controller to a specific state according to UEFI 2.0 spec.
-
- @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
- @param State Indicates the state of the host controller that will
- be set.
-
- @return EFI_SUCCESS : Host controller was successfully placed in the state
- @return EFI_INVALID_PARAMETER : State is invalid.
- @return EFI_DEVICE_ERROR : Failed to set the state
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Uhci2SetState (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN EFI_USB_HC_STATE State
- )
-{
- USB_HC_DEV *Uhc;
-
- Uhc = UHC_FROM_USB2_HC_PROTO (This);
- return UhciSetState (&Uhc->UsbHc, State);
-}
-
-
-/**
- Retrieves capabilities of USB host controller according to UEFI 2.0 spec.
-
- @param This A pointer to the EFI_USB2_HC_PROTOCOL instance
- @param MaxSpeed A pointer to the max speed USB host controller
- supports.
- @param PortNumber A pointer to the number of root hub ports.
- @param Is64BitCapable A pointer to an integer to show whether USB host
- controller supports 64-bit memory addressing.
-
- @return EFI_SUCCESS : capabilities were retrieved successfully.
- @return EFI_INVALID_PARAMETER : MaxSpeed or PortNumber or Is64BitCapable is NULL.
- @return EFI_DEVICE_ERROR : An error was encountered
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Uhci2GetCapability (
- IN EFI_USB2_HC_PROTOCOL *This,
- OUT UINT8 *MaxSpeed,
- OUT UINT8 *PortNumber,
- OUT UINT8 *Is64BitCapable
- )
-{
- USB_HC_DEV *Uhc;
-
- Uhc = UHC_FROM_USB2_HC_PROTO (This);
-
- if ((NULL == MaxSpeed) || (NULL == PortNumber) || (NULL == Is64BitCapable)) {
- return EFI_INVALID_PARAMETER;
- }
-
- *MaxSpeed = EFI_USB_SPEED_FULL;
- *Is64BitCapable = (UINT8) FALSE;
-
- return UhciGetRootHubPortNumber (&Uhc->UsbHc, PortNumber);
-}
-
-
-/**
- Retrieves the current status of a USB root hub port according to UEFI 2.0 spec.
-
- @param This A pointer to the EFI_USB2_HC_PROTOCOL.
- @param PortNumber The port to get status
- @param PortStatus A pointer to the current port status bits and port
- status change bits.
-
- @return EFI_SUCCESS : status of the USB root hub port was returned in PortStatus.
- @return EFI_INVALID_PARAMETER : PortNumber is invalid.
- @return EFI_DEVICE_ERROR : Can't read register
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Uhci2GetRootHubPortStatus (
- IN CONST EFI_USB2_HC_PROTOCOL *This,
- IN CONST UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS *PortStatus
- )
-{
- USB_HC_DEV *Uhc;
-
- Uhc = UHC_FROM_USB2_HC_PROTO (This);
-
- return UhciGetRootHubPortStatus (&Uhc->UsbHc, PortNumber, PortStatus);
-}
-
-
-/**
- Sets a feature for the specified root hub port according to UEFI 2.0 spec.
-
- @param This A pointer to the EFI_USB2_HC_PROTOCOL.
- @param PortNumber Specifies the root hub port whose feature is
- requested to be set.
- @param PortFeature Indicates the feature selector associated with the
- feature set request.
-
- @return EFI_SUCCESS : PortFeature was set for the root port
- @return EFI_INVALID_PARAMETER : PortNumber is invalid or PortFeature is invalid.
- @return EFI_DEVICE_ERROR : Can't read register
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Uhci2SetRootHubPortFeature (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-{
- USB_HC_DEV *Uhc;
-
- Uhc = UHC_FROM_USB2_HC_PROTO (This);
-
- return UhciSetRootHubPortFeature (&Uhc->UsbHc, PortNumber, PortFeature);
-}
-
-
-/**
- Clears a feature for the specified root hub port according to Uefi 2.0 spec.
-
- @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
- @param PortNumber Specifies the root hub port whose feature is
- requested to be cleared.
- @param PortFeature Indicates the feature selector associated with the
- feature clear request.
-
- @return EFI_SUCCESS : PortFeature was cleared for the USB root hub port
- @return EFI_INVALID_PARAMETER : PortNumber is invalid or PortFeature is invalid.
- @return EFI_DEVICE_ERROR : Can't read register
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Uhci2ClearRootHubPortFeature (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-{
- USB_HC_DEV *Uhc;
-
- Uhc = UHC_FROM_USB2_HC_PROTO (This);
-
- return UhciClearRootHubPortFeature (&Uhc->UsbHc, PortNumber, PortFeature);
-}
-
-
-/**
- Submits control transfer to a target USB device accroding to UEFI 2.0 spec..
-
- This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
- DeviceAddress : Target device address
- DeviceSpeed : Device speed
- MaximumPacketLength : Maximum packet size of the target endpoint
- Request : USB device request to send
- TransferDirection : Data direction of the Data stage in control transfer
- Data : Data to transmit/receive in data stage
- DataLength : Length of the data
- TimeOut : Maximum time, in microseconds, for transfer to complete.
- TransferResult : Variable to receive the transfer result
-
- @return EFI_SUCCESS : The control transfer was completed successfully.
- @return EFI_OUT_OF_RESOURCES : Failed due to lack of resource.
- @return EFI_INVALID_PARAMETER : Some parameters are invalid.
- @return EFI_TIMEOUT : Failed due to timeout.
- @return EFI_DEVICE_ERROR : Failed due to host controller or device error.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Uhci2ControlTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-{
- USB_HC_DEV *Uhc;
- BOOLEAN IsSlow;
-
- Uhc = UHC_FROM_USB2_HC_PROTO (This);
- IsSlow = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
-
- return UhciControlTransfer (
- &Uhc->UsbHc,
- DeviceAddress,
- IsSlow,
- (UINT8) MaximumPacketLength,
- Request,
- TransferDirection,
- Data,
- DataLength,
- TimeOut,
- TransferResult
- );
-}
-
-
-/**
- Submits bulk transfer to a bulk endpoint of a USB device
-
- This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
- DeviceAddress : Target device address
- EndPointAddress : Endpoint number and direction
- DeviceSpeed : Device speed
- MaximumPacketLength : Maximum packet size of the target endpoint
- DataBuffersNumber : Number of data buffers prepared for the transfer.
- Data : Array of pointers to the buffers of data
- DataLength : On input, size of the data buffer, On output,
- actually transferred data size.
- DataToggle : On input, data toggle to use; On output, next data toggle
- Translator : A pointr to the transaction translator data.
- TimeOut : Maximum time out, in microseconds
- TransferResult : Variable to receive transfer result
-
- @return EFI_SUCCESS : The bulk transfer was completed successfully.
- @return EFI_OUT_OF_RESOURCES : Failed due to lack of resource.
- @return EFI_INVALID_PARAMETER : Some parameters are invalid.
- @return EFI_TIMEOUT : Failed due to timeout.
- @return EFI_DEVICE_ERROR : Failed due to host controller or device error.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Uhci2BulkTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-{
- USB_HC_DEV *Uhc;
-
- Uhc = UHC_FROM_USB2_HC_PROTO (This);
-
- if (Data == NULL || DeviceSpeed == EFI_USB_SPEED_LOW) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // For full-speed bulk transfers only the data pointed by Data[0] shall be used
- //
- return UhciBulkTransfer (
- &Uhc->UsbHc,
- DeviceAddress,
- EndPointAddress,
- (UINT8) MaximumPacketLength,
- *Data,
- DataLength,
- DataToggle,
- TimeOut,
- TransferResult
- );
-}
-
-
-/**
- Submits an asynchronous interrupt transfer to an
- interrupt endpoint of a USB device according to UEFI 2.0 spec.
-
- This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
- DeviceAddress : Target device address
- EndPointAddress : Endpoint number and direction
- DeviceSpeed : Device speed
- MaximumPacketLength : Maximum packet size of the target endpoint
- IsNewTransfer : If TRUE, submit a new transfer, if FALSE cancel old transfer
- DataToggle : On input, data toggle to use; On output, next data toggle
- PollingInterval : Interrupt poll rate in milliseconds
- DataLength : On input, size of the data buffer, On output,
- actually transferred data size.
- Translator : A pointr to the transaction translator data.
- CallBackFunction : Function to call periodically
- Context : User context
-
- @return EFI_SUCCESS : Transfer was submitted
- @return EFI_INVALID_PARAMETER : Some parameters are invalid.
- @return EFI_OUT_OF_RESOURCES : Failed due to a lack of resources.
- @return EFI_DEVICE_ERROR : Can't read register
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Uhci2AsyncInterruptTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN BOOLEAN IsNewTransfer,
- IN OUT UINT8 *DataToggle,
- IN UINTN PollingInterval,
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
- IN VOID *Context
- )
-{
- USB_HC_DEV *Uhc;
- BOOLEAN IsSlow;
-
- Uhc = UHC_FROM_USB2_HC_PROTO (This);
- IsSlow = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
-
- return UhciAsyncInterruptTransfer (
- &Uhc->UsbHc,
- DeviceAddress,
- EndPointAddress,
- IsSlow,
- (UINT8) MaximumPacketLength,
- IsNewTransfer,
- DataToggle,
- PollingInterval,
- DataLength,
- CallBackFunction,
- Context
- );
-}
-
-
-/**
- Submits synchronous interrupt transfer to an interrupt endpoint
- of a USB device according to UEFI 2.0 spec.
-
- This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
- DeviceAddress : Target device address
- EndPointAddress : Endpoint number and direction
- DeviceSpeed : Device speed
- MaximumPacketLength : Maximum packet size of the target endpoint
- DataBuffersNumber : Number of data buffers prepared for the transfer.
- Data : Array of pointers to the buffers of data
- DataLength : On input, size of the data buffer, On output,
- actually transferred data size.
- DataToggle : On input, data toggle to use; On output, next data toggle
- TimeOut : Maximum time out, in microseconds
- Translator : A pointr to the transaction translator data.
- TransferResult : Variable to receive transfer result
-
- @return EFI_SUCCESS : The transfer was completed successfully.
- @return EFI_OUT_OF_RESOURCES : Failed due to lack of resource.
- @return EFI_INVALID_PARAMETER : Some parameters are invalid.
- @return EFI_TIMEOUT : Failed due to timeout.
- @return EFI_DEVICE_ERROR : Failed due to host controller or device error.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Uhci2SyncInterruptTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-{
- USB_HC_DEV *Uhc;
- BOOLEAN IsSlow;
-
- if (DeviceSpeed == EFI_USB_SPEED_HIGH) {
- return EFI_INVALID_PARAMETER;
- }
-
- Uhc = UHC_FROM_USB2_HC_PROTO (This);
- IsSlow = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
-
- return UhciSyncInterruptTransfer (
- &Uhc->UsbHc,
- DeviceAddress,
- EndPointAddress,
- IsSlow,
- (UINT8) MaximumPacketLength,
- Data,
- DataLength,
- DataToggle,
- TimeOut,
- TransferResult
- );
-}
-
-
-/**
Submits isochronous transfer to a target USB device according to UEFI 2.0 spec.
This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
@@ -1959,22 +1467,6 @@ UhciAllocateDev ( // USB_HC_PROTOCOL is for EFI 1.1 backward compability.
//
Uhc->Signature = USB_HC_DEV_SIGNATURE;
- Uhc->UsbHc.Reset = UhciReset;
- Uhc->UsbHc.GetState = UhciGetState;
- Uhc->UsbHc.SetState = UhciSetState;
- Uhc->UsbHc.ControlTransfer = UhciControlTransfer;
- Uhc->UsbHc.BulkTransfer = UhciBulkTransfer;
- Uhc->UsbHc.AsyncInterruptTransfer = UhciAsyncInterruptTransfer;
- Uhc->UsbHc.SyncInterruptTransfer = UhciSyncInterruptTransfer;
- Uhc->UsbHc.IsochronousTransfer = UhciIsochronousTransfer;
- Uhc->UsbHc.AsyncIsochronousTransfer = UhciAsyncIsochronousTransfer;
- Uhc->UsbHc.GetRootHubPortNumber = UhciGetRootHubPortNumber;
- Uhc->UsbHc.GetRootHubPortStatus = UhciGetRootHubPortStatus;
- Uhc->UsbHc.SetRootHubPortFeature = UhciSetRootHubPortFeature;
- Uhc->UsbHc.ClearRootHubPortFeature = UhciClearRootHubPortFeature;
- Uhc->UsbHc.MajorRevision = 0x1;
- Uhc->UsbHc.MinorRevision = 0x1;
-
Uhc->Usb2Hc.GetCapability = Uhci2GetCapability;
Uhc->Usb2Hc.Reset = Uhci2Reset;
Uhc->Usb2Hc.GetState = Uhci2GetState;
@@ -2065,8 +1557,8 @@ UhciFreeDev ( STATIC
VOID
UhciCleanDevUp (
- IN EFI_HANDLE Controller,
- IN EFI_USB_HC_PROTOCOL *This
+ IN EFI_HANDLE Controller,
+ IN EFI_USB2_HC_PROTOCOL *This
)
{
USB_HC_DEV *Uhc;
@@ -2074,17 +1566,11 @@ UhciCleanDevUp ( //
// Uninstall the USB_HC and USB_HC2 protocol, then disable the controller
//
- Uhc = UHC_FROM_USB_HC_PROTO (This);
+ Uhc = UHC_FROM_USB2_HC_PROTO (This);
UhciStopHc (Uhc, UHC_GENERIC_TIMEOUT);
gBS->UninstallProtocolInterface (
Controller,
- &gEfiUsbHcProtocolGuid,
- &Uhc->UsbHc
- );
-
- gBS->UninstallProtocolInterface (
- Controller,
&gEfiUsb2HcProtocolGuid,
&Uhc->Usb2Hc
);
@@ -2218,12 +1704,10 @@ UhciDriverBindingStart ( }
//
- // Install both USB_HC_PROTOCOL and USB2_HC_PROTOCOL
+ // Install USB2_HC_PROTOCOL
//
Status = gBS->InstallMultipleProtocolInterfaces (
&Controller,
- &gEfiUsbHcProtocolGuid,
- &Uhc->UsbHc,
&gEfiUsb2HcProtocolGuid,
&Uhc->Usb2Hc,
NULL
@@ -2310,28 +1794,10 @@ UhciDriverBindingStop ( IN EFI_HANDLE *ChildHandleBuffer
)
{
- EFI_USB_HC_PROTOCOL *UsbHc;
EFI_USB2_HC_PROTOCOL *Usb2Hc;
EFI_STATUS Status;
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- (VOID **) &UsbHc,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- //
- // Test whether the Controller handler passed in is a valid
- // Usb controller handle that should be supported, if not,
- // return the error status directly
- //
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->OpenProtocol (
+ Status = gBS->OpenProtocol (
Controller,
&gEfiUsb2HcProtocolGuid,
(VOID **) &Usb2Hc,
@@ -2349,7 +1815,7 @@ UhciDriverBindingStop ( return Status;
}
- UhciCleanDevUp (Controller, UsbHc);
+ UhciCleanDevUp (Controller, Usb2Hc);
gBS->CloseProtocol (
Controller,
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h index e47679515b..d0aea616f5 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h +++ b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h @@ -98,7 +98,6 @@ typedef struct { } USB_CLASSC;
#pragma pack()
-#define UHC_FROM_USB_HC_PROTO(This) CR(This, USB_HC_DEV, UsbHc, USB_HC_DEV_SIGNATURE)
#define UHC_FROM_USB2_HC_PROTO(This) CR(This, USB_HC_DEV, Usb2Hc, USB_HC_DEV_SIGNATURE)
//
@@ -114,7 +113,6 @@ typedef struct { //
struct _USB_HC_DEV {
UINT32 Signature;
- EFI_USB_HC_PROTOCOL UsbHc;
EFI_USB2_HC_PROTOCOL Usb2Hc;
EFI_PCI_IO_PROTOCOL *PciIo;
UINT64 OriginalPciAttributes;
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf b/MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf index f5849f2812..4f46bf5bb1 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf +++ b/MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf @@ -63,6 +63,5 @@ [Protocols]
gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiUsbHcProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiUsb2HcProtocolGuid # PROTOCOL ALWAYS_CONSUMED
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c b/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c index 8bb0f2b19a..9c632a60fc 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c @@ -168,7 +168,7 @@ UhciAckAllInterrupt ( //
if (!UhciIsHcWorking (Uhc->PciIo)) {
UHCI_ERROR (("UhciAckAllInterrupt: re-enable the UHCI from system error\n"));
- Uhc->UsbHc.SetState (&Uhc->UsbHc, EfiUsbHcStateOperational);
+ Uhc->Usb2Hc.SetState (&Uhc->Usb2Hc, EfiUsbHcStateOperational);
}
}
@@ -186,8 +186,8 @@ UhciAckAllInterrupt ( **/
EFI_STATUS
UhciStopHc (
- IN USB_HC_DEV *Uhc,
- IN UINTN Timeout
+ IN USB_HC_DEV *Uhc,
+ IN UINTN Timeout
)
{
UINT16 UsbSts;
|