From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web10.68678.1669962347546633146 for ; Thu, 01 Dec 2022 22:25:47 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=KxxkkpzL; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: hao.a.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669962347; x=1701498347; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=pmJuEl5y/KTiF2d55JFCmce4y2D5x1w+R9VMlRryFR0=; b=KxxkkpzLrWCK4vWUqfHKuVXCV+meAv1xbeWWC27s7Q5WFw/Q/4V3U0X0 qB/1UW1eMBCPggtyyz/N5VKwCG7pTBAK3Y0rHeyaEeJwX2CXYqqtwDUk0 fgMWM7AdGeDfKDIJ1LkSD7cFcny8uwncPsVWpApklW68ZoH7yG4KC5wtB SWJbxxe5n331dC3IbaRcDKFBBwhRKcw4cUJKbJWao5OMuVknKZBUReg6l SzwL24244IkXBeuU3tpV/sSK1WxQnL59Y2FjGL9dXf0kzqKSC/w4CXs0a GUdk34VYD11Qkv4S14UQdHlXZHVHtzrlm67d0OvGapXZx5GNu+JZAE+JW w==; X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="380171776" X-IronPort-AV: E=Sophos;i="5.96,210,1665471600"; d="scan'208";a="380171776" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2022 22:25:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="733700256" X-IronPort-AV: E=Sophos;i="5.96,210,1665471600"; d="scan'208";a="733700256" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP; 01 Dec 2022 22:25:46 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 1 Dec 2022 22:25:46 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Thu, 1 Dec 2022 22:25:46 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.177) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Thu, 1 Dec 2022 22:25:46 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JbkLpToxpwqxMzHlZBV+JnZdOXu0UWlgBCQZtP7ai/ktP77BuZ/mcnKT0w/m2yWS5AtAILtCPdZGjWB7awauLSxc0IXw2FJLPXfHgetvHQQmxsKGN8E5LeDQ6L6MUXCGn7ACcbyxJS9QquSxBV0goJRssGEjicRlVrI/ieBPSVVNDuXjrNZTCbrXndH+JcYc0xzy5G/EOaorrNBh8WYEPuo/2blZCvTMInO4L5AlWr8Kz5c6HJqXXhTRLBQnCd0OE8OOVhSzB6axpav11HjWDaJhdmB/lXoFsx1sD0687swn2I5T2Din8femrI4Erjm4oqpcFo5k3QasD0A/smfUeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4Sdf49h08ohg0OUcBfx2LgFrQzAfJD5TvkbrTQp8cpQ=; b=RYZ0xeKebJboF1+t2JsLw36+LK0FDbkFxpJ+oL9ttF4diGeZI+6ELTeLsbuyWd9c+wNx6Wif5LaqTlqUn3OL8ZTR7uT2Jlr+LR+1BWuIF1er3MJ/TVL6V+ozmMTbj2Fbyx2H8ARl5KKRoVUHTtL606MIumN18tTZamLdtmqsQ5leOGXpXcV75PQr/7yYiDTK8MkliCVBeKk/NDZLtOyvJ4VUEXYtoUjNGSMVw32PjXFYGY2TzLDwWJP+Ndh2TEcYmTz/vYR9zlpZoXRpg13acx1X0AFpzuI15V1zK4QjFBvfq7OVmaWfrTM+7PJ4o4P945n9B/mv6G8Gk+zbM06/MQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB4025.namprd11.prod.outlook.com (2603:10b6:5:197::31) by BL1PR11MB5480.namprd11.prod.outlook.com (2603:10b6:208:314::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Fri, 2 Dec 2022 06:25:43 +0000 Received: from DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::6129:7158:18dd:761c]) by DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::6129:7158:18dd:761c%3]) with mapi id 15.20.5857.023; Fri, 2 Dec 2022 06:25:43 +0000 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "Rhodes, Sean" CC: Matt DeVillier , "Ni, Ray" Subject: Re: [edk2-devel] [PATCH 1/4] MdeModulePkg/XhciDxe/XhciReg: Handle incorrect PSIV indices Thread-Topic: [edk2-devel] [PATCH 1/4] MdeModulePkg/XhciDxe/XhciReg: Handle incorrect PSIV indices Thread-Index: AQHZBcL+nBwc6oS26kiBLWV3hBJHCK5aIfew Date: Fri, 2 Dec 2022 06:25:43 +0000 Message-ID: References: <0bd92ce8c58e964edacdb85a5d7c4f600aecbaa4.1669926273.git.sean@starlabs.systems> In-Reply-To: <0bd92ce8c58e964edacdb85a5d7c4f600aecbaa4.1669926273.git.sean@starlabs.systems> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR11MB4025:EE_|BL1PR11MB5480:EE_ x-ms-office365-filtering-correlation-id: 0058c7ca-1a05-463f-c431-08dad42e0a7c x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wXYmE0hqsqzGoxgOYSDx56haFYd2gTXCxI9K2I6yhdUeHIPpsfPCQfDgFKLx1EtQcR35WmVhZOIBjF5034IugfFM+CfsTEkkO3NBl6YuFtis9LdLraaJTb6dOph1+U8dKDmYMYTIVgnJqJCRuXXTCKmB8AlcST+QWQnjNzwKRQG7ihat+IcE6ZJcSQNSPxGf/Mt+gG6Jmw7Q+vyNX9M1YTqNAXN2R0OgxUHK+IU1dqyTx9Vgy71rJJa4dyO1TdUDRIUkpKjfCFp8xjqZtlGl/P2tcTQrGH4exh0QkcpMa2BPBIxaC4z0eE6mbhix+4//tH9+J35XQkbDH2xZpLVVKDbJSnIulg8PJoB+mSVUrlcYpajJz//6AecSMFbsglB65Bod+RpkGJBXsKPO+DK/amEEFlKKq6GghzxWTLI77m48akzV1R2y57NqCrKa0GfQflKgPnDGdN0AhhhJHknSHGyblgzwjCJOYItY62Icq31CCoTnnlgVeicpecpH/6CuniYsTVyzFn8Q1Cu2dl1sfUjhFPZ8hqzE1itIsEtSA0uhAP1dI4Nh74BNvtC1KrKJF+F6p9kqMFX1Fz16mNoByRA26IoKDVrR3TYpcG2Eb9XCralZEJV2UAVFP/nCi1ju3XdL6nJuSNty8LW0jBGlLPg0F5oWCsbjoxHBMta5uIIB5Nu10GsXqtebE0wQ0RTh/meOMbU+0N59uQuFfTmsa7A2hghdUA0ur66uQt4MhZzhDm3aGriTsou9xSWPIYJQt3tNLm8e8JOfwEDipAAB/Q== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4025.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(39860400002)(366004)(346002)(396003)(451199015)(55016003)(38070700005)(86362001)(122000001)(33656002)(110136005)(966005)(316002)(6506007)(5660300002)(82960400001)(8936002)(71200400001)(4326008)(8676002)(66946007)(64756008)(41300700001)(66476007)(478600001)(66446008)(76116006)(66556008)(52536014)(107886003)(83380400001)(38100700002)(2906002)(9686003)(26005)(53546011)(7696005)(186003)(54906003)(66899015);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?exvRs/9kesoB9I2TCkSzAaXUj6eR8vsRxD8mJZKZu2fsnlyC96yoeoFc1ml0?= =?us-ascii?Q?Oy8sc21f6/XF8Uf+dUSgYoRAxtjbl6dDce09plhnQ9Vuv2jlxOVlgK6I3g5b?= =?us-ascii?Q?H616b9edtAaQ1oN+uZs/pVjRZTJFEYXmhGGijme183d7UvskxN8HYS40tnM9?= =?us-ascii?Q?j3d7bwwUUFmwexwz/Xh1Xgq8Y6g9gny5u3HIdjw6TObaKeEGUggA57HsejrR?= =?us-ascii?Q?Mcj01bsviL+mMULvgaf8HPdMun4HrFXOm4piTzQq4DXWUNDlDC7V5SWZRmxe?= =?us-ascii?Q?XVjrVRBmrvT18aSDKmDx3HUAeZGD3Xs1Yup0xKNvGU4M3isMFzTCbeDq/svF?= =?us-ascii?Q?rTh0RBmVjO7ODvdlJg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wB?= =?us-ascii?Q?WifHKdzCk8wRUor4qDPmbHAj+a5cT5IShX7yULoQUSSzJbL4KZ/zXlfrI0Sz?= =?us-ascii?Q?MJAg9wcVncpbtlLphK8KGp9z4FaEfHYe6afpuxn/LDA5mBHYRe0G5lw0WYG8?= =?us-ascii?Q?MWxWtT2kT1z50VDVu+sgg3rucGGM0ngyX7OvYwz1QjXujKpaFAVF1KPAYRoS?= =?us-ascii?Q?IsrCTLzUclEf/1x3E7SB/eL21itN0+hOEN7G64n84i86eaxm2nmpFBO5cFx3?= =?us-ascii?Q?zsxKa6eFlz0DO7VNRdzlkhfP8z7M49fVwqc37ahs19XkDB7oLXNh56LvGLAF?= =?us-ascii?Q?WPaATgkZ6AW29y2nzuYluPKwV7I/733tM+NyZqex?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4025.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0058c7ca-1a05-463f-c431-08dad42e0a7c X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2022 06:25:43.5254 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4rPQ4q99HbUs76bZmF/iFTwXtRDnx/2FAQw7aRYS6li0zclWFjC7NzU0cbaFd16kl1TYqotkBpgUUJuFEYKu2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR11MB5480 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, I saw there are several CI check failures for this 4 patches: https://github.com/tianocore/edk2/pull/3702 Could you help to resolve them? Thanks. Best Regards, Hao Wu > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Sean > Rhodes > Sent: Friday, December 2, 2022 4:25 AM > To: devel@edk2.groups.io > Cc: Matt DeVillier ; Wu, Hao A > ; Ni, Ray ; Rhodes, Sean > > Subject: [edk2-devel] [PATCH 1/4] MdeModulePkg/XhciDxe/XhciReg: Handle > incorrect PSIV indices >=20 > From: Matt DeVillier >=20 > On some platforms, including Sky Lake and Kaby Lake, the PSIV (Protocol S= peed > ID Value) indicesare shared between Protocol Speed ID DWORD' in the > extended capabilities registers for both USB2 (Full Speed) and USB3 (Supe= r > Speed). >=20 > An example can be found below: >=20 > XhcCheckUsbPortSpeedUsedPsic: checking for USB2 ext caps > XhciPsivGetPsid: found 3 PSID entries > XhciPsivGetPsid: looking for port speed 1 > XhciPsivGetPsid: PSIV 1 PSIE 2 PLT 0 PSIM 12 > XhciPsivGetPsid: PSIV 2 PSIE 1 PLT 0 PSIM 1500 > XhciPsivGetPsid: PSIV 3 PSIE 2 PLT 0 PSIM 480 > XhcCheckUsbPortSpeedUsedPsic: checking for USB3 ext caps > XhciPsivGetPsid: found 3 PSID entries > XhciPsivGetPsid: looking for port speed 1 > XhciPsivGetPsid: PSIV 1 PSIE 3 PLT 0 PSIM 5 > XhciPsivGetPsid: PSIV 2 PSIE 3 PLT 0 PSIM 10 > XhciPsivGetPsid: PSIV 34 PSIE 2 PLT 0 PSIM 1248 >=20 > The result is edk2 detecting USB2 devices as USB3 devices, which conseque= ntly > causes enumeration to fail. >=20 > To avoid incorrect detection, check the extended capability registers for= USB2 > before USB3. If edk2 finds a match for a USB 2 device, don't check for US= B 3. >=20 > Cc: Hao A Wu > Cc: Ray Ni > Reviewed-by: Sean Rhodes > Signed-off-by: Matt DeVillier > Change-Id: I5bcf32105ce85fda95b4ba98a5e420e8f522374c > --- > MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 36 +++++++++++++++----------- > MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h | 1 + > 2 files changed, 22 insertions(+), 15 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > index 2b4a4b2444..c992323443 100644 > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > @@ -698,25 +698,11 @@ XhcCheckUsbPortSpeedUsedPsic ( > SpField.Dword =3D 0; UsbSpeedIdMap =3D 0; - //- // Check xHCI Supp= orted > Protocol Capability, find the PSIV field to match- // PortSpeed definiti= on when > the Major Revision is 03h.- //- if (Xhc->Usb3SupOffset !=3D 0xFFFFFFFF)= {- > SpField.Dword =3D XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed);- = if > (SpField.Dword !=3D 0) {- //- // Found the corresponding PORTSC= value in > PSIV field of USB3 offset.- //- UsbSpeedIdMap =3D > USB_PORT_STAT_SUPER_SPEED;- }- }- // // Check xHCI Supported Prot= ocol > Capability, find the PSIV field to match // PortSpeed definition when t= he Major > Revision is 02h. //- if ((UsbSpeedIdMap =3D=3D 0) && (Xhc->Usb2SupOffs= et !=3D > 0xFFFFFFFF)) {+ if (Xhc->Usb2SupOffset !=3D 0xFFFFFFFF) { SpField.Dw= ord =3D > XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset, PortSpeed); if (SpField.Dwo= rd !=3D 0) > { //@@ -733,6 +719,12 @@ XhcCheckUsbPortSpeedUsedPsic ( > // PSIM shows as default High-speed protocol, apply to High-sp= eed > mapping // UsbSpeedIdMap =3D > USB_PORT_STAT_HIGH_SPEED;+ } else if (SpField.Data.Psim =3D=3D > XHC_SUPPORTED_PROTOCOL_USB2_FULL_SPEED_PSIM) {+ //+ // > PSIM shows as default Full-speed protocol, return 0+ // to ensur= e no port > status set+ //+ return 0; } } else if (Sp= Field.Data.Psie =3D=3D 1) > { //@@ -750,6 +742,20 @@ XhcCheckUsbPortSpeedUsedPsic ( > } } + //+ // Check xHCI Supported Protocol Capability, find the = PSIV field to > match+ // PortSpeed definition when the Major Revision is 03h.+ //+ if > ((UsbSpeedIdMap =3D=3D 0) && (Xhc->Usb3SupOffset !=3D 0xFFFFFFFF)) {+ > SpField.Dword =3D XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed);+ = if > (SpField.Dword !=3D 0) {+ //+ // Found the corresponding PORTSC= value in > PSIV field of USB3 offset.+ //+ UsbSpeedIdMap =3D > USB_PORT_STAT_SUPER_SPEED;+ }+ }+ return UsbSpeedIdMap; } diff --gi= t > a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > index 5fe2ba4f0e..74ac6297ba 100644 > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > @@ -85,6 +85,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #define XHC_SUPPORTED_PROTOCOL_DW2_OFFSET 0x08 #define > XHC_SUPPORTED_PROTOCOL_PSI_OFFSET 0x10 #define > XHC_SUPPORTED_PROTOCOL_USB2_HIGH_SPEED_PSIM 480+#define > XHC_SUPPORTED_PROTOCOL_USB2_FULL_SPEED_PSIM 12 #define > XHC_SUPPORTED_PROTOCOL_USB2_LOW_SPEED_PSIM 1500 #pragma > pack (1)-- > 2.37.2 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#96843): https://edk2.groups.io/g/devel/message/96843 > Mute This Topic: https://groups.io/mt/95391831/1768737 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com] -= =3D-=3D- > =3D-=3D-=3D-=3D >=20