[edk2-devel] [PATCH 4/4] MdeModulePkg/UsbBusDxe: Adjust the MaxPacketLength to real world values

Wu, Hao A hao.a.wu at intel.com
Wed Dec 7 02:23:41 UTC 2022


I have concern for this patch.



It will make the implementation of XhcControlTransfer() no longer following the UEFI specification requirements on the EFI_USB2_HC_PROTOCOL.ControlTransfer() service:



Section 17.1.7 of UEFI spec Release 2.10:

EFI_INVALID_PARAMETER is returned if one of the following conditions is satisfied:

...

* MaximumPacketLength is not valid. If DeviceSpeed is EFI_USB_SPEED_LOW, then MaximumPacketLength

  must be 8. If DeviceSpeed is EFI_USB_SPEED_FULL or EFI_USB_SPEED_HIGH, then MaximumPac-

  ketLength must be 8, 16, 32, or 64. If DeviceSpeed is EFI_USB_SPEED_SUPER, then MaximumPacketLength

  must be 512.



My take is that it will need a UEFI spec update to integrate this proposed change.

Sorry Liming, could you help on the process of raising opens with regard to the UEFI specification? Thanks in advance.



Best Regards,

Hao Wu



> -----Original Message-----

> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Sean

> Rhodes

> Sent: Monday, December 5, 2022 5:18 PM

> To: devel at edk2.groups.io

> Cc: Rhodes, Sean <sean at starlabs.systems>; Wu, Hao A

> <hao.a.wu at intel.com>; Ni, Ray <ray.ni at intel.com>

> Subject: [edk2-devel] [PATCH 4/4] MdeModulePkg/UsbBusDxe: Adjust the

> MaxPacketLength to real world values

>

> Adjusts the requirements for the MaxPacketLength to match what is seen on

> real world devices that do not follow the USB specification.

>

> This fixes enumeration on the multiple USB 3 devices made by SanDisk,

> Integral, Kingston and other generic brands.

>

> Cc: Hao A Wu <hao.a.wu at intel.com<mailto:hao.a.wu at intel.com>>

> Cc: Ray Ni <ray.ni at intel.com<mailto:ray.ni at intel.com>>

> Signed-off-by: Sean Rhodes <sean at starlabs.systems<mailto:sean at starlabs.systems>>

> ---

>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ++++-------

>  1 file changed, 4 insertions(+), 7 deletions(-)

>

> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c

> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c

> index 62535cad54..043b7d4cea 100644

> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c

> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c

> @@ -906,19 +906,16 @@ XhcControlTransfer (

>      return EFI_INVALID_PARAMETER;

>

>    }

>

>

>

> -  if ((MaximumPacketLength != 8)  && (MaximumPacketLength != 16) &&

>

> -      (MaximumPacketLength != 32) && (MaximumPacketLength != 64) &&

>

> -      (MaximumPacketLength != 512)

>

> -      )

>

> -  {

>

> +  // Check for valid maximum packet size

>

> +  if ((DeviceSpeed == EFI_USB_SPEED_SUPER) && (MaximumPacketLength >

> 1024)) {

>

>      return EFI_INVALID_PARAMETER;

>

>    }

>

>

>

> -  if ((DeviceSpeed == EFI_USB_SPEED_LOW) && (MaximumPacketLength !=

> 8)) {

>

> +  if ((DeviceSpeed == EFI_USB_SPEED_HIGH) && (MaximumPacketLength >

> 512)) {

>

>      return EFI_INVALID_PARAMETER;

>

>    }

>

>

>

> -  if ((DeviceSpeed == EFI_USB_SPEED_SUPER) && (MaximumPacketLength !=

> 512)) {

>

> +  if ((DeviceSpeed == EFI_USB_SPEED_FULL) && (MaximumPacketLength >

> 64)) {

>

>      return EFI_INVALID_PARAMETER;

>

>    }

>

>

>

> --

> 2.37.2

>

>

>

> -=-=-=-=-=-=

> Groups.io Links: You receive all messages sent to this group.

> View/Reply Online (#96951): https://edk2.groups.io/g/devel/message/96951

> Mute This Topic: https://groups.io/mt/95465401/1768737

> Group Owner: devel+owner at edk2.groups.io<mailto:devel+owner at edk2.groups.io>

> Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu at intel.com]

> -=-=-=-=-=-=

>




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97060): https://edk2.groups.io/g/devel/message/97060
Mute This Topic: https://groups.io/mt/95465401/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20221207/6df9617e/attachment-0001.htm>


More information about the edk2-devel-archive mailing list