public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sean Rhodes" <sean@starlabs.systems>
To: devel@edk2.groups.io
Cc: Sean Rhodes <sean@starlabs.systems>,
	Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>
Subject: [PATCH 2/2] MdeModulePkg/UsbBusDxe: Reset the device on error
Date: Tue, 20 Sep 2022 14:14:13 +0100	[thread overview]
Message-ID: <b35b1f5f37c413dab865884bfe76656825040f22.1663679653.git.sean@starlabs.systems> (raw)
In-Reply-To: <d9791d9c524d004d008f4f1bd86c20374201bd89.1663679653.git.sean@starlabs.systems>

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))
+    {
       Status = UsbEnumerateNewDev (HubIf, Port, FALSE);
     } else {
       Status = UsbEnumerateNewDev (HubIf, Port, TRUE);
-- 
2.34.1


  reply	other threads:[~2022-09-20 13:14 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 ` Sean Rhodes [this message]
2022-09-21  5:31   ` [edk2-devel] [PATCH 2/2] MdeModulePkg/UsbBusDxe: Reset the device on error Wu, Hao A
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=b35b1f5f37c413dab865884bfe76656825040f22.1663679653.git.sean@starlabs.systems \
    --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