public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure
@ 2020-10-23  1:26 Heng Luo
  2020-10-23  2:52 ` Wu, Hao A
  2020-10-23 12:46 ` Wu, Hao A
  0 siblings, 2 replies; 8+ messages in thread
From: Heng Luo @ 2020-10-23  1:26 UTC (permalink / raw)
  To: devel; +Cc: Ray Ni, Hao A Wu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3007

Currently UsbDevContext is not cleaned up if USB slot initialization is
failed, the wrong context data will affect next USB devices and
the USB devices can not be enumerated.
Need to disable slot if USB slot initialization is failed.

Below test cases are passed on UpXtreme:
a. USB 3.0 thumb drives can be recognized in UEFI shell
b. SUT can boot to Puppylinux  from USB3.0 mass storage,
 the storage can be recognized in linux
c. Plug in a USB  keyboard (hot plug) and enumeration is OK
 in UEFI shell and linux
d. Plug in a USB mouse(hot plug) and enumeration is OK in linux.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Heng Luo <heng.luo@intel.com>
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index 9cb115363c..00e9cc63d6 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -2,7 +2,7 @@
 
   XHCI transfer scheduling routines.
 
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR>
 Copyright (c) Microsoft Corporation.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -2279,6 +2279,9 @@ XhcInitializeDeviceSlot (
     DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)->Slot.DeviceAddress;
     DEBUG ((EFI_D_INFO, "    Address %d assigned successfully\n", DeviceAddress));
     Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
+  } else {
+    DEBUG ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));
+    XhcDisableSlotCmd (Xhc, SlotId);
   }
 
   return Status;
@@ -2489,7 +2492,11 @@ XhcInitializeDeviceSlot64 (
     DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)->Slot.DeviceAddress;
     DEBUG ((EFI_D_INFO, "    Address %d assigned successfully\n", DeviceAddress));
     Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
+  } else {
+    DEBUG ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));
+    XhcDisableSlotCmd64 (Xhc, SlotId);
   }
+
   return Status;
 }
 
