]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.c
Add some definitions for efi event in Uefi/UefiSpec.h to follow spec.
[mirror_edk2.git] / EdkModulePkg / Bus / Usb / UsbBus / Dxe / usbbus.c
index e1fdce7997108f1ce306d98510a60fef5b04271c..97c9f5efeea018290c7a9ed28eb374604c6c073d 100644 (file)
@@ -1,13 +1,13 @@
 /*++\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
-                                                                                          \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
+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
+\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
@@ -201,7 +201,7 @@ UsbFreeAddress (
   Arguments:\r
    DevAddress  - Usb device address\r
    AddressPool - Pool of usb device address\r
-   \r
+\r
   Returns:\r
    VOID\r
 \r
@@ -259,7 +259,7 @@ UsbBusControllerDriverSupported (
       return EFI_UNSUPPORTED;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Open the IO Abstraction(s) needed to perform the supported test\r
   //\r
@@ -285,7 +285,7 @@ UsbBusControllerDriverSupported (
          This->DriverBindingHandle,\r
          Controller\r
          );\r
-  \r
+\r
   //\r
   // Check whether USB Host Controller Protocol is already\r
   // installed on this handle. If it is installed, we can start\r
@@ -302,7 +302,7 @@ UsbBusControllerDriverSupported (
   if (Status == EFI_ALREADY_STARTED) {\r
     return EFI_SUCCESS;\r
   }\r
-  \r
+\r
   if (EFI_ERROR (Status)) {\r
     Status = gBS->OpenProtocol (\r
                     Controller,\r
@@ -328,7 +328,7 @@ UsbBusControllerDriverSupported (
       );\r
     return EFI_SUCCESS;\r
   }\r
-  \r
+\r
   gBS->CloseProtocol (\r
     Controller,\r
     &gEfiUsb2HcProtocolGuid,\r
@@ -622,8 +622,8 @@ UsbBusControllerDriverStart (
   // Create a timer to query root ports periodically\r
   //\r
   Status = gBS->CreateEvent (\r
-                  EFI_EVENT_TIMER | EFI_EVENT_NOTIFY_SIGNAL,\r
-                  EFI_TPL_CALLBACK,\r
+                  EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
+                  TPL_CALLBACK,\r
                   RootHubEnumeration,\r
                   RootHubController,\r
                   &RootHubController->HubNotify\r
@@ -670,7 +670,7 @@ UsbBusControllerDriverStart (
   // there will be an interval between bus start and devices start.\r
   //\r
   gBS->SignalEvent (RootHubController->HubNotify);\r
-  \r
+\r
   Status = gBS->SetTimer (\r
                   RootHubController->HubNotify,\r
                   TimerPeriodic,\r
@@ -1229,7 +1229,7 @@ UsbDeviceDeConfiguration (
   Arguments:\r
     UsbIoDevice     -   The device to be deconfigured.\r
 \r
-  Returns: \r
+  Returns:\r
     EFI_SUCCESS\r
     EFI_DEVICE_ERROR\r
 \r
@@ -1307,7 +1307,7 @@ UsbDeviceDeConfiguration (
             NULL\r
             );\r
     }\r
-    \r
+\r
     //\r
     // remove child handle reference to the USB_HC_PROTOCOL\r
     //\r
@@ -1422,7 +1422,7 @@ OnHubInterruptComplete (
         &UsbResult\r
         );\r
     }\r
-    \r
+\r
     //\r
     // Delete & Submit this interrupt again\r
     //\r
@@ -1467,7 +1467,7 @@ OnHubInterruptComplete (
   if (DataLength == 0 || Data == NULL) {\r
     return EFI_SUCCESS;\r
   }\r
-  \r
+\r
   //\r
   // Scan which port has status change\r
   // Bit 0 stands for hub itself, other bit stands for\r
@@ -1500,18 +1500,18 @@ RootHubEnumeration (
 /*++\r
 \r
   Routine Description:\r
-  \r
+\r
     This is USB RootHub enumerator\r
 \r
   Arguments:\r
-  \r
+\r
     Event   -   Indicating which event is signaled\r
     Context -  actually it is a USB_IO_DEVICE\r
 \r
   Returns:\r
-  \r
+\r
     VOID\r
-    \r
+\r
 --*/\r
 {\r
   USB_IO_CONTROLLER_DEVICE  *HubController;\r
@@ -1565,7 +1565,7 @@ RootHubEnumeration (
       );\r
 \r
     if (IsPortConnect (HubPortStatus.PortStatus)) {\r
-        \r
+\r
       //\r
       // There is something connected to this port\r
       //\r
@@ -1602,8 +1602,8 @@ RootHubEnumeration (
       // Process of identify device speed\r
       //\r
       Status = IdentifyDeviceSpeed (\r
-                 UsbBusDev, \r
-                 NewDevice, \r
+                 UsbBusDev,\r
+                 NewDevice,\r
                  Index\r
                  );\r
       if (EFI_ERROR (Status)) {\r
@@ -1667,8 +1667,8 @@ RootHubEnumeration (
           // Create an event to do hub enumeration\r
           //\r
           gBS->CreateEvent (\r
-                EFI_EVENT_NOTIFY_SIGNAL,\r
-                EFI_TPL_CALLBACK,\r
+                EVT_NOTIFY_SIGNAL,\r
+                TPL_CALLBACK,\r
                 HubEnumeration,\r
                 NewController,\r
                 &NewController->HubNotify\r
@@ -1727,11 +1727,11 @@ HubEnumeration (
 /*++\r
 \r
   Routine Description:\r
-  \r
+\r
     This is Usb Hub enumerator\r
 \r
   Arguments:\r
-  \r
+\r
     Event    -   Indicating which event is signaled\r
     Context  -  actually it is a USB_IO_DEVICE\r
 \r
@@ -2040,8 +2040,8 @@ HubEnumeration (
           // Create an event to do hub enumeration\r
           //\r
           gBS->CreateEvent (\r
-                EFI_EVENT_NOTIFY_SIGNAL,\r
-                EFI_TPL_CALLBACK,\r
+                EVT_NOTIFY_SIGNAL,\r
+                TPL_CALLBACK,\r
                 HubEnumeration,\r
                 NewController,\r
                 &NewController->HubNotify\r
@@ -2213,7 +2213,7 @@ ParentPortReset (
     UsbIoController   - Indicating the Usb Controller Device.\r
     ReConfigure       - Do we need to reconfigure it.\r
     RetryTimes        - Retry Times when failed\r
-    \r
+\r
   Returns:\r
     EFI_SUCCESS\r
     EFI_DEVICE_ERROR\r
@@ -2305,7 +2305,7 @@ UsbPortReset (
   if (IsHub (UsbIoController)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   //\r
   // Since at this time, this device has already been configured,\r
   // it needs to be re-configured.\r
@@ -2329,7 +2329,7 @@ ResetRootPort (
     UsbBusDev       - Bus controller of the device.\r
     PortNum         - The given port to be reset.\r
     RetryTimes      - RetryTimes when failed\r
-    \r
+\r
   Returns:\r
     EFI_SUCCESS\r
     EFI_DEVICE_ERROR\r
@@ -2594,22 +2594,22 @@ UsbSetTransactionTranslator (
   IN OUT USB_IO_DEVICE            *Device\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Set Transaction Translator parameter\r
-  \r
+\r
   Arguments:\r
-  \r
+\r
     ParentHubController  - Controller structure of the parent Hub device\r
     ParentPort           - Number of parent port\r
     Device               - Structure of the device\r
-    \r
+\r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS            Success\r
     EFI_OUT_OF_RESOURCES   Cannot allocate resources\r
-    \r
+\r
 --*/\r
 {\r
   USB_IO_CONTROLLER_DEVICE  *AncestorHubController;\r
@@ -2650,19 +2650,19 @@ UsbUnsetTransactionTranslator (
   USB_IO_DEVICE *Device\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Unset Transaction Translator parameter\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     Device - Structure of the device\r
-    \r
+\r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS    Success\r
-    \r
+\r
 --*/\r
 {\r
   if (Device->Translator) {\r
@@ -2681,22 +2681,22 @@ IdentifyDeviceSpeed (
   UINT8                     Index\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Identify speed of USB device\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     UsbBusDev  - UsbBus controller structure of the device\r
     NewDevice  - Devcie controller structure\r
     Index      - Number of the port\r
-    \r
+\r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS        Success\r
     EFI_NOT_FOUND      Device release to CHC or can't be found\r
-    \r
+\r
 --*/\r
 {\r
   EFI_STATUS             Status;\r
@@ -2707,7 +2707,7 @@ IdentifyDeviceSpeed (
     Index,\r
     (EFI_USB_PORT_STATUS *) &HubPortStatus\r
     );\r
-  \r
+\r
   //\r
   // Check device device\r
   //\r
@@ -2717,7 +2717,7 @@ IdentifyDeviceSpeed (
     //\r
     if (HubPortStatus.PortStatus & USB_PORT_STAT_HIGH_SPEED) {\r
       DEBUG ((gUSBDebugLevel, "High Speed Device attached to EHC\n"));\r
-      NewDevice->DeviceSpeed = EFI_USB_SPEED_HIGH; \r
+      NewDevice->DeviceSpeed = EFI_USB_SPEED_HIGH;\r
     } else {\r
       Status = ReleasePortToCHC (UsbBusDev, Index);\r
       if (EFI_ERROR (Status)) {\r
@@ -2733,13 +2733,13 @@ IdentifyDeviceSpeed (
     //\r
     if (HubPortStatus.PortStatus & USB_PORT_STAT_LOW_SPEED) {\r
       DEBUG ((gUSBDebugLevel, "Low Speed Device attached to CHC\n"));\r
-      NewDevice->DeviceSpeed = EFI_USB_SPEED_LOW; \r
+      NewDevice->DeviceSpeed = EFI_USB_SPEED_LOW;\r
     } else {\r
       DEBUG ((gUSBDebugLevel, "FULL Speed Device attached to CHC\n"));\r
-      NewDevice->DeviceSpeed = EFI_USB_SPEED_FULL; \r
+      NewDevice->DeviceSpeed = EFI_USB_SPEED_FULL;\r
     }\r
   }\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -2750,21 +2750,21 @@ ReleasePortToCHC (
   UINT8                     PortNum\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Set bit to release the port owner to CHC\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     UsbBusDev  - UsbBus controller structure of the device\r
     PortNum    - Number of the port\r
-    \r
+\r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS        Success\r
     EFI_DEVICE_ERROR   Fail\r
-    \r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -2789,29 +2789,29 @@ UsbVirtualHcGetCapability (
   OUT UINT8                     *Is64BitCapable\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
-    Virtual interface to Retrieves the capablility of root hub ports \r
+\r
+    Virtual interface to Retrieves the capablility of root hub ports\r
     for both Hc2 and Hc protocol.\r
-    \r
+\r
   Arguments:\r
-  \r
+\r
     UsbBusDev       - A pointer to bus controller of the device.\r
     MaxSpeed        - A pointer to the number of the host controller.\r
     PortNumber      - A pointer to the number of the root hub ports.\r
-    Is64BitCapable  - A pointer to the flag for whether controller supports \r
+    Is64BitCapable  - A pointer to the flag for whether controller supports\r
                       64-bit memory addressing.\r
-    \r
+\r
   Returns:\r
-  \r
-    EFI_SUCCESS \r
+\r
+    EFI_SUCCESS\r
           The host controller capability were retrieved successfully.\r
-    EFI_INVALID_PARAMETER \r
+    EFI_INVALID_PARAMETER\r
           MaxSpeed or PortNumber or Is64BitCapable is NULL.\r
-    EFI_DEVICE_ERROR  \r
-          An error was encountered while attempting to retrieve the capabilities.  \r
-          \r
+    EFI_DEVICE_ERROR\r
+          An error was encountered while attempting to retrieve the capabilities.\r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -2844,59 +2844,59 @@ UsbVirtualHcReset (
   IN UINT16                     Attributes\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Virtual interface to provides software reset for the USB host controller\r
     for both Hc2 and Hc protocol.\r
-  \r
+\r
   Arguments:\r
-  \r
+\r
     UsbBusDev   - A pointer to bus controller of the device.\r
-    Attributes  - A bit mask of the reset operation to perform. \r
+    Attributes  - A bit mask of the reset operation to perform.\r
                 See below for a list of the supported bit mask values.\r
-  \r
+\r
   #define EFI_USB_HC_RESET_GLOBAL  0x0001               // Hc2 and Hc\r
   #define EFI_USB_HC_RESET_HOST_CONTROLLER  0x0002      // Hc2 and Hc\r
   #define EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG  0x0004    // Hc2\r
   #define EFI_USB_HC_RESET_HOST_WITH_DEBUG  0x0008      // Hc2\r
 \r
-  EFI_USB_HC_RESET_GLOBAL \r
+  EFI_USB_HC_RESET_GLOBAL\r
         If this bit is set, a global reset signal will be sent to the USB bus.\r
-        This resets all of the USB bus logic, including the USB host \r
+        This resets all of the USB bus logic, including the USB host\r
         controller hardware and all the devices attached on the USB bus.\r
-  EFI_USB_HC_RESET_HOST_CONTROLLER  \r
-        If this bit is set, the USB host controller hardware will be reset. \r
+  EFI_USB_HC_RESET_HOST_CONTROLLER\r
+        If this bit is set, the USB host controller hardware will be reset.\r
         No reset signal will be sent to the USB bus.\r
   EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG\r
         If this bit is set, a global reset signal will be sent to the USB bus.\r
-        This resets all of the USB bus logic, including the USB host \r
-        controller hardware and all the devices attached on the USB bus. \r
-        If this is an EHCI controller and the debug port has configured, then \r
+        This resets all of the USB bus logic, including the USB host\r
+        controller hardware and all the devices attached on the USB bus.\r
+        If this is an EHCI controller and the debug port has configured, then\r
         this is will still reset the host controller.\r
   EFI_USB_HC_RESET_HOST_WITH_DEBUG\r
-        If this bit is set, the USB host controller hardware will be reset. \r
+        If this bit is set, the USB host controller hardware will be reset.\r
         If this is an EHCI controller and the debug port has been configured,\r
         then this will still reset the host controller.\r
-        \r
+\r
   Returns:\r
-  \r
-    EFI_SUCCESS \r
+\r
+    EFI_SUCCESS\r
         The reset operation succeeded.\r
-    EFI_INVALID_PARAMETER \r
+    EFI_INVALID_PARAMETER\r
         Attributes is not valid.\r
     EFI_UNSUPPOURTED\r
         The type of reset specified by Attributes is not currently supported by\r
         the host controller hardware.\r
     EFI_ACCESS_DENIED\r
-        Reset operation is rejected due to the debug port being configured and \r
-        active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or \r
+        Reset operation is rejected due to the debug port being configured and\r
+        active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or\r
         EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Atrributes can be used to\r
         perform reset operation for this host controller.\r
-    EFI_DEVICE_ERROR  \r
-        An error was encountered while attempting to perform \r
+    EFI_DEVICE_ERROR\r
+        An error was encountered while attempting to perform\r
         the reset operation.\r
-        \r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -2925,36 +2925,36 @@ UsbVirtualHcGetState (
   OUT EFI_USB_HC_STATE          *State\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Virtual interface to retrieves current state of the USB host controller\r
     for both Hc2 and Hc protocol.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     UsbBusDev - A pointer to bus controller of the device.\r
-    State     - A pointer to the EFI_USB_HC_STATE data structure that \r
-              indicates current state of the USB host controller.  \r
+    State     - A pointer to the EFI_USB_HC_STATE data structure that\r
+              indicates current state of the USB host controller.\r
               Type EFI_USB_HC_STATE is defined below.\r
-              \r
+\r
     typedef enum {\r
       EfiUsbHcStateHalt,\r
       EfiUsbHcStateOperational,\r
       EfiUsbHcStateSuspend,\r
       EfiUsbHcStateMaximum\r
     } EFI_USB_HC_STATE;\r
-  \r
+\r
   Returns:\r
-  \r
-    EFI_SUCCESS \r
+\r
+    EFI_SUCCESS\r
             The state information of the host controller was returned in State.\r
-    EFI_INVALID_PARAMETER \r
+    EFI_INVALID_PARAMETER\r
             State is NULL.\r
-    EFI_DEVICE_ERROR  \r
-            An error was encountered while attempting to retrieve the \r
-            host controller's current state.  \r
-            \r
+    EFI_DEVICE_ERROR\r
+            An error was encountered while attempting to retrieve the\r
+            host controller's current state.\r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -2983,27 +2983,27 @@ UsbVirtualHcSetState (
   IN EFI_USB_HC_STATE           State\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Virtual interface to sets the USB host controller to a specific state\r
     for both Hc2 and Hc protocol.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     UsbBusDev   - A pointer to bus controller of the device.\r
     State       - Indicates the state of the host controller that will be set.\r
-  \r
+\r
   Returns:\r
-  \r
-    EFI_SUCCESS \r
-          The USB host controller was successfully placed in the state \r
+\r
+    EFI_SUCCESS\r
+          The USB host controller was successfully placed in the state\r
           specified by State.\r
-    EFI_INVALID_PARAMETER \r
+    EFI_INVALID_PARAMETER\r
           State is invalid.\r
-    EFI_DEVICE_ERROR  \r
-          Failed to set the state specified by State due to device error.  \r
-          \r
+    EFI_DEVICE_ERROR\r
+          Failed to set the state specified by State due to device error.\r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -3033,29 +3033,29 @@ UsbVirtualHcGetRootHubPortStatus (
   OUT EFI_USB_PORT_STATUS       *PortStatus\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Virtual interface to retrieves the current status of a USB root hub port\r
     both for Hc2 and Hc protocol.\r
-  \r
+\r
   Arguments:\r
-  \r
+\r
     UsbBusDev   - A pointer to bus controller of the device.\r
-    PortNumber  - Specifies the root hub port from which the status \r
-                is to be retrieved.  This value is zero-based. For example, \r
+    PortNumber  - Specifies the root hub port from which the status\r
+                is to be retrieved.  This value is zero-based. For example,\r
                 if a root hub has two ports, then the first port is numbered 0,\r
                 and the second port is numbered 1.\r
-    PortStatus  - A pointer to the current port status bits and \r
-                port status change bits.  \r
-  \r
+    PortStatus  - A pointer to the current port status bits and\r
+                port status change bits.\r
+\r
   Returns:\r
-  \r
-    EFI_SUCCESS  The status of the USB root hub port specified by PortNumber \r
+\r
+    EFI_SUCCESS  The status of the USB root hub port specified by PortNumber\r
                  was returned in PortStatus.\r
-    EFI_INVALID_PARAMETER PortNumber is invalid. \r
-    EFI_DEVICE_ERROR      Can't read register     \r
-    \r
+    EFI_INVALID_PARAMETER PortNumber is invalid.\r
+    EFI_DEVICE_ERROR      Can't read register\r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -3087,29 +3087,29 @@ UsbVirtualHcSetRootHubPortFeature (
   IN  EFI_USB_PORT_FEATURE      PortFeature\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
     Virual interface to sets a feature for the specified root hub port\r
     for both Hc2 and Hc protocol.\r
-  \r
+\r
   Arguments:\r
-  \r
+\r
     UsbBusDev   - A pointer to bus controller of the device.\r
-    PortNumber  - Specifies the root hub port whose feature \r
+    PortNumber  - Specifies the root hub port whose feature\r
                 is requested to be set.\r
-    PortFeature - Indicates the feature selector associated \r
-                with the feature set request. \r
-  \r
+    PortFeature - Indicates the feature selector associated\r
+                with the feature set request.\r
+\r
   Returns:\r
-  \r
-    EFI_SUCCESS \r
-        The feature specified by PortFeature was set for the \r
+\r
+    EFI_SUCCESS\r
+        The feature specified by PortFeature was set for the\r
         USB root hub port specified by PortNumber.\r
-    EFI_INVALID_PARAMETER \r
+    EFI_INVALID_PARAMETER\r
         PortNumber is invalid or PortFeature is invalid.\r
     EFI_DEVICE_ERROR\r
         Can't read register\r
-        \r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -3141,30 +3141,30 @@ UsbVirtualHcClearRootHubPortFeature (
   IN  EFI_USB_PORT_FEATURE      PortFeature\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Virtual interface to clears a feature for the specified root hub port\r
     for both Hc2 and Hc protocol.\r
-  \r
+\r
   Arguments:\r
-  \r
+\r
     UsbBusDev   - A pointer to bus controller of the device.\r
-    PortNumber  - Specifies the root hub port whose feature \r
+    PortNumber  - Specifies the root hub port whose feature\r
                 is requested to be cleared.\r
-    PortFeature - Indicates the feature selector associated with the \r
+    PortFeature - Indicates the feature selector associated with the\r
                 feature clear request.\r
-                  \r
+\r
   Returns:\r
-  \r
-    EFI_SUCCESS \r
-        The feature specified by PortFeature was cleared for the \r
+\r
+    EFI_SUCCESS\r
+        The feature specified by PortFeature was cleared for the\r
         USB root hub port specified by PortNumber.\r
-    EFI_INVALID_PARAMETER \r
+    EFI_INVALID_PARAMETER\r
         PortNumber is invalid or PortFeature is invalid.\r
     EFI_DEVICE_ERROR\r
         Can't read register\r
-        \r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -3204,48 +3204,48 @@ UsbVirtualHcControlTransfer (
   OUT UINT32                               *TransferResult\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Virtual interface to submits control transfer to a target USB device\r
     for both Hc2 and Hc protocol.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     UsbBusDev     - A pointer to bus controller of the device.\r
     DeviceAddress - Represents the address of the target device on the USB,\r
                   which is assigned during USB enumeration.\r
     DeviceSpeed   - Indicates target device speed.\r
-    MaximumPacketLength - Indicates the maximum packet size that the \r
-                        default control transfer endpoint is capable of \r
+    MaximumPacketLength - Indicates the maximum packet size that the\r
+                        default control transfer endpoint is capable of\r
                         sending or receiving.\r
-    Request       - A pointer to the USB device request that will be sent \r
-                  to the USB device. \r
+    Request       - A pointer to the USB device request that will be sent\r
+                  to the USB device.\r
     TransferDirection - Specifies the data direction for the transfer.\r
-                      There are three values available, DataIn, DataOut \r
+                      There are three values available, DataIn, DataOut\r
                       and NoData.\r
-    Data          - A pointer to the buffer of data that will be transmitted \r
+    Data          - A pointer to the buffer of data that will be transmitted\r
                   to USB device or received from USB device.\r
-    DataLength    - Indicates the size, in bytes, of the data buffer \r
+    DataLength    - Indicates the size, in bytes, of the data buffer\r
                   specified by Data.\r
-    TimeOut       - Indicates the maximum time, in microseconds, \r
+    TimeOut       - Indicates the maximum time, in microseconds,\r
                   which the transfer is allowed to complete.\r
     Translator      - A pointr to the transaction translator data.\r
-    TransferResult  - A pointer to the detailed result information generated \r
+    TransferResult  - A pointer to the detailed result information generated\r
                     by this control transfer.\r
-                    \r
+\r
   Returns:\r
-  \r
-    EFI_SUCCESS \r
+\r
+    EFI_SUCCESS\r
         The control transfer was completed successfully.\r
-    EFI_OUT_OF_RESOURCES  \r
+    EFI_OUT_OF_RESOURCES\r
         The control transfer could not be completed due to a lack of resources.\r
-    EFI_INVALID_PARAMETER \r
+    EFI_INVALID_PARAMETER\r
         Some parameters are invalid.\r
-    EFI_TIMEOUT \r
+    EFI_TIMEOUT\r
         The control transfer failed due to timeout.\r
-    EFI_DEVICE_ERROR  \r
-        The control transfer failed due to host controller or device error. \r
+    EFI_DEVICE_ERROR\r
+        The control transfer failed due to host controller or device error.\r
         Caller should check TranferResult for detailed error information.\r
 \r
 --*/\r
@@ -3305,55 +3305,55 @@ UsbVirtualHcBulkTransfer (
   OUT UINT32                              *TransferResult\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Virtual interface to submits bulk transfer to a bulk endpoint of a USB device\r
     both for Hc2 and Hc protocol.\r
-    \r
+\r
   Arguments:\r
-    \r
+\r
     UsbBusDev         - A pointer to bus controller of the device.\r
     DeviceAddress     - Represents the address of the target device on the USB,\r
-                      which is assigned during USB enumeration.               \r
-    EndPointAddress   - The combination of an endpoint number and an \r
-                      endpoint direction of the target USB device. \r
-                      Each endpoint address supports data transfer in \r
-                      one direction except the control endpoint \r
-                      (whose default endpoint address is 0). \r
-                      It is the caller's responsibility to make sure that \r
-                      the EndPointAddress represents a bulk endpoint.                  \r
+                      which is assigned during USB enumeration.\r
+    EndPointAddress   - The combination of an endpoint number and an\r
+                      endpoint direction of the target USB device.\r
+                      Each endpoint address supports data transfer in\r
+                      one direction except the control endpoint\r
+                      (whose default endpoint address is 0).\r
+                      It is the caller's responsibility to make sure that\r
+                      the EndPointAddress represents a bulk endpoint.\r
     DeviceSpeed       - Indicates device speed. The supported values are EFI_USB_SPEED_FULL\r
                       and EFI_USB_SPEED_HIGH.\r
     MaximumPacketLength - Indicates the maximum packet size the target endpoint\r
-                        is capable of sending or receiving.                 \r
+                        is capable of sending or receiving.\r
     DataBuffersNumber - Number of data buffers prepared for the transfer.\r
-    Data              - Array of pointers to the buffers of data that will be transmitted \r
-                      to USB device or received from USB device.              \r
+    Data              - Array of pointers to the buffers of data that will be transmitted\r
+                      to USB device or received from USB device.\r
     DataLength        - When input, indicates the size, in bytes, of the data buffer\r
-                      specified by Data. When output, indicates the actually \r
-                      transferred data size.              \r
-    DataToggle        - A pointer to the data toggle value. On input, it indicates \r
+                      specified by Data. When output, indicates the actually\r
+                      transferred data size.\r
+    DataToggle        - A pointer to the data toggle value. On input, it indicates\r
                       the initial data toggle value the bulk transfer should adopt;\r
-                      on output, it is updated to indicate the data toggle value \r
-                      of the subsequent bulk transfer. \r
-    Translator        - A pointr to the transaction translator data. \r
-    TimeOut           - Indicates the maximum time, in microseconds, which the \r
-                      transfer is allowed to complete.              \r
-    TransferResult    - A pointer to the detailed result information of the \r
+                      on output, it is updated to indicate the data toggle value\r
+                      of the subsequent bulk transfer.\r
+    Translator        - A pointr to the transaction translator data.\r
+    TimeOut           - Indicates the maximum time, in microseconds, which the\r
+                      transfer is allowed to complete.\r
+    TransferResult    - A pointer to the detailed result information of the\r
                       bulk transfer.\r
 \r
   Returns:\r
-  \r
-    EFI_SUCCESS \r
+\r
+    EFI_SUCCESS\r
         The bulk transfer was completed successfully.\r
-    EFI_OUT_OF_RESOURCES  \r
+    EFI_OUT_OF_RESOURCES\r
         The bulk transfer could not be submitted due to lack of resource.\r
-    EFI_INVALID_PARAMETER \r
+    EFI_INVALID_PARAMETER\r
         Some parameters are invalid.\r
-    EFI_TIMEOUT \r
+    EFI_TIMEOUT\r
         The bulk transfer failed due to timeout.\r
-    EFI_DEVICE_ERROR  \r
+    EFI_DEVICE_ERROR\r
         The bulk transfer failed due to host controller or device error.\r
         Caller should check TranferResult for detailed error information.\r
 \r
@@ -3412,63 +3412,63 @@ UsbVirtualHcAsyncInterruptTransfer (
   IN  VOID                                  *Context OPTIONAL\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
-    Virtual interface to submits an asynchronous interrupt transfer to an \r
+\r
+    Virtual interface to submits an asynchronous interrupt transfer to an\r
     interrupt endpoint of a USB device for both Hc2 and Hc protocol.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     UsbBusDev       - A pointer to bus controller of the device.\r
     DeviceAddress   - Represents the address of the target device on the USB,\r
-                    which is assigned during USB enumeration.                \r
-    EndPointAddress - The combination of an endpoint number and an endpoint \r
-                    direction of the target USB device. Each endpoint address \r
-                    supports data transfer in one direction except the \r
-                    control endpoint (whose default endpoint address is 0). \r
-                    It is the caller's responsibility to make sure that \r
-                    the EndPointAddress represents an interrupt endpoint.              \r
+                    which is assigned during USB enumeration.\r
+    EndPointAddress - The combination of an endpoint number and an endpoint\r
+                    direction of the target USB device. Each endpoint address\r
+                    supports data transfer in one direction except the\r
+                    control endpoint (whose default endpoint address is 0).\r
+                    It is the caller's responsibility to make sure that\r
+                    the EndPointAddress represents an interrupt endpoint.\r
     DeviceSpeed     - Indicates device speed.\r
     MaximumPacketLength  - Indicates the maximum packet size the target endpoint\r
-                         is capable of sending or receiving.                   \r
+                         is capable of sending or receiving.\r
     IsNewTransfer   - If TRUE, an asynchronous interrupt pipe is built between\r
-                    the host and the target interrupt endpoint. \r
-                    If FALSE, the specified asynchronous interrupt pipe \r
-                    is canceled.               \r
-    DataToggle      - A pointer to the data toggle value.  On input, it is valid \r
-                    when IsNewTransfer is TRUE, and it indicates the initial \r
-                    data toggle value the asynchronous interrupt transfer \r
-                    should adopt.  \r
-                    On output, it is valid when IsNewTransfer is FALSE, \r
-                    and it is updated to indicate the data toggle value of \r
-                    the subsequent asynchronous interrupt transfer.              \r
-    PollingInterval - Indicates the interval, in milliseconds, that the \r
-                    asynchronous interrupt transfer is polled.  \r
-                    This parameter is required when IsNewTransfer is TRUE.               \r
-    DataLength      - Indicates the length of data to be received at the \r
-                    rate specified by PollingInterval from the target \r
-                    asynchronous interrupt endpoint.  This parameter \r
-                    is only required when IsNewTransfer is TRUE.             \r
+                    the host and the target interrupt endpoint.\r
+                    If FALSE, the specified asynchronous interrupt pipe\r
+                    is canceled.\r
+    DataToggle      - A pointer to the data toggle value.  On input, it is valid\r
+                    when IsNewTransfer is TRUE, and it indicates the initial\r
+                    data toggle value the asynchronous interrupt transfer\r
+                    should adopt.\r
+                    On output, it is valid when IsNewTransfer is FALSE,\r
+                    and it is updated to indicate the data toggle value of\r
+                    the subsequent asynchronous interrupt transfer.\r
+    PollingInterval - Indicates the interval, in milliseconds, that the\r
+                    asynchronous interrupt transfer is polled.\r
+                    This parameter is required when IsNewTransfer is TRUE.\r
+    DataLength      - Indicates the length of data to be received at the\r
+                    rate specified by PollingInterval from the target\r
+                    asynchronous interrupt endpoint.  This parameter\r
+                    is only required when IsNewTransfer is TRUE.\r
     Translator      - A pointr to the transaction translator data.\r
-    CallBackFunction  - The Callback function.This function is called at the \r
-                      rate specified by PollingInterval.This parameter is \r
-                      only required when IsNewTransfer is TRUE.               \r
+    CallBackFunction  - The Callback function.This function is called at the\r
+                      rate specified by PollingInterval.This parameter is\r
+                      only required when IsNewTransfer is TRUE.\r
     Context         - The context that is passed to the CallBackFunction.\r
                     - This is an optional parameter and may be NULL.\r
-  \r
+\r
   Returns:\r
-  \r
-    EFI_SUCCESS \r
-        The asynchronous interrupt transfer request has been successfully \r
+\r
+    EFI_SUCCESS\r
+        The asynchronous interrupt transfer request has been successfully\r
         submitted or canceled.\r
-    EFI_INVALID_PARAMETER \r
+    EFI_INVALID_PARAMETER\r
         Some parameters are invalid.\r
-    EFI_OUT_OF_RESOURCES  \r
-        The request could not be completed due to a lack of resources.  \r
+    EFI_OUT_OF_RESOURCES\r
+        The request could not be completed due to a lack of resources.\r
     EFI_DEVICE_ERROR\r
         Can't read register\r
-        \r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -3527,58 +3527,58 @@ UsbVirtualHcSyncInterruptTransfer (
   OUT UINT32                                *TransferResult\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
-    Vitual interface to submits synchronous interrupt transfer to an interrupt endpoint \r
+\r
+    Vitual interface to submits synchronous interrupt transfer to an interrupt endpoint\r
     of a USB device for both Hc2 and Hc protocol.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     UsbBusDev       - A pointer to bus controller of the device.\r
-    DeviceAddress   - Represents the address of the target device on the USB, \r
+    DeviceAddress   - Represents the address of the target device on the USB,\r
                     which is assigned during USB enumeration.\r
-    EndPointAddress   - The combination of an endpoint number and an endpoint \r
-                      direction of the target USB device. Each endpoint \r
-                      address supports data transfer in one direction \r
-                      except the control endpoint (whose default \r
+    EndPointAddress   - The combination of an endpoint number and an endpoint\r
+                      direction of the target USB device. Each endpoint\r
+                      address supports data transfer in one direction\r
+                      except the control endpoint (whose default\r
                       endpoint address is 0). It is the caller's responsibility\r
-                      to make sure that the EndPointAddress represents \r
-                      an interrupt endpoint. \r
+                      to make sure that the EndPointAddress represents\r
+                      an interrupt endpoint.\r
     DeviceSpeed     - Indicates device speed.\r
-    MaximumPacketLength - Indicates the maximum packet size the target endpoint \r
+    MaximumPacketLength - Indicates the maximum packet size the target endpoint\r
                         is capable of sending or receiving.\r
-    Data            - A pointer to the buffer of data that will be transmitted \r
+    Data            - A pointer to the buffer of data that will be transmitted\r
                     to USB device or received from USB device.\r
-    DataLength      - On input, the size, in bytes, of the data buffer specified \r
+    DataLength      - On input, the size, in bytes, of the data buffer specified\r
                     by Data. On output, the number of bytes transferred.\r
     DataToggle      - A pointer to the data toggle value. On input, it indicates\r
-                    the initial data toggle value the synchronous interrupt \r
-                    transfer should adopt; \r
-                    on output, it is updated to indicate the data toggle value \r
-                    of the subsequent synchronous interrupt transfer. \r
-    TimeOut         - Indicates the maximum time, in microseconds, which the \r
+                    the initial data toggle value the synchronous interrupt\r
+                    transfer should adopt;\r
+                    on output, it is updated to indicate the data toggle value\r
+                    of the subsequent synchronous interrupt transfer.\r
+    TimeOut         - Indicates the maximum time, in microseconds, which the\r
                     transfer is allowed to complete.\r
     Translator      - A pointr to the transaction translator data.\r
-    TransferResult  - A pointer to the detailed result information from \r
-                    the synchronous interrupt transfer.  \r
+    TransferResult  - A pointer to the detailed result information from\r
+                    the synchronous interrupt transfer.\r
 \r
   Returns:\r
-  \r
-    EFI_SUCCESS \r
+\r
+    EFI_SUCCESS\r
         The synchronous interrupt transfer was completed successfully.\r
-    EFI_OUT_OF_RESOURCES  \r
-        The synchronous interrupt transfer could not be submitted due \r
+    EFI_OUT_OF_RESOURCES\r
+        The synchronous interrupt transfer could not be submitted due\r
         to lack of resource.\r
-    EFI_INVALID_PARAMETER \r
+    EFI_INVALID_PARAMETER\r
         Some parameters are invalid.\r
-    EFI_TIMEOUT \r
+    EFI_TIMEOUT\r
         The synchronous interrupt transfer failed due to timeout.\r
-    EFI_DEVICE_ERROR  \r
-        The synchronous interrupt transfer failed due to host controller \r
-        or device error. Caller should check TranferResult for detailed \r
-        error information.  \r
-        \r
+    EFI_DEVICE_ERROR\r
+        The synchronous interrupt transfer failed due to host controller\r
+        or device error. Caller should check TranferResult for detailed\r
+        error information.\r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -3634,34 +3634,34 @@ UsbVirtualHcIsochronousTransfer (
   OUT UINT32                                *TransferResult\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Virtual interface to submits isochronous transfer to a target USB device\r
     for both Hc2 and Hc protocol.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     UsbBusDev        - A pointer to bus controller of the device.\r
     DeviceAddress    - Represents the address of the target device on the USB,\r
                      which is assigned during USB enumeration.\r
     EndPointAddress  - End point address\r
     DeviceSpeed      - Indicates device speed.\r
-    MaximumPacketLength    - Indicates the maximum packet size that the \r
-                           default control transfer endpoint is capable of \r
+    MaximumPacketLength    - Indicates the maximum packet size that the\r
+                           default control transfer endpoint is capable of\r
                            sending or receiving.\r
     DataBuffersNumber - Number of data buffers prepared for the transfer.\r
-    Data              - Array of pointers to the buffers of data that will be \r
+    Data              - Array of pointers to the buffers of data that will be\r
                       transmitted to USB device or received from USB device.\r
-    DataLength        - Indicates the size, in bytes, of the data buffer \r
+    DataLength        - Indicates the size, in bytes, of the data buffer\r
                       specified by Data.\r
     Translator        - A pointr to the transaction translator data.\r
-    TransferResult    - A pointer to the detailed result information generated \r
-                      by this control transfer.               \r
-                      \r
+    TransferResult    - A pointer to the detailed result information generated\r
+                      by this control transfer.\r
+\r
   Returns:\r
-  \r
-    EFI_UNSUPPORTED \r
+\r
+    EFI_UNSUPPORTED\r
 \r
 --*/\r
 {\r
@@ -3684,34 +3684,34 @@ UsbVirtualHcAsyncIsochronousTransfer (
   IN  VOID                                *Context\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Vitual interface to submits Async isochronous transfer to a target USB device\r
     for both Hc2 and Hc protocol.\r
-  \r
+\r
   Arguments:\r
-  \r
+\r
     UsbBusDev           - A pointer to bus controller of the device.\r
     DeviceAddress       - Represents the address of the target device on the USB,\r
                         which is assigned during USB enumeration.\r
     EndPointAddress     - End point address\r
     DeviceSpeed         - Indicates device speed.\r
-    MaximumPacketLength - Indicates the maximum packet size that the \r
-                        default control transfer endpoint is capable of \r
+    MaximumPacketLength - Indicates the maximum packet size that the\r
+                        default control transfer endpoint is capable of\r
                         sending or receiving.\r
     DataBuffersNumber   - Number of data buffers prepared for the transfer.\r
-    Data                - Array of pointers to the buffers of data that will be transmitted \r
+    Data                - Array of pointers to the buffers of data that will be transmitted\r
                         to USB device or received from USB device.\r
-    DataLength          - Indicates the size, in bytes, of the data buffer \r
+    DataLength          - Indicates the size, in bytes, of the data buffer\r
                         specified by Data.\r
     Translator          - A pointr to the transaction translator data.\r
     IsochronousCallBack - When the transfer complete, the call back function will be called\r
     Context             - Pass to the call back function as parameter\r
-                    \r
+\r
   Returns:\r
-  \r
-    EFI_UNSUPPORTED \r
+\r
+    EFI_UNSUPPORTED\r
 \r
 --*/\r
 {\r