Skip to content

Commit

Permalink
MdeModulePkg/Bus/Pci/XhciDxe: Reset port if status change returns an …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Sean-StarLabs authored and mergify[bot] committed Jan 4, 2023
1 parent 89c5d90 commit 992d545
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 992d545

Please sign in to comment.