summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.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/Usb/UsbBusDxe/UsbEnumer.c
parentba5711102a63d081cb388289983a0e2734e42fb5 (diff)
downloadedk2-41e8ff2781f3ca14f73ef5f39e781ccba8cb373d.tar.gz
edk2-41e8ff2781f3ca14f73ef5f39e781ccba8cb373d.tar.bz2
edk2-41e8ff2781f3ca14f73ef5f39e781ccba8cb373d.zip
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/Usb/UsbBusDxe/UsbEnumer.c')
-rw-r--r--MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c60
1 files changed, 25 insertions, 35 deletions
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
index b92e9e072e..65eb2dd77f 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
@@ -656,13 +656,9 @@ UsbEnumerateNewDev (
Parent = HubIf->Device;
Bus = Parent->Bus;
HubApi = HubIf->HubApi;
-
-
- //
- // Wait at least 100 ms for the power on port to stable
- //
- gBS->Stall (100 * USB_STALL_1_MS);
-
+
+ gBS->Stall (USB_WAIT_PORT_STABLE_STALL);
+
//
// Hub resets the device for at least 10 milliseconds.
// Host learns device speed. If device is of low/full speed
@@ -774,11 +770,8 @@ UsbEnumerateNewDev (
DEBUG ((EFI_D_ERROR, "UsbEnumerateNewDev: failed to set device address - %r\n", Status));
goto ON_ERROR;
}
-
- //
- // Wait 20ms for set address to complete
- //
- gBS->Stall (20 * USB_STALL_1_MS);
+
+ gBS->Stall (USB_SET_DEVICE_ADDRESS_STALL);
DEBUG ((EFI_D_INFO, "UsbEnumerateNewDev: device is now ADDRESSED at %d\n", Address));
@@ -886,47 +879,44 @@ UsbEnumeratePort (
if (USB_BIT_IS_SET (PortState.PortStatus, USB_PORT_STAT_OVERCURRENT)) {
//
- // Both OverCurrent and OverCurrentChange set, means over current occurs,
- // which probably is caused by short circuit. It has to wait system hardware
- // to perform recovery.
+ // Case1:
+ // Both OverCurrent and OverCurrentChange set, means over current occurs,
+ // which probably is caused by short circuit. It has to wait system hardware
+ // to perform recovery.
//
DEBUG (( EFI_D_ERROR, "UsbEnumeratePort: Critical Over Current\n", Port));
return EFI_DEVICE_ERROR;
- } else {
- //
- // Only OverCurrentChange set, means system has been recoveried from
- // over current. As a result, all ports are nearly power-off, so
- // it's necessary to detach and enumerate all ports again.
- //
- DEBUG (( EFI_D_ERROR, "UsbEnumeratePort: 2.0 device Recovery Over Current\n", Port));
- goto ON_ENUMERATE;
-
- }
+ }
+ //
+ // Case2:
+ // Only OverCurrentChange set, means system has been recoveried from
+ // over current. As a result, all ports are nearly power-off, so
+ // it's necessary to detach and enumerate all ports again.
+ //
+ DEBUG (( EFI_D_ERROR, "UsbEnumeratePort: 2.0 device Recovery Over Current\n", Port));
}
if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_ENABLE)) {
//
- // 1.1 roothub port reg doesn't reflect over-current state, while its counterpart
- // on 2.0 roothub does. When over-current has influence on 1.1 device, the port
- // would be disabled, so it's also necessary to detach and enumerate again.
+ // Case3:
+ // 1.1 roothub port reg doesn't reflect over-current state, while its counterpart
+ // on 2.0 roothub does. When over-current has influence on 1.1 device, the port
+ // would be disabled, so it's also necessary to detach and enumerate again.
//
DEBUG (( EFI_D_ERROR, "UsbEnumeratePort: 1.1 device Recovery Over Current\n", Port));
- goto ON_ENUMERATE;
}
if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_CONNECTION)) {
//
- // Device connected or disconnected normally.
+ // Case4:
+ // Device connected or disconnected normally.
//
- goto ON_ENUMERATE;
+ DEBUG ((EFI_D_ERROR, "UsbEnumeratePort: Device Connect/Discount Normally\n", Port));
}
-ON_ENUMERATE:
-
//
- // In case there is already a device on this port logically, it's safety to remove
- // and enumerate again.
+ // Following as the above cases, it's safety to remove and create again.
//
Child = UsbFindChild (HubIf, Port);