// Host Controller must be Halt when Reset it\r
//\r
if (!EhcIsHalt (Ehc)) {\r
- Status = EhcHaltHC (Ehc, EHC_GENERIC_TIME);\r
+ Status = EhcHaltHC (Ehc, EHC_GENERIC_TIMEOUT);\r
\r
if (EFI_ERROR (Status)) {\r
Status = EFI_DEVICE_ERROR;\r
goto ON_EXIT;\r
}\r
}\r
-\r
+ \r
//\r
// Clean up the asynchronous transfers, currently only\r
// interrupt supports asynchronous operation.\r
EhcAckAllInterrupt (Ehc);\r
EhcFreeSched (Ehc);\r
\r
- Status = EhcResetHC (Ehc, EHC_STALL_1_SECOND);\r
+ Status = EhcResetHC (Ehc, EHC_RESET_TIMEOUT);\r
\r
if (EFI_ERROR (Status)) {\r
goto ON_EXIT;\r
\r
switch (State) {\r
case EfiUsbHcStateHalt:\r
- Status = EhcHaltHC (Ehc, EHC_GENERIC_TIME);\r
+ Status = EhcHaltHC (Ehc, EHC_GENERIC_TIMEOUT);\r
break;\r
\r
case EfiUsbHcStateOperational:\r
break;\r
}\r
\r
- Status = EhcRunHC (Ehc, EHC_GENERIC_TIME);\r
+ //\r
+ // Software must not write a one to this field unless the host controller\r
+ // is in the Halted state. Doing so will yield undefined results. \r
+ // refers to Spec[EHCI1.0-2.3.1]\r
+ // \r
+ if (!EHC_REG_BIT_IS_SET (Ehc, EHC_USBSTS_OFFSET, USBSTS_HALT)) {\r
+ Status = EFI_DEVICE_ERROR;\r
+ break;\r
+ }\r
+\r
+ Status = EhcRunHC (Ehc, EHC_GENERIC_TIMEOUT);\r
break;\r
\r
case EfiUsbHcStateSuspend:\r
// Make sure Host Controller not halt before reset it\r
//\r
if (EhcIsHalt (Ehc)) {\r
- Status = EhcRunHC (Ehc, EHC_GENERIC_TIME);\r
+ Status = EhcRunHC (Ehc, EHC_GENERIC_TIMEOUT);\r
\r
if (EFI_ERROR (Status)) {\r
EHC_DEBUG (("EhcSetRootHubPortFeature :failed to start HC - %r\n", Status));\r
break;\r
}\r
}\r
-\r
+ \r
//\r
// Set one to PortReset bit must also set zero to PortEnable bit\r
//\r
// Robustnesss improvement such as for UoL\r
//\r
EhcClearLegacySupport (Ehc);\r
- EhcResetHC (Ehc, EHC_STALL_1_SECOND);\r
+ EhcResetHC (Ehc, EHC_RESET_TIMEOUT);\r
\r
Status = EhcInitHC (Ehc);\r
\r
//\r
// Start the asynchronous interrupt monitor\r
//\r
- Status = gBS->SetTimer (Ehc->PollTimer, TimerPeriodic, EHC_ASYNC_POLL_TIME);\r
+ Status = gBS->SetTimer (Ehc->PollTimer, TimerPeriodic, EHC_ASYNC_POLL_INTERVAL);\r
\r
if (EFI_ERROR (Status)) {\r
EHC_ERROR (("EhcDriverBindingStart: failed to start async interrupt monitor\n"));\r
\r
- EhcHaltHC (Ehc, EHC_GENERIC_TIME);\r
+ EhcHaltHC (Ehc, EHC_GENERIC_TIMEOUT);\r
goto UNINSTALL_USBHC;\r
}\r
\r
// Stop AsyncRequest Polling timer then stop the EHCI driver\r
// and uninstall the EHCI protocl.\r
//\r
- gBS->SetTimer (Ehc->PollTimer, TimerCancel, EHC_ASYNC_POLL_TIME);\r
- EhcHaltHC (Ehc, EHC_GENERIC_TIME);\r
+ gBS->SetTimer (Ehc->PollTimer, TimerCancel, EHC_ASYNC_POLL_INTERVAL);\r
+ EhcHaltHC (Ehc, EHC_GENERIC_TIMEOUT);\r
\r
Status = gBS->UninstallProtocolInterface (\r
Controller,\r