From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by mx.groups.io with SMTP id smtpd.web11.11191.1670231957373534978 for ; Mon, 05 Dec 2022 01:19:17 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@starlabs-systems.20210112.gappssmtp.com header.s=20210112 header.b=Hnbknlmo; spf=pass (domain: starlabs.systems, ip: 209.85.215.173, mailfrom: sean@starlabs.systems) Received: by mail-pg1-f173.google.com with SMTP id f9so9956753pgf.7 for ; Mon, 05 Dec 2022 01:19:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starlabs-systems.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+pHumf/yyI0khkWAxBmiESOr29rCRGvBQFXTu0VDOOI=; b=HnbknlmoTKmfPVad5mEe070ZDrPD8bGxEgtpy6RlPBDrJqY6STyH3X3B4L0Elmrq0I jDDkRKt8i8joHbxRMf1zWyaGlCR/ZoMdT+H0yOKMDqB3AsZK8FLgjtQPP7GrUmmUWkh0 eJJ6EoxQyeNTCUNFUM18alKHkWbVw0ckip0YfmvjcQoj3f2bCkAXmSBiQBfBfBAp53rH 0CmxscosRr8ffGBZgFs88KG9Oo22FSkxYxM5F5abk6a9lQkW6D0t3f5qZH6H9IfxofWJ kiwLEl7pCyW2AVNqSf3Z5aTAW28Lw769CQi+X5G5q06WFmUb0k78K4MkJ40hiP5zfThc timw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+pHumf/yyI0khkWAxBmiESOr29rCRGvBQFXTu0VDOOI=; b=X6f7T1HKu58gwo5FA90mjQs498OiMdzaM8+dkfSEzARaD3+LmoYNyTBkHvkOgeBq9r JgcHiXw7j28nKTXnIMM+8k2wBwGnqFk7Bf1IFYcmMLceEM6d6/1uPK6rhtDA3Wzw3ko6 1QQ2NBYlMd5zzthtNSCVlUoRd6jTAV/UYWtW8pMiHkwaEdu1qQ9ZBkqMpCQsnI98nnFU 4w+R1FQj8u6CVOQMbOuAldzNdaeqzkhI/AgO1wN3r6VDcLAACdnvanJw4I/ezS8P7Gjg X+mR9a9/tM2TLKNH0P/dIbQbk4fCBWuygBF/omCpgSLnjIhCAB/Fi9W6x3E6/muFRriG 6+VA== X-Gm-Message-State: ANoB5pmWSwHoZxGMnXqEkx7OeiKGAR/ahiicoXHsMLg5qqe2TeIgjZfv 9hBRBFENhJz6sKQI43DeeFj5cQQnDGU+wwsMBzYtim2xn3lDr6o= X-Google-Smtp-Source: AA0mqf5oFGheQF2awhEigZpP+nqdVDjPvI1ik5x53gDyg3jAFjBhGBVzCS1tqsn6g1KJuKrQpmKA89xvqhVkDv9hdio= X-Received: by 2002:a65:4948:0:b0:46e:be03:d9b5 with SMTP id q8-20020a654948000000b0046ebe03d9b5mr54372636pgs.495.1670231956368; Mon, 05 Dec 2022 01:19:16 -0800 (PST) MIME-Version: 1.0 References: <172DDB13FC08F1B6.13790@groups.io> In-Reply-To: <172DDB13FC08F1B6.13790@groups.io> From: "Sean Rhodes" Date: Mon, 5 Dec 2022 09:19:05 +0000 Message-ID: Subject: Re: [edk2-devel] [PATCH 4/4] MdeModulePkg/UsbBusDxe: Adjust the MaxPacketLength to real world values To: devel@edk2.groups.io, sean@starlabs.systems Cc: Hao A Wu , Ray Ni Content-Type: multipart/alternative; boundary="00000000000073cdba05ef112e01" --00000000000073cdba05ef112e01 Content-Type: text/plain; charset="UTF-8" Link to PR passing CI - https://github.com/tianocore/edk2/pull/3353 On Mon, 5 Dec 2022 at 09:18, Sean Rhodes via groups.io wrote: > 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 > Cc: Ray Ni > Signed-off-by: Sean Rhodes > --- > 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/6718866 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [sean@starlabs.systems] > ------------ > > > --00000000000073cdba05ef112e01 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Link to PR passing CI -=C2=A0https://github.com/tianocore/edk2/pull/3353<= /div>

On Mon, 5 Dec 2022 at 09:18, Sean Rhodes via groups.io <sean=3D= starlabs.systems@groups.io> wrote:
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 <ha= o.a.wu@intel.com>
Cc: Ray Ni <ray.ni= @intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
---
=C2=A0MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ++++-------
=C2=A01 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/Xhc= iDxe/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 (
=C2=A0 =C2=A0 =C2=A0return EFI_INVALID_PARAMETER;
=C2=A0 =C2=A0}

-=C2=A0 if ((MaximumPacketLength !=3D 8)=C2=A0 && (MaximumPacketLen= gth !=3D 16) &&
-=C2=A0 =C2=A0 =C2=A0 (MaximumPacketLength !=3D 32) && (MaximumPack= etLength !=3D 64) &&
-=C2=A0 =C2=A0 =C2=A0 (MaximumPacketLength !=3D 512)
-=C2=A0 =C2=A0 =C2=A0 )
-=C2=A0 {
+=C2=A0 // Check for valid maximum packet size
+=C2=A0 if ((DeviceSpeed =3D=3D EFI_USB_SPEED_SUPER) && (MaximumPac= ketLength > 1024)) {
=C2=A0 =C2=A0 =C2=A0return EFI_INVALID_PARAMETER;
=C2=A0 =C2=A0}

-=C2=A0 if ((DeviceSpeed =3D=3D EFI_USB_SPEED_LOW) && (MaximumPacke= tLength !=3D 8)) {
+=C2=A0 if ((DeviceSpeed =3D=3D EFI_USB_SPEED_HIGH) && (MaximumPack= etLength > 512)) {
=C2=A0 =C2=A0 =C2=A0return EFI_INVALID_PARAMETER;
=C2=A0 =C2=A0}

-=C2=A0 if ((DeviceSpeed =3D=3D EFI_USB_SPEED_SUPER) && (MaximumPac= ketLength !=3D 512)) {
+=C2=A0 if ((DeviceSpeed =3D=3D EFI_USB_SPEED_FULL) && (MaximumPack= etLength > 64)) {
=C2=A0 =C2=A0 =C2=A0return EFI_INVALID_PARAMETER;
=C2=A0 =C2=A0}

--
2.37.2



------------
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96951): https://edk2.groups.io/g/dev= el/message/96951
Mute This Topic: https://groups.io/mt/95465401/6718866
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [sean@star= labs.systems]
------------


--00000000000073cdba05ef112e01--