> -----Original Message-----
> From: [email protected] <[email protected]> On Behalf Of Sean
> Rhodes
> Sent: Tuesday, September 20, 2022 9:14 PM
> To: [email protected]
> Cc: Rhodes, Sean <[email protected]>; Wu, Hao A
> <[email protected]>; Ni, Ray <[email protected]>
> 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 <[email protected]>
> Cc: Ray Ni <[email protected]>
> Signed-off-by: Sean Rhodes <[email protected]>
> ---
> 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: [email protected]
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
> -=-=-=-=-=-=
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94045): https://edk2.groups.io/g/devel/message/94045
Mute This Topic: https://groups.io/mt/93802899/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-