-- 
2.24.0.windows.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure
  2020-10-23  1:26 [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure Heng Luo
@ 2020-10-23  2:52 ` Wu, Hao A
  2020-10-23  9:49   ` Jon Hunter
  2020-10-23 12:46 ` Wu, Hao A
  1 sibling, 1 reply; 8+ messages in thread
From: Wu, Hao A @ 2020-10-23  2:52 UTC (permalink / raw)
  To: Luo, Heng, devel@edk2.groups.io, Jon Hunter, jbrasen@nvidia.com; +Cc: Ni, Ray

Hello Jon,

Could you help to check of this version will co-work with your patch?
Thanks in advance.

Best Regards,
Hao Wu

> -----Original Message-----
> From: Luo, Heng <heng.luo@intel.com>
> Sent: Friday, October 23, 2020 9:26 AM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
> Subject: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot
> initialization failure
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3007
> 
> Currently UsbDevContext is not cleaned up if USB slot initialization is failed,
> the wrong context data will affect next USB devices and the USB devices can
> not be enumerated.
> Need to disable slot if USB slot initialization is failed.
> 
> Below test cases are passed on UpXtreme:
> a. USB 3.0 thumb drives can be recognized in UEFI shell b. SUT can boot to
> Puppylinux  from USB3.0 mass storage,  the storage can be recognized in
> linux c. Plug in a USB  keyboard (hot plug) and enumeration is OK  in UEFI
> shell and linux d. Plug in a USB mouse(hot plug) and enumeration is OK in
> linux.
> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Signed-off-by: Heng Luo <heng.luo@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> index 9cb115363c..00e9cc63d6 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> @@ -2,7 +2,7 @@
>     XHCI transfer scheduling routines. -Copyright (c) 2011 - 2018, Intel
> Corporation. All rights reserved.<BR>+Copyright (c) 2011 - 2020, Intel
> Corporation. All rights reserved.<BR> Copyright (c) Microsoft
> Corporation.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -2279,6
> +2279,9 @@ XhcInitializeDeviceSlot (
>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)-
> >Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
> successfully\n", DeviceAddress));     Xhc-
> >UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;+  } else {+    DEBUG
> ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));+
> XhcDisableSlotCmd (Xhc, SlotId);   }    return Status;@@ -2489,7 +2492,11 @@
> XhcInitializeDeviceSlot64 (
>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)-
> >Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
> successfully\n", DeviceAddress));     Xhc-
> >UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;+  } else {+    DEBUG
> ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));+
> XhcDisableSlotCmd64 (Xhc, SlotId);   }+   return Status; } --
> 2.24.0.windows.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure
  2020-10-23  2:52 ` Wu, Hao A
@ 2020-10-23  9:49   ` Jon Hunter
  2020-10-23 12:44     ` Wu, Hao A
  0 siblings, 1 reply; 8+ messages in thread
From: Jon Hunter @ 2020-10-23  9:49 UTC (permalink / raw)
  To: Wu, Hao A, Luo, Heng, devel@edk2.groups.io, jbrasen@nvidia.com; +Cc: Ni, Ray

Hi Hao,

Thanks. Yes this works with my patch. I will send out a V2 for my patch
shortly. For this patch you can add my ...

Tested-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>

Cheers
Jon

On 23/10/2020 03:52, Wu, Hao A wrote:
> Hello Jon,
> 
> Could you help to check of this version will co-work with your patch?
> Thanks in advance.
> 
> Best Regards,
> Hao Wu
> 
>> -----Original Message-----
>> From: Luo, Heng <heng.luo@intel.com>
>> Sent: Friday, October 23, 2020 9:26 AM
>> To: devel@edk2.groups.io
>> Cc: Ni, Ray <ray.ni@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
>> Subject: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot
>> initialization failure
>>
>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3007
>>
>> Currently UsbDevContext is not cleaned up if USB slot initialization is failed,
>> the wrong context data will affect next USB devices and the USB devices can
>> not be enumerated.
>> Need to disable slot if USB slot initialization is failed.
>>
>> Below test cases are passed on UpXtreme:
>> a. USB 3.0 thumb drives can be recognized in UEFI shell b. SUT can boot to
>> Puppylinux  from USB3.0 mass storage,  the storage can be recognized in
>> linux c. Plug in a USB  keyboard (hot plug) and enumeration is OK  in UEFI
>> shell and linux d. Plug in a USB mouse(hot plug) and enumeration is OK in
>> linux.
>>
>> Cc: Ray Ni <ray.ni@intel.com>
>> Cc: Hao A Wu <hao.a.wu@intel.com>
>> Signed-off-by: Heng Luo <heng.luo@intel.com>
>> ---
>>  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 9 ++++++++-
>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>> index 9cb115363c..00e9cc63d6 100644
>> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>> @@ -2,7 +2,7 @@
>>     XHCI transfer scheduling routines. -Copyright (c) 2011 - 2018, Intel
>> Corporation. All rights reserved.<BR>+Copyright (c) 2011 - 2020, Intel
>> Corporation. All rights reserved.<BR> Copyright (c) Microsoft
>> Corporation.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -2279,6
>> +2279,9 @@ XhcInitializeDeviceSlot (
>>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)-
>>> Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
>> successfully\n", DeviceAddress));     Xhc-
>>> UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;+  } else {+    DEBUG
>> ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));+
>> XhcDisableSlotCmd (Xhc, SlotId);   }    return Status;@@ -2489,7 +2492,11 @@
>> XhcInitializeDeviceSlot64 (
>>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)-
>>> Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
>> successfully\n", DeviceAddress));     Xhc-
>>> UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;+  } else {+    DEBUG
>> ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));+
>> XhcDisableSlotCmd64 (Xhc, SlotId);   }+   return Status; } --
>> 2.24.0.windows.2
> 

