]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Protocol/UsbIo.h
MdePkg: Clean up source files
[mirror_edk2.git] / MdePkg / Include / Protocol / UsbIo.h
index 48d1ba32cf773cfe327bdb76e252e1d13b25a02a..1d102f17aa19350b9bc416f4b0460b766024ac18 100644 (file)
@@ -1,16 +1,18 @@
 /** @file\r
-  EFI Usb I/O Protocol\r
+  EFI Usb I/O Protocol as defined in UEFI specification.\r
+  This protocol is used by code, typically drivers, running in the EFI\r
+  boot services environment to access USB devices like USB keyboards,\r
+  mice and mass storage devices. In particular, functions for managing devices\r
+  on USB buses are defined here.\r
 \r
-  Copyright (c) 2006, 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
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  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:  UsbIo.h\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
 \r
 typedef struct _EFI_USB_IO_PROTOCOL   EFI_USB_IO_PROTOCOL;\r
 \r
-/**                                                                 \r
+//\r
+// Related Definition for EFI USB I/O protocol\r
+//\r
+\r
+//\r
+// USB standard descriptors and reqeust\r
+//\r
+typedef USB_DEVICE_REQUEST        EFI_USB_DEVICE_REQUEST;\r
+typedef USB_DEVICE_DESCRIPTOR     EFI_USB_DEVICE_DESCRIPTOR;\r
+typedef USB_CONFIG_DESCRIPTOR     EFI_USB_CONFIG_DESCRIPTOR;\r
+typedef USB_INTERFACE_DESCRIPTOR  EFI_USB_INTERFACE_DESCRIPTOR;\r
+typedef USB_ENDPOINT_DESCRIPTOR   EFI_USB_ENDPOINT_DESCRIPTOR;\r
+\r
+///\r
+/// USB data transfer direction\r
+///\r
+typedef enum {\r
+  EfiUsbDataIn,\r
+  EfiUsbDataOut,\r
+  EfiUsbNoData\r
+} EFI_USB_DATA_DIRECTION;\r
+\r
+//\r
+// USB Transfer Results\r
+//\r
+#define EFI_USB_NOERROR             0x00\r
+#define EFI_USB_ERR_NOTEXECUTE      0x01\r
+#define EFI_USB_ERR_STALL           0x02\r
+#define EFI_USB_ERR_BUFFER          0x04\r
+#define EFI_USB_ERR_BABBLE          0x08\r
+#define EFI_USB_ERR_NAK             0x10\r
+#define EFI_USB_ERR_CRC             0x20\r
+#define EFI_USB_ERR_TIMEOUT         0x40\r
+#define EFI_USB_ERR_BITSTUFF        0x80\r
+#define EFI_USB_ERR_SYSTEM          0x100\r
+\r
+/**\r
   Async USB transfer callback routine.\r
-    \r
+\r
   @param  Data                  Data received or sent via the USB Asynchronous Transfer, if the\r
-                                transfer completed successfully.                               \r
+                                transfer completed successfully.\r
   @param  DataLength            The length of Data received or sent via the Asynchronous\r
-                                Transfer, if transfer successfully completes.                                           \r
+                                Transfer, if transfer successfully completes.\r
   @param  Context               Data passed from UsbAsyncInterruptTransfer() request.\r
   @param  Status                Indicates the result of the asynchronous transfer.\r
-                                \r
-  @retval EFI_SUCCESS           The asynchronous USB transfer request has been successfully executed.  \r
+\r
+  @retval EFI_SUCCESS           The asynchronous USB transfer request has been successfully executed.\r
   @retval EFI_DEVICE_ERROR      The asynchronous USB transfer request failed.\r
-                                   \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_ASYNC_USB_TRANSFER_CALLBACK) (\r
+(EFIAPI *EFI_ASYNC_USB_TRANSFER_CALLBACK)(\r
   IN VOID         *Data,\r
   IN UINTN        DataLength,\r
   IN VOID         *Context,\r
@@ -57,31 +95,31 @@ EFI_STATUS
 //\r
 \r
 \r
-/**                                                                 \r
+/**\r
   This function is used to manage a USB device with a control transfer pipe. A control transfer is\r
-  typically used to perform device initialization and configuration.                              \r
-    \r
-  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
+  typically used to perform device initialization and configuration.\r
+\r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.\r
   @param  Request               A pointer to the USB device request that will be sent to the USB\r
-                                device.                                                         \r
+                                device.\r
   @param  Direction             Indicates the data direction.\r
-  @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
-                                device or received from USB device.                            \r
   @param  Timeout               Indicating the transfer should be completed within this time frame.\r
-                                The units are in milliseconds.                                       \r
+                                The units are in milliseconds.\r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
+                                device or received from USB device.\r
   @param  DataLength            The size, in bytes, of the data buffer specified by Data.\r
   @param  Status                A pointer to the result of the USB transfer.\r
-                                \r
+\r
   @retval EFI_SUCCESS           The control transfer has been successfully executed.\r
   @retval EFI_DEVICE_ERROR      The transfer failed. The transfer status is returned in Status.\r
   @retval EFI_INVALID_PARAMETE  One or more parameters are invalid.\r
   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
   @retval EFI_TIMEOUT           The control transfer fails due to timeout.\r
-                                   \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_CONTROL_TRANSFER) (\r
+(EFIAPI *EFI_USB_IO_CONTROL_TRANSFER)(\r
   IN EFI_USB_IO_PROTOCOL                        *This,\r
   IN EFI_USB_DEVICE_REQUEST                     *Request,\r
   IN EFI_USB_DATA_DIRECTION                     Direction,\r
@@ -91,30 +129,40 @@ EFI_STATUS
   OUT UINT32                                    *Status\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   This function is used to manage a USB device with the bulk transfer pipe. Bulk Transfers are\r
   typically used to transfer large amounts of data to/from USB devices.\r
-    \r
-  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
-  @param  DeviceEndpoint        A pointer to the USB device request that will be sent to the USB\r
-                                device.                                                         \r
+\r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.\r
+  @param  DeviceEndpoint        The destination USB device endpoint to which the\r
+                                device request is being sent. DeviceEndpoint must\r
+                                be between 0x01 and 0x0F or between 0x81 and 0x8F,\r
+                                otherwise EFI_INVALID_PARAMETER is returned. If\r
+                                the endpoint is not a BULK endpoint, EFI_INVALID_PARAMETER\r
+                                is returned. The MSB of this parameter indicates\r
+                                the endpoint direction. The number "1" stands for\r
+                                an IN endpoint, and "0" stands for an OUT endpoint.\r
   @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
-                                device or received from USB device.                            \r
+                                device or received from USB device.\r
   @param  DataLength            The size, in bytes, of the data buffer specified by Data.\r
+                                On input, the size, in bytes, of the data buffer specified by Data.\r
+                                On output, the number of bytes that were actually transferred.\r
   @param  Timeout               Indicating the transfer should be completed within this time frame.\r
-                                The units are in milliseconds.                                           \r
+                                The units are in milliseconds. If Timeout is 0, then the\r
+                                caller must wait for the function to be completed until\r
+                                EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
   @param  Status                This parameter indicates the USB transfer status.\r
-                                \r
+\r
   @retval EFI_SUCCESS           The bulk transfer has been successfully executed.\r
   @retval EFI_DEVICE_ERROR      The transfer failed. The transfer status is returned in Status.\r
   @retval EFI_INVALID_PARAMETE  One or more parameters are invalid.\r
   @retval EFI_OUT_OF_RESOURCES  The request could not be submitted due to a lack of resources.\r
   @retval EFI_TIMEOUT           The control transfer fails due to timeout.\r
-                                   \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_BULK_TRANSFER) (\r
+(EFIAPI *EFI_USB_IO_BULK_TRANSFER)(\r
   IN EFI_USB_IO_PROTOCOL            *This,\r
   IN UINT8                          DeviceEndpoint,\r
   IN OUT VOID                       *Data,\r
@@ -123,33 +171,43 @@ EFI_STATUS
   OUT UINT32                        *Status\r
   );\r
 \r
-/**                                                                 \r
-  This function is used to manage a USB device with an interrupt transfer pipe. An Asynchronous   \r
-  Interrupt Transfer is typically used to query a device's status at a fixed rate. For example,  \r
+/**\r
+  This function is used to manage a USB device with an interrupt transfer pipe. An Asynchronous\r
+  Interrupt Transfer is typically used to query a device's status at a fixed rate. For example,\r
   keyboard, mouse, and hub devices use this type of transfer to query their interrupt endpoints at\r
-  a fixed rate.                                                                                   \r
-    \r
-  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
-  @param  DeviceEndpoint        A pointer to the USB device request that will be sent to the USB\r
-                                device.                                                         \r
-  @param  IsNewTransfer         If TRUE, a new transfer will be submitted to USB controller. If                             \r
+  a fixed rate.\r
+\r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.\r
+  @param  DeviceEndpoint        The destination USB device endpoint to which the\r
+                                device request is being sent. DeviceEndpoint must\r
+                                be between 0x01 and 0x0F or between 0x81 and 0x8F,\r
+                                otherwise EFI_INVALID_PARAMETER is returned. If\r
+                                the endpoint is not a BULK endpoint, EFI_INVALID_PARAMETER\r
+                                is returned. The MSB of this parameter indicates\r
+                                the endpoint direction. The number "1" stands for\r
+                                an IN endpoint, and "0" stands for an OUT endpoint.\r
+  @param  IsNewTransfer         If TRUE, a new transfer will be submitted to USB controller. If\r
                                 FALSE, the interrupt transfer is deleted from the device's interrupt\r
-                                transfer queue.                                                      \r
-  @param  PollingInterval       Indicates the periodic rate, in milliseconds, that the transfer is to be                        \r
-                                executed.                                                                 \r
+                                transfer queue.\r
+  @param  PollingInterval       Indicates the periodic rate, in milliseconds, that the transfer is to be\r
+                                executed.This parameter is required when IsNewTransfer is TRUE. The\r
+                                value must be between 1 to 255, otherwise EFI_INVALID_PARAMETER is returned.\r
+                                The units are in milliseconds.\r
   @param  DataLength            Specifies the length, in bytes, of the data to be received from the\r
-                                USB device.                                                        \r
-  @param  Context               Data passed to the InterruptCallback function.\r
+                                USB device. This parameter is only required when IsNewTransfer is TRUE.\r
   @param  InterruptCallback     The Callback function. This function is called if the asynchronous\r
-                                interrupt transfer is completed.\r
-                                \r
+                                interrupt transfer is completed. This parameter is required\r
+                                when IsNewTransfer is TRUE.\r
+  @param  Context               Data passed to the InterruptCallback function. This is an optional\r
+                                parameter and may be NULL.\r
+\r
   @retval EFI_SUCCESS           The asynchronous USB transfer request transfer has been successfully executed.\r
-  @retval EFI_DEVICE_ERROR      The asynchronous USB transfer request failed.   \r
-                                   \r
+  @retval EFI_DEVICE_ERROR      The asynchronous USB transfer request failed.\r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_ASYNC_INTERRUPT_TRANSFER) (\r
+(EFIAPI *EFI_USB_IO_ASYNC_INTERRUPT_TRANSFER)(\r
   IN EFI_USB_IO_PROTOCOL                                 *This,\r
   IN UINT8                                               DeviceEndpoint,\r
   IN BOOLEAN                                             IsNewTransfer,\r
@@ -159,28 +217,37 @@ EFI_STATUS
   IN VOID                                                *Context OPTIONAL\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   This function is used to manage a USB device with an interrupt transfer pipe.\r
-    \r
-  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
-  @param  DeviceEndpoint        A pointer to the USB device request that will be sent to the USB\r
-                                device.                                                         \r
+\r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.\r
+  @param  DeviceEndpoint        The destination USB device endpoint to which the\r
+                                device request is being sent. DeviceEndpoint must\r
+                                be between 0x01 and 0x0F or between 0x81 and 0x8F,\r
+                                otherwise EFI_INVALID_PARAMETER is returned. If\r
+                                the endpoint is not a BULK endpoint, EFI_INVALID_PARAMETER\r
+                                is returned. The MSB of this parameter indicates\r
+                                the endpoint direction. The number "1" stands for\r
+                                an IN endpoint, and "0" stands for an OUT endpoint.\r
   @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
-                                device or received from USB device.                            \r
+                                device or received from USB device.\r
   @param  DataLength            On input, then size, in bytes, of the buffer Data. On output, the\r
-                                amount of data actually transferred.                             \r
-  @param  Timeout               The time out, in seconds, for this transfer.\r
-  @param  Status                This parameter indicates the USB transfer status.                                \r
-                                \r
+                                amount of data actually transferred.\r
+  @param  Timeout               The time out, in seconds, for this transfer. If Timeout is 0,\r
+                                then the caller must wait for the function to be completed\r
+                                until EFI_SUCCESS or EFI_DEVICE_ERROR is returned. If the\r
+                                transfer is not completed in this time frame, then EFI_TIMEOUT is returned.\r
+  @param  Status                This parameter indicates the USB transfer status.\r
+\r
   @retval EFI_SUCCESS           The sync interrupt transfer has been successfully executed.\r
   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
-  @retval EFI_DEVICE_ERROR      The sync interrupt transfer request failed.   \r
+  @retval EFI_DEVICE_ERROR      The sync interrupt transfer request failed.\r
   @retval EFI_OUT_OF_RESOURCES  The request could not be submitted due to a lack of resources.\r
-  @retval EFI_TIMEOUT           The transfer fails due to timeout.                                                       \r
+  @retval EFI_TIMEOUT           The transfer fails due to timeout.\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_SYNC_INTERRUPT_TRANSFER) (\r
+(EFIAPI *EFI_USB_IO_SYNC_INTERRUPT_TRANSFER)(\r
   IN EFI_USB_IO_PROTOCOL            *This,\r
   IN     UINT8                      DeviceEndpoint,\r
   IN OUT VOID                       *Data,\r
@@ -189,28 +256,34 @@ EFI_STATUS
   OUT    UINT32                     *Status\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous\r
   transfer is typically used to transfer streaming data.\r
-    \r
-  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
-  @param  DeviceEndpoint        A pointer to the USB device request that will be sent to the USB\r
-                                device.                                                         \r
+\r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.\r
+  @param  DeviceEndpoint        The destination USB device endpoint to which the\r
+                                device request is being sent. DeviceEndpoint must\r
+                                be between 0x01 and 0x0F or between 0x81 and 0x8F,\r
+                                otherwise EFI_INVALID_PARAMETER is returned. If\r
+                                the endpoint is not a BULK endpoint, EFI_INVALID_PARAMETER\r
+                                is returned. The MSB of this parameter indicates\r
+                                the endpoint direction. The number "1" stands for\r
+                                an IN endpoint, and "0" stands for an OUT endpoint.\r
   @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
-                                device or received from USB device.                            \r
-  @param  DataLength            The size, in bytes, of the data buffer specified by Data.                                         \r
-  @param  Status                This parameter indicates the USB transfer status.                                \r
-                                \r
+                                device or received from USB device.\r
+  @param  DataLength            The size, in bytes, of the data buffer specified by Data.\r
+  @param  Status                This parameter indicates the USB transfer status.\r
+\r
   @retval EFI_SUCCESS           The isochronous transfer has been successfully executed.\r
   @retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid.\r
   @retval EFI_DEVICE_ERROR      The transfer failed due to the reason other than timeout, The error status\r
-                                is returned in Status.                                                    \r
+                                is returned in Status.\r
   @retval EFI_OUT_OF_RESOURCES  The request could not be submitted due to a lack of resources.\r
-  @retval EFI_TIMEOUT           The transfer fails due to timeout.                                                       \r
+  @retval EFI_TIMEOUT           The transfer fails due to timeout.\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_ISOCHRONOUS_TRANSFER) (\r
+(EFIAPI *EFI_USB_IO_ISOCHRONOUS_TRANSFER)(\r
   IN EFI_USB_IO_PROTOCOL            *This,\r
   IN     UINT8                      DeviceEndpoint,\r
   IN OUT VOID                       *Data,\r
@@ -218,28 +291,36 @@ EFI_STATUS
   OUT    UINT32                     *Status\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous\r
-  transfer is typically used to transfer streaming data.                                      \r
-    \r
-  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
-  @param  DeviceEndpoint        A pointer to the USB device request that will be sent to the USB\r
-                                device.                                                         \r
+  transfer is typically used to transfer streaming data.\r
+\r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.\r
+  @param  DeviceEndpoint        The destination USB device endpoint to which the\r
+                                device request is being sent. DeviceEndpoint must\r
+                                be between 0x01 and 0x0F or between 0x81 and 0x8F,\r
+                                otherwise EFI_INVALID_PARAMETER is returned. If\r
+                                the endpoint is not a BULK endpoint, EFI_INVALID_PARAMETER\r
+                                is returned. The MSB of this parameter indicates\r
+                                the endpoint direction. The number "1" stands for\r
+                                an IN endpoint, and "0" stands for an OUT endpoint.\r
   @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
-                                device or received from USB device.                            \r
-  @param  DataLength            The size, in bytes, of the data buffer specified by Data.                                         \r
+                                device or received from USB device.\r
+  @param  DataLength            The size, in bytes, of the data buffer specified by Data.\r
+                                This is an optional parameter and may be NULL.\r
+  @param  IsochronousCallback   The IsochronousCallback() function.This function is\r
+                                called if the requested isochronous transfer is completed.\r
   @param  Context               Data passed to the IsochronousCallback() function.\r
-  @param  IsochronousCallback   The IsochronousCallback() function.\r
-                                \r
+\r
   @retval EFI_SUCCESS           The asynchronous isochronous transfer has been successfully submitted\r
                                 to the system.\r
   @retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid.\r
   @retval EFI_OUT_OF_RESOURCES  The request could not be submitted due to a lack of resources.\r
-                                           \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_ASYNC_ISOCHRONOUS_TRANSFER) (\r
+(EFIAPI *EFI_USB_IO_ASYNC_ISOCHRONOUS_TRANSFER)(\r
   IN EFI_USB_IO_PROTOCOL              *This,\r
   IN UINT8                            DeviceEndpoint,\r
   IN OUT VOID                         *Data,\r
@@ -248,146 +329,157 @@ EFI_STATUS
   IN VOID                             *Context OPTIONAL\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Resets and reconfigures the USB controller. This function will work for all USB devices except\r
-  USB Hub Controllers.                                                                          \r
-    \r
-  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
-                                \r
-  @retval EFI_SUCCESS           The USB controller was reset.                                \r
+  USB Hub Controllers.\r
+\r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           The USB controller was reset.\r
   @retval EFI_INVALID_PARAMETER If the controller specified by This is a USB hub.\r
   @retval EFI_DEVICE_ERROR      An error occurred during the reconfiguration process.\r
-                                           \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_PORT_RESET) (\r
+(EFIAPI *EFI_USB_IO_PORT_RESET)(\r
   IN EFI_USB_IO_PROTOCOL    *This\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Retrieves the USB Device Descriptor.\r
-    \r
-  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+\r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.\r
   @param  DeviceDescriptor      A pointer to the caller allocated USB Device Descriptor.\r
-                                \r
+\r
   @retval EFI_SUCCESS           The device descriptor was retrieved successfully.\r
   @retval EFI_INVALID_PARAMETER DeviceDescriptor is NULL.\r
   @retval EFI_NOT_FOUND         The device descriptor was not found. The device may not be configured.\r
-                                           \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_GET_DEVICE_DESCRIPTOR) (\r
+(EFIAPI *EFI_USB_IO_GET_DEVICE_DESCRIPTOR)(\r
   IN EFI_USB_IO_PROTOCOL            *This,\r
   OUT EFI_USB_DEVICE_DESCRIPTOR     *DeviceDescriptor\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Retrieves the USB Device Descriptor.\r
-    \r
-  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+\r
+  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.\r
   @param  ConfigurationDescriptor A pointer to the caller allocated USB Active Configuration\r
-                                  Descriptor.                                               \r
+                                  Descriptor.\r
   @retval EFI_SUCCESS             The active configuration descriptor was retrieved successfully.\r
   @retval EFI_INVALID_PARAMETER   ConfigurationDescriptor is NULL.\r
   @retval EFI_NOT_FOUND           An active configuration descriptor cannot be found. The device may not\r
-                                  be configured.                                                        \r
-                                           \r
+                                  be configured.\r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_GET_CONFIG_DESCRIPTOR) (\r
+(EFIAPI *EFI_USB_IO_GET_CONFIG_DESCRIPTOR)(\r
   IN EFI_USB_IO_PROTOCOL            *This,\r
   OUT EFI_USB_CONFIG_DESCRIPTOR     *ConfigurationDescriptor\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Retrieves the Interface Descriptor for a USB Device Controller. As stated earlier, an interface\r
-  within a USB device is equivalently to a USB Controller within the current configuration.      \r
-    \r
-  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+  within a USB device is equivalently to a USB Controller within the current configuration.\r
+\r
+  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.\r
   @param  InterfaceDescriptor     A pointer to the caller allocated USB Interface Descriptor within\r
-                                  the configuration setting.                                       \r
+                                  the configuration setting.\r
   @retval EFI_SUCCESS             The interface descriptor retrieved successfully.\r
   @retval EFI_INVALID_PARAMETER   InterfaceDescriptor is NULL.\r
   @retval EFI_NOT_FOUND           The interface descriptor cannot be found. The device may not be\r
-                                  correctly configured.                                          \r
-                                           \r
+                                  correctly configured.\r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_GET_INTERFACE_DESCRIPTOR) (\r
+(EFIAPI *EFI_USB_IO_GET_INTERFACE_DESCRIPTOR)(\r
   IN EFI_USB_IO_PROTOCOL            *This,\r
   OUT EFI_USB_INTERFACE_DESCRIPTOR  *InterfaceDescriptor\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Retrieves an Endpoint Descriptor within a USB Controller.\r
-    \r
-  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+\r
+  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.\r
   @param  EndpointIndex           Indicates which endpoint descriptor to retrieve.\r
   @param  EndpointDescriptor      A pointer to the caller allocated USB Endpoint Descriptor of\r
-                                  a USB controller.                                           \r
-                                                    \r
+                                  a USB controller.\r
+\r
   @retval EFI_SUCCESS             The endpoint descriptor was retrieved successfully.\r
   @retval EFI_INVALID_PARAMETER   One or more parameters are invalid.\r
   @retval EFI_NOT_FOUND           The endpoint descriptor cannot be found. The device may not be\r
-                                  correctly configured.                                         \r
-                                           \r
+                                  correctly configured.\r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_GET_ENDPOINT_DESCRIPTOR) (\r
+(EFIAPI *EFI_USB_IO_GET_ENDPOINT_DESCRIPTOR)(\r
   IN EFI_USB_IO_PROTOCOL            *This,\r
   IN  UINT8                         EndpointIndex,\r
   OUT EFI_USB_ENDPOINT_DESCRIPTOR   *EndpointDescriptor\r
   );\r
 \r
-/**                                                                 \r
-  Retrieves a Unicode string stored in a USB Device.\r
-    \r
-  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+/**\r
+  Retrieves a string stored in a USB Device.\r
+\r
+  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.\r
   @param  LangID                  The Language ID for the string being retrieved.\r
-  @param  StringID                The ID of the string being retrieved.                                                         \r
-  @param  String                  A pointer to a buffer allocated by this function with                \r
-                                  AllocatePool() to store the string.\r
-                                                    \r
-  @retval EFI_SUCCESS             The string was retrieved successfully.  \r
-  @retval EFI_NOT_FOUND           The string specified by LangID and StringID was not found.                                      \r
+  @param  StringID                The ID of the string being retrieved.\r
+  @param  String                  A pointer to a buffer allocated by this function with\r
+                                  AllocatePool() to store the string.If this function\r
+                                  returns EFI_SUCCESS, it stores the string the caller\r
+                                  wants to get. The caller should release the string\r
+                                  buffer with FreePool() after the string is not used any more.\r
+\r
+  @retval EFI_SUCCESS             The string was retrieved successfully.\r
+  @retval EFI_NOT_FOUND           The string specified by LangID and StringID was not found.\r
   @retval EFI_OUT_OF_RESOURCES    There are not enough resources to allocate the return buffer String.\r
-                                           \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_GET_STRING_DESCRIPTOR) (\r
+(EFIAPI *EFI_USB_IO_GET_STRING_DESCRIPTOR)(\r
   IN EFI_USB_IO_PROTOCOL            *This,\r
   IN  UINT16                        LangID,\r
   IN  UINT8                         StringID,\r
   OUT CHAR16                        **String\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Retrieves all the language ID codes that the USB device supports.\r
-    \r
-  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+\r
+  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.\r
   @param  LangIDTable             Language ID for the string the caller wants to get.\r
+                                  This is a 16-bit ID defined by Microsoft. This\r
+                                  buffer pointer is allocated and maintained by\r
+                                  the USB Bus Driver, the caller should not modify\r
+                                  its contents.\r
   @param  TableSize               The size, in bytes, of the table LangIDTable.\r
-                                                    \r
-  @retval EFI_SUCCESS             The support languages were retrieved successfully.  \r
-                                           \r
+\r
+  @retval EFI_SUCCESS             The support languages were retrieved successfully.\r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_USB_IO_GET_SUPPORTED_LANGUAGE) (\r
+(EFIAPI *EFI_USB_IO_GET_SUPPORTED_LANGUAGE)(\r
   IN EFI_USB_IO_PROTOCOL            *This,\r
   OUT UINT16                        **LangIDTable,\r
   OUT UINT16                        *TableSize\r
   );\r
 \r
-//\r
-//  Protocol Interface Structure\r
-//\r
+///\r
+/// The EFI_USB_IO_PROTOCOL provides four basic transfers types described\r
+/// in the USB 1.1 Specification. These include control transfer, interrupt\r
+/// transfer, bulk transfer and isochronous transfer. The EFI_USB_IO_PROTOCOL\r
+/// also provides some basic USB device/controller management and configuration\r
+/// interfaces. A USB device driver uses the services of this protocol to manage USB devices.\r
+///\r
 struct _EFI_USB_IO_PROTOCOL {\r
   //\r
   // IO transfer\r