From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail03.groups.io (mail03.groups.io [45.79.227.220]) by spool.mail.gandi.net (Postfix) with ESMTPS id 60EF8AC026A for ; Fri, 12 Apr 2024 01:54:24 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ujv6TVw5v1cGN14Y0fWEFLP4IcMYXDA0vyLpApY8NAc=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type; s=20240206; t=1712886863; v=1; b=RA5aM1aqK2rw2YN5fWObEgWVXeiCrWjvGVQ8wTvu6hmu45/09/l5SzQ9EZV1jvxh5CCGyuer 5xW3STAyO/Qi4MvKNyfPxfoShZWuV60eIspuqroMHUS5voZVdjandZ38jUuTSr9M1B+npDxKCWB JGZEcCbaRNCNUqVNu1c3REyjR19tBGqHV9egU14vK6eM/mB7uwwmBFHW01sLKykoDBXuCAZxdO+ J44ISBEzBbOxuh3QlzX5DFO5K/hJZRe/wr36Zn26x6tleFVYF7c5uj0Jd4anTd6CBreEVgKxwJs RINPaUoSKuz6MObynYWEsRuO9YpmoTM55a2oM1qBucPLA== X-Received: by 127.0.0.2 with SMTP id Ccc0YY7687511xVgIQGOtloU; Thu, 11 Apr 2024 18:54:23 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mx.groups.io with SMTP id smtpd.web11.37057.1712886857476657483 for ; Thu, 11 Apr 2024 18:54:17 -0700 X-CSE-ConnectionGUID: iIFe83VqSAOzA6t/k4KcWw== X-CSE-MsgGUID: D1uIRZQmS16U2cnb6c+CVA== X-IronPort-AV: E=McAfee;i="6600,9927,11041"; a="19723947" X-IronPort-AV: E=Sophos;i="6.07,194,1708416000"; d="scan'208,217";a="19723947" X-Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2024 18:54:17 -0700 X-CSE-ConnectionGUID: wCZcKJb2SZanTwZ8YYi+6w== X-CSE-MsgGUID: FOfbgyH3RoGo2VLDbpbdzw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,194,1708416000"; d="scan'208,217";a="21134527" X-Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmviesa006.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Apr 2024 18:54:17 -0700 X-Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 11 Apr 2024 18:54:16 -0700 X-Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Thu, 11 Apr 2024 18:54:16 -0700 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 11 Apr 2024 18:54:16 -0700 X-Received: from MN0PR11MB6034.namprd11.prod.outlook.com (2603:10b6:208:375::17) by SJ2PR11MB8449.namprd11.prod.outlook.com (2603:10b6:a03:56f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.27; Fri, 12 Apr 2024 01:54:14 +0000 X-Received: from MN0PR11MB6034.namprd11.prod.outlook.com ([fe80::f91f:3355:add2:3216]) by MN0PR11MB6034.namprd11.prod.outlook.com ([fe80::f91f:3355:add2:3216%3]) with mapi id 15.20.7452.019; Fri, 12 Apr 2024 01:54:14 +0000 From: "Xianglei Cai" To: "Lewandowski, Krzysztof" , "devel@edk2.groups.io" , "Ni, Ray" , Liming Gao CC: "Huang, Jenny" , "Shih, More" , "Chiu, Ian" Subject: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST Thread-Topic: [PATCH 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST Thread-Index: AQHaf/O1pD5wIQYWGEWx/GU24iM/NrFhlkgAgAJiRXA= Date: Fri, 12 Apr 2024 01:54:14 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-Mentions: ray.ni@intel.com,gaoliming@byosoft.com.cn X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN0PR11MB6034:EE_|SJ2PR11MB8449:EE_ x-ms-office365-filtering-correlation-id: 8fe85f39-90ad-46c1-fa34-08dc5a9374d0 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: 0MnpMt0XO1LHzIMXQMS2eer4mTXAVUiw+6SoYm+9IWyeqeccVAMbqdgkZIp1ktD82R+6og4oTFEaloJfzLl6skC7/LNqQNaOD1NHm9hboSkea1SEFX/PKpqoPzS5tuIi8ghrhUD/r9vEFQjUTBd71WbCgiYLeLQU7hApasHfcQ1AXDHyjqrzYG8EvuqBXN29gnQ7tRcQYdNX27Sum+cNUOrqzTz+xnyUhnsvKQ7itEgyDpv8HiGIMNeBzL2Gymbee/bGvBM2xVlHGH1RoSwBUrwGNU4+O2olfY+wjLxshjQN3lkgiaXwnBmAkWgK4eugEHX1p1PgoS1E/qJMhcOFcoj1slX+fsVmCn2YWPQV6/3a9nGL2scFKMkKtWeuwQIHGWkTp93OpPzND1JGaaW4GxntcAfibLkU4XuD116nzDVj8zspIsADOWcZEdI0Di5sM2orfyJnbryJhjUSekmKLHQ+sor8zmvMlKc5W9dnIDhqFbHUxPL5KCYuLa3MgPdmN0a8ralQv0fe+ytIczwWVOwjwP8Se8aGpknA1Swvax4pG51aVTsas6AgvyhUgL1qoybYYHK9SU+qzQx9pXIeGNsrm8wCaHvpn/3eZmD2MJP0wJX9iOJ+RfoAd8b9fw/7wC2L8gtWnuv6kvF3iCkXxACGJx6CmbWacwc3mpaV5CM= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?zWx5E2GRmEbbMEfDRy2l9pNuBoQD6fXcg0NxVEiT3Y49d/hUXrCypfywzIWG?= =?us-ascii?Q?5l8S/XVoySUfKkwdU+Ua5DCxexbvO3zXJMBam8MNo3uFWPsVE/U2DOtCT3hC?= =?us-ascii?Q?Pa5TVOajPVx0urZQVCASHwIhbDN3cqDxO8G4yD+3pKMUQpMiv2jumtj+ArRa?= =?us-ascii?Q?KJdrhNwqNLlxEUi9cfsOiG9S3twYbrQmfXxRk25dD9t9gw9zWI1cQoBhCSht?= =?us-ascii?Q?sySey8+8KreeVyD7eG6joMxvjqAXt5FmoTZK2nEtAVfEiLfYXCPMajgK3qax?= =?us-ascii?Q?QCixpBwSUWMQxX69L7myiKl9TuDJEejBlRfVjTxxIAMignRZQ2mpecB/bsxf?= =?us-ascii?Q?Li/OKWT4HuUgcFfKjwAaC3wMrwOEfVYQadOLCAMXbpIwj0lH/5PVXKG6e9yk?= =?us-ascii?Q?AWrQWQ3zWWso7i8XNt0oA1Dx9mtev64UOkQo+OF/cR9SWFDlCv6wlIJzx7wv?= =?us-ascii?Q?dhxcXEwHq53KjcCSBT5ecg1nk2pqVtsbNuWrlx9MAXRbqn7xP1y4bDUMzPgh?= =?us-ascii?Q?3OwNdcJTBz0VVJT5vsQg/n1JAEyb5+W2IX0Y5I3S84DdTgO4mOJQ53kMqKrF?= =?us-ascii?Q?1Bt6jngaSTmlaHSgjPijJE/PqLVtgEZMCnU1/YVctwVzWxy4XKO6YGQYLgeZ?= =?us-ascii?Q?NLifPhT5WL8chlJ0eVBSd0SU9LY2Q4+cdHkgUVKqfKfuvB8bsFDUhp0ilm8w?= =?us-ascii?Q?0CRr2iTGuEYtfUCO1q8uERHx8Os9WYsOIWIT2pLfbwP5fUdISOsWQP33Iixw?= =?us-ascii?Q?xqmAfKhF9mqaEe6pQWELwWVRp2TLEERQ/TgZHa4Sv107m9gW6wyU2T1kyz7V?= =?us-ascii?Q?7FWuGVqL+CtLPuEC3+npw64vP2x5YoEQcWTarEMf3Xh5sxjb+85WdPo7w9lZ?= =?us-ascii?Q?JQRR7Cjaf31StN+vYh3v1A08mXmzVfwZ3qq1ONn4YQtgAJSeg1jIrYU8LWTR?= =?us-ascii?Q?EZOvJn0vh55qkv5+JU8TWinNonVYo3GzCR9dmEOS3NvR8VSDutcFoOtvt4ID?= =?us-ascii?Q?OZsHSWRLvkEx/M7S4cNbaVN+GC5KIU9Ep9Oa1isvbJ6ZvsJ19P573iugtHQf?= =?us-ascii?Q?R8D/QdahL8HVczhuJu2OFPmN1SLlGz5vf4uMdrfznRY8YGvSU4thwuIEHkqb?= =?us-ascii?Q?u7hEl0KreZePw6UacOx5WW6MDSuk+e+WsEsW7+M+DJuTaNZ3Vmyo5iePZXpu?= =?us-ascii?Q?drILVvj/o0jyf0WoDK/QS66Dek7heNLlYO8QccCJjQ+gFS4b0QF8AEREUQ8H?= =?us-ascii?Q?W8Vp6eodZ625WmQcVwJPHtPh+Eh+m8GKEZ5s2tt8gywIA+xpfZ+f0ZN0KzdX?= =?us-ascii?Q?NcutBt8bc1odVSWH/Ap9z3It3KzrKMAQbfrTxKf3u6z/1J0QeGuggsrct+5S?= =?us-ascii?Q?8bDO4mxu/kJgfbH2SgdD91XmkwlJ/dIhB06l8uWxa8wTaprWrj+m+qU9XY8p?= =?us-ascii?Q?iQfyJ+51YprXaF0oQa93B3Tl+uatFiq1oZR0oKbqOJ7Bmi8kDkse4HeR/OoL?= =?us-ascii?Q?XzytJuGDYHz3xwkEtA8XlL/2G/3C9izb4O+Y2KrtQF7TCdtm01LZxkioN8uf?= =?us-ascii?Q?lCJV19OgPXWhzWzTm8Eo0cuPOiHQF9zR2BMBy6NC?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6034.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8fe85f39-90ad-46c1-fa34-08dc5a9374d0 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2024 01:54:14.5924 (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: FhNrGwmcvw6VBZhq5fm2OqcXc+2/Ipnllr/hSot/ZjFIbDQsyIopbd7cqOfF9FY0nNtFg3leaRIgm25VLdiZVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB8449 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Thu, 11 Apr 2024 18:54:17 -0700 Resent-From: xianglei.cai@intel.com Reply-To: devel@edk2.groups.io,xianglei.cai@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: hZNojdX0q9otUxR0yWkpWlyFx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MN0PR11MB60344044A926EF89E6E2CDF393042MN0PR11MB6034namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=RA5aM1aq; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.227.220 as permitted sender) smtp.mailfrom=bounce@groups.io --_000_MN0PR11MB60344044A926EF89E6E2CDF393042MN0PR11MB6034namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable @Liming Gao @Ni, Ray Would you like to merge the patch to upstream? Thanks, Xianglei From: Lewandowski, Krzysztof Sent: Wednesday, April 10, 2024 9:29 PM To: Cai, Xianglei ; devel@edk2.groups.io Cc: Ni, Ray ; Liming Gao ; Huan= g, Jenny ; Shih, More ; Chiu, I= an Subject: Re: [PATCH 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCR= ST Looks good to me. Reviewed-by: Krzysztof Lewandowski > ________________________________ From: Cai, Xianglei > Sent: Wednesday, April 10, 2024 09:01 To: devel@edk2.groups.io > Cc: Cai, Xianglei >; = Ni, Ray >; Liming Gao >; Lewandowski, Krzysztof >; Hu= ang, Jenny >; Shih, Mor= e >; Chiu, Ian > Subject: [PATCH 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST https://bugzilla.tianocore.org/show_bug.cgi?id=3D4727 Recently some of XHCI host controllers require to have extra 1ms delay before accessing any MMIO register during reset. PHY transition from P3 to P0 can take around 1.3ms and the xHCI reset can take around 1.5ms. Add PCD to control the delay, the default is 2 ms. Cc: Ray Ni > Cc: Liming Gao > Cc: Krzysztof Lewandowski > Cc: Jenny Huang > Cc: More Shih > Cc: Ian Chiu > Signed-off-by: Xianglei Cai > --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h | 1 + MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf | 4 ++++ MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 2 +- MdePkg/MdePkg.dec | 4 ++++ MdePkg/MdePkg.dsc | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h b/MdeModulePkg/Bus/Pci/Xhc= iDxe/Xhci.h index 44016758724c..c9a12095c29e 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h @@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf b/MdeModulePkg/Bus/Pc= i/XhciDxe/XhciDxe.inf index 18ef87916ae4..2ee4c22d1e32 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf @@ -56,6 +56,7 @@ DebugLib ReportStatusCodeLib TimerLib + PcdLib [Guids] gEfiEventExitBootServicesGuid ## SOMETIMES_CONSUMES ## E= vent @@ -64,6 +65,9 @@ gEfiPciIoProtocolGuid ## TO_START gEfiUsb2HcProtocolGuid ## BY_START +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdDelayXhciHCReset ## CONSUMES + # [Event] # EVENT_TYPE_PERIODIC_TIMER ## CONSUMES # diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c b/MdeModulePkg/Bus/Pci/= XhciDxe/XhciReg.c index 40f2f1f22766..525942a167b0 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c @@ -864,7 +864,7 @@ XhcResetHC ( // Otherwise there may have the timeout case happened. // The below is a workaround to solve such problem. // - gBS->Stall (XHC_1_MILLISECOND); + gBS->Stall (PcdGet16 (PcdDelayXhciHCReset)); Status =3D XhcWaitOpRegBit (Xhc, XHC_USBCMD_OFFSET, XHC_USBCMD_RESET, = FALSE, Timeout); if (!EFI_ERROR (Status)) { diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 0459418906f8..a5b3ce94072c 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -2510,5 +2510,9 @@ # @Prompt Memory encryption attribute gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0|UINT64|0x00= 00002e + ## This dynamic PCD indicates time delay for XHCI registers access after= it issues HCRST. + # @Prompt Delay access XHCI register after it issues HCRST (us) + gEfiMdePkgTokenSpaceGuid.PcdDelayXhciHCReset|2000|UINT16|0x00000043 + [UserExtensions.TianoCore."ExtraFiles"] MdePkgExtra.uni diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index 109224c527f7..23aea04fea2e 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -31,6 +31,7 @@ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0f gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000 gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xE0000000 + gEfiMdePkgTokenSpaceGuid.PcdDelayXhciHCReset|2000 [LibraryClasses] SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf -- 2.42.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117638): https://edk2.groups.io/g/devel/message/117638 Mute This Topic: https://groups.io/mt/105171188/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --_000_MN0PR11MB60344044A926EF89E6E2CDF393042MN0PR11MB6034namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

