From nobody Tue Apr 30 11:10:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+97683+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+97683+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1671610508; cv=none; d=zohomail.com; s=zohoarc; b=gsbJFdyr8w3UURAes+dgLODgqW/BWdnYze//wv0u/QxWJzXslmgpi9K7MHcM1O4xTRPBmslbKaPXNDn4od3tQGj/mPX/wHdu01gMv63CHkDNiBcRMI3wGD5t6dFYBMZJq8aUUJR2e6xcDGrCVUZtacmlGrdUAxXwIxxPWN0KGrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671610508; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=3BvCP9Ze9ADTSSScNdK5BMZm1iUL0X0oL/I5VdL4z+A=; b=ITunX0bczcWk+pigcE1sZ79rLes8IPWIM06W2Y7NGAsF/oQ7frpxWgzNKcDBuWvDM08e7TCuhIB5IZDoX6Dtq6d/q+Wl5mXYtgzCwlcGWxE3Kn7jWw/3mMr7nQZ36X5L7z6XwcyB3qiod3WlB0OFU+96XfdI/wu5vsKcmhnBnM0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+97683+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1671610507930145.39064998477488; Wed, 21 Dec 2022 00:15:07 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id E3VNYY1788612xvff33Hhc3b; Wed, 21 Dec 2022 00:15:07 -0800 X-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 X-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: [edk2-devel] [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> MIME-Version: 1.0 X-Originating-smarthost01b-IP: [51.148.147.4] Feedback-ID: 51.148.147.4 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sean@starlabs.systems X-Gm-Message-State: wFUfbhKRTgXudnIHl0odu0uqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1671610507; bh=70RUiOhrhU5azw3ffNNdE/hl0TOB8JrrfrRptlS8CCA=; h=Cc:Date:From:Reply-To:Subject:To; b=R9J+ijCHOwRNxK2olagtyGF3P+xcUiina8TNKxtYFoFpB+cbyFSmrlW1moTLIuX8DFg ieXL5jr7KQnGgCPXvE7cGt7eDQNUa5JuBsDcKTLbgwUZONsn2rBjdaP3u6GU8E5yvYHqe szf2jXpgLtl2PUKD+Nvfg2dbdsYzapCD1hk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1671610509757100002 Content-Type: text/plain; charset="utf-8" Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in PortC= hangeStatus when XhcPollPortStatusChange fails Signed-off-by: Sean Rhodes Reviewed-by: Hao A Wu > Reviewed-by: Hao A Wu --- 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. // ParentRouteChart.Dword =3D 0; - XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus); + Status =3D XhcPollPortStatusChange (Xhc, ParentRouteChar= t, 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 &=3D ~(USB_PORT_STAT_C_RESET); + Status =3D EFI_SUCCESS; + } =20 ON_EXIT: gBS->RestoreTPL (OldTpl); --=20 2.37.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#97683): https://edk2.groups.io/g/devel/message/97683 Mute This Topic: https://groups.io/mt/95802798/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-