From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Rhodes, Sean" <sean@starlabs.systems>
Cc: "Ni, Ray" <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH 2/2] MdeModulePkg/UsbBusDxe: Reset the device on error
Date: Wed, 21 Sep 2022 05:31:01 +0000 [thread overview]
Message-ID: <DM6PR11MB40253EF7047B613B28EA165ECA4F9@DM6PR11MB4025.namprd11.prod.outlook.com> (raw)
In-Reply-To: <b35b1f5f37c413dab865884bfe76656825040f22.1663679653.git.sean@starlabs.systems>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean
> Rhodes
> Sent: Tuesday, September 20, 2022 9:14 PM
> To: devel@edk2.groups.io
> Cc: Rhodes, Sean <sean@starlabs.systems>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: [edk2-devel] [PATCH 2/2] MdeModulePkg/UsbBusDxe: Reset the
> device on error
>
> Try a port reset if GetPortStatus returns and error.
>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems>
> ---
> MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> index 7fc567898a..13112be2a5 100644
> --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> @@ -992,7 +992,9 @@ UsbEnumeratePort (
> // Now, new device connected, enumerate and configure the device
>
> //
>
> DEBUG ((DEBUG_INFO, "UsbEnumeratePort: new device connected at
> port %d\n", Port));
>
> - if (USB_BIT_IS_SET (PortState.PortChangeStatus,
> USB_PORT_STAT_C_RESET)) {
>
> + if (USB_BIT_IS_SET (PortState.PortChangeStatus,
> USB_PORT_STAT_C_RESET) &&
>
> + (Status != EFI_DEVICE_ERROR))
Sorry, I do not understand the purpose of the patch.
Looking into the current implementation of function UsbEnumeratePort(), if the execution flow reaches here, the local variable 'Status' must have a value of EFI_SUCCESS.
My take is that this check:
Status = HubApi->GetPortStatus (HubIf, Port, &PortState);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "UsbEnumeratePort: failed to get state of port %d\n", Port));
return Status;
}
will make the function return if the value of 'Status' does not equals to EFI_SUCCESS.
Did I miss something for the above understanding?
Best Regards,
Hao Wu
>
> + {
>
> Status = UsbEnumerateNewDev (HubIf, Port, FALSE);
>
> } else {
>
> Status = UsbEnumerateNewDev (HubIf, Port, TRUE);
>
> --
> 2.34.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#93990): https://edk2.groups.io/g/devel/message/93990
> Mute This Topic: https://groups.io/mt/93802899/1768737
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com]
> -=-=-=-=-=-=
>
next prev parent reply other threads:[~2022-09-21 5:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 13:14 [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid continuing on error path Sean Rhodes
2022-09-20 13:14 ` [PATCH 2/2] MdeModulePkg/UsbBusDxe: Reset the device on error Sean Rhodes
2022-09-21 5:31 ` Wu, Hao A [this message]
2022-09-21 5:30 ` [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid continuing on error path Wu, Hao A
2022-09-21 8:00 ` Sean Rhodes
2022-09-21 8:24 ` Wu, Hao A
2022-09-21 8:36 ` Sean Rhodes
2022-09-22 7:30 ` Wu, Hao A
2022-09-23 8:02 ` Sean Rhodes
2022-09-23 8:12 ` Wu, Hao A
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=DM6PR11MB40253EF7047B613B28EA165ECA4F9@DM6PR11MB4025.namprd11.prod.outlook.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