From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smarthost01b.sbp.mail.zen.net.uk (smarthost01b.sbp.mail.zen.net.uk [212.23.1.3]) by mx.groups.io with SMTP id smtpd.web10.14245.1671610505705512715 for ; Wed, 21 Dec 2022 00:15:06 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=permerror, err=parse error for token &{10 18 sdn.klaviyomail.com}: permanent DNS error (domain: starlabs.systems, ip: 212.23.1.3, mailfrom: sean@starlabs.systems) Received: from [51.148.147.4] (helo=starbook..) by smarthost01b.sbp.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1p7uFj-0007DV-EG; Wed, 21 Dec 2022 08:15:03 +0000 From: "Sean Rhodes" To: devel@edk2.groups.io Cc: Sean Rhodes Subject: [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error Date: Wed, 21 Dec 2022 08:15:01 +0000 Message-Id: <68be875805735c1660336eadbde6253b6594f4f8.1671610501.git.sean@starlabs.systems> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Originating-smarthost01b-IP: [51.148.147.4] Feedback-ID: 51.148.147.4 Content-Transfer-Encoding: quoted-printable Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in PortC= hangeStatus when XhcPollPortStatusChange fails Signed-off-by: Sean Rhodes --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/Xhc= iDxe/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 hooki= ng Get_Port_Status request at control transfer for those hub.=0D //=0D ParentRouteChart.Dword =3D 0;=0D - XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus);= =0D + Status =3D XhcPollPortStatusChange (Xhc, ParentRouteChar= t, PortNumber, PortStatus);=0D +=0D + //=0D + // Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in= PortChangeStatus=0D + // when XhcPollPortStatusChange fails=0D + //=0D + if (EFI_ERROR (Status)) {=0D + PortStatus->PortChangeStatus &=3D ~(USB_PORT_STAT_C_RESET);=0D + Status =3D EFI_SUCCESS;=0D + }=0D =0D ON_EXIT:=0D gBS->RestoreTPL (OldTpl);=0D --=20 2.37.2