summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
diff options
context:
space:
mode:
authoryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>2007-10-08 06:14:13 +0000
committeryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>2007-10-08 06:14:13 +0000
commit41e8ff2781f3ca14f73ef5f39e781ccba8cb373d (patch)
tree8fd7edcbb8c98bf324db6e2b043b3603abf67158 /MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
parentba5711102a63d081cb388289983a0e2734e42fb5 (diff)
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
Diffstat (limited to 'MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c')
-rw-r--r--MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
index 13ce7fdfb..07a690edc 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
@@ -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,