]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c
Add DevicePathUtilities DevicePathToText DevciePathFromText USB2HostController protocols
[mirror_edk2.git] / EdkModulePkg / Bus / Pci / Uhci / Dxe / uhci.c
index 1eba8bed5b1f36a02229ed71a3ca3b55f3196c47..14f8bf27902de98fab4ce3d9be6cd6bed4267809 100644 (file)
@@ -26,13 +26,6 @@ Revision History
 // Driver model protocol interface\r
 //\r
 \r
 // Driver model protocol interface\r
 //\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-UHCIDriverEntryPoint (\r
-  IN EFI_HANDLE           ImageHandle,\r
-  IN EFI_SYSTEM_TABLE     *SystemTable\r
-  );\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 UHCIDriverBindingSupported (\r
 EFI_STATUS\r
 EFIAPI\r
 UHCIDriverBindingSupported (\r
@@ -119,7 +112,7 @@ UHCIAsyncInterruptTransfer (
   IN       UINT8                              DeviceAddress,\r
   IN       UINT8                              EndPointAddress,\r
   IN       BOOLEAN                            IsSlowDevice,\r
   IN       UINT8                              DeviceAddress,\r
   IN       UINT8                              EndPointAddress,\r
   IN       BOOLEAN                            IsSlowDevice,\r
-  IN       UINT8                              MaxiumPacketLength,\r
+  IN       UINT8                              MaximumPacketLength,\r
   IN       BOOLEAN                            IsNewTransfer,\r
   IN OUT   UINT8                              *DataToggle,\r
   IN       UINTN                              PollingInterval, OPTIONAL\r
   IN       BOOLEAN                            IsNewTransfer,\r
   IN OUT   UINT8                              *DataToggle,\r
   IN       UINTN                              PollingInterval, OPTIONAL\r
@@ -199,6 +192,161 @@ UHCIClearRootHubPortFeature (
   IN  EFI_USB_PORT_FEATURE    PortFeature\r
   );\r
 \r
   IN  EFI_USB_PORT_FEATURE    PortFeature\r
   );\r
 \r
+//\r
+// UEFI 2.0 Protocol\r
+//\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2GetCapability(\r
+  IN  EFI_USB2_HC_PROTOCOL  * This,\r
+  OUT UINT8                 *MaxSpeed,\r
+  OUT UINT8                 *PortNumber,\r
+  OUT UINT8                 *Is64BitCapable\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2Reset (\r
+  IN EFI_USB2_HC_PROTOCOL   * This,\r
+  IN UINT16                 Attributes\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2GetState (\r
+  IN  EFI_USB2_HC_PROTOCOL   * This,\r
+  OUT EFI_USB_HC_STATE       * State\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2SetState (\r
+  IN EFI_USB2_HC_PROTOCOL   * This,\r
+  IN EFI_USB_HC_STATE       State\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2ControlTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL      * This,\r
+  IN     UINT8                     DeviceAddress,\r
+  IN     UINT8                     DeviceSpeed,\r
+  IN     UINTN                     MaximumPacketLength,\r
+  IN     EFI_USB_DEVICE_REQUEST    * Request,\r
+  IN     EFI_USB_DATA_DIRECTION    TransferDirection,\r
+  IN OUT VOID                      *Data, OPTIONAL\r
+  IN OUT UINTN                     *DataLength, OPTIONAL\r
+  IN     UINTN                     TimeOut,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR            *Translator,\r
+  OUT    UINT32                    *TransferResult\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2BulkTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL   * This,\r
+  IN     UINT8                  DeviceAddress,\r
+  IN     UINT8                  EndPointAddress,\r
+  IN     UINT8                  DeviceSpeed,\r
+  IN     UINTN                  MaximumPacketLength,\r
+  IN     UINT8                  DataBuffersNumber,\r
+  IN OUT VOID                   *Data[EFI_USB_MAX_BULK_BUFFER_NUM],\r
+  IN OUT UINTN                  *DataLength,\r
+  IN OUT UINT8                  *DataToggle,\r
+  IN     UINTN                  TimeOut,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR            *Translator,\r
+  OUT    UINT32                 *TransferResult\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2AsyncInterruptTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL   * This,\r
+  IN     UINT8                  DeviceAddress,\r
+  IN     UINT8                  EndPointAddress,\r
+  IN     UINT8                  DeviceSpeed,\r
+  IN     UINTN                  MaximumPacketLength,\r
+  IN     BOOLEAN                IsNewTransfer,\r
+  IN OUT UINT8                  *DataToggle,\r
+  IN     UINTN                  PollingInterval, OPTIONAL\r
+  IN     UINTN                  DataLength, OPTIONAL\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR            *Translator,\r
+  IN     EFI_ASYNC_USB_TRANSFER_CALLBACK               CallBackFunction, OPTIONAL\r
+  IN     VOID                   *Context OPTIONAL\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2SyncInterruptTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL   * This,\r
+  IN     UINT8                  DeviceAddress,\r
+  IN     UINT8                  EndPointAddress,\r
+  IN     UINT8                  DeviceSpeed,\r
+  IN     UINTN                  MaximumPacketLength,\r
+  IN OUT VOID                   *Data,\r
+  IN OUT UINTN                  *DataLength,\r
+  IN OUT UINT8                  *DataToggle,\r
+  IN     UINTN                  TimeOut,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR           *Translator,\r
+  OUT    UINT32                 *TransferResult\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2IsochronousTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL   * This,\r
+  IN     UINT8                  DeviceAddress,\r
+  IN     UINT8                  EndPointAddress,\r
+  IN     UINT8                  DeviceSpeed,\r
+  IN     UINTN                  MaximumPacketLength,\r
+  IN     UINT8                  DataBuffersNumber,\r
+  IN OUT VOID                   *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
+  IN     UINTN                  DataLength,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR           *Translator,\r
+  OUT    UINT32                 *TransferResult\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2AsyncIsochronousTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL   * This,\r
+  IN     UINT8                  DeviceAddress,\r
+  IN     UINT8                  EndPointAddress,\r
+  IN     UINT8                  DeviceSpeed,\r
+  IN     UINTN                  MaximumPacketLength,\r
+  IN     UINT8                  DataBuffersNumber,\r
+  IN OUT VOID                   *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
+  IN     UINTN                  DataLength,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR           *Translator,\r
+  IN     EFI_ASYNC_USB_TRANSFER_CALLBACK              IsochronousCallBack,\r
+  IN     VOID                   *Context OPTIONAL\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2GetRootHubPortStatus (\r
+  IN  EFI_USB2_HC_PROTOCOL   * This,\r
+  IN  UINT8                  PortNumber,\r
+  OUT EFI_USB_PORT_STATUS    * PortStatus\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2SetRootHubPortFeature (\r
+  IN EFI_USB2_HC_PROTOCOL    * This,\r
+  IN UINT8                   PortNumber,\r
+  IN EFI_USB_PORT_FEATURE    PortFeature\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2ClearRootHubPortFeature (\r
+  IN EFI_USB2_HC_PROTOCOL    * This,\r
+  IN UINT8                   PortNumber,\r
+  IN EFI_USB_PORT_FEATURE    PortFeature\r
+  );\r
+\r
 //\r
 // Asynchronous interrupt transfer monitor function\r
 //\r
 //\r
 // Asynchronous interrupt transfer monitor function\r
 //\r
@@ -236,7 +384,7 @@ UHCIDriverBindingSupported (
 \r
   Arguments:\r
     This                - Protocol instance pointer.\r
 \r
   Arguments:\r
     This                - Protocol instance pointer.\r
-    Controller,         - Handle of device to test\r
+    Controller          - Handle of device to test\r
     RemainingDevicePath - Not used\r
 \r
   Returns:\r
     RemainingDevicePath - Not used\r
 \r
   Returns:\r
@@ -289,20 +437,20 @@ UHCIDriverBindingSupported (
       (UsbClassCReg.PI != PCI_CLASSC_PI_UHCI)) {\r
 \r
     gBS->CloseProtocol (\r
       (UsbClassCReg.PI != PCI_CLASSC_PI_UHCI)) {\r
 \r
     gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiPciIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
+           Controller,\r
+           &gEfiPciIoProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           Controller\r
+           );\r
 \r
     return EFI_UNSUPPORTED;\r
   }\r
   gBS->CloseProtocol (\r
 \r
     return EFI_UNSUPPORTED;\r
   }\r
   gBS->CloseProtocol (\r
-        Controller,\r
-        &gEfiPciIoProtocolGuid,\r
-        This->DriverBindingHandle,\r
-        Controller\r
-        );\r
+         Controller,\r
+         &gEfiPciIoProtocolGuid,\r
+         This->DriverBindingHandle,\r
+         Controller\r
+         );\r
   return EFI_SUCCESS;\r
 \r
 }\r
   return EFI_SUCCESS;\r
 \r
 }\r
@@ -351,6 +499,7 @@ UHCIDriverBindingStart (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+\r
   //\r
   // Turn off USB emulation\r
   //\r
   //\r
   // Turn off USB emulation\r
   //\r
@@ -367,11 +516,11 @@ UHCIDriverBindingStart (
                     );\r
   if (EFI_ERROR (Status)) {\r
     gBS->CloseProtocol (\r
                     );\r
   if (EFI_ERROR (Status)) {\r
     gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiPciIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
+           Controller,\r
+           &gEfiPciIoProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           Controller\r
+           );\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
@@ -381,14 +530,14 @@ UHCIDriverBindingStart (
   HcDev = AllocateZeroPool (sizeof (USB_HC_DEV));\r
   if (HcDev == NULL) {\r
     gBS->CloseProtocol (\r
   HcDev = AllocateZeroPool (sizeof (USB_HC_DEV));\r
   if (HcDev == NULL) {\r
     gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiPciIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
+           Controller,\r
+           &gEfiPciIoProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           Controller\r
+           );\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
   //\r
   // init EFI_USB_HC_PROTOCOL protocol interface and install the protocol\r
   //\r
   //\r
   // init EFI_USB_HC_PROTOCOL protocol interface and install the protocol\r
   //\r
@@ -409,6 +558,27 @@ UHCIDriverBindingStart (
   HcDev->UsbHc.MajorRevision            = 0x1;\r
   HcDev->UsbHc.MinorRevision            = 0x1;\r
 \r
   HcDev->UsbHc.MajorRevision            = 0x1;\r
   HcDev->UsbHc.MinorRevision            = 0x1;\r
 \r
+  //\r
+  //\r
+  // init EFI_USB2_HC_PROTOCOL protocol interface and install the protocol\r
+  //\r
+  HcDev->Usb2Hc.GetCapability            = UHCI2GetCapability;\r
+  HcDev->Usb2Hc.Reset                    = UHCI2Reset;\r
+  HcDev->Usb2Hc.GetState                 = UHCI2GetState;\r
+  HcDev->Usb2Hc.SetState                 = UHCI2SetState;\r
+  HcDev->Usb2Hc.ControlTransfer          = UHCI2ControlTransfer;\r
+  HcDev->Usb2Hc.BulkTransfer             = UHCI2BulkTransfer;\r
+  HcDev->Usb2Hc.AsyncInterruptTransfer   = UHCI2AsyncInterruptTransfer;\r
+  HcDev->Usb2Hc.SyncInterruptTransfer    = UHCI2SyncInterruptTransfer;\r
+  HcDev->Usb2Hc.IsochronousTransfer      = UHCI2IsochronousTransfer;\r
+  HcDev->Usb2Hc.AsyncIsochronousTransfer = UHCI2AsyncIsochronousTransfer;\r
+  HcDev->Usb2Hc.GetRootHubPortStatus     = UHCI2GetRootHubPortStatus;\r
+  HcDev->Usb2Hc.SetRootHubPortFeature    = UHCI2SetRootHubPortFeature;\r
+  HcDev->Usb2Hc.ClearRootHubPortFeature  = UHCI2ClearRootHubPortFeature;\r
+  \r
+  HcDev->Usb2Hc.MajorRevision            = 0x1;\r
+  HcDev->Usb2Hc.MinorRevision            = 0x1;\r
+  \r
   //\r
   //  Init UHCI private data structures\r
   //\r
   //\r
   //  Init UHCI private data structures\r
   //\r
@@ -428,14 +598,14 @@ UHCIDriverBindingStart (
     }\r
 \r
     gBS->CloseProtocol (\r
     }\r
 \r
     gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiPciIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
+           Controller,\r
+           &gEfiPciIoProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           Controller\r
+           );\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
   //\r
   //  Init interrupt list head in the HcDev structure.\r
   //\r
   //\r
   //  Init interrupt list head in the HcDev structure.\r
   //\r
@@ -460,11 +630,11 @@ UHCIDriverBindingStart (
     }\r
 \r
     gBS->CloseProtocol (\r
     }\r
 \r
     gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiPciIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
+           Controller,\r
+           &gEfiPciIoProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           Controller\r
+           );\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
@@ -486,11 +656,11 @@ UHCIDriverBindingStart (
     }\r
 \r
     gBS->CloseProtocol (\r
     }\r
 \r
     gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiPciIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
+           Controller,\r
+           &gEfiPciIoProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           Controller\r
+           );\r
     return EFI_UNSUPPORTED;\r
   }\r
   \r
     return EFI_UNSUPPORTED;\r
   }\r
   \r
@@ -518,7 +688,7 @@ UHCIDriverBindingStart (
            );\r
     return Status;\r
   }\r
            );\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // Install Host Controller Protocol\r
   //\r
   //\r
   // Install Host Controller Protocol\r
   //\r
@@ -538,17 +708,46 @@ UHCIDriverBindingStart (
     }\r
 \r
     gBS->CloseProtocol (\r
     }\r
 \r
     gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiPciIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
+           Controller,\r
+           &gEfiPciIoProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           Controller\r
+           );\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Install USB2.0 Host Controller Protocol\r
+  //\r
+  Status = gBS->InstallProtocolInterface (\r
+                  &Controller,\r
+                  &gEfiUsb2HcProtocolGuid,\r
+                  EFI_NATIVE_INTERFACE,\r
+                  &HcDev->Usb2Hc\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    gBS->CloseEvent (HcDev->InterruptTransTimer);\r
+    FreeFrameListEntry (HcDev);\r
+    DelMemoryManagement (HcDev);\r
+\r
+    if (HcDev != NULL) {\r
+      gBS->FreePool (HcDev);\r
+    }\r
+\r
+    gBS->CloseProtocol (\r
+           Controller,\r
+           &gEfiPciIoProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           Controller\r
+           );\r
+\r
     return Status;\r
   }\r
   \r
   //\r
   // component name protocol.\r
   //\r
     return Status;\r
   }\r
   \r
   //\r
   // component name protocol.\r
   //\r
+\r
   HcDev->ControllerNameTable = NULL;\r
   AddUnicodeString (\r
     "eng",\r
   HcDev->ControllerNameTable = NULL;\r
   AddUnicodeString (\r
     "eng",\r
@@ -582,12 +781,17 @@ UnInstallUHCInterface (
   HcDev = USB_HC_DEV_FROM_THIS (This);\r
 \r
   gBS->UninstallProtocolInterface (\r
   HcDev = USB_HC_DEV_FROM_THIS (This);\r
 \r
   gBS->UninstallProtocolInterface (\r
-        Controller,\r
-        &gEfiUsbHcProtocolGuid,\r
-        &HcDev->UsbHc\r
-        );\r
-\r
-  //\r
+         Controller,\r
+         &gEfiUsbHcProtocolGuid,\r
+         &HcDev->UsbHc\r
+         );\r
+         \r
+  gBS->UninstallProtocolInterface (\r
+         Controller,\r
+         &gEfiUsb2HcProtocolGuid,\r
+         &HcDev->Usb2Hc\r
+         );\r
+  //     \r
   // first stop USB Host Controller\r
   //\r
   This->SetState (This, EfiUsbHcStateHalt);\r
   // first stop USB Host Controller\r
   //\r
   This->SetState (This, EfiUsbHcStateHalt);\r
@@ -659,12 +863,31 @@ UHCIDriverBindingStop (
 --*/\r
 {\r
   EFI_USB_HC_PROTOCOL *UsbHc;\r
 --*/\r
 {\r
   EFI_USB_HC_PROTOCOL *UsbHc;\r
+  EFI_USB2_HC_PROTOCOL *Usb2Hc;\r
   EFI_STATUS          OpenStatus;\r
 \r
   OpenStatus = gBS->OpenProtocol (\r
                       Controller,\r
                       &gEfiUsbHcProtocolGuid,\r
   EFI_STATUS          OpenStatus;\r
 \r
   OpenStatus = gBS->OpenProtocol (\r
                       Controller,\r
                       &gEfiUsbHcProtocolGuid,\r
-                      (VOID **) &UsbHc,\r
+                      (VOID **)&UsbHc,\r
+                      This->DriverBindingHandle,\r
+                      Controller,\r
+                      EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                      );\r
+\r
+  //\r
+  // Test whether the Controller handler passed in is a valid\r
+  // Usb controller handle that should be supported, if not,\r
+  // return the error status directly\r
+  //\r
+  if (EFI_ERROR (OpenStatus)) {\r
+    return OpenStatus;\r
+  }\r
+\r
+  OpenStatus = gBS->OpenProtocol (\r
+                      Controller,\r
+                      &gEfiUsb2HcProtocolGuid,\r
+                      (VOID **) &Usb2Hc,\r
                       This->DriverBindingHandle,\r
                       Controller,\r
                       EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
                       This->DriverBindingHandle,\r
                       Controller,\r
                       EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
@@ -684,11 +907,11 @@ UHCIDriverBindingStop (
   UnInstallUHCInterface (Controller, UsbHc);\r
 \r
   gBS->CloseProtocol (\r
   UnInstallUHCInterface (Controller, UsbHc);\r
 \r
   gBS->CloseProtocol (\r
-        Controller,\r
-        &gEfiPciIoProtocolGuid,\r
-        This->DriverBindingHandle,\r
-        Controller\r
-        );\r
+         Controller,\r
+         &gEfiPciIoProtocolGuid,\r
+         This->DriverBindingHandle,\r
+         Controller\r
+         );\r
 \r
   return EFI_SUCCESS;\r
 \r
 \r
   return EFI_SUCCESS;\r
 \r
@@ -753,20 +976,20 @@ UHCIReset (
     // set the Global Reset bit in the command register\r
     //\r
     Status = ReadUHCCommandReg (\r
     // set the Global Reset bit in the command register\r
     //\r
     Status = ReadUHCCommandReg (\r
-              HcDev->PciIo,\r
-              CommandRegAddr,\r
-              &Command\r
-              );\r
+               HcDev->PciIo,\r
+               CommandRegAddr,\r
+               &Command\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
 \r
     Command |= USBCMD_GRESET;\r
     Status = WriteUHCCommandReg (\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
 \r
     Command |= USBCMD_GRESET;\r
     Status = WriteUHCCommandReg (\r
-              HcDev->PciIo,\r
-              CommandRegAddr,\r
-              Command\r
-              );\r
+               HcDev->PciIo,\r
+               CommandRegAddr,\r
+               Command\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
@@ -782,10 +1005,10 @@ UHCIReset (
     //\r
     Command &= ~USBCMD_GRESET;\r
     Status = WriteUHCCommandReg (\r
     //\r
     Command &= ~USBCMD_GRESET;\r
     Status = WriteUHCCommandReg (\r
-              HcDev->PciIo,\r
-              CommandRegAddr,\r
-              Command\r
-              );\r
+               HcDev->PciIo,\r
+               CommandRegAddr,\r
+               Command\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
@@ -801,20 +1024,20 @@ UHCIReset (
     // set Host Controller Reset bit to 1\r
     //\r
     Status = ReadUHCCommandReg (\r
     // set Host Controller Reset bit to 1\r
     //\r
     Status = ReadUHCCommandReg (\r
-              HcDev->PciIo,\r
-              CommandRegAddr,\r
-              &Command\r
-              );\r
+               HcDev->PciIo,\r
+               CommandRegAddr,\r
+               &Command\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
 \r
     Command |= USBCMD_HCRESET;\r
     Status = WriteUHCCommandReg (\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
 \r
     Command |= USBCMD_HCRESET;\r
     Status = WriteUHCCommandReg (\r
-              HcDev->PciIo,\r
-              CommandRegAddr,\r
-              Command\r
-              );\r
+               HcDev->PciIo,\r
+               CommandRegAddr,\r
+               Command\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
@@ -905,20 +1128,20 @@ UHCIGetState (
   StatusRegAddr   = (UINT32) (USBSTS);\r
 \r
   Status = ReadUHCCommandReg (\r
   StatusRegAddr   = (UINT32) (USBSTS);\r
 \r
   Status = ReadUHCCommandReg (\r
-            HcDev->PciIo,\r
-            CommandRegAddr,\r
-            &UhcCommand\r
-            );\r
+             HcDev->PciIo,\r
+             CommandRegAddr,\r
+             &UhcCommand\r
+             );\r
 \r
   if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
   Status = ReadUHCCommandReg (\r
 \r
   if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
   Status = ReadUHCCommandReg (\r
-            HcDev->PciIo,\r
-            StatusRegAddr,\r
-            &UhcStatus\r
-            );\r
+             HcDev->PciIo,\r
+             StatusRegAddr,\r
+             &UhcStatus\r
+             );\r
   if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
@@ -990,10 +1213,10 @@ UHCISetState (
     }\r
 \r
     Status = ReadUHCCommandReg (\r
     }\r
 \r
     Status = ReadUHCCommandReg (\r
-              HcDev->PciIo,\r
-              CommandRegAddr,\r
-              &Command\r
-              );\r
+               HcDev->PciIo,\r
+               CommandRegAddr,\r
+               &Command\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
@@ -1001,10 +1224,10 @@ UHCISetState (
     Command &= ~USBCMD_RS;\r
 \r
     Status = WriteUHCCommandReg (\r
     Command &= ~USBCMD_RS;\r
 \r
     Status = WriteUHCCommandReg (\r
-              HcDev->PciIo,\r
-              CommandRegAddr,\r
-              Command\r
-              );\r
+               HcDev->PciIo,\r
+               CommandRegAddr,\r
+               Command\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
@@ -1033,20 +1256,20 @@ UHCISetState (
       // Set Run/Stop bit to 1.\r
       //\r
       Status = ReadUHCCommandReg (\r
       // Set Run/Stop bit to 1.\r
       //\r
       Status = ReadUHCCommandReg (\r
-                HcDev->PciIo,\r
-                CommandRegAddr,\r
-                &Command\r
-                );\r
+                 HcDev->PciIo,\r
+                 CommandRegAddr,\r
+                 &Command\r
+                 );\r
       if (EFI_ERROR (Status)) {\r
         return EFI_DEVICE_ERROR;\r
       }\r
 \r
       Command |= USBCMD_RS | USBCMD_MAXP;\r
       Status = WriteUHCCommandReg (\r
       if (EFI_ERROR (Status)) {\r
         return EFI_DEVICE_ERROR;\r
       }\r
 \r
       Command |= USBCMD_RS | USBCMD_MAXP;\r
       Status = WriteUHCCommandReg (\r
-                HcDev->PciIo,\r
-                CommandRegAddr,\r
-                Command\r
-                );\r
+                 HcDev->PciIo,\r
+                 CommandRegAddr,\r
+                 Command\r
+                 );\r
       if (EFI_ERROR (Status)) {\r
         return EFI_DEVICE_ERROR;\r
       }\r
       if (EFI_ERROR (Status)) {\r
         return EFI_DEVICE_ERROR;\r
       }\r
@@ -1055,10 +1278,10 @@ UHCISetState (
 \r
     case EfiUsbHcStateSuspend:\r
       Status = ReadUHCCommandReg (\r
 \r
     case EfiUsbHcStateSuspend:\r
       Status = ReadUHCCommandReg (\r
-                HcDev->PciIo,\r
-                CommandRegAddr,\r
-                &Command\r
-                );\r
+                 HcDev->PciIo,\r
+                 CommandRegAddr,\r
+                 &Command\r
+                 );\r
       if (EFI_ERROR (Status)) {\r
         return EFI_DEVICE_ERROR;\r
       }\r
       if (EFI_ERROR (Status)) {\r
         return EFI_DEVICE_ERROR;\r
       }\r
@@ -1115,20 +1338,20 @@ UHCISetState (
     // Set Enter Global Suspend Mode bit to 1.\r
     //\r
     Status = ReadUHCCommandReg (\r
     // Set Enter Global Suspend Mode bit to 1.\r
     //\r
     Status = ReadUHCCommandReg (\r
-              HcDev->PciIo,\r
-              CommandRegAddr,\r
-              &Command\r
-              );\r
+               HcDev->PciIo,\r
+               CommandRegAddr,\r
+               &Command\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
 \r
     Command |= USBCMD_EGSM;\r
     Status = WriteUHCCommandReg (\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
 \r
     Command |= USBCMD_EGSM;\r
     Status = WriteUHCCommandReg (\r
-              HcDev->PciIo,\r
-              CommandRegAddr,\r
-              Command\r
-              );\r
+               HcDev->PciIo,\r
+               CommandRegAddr,\r
+               Command\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
@@ -1185,10 +1408,10 @@ UHCIGetRootHubPortNumber (
   for (Index = 0; Index < 2; Index++) {\r
     PSAddr = (UINT32) (USBPORTSC1 + Index * 2);\r
     Status = ReadRootPortReg (\r
   for (Index = 0; Index < 2; Index++) {\r
     PSAddr = (UINT32) (USBPORTSC1 + Index * 2);\r
     Status = ReadRootPortReg (\r
-              HcDev->PciIo,\r
-              PSAddr,\r
-              &RHPortControl\r
-              );\r
+               HcDev->PciIo,\r
+               PSAddr,\r
+               &RHPortControl\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
@@ -1261,10 +1484,10 @@ UHCIGetRootHubPortStatus (
   PortStatus->PortChangeStatus  = 0;\r
 \r
   Status = ReadRootPortReg (\r
   PortStatus->PortChangeStatus  = 0;\r
 \r
   Status = ReadRootPortReg (\r
-            HcDev->PciIo,\r
-            PSAddr,\r
-            &RHPortStatus\r
-            );\r
+             HcDev->PciIo,\r
+             PSAddr,\r
+             &RHPortStatus\r
+             );\r
 \r
   if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
 \r
   if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
@@ -1307,6 +1530,10 @@ UHCIGetRootHubPortStatus (
     PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;\r
   }\r
   //\r
     PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;\r
   }\r
   //\r
+  // CHC will always return one in this bit\r
+  //\r
+  PortStatus->PortStatus |= USB_PORT_STAT_OWNER;\r
+  //\r
   //   Fill Port Status Change bits\r
   //\r
   \r
   //   Fill Port Status Change bits\r
   //\r
   \r
@@ -1393,10 +1620,10 @@ UHCISetRootHubPortFeature (
 \r
   case EfiUsbPortSuspend:\r
     Status = ReadUHCCommandReg (\r
 \r
   case EfiUsbPortSuspend:\r
     Status = ReadUHCCommandReg (\r
-              HcDev->PciIo,\r
-              CommandRegAddr,\r
-              &Command\r
-              );\r
+               HcDev->PciIo,\r
+               CommandRegAddr,\r
+               &Command\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
@@ -1487,10 +1714,10 @@ UHCIClearRootHubPortFeature (
   PSAddr  = (UINT32) (USBPORTSC1 + PortNumber * 2);\r
 \r
   Status = ReadRootPortReg (\r
   PSAddr  = (UINT32) (USBPORTSC1 + PortNumber * 2);\r
 \r
   Status = ReadRootPortReg (\r
-            HcDev->PciIo,\r
-            PSAddr,\r
-            &RHPortControl\r
-            );\r
+             HcDev->PciIo,\r
+             PSAddr,\r
+             &RHPortControl\r
+             );\r
   if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
@@ -1733,13 +1960,13 @@ UHCIControlTransfer (
     // BusMasterWrite means cpu read\r
     //\r
     Status = HcDev->PciIo->Map (\r
     // BusMasterWrite means cpu read\r
     //\r
     Status = HcDev->PciIo->Map (\r
-                            HcDev->PciIo,\r
-                            EfiPciIoOperationBusMasterWrite,\r
-                            PtrDataSource,\r
-                            &DataLen,\r
-                            &TempPtr,\r
-                            &Mapping\r
-                            );\r
+                             HcDev->PciIo,\r
+                             EfiPciIoOperationBusMasterWrite,\r
+                             PtrDataSource,\r
+                             &DataLen,\r
+                             &TempPtr,\r
+                             &Mapping\r
+                             );\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
@@ -1757,13 +1984,13 @@ UHCIControlTransfer (
     // BusMasterRead means cpu write\r
     //\r
     Status = HcDev->PciIo->Map (\r
     // BusMasterRead means cpu write\r
     //\r
     Status = HcDev->PciIo->Map (\r
-                            HcDev->PciIo,\r
-                            EfiPciIoOperationBusMasterRead,\r
-                            PtrDataSource,\r
-                            &DataLen,\r
-                            &TempPtr,\r
-                            &Mapping\r
-                            );\r
+                             HcDev->PciIo,\r
+                             EfiPciIoOperationBusMasterRead,\r
+                             PtrDataSource,\r
+                             &DataLen,\r
+                             &TempPtr,\r
+                             &Mapping\r
+                             );\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
@@ -1809,13 +2036,13 @@ UHCIControlTransfer (
   //\r
   RequestLen = sizeof (EFI_USB_DEVICE_REQUEST);\r
   Status = HcDev->PciIo->Map (\r
   //\r
   RequestLen = sizeof (EFI_USB_DEVICE_REQUEST);\r
   Status = HcDev->PciIo->Map (\r
-                          HcDev->PciIo,\r
-                          EfiPciIoOperationBusMasterRead,\r
-                          (UINT8 *) Request,\r
-                          &RequestLen,\r
-                          &TempPtr,\r
-                          &RequestMapping\r
-                          );\r
+                           HcDev->PciIo,\r
+                           EfiPciIoOperationBusMasterRead,\r
+                           (UINT8 *) Request,\r
+                           &RequestLen,\r
+                           &TempPtr,\r
+                           &RequestMapping\r
+                           );\r
 \r
   if (EFI_ERROR (Status)) {\r
     HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);\r
 \r
   if (EFI_ERROR (Status)) {\r
     HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);\r
@@ -1829,14 +2056,14 @@ UHCIControlTransfer (
   // generate Setup Stage TD\r
   //\r
   Status = GenSetupStageTD (\r
   // generate Setup Stage TD\r
   //\r
   Status = GenSetupStageTD (\r
-            HcDev,\r
-            DeviceAddress,\r
-            0,\r
-            IsSlowDevice,\r
-            (UINT8 *) RequestMappedAddress,\r
-            sizeof (EFI_USB_DEVICE_REQUEST),\r
-            &PtrSetupTD\r
-            );\r
+             HcDev,\r
+             DeviceAddress,\r
+             0,\r
+             IsSlowDevice,\r
+             (UINT8 *) RequestMappedAddress,\r
+             sizeof (EFI_USB_DEVICE_REQUEST),\r
+             &PtrSetupTD\r
+             );\r
 \r
   if (EFI_ERROR (Status)) {\r
     HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);\r
 \r
   if (EFI_ERROR (Status)) {\r
     HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);\r
@@ -1864,16 +2091,16 @@ UHCIControlTransfer (
     }\r
 \r
     Status = GenDataTD (\r
     }\r
 \r
     Status = GenDataTD (\r
-              HcDev,\r
-              DeviceAddress,\r
-              0,\r
-              Ptr,\r
-              PktSize,\r
-              PktID,\r
-              DataToggle,\r
-              IsSlowDevice,\r
-              &PtrTD\r
-              );\r
+               HcDev,\r
+               DeviceAddress,\r
+               0,\r
+               Ptr,\r
+               PktSize,\r
+               PktID,\r
+               DataToggle,\r
+               IsSlowDevice,\r
+               &PtrTD\r
+               );\r
 \r
     if (EFI_ERROR (Status)) {\r
       //\r
 \r
     if (EFI_ERROR (Status)) {\r
       //\r
@@ -1920,13 +2147,13 @@ UHCIControlTransfer (
   // create Status Stage TD structure\r
   //\r
   Status = CreateStatusTD (\r
   // create Status Stage TD structure\r
   //\r
   Status = CreateStatusTD (\r
-            HcDev,\r
-            DeviceAddress,\r
-            0,\r
-            PktID,\r
-            IsSlowDevice,\r
-            &PtrStatusTD\r
-            );\r
+             HcDev,\r
+             DeviceAddress,\r
+             0,\r
+             PktID,\r
+             IsSlowDevice,\r
+             &PtrStatusTD\r
+             );\r
 \r
   if (EFI_ERROR (Status)) {\r
     HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);\r
 \r
   if (EFI_ERROR (Status)) {\r
     HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);\r
@@ -2009,13 +2236,13 @@ UHCIControlTransfer (
       }\r
 \r
       Status = ExecuteControlTransfer (\r
       }\r
 \r
       Status = ExecuteControlTransfer (\r
-                HcDev,\r
-                PtrFirstDataTD,\r
-                LoadFrameListIndex,\r
-                DataLength,\r
-                TimeOut,\r
-                TransferResult\r
-                );\r
+                 HcDev,\r
+                 PtrFirstDataTD,\r
+                 LoadFrameListIndex,\r
+                 DataLength,\r
+                 TimeOut,\r
+                 TransferResult\r
+                 );\r
 \r
       for (Index = 0; Index < 500; Index++) {\r
         DelLinkSingleQH (\r
 \r
       for (Index = 0; Index < 500; Index++) {\r
         DelLinkSingleQH (\r
@@ -2060,13 +2287,13 @@ UHCIControlTransfer (
     // detail status is returned\r
     //\r
     Status = ExecuteControlTransfer (\r
     // detail status is returned\r
     //\r
     Status = ExecuteControlTransfer (\r
-              HcDev,\r
-              PtrStatusTD,\r
-              LoadFrameListIndex,\r
-              DataLength,\r
-              TimeOut,\r
-              TransferResult\r
-              );\r
+               HcDev,\r
+               PtrStatusTD,\r
+               LoadFrameListIndex,\r
+               DataLength,\r
+               TimeOut,\r
+               TransferResult\r
+               );\r
 \r
     //\r
     // Delete Control Transfer QH-TDs structure\r
 \r
     //\r
     // Delete Control Transfer QH-TDs structure\r
@@ -2123,13 +2350,13 @@ UHCIControlTransfer (
     // detail status is returned\r
     //\r
     Status = ExecuteControlTransfer (\r
     // detail status is returned\r
     //\r
     Status = ExecuteControlTransfer (\r
-              HcDev,\r
-              PtrSetupTD,\r
-              LoadFrameListIndex,\r
-              DataLength,\r
-              TimeOut,\r
-              TransferResult\r
-              );\r
+               HcDev,\r
+               PtrSetupTD,\r
+               LoadFrameListIndex,\r
+               DataLength,\r
+               TimeOut,\r
+               TransferResult\r
+               );\r
     //\r
     // Remove Control Transfer QH-TDs structure from the frame list\r
     // and update the pointers in the Frame List\r
     //\r
     // Remove Control Transfer QH-TDs structure from the frame list\r
     // and update the pointers in the Frame List\r
@@ -2354,13 +2581,13 @@ UHCIBulkTransfer (
     // BusMasterWrite means cpu read\r
     //\r
     Status = HcDev->PciIo->Map (\r
     // BusMasterWrite means cpu read\r
     //\r
     Status = HcDev->PciIo->Map (\r
-                            HcDev->PciIo,\r
-                            EfiPciIoOperationBusMasterWrite,\r
-                            PtrDataSource,\r
-                            &DataLen,\r
-                            &TempPtr,\r
-                            &Mapping\r
-                            );\r
+                             HcDev->PciIo,\r
+                             EfiPciIoOperationBusMasterWrite,\r
+                             PtrDataSource,\r
+                             &DataLen,\r
+                             &TempPtr,\r
+                             &Mapping\r
+                             );\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
@@ -2377,13 +2604,13 @@ UHCIBulkTransfer (
     // BusMasterRead means cpu write\r
     //\r
     Status = HcDev->PciIo->Map (\r
     // BusMasterRead means cpu write\r
     //\r
     Status = HcDev->PciIo->Map (\r
-                            HcDev->PciIo,\r
-                            EfiPciIoOperationBusMasterRead,\r
-                            PtrDataSource,\r
-                            &DataLen,\r
-                            &TempPtr,\r
-                            &Mapping\r
-                            );\r
+                             HcDev->PciIo,\r
+                             EfiPciIoOperationBusMasterRead,\r
+                             PtrDataSource,\r
+                             &DataLen,\r
+                             &TempPtr,\r
+                             &Mapping\r
+                             );\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
@@ -2422,16 +2649,16 @@ UHCIBulkTransfer (
     }\r
 \r
     Status = GenDataTD (\r
     }\r
 \r
     Status = GenDataTD (\r
-              HcDev,\r
-              DeviceAddress,\r
-              EndPointAddress,\r
-              Ptr,\r
-              PktSize,\r
-              PktID,\r
-              *DataToggle,\r
-              FALSE,\r
-              &PtrTD\r
-              );\r
+               HcDev,\r
+               DeviceAddress,\r
+               EndPointAddress,\r
+               Ptr,\r
+               PktSize,\r
+               PktID,\r
+               *DataToggle,\r
+               FALSE,\r
+               &PtrTD\r
+               );\r
 \r
     if (EFI_ERROR (Status)) {\r
       HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);\r
 \r
     if (EFI_ERROR (Status)) {\r
       HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);\r
@@ -2526,14 +2753,14 @@ UHCIBulkTransfer (
   // of the last successful TD\r
   //\r
   Status = ExecBulkorSyncInterruptTransfer (\r
   // of the last successful TD\r
   //\r
   Status = ExecBulkorSyncInterruptTransfer (\r
-            HcDev,\r
-            PtrFirstTD,\r
-            LoadFrameListIndex,\r
-            DataLength,\r
-            DataToggle,\r
-            TimeOut,\r
-            TransferResult\r
-            );\r
+             HcDev,\r
+             PtrFirstTD,\r
+             LoadFrameListIndex,\r
+             DataLength,\r
+             DataToggle,\r
+             TimeOut,\r
+             TransferResult\r
+             );\r
 \r
   //\r
   // Delete Bulk transfer QH-TD structure\r
 \r
   //\r
   // Delete Bulk transfer QH-TD structure\r
@@ -2587,7 +2814,7 @@ UHCIAsyncInterruptTransfer (
   IN     UINT8                              DeviceAddress,\r
   IN     UINT8                              EndPointAddress,\r
   IN     BOOLEAN                            IsSlowDevice,\r
   IN     UINT8                              DeviceAddress,\r
   IN     UINT8                              EndPointAddress,\r
   IN     BOOLEAN                            IsSlowDevice,\r
-  IN     UINT8                              MaxiumPacketLength,\r
+  IN     UINT8                              MaximumPacketLength,\r
   IN     BOOLEAN                            IsNewTransfer,\r
   IN OUT UINT8                              *DataToggle,\r
   IN     UINTN                              PollingInterval, OPTIONAL\r
   IN     BOOLEAN                            IsNewTransfer,\r
   IN OUT UINT8                              *DataToggle,\r
   IN     UINTN                              PollingInterval, OPTIONAL\r
@@ -2618,7 +2845,7 @@ UHCIAsyncInterruptTransfer (
     IsSlowDevice    Indicates whether the target device is slow device \r
                     or full-speed device.\r
                     \r
     IsSlowDevice    Indicates whether the target device is slow device \r
                     or full-speed device.\r
                     \r
-    MaxiumPacketLength  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
                         \r
     IsNewTransfer   If TRUE, an asynchronous interrupt pipe is built between\r
                         is capable of sending or receiving.\r
                         \r
     IsNewTransfer   If TRUE, an asynchronous interrupt pipe is built between\r
@@ -2715,11 +2942,11 @@ UHCIAsyncInterruptTransfer (
     OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY);\r
 \r
     Status = DeleteAsyncINTQHTDs (\r
     OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY);\r
 \r
     Status = DeleteAsyncINTQHTDs (\r
-              HcDev,\r
-              DeviceAddress,\r
-              EndPointAddress,\r
-              DataToggle\r
-              );\r
+               HcDev,\r
+               DeviceAddress,\r
+               EndPointAddress,\r
+               DataToggle\r
+               );\r
 \r
     gBS->RestoreTPL (OldTpl);\r
 \r
 \r
     gBS->RestoreTPL (OldTpl);\r
 \r
@@ -2764,13 +2991,13 @@ UHCIAsyncInterruptTransfer (
   // BusMasterWrite means cpu read\r
   //\r
   Status = HcDev->PciIo->Map (\r
   // BusMasterWrite means cpu read\r
   //\r
   Status = HcDev->PciIo->Map (\r
-                          HcDev->PciIo,\r
-                          EfiPciIoOperationBusMasterWrite,\r
-                          Ptr,\r
-                          &DataLen,\r
-                          &TempPtr,\r
-                          &Mapping\r
-                          );\r
+                           HcDev->PciIo,\r
+                           EfiPciIoOperationBusMasterWrite,\r
+                           Ptr,\r
+                           &DataLen,\r
+                           &TempPtr,\r
+                           &Mapping\r
+                           );\r
   if (EFI_ERROR (Status)) {\r
     gBS->FreePool (Ptr);\r
     return Status;\r
   if (EFI_ERROR (Status)) {\r
     gBS->FreePool (Ptr);\r
     return Status;\r
@@ -2788,23 +3015,23 @@ UHCIAsyncInterruptTransfer (
     //\r
         \r
     PktSize = (UINT8) DataLen;\r
     //\r
         \r
     PktSize = (UINT8) DataLen;\r
-    if (DataLen > MaxiumPacketLength) {\r
-      PktSize = MaxiumPacketLength;\r
+    if (DataLen > MaximumPacketLength) {\r
+      PktSize = MaximumPacketLength;\r
     }\r
 \r
     Status = GenDataTD (\r
     }\r
 \r
     Status = GenDataTD (\r
-              HcDev,\r
-              DeviceAddress,\r
-              EndPointAddress,\r
-              MappedPtr,\r
-              PktSize,\r
-              PktID,\r
-              CurrentDataToggle,\r
-              IsSlowDevice,\r
-              &PtrTD\r
-              );\r
-    if (EFI_ERROR (Status)) {\r
-      gBS->FreePool (Ptr);\r
+               HcDev,\r
+               DeviceAddress,\r
+               EndPointAddress,\r
+               MappedPtr,\r
+               PktSize,\r
+               PktID,\r
+               CurrentDataToggle,\r
+               IsSlowDevice,\r
+               &PtrTD\r
+               );\r
+    if (EFI_ERROR (Status)) {\r
+      gBS->FreePool (Ptr);\r
       HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);\r
       DeleteQueuedTDs (HcDev, PtrFirstTD);\r
       return Status;\r
       HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);\r
       DeleteQueuedTDs (HcDev, PtrFirstTD);\r
       return Status;\r
@@ -3084,6 +3311,10 @@ UHCISyncInterruptTransfer (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  if (TransferResult == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   ClearStatusReg (HcDev->PciIo, StatusReg);\r
 \r
   //\r
   ClearStatusReg (HcDev->PciIo, StatusReg);\r
 \r
   //\r
@@ -3357,6 +3588,830 @@ UHCIAsyncIsochronousTransfer (
   return EFI_UNSUPPORTED;\r
 }\r
 \r
   return EFI_UNSUPPORTED;\r
 }\r
 \r
+//\r
+// UEFI 2.0 Protocol\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2GetCapability(\r
+  IN  EFI_USB2_HC_PROTOCOL  * This,\r
+  OUT UINT8                 *MaxSpeed,\r
+  OUT UINT8                 *PortNumber,\r
+  OUT UINT8                 *Is64BitCapable\r
+  )\r
+/*++\r
+\r
+  Routine Description:\r
+    Retrieves capabilities of USB host controller according to UEFI 2.0 spec.\r
+\r
+  Arguments:\r
+    This                      - A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+    \r
+    MaxSpeed             - A pointer to the max speed USB host controller supports.\r
+    \r
+    PortNumber           - A pointer to the number of root hub ports.\r
+    \r
+    Is64BitCapable      - A pointer to an integer to show whether USB host controller\r
+                                  supports 64-bit memory addressing.\r
+  Returns:\r
+    EFI_SUCCESS \r
+        The host controller capabilities were retrieved successfully.\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
+--*/     \r
+{\r
+  USB_HC_DEV *HcDev;\r
+\r
+  HcDev = USB2_HC_DEV_FROM_THIS (This);\r
+  \r
+  if ((NULL == MaxSpeed) \r
+       ||(NULL == PortNumber)\r
+       || (NULL == Is64BitCapable))\r
+  {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  \r
+  *MaxSpeed = EFI_USB_SPEED_FULL;\r
+  *Is64BitCapable = (UINT8)FALSE;\r
+  return  UHCIGetRootHubPortNumber(&HcDev->UsbHc, PortNumber);\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2Reset (\r
+  IN EFI_USB2_HC_PROTOCOL   * This,\r
+  IN UINT16                 Attributes\r
+  )\r
+/*++\r
+\r
+  Routine Description:\r
+    Provides software reset for the USB host controller according to UEFI 2.0 spec.\r
+\r
+  Arguments:\r
+    This           - A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+    \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
+  #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
+        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
+  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
+  \r
+  Returns:\r
+    EFI_SUCCESS \r
+        The reset operation succeeded.\r
+    EFI_INVALID_PARAMETER \r
+        Attributes is not valid.\r
+    EFI_UNSUPPORTED\r
+        The type of reset specified by Attributes is not currently supported by the host controller hardware.\r
+    EFI_ACCESS_DENIED\r
+        Reset operation is rejected due to the debug port being configured and active.\r
+    EFI_DEVICE_ERROR  \r
+        An error was encountered while attempting to perform \r
+        the reset operation.\r
+--*/\r
+{\r
+  USB_HC_DEV *HcDev;\r
+\r
+  HcDev = USB2_HC_DEV_FROM_THIS (This);\r
+  \r
+  if (Attributes==EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG || Attributes==EFI_USB_HC_RESET_HOST_WITH_DEBUG)\r
+       return EFI_UNSUPPORTED;\r
+  \r
+  return UHCIReset(\r
+       &HcDev->UsbHc, \r
+       Attributes\r
+       );\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2GetState (\r
+  IN  EFI_USB2_HC_PROTOCOL   * This,\r
+  OUT EFI_USB_HC_STATE       * State\r
+  )\r
+/*++\r
+  \r
+  Routine Description:\r
+    Retrieves current state of the USB host controller according to UEFI 2.0 spec.\r
+  \r
+  Arguments:\r
+    \r
+    This     - A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+    \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
+    typedef enum {\r
+      EfiUsbHcStateHalt,\r
+      EfiUsbHcStateOperational,\r
+      EfiUsbHcStateSuspend,\r
+      EfiUsbHcStateMaximum\r
+    } EFI_USB_HC_STATE;\r
+  \r
+  Returns:\r
+    EFI_SUCCESS \r
+            The state information of the host controller was returned in State.\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
+{\r
+  USB_HC_DEV *HcDev;\r
+\r
+  HcDev = USB2_HC_DEV_FROM_THIS (This);\r
+  return UHCIGetState(\r
+       &HcDev->UsbHc, \r
+       State\r
+       );\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2SetState (\r
+  IN EFI_USB2_HC_PROTOCOL    * This,\r
+  IN EFI_USB_HC_STATE        State\r
+  )\r
+/*++\r
+  \r
+  Routine Description:\r
+    Sets the USB host controller to a specific state according to UEFI 2.0 spec.\r
+  \r
+  Arguments:\r
+    \r
+    This     - A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+\r
+    State    - Indicates the state of the host controller that will be set.\r
+  \r
+  Returns:\r
+    EFI_SUCCESS \r
+          The USB host controller was successfully placed in the state \r
+          specified by State.\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
+{\r
+  USB_HC_DEV *HcDev;\r
+\r
+  HcDev = USB2_HC_DEV_FROM_THIS (This);\r
+  return UHCISetState(\r
+       &HcDev->UsbHc, \r
+       State\r
+       );\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2ControlTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL                           * This,\r
+  IN     UINT8                                          DeviceAddress,\r
+  IN     UINT8                                          DeviceSpeed,\r
+  IN     UINTN                                          MaximumPacketLength,\r
+  IN     EFI_USB_DEVICE_REQUEST                         * Request,\r
+  IN     EFI_USB_DATA_DIRECTION                         TransferDirection,\r
+  IN OUT VOID                                           *Data,\r
+  IN OUT UINTN                                          *DataLength,\r
+  IN     UINTN                                          TimeOut,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR             *Translator,\r
+  OUT    UINT32                                         *TransferResult\r
+  )\r
+/*++\r
+  \r
+  Routine Description:\r
+    Submits control transfer to a target USB device accroding to UEFI 2.0 spec..\r
+  \r
+  Arguments:\r
+    \r
+    This         - A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+\r
+    DeviceAddress -Represents the address of the target device on the USB,\r
+                  which is assigned during USB enumeration.\r
+\r
+    DeviceSpeed  - Indicates transfer speed of device.\r
+    \r
+    MaximumPacketLength - Indicates the maximum packet size that the \r
+                        default control transfer endpoint is capable of \r
+                        sending or receiving.\r
+    \r
+    Request      - A pointer to the USB device request that will be sent \r
+                  to the USB device. \r
+    \r
+    TransferDirection - Specifies the data direction for the transfer.\r
+                      There are three values available, DataIn, DataOut \r
+                      and NoData.\r
+    \r
+    Data          -A pointer to the buffer of data that will be transmitted \r
+                  to USB device or received from USB device.\r
+    \r
+    DataLength    - Indicates the size, in bytes, of the data buffer \r
+                  specified by Data.\r
+    \r
+    TimeOut       - Indicates the maximum time, in microseconds, \r
+                  which the transfer is allowed to complete.\r
+    \r
+    TransferResult  - A pointer to the detailed result information generated \r
+                    by this control transfer.\r
+                    \r
+  Returns:\r
+    EFI_SUCCESS \r
+        The control transfer was completed successfully.\r
+    EFI_OUT_OF_RESOURCES  \r
+        The control transfer could not be completed due to a lack of resources.\r
+    EFI_INVALID_PARAMETER \r
+        Some parameters are invalid.\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
+        Caller should check TranferResult for detailed error information.\r
+\r
+--*/\r
+{\r
+  USB_HC_DEV *HcDev;\r
+  BOOLEAN IsSlowDevice = (EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE;\r
+\r
+  HcDev = USB2_HC_DEV_FROM_THIS (This);\r
+  \r
+  return UHCIControlTransfer(\r
+       &HcDev->UsbHc, \r
+       DeviceAddress, \r
+       IsSlowDevice, \r
+       (UINT8) MaximumPacketLength, \r
+       Request, \r
+       TransferDirection, \r
+       Data, \r
+       DataLength,\r
+       TimeOut,\r
+       TransferResult\r
+       );      \r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2BulkTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL                            * This,\r
+  IN     UINT8                                           DeviceAddress,\r
+  IN     UINT8                                           EndPointAddress,\r
+  IN     UINT8                                           DeviceSpeed,\r
+  IN     UINTN                                           MaximumPacketLength,\r
+  IN     UINT8                                           DataBuffersNumber,\r
+  IN OUT VOID                                            *Data[EFI_USB_MAX_BULK_BUFFER_NUM],\r
+  IN OUT UINTN                                           *DataLength,\r
+  IN OUT UINT8                                           *DataToggle,\r
+  IN     UINTN                                           TimeOut,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR              *Translator,\r
+  OUT    UINT32                                          *TransferResult\r
+  )                                                  \r
+/*++\r
+  \r
+  Routine Description:\r
+    Submits bulk transfer to a bulk endpoint of a USB device according to UEFI 2.0 spec.\r
+    \r
+  Arguments:\r
+    \r
+    This          A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+    \r
+    DeviceAddress Represents the address of the target device on the USB,\r
+                  which is assigned during USB enumeration.\r
+                  \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
+                      \r
+    DeviceSpeed  Indicates device speed. The supported values are EFI_USB_SPEED_FULL\r
+                          and EFI_USB_SPEED_HIGH.\r
+                          \r
+    MaximumPacketLength Indicates the maximum packet size the target endpoint\r
+                        is capable of sending or receiving.\r
+                        \r
+    DataBuffersNumber  Number of data buffers prepared for the transfer.\r
+    \r
+    Data          Array of pointers to the buffers of data that will be transmitted \r
+                  to USB device or received from USB device.\r
+                  \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
+                  \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
+                  \r
+    Translator  A pointr to the transaction translator data.\r
+    \r
+    TimeOut       Indicates the maximum time, in microseconds, which the \r
+                  transfer is allowed to complete.\r
+                  \r
+    TransferResult  A pointer to the detailed result information of the \r
+                    bulk transfer.\r
+\r
+  Returns:\r
+    EFI_SUCCESS \r
+        The bulk transfer was completed successfully.\r
+        \r
+    EFI_OUT_OF_RESOURCES  \r
+        The bulk transfer could not be submitted due to lack of resource.\r
+        \r
+    EFI_INVALID_PARAMETER \r
+        Some parameters are invalid.\r
+        \r
+    EFI_TIMEOUT \r
+        The bulk transfer failed due to timeout.\r
+        \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
+--*/  \r
+{\r
+  USB_HC_DEV *HcDev;\r
+\r
+  HcDev = USB2_HC_DEV_FROM_THIS (This);\r
+  \r
+  if( Data == NULL || DeviceSpeed==EFI_USB_SPEED_LOW)\r
+       return EFI_INVALID_PARAMETER;\r
+  /* For full-speed bulk transfers only the data pointed by Data[0] shall be used */\r
+\r
+  return UHCIBulkTransfer (\r
+       &HcDev->UsbHc, \r
+       DeviceAddress, \r
+       EndPointAddress, \r
+       (UINT8) MaximumPacketLength, \r
+       *Data, \r
+       DataLength, \r
+       DataToggle, \r
+       TimeOut, \r
+       TransferResult\r
+       );\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2AsyncInterruptTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL                        * This,\r
+  IN     UINT8                                       DeviceAddress,\r
+  IN     UINT8                                       EndPointAddress,\r
+  IN     UINT8                                       DeviceSpeed,\r
+  IN     UINTN                                       MaximumPacketLength,\r
+  IN     BOOLEAN                                     IsNewTransfer,\r
+  IN OUT UINT8                                       *DataToggle,\r
+  IN     UINTN                                       PollingInterval,\r
+  IN     UINTN                                       DataLength,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR          *Translator,\r
+  IN     EFI_ASYNC_USB_TRANSFER_CALLBACK             CallBackFunction,\r
+  IN     VOID                                        *Context\r
+  )\r
+/*++\r
+  \r
+  Routine Description:\r
+    Submits an asynchronous interrupt transfer to an \r
+    interrupt endpoint of a USB device according to UEFI 2.0 spec.\r
+  \r
+  Arguments:\r
+    \r
+    This            A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+    \r
+    DeviceAddress   Represents the address of the target device on the USB,\r
+                    which is assigned during USB enumeration.\r
+                    \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
+                    \r
+    DeviceSpeed     Indicates device speed.\r
+    \r
+    MaximumPacketLength  Indicates the maximum packet size the target endpoint\r
+                        is capable of sending or receiving.\r
+                        \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
+                    \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
+                    \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
+                    \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
+                    \r
+    Translator  A pointr to the transaction translator data.\r
+    \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
+                      \r
+    Context         The context that is passed to the CallBackFunction.\r
+                    This is an optional parameter and may be NULL.\r
+  \r
+  Returns:\r
+  \r
+    EFI_SUCCESS \r
+        The asynchronous interrupt transfer request has been successfully \r
+        submitted or canceled.\r
+        \r
+    EFI_INVALID_PARAMETER \r
+        Some parameters are invalid.\r
+        \r
+    EFI_OUT_OF_RESOURCES  \r
+        The request could not be completed due to a lack of resources.  \r
+        \r
+    EFI_DEVICE_ERROR\r
+        Can't read register\r
+--*/  \r
+{\r
+  USB_HC_DEV *HcDev;\r
+  BOOLEAN IsSlowDevice = (EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE;\r
+   \r
+  HcDev = USB2_HC_DEV_FROM_THIS (This);\r
+  return UHCIAsyncInterruptTransfer(\r
+       &HcDev->UsbHc, \r
+       DeviceAddress, \r
+       EndPointAddress, \r
+       IsSlowDevice, \r
+       (UINT8) MaximumPacketLength, \r
+       IsNewTransfer, \r
+       DataToggle, \r
+       PollingInterval,\r
+       DataLength, \r
+       CallBackFunction,\r
+       Context\r
+       );\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2SyncInterruptTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL                      * This,\r
+  IN     UINT8                                     DeviceAddress,\r
+  IN     UINT8                                     EndPointAddress,\r
+  IN     UINT8                                     DeviceSpeed,\r
+  IN     UINTN                                     MaximumPacketLength,\r
+  IN OUT VOID                                      *Data,\r
+  IN OUT UINTN                                     *DataLength,\r
+  IN OUT UINT8                                     *DataToggle,\r
+  IN     UINTN                                     TimeOut,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR        *Translator,\r
+  OUT    UINT32                                    *TransferResult\r
+  )\r
+/*++\r
+  \r
+  Routine Description:\r
+    Submits synchronous interrupt transfer to an interrupt endpoint \r
+    of a USB device according to UEFI 2.0 spec.\r
+  \r
+  Arguments:\r
+    \r
+    This            A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+    \r
+    DeviceAddress   Represents the address of the target device on the USB, \r
+                    which is assigned during USB enumeration.\r
+                    \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
+                      \r
+    DeviceSpeed  Indicates device speed.\r
+                    \r
+    MaximumPacketLength Indicates the maximum packet size the target endpoint \r
+                        is capable of sending or receiving.\r
+                        \r
+    Data            A pointer to the buffer of data that will be transmitted \r
+                    to USB device or received from USB device.\r
+                    \r
+    DataLength      On input, the size, in bytes, of the data buffer specified \r
+                    by Data. On output, the number of bytes transferred.\r
+                    \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
+                    \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
+\r
+  Returns:\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
+        to lack of resource.\r
+    EFI_INVALID_PARAMETER \r
+        Some parameters are invalid.\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
+{\r
+  USB_HC_DEV *HcDev;\r
+  BOOLEAN IsSlowDevice;\r
+  \r
+  if(DeviceSpeed==EFI_USB_SPEED_HIGH)\r
+       return EFI_INVALID_PARAMETER;\r
+  \r
+  IsSlowDevice = (EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE;  \r
+  HcDev = USB2_HC_DEV_FROM_THIS (This);\r
+  \r
+  return UHCISyncInterruptTransfer(\r
+       &HcDev->UsbHc, \r
+       DeviceAddress, \r
+       EndPointAddress, \r
+       IsSlowDevice, \r
+       (UINT8) MaximumPacketLength, \r
+       Data, \r
+       DataLength, \r
+       DataToggle,\r
+       TimeOut,\r
+       TransferResult\r
+       );\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2IsochronousTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL                       * This,\r
+  IN     UINT8                                      DeviceAddress,\r
+  IN     UINT8                                      EndPointAddress,\r
+  IN     UINT8                                      DeviceSpeed,\r
+  IN     UINTN                                      MaximumPacketLength,\r
+  IN     UINT8                                      DataBuffersNumber,\r
+  IN OUT VOID                                       *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
+  IN     UINTN                                      DataLength,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR         *Translator,\r
+  OUT    UINT32                                     *TransferResult\r
+  )\r
+/*++\r
+  \r
+  Routine Description:\r
+  \r
+    Submits isochronous transfer to a target USB device according to UEFI 2.0 spec.\r
+  \r
+  Arguments:\r
+    \r
+    This             A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+    \r
+    DeviceAddress    Represents the address of the target device on the USB,\r
+                           which is assigned during USB enumeration.\r
+                           \r
+    EndPointAddress  End point address\r
+    \r
+    DeviceSpeed      Indicates device speed.\r
+    \r
+    MaximumPacketLength    Indicates the maximum packet size that the \r
+                           default control transfer endpoint is capable of \r
+                           sending or receiving.\r
+                           \r
+    DataBuffersNumber Number of data buffers prepared for the transfer.\r
+    \r
+    Data              Array of pointers to the buffers of data that will be \r
+                      transmitted to USB device or received from USB device.\r
+                  \r
+    DataLength        Indicates the size, in bytes, of the data buffer \r
+                      specified by Data.\r
+                           \r
+    Translator        A pointr to the transaction translator data.\r
+    \r
+    TransferResult    A pointer to the detailed result information generated \r
+                      by this control transfer.               \r
+  Returns:\r
+  \r
+    EFI_UNSUPPORTED \r
+\r
+--*/  \r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2AsyncIsochronousTransfer (\r
+  IN     EFI_USB2_HC_PROTOCOL                         * This,\r
+  IN     UINT8                                        DeviceAddress,\r
+  IN     UINT8                                        EndPointAddress,\r
+  IN     UINT8                                        DeviceSpeed,\r
+  IN     UINTN                                        MaximumPacketLength,\r
+  IN     UINT8                                        DataBuffersNumber,\r
+  IN OUT VOID                                         *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
+  IN     UINTN                                        DataLength,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR           *Translator,\r
+  IN     EFI_ASYNC_USB_TRANSFER_CALLBACK              IsochronousCallBack,\r
+  IN     VOID                                         *Context\r
+  )\r
+/*++\r
+  \r
+  Routine Description:\r
+  \r
+    Submits Async isochronous transfer to a target USB device according to UEFI 2.0 spec.\r
+  \r
+  Arguments:\r
+    \r
+    This                A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+    \r
+    DeviceAddress       Represents the address of the target device on the USB,\r
+                           which is assigned during USB enumeration.\r
+\r
+    EndPointAddress     End point address\r
+    \r
+    DeviceSpeed         Indicates device speed.\r
+    \r
+    MaximumPacketLength Indicates the maximum packet size that the \r
+                        default control transfer endpoint is capable of \r
+                        sending or receiving.\r
+                        \r
+    DataBuffersNumber   Number of data buffers prepared for the transfer.\r
+    \r
+    Data                Array of pointers to the buffers of data that will be transmitted \r
+                        to USB device or received from USB device.\r
+                        \r
+    Translator          A pointr to the transaction translator data.\r
+    \r
+    IsochronousCallBack When the transfer complete, the call back function will be called\r
+    \r
+    Context             Pass to the call back function as parameter\r
+                    \r
+  Returns:\r
+  \r
+    EFI_UNSUPPORTED \r
+\r
+--*/  \r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2GetRootHubPortStatus (\r
+  IN  EFI_USB2_HC_PROTOCOL   * This,\r
+  IN  UINT8                  PortNumber,\r
+  OUT EFI_USB_PORT_STATUS    * PortStatus\r
+  )\r
+/*++\r
+  \r
+  Routine Description:\r
+    Retrieves the current status of a USB root hub port according to UEFI 2.0 spec.\r
+  \r
+  Arguments:\r
+  \r
+    This        A pointer to the EFI_USB2_HC_PROTOCOL.\r
+    \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
+    \r
+    PortStatus  A pointer to the current port status bits and \r
+                port status change bits.  \r
+  \r
+  Returns:\r
+    EFI_SUCCESS \r
+        The status of the USB root hub port specified by PortNumber \r
+        was returned in PortStatus.\r
+    EFI_INVALID_PARAMETER \r
+        PortNumber is invalid. \r
+    EFI_DEVICE_ERROR - Can't read register      \r
+--*/     \r
+{\r
+  USB_HC_DEV *HcDev;\r
+\r
+  HcDev = USB2_HC_DEV_FROM_THIS (This);\r
+  \r
+  return UHCIGetRootHubPortStatus(\r
+       &HcDev->UsbHc, \r
+       PortNumber, \r
+       PortStatus\r
+       );\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2SetRootHubPortFeature (\r
+  IN EFI_USB2_HC_PROTOCOL     * This,\r
+  IN UINT8                   PortNumber,\r
+  IN EFI_USB_PORT_FEATURE    PortFeature\r
+  )\r
+/*++\r
+  \r
+  Routine Description:\r
+    Sets a feature for the specified root hub port according to UEFI 2.0 spec.\r
+  \r
+  Arguments:\r
+  \r
+    This        A pointer to the EFI_USB2_HC_PROTOCOL.\r
+    \r
+    PortNumber  Specifies the root hub port whose feature \r
+                is requested to be set.\r
+    \r
+    PortFeature Indicates the feature selector associated \r
+                with the feature set request. \r
+  \r
+  Returns:\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
+        PortNumber is invalid or PortFeature is invalid.\r
+    EFI_DEVICE_ERROR\r
+        Can't read register\r
+--*/  \r
+{\r
+  USB_HC_DEV *HcDev;\r
+\r
+  HcDev = USB2_HC_DEV_FROM_THIS (This);\r
+  return UHCISetRootHubPortFeature(\r
+       &HcDev->UsbHc, \r
+       PortNumber, \r
+       PortFeature\r
+       );\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UHCI2ClearRootHubPortFeature (\r
+  IN EFI_USB2_HC_PROTOCOL    * This,\r
+  IN UINT8                   PortNumber,\r
+  IN EFI_USB_PORT_FEATURE    PortFeature\r
+  )\r
+/*++\r
+  \r
+  Routine Description:\r
+    Clears a feature for the specified root hub port according to Uefi 2.0 spec.\r
+  \r
+  Arguments:\r
+  \r
+    This        A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+    \r
+    PortNumber  Specifies the root hub port whose feature \r
+                is requested to be cleared.\r
+    \r
+    PortFeature Indicates the feature selector associated with the \r
+                feature clear request.\r
+                  \r
+  Returns:\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
+        PortNumber is invalid or PortFeature is invalid.\r
+    EFI_DEVICE_ERROR\r
+        Can't read register\r
+--*/  \r
+{\r
+  USB_HC_DEV *HcDev;\r
+\r
+  HcDev = USB2_HC_DEV_FROM_THIS (This);\r
+  return UHCIClearRootHubPortFeature(\r
+       &HcDev->UsbHc, \r
+       PortNumber, \r
+       PortFeature\r
+       );\r
+}\r
+\r
 VOID\r
 EFIAPI\r
 MonitorInterruptTrans (\r
 VOID\r
 EFIAPI\r
 MonitorInterruptTrans (\r