- if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_OVERCURRENT)) {\r
- //\r
- // If overcurrent condition is cleared, enable the port again\r
- //\r
- if (!USB_BIT_IS_SET (PortState.PortStatus, USB_PORT_STAT_OVERCURRENT)) {\r
- HubApi->SetPortFeature (HubIf, Port, USB_HUB_PORT_POWER);\r
+ if (USB_BIT_IS_SET (PortState.PortStatus, USB_PORT_STAT_OVERCURRENT)) {\r
+ //\r
+ // Both OverCurrent and OverCurrentChange set, means over current occurs, \r
+ // which probably is caused by short circuit. It has to wait system hardware\r
+ // to perform recovery.\r
+ //\r
+ USB_DEBUG (("UsbEnumeratePort: Critical Over Current\n", Port));\r
+ return EFI_DEVICE_ERROR;\r
+ \r
+ } else {\r
+ //\r
+ // Only OverCurrentChange set, means system has been recoveried from \r
+ // over current. As a result, all ports are nearly power-off, so\r
+ // it's necessary to detach and enumerate all ports again. \r
+ //\r
+ USB_DEBUG (("UsbEnumeratePort: 2.0 device Recovery Over Current\n", Port)); \r
+ goto ON_ENUMERATE;\r
+ \r