]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h
MdeModulePkg: Change OPTIONAL keyword usage style
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbBus.h
index 21d1b304bf80d36146153957500154c62bd10f55..40bc5f130e03f5354f0f8b82de6a17b51fb4e007 100644 (file)
@@ -1,23 +1,9 @@
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The 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
-  Module Name:\r
-\r
-    UsbBus.h\r
-\r
-  Abstract:\r
-\r
-    Usb Bus Driver Binding and Bus IO Protocol\r
-\r
-  Revision History\r
+    Usb Bus Driver Binding and Bus IO Protocol.\r
 \r
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -25,7 +11,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define _EFI_USB_BUS_H_\r
 \r
 \r
-#include <PiDxe.h>\r
+#include <Uefi.h>\r
 \r
 #include <Protocol/Usb2HostController.h>\r
 #include <Protocol/UsbHostController.h>\r
@@ -40,6 +26,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
 \r
 \r
 #include <IndustryStandard/Usb.h>\r
@@ -55,94 +42,105 @@ typedef struct _USB_HUB_API    USB_HUB_API;
 #include "UsbHub.h"\r
 #include "UsbEnumer.h"\r
 \r
-enum {\r
-  USB_MAX_LANG_ID           = 16,\r
-  USB_MAX_INTERFACE         = 16,\r
-  USB_MAX_DEVICES           = 128,\r
+//\r
+// USB bus timeout experience values\r
+//\r
 \r
-  USB_BUS_1_MILLISECOND     = 1000,\r
+#define USB_MAX_LANG_ID           16\r
+#define USB_MAX_INTERFACE         16\r
+#define USB_MAX_DEVICES           128\r
 \r
-  //\r
-  // Roothub and hub's polling interval, set by experience,\r
-  // The unit of roothub is 100us, means 1s as interval, and\r
-  // the unit of hub is 1ms, means 64ms as interval.\r
-  //\r
-  USB_ROOTHUB_POLL_INTERVAL = 1000 * 10000U,\r
-  USB_HUB_POLL_INTERVAL     = 64,\r
+#define USB_BUS_1_MILLISECOND     1000\r
 \r
-  //\r
-  // Wait for port stable to work, refers to specification\r
-  // [USB20-9.1.2]\r
-  //\r
-  USB_WAIT_PORT_STABLE_STALL     = 100 * USB_BUS_1_MILLISECOND,\r
+//\r
+// Roothub and hub's polling interval, set by experience,\r
+// The unit of roothub is 100us, means 100ms as interval, and\r
+// the unit of hub is 1ms, means 64ms as interval.\r
+//\r
+#define USB_ROOTHUB_POLL_INTERVAL (100 * 10000U)\r
+#define USB_HUB_POLL_INTERVAL     64\r
 \r
-  //\r
-  // Wait for port statue reg change, set by experience\r
-  //\r
-  USB_WAIT_PORT_STS_CHANGE_STALL = 5 * USB_BUS_1_MILLISECOND,\r
+//\r
+// Wait for port stable to work, refers to specification\r
+// [USB20-9.1.2]\r
+//\r
+#define USB_WAIT_PORT_STABLE_STALL  (100 * USB_BUS_1_MILLISECOND)\r
 \r
-  //\r
-  // Wait for set device address, refers to specification\r
-  // [USB20-9.2.6.3, it says 2ms]\r
-  //\r
-  USB_SET_DEVICE_ADDRESS_STALL   = 20 * USB_BUS_1_MILLISECOND,\r
+//\r
+// Wait for port statue reg change, set by experience\r
+//\r
+#define USB_WAIT_PORT_STS_CHANGE_STALL (100)\r
 \r
-  //\r
-  // Wait for retry max packet size, set by experience\r
-  //\r
-  USB_RETRY_MAX_PACK_SIZE_STALL  = 100 * USB_BUS_1_MILLISECOND,\r
+//\r
+// Wait for set device address, refers to specification\r
+// [USB20-9.2.6.3, it says 2ms]\r
+//\r
+#define USB_SET_DEVICE_ADDRESS_STALL   (2 * USB_BUS_1_MILLISECOND)\r
 \r
-  //\r
-  // Wait for hub port power-on, refers to specification\r
-  // [USB20-11.23.2]\r
-  //\r
-  USB_SET_PORT_POWER_STALL       = 2 * USB_BUS_1_MILLISECOND,\r
+//\r
+// Wait for retry max packet size, set by experience\r
+//\r
+#define USB_RETRY_MAX_PACK_SIZE_STALL  (100 * USB_BUS_1_MILLISECOND)\r
 \r
-  //\r
-  // Wait for port reset, refers to specification\r
-  // [USB20-7.1.7.5, it says 10ms for hub and 50ms for\r
-  // root hub]\r
-  //\r
-  USB_SET_PORT_RESET_STALL       = 20 * USB_BUS_1_MILLISECOND,\r
-  USB_SET_ROOT_PORT_RESET_STALL  = 50 * USB_BUS_1_MILLISECOND,\r
+//\r
+// Wait for hub port power-on, refers to specification\r
+// [USB20-11.23.2]\r
+//\r
+#define USB_SET_PORT_POWER_STALL       (2 * USB_BUS_1_MILLISECOND)\r
 \r
-  //\r
-  // Wait for clear roothub port reset, set by experience\r
-  //\r
-  USB_CLR_ROOT_PORT_RESET_STALL  = 1 * USB_BUS_1_MILLISECOND,\r
+//\r
+// Wait for port reset, refers to specification\r
+// [USB20-7.1.7.5, it says 10ms for hub and 50ms for\r
+// root hub]\r
+//\r
+// According to USB2.0, Chapter 11.5.1.5 Resetting,\r
+// the worst case for TDRST is 20ms\r
+//\r
+#define USB_SET_PORT_RESET_STALL       (20 * USB_BUS_1_MILLISECOND)\r
+#define USB_SET_ROOT_PORT_RESET_STALL  (50 * USB_BUS_1_MILLISECOND)\r
 \r
-  //\r
-  // Wait for set roothub port enable, set by experience\r
-  //\r
-  USB_SET_ROOT_PORT_ENABLE_STALL = 20 * USB_BUS_1_MILLISECOND,\r
+//\r
+// Wait for port recovery to accept SetAddress, refers to specification\r
+// [USB20-7.1.7.5, it says 10 ms for TRSTRCY]\r
+//\r
+#define USB_SET_PORT_RECOVERY_STALL    (10 * USB_BUS_1_MILLISECOND)\r
 \r
-  //\r
-  // Send general device request timeout, refers to\r
-  // specification[USB20-11.24.1]\r
-  //\r
-  USB_GENERAL_DEVICE_REQUEST_TIMEOUT = 50 * USB_BUS_1_MILLISECOND,\r
+//\r
+// Wait for clear roothub port reset, set by experience\r
+//\r
+#define USB_CLR_ROOT_PORT_RESET_STALL  (20 * USB_BUS_1_MILLISECOND)\r
 \r
-  //\r
-  // Send clear feature request timeout, set by experience\r
-  //\r
-  USB_CLEAR_FEATURE_REQUEST_TIMEOUT  = 10 * USB_BUS_1_MILLISECOND,\r
+//\r
+// Wait for set roothub port enable, set by experience\r
+//\r
+#define USB_SET_ROOT_PORT_ENABLE_STALL (20 * USB_BUS_1_MILLISECOND)\r
 \r
-  //\r
-  // Bus raises TPL to TPL_NOTIFY to serialize all its operations\r
-  // to protect shared data structures.\r
-  //\r
-  USB_BUS_TPL               = TPL_NOTIFY,\r
+//\r
+// Send general device request timeout.\r
+//\r
+// The USB Specification 2.0, section 11.24.1 recommends a value of\r
+// 50 milliseconds.  We use a value of 500 milliseconds to work\r
+// around slower hubs and devices.\r
+//\r
+#define USB_GENERAL_DEVICE_REQUEST_TIMEOUT 500\r
 \r
-  USB_INTERFACE_SIGNATURE   = EFI_SIGNATURE_32 ('U', 'S', 'B', 'I'),\r
-  USB_BUS_SIGNATURE         = EFI_SIGNATURE_32 ('U', 'S', 'B', 'B')\r
-};\r
+//\r
+// Send clear feature request timeout, set by experience\r
+//\r
+#define USB_CLEAR_FEATURE_REQUEST_TIMEOUT  10\r
+\r
+//\r
+// Bus raises TPL to TPL_NOTIFY to serialize all its operations\r
+// to protect shared data structures.\r
+//\r
+#define  USB_BUS_TPL               TPL_NOTIFY\r
+\r
+#define  USB_INTERFACE_SIGNATURE   SIGNATURE_32 ('U', 'S', 'B', 'I')\r
+#define  USB_BUS_SIGNATURE         SIGNATURE_32 ('U', 'S', 'B', 'B')\r
 \r
 #define USB_BIT(a)                  ((UINTN)(1 << (a)))\r
 #define USB_BIT_IS_SET(Data, Bit)   ((BOOLEAN)(((Data) & (Bit)) == (Bit)))\r
 \r
-#define EFI_USB_BUS_PROTOCOL_GUID \\r
-          {0x2B2F68CC, 0x0CD2, 0x44cf, {0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75}}\r
-\r
 #define USB_INTERFACE_FROM_USBIO(a) \\r
           CR(a, USB_INTERFACE, UsbIo, USB_INTERFACE_SIGNATURE)\r
 \r
@@ -151,6 +149,8 @@ enum {
 \r
 //\r
 // Used to locate USB_BUS\r
+// UsbBusProtocol is the private protocol.\r
+// gEfiCallerIdGuid will be used as its protocol guid.\r
 //\r
 typedef struct _EFI_USB_BUS_PROTOCOL {\r
   UINT64                    Reserved;\r
@@ -159,7 +159,7 @@ typedef struct _EFI_USB_BUS_PROTOCOL {
 \r
 //\r
 // Stands for the real USB device. Each device may\r
-// has several seperately working interfaces.\r
+// has several separately working interfaces.\r
 //\r
 struct _USB_DEVICE {\r
   USB_BUS                   *Bus;\r
@@ -169,7 +169,7 @@ struct _USB_DEVICE {
   //\r
   UINT8                     Speed;\r
   UINT8                     Address;\r
-  UINT                    MaxPacket0;\r
+  UINT32                    MaxPacket0;\r
 \r
   //\r
   // The device's descriptors and its configuration\r
@@ -191,6 +191,8 @@ struct _USB_DEVICE {
   UINT8                     ParentAddr;\r
   USB_INTERFACE             *ParentIf;\r
   UINT8                     ParentPort;       // Start at 0\r
+  UINT8                     Tier;\r
+  BOOLEAN                   DisconnectFail;\r
 };\r
 \r
 //\r
@@ -247,27 +249,46 @@ struct _USB_BUS {
   EFI_USB2_HC_PROTOCOL      *Usb2Hc;\r
   EFI_USB_HC_PROTOCOL       *UsbHc;\r
 \r
+  //\r
+  // Recorded the max supported usb devices.\r
+  // XHCI can support up to 255 devices.\r
+  // EHCI/UHCI/OHCI supports up to 127 devices.\r
+  //\r
+  UINT32                    MaxDevices;\r
   //\r
   // An array of device that is on the bus. Devices[0] is\r
   // for root hub. Device with address i is at Devices[i].\r
   //\r
-  USB_DEVICE                *Devices[USB_MAX_DEVICES];\r
+  USB_DEVICE                *Devices[256];\r
 \r
   //\r
   // USB Bus driver need to control the recursive connect policy of the bus, only those wanted\r
   // usb child device will be recursively connected.\r
   //\r
-  // WantedUsbIoDPList tracks the Usb child devices which user want to recursivly fully connecte,\r
-  // every wanted child device is stored in a item of the WantedUsbIoDPList, whose structrure is\r
+  // WantedUsbIoDPList tracks the Usb child devices which user want to recursively fully connecte,\r
+  // every wanted child device is stored in a item of the WantedUsbIoDPList, whose structure is\r
   // DEVICE_PATH_LIST_ITEM\r
   //\r
   LIST_ENTRY                WantedUsbIoDPList;\r
 \r
 };\r
 \r
+//\r
+// USB Hub Api\r
+//\r
+struct _USB_HUB_API{\r
+  USB_HUB_INIT                Init;\r
+  USB_HUB_GET_PORT_STATUS     GetPortStatus;\r
+  USB_HUB_CLEAR_PORT_CHANGE   ClearPortChange;\r
+  USB_HUB_SET_PORT_FEATURE    SetPortFeature;\r
+  USB_HUB_CLEAR_PORT_FEATURE  ClearPortFeature;\r
+  USB_HUB_RESET_PORT          ResetPort;\r
+  USB_HUB_RELEASE             Release;\r
+};\r
+\r
 #define USB_US_LAND_ID   0x0409\r
 \r
-#define DEVICE_PATH_LIST_ITEM_SIGNATURE     EFI_SIGNATURE_32('d','p','l','i')\r
+#define DEVICE_PATH_LIST_ITEM_SIGNATURE     SIGNATURE_32('d','p','l','i')\r
 typedef struct _DEVICE_PATH_LIST_ITEM{\r
   UINTN                                 Signature;\r
   LIST_ENTRY                            Link;\r
@@ -279,12 +300,32 @@ typedef struct {
   EFI_DEVICE_PATH_PROTOCOL        End;\r
 } USB_CLASS_FORMAT_DEVICE_PATH;\r
 \r
+/**\r
+  Free a DEVICE_PATH_LIST_ITEM list.\r
+\r
+  @param  UsbIoDPList            a DEVICE_PATH_LIST_ITEM list pointer.\r
+\r
+  @retval EFI_INVALID_PARAMETER  If parameters are invalid, return this value.\r
+  @retval EFI_SUCCESS            If free operation is successful, return this value.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbBusFreeUsbDPList (\r
   IN     LIST_ENTRY                                 *UsbIoDPList\r
   );\r
 \r
+/**\r
+  Store a wanted usb child device info (its Usb part of device path) which is indicated by\r
+  RemainingDevicePath in a Usb bus which  is indicated by UsbBusId.\r
+\r
+  @param  UsbBusId               Point to EFI_USB_BUS_PROTOCOL interface.\r
+  @param  RemainingDevicePath    The remaining device patch.\r
+\r
+  @retval EFI_SUCCESS            Add operation is successful.\r
+  @retval EFI_INVALID_PARAMETER  The parameters are invalid.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbBusAddWantedUsbIoDP (\r
@@ -292,6 +333,16 @@ UsbBusAddWantedUsbIoDP (
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   );\r
 \r
+/**\r
+  Check whether a usb child device is the wanted device in a bus.\r
+\r
+  @param  Bus     The Usb bus's private data pointer.\r
+  @param  UsbIf   The usb child device interface.\r
+\r
+  @retval True    If a usb child device is the wanted device in a bus.\r
+  @retval False   If a usb child device is *NOT* the wanted device in a bus.\r
+\r
+**/\r
 BOOLEAN\r
 EFIAPI\r
 UsbBusIsWantedUsbIO (\r
@@ -299,12 +350,412 @@ UsbBusIsWantedUsbIO (
   IN USB_INTERFACE           *UsbIf\r
   );\r
 \r
+/**\r
+  Recursively connect every wanted usb child device to ensure they all fully connected.\r
+  Check all the child Usb IO handles in this bus, recursively connecte if it is wanted usb child device.\r
+\r
+  @param  UsbBusId                  Point to EFI_USB_BUS_PROTOCOL interface.\r
+\r
+  @retval EFI_SUCCESS               Connect is done successfully.\r
+  @retval EFI_INVALID_PARAMETER     The parameter is invalid.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbBusRecursivelyConnectWantedUsbIo (\r
   IN EFI_USB_BUS_PROTOCOL         *UsbBusId\r
   );\r
 \r
+/**\r
+  USB_IO function to execute a control transfer. This\r
+  function will execute the USB transfer. If transfer\r
+  successes, it will sync the internal state of USB bus\r
+  with device state.\r
+\r
+  @param  This                   The USB_IO instance\r
+  @param  Request                The control transfer request\r
+  @param  Direction              Direction for data stage\r
+  @param  Timeout                The time to wait before timeout\r
+  @param  Data                   The buffer holding the data\r
+  @param  DataLength             Then length of the data\r
+  @param  UsbStatus              USB result\r
+\r
+  @retval EFI_INVALID_PARAMETER  The parameters are invalid\r
+  @retval EFI_SUCCESS            The control transfer succeded.\r
+  @retval Others                 Failed to execute the transfer\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoControlTransfer (\r
+  IN  EFI_USB_IO_PROTOCOL     *This,\r
+  IN  EFI_USB_DEVICE_REQUEST  *Request,\r
+  IN  EFI_USB_DATA_DIRECTION  Direction,\r
+  IN  UINT32                  Timeout,\r
+  IN  OUT VOID                *Data       OPTIONAL,\r
+  IN  UINTN                   DataLength  OPTIONAL,\r
+  OUT UINT32                  *UsbStatus\r
+  );\r
+\r
+/**\r
+  Execute a bulk transfer to the device endpoint.\r
+\r
+  @param  This                   The USB IO instance.\r
+  @param  Endpoint               The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of the data to transfer.\r
+  @param  Timeout                Time to wait before timeout.\r
+  @param  UsbStatus              The result of USB transfer.\r
+\r
+  @retval EFI_SUCCESS            The bulk transfer is OK.\r
+  @retval EFI_INVALID_PARAMETER  Some parameters are invalid.\r
+  @retval Others                 Failed to execute transfer, reason returned in\r
+                                 UsbStatus.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoBulkTransfer (\r
+  IN  EFI_USB_IO_PROTOCOL *This,\r
+  IN  UINT8               Endpoint,\r
+  IN  OUT VOID            *Data,\r
+  IN  OUT UINTN           *DataLength,\r
+  IN  UINTN               Timeout,\r
+  OUT UINT32              *UsbStatus\r
+  );\r
+\r
+/**\r
+  Execute a synchronous interrupt transfer.\r
+\r
+  @param  This                   The USB IO instance.\r
+  @param  Endpoint               The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of the data to transfer.\r
+  @param  Timeout                Time to wait before timeout.\r
+  @param  UsbStatus              The result of USB transfer.\r
+\r
+  @retval EFI_SUCCESS            The synchronous interrupt transfer is OK.\r
+  @retval EFI_INVALID_PARAMETER  Some parameters are invalid.\r
+  @retval Others                 Failed to execute transfer, reason returned in\r
+                                 UsbStatus.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoSyncInterruptTransfer (\r
+  IN  EFI_USB_IO_PROTOCOL *This,\r
+  IN  UINT8               Endpoint,\r
+  IN  OUT VOID            *Data,\r
+  IN  OUT UINTN           *DataLength,\r
+  IN  UINTN               Timeout,\r
+  OUT UINT32              *UsbStatus\r
+  );\r
+\r
+/**\r
+  Queue a new asynchronous interrupt transfer, or remove the old\r
+  request if (IsNewTransfer == FALSE).\r
+\r
+  @param  This                   The USB_IO instance.\r
+  @param  Endpoint               The device endpoint.\r
+  @param  IsNewTransfer          Whether this is a new request, if it's old, remove\r
+                                 the request.\r
+  @param  PollInterval           The interval to poll the transfer result, (in ms).\r
+  @param  DataLength             The length of perodic data transfer.\r
+  @param  Callback               The function to call periodically when transfer is\r
+                                 ready.\r
+  @param  Context                The context to the callback.\r
+\r
+  @retval EFI_SUCCESS            New transfer is queued or old request is removed.\r
+  @retval EFI_INVALID_PARAMETER  Some parameters are invalid.\r
+  @retval Others                 Failed to queue the new request or remove the old\r
+                                 request.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoAsyncInterruptTransfer (\r
+  IN EFI_USB_IO_PROTOCOL              *This,\r
+  IN UINT8                            Endpoint,\r
+  IN BOOLEAN                          IsNewTransfer,\r
+  IN UINTN                            PollInterval        OPTIONAL,\r
+  IN UINTN                            DataLength          OPTIONAL,\r
+  IN EFI_ASYNC_USB_TRANSFER_CALLBACK  Callback            OPTIONAL,\r
+  IN VOID                             *Context            OPTIONAL\r
+  );\r
+\r
+/**\r
+  Execute a synchronous isochronous transfer.\r
+\r
+  @param  This                   The USB IO instance.\r
+  @param  DeviceEndpoint         The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of the data to transfer.\r
+  @param  UsbStatus              The result of USB transfer.\r
+\r
+  @retval EFI_UNSUPPORTED        Currently isochronous transfer isn't supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoIsochronousTransfer (\r
+  IN  EFI_USB_IO_PROTOCOL *This,\r
+  IN  UINT8               DeviceEndpoint,\r
+  IN  OUT VOID            *Data,\r
+  IN  UINTN               DataLength,\r
+  OUT UINT32              *Status\r
+  );\r
+\r
+/**\r
+  Queue an asynchronous isochronous transfer.\r
+\r
+  @param  This                   The USB_IO instance.\r
+  @param  DeviceEndpoint         The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of perodic data transfer.\r
+  @param  IsochronousCallBack    The function to call periodically when transfer is\r
+                                 ready.\r
+  @param  Context                The context to the callback.\r
+\r
+  @retval EFI_UNSUPPORTED        Currently isochronous transfer isn't supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoAsyncIsochronousTransfer (\r
+  IN EFI_USB_IO_PROTOCOL              *This,\r
+  IN UINT8                            DeviceEndpoint,\r
+  IN OUT VOID                         *Data,\r
+  IN UINTN                            DataLength,\r
+  IN EFI_ASYNC_USB_TRANSFER_CALLBACK  IsochronousCallBack,\r
+  IN VOID                             *Context              OPTIONAL\r
+  );\r
+\r
+/**\r
+  Retrieve the device descriptor of the device.\r
+\r
+  @param  This                   The USB IO instance.\r
+  @param  Descriptor             The variable to receive the device descriptor.\r
+\r
+  @retval EFI_SUCCESS            The device descriptor is returned.\r
+  @retval EFI_INVALID_PARAMETER  The parameter is invalid.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoGetDeviceDescriptor (\r
+  IN  EFI_USB_IO_PROTOCOL       *This,\r
+  OUT EFI_USB_DEVICE_DESCRIPTOR *Descriptor\r
+  );\r
+\r
+/**\r
+  Return the configuration descriptor of the current active configuration.\r
+\r
+  @param  This                   The USB IO instance.\r
+  @param  Descriptor             The USB configuration descriptor.\r
+\r
+  @retval EFI_SUCCESS            The active configuration descriptor is returned.\r
+  @retval EFI_INVALID_PARAMETER  Some parameter is invalid.\r
+  @retval EFI_NOT_FOUND          Currently no active configuration is selected.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoGetActiveConfigDescriptor (\r
+  IN  EFI_USB_IO_PROTOCOL       *This,\r
+  OUT EFI_USB_CONFIG_DESCRIPTOR *Descriptor\r
+  );\r
+\r
+/**\r
+  Retrieve the active interface setting descriptor for this USB IO instance.\r
+\r
+  @param  This                   The USB IO instance.\r
+  @param  Descriptor             The variable to receive active interface setting.\r
+\r
+  @retval EFI_SUCCESS            The active interface setting is returned.\r
+  @retval EFI_INVALID_PARAMETER  Some parameter is invalid.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoGetInterfaceDescriptor (\r
+  IN  EFI_USB_IO_PROTOCOL           *This,\r
+  OUT EFI_USB_INTERFACE_DESCRIPTOR  *Descriptor\r
+  );\r
+\r
+/**\r
+  Retrieve the endpoint descriptor from this interface setting.\r
+\r
+  @param  This                   The USB IO instance.\r
+  @param  Index                  The index (start from zero) of the endpoint to\r
+                                 retrieve.\r
+  @param  Descriptor             The variable to receive the descriptor.\r
+\r
+  @retval EFI_SUCCESS            The endpoint descriptor is returned.\r
+  @retval EFI_INVALID_PARAMETER  Some parameter is invalid.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoGetEndpointDescriptor (\r
+  IN  EFI_USB_IO_PROTOCOL         *This,\r
+  IN  UINT8                       Index,\r
+  OUT EFI_USB_ENDPOINT_DESCRIPTOR *Descriptor\r
+  );\r
+\r
+/**\r
+  Retrieve the supported language ID table from the device.\r
+\r
+  @param  This                   The USB IO instance.\r
+  @param  LangIDTable            The table to return the language IDs.\r
+  @param  TableSize              The size, in bytes, of the table LangIDTable.\r
+\r
+  @retval EFI_SUCCESS            The language ID is return.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoGetSupportedLanguages (\r
+  IN  EFI_USB_IO_PROTOCOL *This,\r
+  OUT UINT16              **LangIDTable,\r
+  OUT UINT16              *TableSize\r
+  );\r
+\r
+/**\r
+  Retrieve an indexed string in the language of LangID.\r
+\r
+  @param  This                   The USB IO instance.\r
+  @param  LangID                 The language ID of the string to retrieve.\r
+  @param  StringIndex            The index of the string.\r
+  @param  String                 The variable to receive the string.\r
+\r
+  @retval EFI_SUCCESS            The string is returned.\r
+  @retval EFI_NOT_FOUND          No such string existed.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoGetStringDescriptor (\r
+  IN  EFI_USB_IO_PROTOCOL   *This,\r
+  IN  UINT16                LangID,\r
+  IN  UINT8                 StringIndex,\r
+  OUT CHAR16                **String\r
+  );\r
+\r
+/**\r
+  Reset the device, then if that succeeds, reconfigure the\r
+  device with its address and current active configuration.\r
+\r
+  @param  This                   The USB IO instance.\r
+\r
+  @retval EFI_SUCCESS            The device is reset and configured.\r
+  @retval Others                 Failed to reset the device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbIoPortReset (\r
+  IN EFI_USB_IO_PROTOCOL  *This\r
+  );\r
+\r
+/**\r
+  Install Usb Bus Protocol on host controller, and start the Usb bus.\r
+\r
+  @param This                    The USB bus driver binding instance.\r
+  @param Controller              The controller to check.\r
+  @param RemainingDevicePath     The remaining device patch.\r
+\r
+  @retval EFI_SUCCESS            The controller is controlled by the usb bus.\r
+  @retval EFI_ALREADY_STARTED    The controller is already controlled by the usb bus.\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to allocate resources.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbBusBuildProtocol (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  );\r
+\r
+/**\r
+  The USB bus driver entry pointer.\r
+\r
+  @param ImageHandle       The driver image handle.\r
+  @param SystemTable       The system table.\r
+\r
+  @return EFI_SUCCESS      The component name protocol is installed.\r
+  @return Others           Failed to init the usb driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbBusDriverEntryPoint (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  );\r
+\r
+/**\r
+  Check whether USB bus driver support this device.\r
+\r
+  @param  This                   The USB bus driver binding protocol.\r
+  @param  Controller             The controller handle to check.\r
+  @param  RemainingDevicePath    The remaining device path.\r
+\r
+  @retval EFI_SUCCESS            The bus supports this controller.\r
+  @retval EFI_UNSUPPORTED        This device isn't supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbBusControllerDriverSupported (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  );\r
+\r
+/**\r
+  Start to process the controller.\r
+\r
+  @param  This                   The USB bus driver binding instance.\r
+  @param  Controller             The controller to check.\r
+  @param  RemainingDevicePath    The remaining device patch.\r
+\r
+  @retval EFI_SUCCESS            The controller is controlled by the usb bus.\r
+  @retval EFI_ALREADY_STARTED    The controller is already controlled by the usb\r
+                                 bus.\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to allocate resources.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbBusControllerDriverStart (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  );\r
+\r
+/**\r
+  Stop handle the controller by this USB bus driver.\r
+\r
+  @param  This                   The USB bus driver binding protocol.\r
+  @param  Controller             The controller to release.\r
+  @param  NumberOfChildren       The child of USB bus that opened controller\r
+                                 BY_CHILD.\r
+  @param  ChildHandleBuffer      The array of child handle.\r
+\r
+  @retval EFI_SUCCESS            The controller or children are stopped.\r
+  @retval EFI_DEVICE_ERROR       Failed to stop the driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbBusControllerDriverStop (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN UINTN                        NumberOfChildren,\r
+  IN EFI_HANDLE                   *ChildHandleBuffer\r
+  );\r
+\r
 extern EFI_USB_IO_PROTOCOL            mUsbIoProtocol;\r
 extern EFI_DRIVER_BINDING_PROTOCOL    mUsbBusDriverBinding;\r
 extern EFI_COMPONENT_NAME_PROTOCOL    mUsbBusComponentName;\r