Fixed unexpected timeout in Usb MassStorage Driver.

Fixed unexpected timeout in Uhci/Ehci driver.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4038 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
yshang1
2007-10-08 06:14:13 +00:00
parent ba5711102a
commit 41e8ff2781
22 changed files with 386 additions and 262 deletions

View File

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