]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c
Fixed unexpected timeout in Usb MassStorage Driver.
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / EhciDxe / EhciReg.c
index aa166055569fe4fad33c5a8b0190362d7e1c3ba5..45b6df5c830a7035e57b75c7196f8d0595d14270 100644 (file)
@@ -214,12 +214,12 @@ EhcWaitOpRegBit (
 {\r
   UINT32                  Index;\r
 \r
-  for (Index = 0; Index < Timeout / EHC_SYNC_POLL_TIME + 1; Index++) {\r
+  for (Index = 0; Index < Timeout / EHC_SYNC_POLL_INTERVAL + 1; Index++) {\r
     if (EHC_REG_BIT_IS_SET (Ehc, Offset, Bit) == WaitToSet) {\r
       return EFI_SUCCESS;\r
     }\r
 \r
-    gBS->Stall (EHC_SYNC_POLL_TIME);\r
+    gBS->Stall (EHC_SYNC_POLL_INTERVAL);\r
   }\r
 \r
   return EFI_TIMEOUT;\r
@@ -368,7 +368,6 @@ EhcEnablePeriodSchd (
   @return EFI_DEVICE_ERROR : Fail to disable periodic schedule\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EhcDisablePeriodSchd (\r
   IN USB2_HC_DEV          *Ehc,\r
@@ -422,7 +421,6 @@ EhcEnableAsyncSchd (
   @return Others      : Failed to disable the asynchronous schedule\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EhcDisableAsyncSchd (\r
   IN USB2_HC_DEV          *Ehc,\r
@@ -616,14 +614,19 @@ EhcInitHC (
   //\r
   EhcSetOpRegBit (Ehc, EHC_CONFIG_FLAG_OFFSET, CONFIGFLAG_ROUTE_EHC);\r
 \r
-  Status = EhcEnablePeriodSchd (Ehc, EHC_GENERIC_TIME);\r
+  //\r
+  // Wait roothub port power stable\r
+  //\r
+  gBS->Stall (EHC_ROOT_PORT_RECOVERY_STALL);\r
+\r
+  Status = EhcEnablePeriodSchd (Ehc, EHC_GENERIC_TIMEOUT);\r
 \r
   if (EFI_ERROR (Status)) {\r
     EHC_ERROR (("EhcInitHC: failed to enable period schedule\n"));\r
     return Status;\r
   }\r
 \r
-  Status = EhcEnableAsyncSchd (Ehc, EHC_GENERIC_TIME);\r
+  Status = EhcEnableAsyncSchd (Ehc, EHC_GENERIC_TIMEOUT);\r
 \r
   if (EFI_ERROR (Status)) {\r
     EHC_ERROR (("EhcInitHC: failed to enable async schedule\n"));\r