@Liming Gao @Ni, Ray Would you like to merge the patch to upstrea= m?

 

Thanks,

Xianglei

 

From: Lewandowski, Krzysztof <krzysztof.le= wandowski@intel.com>
Sent: Wednesday, April 10, 2024 9:29 PM
To: Cai, Xianglei <xianglei.cai@intel.com>; devel@edk2.groups.= io
Cc: Ni, Ray <ray.ni@intel.com>; Liming Gao <gaoliming@byoso= ft.com.cn>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <m= ore.shih@intel.com>; Chiu, Ian <Ian.chiu@intel.com>
Subject: Re: [PATCH 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay= of HCRST

 

Looks good to me.

Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com>


From: Cai, Xianglei <xianglei.cai@intel.com>
Sent: Wednesday, April 10, 2024 09:01
To: devel@edk2.groups.io= <devel@edk2.groups.io> Cc: Cai, Xianglei <xian= glei.cai@intel.com>; Ni, Ray <ray.ni@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Lewandowski, Krzysztof <krzysztof= .lewandowski@intel.com>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; Chiu, Ian <Ian.chiu@intel.com> Subject: [PATCH 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of = HCRST

 

https://bugzilla.tianocore.org= /show_bug.cgi?id=3D4727

Recently some of XHCI host controllers require to have
extra 1ms delay before accessing any MMIO register
during reset. PHY transition from P3 to P0 can take
around 1.3ms and the xHCI reset can take around 1.5ms.
Add PCD to control the delay, the default is 2 ms.

Cc: Ray Ni           = ;            &n= bsp;        <ray.ni@intel.com>
Cc: Liming Gao          &= nbsp;           &nbs= p;     <= gaoliming@byosoft.com.cn>
Cc: Krzysztof Lewandowski    <krzysztof.lewandowski@intel.com>
Cc: Jenny Huang          =             &nb= sp;    <jenny.hu= ang@intel.com>
Cc: More Shih          &n= bsp;            = ;      <= more.shih@intel.com>
Cc: Ian Chiu          &nb= sp;           <ian.chiu@intel.com>

Signed-off-by: Xianglei Cai <x= ianglei.cai@intel.com>
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h      | 1= +
 MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf | 4 ++++
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c   | 2 +-
 MdePkg/MdePkg.dec        &nbs= p;            &= nbsp;  | 4 ++++
 MdePkg/MdePkg.dsc        &nbs= p;            &= nbsp;  | 1 +
 5 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h b/MdeModulePkg/Bus/Pci/Xhc= iDxe/Xhci.h
index 44016758724c..c9a12095c29e 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
@@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/DebugLib.h>
 #include <Library/ReportStatusCodeLib.h>
 #include <Library/TimerLib.h>
+#include <Library/PcdLib.h>
 
 #include <IndustryStandard/Pci.h>
 
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf b/MdeModulePkg/Bus/Pc= i/XhciDxe/XhciDxe.inf
index 18ef87916ae4..2ee4c22d1e32 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
@@ -56,6 +56,7 @@
   DebugLib
   ReportStatusCodeLib
   TimerLib
+  PcdLib
 
 [Guids]
   gEfiEventExitBootServicesGuid     &nb= sp;           ## SOMETIME= S_CONSUMES ## Event
@@ -64,6 +65,9 @@
   gEfiPciIoProtocolGuid       = ;            &n= bsp;     ## TO_START
   gEfiUsb2HcProtocolGuid      &nbs= p;            &= nbsp;    ## BY_START
 
+[Pcd]
+  gEfiMdePkgTokenSpaceGuid.PcdDelayXhciHCReset    = ;  ## CONSUMES
+
 # [Event]
 # EVENT_TYPE_PERIODIC_TIMER       ## CO= NSUMES
 #
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c b/MdeModulePkg/Bus/Pci/= XhciDxe/XhciReg.c
index 40f2f1f22766..525942a167b0 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
@@ -864,7 +864,7 @@ XhcResetHC (
     // Otherwise there may have the timeout case happe= ned.
     // The below is a workaround to solve such problem= .
     //
-    gBS->Stall (XHC_1_MILLISECOND);
+    gBS->Stall (PcdGet16 (PcdDelayXhciHCReset));
     Status =3D XhcWaitOpRegBit (Xhc, XHC_USBCMD_OFFSET= , XHC_USBCMD_RESET, FALSE, Timeout);
 
     if (!EFI_ERROR (Status)) {
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 0459418906f8..a5b3ce94072c 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -2510,5 +2510,9 @@
   # @Prompt Memory encryption attribute
   gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0|U= INT64|0x0000002e
 
+  ## This dynamic PCD indicates time delay for XHCI registers access = after it issues HCRST.
+  # @Prompt Delay access XHCI register after it issues HCRST (us)
+  gEfiMdePkgTokenSpaceGuid.PcdDelayXhciHCReset|2000|UINT16|0x00000043=
+
 [UserExtensions.TianoCore."ExtraFiles"]
   MdePkgExtra.uni
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index 109224c527f7..23aea04fea2e 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -31,6 +31,7 @@
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0f
   gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000    gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xE0000000 +  gEfiMdePkgTokenSpaceGuid.PcdDelayXhciHCReset|2000
 
 [LibraryClasses]
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf --
2.42.0.windows.2

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#117638) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_MN0PR11MB60344044A926EF89E6E2CDF393042MN0PR11MB6034namp_--