-- 
nvpublic

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure
  2020-10-23  9:49   ` Jon Hunter
@ 2020-10-23 12:44     ` Wu, Hao A
  2020-10-23 13:04       ` Jon Hunter
  0 siblings, 1 reply; 8+ messages in thread
From: Wu, Hao A @ 2020-10-23 12:44 UTC (permalink / raw)
  To: Jon Hunter, Luo, Heng, devel@edk2.groups.io, jbrasen@nvidia.com; +Cc: Ni, Ray

Hello Jon,

Thanks for the testing effort.
If you patch is not urgent, could you hold your v2 patch until I merge Heng's
patch into the codebase?

I will do it early next week and will inform you as soon as it is done.
Does it sound good to you? Sorry for the inconvenience.

Best Regards,
Hao Wu

> -----Original Message-----
> From: Jon Hunter <jonathanh@nvidia.com>
> Sent: Friday, October 23, 2020 5:50 PM
> To: Wu, Hao A <hao.a.wu@intel.com>; Luo, Heng <heng.luo@intel.com>;
> devel@edk2.groups.io; jbrasen@nvidia.com
> Cc: Ni, Ray <ray.ni@intel.com>
> Subject: Re: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot
> initialization failure
> 
> Hi Hao,
> 
> Thanks. Yes this works with my patch. I will send out a V2 for my patch shortly.
> For this patch you can add my ...
> 
> Tested-by: Jon Hunter <jonathanh@nvidia.com>
> Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
> 
> Cheers
> Jon
> 
> On 23/10/2020 03:52, Wu, Hao A wrote:
> > Hello Jon,
> >
> > Could you help to check of this version will co-work with your patch?
> > Thanks in advance.
> >
> > Best Regards,
> > Hao Wu
> >
> >> -----Original Message-----
> >> From: Luo, Heng <heng.luo@intel.com>
> >> Sent: Friday, October 23, 2020 9:26 AM
> >> To: devel@edk2.groups.io
> >> Cc: Ni, Ray <ray.ni@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
> >> Subject: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot
> >> initialization failure
> >>
> >> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3007
> >>
> >> Currently UsbDevContext is not cleaned up if USB slot initialization
> >> is failed, the wrong context data will affect next USB devices and
> >> the USB devices can not be enumerated.
> >> Need to disable slot if USB slot initialization is failed.
> >>
> >> Below test cases are passed on UpXtreme:
> >> a. USB 3.0 thumb drives can be recognized in UEFI shell b. SUT can
> >> boot to Puppylinux  from USB3.0 mass storage,  the storage can be
> >> recognized in linux c. Plug in a USB  keyboard (hot plug) and
> >> enumeration is OK  in UEFI shell and linux d. Plug in a USB mouse(hot
> >> plug) and enumeration is OK in linux.
> >>
> >> Cc: Ray Ni <ray.ni@intel.com>
> >> Cc: Hao A Wu <hao.a.wu@intel.com>
> >> Signed-off-by: Heng Luo <heng.luo@intel.com>
> >> ---
> >>  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 9 ++++++++-
> >>  1 file changed, 8 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> >> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> >> index 9cb115363c..00e9cc63d6 100644
> >> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> >> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> >> @@ -2,7 +2,7 @@
> >>     XHCI transfer scheduling routines. -Copyright (c) 2011 - 2018,
> >> Intel Corporation. All rights reserved.<BR>+Copyright (c) 2011 -
> >> 2020, Intel Corporation. All rights reserved.<BR> Copyright (c)
> >> Microsoft Corporation.<BR> SPDX-License-Identifier:
> >> BSD-2-Clause-Patent @@ -2279,6
> >> +2279,9 @@ XhcInitializeDeviceSlot (
> >>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)-
> >>> Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
> >> successfully\n", DeviceAddress));     Xhc-
> >>> UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;+  } else {+    DEBUG
> >> ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));+
> >> XhcDisableSlotCmd (Xhc, SlotId);   }    return Status;@@ -2489,7 +2492,11
> @@
> >> XhcInitializeDeviceSlot64 (
> >>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)-
> >>> Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
> >> successfully\n", DeviceAddress));     Xhc-
> >>> UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;+  } else {+    DEBUG
> >> ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));+
> >> XhcDisableSlotCmd64 (Xhc, SlotId);   }+   return Status; } --
> >> 2.24.0.windows.2
> >
> 
> --
> nvpublic

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure
  2020-10-23  1:26 [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure Heng Luo
  2020-10-23  2:52 ` Wu, Hao A
@ 2020-10-23 12:46 ` Wu, Hao A
  2020-10-27  1:15   ` [edk2-devel] " Wu, Hao A
  1 sibling, 1 reply; 8+ messages in thread
From: Wu, Hao A @ 2020-10-23 12:46 UTC (permalink / raw)
  To: Luo, Heng, devel@edk2.groups.io; +Cc: Ni, Ray

> -----Original Message-----
> From: Luo, Heng <heng.luo@intel.com>
> Sent: Friday, October 23, 2020 9:26 AM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
> Subject: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot
> initialization failure
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3007
> 
> Currently UsbDevContext is not cleaned up if USB slot initialization is failed, the
> wrong context data will affect next USB devices and the USB devices can not be
> enumerated.
> Need to disable slot if USB slot initialization is failed.
> 
> Below test cases are passed on UpXtreme:
> a. USB 3.0 thumb drives can be recognized in UEFI shell b. SUT can boot to
> Puppylinux  from USB3.0 mass storage,  the storage can be recognized in linux c.
> Plug in a USB  keyboard (hot plug) and enumeration is OK  in UEFI shell and linux
> d. Plug in a USB mouse(hot plug) and enumeration is OK in linux.


Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu


> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Signed-off-by: Heng Luo <heng.luo@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> index 9cb115363c..00e9cc63d6 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> @@ -2,7 +2,7 @@
>     XHCI transfer scheduling routines. -Copyright (c) 2011 - 2018, Intel
> Corporation. All rights reserved.<BR>+Copyright (c) 2011 - 2020, Intel
> Corporation. All rights reserved.<BR> Copyright (c) Microsoft Corporation.<BR>
> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -2279,6 +2279,9 @@
> XhcInitializeDeviceSlot (
>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)-
> >Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
> successfully\n", DeviceAddress));     Xhc->UsbDevContext[SlotId].XhciDevAddr =
> DeviceAddress;+  } else {+    DEBUG ((DEBUG_INFO, "    Address %d assigned
> unsuccessfully\n"));+    XhcDisableSlotCmd (Xhc, SlotId);   }    return Status;@@ -
> 2489,7 +2492,11 @@ XhcInitializeDeviceSlot64 (
>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)-
> >Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
> successfully\n", DeviceAddress));     Xhc->UsbDevContext[SlotId].XhciDevAddr =
> DeviceAddress;+  } else {+    DEBUG ((DEBUG_INFO, "    Address %d assigned
> unsuccessfully\n"));+    XhcDisableSlotCmd64 (Xhc, SlotId);   }+   return Status; } --
> 2.24.0.windows.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure
  2020-10-23 12:44     ` Wu, Hao A
@ 2020-10-23 13:04       ` Jon Hunter
  2020-10-27  1:15         ` Wu, Hao A
  0 siblings, 1 reply; 8+ messages in thread
From: Jon Hunter @ 2020-10-23 13:04 UTC (permalink / raw)
  To: Wu, Hao A, Luo, Heng, devel@edk2.groups.io, jbrasen@nvidia.com; +Cc: Ni, Ray

Hi Hao,

No problem, next week is fine.

Thanks
Jon

On 23/10/2020 13:44, Wu, Hao A wrote:
> Hello Jon,
> 
> Thanks for the testing effort.
> If you patch is not urgent, could you hold your v2 patch until I merge Heng's
> patch into the codebase?
> 
> I will do it early next week and will inform you as soon as it is done.
> Does it sound good to you? Sorry for the inconvenience.
> 
> Best Regards,
> Hao Wu
> 
>> -----Original Message-----
>> From: Jon Hunter <jonathanh@nvidia.com>
>> Sent: Friday, October 23, 2020 5:50 PM
>> To: Wu, Hao A <hao.a.wu@intel.com>; Luo, Heng <heng.luo@intel.com>;
>> devel@edk2.groups.io; jbrasen@nvidia.com
>> Cc: Ni, Ray <ray.ni@intel.com>
>> Subject: Re: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot
>> initialization failure
>>
>> Hi Hao,
>>
>> Thanks. Yes this works with my patch. I will send out a V2 for my patch shortly.
>> For this patch you can add my ...
>>
>> Tested-by: Jon Hunter <jonathanh@nvidia.com>
>> Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
>>
>> Cheers
>> Jon
>>
>> On 23/10/2020 03:52, Wu, Hao A wrote:
>>> Hello Jon,
>>>
>>> Could you help to check of this version will co-work with your patch?
>>> Thanks in advance.
>>>
>>> Best Regards,
>>> Hao Wu
>>>
>>>> -----Original Message-----
>>>> From: Luo, Heng <heng.luo@intel.com>
>>>> Sent: Friday, October 23, 2020 9:26 AM
>>>> To: devel@edk2.groups.io
>>>> Cc: Ni, Ray <ray.ni@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
>>>> Subject: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot
>>>> initialization failure
>>>>
>>>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3007
>>>>
>>>> Currently UsbDevContext is not cleaned up if USB slot initialization
>>>> is failed, the wrong context data will affect next USB devices and
>>>> the USB devices can not be enumerated.
>>>> Need to disable slot if USB slot initialization is failed.
>>>>
>>>> Below test cases are passed on UpXtreme:
>>>> a. USB 3.0 thumb drives can be recognized in UEFI shell b. SUT can
>>>> boot to Puppylinux  from USB3.0 mass storage,  the storage can be
>>>> recognized in linux c. Plug in a USB  keyboard (hot plug) and
>>>> enumeration is OK  in UEFI shell and linux d. Plug in a USB mouse(hot
>>>> plug) and enumeration is OK in linux.
>>>>
>>>> Cc: Ray Ni <ray.ni@intel.com>
>>>> Cc: Hao A Wu <hao.a.wu@intel.com>
>>>> Signed-off-by: Heng Luo <heng.luo@intel.com>
>>>> ---
>>>>  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 9 ++++++++-
>>>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>>>> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>>>> index 9cb115363c..00e9cc63d6 100644
>>>> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>>>> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>>>> @@ -2,7 +2,7 @@
>>>>     XHCI transfer scheduling routines. -Copyright (c) 2011 - 2018,
>>>> Intel Corporation. All rights reserved.<BR>+Copyright (c) 2011 -
>>>> 2020, Intel Corporation. All rights reserved.<BR> Copyright (c)
>>>> Microsoft Corporation.<BR> SPDX-License-Identifier:
>>>> BSD-2-Clause-Patent @@ -2279,6
>>>> +2279,9 @@ XhcInitializeDeviceSlot (
>>>>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)-
>>>>> Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
>>>> successfully\n", DeviceAddress));     Xhc-
>>>>> UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;+  } else {+    DEBUG
>>>> ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));+
>>>> XhcDisableSlotCmd (Xhc, SlotId);   }    return Status;@@ -2489,7 +2492,11
>> @@
>>>> XhcInitializeDeviceSlot64 (
>>>>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)-
>>>>> Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
>>>> successfully\n", DeviceAddress));     Xhc-
>>>>> UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;+  } else {+    DEBUG
>>>> ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));+
>>>> XhcDisableSlotCmd64 (Xhc, SlotId);   }+   return Status; } --
>>>> 2.24.0.windows.2
>>>
>>
>> --
>> nvpublic

-- 
nvpublic

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure
  2020-10-23 12:46 ` Wu, Hao A
@ 2020-10-27  1:15   ` Wu, Hao A
  0 siblings, 0 replies; 8+ messages in thread
From: Wu, Hao A @ 2020-10-27  1:15 UTC (permalink / raw)
  To: devel@edk2.groups.io, Wu, Hao A, Luo, Heng; +Cc: Ni, Ray

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao
> A
> Sent: Friday, October 23, 2020 8:46 PM
> To: Luo, Heng <heng.luo@intel.com>; devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>
> Subject: Re: [edk2-devel] [Patch V4] MdeModulePkg/XhciDxe: Error handle
> for USB slot initialization failure
> 
> > -----Original Message-----
> > From: Luo, Heng <heng.luo@intel.com>
> > Sent: Friday, October 23, 2020 9:26 AM
> > To: devel@edk2.groups.io
> > Cc: Ni, Ray <ray.ni@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
> > Subject: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot
> > initialization failure
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3007
> >
> > Currently UsbDevContext is not cleaned up if USB slot initialization
> > is failed, the wrong context data will affect next USB devices and the
> > USB devices can not be enumerated.
> > Need to disable slot if USB slot initialization is failed.
> >
> > Below test cases are passed on UpXtreme:
> > a. USB 3.0 thumb drives can be recognized in UEFI shell b. SUT can
> > boot to Puppylinux  from USB3.0 mass storage,  the storage can be
> recognized in linux c.
> > Plug in a USB  keyboard (hot plug) and enumeration is OK  in UEFI
> > shell and linux d. Plug in a USB mouse(hot plug) and enumeration is OK in
> linux.
> 
> 
> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>


Pushed via:
PR: https://github.com/tianocore/edk2/pull/1049
Commit: https://github.com/tianocore/edk2/commit/a3212009d95bbcba7d08076aba2eee51eb1f8e7c

Best Regards,
Hao Wu

> 
> Best Regards,
> Hao Wu
> 
> 
> >
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Signed-off-by: Heng Luo <heng.luo@intel.com>
> > ---
> >  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > index 9cb115363c..00e9cc63d6 100644
> > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > @@ -2,7 +2,7 @@
> >     XHCI transfer scheduling routines. -Copyright (c) 2011 - 2018,
> > Intel Corporation. All rights reserved.<BR>+Copyright (c) 2011 - 2020,
> > Intel Corporation. All rights reserved.<BR> Copyright (c) Microsoft
> > Corporation.<BR>
> > SPDX-License-Identifier: BSD-2-Clause-Patent @@ -2279,6 +2279,9 @@
> > XhcInitializeDeviceSlot (
> >      DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)-
> > >Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
> > successfully\n", DeviceAddress));     Xhc-
> >UsbDevContext[SlotId].XhciDevAddr =
> > DeviceAddress;+  } else {+    DEBUG ((DEBUG_INFO, "    Address %d
> assigned
> > unsuccessfully\n"));+    XhcDisableSlotCmd (Xhc, SlotId);   }    return
> Status;@@ -
> > 2489,7 +2492,11 @@ XhcInitializeDeviceSlot64 (
> >      DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)-
> > >Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
> > successfully\n", DeviceAddress));     Xhc-
> >UsbDevContext[SlotId].XhciDevAddr =
> > DeviceAddress;+  } else {+    DEBUG ((DEBUG_INFO, "    Address %d
> assigned
> > unsuccessfully\n"));+    XhcDisableSlotCmd64 (Xhc, SlotId);   }+   return
> Status; } --
> > 2.24.0.windows.2
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure
  2020-10-23 13:04       ` Jon Hunter
@ 2020-10-27  1:15         ` Wu, Hao A
  0 siblings, 0 replies; 8+ messages in thread
From: Wu, Hao A @ 2020-10-27  1:15 UTC (permalink / raw)
  To: Jon Hunter, devel@edk2.groups.io, jbrasen@nvidia.com; +Cc: Ni, Ray, Luo, Heng

Hello Jon,

I have merged Heng's patch into the edk2 repository.
Could you help to rebase your patch onto the latest codebase?

Thanks in advance.

Best Regards,
Hao Wu

> -----Original Message-----
> From: Jon Hunter <jonathanh@nvidia.com>
> Sent: Friday, October 23, 2020 9:04 PM
> To: Wu, Hao A <hao.a.wu@intel.com>; Luo, Heng <heng.luo@intel.com>;
> devel@edk2.groups.io; jbrasen@nvidia.com
> Cc: Ni, Ray <ray.ni@intel.com>
> Subject: Re: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot
> initialization failure
> 
> Hi Hao,
> 
> No problem, next week is fine.
> 
> Thanks
> Jon
> 
> On 23/10/2020 13:44, Wu, Hao A wrote:
> > Hello Jon,
> >
> > Thanks for the testing effort.
> > If you patch is not urgent, could you hold your v2 patch until I merge
> > Heng's patch into the codebase?
> >
> > I will do it early next week and will inform you as soon as it is done.
> > Does it sound good to you? Sorry for the inconvenience.
> >
> > Best Regards,
> > Hao Wu
> >
> >> -----Original Message-----
> >> From: Jon Hunter <jonathanh@nvidia.com>
> >> Sent: Friday, October 23, 2020 5:50 PM
> >> To: Wu, Hao A <hao.a.wu@intel.com>; Luo, Heng <heng.luo@intel.com>;
> >> devel@edk2.groups.io; jbrasen@nvidia.com
> >> Cc: Ni, Ray <ray.ni@intel.com>
> >> Subject: Re: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB
> >> slot initialization failure
> >>
> >> Hi Hao,
> >>
> >> Thanks. Yes this works with my patch. I will send out a V2 for my patch
> shortly.
> >> For this patch you can add my ...
> >>
> >> Tested-by: Jon Hunter <jonathanh@nvidia.com>
> >> Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
> >>
> >> Cheers
> >> Jon
> >>
> >> On 23/10/2020 03:52, Wu, Hao A wrote:
> >>> Hello Jon,
> >>>
> >>> Could you help to check of this version will co-work with your patch?
> >>> Thanks in advance.
> >>>
> >>> Best Regards,
> >>> Hao Wu
> >>>
> >>>> -----Original Message-----
> >>>> From: Luo, Heng <heng.luo@intel.com>
> >>>> Sent: Friday, October 23, 2020 9:26 AM
> >>>> To: devel@edk2.groups.io
> >>>> Cc: Ni, Ray <ray.ni@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
> >>>> Subject: [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot
> >>>> initialization failure
> >>>>
> >>>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3007
> >>>>
> >>>> Currently UsbDevContext is not cleaned up if USB slot
> >>>> initialization is failed, the wrong context data will affect next
> >>>> USB devices and the USB devices can not be enumerated.
> >>>> Need to disable slot if USB slot initialization is failed.
> >>>>
> >>>> Below test cases are passed on UpXtreme:
> >>>> a. USB 3.0 thumb drives can be recognized in UEFI shell b. SUT can
> >>>> boot to Puppylinux  from USB3.0 mass storage,  the storage can be
> >>>> recognized in linux c. Plug in a USB  keyboard (hot plug) and
> >>>> enumeration is OK  in UEFI shell and linux d. Plug in a USB
> >>>> mouse(hot
> >>>> plug) and enumeration is OK in linux.
> >>>>
> >>>> Cc: Ray Ni <ray.ni@intel.com>
> >>>> Cc: Hao A Wu <hao.a.wu@intel.com>
> >>>> Signed-off-by: Heng Luo <heng.luo@intel.com>
> >>>> ---
> >>>>  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 9 ++++++++-
> >>>>  1 file changed, 8 insertions(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> >>>> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> >>>> index 9cb115363c..00e9cc63d6 100644
> >>>> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> >>>> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> >>>> @@ -2,7 +2,7 @@
> >>>>     XHCI transfer scheduling routines. -Copyright (c) 2011 - 2018,
> >>>> Intel Corporation. All rights reserved.<BR>+Copyright (c) 2011 -
> >>>> 2020, Intel Corporation. All rights reserved.<BR> Copyright (c)
> >>>> Microsoft Corporation.<BR> SPDX-License-Identifier:
> >>>> BSD-2-Clause-Patent @@ -2279,6
> >>>> +2279,9 @@ XhcInitializeDeviceSlot (
> >>>>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)-
> >>>>> Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
> >>>> successfully\n", DeviceAddress));     Xhc-
> >>>>> UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;+  } else {+
> DEBUG
> >>>> ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));+
> >>>> XhcDisableSlotCmd (Xhc, SlotId);   }    return Status;@@ -2489,7
> +2492,11
> >> @@
> >>>> XhcInitializeDeviceSlot64 (
> >>>>      DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)-
> >>>>> Slot.DeviceAddress;     DEBUG ((EFI_D_INFO, "    Address %d assigned
> >>>> successfully\n", DeviceAddress));     Xhc-
> >>>>> UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;+  } else {+
> DEBUG
> >>>> ((DEBUG_INFO, "    Address %d assigned unsuccessfully\n"));+
> >>>> XhcDisableSlotCmd64 (Xhc, SlotId);   }+   return Status; } --
> >>>> 2.24.0.windows.2
> >>>
> >>
> >> --
> >> nvpublic
> 
> --
> nvpublic

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-27  1:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-23  1:26 [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure Heng Luo
2020-10-23  2:52 ` Wu, Hao A
2020-10-23  9:49   ` Jon Hunter
2020-10-23 12:44     ` Wu, Hao A
2020-10-23 13:04       ` Jon Hunter
2020-10-27  1:15         ` Wu, Hao A
2020-10-23 12:46 ` Wu, Hao A
2020-10-27  1:15   ` [edk2-devel] " Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox