]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c
MdeModulePkg/UsbBus&XhciDxe: Solve a bug that 2 or more tiers SS hubs with SS devices...
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbHub.c
index 2fcacad46e468d2f0fc5f90bf3d06d696ac33509..e3752d1f83ef7fa1835bce82fa1845c911f5989d 100644 (file)
@@ -968,6 +968,15 @@ UsbHubResetPort (
   UINTN                   Index;\r
   EFI_STATUS              Status;\r
 \r
+  Status = UsbHubGetPortStatus (HubIf, Port, &PortState);\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  } else if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_RESET)) {\r
+    DEBUG (( EFI_D_INFO, "UsbHubResetPort: skip reset on hub %p port %d\n", HubIf, Port));\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
   Status  = UsbHubSetPortFeature (HubIf, Port, (EFI_USB_PORT_FEATURE) USB_HUB_PORT_RESET);\r
 \r
   if (EFI_ERROR (Status)) {\r
@@ -1272,6 +1281,16 @@ UsbRootHubResetPort (
   // should be handled in the EHCI driver.\r
   //\r
   Bus     = RootIf->Device->Bus;\r
+\r
+  Status = UsbHcGetRootHubPortStatus (Bus, Port, &PortState);\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  } else if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_RESET)) {\r
+    DEBUG (( EFI_D_INFO, "UsbRootHubResetPort: skip reset on root port %d\n", Port));\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
   Status  = UsbHcSetRootHubPortFeature (Bus, Port, EfiUsbPortReset);\r
 \r
   if (EFI_ERROR (Status)) {\r