From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zg8tmtm4lje5ny4xodqumjaa.icoremail.net (zg8tmtm4lje5ny4xodqumjaa.icoremail.net [138.197.184.20]) by mx.groups.io with SMTP id smtpd.web08.195.1667490804129862769 for ; Thu, 03 Nov 2022 08:53:25 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: phytium.com.cn, ip: 138.197.184.20, mailfrom: zhoucheng@phytium.com.cn) Received: from prodtpl.icoremail.net (unknown [10.12.1.20]) by hzbj-icmmx-2 (Coremail) with SMTP id AQAAfwC3HRfv42Njm1NlFQ--.9274S2; Thu, 03 Nov 2022 23:53:19 +0800 (CST) Received: from ubuntu.localdomain (unknown [113.246.28.250]) by mail (Coremail) with SMTP id AQAAfwD3w2Ts42Nj310CAA--.8243S3; Thu, 03 Nov 2022 23:53:18 +0800 (CST) From: "zhoucheng" To: devel@edk2.groups.io Cc: Liming Gao , Hao A Wu , Ray Ni Subject: [PATCH v1 1/1] MdeModulePkg:Add Warm Reset for Xhc Date: Thu, 3 Nov 2022 23:53:15 +0800 Message-Id: <20221103155315.3764-2-zhoucheng@phytium.com.cn> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221103155315.3764-1-zhoucheng@phytium.com.cn> References: <20221103155315.3764-1-zhoucheng@phytium.com.cn> X-CM-TRANSID: AQAAfwD3w2Ts42Nj310CAA--.8243S3 X-CM-SenderInfo: 52kr3upkhqwqxsk13x1xpou0fpof0/ Authentication-Results: hzbj-icmmx-2; spf=neutral smtp.mail=zhoucheng@ phytium.com.cn; X-Coremail-Antispam: 1Uk129KBjvJXoW7trW3AFWrKF48ZFyfWr4fuFg_yoW8XF45pF WrAryYgr48A3W3K347ArWUur1Fgw4vg3WrX3ZYqw4jya9Iqr9xXwnIyry5Ga17urW0ya4r uF1aqF9rWa4DGr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj DUYxn0WfASr-VFAU7a7-sFnT9fnUUIcSsGvfJ3UbIYCTnIWIevJa73UjIFyTuYvj4RJUUU UUUUU Description according to Chapter 7.5.2 of USB 3.2 spec protocol. When the Usb state machine is in Inactive, the software is required to perform a warm reset operation. Cc: Liming Gao Cc: Hao A Wu Cc: Ray Ni Signed-off-by: Cheng Zhou --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index c05431ff30ec..938c8e2e28f7 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -558,6 +558,20 @@ XhcSetRootHubPortFeature ( State |= XHC_PORTSC_RESET; XhcWriteOpReg (Xhc, Offset, State); XhcWaitOpRegBit (Xhc, Offset, XHC_PORTSC_PRC, TRUE, XHC_GENERIC_TIMEOUT); + + // + // Usb 3.2 spec 7.5.2 + // When the USB state machine is Inactive state, the device is abnormal. + // eSS.Inactive is a state where a link has failed Enhanced SuperSpeed operation.Software + // is required for warm reset intervention.This flag only applies to USB3 protocol ports. + // + State = XhcReadOpReg (Xhc, Offset); + if ((((State & 0x1e0) >> 5) == 6) && ((State & 3) == 0)) { + State |= 0x80000000; + XhcWriteOpReg (Xhc, Offset, State); + XhcWaitOpRegBit (Xhc, Offset, XHC_PORTSC_PRC, TRUE, XHC_GENERIC_TIMEOUT); + DEBUG ((DEBUG_INFO, "Warm Reset Successful! \n")); + } break; case EfiUsbPortPower: -- 2.17.1