summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Include
diff options
context:
space:
mode:
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-27 23:30:55 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-27 23:30:55 +0000
commit4b1bf81c20d5523554a83f6604df7930396f7c21 (patch)
tree8764ce333f14a1e5722b9d0f75ac1e09f1e0df29 /MdeModulePkg/Include
parent366f81a016c11a59669cdfb5adb714e6f036f65f (diff)
downloadedk2-4b1bf81c20d5523554a83f6604df7930396f7c21.zip
edk2-4b1bf81c20d5523554a83f6604df7930396f7c21.tar.gz
edk2-4b1bf81c20d5523554a83f6604df7930396f7c21.tar.bz2
MdeModulePkg: Add PEI USB drivers and related PPIs
Signed-off-by: jljusten Reviewed-by: mdkinney Reviewed-by: geekboy15a git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11901 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Include')
-rw-r--r--MdeModulePkg/Include/Ppi/Usb2HostController.h263
-rw-r--r--MdeModulePkg/Include/Ppi/UsbController.h88
-rw-r--r--MdeModulePkg/Include/Ppi/UsbHostController.h251
-rw-r--r--MdeModulePkg/Include/Ppi/UsbIo.h190
4 files changed, 792 insertions, 0 deletions
diff --git a/MdeModulePkg/Include/Ppi/Usb2HostController.h b/MdeModulePkg/Include/Ppi/Usb2HostController.h
new file mode 100644
index 0000000..e6d00ee
--- /dev/null
+++ b/MdeModulePkg/Include/Ppi/Usb2HostController.h
@@ -0,0 +1,263 @@
+/** @file
+ Defines the USB Host Controller PPI that provides I/O services for a USB Host
+ Controller that may be used to access recovery devices. These interfaces are
+ modeled on the UEFI 2.3 specification EFI_USB2_HOST_CONTROLLER_PROTOCOL.
+ Refer to section 16.1 of the UEFI 2.3 Specification for more information on
+ these interfaces.
+
+Copyright (c) 2010, Intel Corporation. All rights reserved. <BR>
+
+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.
+
+**/
+
+#ifndef _PEI_USB2_HOST_CONTROLLER_PPI_H_
+#define _PEI_USB2_HOST_CONTROLLER_PPI_H_
+
+#include <Protocol/Usb2HostController.h>
+
+///
+/// Global ID for the PEI_USB2_HOST_CONTROLLER_PPI.
+///
+#define PEI_USB2_HOST_CONTROLLER_PPI_GUID \
+ { \
+ 0xa7d09fe1, 0x74d4, 0x4ba5, { 0x84, 0x7c, 0x12, 0xed, 0x5b, 0x19, 0xad, 0xe4 } \
+ }
+
+///
+/// Forward declaration for the PEI_USB2_HOST_CONTROLLER_PPI.
+///
+typedef struct _PEI_USB2_HOST_CONTROLLER_PPI PEI_USB2_HOST_CONTROLLER_PPI;
+
+/**
+ Initiate a USB control transfer using a specific USB Host controller on the USB bus.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB2_HOST_CONTROLLER_PPI.
+ @param[in] DeviceAddress Represents the address of the target device
+ on the USB.
+ @param[in] DeviceSpeed Indicates device speed.
+ @param[in] MaximumPacketLength Indicates the maximum packet size that the
+ default control transfer
+ endpoint is capable of sending or receiving.
+ @param[in] Request A pointer to the USB device request that
+ will be sent to the USB device.
+ @param[in] TransferDirection Specifies the data direction for the transfer.
+ There are three values available:
+ EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.
+ @param[in,out] Data A pointer to the buffer of data that will
+ be transmitted to USB device or
+ received from USB device.
+ @param[in,out] DataLength On input, indicates the size, in bytes, of
+ the data buffer specified by Data.
+ On output, indicates the amount of data
+ actually transferred.
+ @param[in] TimeOut Indicates the maximum time, in milliseconds,
+ that the transfer is allowed to complete.
+ @param[in] Translator A pointer to the transaction translator data.
+ @param[out] TransferResult A pointer to the detailed result information
+ generated by this control transfer.
+
+ @retval EFI_SUCCESS The control transfer was completed successfully.
+ @retval EFI_DEVICE_ERROR The control transfer failed due to host controller
+ or device error.
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+ @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due to a lack of resources.
+ @retval EFI_TIMEOUT The control transfer failed due to timeout.
+
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB2_HOST_CONTROLLER_CONTROL_TRANSFER)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB2_HOST_CONTROLLER_PPI *This,
+ IN UINT8 DeviceAddress,
+ IN UINT8 DeviceSpeed,
+ IN UINTN MaximumPacketLength,
+ IN USB_DEVICE_REQUEST *Request,
+ IN EFI_USB_DATA_DIRECTION TransferDirection,
+ IN OUT VOID *Data OPTIONAL,
+ IN OUT UINTN *DataLength OPTIONAL,
+ IN UINTN TimeOut,
+ IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
+ OUT UINT32 *TransferResult
+ );
+
+/**
+ Initiate a USB bulk transfer using a specific USB Host controller on the USB bus.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB2_HOST_CONTROLLER_PPI.
+ @param[in] DeviceAddress Represents the address of the target device
+ on the USB.
+ @param[in] EndPointAddress The combination of an endpoint number and
+ an endpoint direction of the target USB device.
+ @param[in] DeviceSpeed Indicates device speed.
+ @param[in] MaximumPacketLength Indicates the maximum packet size the target
+ endpoint is capable of sending or receiving.
+ @param[in,out] Data Array of pointers to the buffers of data
+ that will be transmitted to USB device or
+ received from USB device.
+ @param[in,out] DataLength When input, indicates the size, in bytes, of
+ the data buffers specified by Data. When output,
+ indicates the data size actually transferred.
+ @param[in,out] DataToggle A pointer to the data toggle value.
+ @param[in] TimeOut Indicates the maximum time, in milliseconds,
+ in which the transfer is allowed to complete.
+ @param[in] Translator A pointer to the transaction translator data.
+ @param[out] TransferResult A pointer to the detailed result information
+ of the bulk transfer.
+
+ @retval EFI_SUCCESS The bulk transfer was completed successfully.
+ @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.
+ Caller should check TransferResult for detailed error information.
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+ @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be submitted due to a lack of resources.
+ @retval EFI_TIMEOUT The bulk transfer failed due to timeout.
+
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB2_HOST_CONTROLLER_BULK_TRANSFER)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB2_HOST_CONTROLLER_PPI *This,
+ IN UINT8 DeviceAddress,
+ IN UINT8 EndPointAddress,
+ IN UINT8 DeviceSpeed,
+ IN UINTN MaximumPacketLength,
+ 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
+ );
+
+/**
+ Retrieves the number of root hub ports.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB2_HOST_CONTROLLER_PPI.
+ @param[out] PortNumber The pointer to the number of the root hub ports.
+
+ @retval EFI_SUCCESS The port number was retrieved successfully.
+ @retval EFI_INVALID_PARAMETER PortNumber is NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB2_HOST_CONTROLLER_PPI *This,
+ OUT UINT8 *PortNumber
+ );
+
+/**
+ Retrieves the current status of a USB root hub port.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB2_HOST_CONTROLLER_PPI.
+ @param[in] PortNumber Specifies the root hub port from which the status is
+ to be retrieved.
+ This value is zero based.
+ @param[out] PortStatus A pointer to the current port status bits and port
+ status change bits.
+
+ @retval EFI_SUCCESS The status of the USB root hub port specified by
+ PortNumber was returned in PortStatus.
+ @retval EFI_INVALID_PARAMETER PortNumber is invalid.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB2_HOST_CONTROLLER_PPI *This,
+ IN UINT8 PortNumber,
+ OUT EFI_USB_PORT_STATUS *PortStatus
+ );
+
+/**
+ Sets a feature for the specified root hub port.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB2_HOST_CONTROLLER_PPI.
+ @param[in] PortNumber Specifies the root hub port whose feature is requested
+ to be set. This value is zero based.
+ @param[in] PortFeature Indicates the feature selector associated with the feature
+ set request.
+
+ @retval EFI_SUCCESS The feature specified by PortFeature was set for
+ the USB root hub port specified by PortNumber.
+ @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid
+ for this function.
+ @retval EFI_TIMEOUT The time out occurred
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB2_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB2_HOST_CONTROLLER_PPI *This,
+ IN UINT8 PortNumber,
+ IN EFI_USB_PORT_FEATURE PortFeature
+ );
+
+/**
+ Clears a feature for the specified root hub port.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB2_HOST_CONTROLLER_PPI.
+ @param[in] PortNumber Specifies the root hub port whose feature is
+ requested to be cleared.
+ @param[in] PortFeature Indicates the feature selector associated with the
+ feature clear request.
+
+ @return EFI_SUCCESS The feature specified by PortFeature was cleared
+ for the USB root hub port specified by PortNumber.
+ @return EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB2_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB2_HOST_CONTROLLER_PPI *This,
+ IN UINT8 PortNumber,
+ IN EFI_USB_PORT_FEATURE PortFeature
+ );
+
+///
+/// This PPI contains a set of services to interact with the USB host controller.
+/// These interfaces are modeled on the UEFI 2.3 specification protocol
+/// EFI_USB2_HOST_CONTROLLER_PROTOCOL. Refer to section 16.1 of the UEFI 2.3
+/// Specification for more information on these interfaces.
+///
+struct _PEI_USB2_HOST_CONTROLLER_PPI {
+ PEI_USB2_HOST_CONTROLLER_CONTROL_TRANSFER ControlTransfer;
+ PEI_USB2_HOST_CONTROLLER_BULK_TRANSFER BulkTransfer;
+ PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER GetRootHubPortNumber;
+ PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus;
+ PEI_USB2_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature;
+ PEI_USB2_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature;
+};
+
+extern EFI_GUID gPeiUsb2HostControllerPpiGuid;
+
+#endif
+
diff --git a/MdeModulePkg/Include/Ppi/UsbController.h b/MdeModulePkg/Include/Ppi/UsbController.h
new file mode 100644
index 0000000..10e025d
--- /dev/null
+++ b/MdeModulePkg/Include/Ppi/UsbController.h
@@ -0,0 +1,88 @@
+/** @file
+ Define APIs to retrieve USB Host Controller Info such as controller type and
+ I/O Port Base Address.
+
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+
+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.
+
+**/
+
+#ifndef _PEI_USB_CONTROLLER_PPI_H_
+#define _PEI_USB_CONTROLLER_PPI_H_
+
+///
+/// Global ID for the PEI_USB_CONTROLLER_PPI.
+///
+#define PEI_USB_CONTROLLER_PPI_GUID \
+ { \
+ 0x3bc1f6de, 0x693e, 0x4547,{ 0xa3, 0x0, 0x21, 0x82, 0x3c, 0xa4, 0x20, 0xb2} \
+ }
+
+///
+/// Forward declaration for the PEI_USB_CONTROLLER_PPI.
+///
+typedef struct _PEI_USB_CONTROLLER_PPI PEI_USB_CONTROLLER_PPI;
+
+///
+/// This bit is used in the ControllerType return parameter of GetUsbController()
+/// to identify the USB Host Controller type as UHCI
+///
+#define PEI_UHCI_CONTROLLER 0x01
+
+///
+/// This bit is used in the ControllerType return parameter of GetUsbController()
+/// to identify the USB Host Controller type as OHCI
+///
+#define PEI_OHCI_CONTROLLER 0x02
+
+///
+/// This bit is used in the ControllerType return parameter of GetUsbController()
+/// to identify the USB Host Controller type as EHCI
+///
+#define PEI_EHCI_CONTROLLER 0x03
+
+/**
+ Retrieve USB Host Controller Info such as controller type and I/O Base Address.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the PEI_USB_CONTROLLER_PPI.
+ @param[in] ControllerId The ID of the USB controller.
+ @param[out] ControllerType On output, returns the type of the USB controller.
+ @param[out] BaseAddress On output, returns the base address of UHCI's I/O ports
+ if UHCI is enabled or the base address of EHCI's MMIO
+ if EHCI is enabled.
+
+ @retval EFI_SUCCESS USB controller attributes were returned successfully.
+ @retval EFI_INVALID_PARAMETER ControllerId is greater than the maximum number
+ of USB controller supported by this platform.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_GET_USB_CONTROLLER)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_CONTROLLER_PPI *This,
+ IN UINT8 UsbControllerId,
+ OUT UINTN *ControllerType,
+ OUT UINTN *BaseAddress
+ );
+
+///
+/// This PPI contains a single service to retrieve the USB Host Controller type
+/// and the base address of the I/O ports used to access the USB Host Controller.
+///
+struct _PEI_USB_CONTROLLER_PPI {
+ PEI_GET_USB_CONTROLLER GetUsbController;
+};
+
+extern EFI_GUID gPeiUsbControllerPpiGuid;
+
+#endif
diff --git a/MdeModulePkg/Include/Ppi/UsbHostController.h b/MdeModulePkg/Include/Ppi/UsbHostController.h
new file mode 100644
index 0000000..107b799
--- /dev/null
+++ b/MdeModulePkg/Include/Ppi/UsbHostController.h
@@ -0,0 +1,251 @@
+/** @file
+ Defines the USB Host Controller PPI that provides I/O services for a USB Host
+ Controller that may be used to access recovery devices. These interfaces are
+ modeled on the UEFI 2.3 specification EFI_USB2_HOST_CONTROLLER_PROTOCOL.
+ Refer to section 16.1 of the UEFI 2.3 Specification for more information on
+ these interfaces.
+
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+
+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.
+
+**/
+
+#ifndef _PEI_USB_HOST_CONTROLLER_PPI_H_
+#define _PEI_USB_HOST_CONTROLLER_PPI_H_
+
+#include <Protocol/Usb2HostController.h>
+
+///
+/// Global ID for the PEI_USB_HOST_CONTROLLER_PPI.
+///
+#define PEI_USB_HOST_CONTROLLER_PPI_GUID \
+ { \
+ 0x652b38a9, 0x77f4, 0x453f, { 0x89, 0xd5, 0xe7, 0xbd, 0xc3, 0x52, 0xfc, 0x53} \
+ }
+
+///
+/// Forward declaration for the PEI_USB_HOST_CONTROLLER_PPI.
+///
+typedef struct _PEI_USB_HOST_CONTROLLER_PPI PEI_USB_HOST_CONTROLLER_PPI;
+
+/**
+ Initiate a USB control transfer using a specific USB Host controller on the USB bus.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB_HOST_CONTROLLER_PPI.
+ @param[in] DeviceAddress Represents the address of the target device
+ on the USB.
+ @param[in] DeviceSpeed Indicates device speed.
+ @param[in] MaximumPacketLength Indicates the maximum packet size that the
+ default control transfer
+ endpoint is capable of sending or receiving.
+ @param[in] Request A pointer to the USB device request that
+ will be sent to the USB device.
+ @param[in] TransferDirection Specifies the data direction for the transfer.
+ There are three values available:
+ EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.
+ @param[in,out] Data A pointer to the buffer of data that will
+ be transmitted to USB device or
+ received from USB device.
+ @param[in,out] DataLength On input, indicates the size, in bytes, of
+ the data buffer specified by Data.
+ On output, indicates the amount of data
+ actually transferred.
+ @param[in] TimeOut Indicates the maximum time, in milliseconds,
+ that the transfer is allowed to complete.
+ @param[out] TransferResult A pointer to the detailed result information
+ generated by this control transfer.
+
+ @retval EFI_DEVICE_ERROR The control transfer failed due to host controller
+ or device error.
+ @retval EFI_SUCCESS The control transfer was completed successfully.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB_HOST_CONTROLLER_CONTROL_TRANSFER)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_HOST_CONTROLLER_PPI *This,
+ IN UINT8 DeviceAddress,
+ IN UINT8 DeviceSpeed,
+ IN UINT8 MaximumPacketLength,
+ IN 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
+ );
+
+/**
+ Initiate a USB bulk transfer using a specific USB Host controller on the USB bus.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB_HOST_CONTROLLER_PPI.
+ @param[in] DeviceAddress Represents the address of the target device
+ on the USB.
+ @param[in] EndPointAddress The combination of an endpoint number and
+ an endpoint direction of the target USB device.
+ @param[in] MaximumPacketLength Indicates the maximum packet size the target
+ endpoint is capable of sending or receiving.
+ @param[in,out] Data Array of pointers to the buffers of data
+ that will be transmitted to USB device or
+ received from USB device.
+ @param[in,out] DataLength When input, indicates the size, in bytes, of
+ the data buffers specified by Data. When output,
+ indicates the data size actually transferred.
+ @param[in,out] DataToggle A pointer to the data toggle value.
+ @param[in] TimeOut Indicates the maximum time, in milliseconds,
+ in which the transfer is allowed to complete.
+ @param[out] TransferResult A pointer to the detailed result information
+ of the bulk transfer.
+
+ @retval EFI_SUCCESS The bulk transfer was completed successfully.
+ @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.
+ Caller should check TransferResult for detailed error information.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB_HOST_CONTROLLER_BULK_TRANSFER)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_HOST_CONTROLLER_PPI *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
+ );
+
+/**
+ Retrieves the number of root hub ports.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB_HOST_CONTROLLER_PPI.
+ @param[out] PortNumber The pointer to the number of the root hub ports.
+
+ @retval EFI_SUCCESS The port number was retrieved successfully.
+ @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve
+ the port number.
+ @retval EFI_INVALID_PARAMETER PortNumber is NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_HOST_CONTROLLER_PPI *This,
+ OUT UINT8 *PortNumber
+ );
+
+/**
+ Retrieves the current status of a USB root hub port.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB_HOST_CONTROLLER_PPI.
+ @param[in] PortNumber Specifies the root hub port from which the status is
+ to be retrieved.
+ This value is zero based.
+ @param[out] PortStatus A pointer to the current port status bits and port
+ status change bits.
+
+ @retval EFI_SUCCESS The status of the USB root hub port specified by
+ PortNumber was returned in PortStatus.
+ @retval EFI_INVALID_PARAMETER PortNumber is invalid.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_HOST_CONTROLLER_PPI *This,
+ IN UINT8 PortNumber,
+ OUT EFI_USB_PORT_STATUS *PortStatus
+ );
+
+/**
+ Sets a feature for the specified root hub port.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB_HOST_CONTROLLER_PPI.
+ @param[in] PortNumber Specifies the root hub port whose feature is requested
+ to be set. This value is zero based.
+ @param[in] PortFeature Indicates the feature selector associated with the feature
+ set request.
+
+ @retval EFI_SUCCESS The feature specified by PortFeature was set for
+ the USB root hub port specified by PortNumber.
+ @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid
+ for this function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_HOST_CONTROLLER_PPI *This,
+ IN UINT8 PortNumber,
+ IN EFI_USB_PORT_FEATURE PortFeature
+ );
+
+/**
+ Clears a feature for the specified root hub port.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the
+ PEI_USB_HOST_CONTROLLER_PPI.
+ @param[in] PortNumber Specifies the root hub port whose feature is
+ requested to be cleared.
+ @param[in] PortFeature Indicates the feature selector associated with the
+ feature clear request.
+
+ @return EFI_SUCCESS The feature specified by PortFeature was cleared
+ for the USB root hub port specified by PortNumber.
+ @return EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
+ @return EFI_DEVICE_ERROR Can't read the register.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_HOST_CONTROLLER_PPI *This,
+ IN UINT8 PortNumber,
+ IN EFI_USB_PORT_FEATURE PortFeature
+ );
+
+///
+/// This PPI contains a set of services to interact with the USB host controller.
+/// These interfaces are modeled on the UEFI 2.3 specification protocol
+/// EFI_USB2_HOST_CONTROLLER_PROTOCOL. Refer to section 16.1 of the UEFI 2.3
+/// Specification for more information on these interfaces.
+///
+struct _PEI_USB_HOST_CONTROLLER_PPI {
+ PEI_USB_HOST_CONTROLLER_CONTROL_TRANSFER ControlTransfer;
+ PEI_USB_HOST_CONTROLLER_BULK_TRANSFER BulkTransfer;
+ PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER GetRootHubPortNumber;
+ PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus;
+ PEI_USB_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature;
+ PEI_USB_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature;
+};
+
+extern EFI_GUID gPeiUsbHostControllerPpiGuid;
+
+#endif
+
diff --git a/MdeModulePkg/Include/Ppi/UsbIo.h b/MdeModulePkg/Include/Ppi/UsbIo.h
new file mode 100644
index 0000000..16660f8
--- /dev/null
+++ b/MdeModulePkg/Include/Ppi/UsbIo.h
@@ -0,0 +1,190 @@
+/** @file
+ Defines the PEI_USB_IO_PPI that the USB-related PEIM can use for I/O operations
+ on the USB BUS. This interface enables recovery from a
+ USB-class storage device, such as USB CD/DVD, USB hard drive, or USB FLASH
+ drive. These interfaces are modeled on the UEFI 2.3 specification EFI_USB_IO_PROTOCOL.
+ Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on
+ these interfaces.
+
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+
+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.
+
+**/
+
+#ifndef _PEI_USB_IO_PPI_H_
+#define _PEI_USB_IO_PPI_H_
+
+#include <Protocol/Usb2HostController.h>
+
+///
+/// Global ID for the PEI_USB_IO_PPI.
+///
+#define PEI_USB_IO_PPI_GUID \
+ { \
+ 0x7c29785c, 0x66b9, 0x49fc, { 0xb7, 0x97, 0x1c, 0xa5, 0x55, 0xe, 0xf2, 0x83} \
+ }
+
+///
+/// Forward declaration for the PEI_USB_IO_PPI.
+///
+typedef struct _PEI_USB_IO_PPI PEI_USB_IO_PPI;
+
+/**
+ Submits control transfer to a target USB device.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
+ @param[in] Request A pointer to the USB device request that will be
+ sent to the USB device.
+ @param[in] Direction Specifies the data direction for the transfer. There
+ are three values available:
+ EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.
+ @param[in] TimeOut Indicates the maximum time, in milliseconds, that
+ the transfer is allowed to complete.
+ @param[in,out] Data A pointer to the buffer of data that will be
+ transmitted to or received from the USB device.
+ @param[in] DataLength On input, indicates the size, in bytes, of the data
+ buffer specified by Data.
+
+ @retval EFI_SUCCESS The control transfer was completed successfully.
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+ @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due
+ to a lack of resources.
+ @retval EFI_TIMEOUT The control transfer failed due to timeout.
+ @retval EFI_DEVICE_ERROR The control transfer failed due to host controller
+ or device error.
+ Caller should check TransferResult for detailed
+ error information.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB_CONTROL_TRANSFER)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ IN EFI_USB_DEVICE_REQUEST *Request,
+ IN EFI_USB_DATA_DIRECTION Direction,
+ IN UINT32 Timeout,
+ IN OUT VOID *Data OPTIONAL,
+ IN UINTN DataLength OPTIONAL
+ );
+
+/**
+ Submits bulk transfer to a target USB device.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
+ @param[in] EndPointAddress The endpoint address.
+ @param[in] Data The data buffer to be transfered.
+ @param[in] DataLength The length of data buffer.
+ @param[in] TimeOut The timeout for the transfer, in milliseconds.
+
+ @retval EFI_SUCCESS The bulk transfer completed successfully.
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+ @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be completed due to
+ a lack of resources.
+ @retval EFI_TIMEOUT The bulk transfer failed due to timeout.
+ @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller
+ or device error.
+ Caller should check TransferResult for detailed
+ error information.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB_BULK_TRANSFER)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ IN UINT8 DeviceEndpoint,
+ IN OUT VOID *Data,
+ IN OUT UINTN *DataLength,
+ IN UINTN Timeout
+ );
+
+/**
+ Get interface descriptor from a USB device.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
+ @param[in] InterfaceDescriptor The interface descriptor.
+
+ @retval EFI_SUCCESS The interface descriptor was returned.
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+ @retval EFI_DEVICE_ERROR A device error occurred, the function failed to
+ get the interface descriptor.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB_GET_INTERFACE_DESCRIPTOR)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ IN EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor
+ );
+
+/**
+ Get endpoint descriptor from a USB device.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
+ @param[in] EndPointIndex The index of the end point.
+ @param[in] EndpointDescriptor The endpoint descriptor.
+
+ @retval EFI_SUCCESS The endpoint descriptor was returned.
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+ @retval EFI_DEVICE_ERROR A device error occurred, the function failed to
+ get the endpoint descriptor.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB_GET_ENDPOINT_DESCRIPTOR)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ IN UINT8 EndpointIndex,
+ IN EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor
+ );
+
+/**
+ Issue a port reset to the device.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
+
+ @retval EFI_SUCCESS The port reset was issued successfully.
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+ @retval EFI_DEVICE_ERROR Device error occurred.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_USB_PORT_RESET)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This
+ );
+
+///
+/// This PPI contains a set of services to interact with the USB host controller.
+/// These interfaces are modeled on the UEFI 2.3 specification EFI_USB_IO_PROTOCOL.
+/// Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on
+/// these interfaces.
+///
+struct _PEI_USB_IO_PPI {
+ PEI_USB_CONTROL_TRANSFER UsbControlTransfer;
+ PEI_USB_BULK_TRANSFER UsbBulkTransfer;
+ PEI_USB_GET_INTERFACE_DESCRIPTOR UsbGetInterfaceDescriptor;
+ PEI_USB_GET_ENDPOINT_DESCRIPTOR UsbGetEndpointDescriptor;
+ PEI_USB_PORT_RESET UsbPortReset;
+};
+
+extern EFI_GUID gPeiUsbIoPpiGuid;
+
+#endif