]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c
1. Add NULL QH to set as QH header;
[mirror_edk2.git] / EdkModulePkg / Bus / Pci / Ehci / Dxe / Ehci.c
index baea1f608db09d21c8a86468c682e0c935fb932a..e6a4f6130b15162353b42c81098cbef253df952c 100644 (file)
@@ -1,20 +1,20 @@
 /*++\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
     Ehci.c\r
-    \r
-Abstract: \r
-    \r
+\r
+Abstract:\r
+\r
 \r
 Revision History\r
 --*/\r
@@ -23,7 +23,7 @@ Revision History
 #include "Ehci.h"\r
 \r
 \r
-GLOBAL_REMOVE_IF_UNREFERENCED UINTN    gEHCDebugLevel  = EFI_D_INFO;\r
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN    gEHCDebugLevel  = EFI_D_ERROR;\r
 GLOBAL_REMOVE_IF_UNREFERENCED UINTN    gEHCErrorLevel  = EFI_D_ERROR;\r
 \r
 \r
@@ -234,18 +234,18 @@ EhciDriverBindingSupported (
 /*++\r
 \r
   Routine Description:\r
-  \r
+\r
     Test to see if this driver supports ControllerHandle. Any ControllerHandle\r
     that has Usb2HcProtocol installed will be supported.\r
 \r
   Arguments:\r
-  \r
+\r
     This                - Protocol instance pointer.\r
     Controlle           - Handle of device to test\r
     RemainingDevicePath - Not used\r
 \r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS       This driver supports this device.\r
     EFI_UNSUPPORTED   This driver does not support this device.\r
 \r
@@ -255,7 +255,7 @@ EhciDriverBindingSupported (
   EFI_PCI_IO_PROTOCOL *PciIo;\r
   USB_CLASSC          UsbClassCReg;\r
 \r
-  \r
+\r
   //\r
   // Test whether there is PCI IO Protocol attached on the controller handle.\r
   //\r
@@ -288,7 +288,7 @@ EhciDriverBindingSupported (
     Status = EFI_UNSUPPORTED;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Test whether the controller belongs to Ehci type\r
   //\r
@@ -329,17 +329,17 @@ EhciDriverBindingStart (
 /*++\r
 \r
   Routine Description:\r
-  \r
+\r
     Starting the Usb EHCI Driver\r
 \r
   Arguments:\r
-  \r
+\r
     This                - Protocol instance pointer.\r
     Controller          - Handle of device to test\r
     RemainingDevicePath - Not used\r
 \r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS           supports this device.\r
     EFI_UNSUPPORTED       do not support this device.\r
     EFI_DEVICE_ERROR      cannot be started due to device Error\r
@@ -353,7 +353,8 @@ EhciDriverBindingStart (
   UINT8                 MaxSpeed;\r
   UINT8                 PortNumber;\r
   UINT8                 Is64BitCapable;\r
-  \r
+  UINT64                Supports;\r
+\r
   //\r
   // Open the PciIo Protocol\r
   //\r
@@ -369,21 +370,30 @@ EhciDriverBindingStart (
     Status = EFI_OUT_OF_RESOURCES;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Enable the USB Host Controller\r
   //\r
   Status = PciIo->Attributes (\r
                     PciIo,\r
-                    EfiPciIoAttributeOperationEnable,\r
-                    EFI_PCI_DEVICE_ENABLE,\r
-                    NULL\r
+                    EfiPciIoAttributeOperationSupported,\r
+                    0,\r
+                    &Supports\r
                     );\r
+  if (!EFI_ERROR (Status)) {\r
+    Supports &= EFI_PCI_DEVICE_ENABLE;\r
+    Status = PciIo->Attributes (\r
+                      PciIo,\r
+                      EfiPciIoAttributeOperationEnable,\r
+                      Supports,\r
+                      NULL\r
+                      );\r
+  }\r
   if (EFI_ERROR (Status)) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto close_pciio_protocol;\r
   }\r
-  \r
+\r
   //\r
   // Allocate memory for EHC private data structure\r
   //\r
@@ -392,7 +402,7 @@ EhciDriverBindingStart (
     Status = EFI_OUT_OF_RESOURCES;\r
     goto close_pciio_protocol;\r
   }\r
-  \r
+\r
   //\r
   // Init EFI_USB2_HC_PROTOCOL interface and private data structure\r
   //\r
@@ -430,7 +440,7 @@ EhciDriverBindingStart (
     Status = EFI_OUT_OF_RESOURCES;\r
     goto free_pool;\r
   }\r
-  \r
+\r
   //\r
   // Get Capability Register Length\r
   //\r
@@ -446,14 +456,14 @@ EhciDriverBindingStart (
   DEBUG_CODE (\r
    DumpEHCIPortsStatus (HcDev);\r
   );\r
-  \r
+\r
   //\r
   // Create and Init Perodic Frame List\r
   //\r
   Status = EhciGetCapability (\r
-             &HcDev->Usb2Hc, \r
-             &MaxSpeed, \r
-             &PortNumber, \r
+             &HcDev->Usb2Hc,\r
+             &MaxSpeed,\r
+             &PortNumber,\r
              &Is64BitCapable\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -461,19 +471,19 @@ EhciDriverBindingStart (
     goto uninstall_usb2hc_protocol;\r
   }\r
   HcDev->Is64BitCapable = Is64BitCapable;\r
-  \r
+\r
   //\r
   // Create and Init Perodic Frame List\r
   //\r
   Status = InitialPeriodicFrameList (\r
-             HcDev, \r
+             HcDev,\r
              EHCI_MAX_FRAME_LIST_LENGTH\r
              );\r
   if (EFI_ERROR (Status)) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto uninstall_usb2hc_protocol;\r
   }\r
-  \r
+\r
   //\r
   // Init memory pool management\r
   //\r
@@ -482,21 +492,26 @@ EhciDriverBindingStart (
     Status = EFI_OUT_OF_RESOURCES;\r
     goto deinit_perodic_frame_list;\r
   }\r
-  \r
+\r
+  Status = CreateNULLQH (HcDev);\r
+  if (EFI_ERROR (Status)) {\r
+    Status = EFI_OUT_OF_RESOURCES;\r
+    goto deinit_perodic_frame_list;\r
+  }\r
   //\r
   // Create AsyncRequest Polling Timer\r
   //\r
   Status = CreatePollingTimer (HcDev, (EFI_EVENT_NOTIFY) AsyncRequestMoniter);\r
   if (EFI_ERROR (Status)) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
-    goto deinit_memory_management;\r
+    goto deinit_null_qh;\r
   }\r
-  \r
+\r
   //\r
-  // Default Maxximum Interrupt Interval is 8, \r
+  // Default Maxximum Interrupt Interval is 8,\r
   // it means that 8 micro frame = 1ms\r
   //\r
-  \r
+\r
   //\r
   // Start the Host Controller\r
   //\r
@@ -507,7 +522,7 @@ EhciDriverBindingStart (
       goto deinit_timer;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Set all ports routing to EHC\r
   //\r
@@ -516,7 +531,7 @@ EhciDriverBindingStart (
     Status = EFI_DEVICE_ERROR;\r
     goto deinit_timer;\r
   }\r
-  \r
+\r
   //\r
   // Component name protocol\r
   //\r
@@ -538,7 +553,8 @@ EhciDriverBindingStart (
   //\r
 deinit_timer:\r
   DestoryPollingTimer (HcDev);\r
-deinit_memory_management:\r
+deinit_null_qh:\r
+  DestroyNULLQH(HcDev);\r
   DeinitialMemoryManagement (HcDev);\r
 deinit_perodic_frame_list:\r
   DeinitialPeriodicFrameList (HcDev);\r
@@ -573,19 +589,19 @@ EhciDriverBindingStop (
 /*++\r
 \r
   Routine Description:\r
-  \r
+\r
     Stop this driver on ControllerHandle. Support stoping any child handles\r
     created by this driver.\r
 \r
   Arguments:\r
-  \r
+\r
     This              - Protocol instance pointer.\r
     Controller        - Handle of device to stop driver on\r
     NumberOfChildren  - Number of Children in the ChildHandleBuffer\r
     ChildHandleBuffer - List of handles for the children we need to stop.\r
 \r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS         Success\r
     EFI_DEVICE_ERROR    Fail\r
 --*/\r
@@ -593,6 +609,7 @@ EhciDriverBindingStop (
   EFI_STATUS            Status;\r
   EFI_USB2_HC_PROTOCOL  *Usb2Hc;\r
   USB2_HC_DEV           *HcDev;\r
+  UINT64                Supports;\r
 \r
   //\r
   // Test whether the Controller handler passed in is a valid\r
@@ -626,19 +643,19 @@ EhciDriverBindingStop (
     Status = EFI_DEVICE_ERROR;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Set Host Controller state as halt\r
   //\r
   Status = Usb2Hc->SetState (\r
-                     Usb2Hc, \r
+                     Usb2Hc,\r
                      EfiUsbHcStateHalt\r
                      );\r
   if (EFI_ERROR (Status)) {\r
     Status = EFI_DEVICE_ERROR;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Stop AsyncRequest Polling Timer\r
   //\r
@@ -647,7 +664,7 @@ EhciDriverBindingStop (
     Status = EFI_DEVICE_ERROR;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Destroy Asynchronous Request Event\r
   //\r
@@ -658,6 +675,11 @@ EhciDriverBindingStop (
   //\r
   DeinitialPeriodicFrameList (HcDev);\r
 \r
+  //\r
+  // Destroy NULLQH\r
+  //\r
+  DestroyNULLQH (HcDev);\r
+\r
   //\r
   // Deinit Ehci pool memory management\r
   //\r
@@ -673,10 +695,19 @@ EhciDriverBindingStop (
   //\r
   Status = HcDev->PciIo->Attributes (\r
                            HcDev->PciIo,\r
-                           EfiPciIoAttributeOperationDisable,\r
-                           EFI_PCI_DEVICE_ENABLE,\r
-                           NULL\r
+                           EfiPciIoAttributeOperationSupported,\r
+                           0,\r
+                           &Supports\r
                            );\r
+  if (!EFI_ERROR (Status)) {\r
+    Supports &= EFI_PCI_DEVICE_ENABLE;\r
+    Status = HcDev->PciIo->Attributes (\r
+                             HcDev->PciIo,\r
+                             EfiPciIoAttributeOperationDisable,\r
+                             Supports,\r
+                             NULL\r
+                             );\r
+  }\r
   if (EFI_ERROR (Status)) {\r
     Status = EFI_DEVICE_ERROR;\r
     goto exit;\r
@@ -704,25 +735,25 @@ EhciGetCapability (
   OUT UINT8                *Is64BitCapable\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Retrieves the capablility of root hub ports.\r
-    \r
+\r
   Arguments:\r
-  \r
+\r
     This            - A pointer to the EFI_USB_HC_PROTOCOL instance.\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
+\r
     EFI_SUCCESS            host controller capability were retrieved successfully.\r
     EFI_INVALID_PARAMETER  MaxSpeed or PortNumber or Is64BitCapable is NULL.\r
-    EFI_DEVICE_ERROR       An error was encountered while attempting to retrieve the capabilities.  \r
-          \r
+    EFI_DEVICE_ERROR       An error was encountered while attempting to retrieve the capabilities.\r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -776,58 +807,58 @@ EhciReset (
   IN UINT16               Attributes\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Provides software reset for the USB host controller.\r
-  \r
+\r
   Arguments:\r
-  \r
-  This        - A pointer to the EFI_USB2_HC_PROTOCOL instance.  \r
-  Attributes  - A bit mask of the reset operation to perform. \r
+\r
+  This        - A pointer to the EFI_USB2_HC_PROTOCOL instance.\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\r
   #define EFI_USB_HC_RESET_HOST_CONTROLLER  0x0002\r
   #define EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG  0x0004\r
   #define EFI_USB_HC_RESET_HOST_WITH_DEBUG  0x0008\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
@@ -840,7 +871,7 @@ EhciReset (
   switch (Attributes) {\r
 \r
   case EFI_USB_HC_RESET_GLOBAL:\r
-    \r
+\r
     //\r
     // Same behavior as Host Controller Reset\r
     //\r
@@ -892,7 +923,7 @@ EhciReset (
     // Init Perodic List Base Addr and Frame List\r
     //\r
     Status = SetFrameListBaseAddr (\r
-               HcDev, \r
+               HcDev,\r
                (UINT32)GET_0B_TO_31B (HcDev->PeriodicFrameListBuffer)\r
                );\r
     if (EFI_ERROR (Status)) {\r
@@ -951,34 +982,34 @@ EhciGetState (
   OUT EFI_USB_HC_STATE     *State\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Retrieves current state of the USB host controller.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     This      A pointer to the EFI_USB2_HC_PROTOCOL instance.\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
+    EFI_DEVICE_ERROR\r
+            An error was encountered while attempting to retrieve the\r
+            host controller's current state.\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -1021,26 +1052,26 @@ EhciSetState (
   IN EFI_USB_HC_STATE     State\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Sets the USB host controller to a specific state.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     This     - A pointer to the EFI_USB2_HC_PROTOCOL instance.\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
@@ -1154,28 +1185,28 @@ EhciGetRootHubPortStatus (
   OUT EFI_USB_PORT_STATUS  *PortStatus\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Retrieves the current status of a USB root hub port.\r
-  \r
+\r
   Arguments:\r
-  \r
+\r
     This        - A pointer to the EFI_USB2_HC_PROTOCOL.\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 \r
+\r
+    EFI_SUCCESS           The status of the USB root hub port specified\r
                           by PortNumber 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
@@ -1192,12 +1223,12 @@ EhciGetRootHubPortStatus (
   }\r
 \r
   EhciGetCapability (\r
-    This, \r
-    &MaxSpeed, \r
-    &TotalPortNumber, \r
+    This,\r
+    &MaxSpeed,\r
+    &TotalPortNumber,\r
     &Is64BitCapable\r
     );\r
-  \r
+\r
   if (PortNumber >= TotalPortNumber) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto exit;\r
@@ -1221,11 +1252,11 @@ EhciGetRootHubPortStatus (
     Status = EFI_DEVICE_ERROR;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   //    Fill Port Status bits\r
   //\r
-  \r
+\r
   //\r
   // Current Connect Status\r
   //\r
@@ -1319,29 +1350,29 @@ EhciSetRootHubPortFeature (
   IN  EFI_USB_PORT_FEATURE     PortFeature\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Sets a feature for the specified root hub port.\r
-  \r
+\r
   Arguments:\r
-  \r
+\r
     This        - A pointer to the EFI_USB2_HC_PROTOCOL.\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
@@ -1353,9 +1384,9 @@ EhciSetRootHubPortFeature (
   UINT8       Is64BitCapable;\r
 \r
   EhciGetCapability (\r
-    This, \r
-    &MaxSpeed, \r
-    &TotalPortNumber, \r
+    This,\r
+    &MaxSpeed,\r
+    &TotalPortNumber,\r
     &Is64BitCapable\r
     );\r
 \r
@@ -1380,7 +1411,7 @@ EhciSetRootHubPortFeature (
   switch (PortFeature) {\r
 \r
   case EfiUsbPortEnable:\r
-  \r
+\r
     //\r
     // Sofeware can't set this bit, Port can only be enable by the Host Controller\r
     // as a part of the reset and enable\r
@@ -1390,13 +1421,13 @@ EhciSetRootHubPortFeature (
     break;\r
 \r
   case EfiUsbPortSuspend:\r
-  \r
+\r
     PortStatusControlReg &= 0xffffffd5;\r
     PortStatusControlReg |= PORTSC_SUSP;\r
     break;\r
 \r
   case EfiUsbPortReset:\r
-  \r
+\r
     //\r
     // Make sure Host Controller not halt before reset it\r
     //\r
@@ -1422,14 +1453,14 @@ EhciSetRootHubPortFeature (
     break;\r
 \r
   case EfiUsbPortPower:\r
-    \r
+\r
     //\r
     // No support, no operation\r
     //\r
     goto exit;\r
 \r
   case EfiUsbPortOwner:\r
-  \r
+\r
     PortStatusControlReg &= 0xffffffd5;\r
     PortStatusControlReg |= PORTSC_PO;\r
     break;\r
@@ -1461,29 +1492,29 @@ EhciClearRootHubPortFeature (
   IN  EFI_USB_PORT_FEATURE     PortFeature\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Clears a feature for the specified root hub port.\r
-  \r
+\r
   Arguments:\r
-  \r
-    This        - A pointer to the EFI_USB2_HC_PROTOCOL instance. \r
-    PortNumber  - Specifies the root hub port whose feature \r
+\r
+    This        - A pointer to the EFI_USB2_HC_PROTOCOL instance.\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
@@ -1495,9 +1526,9 @@ EhciClearRootHubPortFeature (
   UINT8       Is64BitCapable;\r
 \r
   EhciGetCapability (\r
-    This, \r
-    &MaxSpeed, \r
-    &TotalPortNumber, \r
+    This,\r
+    &MaxSpeed,\r
+    &TotalPortNumber,\r
     &Is64BitCapable\r
     );\r
 \r
@@ -1522,7 +1553,7 @@ EhciClearRootHubPortFeature (
   switch (PortFeature) {\r
 \r
   case EfiUsbPortEnable:\r
-  \r
+\r
     //\r
     // Clear PORT_ENABLE feature means disable port.\r
     //\r
@@ -1531,7 +1562,7 @@ EhciClearRootHubPortFeature (
     break;\r
 \r
   case EfiUsbPortSuspend:\r
-  \r
+\r
     //\r
     // A write of zero to this bit is ignored by the host controller.\r
     // The host controller will unconditionally set this bit to a zero when:\r
@@ -1543,7 +1574,7 @@ EhciClearRootHubPortFeature (
     break;\r
 \r
   case EfiUsbPortReset:\r
-  \r
+\r
     //\r
     // Clear PORT_RESET means clear the reset signal.\r
     //\r
@@ -1552,14 +1583,14 @@ EhciClearRootHubPortFeature (
     break;\r
 \r
   case EfiUsbPortPower:\r
-  \r
+\r
     //\r
     // No support, no operation\r
     //\r
     goto exit;\r
 \r
   case EfiUsbPortOwner:\r
-  \r
+\r
     //\r
     // Clear port owner means this port owned by EHC\r
     //\r
@@ -1568,7 +1599,7 @@ EhciClearRootHubPortFeature (
     break;\r
 \r
   case EfiUsbPortConnectChange:\r
-  \r
+\r
     //\r
     // Clear connect status change\r
     //\r
@@ -1577,7 +1608,7 @@ EhciClearRootHubPortFeature (
     break;\r
 \r
   case EfiUsbPortEnableChange:\r
-  \r
+\r
     //\r
     // Clear enable status change\r
     //\r
@@ -1586,14 +1617,14 @@ EhciClearRootHubPortFeature (
     break;\r
 \r
   case EfiUsbPortSuspendChange:\r
-  \r
+\r
     //\r
     // No related bit, no operation\r
     //\r
     goto exit;\r
 \r
   case EfiUsbPortOverCurrentChange:\r
-  \r
+\r
     //\r
     // Clear PortOverCurrent change\r
     //\r
@@ -1602,7 +1633,7 @@ EhciClearRootHubPortFeature (
     break;\r
 \r
   case EfiUsbPortResetChange:\r
-  \r
+\r
     //\r
     // No related bit, no operation\r
     //\r
@@ -1644,47 +1675,47 @@ EhciControlTransfer (
   OUT UINT32                               *TransferResult\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Submits control transfer to a target USB device.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     This            - A pointer to the EFI_USB2_HC_PROTOCOL instance.\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
@@ -1748,7 +1779,7 @@ EhciControlTransfer (
     Status = EFI_INVALID_PARAMETER;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // If errors exist that cause host controller halt,\r
   // then return EFI_DEVICE_ERROR.\r
@@ -1759,7 +1790,7 @@ EhciControlTransfer (
     Status          = EFI_DEVICE_ERROR;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Map the Request for bus master access.\r
   // BusMasterRead means cpu write\r
@@ -1775,7 +1806,7 @@ EhciControlTransfer (
     Status          = EFI_DEVICE_ERROR;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Map the source data buffer for bus master access.\r
   //\r
@@ -1793,7 +1824,7 @@ EhciControlTransfer (
     Status          = EFI_DEVICE_ERROR;\r
     goto unmap_request;\r
   }\r
-  \r
+\r
   //\r
   // Create and init control Qh\r
   //\r
@@ -1810,7 +1841,7 @@ EhciControlTransfer (
     Status          = EFI_OUT_OF_RESOURCES;\r
     goto unmap_data;\r
   }\r
-  \r
+\r
   //\r
   // Create and init control Qtds\r
   //\r
@@ -1828,7 +1859,7 @@ EhciControlTransfer (
     Status          = EFI_OUT_OF_RESOURCES;\r
     goto destory_qh;\r
   }\r
-  \r
+\r
   //\r
   // Link Qtds to Qh\r
   //\r
@@ -1845,7 +1876,7 @@ EhciControlTransfer (
     Status          = EFI_DEVICE_ERROR;\r
     goto destory_qtds;\r
   }\r
-  \r
+\r
   //\r
   // Poll Qh-Qtds execution and get result.\r
   // detail status is returned\r
@@ -1862,7 +1893,7 @@ EhciControlTransfer (
   if (EFI_ERROR (Status)) {\r
     goto destory_qtds;\r
   }\r
-  \r
+\r
   //\r
   // If has errors that cause host controller halt,\r
   // then return EFI_DEVICE_ERROR directly.\r
@@ -1904,54 +1935,54 @@ EhciBulkTransfer (
   OUT UINT32                              *TransferResult\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Submits bulk transfer to a bulk endpoint of a USB device.\r
-    \r
+\r
   Arguments:\r
-    \r
+\r
     This              - A pointer to the EFI_USB2_HC_PROTOCOL instance.\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
@@ -1976,8 +2007,8 @@ EhciBulkTransfer (
   // Parameters Checking\r
   //\r
   if (NULL == DataLength ||\r
-       NULL == Data || \r
-       NULL == Data[0] || \r
+       NULL == Data ||\r
+       NULL == Data[0] ||\r
        NULL == TransferResult\r
        ) {\r
     Status = EFI_INVALID_PARAMETER;\r
@@ -2012,7 +2043,7 @@ EhciBulkTransfer (
       goto exit;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // if has errors that cause host controller halt,\r
   // then return EFI_DEVICE_ERROR directly.\r
@@ -2029,7 +2060,7 @@ EhciBulkTransfer (
     Status = EFI_DEVICE_ERROR;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // construct QH and TD data structures,\r
   // and link them together\r
@@ -2054,7 +2085,7 @@ EhciBulkTransfer (
     Status          = EFI_DEVICE_ERROR;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Create and init Bulk Qh\r
   //\r
@@ -2073,7 +2104,7 @@ EhciBulkTransfer (
     Status          = EFI_OUT_OF_RESOURCES;\r
     goto unmap_data;\r
   }\r
-  \r
+\r
   //\r
   // Create and init Bulk Qtds\r
   //\r
@@ -2090,7 +2121,7 @@ EhciBulkTransfer (
     Status          = EFI_OUT_OF_RESOURCES;\r
     goto destory_qh;\r
   }\r
-  \r
+\r
   //\r
   // Link Qtds to Qh\r
   //\r
@@ -2107,7 +2138,7 @@ EhciBulkTransfer (
     Status          = EFI_DEVICE_ERROR;\r
     goto destory_qtds;\r
   }\r
-  \r
+\r
   //\r
   // Poll QH-TDs execution and get result.\r
   // detail status is returned\r
@@ -2124,7 +2155,7 @@ EhciBulkTransfer (
   if (EFI_ERROR (Status)) {\r
     goto destory_qtds;\r
   }\r
-  \r
+\r
   //\r
   // if has errors that cause host controller halt,\r
   // then return EFI_DEVICE_ERROR directly.\r
@@ -2164,65 +2195,65 @@ EhciAsyncInterruptTransfer (
   IN  VOID                                  *Context OPTIONAL\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
-    Submits an asynchronous interrupt transfer to an \r
+\r
+    Submits an asynchronous interrupt transfer to an\r
     interrupt endpoint of a USB device.\r
-    Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated \r
+    Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated\r
     in the following specification version.\r
-    \r
+\r
   Arguments:\r
-    \r
+\r
     This            - A pointer to the EFI_USB2_HC_PROTOCOL instance.\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
@@ -2269,7 +2300,7 @@ EhciAsyncInterruptTransfer (
       goto exit;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // if has errors that cause host controller halt,\r
   // then return EFI_DEVICE_ERROR directly.\r
@@ -2285,7 +2316,7 @@ EhciAsyncInterruptTransfer (
     Status = EFI_DEVICE_ERROR;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Delete Async interrupt transfer request\r
   //\r
@@ -2306,8 +2337,8 @@ EhciAsyncInterruptTransfer (
   }\r
 \r
   Status = EhciAllocatePool (\r
-                HcDev, \r
-                (UINT8 **) &AsyncRequestPtr, \r
+                HcDev,\r
+                (UINT8 **) &AsyncRequestPtr,\r
                 sizeof (EHCI_ASYNC_REQUEST)\r
                 );\r
   if (EFI_ERROR (Status)) {\r
@@ -2335,7 +2366,7 @@ EhciAsyncInterruptTransfer (
     Status = EFI_DEVICE_ERROR;\r
     goto free_data;\r
   }\r
-  \r
+\r
   //\r
   // Create and init Interrupt Qh\r
   //\r
@@ -2354,7 +2385,7 @@ EhciAsyncInterruptTransfer (
     Status = EFI_OUT_OF_RESOURCES;\r
     goto unmap_data;\r
   }\r
-  \r
+\r
   //\r
   // Create and init Interrupt Qtds\r
   //\r
@@ -2370,7 +2401,7 @@ EhciAsyncInterruptTransfer (
     Status = EFI_OUT_OF_RESOURCES;\r
     goto destory_qh;\r
   }\r
-  \r
+\r
   //\r
   // Link Qtds to Qh\r
   //\r
@@ -2394,7 +2425,7 @@ EhciAsyncInterruptTransfer (
       goto exit;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Link Entry to AsyncRequest List\r
   //\r
@@ -2413,7 +2444,7 @@ EhciAsyncInterruptTransfer (
     Status = EFI_TIMEOUT;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Link Qh and Qtds to Periodic Schedule List\r
   //\r
@@ -2448,8 +2479,8 @@ free_data:
   EhciFreePool (HcDev, DataPtr, DataLength);\r
 free_request:\r
   EhciFreePool (\r
-       HcDev, \r
-       (UINT8 *) AsyncRequestPtr, \r
+       HcDev,\r
+       (UINT8 *) AsyncRequestPtr,\r
        sizeof (EHCI_ASYNC_REQUEST)\r
        );\r
 unmap_data:\r
@@ -2474,60 +2505,60 @@ EhciSyncInterruptTransfer (
   OUT UINT32                                *TransferResult\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
-    Submits synchronous interrupt transfer to an interrupt endpoint \r
-    of a USB device. \r
-    Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated \r
+\r
+    Submits synchronous interrupt transfer to an interrupt endpoint\r
+    of a USB device.\r
+    Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated\r
     in the following specification version.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     This            - A pointer to the EFI_USB2_HC_PROTOCOL instance.\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
@@ -2548,7 +2579,7 @@ EhciSyncInterruptTransfer (
   // Parameters Checking\r
   //\r
   if (DataLength == NULL ||\r
-       Data == NULL || \r
+       Data == NULL ||\r
        TransferResult == NULL\r
        ) {\r
     Status = EFI_INVALID_PARAMETER;\r
@@ -2584,7 +2615,7 @@ EhciSyncInterruptTransfer (
     Status = EFI_INVALID_PARAMETER;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // if has errors that cause host controller halt,\r
   // then return EFI_DEVICE_ERROR directly.\r
@@ -2616,7 +2647,7 @@ EhciSyncInterruptTransfer (
     Status          = EFI_DEVICE_ERROR;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Create and init Interrupt Qh\r
   //\r
@@ -2635,7 +2666,7 @@ EhciSyncInterruptTransfer (
     Status = EFI_OUT_OF_RESOURCES;\r
     goto unmap_data;\r
   }\r
-  \r
+\r
   //\r
   // Create and init Interrupt Qtds\r
   //\r
@@ -2652,7 +2683,7 @@ EhciSyncInterruptTransfer (
     Status          = EFI_OUT_OF_RESOURCES;\r
     goto destory_qh;\r
   }\r
-  \r
+\r
   //\r
   // Link Qtds to Qh\r
   //\r
@@ -2671,7 +2702,7 @@ EhciSyncInterruptTransfer (
     Status = EFI_TIMEOUT;\r
     goto exit;\r
   }\r
-  \r
+\r
   //\r
   // Link Qh and Qtds to Periodic Schedule List\r
   //\r
@@ -2696,7 +2727,7 @@ EhciSyncInterruptTransfer (
       goto exit;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Poll QH-TDs execution and get result.\r
   // detail status is returned\r
@@ -2713,7 +2744,7 @@ EhciSyncInterruptTransfer (
   if (EFI_ERROR (Status)) {\r
     goto destory_qtds;\r
   }\r
-  \r
+\r
   //\r
   // if has errors that cause host controller halt,\r
   // then return EFI_DEVICE_ERROR directly.\r
@@ -2751,33 +2782,33 @@ EhciIsochronousTransfer (
   OUT UINT32                                *TransferResult\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Submits isochronous transfer to a target USB device.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     This             - A pointer to the EFI_USB2_HC_PROTOCOL instance.\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
@@ -2800,31 +2831,31 @@ EhciAsyncIsochronousTransfer (
   IN  VOID                                *Context\r
   )\r
 /*++\r
-  \r
+\r
   Routine Description:\r
-  \r
+\r
     Submits Async isochronous transfer to a target USB device.\r
-  \r
+\r
   Arguments:\r
-    \r
+\r
     This                - A pointer to the EFI_USB2_HC_PROTOCOL instance.\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
     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