From: "Pedro Falcato" <pedro.falcato@gmail.com>
To: devel@edk2.groups.io, zhoucheng@phytium.com.cn
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH v1 1/1] MdeModulePkg:Add Warm Reset for Xhc
Date: Thu, 3 Nov 2022 18:28:18 +0000 [thread overview]
Message-ID: <CAKbZUD3LLw4UYZe7SVs2LVR8C7aqi-d0adHVQ+b3aC6jjv70ww@mail.gmail.com> (raw)
In-Reply-To: <20221103155315.3764-2-zhoucheng@phytium.com.cn>
[-- Attachment #1: Type: text/plain, Size: 1837 bytes --]
On Thu, Nov 3, 2022 at 3:53 PM zhoucheng <zhoucheng@phytium.com.cn> wrote:
> 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;
>
Please use defines for all of these magic values, it improves readability
so much.
> + 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
>
>
>
>
>
>
>
--
Pedro Falcato
[-- Attachment #2: Type: text/html, Size: 2865 bytes --]
next prev parent reply other threads:[~2022-11-03 18:28 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 ` [PATCH v1 1/1] " zhoucheng
2022-11-03 18:28 ` Pedro Falcato [this message]
2022-11-04 3:15 ` [edk2-devel] " 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=CAKbZUD3LLw4UYZe7SVs2LVR8C7aqi-d0adHVQ+b3aC6jjv70ww@mail.gmail.com \
--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