]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Bus/Pci/XhciDxe: Reset port if status change returns an error
authorSean Rhodes <sean@starlabs.systems>
Fri, 16 Dec 2022 12:24:18 +0000 (12:24 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 4 Jan 2023 03:50:39 +0000 (03:50 +0000)
Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in
PortChangeStatus when XhcPollPortStatusChange fails

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c

index 461b2cd9b5946dc6ffbc1a78c4f9844dd803482b..d8fa41f68f5577aa595bf9dd4c09d9ddc935ab73 100644 (file)
@@ -471,7 +471,16 @@ XhcGetRootHubPortStatus (
   // For those devices behind hub, we get its attach/detach event by hooking Get_Port_Status request at control transfer for those hub.\r
   //\r
   ParentRouteChart.Dword = 0;\r
-  XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus);\r
+  Status                 = XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus);\r
+\r
+  //\r
+  // Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in PortChangeStatus\r
+  // when XhcPollPortStatusChange fails\r
+  //\r
+  if (EFI_ERROR (Status)) {\r
+    PortStatus->PortChangeStatus &= ~(USB_PORT_STAT_C_RESET);\r
+    Status                        = EFI_SUCCESS;\r
+  }\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r