]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Ppi/UsbHostController.h
MdeModulePkg: Add PEI USB drivers and related PPIs
[mirror_edk2.git] / MdeModulePkg / Include / Ppi / UsbHostController.h
diff --git a/MdeModulePkg/Include/Ppi/UsbHostController.h b/MdeModulePkg/Include/Ppi/UsbHostController.h
new file mode 100644 (file)
index 0000000..107b799
--- /dev/null
@@ -0,0 +1,251 @@
+/** @file\r
+  Defines the USB Host Controller PPI that provides I/O services for a USB Host \r
+  Controller that may be used to access recovery devices.  These interfaces are \r
+  modeled on the UEFI 2.3 specification EFI_USB2_HOST_CONTROLLER_PROTOCOL.\r
+  Refer to section 16.1 of the UEFI 2.3 Specification for more information on \r
+  these interfaces.\r
\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions\r
+of the BSD License which accompanies this distribution.  The\r
+full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _PEI_USB_HOST_CONTROLLER_PPI_H_\r
+#define _PEI_USB_HOST_CONTROLLER_PPI_H_\r
+\r
+#include <Protocol/Usb2HostController.h>\r
+\r
+///\r
+/// Global ID for the PEI_USB_HOST_CONTROLLER_PPI.\r
+///\r
+#define PEI_USB_HOST_CONTROLLER_PPI_GUID \\r
+  { \\r
+    0x652b38a9, 0x77f4, 0x453f, { 0x89, 0xd5, 0xe7, 0xbd, 0xc3, 0x52, 0xfc, 0x53} \\r
+  }\r
+\r
+///\r
+/// Forward declaration for the PEI_USB_HOST_CONTROLLER_PPI.\r
+///\r
+typedef struct _PEI_USB_HOST_CONTROLLER_PPI PEI_USB_HOST_CONTROLLER_PPI;\r
+\r
+/**\r
+  Initiate a USB control transfer using a specific USB Host controller on the USB bus. \r
+\r
+  @param[in]     PeiServices           The pointer to the PEI Services Table.\r
+  @param[in]     This                  The pointer to this instance of the \r
+                                       PEI_USB_HOST_CONTROLLER_PPI.\r
+  @param[in]     DeviceAddress         Represents the address of the target device \r
+                                       on the USB.\r
+  @param[in]     DeviceSpeed           Indicates device speed.\r
+  @param[in]     MaximumPacketLength   Indicates the maximum packet size that the \r
+                                       default control transfer\r
+                                       endpoint is capable of sending or receiving.\r
+  @param[in]     Request               A pointer to the USB device request that \r
+                                       will be sent to the USB device.\r
+  @param[in]     TransferDirection     Specifies the data direction for the transfer. \r
+                                       There are three values available: \r
+                                       EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.\r
+  @param[in,out] Data                  A pointer to the buffer of data that will \r
+                                       be transmitted to USB device or\r
+                                       received from USB device.\r
+  @param[in,out] DataLength            On input, indicates the size, in bytes, of \r
+                                       the data buffer specified by Data.\r
+                                       On output, indicates the amount of data \r
+                                       actually transferred.\r
+  @param[in]     TimeOut               Indicates the maximum time, in milliseconds, \r
+                                       that the transfer is allowed to complete.\r
+  @param[out]    TransferResult        A pointer to the detailed result information \r
+                                       generated by this control transfer.\r
+\r
+  @retval EFI_DEVICE_ERROR   The control transfer failed due to host controller \r
+                             or device error.\r
+  @retval EFI_SUCCESS        The control transfer was completed successfully.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PEI_USB_HOST_CONTROLLER_CONTROL_TRANSFER)(\r
+  IN EFI_PEI_SERVICES             **PeiServices,\r
+  IN PEI_USB_HOST_CONTROLLER_PPI  *This,\r
+  IN     UINT8                    DeviceAddress,\r
+  IN     UINT8                    DeviceSpeed,\r
+  IN     UINT8                    MaximumPacketLength,\r
+  IN     USB_DEVICE_REQUEST       *Request,\r
+  IN     EFI_USB_DATA_DIRECTION   TransferDirection,\r
+  IN OUT VOID                     *Data OPTIONAL,\r
+  IN OUT UINTN                    *DataLength OPTIONAL,\r
+  IN     UINTN                    TimeOut,\r
+  OUT    UINT32                   *TransferResult\r
+  );\r
+\r
+/**\r
+  Initiate a USB bulk transfer using a specific USB Host controller on the USB bus. \r
+\r
+  @param[in]     PeiServices           The pointer to the PEI Services Table.\r
+  @param[in]     This                  The pointer to this instance of the \r
+                                       PEI_USB_HOST_CONTROLLER_PPI.\r
+  @param[in]     DeviceAddress         Represents the address of the target device \r
+                                       on the USB.\r
+  @param[in]     EndPointAddress       The combination of an endpoint number and \r
+                                       an endpoint direction of the target USB device.\r
+  @param[in]     MaximumPacketLength   Indicates the maximum packet size the target \r
+                                       endpoint is capable of sending or receiving.\r
+  @param[in,out] Data                  Array of pointers to the buffers of data \r
+                                       that will be transmitted to USB device or \r
+                                       received from USB device.\r
+  @param[in,out] DataLength            When input, indicates the size, in bytes, of  \r
+                                       the data buffers specified by Data. When output,\r
+                                       indicates the data size actually transferred.\r
+  @param[in,out] DataToggle            A pointer to the data toggle value.\r
+  @param[in]     TimeOut               Indicates the maximum time, in milliseconds,\r
+                                       in which the transfer is allowed to complete.\r
+  @param[out]    TransferResult        A pointer to the detailed result information \r
+                                       of the bulk transfer.\r
+\r
+  @retval EFI_SUCCESS           The bulk transfer was completed successfully.\r
+  @retval EFI_DEVICE_ERROR      The bulk transfer failed due to host controller or device error.\r
+                                Caller should check TransferResult for detailed error information.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PEI_USB_HOST_CONTROLLER_BULK_TRANSFER)(\r
+  IN     EFI_PEI_SERVICES             **PeiServices,\r
+  IN     PEI_USB_HOST_CONTROLLER_PPI  *This,\r
+  IN     UINT8                        DeviceAddress,\r
+  IN     UINT8                        EndPointAddress,\r
+  IN     UINT8                        MaximumPacketLength,\r
+  IN OUT VOID                         *Data,\r
+  IN OUT UINTN                        *DataLength,\r
+  IN OUT UINT8                        *DataToggle,\r
+  IN     UINTN                        TimeOut,\r
+  OUT    UINT32                       *TransferResult\r
+  );\r
+\r
+/**\r
+  Retrieves the number of root hub ports.\r
+\r
+  @param[in]  PeiServices   The pointer to the PEI Services Table.\r
+  @param[in]  This          The pointer to this instance of the \r
+                            PEI_USB_HOST_CONTROLLER_PPI.\r
+  @param[out] PortNumber    The pointer to the number of the root hub ports.                                \r
+                                \r
+  @retval EFI_SUCCESS           The port number was retrieved successfully.\r
+  @retval EFI_DEVICE_ERROR      An error was encountered while attempting to retrieve \r
+                                the port number.\r
+  @retval EFI_INVALID_PARAMETER PortNumber is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER)(\r
+  IN  EFI_PEI_SERVICES             **PeiServices,\r
+  IN  PEI_USB_HOST_CONTROLLER_PPI  *This,\r
+  OUT UINT8                        *PortNumber\r
+  );\r
+\r
+/**\r
+  Retrieves the current status of a USB root hub port.\r
+\r
+  @param[in]  PeiServices   The pointer to the PEI Services Table.\r
+  @param[in]  This          The pointer to this instance of the \r
+                            PEI_USB_HOST_CONTROLLER_PPI.\r
+  @param[in]  PortNumber    Specifies the root hub port from which the status is \r
+                            to be retrieved.\r
+                            This value is zero based.\r
+  @param[out] PortStatus    A pointer to the current port status bits and port \r
+                            status change bits.\r
+  \r
+  @retval EFI_SUCCESS           The status of the USB root hub port specified by \r
+                                PortNumber was returned in PortStatus.\r
+  @retval EFI_INVALID_PARAMETER PortNumber is invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS)(\r
+  IN  EFI_PEI_SERVICES             **PeiServices,\r
+  IN  PEI_USB_HOST_CONTROLLER_PPI  *This,\r
+  IN  UINT8                        PortNumber,\r
+  OUT EFI_USB_PORT_STATUS          *PortStatus\r
+  );\r
+\r
+/**\r
+  Sets a feature for the specified root hub port.\r
+\r
+  @param[in] PeiServices   The pointer to the PEI Services Table.\r
+  @param[in] This          The pointer to this instance of the \r
+                           PEI_USB_HOST_CONTROLLER_PPI.\r
+  @param[in] PortNumber    Specifies the root hub port whose feature is requested \r
+                           to be set. This value is zero based.\r
+  @param[in] PortFeature   Indicates the feature selector associated with the feature \r
+                           set request.\r
+  \r
+  @retval EFI_SUCCESS           The feature specified by PortFeature was set for \r
+                                the USB root hub port specified by PortNumber.\r
+  @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid \r
+                                for this function.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PEI_USB_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE)(\r
+  IN EFI_PEI_SERVICES             **PeiServices,\r
+  IN PEI_USB_HOST_CONTROLLER_PPI  *This,\r
+  IN UINT8                        PortNumber,\r
+  IN EFI_USB_PORT_FEATURE         PortFeature\r
+  );\r
+\r
+/**\r
+  Clears a feature for the specified root hub port.\r
+\r
+  @param[in] PeiServices   The pointer to the PEI Services Table.\r
+  @param[in] This          The pointer to this instance of the \r
+                           PEI_USB_HOST_CONTROLLER_PPI.\r
+  @param[in] PortNumber    Specifies the root hub port whose feature is\r
+                           requested to be cleared.\r
+  @param[in] PortFeature   Indicates the feature selector associated with the\r
+                           feature clear request.\r
+\r
+  @return EFI_SUCCESS             The feature specified by PortFeature was cleared\r
+                                  for the USB root hub port specified by PortNumber.\r
+  @return EFI_INVALID_PARAMETER   PortNumber is invalid or PortFeature is invalid.\r
+  @return EFI_DEVICE_ERROR        Can't read the register.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PEI_USB_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE)(\r
+  IN EFI_PEI_SERVICES             **PeiServices,\r
+  IN PEI_USB_HOST_CONTROLLER_PPI  *This,\r
+  IN UINT8                        PortNumber,\r
+  IN EFI_USB_PORT_FEATURE         PortFeature\r
+  );\r
+\r
+///\r
+/// This PPI contains a set of services to interact with the USB host controller.\r
+/// These interfaces are modeled on the UEFI 2.3 specification protocol\r
+/// EFI_USB2_HOST_CONTROLLER_PROTOCOL.  Refer to section 16.1 of the UEFI 2.3 \r
+/// Specification for more information on these interfaces.\r
+///\r
+struct _PEI_USB_HOST_CONTROLLER_PPI {\r
+  PEI_USB_HOST_CONTROLLER_CONTROL_TRANSFER            ControlTransfer;\r
+  PEI_USB_HOST_CONTROLLER_BULK_TRANSFER               BulkTransfer;\r
+  PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER     GetRootHubPortNumber;\r
+  PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS     GetRootHubPortStatus;\r
+  PEI_USB_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE    SetRootHubPortFeature;\r
+  PEI_USB_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE  ClearRootHubPortFeature;\r
+};\r
+\r
+extern EFI_GUID gPeiUsbHostControllerPpiGuid;\r
+\r
+#endif\r
+\r