From: "zhoucheng" <zhoucheng@phytium.com.cn>
To: devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>
Subject: [PATCH v1 1/1] MdeModulePkg:Add Warm Reset for Xhc
Date: Thu, 3 Nov 2022 23:53:15 +0800 [thread overview]
Message-ID: <20221103155315.3764-2-zhoucheng@phytium.com.cn> (raw)
In-Reply-To: <20221103155315.3764-1-zhoucheng@phytium.com.cn>
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 <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Cheng Zhou <zhoucheng@phytium.com.cn>
---
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
next prev parent reply other threads:[~2022-11-03 15:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 15:53 [PATCH v1 0/1] MdeModulePkg:Add Warm Reset for Xhc zhoucheng
2022-11-03 15:53 ` zhoucheng [this message]
2022-11-03 18:28 ` [edk2-devel] [PATCH v1 1/1] " Pedro Falcato
2022-11-04 3:15 ` zhoucheng
2022-11-16 6:55 ` Wu, Hao A
2022-11-16 11:36 ` zhoucheng
2022-11-17 1:48 ` Wu, Hao A
2022-11-17 10:23 ` zhoucheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221103155315.3764-2-zhoucheng@phytium.com.cn \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox