summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorSean Rhodes <sean@starlabs.systems>2022-12-16 12:24:18 +0000
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-01-04 03:50:39 +0000
commit992d5451d19b93635d52db293bab680e32142776 (patch)
tree7a214f2f1db4db54c891f690fd8152e7d6c21d17 /MdeModulePkg
parent89c5d90003d9c54d03d3e85bd305718e9c29a213 (diff)
downloadedk2-992d5451d19b93635d52db293bab680e32142776.tar.gz
edk2-992d5451d19b93635d52db293bab680e32142776.tar.bz2
edk2-992d5451d19b93635d52db293bab680e32142776.zip
MdeModulePkg/Bus/Pci/XhciDxe: Reset port if status change returns an error
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>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index 461b2cd9b5..d8fa41f68f 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -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.
//
ParentRouteChart.Dword = 0;
- XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus);
+ Status = XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus);
+
+ //
+ // Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in PortChangeStatus
+ // when XhcPollPortStatusChange fails
+ //
+ if (EFI_ERROR (Status)) {
+ PortStatus->PortChangeStatus &= ~(USB_PORT_STAT_C_RESET);
+ Status = EFI_SUCCESS;
+ }
ON_EXIT:
gBS->RestoreTPL (OldTpl);