From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id C25247803E1 for ; Wed, 10 Apr 2024 13:30:14 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=mrZSwI1DicFKeT+a1umjHXVwZfyqApbyYq5/+XY/3hk=; 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=1712755813; v=1; b=HJsm9MI8p/uZvKYcsN0GsSTK4afp6oqdwJtfd40dOaTpi7wcapzTyXZ00oPzDnTK79JU+9+8 gMBCyztxvB6yjjZKHAPRlkPE4SedXrg/Fduo7pQFj/1UDwAd5zmDdFkmi/uWgl4fxFEZsyMSkZm iGtsJdUfnK9jQKaMIJHUez49MS+QT/B4qibO31SjtEjWelc+UNnmhPpKcF+JIUu8Rretq+Qm3gH i0CdhD019OwIb1ujA1oclACx8i0y7p6O8lf7sN2fhwxE/+7pbPTRd4JtM9GsA1jynD1bWFWw0CA /rtkQUxlFpd4i6zZP8QkmlbQsSFXQF4Wx+0WaTQxVSBzg== X-Received: by 127.0.0.2 with SMTP id pRchYY7687511x7YajneFTiT; Wed, 10 Apr 2024 06:30:13 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by mx.groups.io with SMTP id smtpd.web10.165984.1712755768801955428 for ; Wed, 10 Apr 2024 06:29:29 -0700 X-CSE-ConnectionGUID: GNrbnRfLRbG96+PPauC5TQ== X-CSE-MsgGUID: TRcMrIThTGK15AAIzBDxew== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="7970951" X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208,217";a="7970951" X-Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2024 06:29:28 -0700 X-CSE-ConnectionGUID: Ok/C9lCLTTCfmrV0znz/OQ== X-CSE-MsgGUID: DtLmXwBpRWKnxcZsufpjbQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208,217";a="25031304" X-Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa005.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 10 Apr 2024 06:29:27 -0700 X-Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 10 Apr 2024 06:29:27 -0700 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.35 via Frontend Transport; Wed, 10 Apr 2024 06:29:27 -0700 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.169) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 10 Apr 2024 06:29:27 -0700 X-Received: from BYAPR11MB3767.namprd11.prod.outlook.com (2603:10b6:a03:fd::13) by SJ0PR11MB6622.namprd11.prod.outlook.com (2603:10b6:a03:478::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.25; Wed, 10 Apr 2024 13:29:20 +0000 X-Received: from BYAPR11MB3767.namprd11.prod.outlook.com ([fe80::def8:13bf:1c58:3a88]) by BYAPR11MB3767.namprd11.prod.outlook.com ([fe80::def8:13bf:1c58:3a88%3]) with mapi id 15.20.7452.019; Wed, 10 Apr 2024 13:29:20 +0000 From: "Lewandowski, Krzysztof" To: "Cai, Xianglei" , "devel@edk2.groups.io" CC: "Ni, Ray" , Liming Gao , "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: AQHaixT+G+OYWHQ2s0Cn6Gzi1PFgxLFhf66F Date: Wed, 10 Apr 2024 13:29:20 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BYAPR11MB3767:EE_|SJ0PR11MB6622:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: /6fk96QreKjm2DjgihB+5KQUPE5I01fM00IXR2Z0yK0aoElDj5xEhDN+YHODs4MPFphhYmjWkOeX/BOmsvK18Cns+tO2OMTdhDixNWo5nEZ+2zAFGOWc+utNH0lJuY2lFI41wGn2oVdyRfdj2ZiSZYNgphkBESS+sRviR64Qmlcwdy+hjhfUtmNnUgAH5wnpLBLUJkNECP9o/Uq/Li+KwhD5WO3yev/kRH37vZVuSNwDmkQQzppJjDX9hwbqvvXW6vbYdz8q6DKd/YXRwuABkdIVSB7dJ1q4lMcrbb4fkCbrvvCytsOZQT/2H6LmFnyUdqm/5z5lMgHl3gh3ClG8LUbFHE762YqTRG5D37YtHhjURnYTl9TwVmmWytGJuWaPklcXVvfC1XAUQdvdvj1ySq9yhCBFxzFBuCajej04qgF/G22r27iR3rkgne7UKux9o/ieUdxJeWt9oulA0MsEVr0F16/DPToY8T3nAaJtz2f/HIFzKDELSZLilOqMuOd0ImSm/lHZUaVicQte+j9pu2HRg+sAHHaJUWaJ852+sCBezyMMWtNSl6RQuHsr3YqgBJ4yati8LEgTo6gHwmGFX5wMJzUDmtflrg1OwXbr6W4= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?AQsUk9bDwY4uGYe2ujluza0dh7rjoT2BjFDx6+nhh8ODiQwCy8ZtkiKmc9/i?= =?us-ascii?Q?GSsLZI6D/9bR76GA5cptsDHAHSTChpjd3K29nO7xx6Uzkv9hHHtWGT0SXj2c?= =?us-ascii?Q?366fUy17TAqUHUgs4TGsjjaMyVY7len4z1jgMTY5C45qogx7x7UlcjM0NHMx?= =?us-ascii?Q?IewUOH3qQq9kn7eNx0dBDxHAvll5REwPKWIHMeYgHluHvQQYoT/Yf3SbgkJ1?= =?us-ascii?Q?Zi8vnFp8I/p7WiYrEOkYOgC989IBHSQEKgvMivyP3DIFQedg8n62k3ZKEjVQ?= =?us-ascii?Q?OVg32xAVyX9cgK+nAbMPDJryhmEV+PLC3Mj6/qi9ek00BtFmg2Ys5Dp3G/01?= =?us-ascii?Q?qMMFXbk8Dvr0GTj6j84e6PgpWWGN/dE8Az8lmyEnV3wpi6YSJTq2CjcBJFIy?= =?us-ascii?Q?vjRpGZbHYE1XgoqX+aOpmCt/taaCe/V+T/qoX4F7MnEYmqZECAeFVCpMSJNp?= =?us-ascii?Q?zuhfYZBKcKFBceSjTSISjpgYES+pWT71AWLWpWfYuBLDrsA23kZXufXs/aPm?= =?us-ascii?Q?5DC/c5uGDVU1ybAHClzNVBQv9NpqTZc05GSCg3mVBlvK+B1u7SpeO9JoUJvs?= =?us-ascii?Q?HUfPEW84yUcrhNkc+6eGfuH+ImidBPS9Aqf9o1zKFDZjftJUvSdSFg9Xf6x/?= =?us-ascii?Q?+7wT46W0bqj2mj60M04vpQZFgZI/r1pM1OcW2N1HXB+Rk5pP/44cDArtjVKs?= =?us-ascii?Q?FqiDYlookXdFiZhru6Wz7b3yRF17rgT9VeR49OMzh3gYcdeBguNri4x4fJTQ?= =?us-ascii?Q?84FXDr9IFQjEv5ppuR1CwlDf9LuuJfPkREb/dTY0+i/hChMVvNSxtwYSvi36?= =?us-ascii?Q?UzL17Udbb96HlHiRyYV1QhDTfdAYIKJvLkcuM9JO9XhpougflAiXjRl/ZLJm?= =?us-ascii?Q?W3ezbEaEnZ1Ykve0UePIGOvYWsni/bPQOp+QfkFt7fHTgNifwLeMhWtUNBM/?= =?us-ascii?Q?5eyietWEIDcxZjUvTW7fos9kByCDSG4UTduuNeQgXCzETrrckXNMAIhcQOms?= =?us-ascii?Q?sLiGoqLtFJkDzN3m1ANaG6JiN8GZ2/BcQTGreraSeMaWhl7ckii5B8anGQKv?= =?us-ascii?Q?+2Bm9ME59pHJ8FRmtoXS0TXnzhrqNX7Z0UOAm8xTBlNI5RVkPid7nq8tGe95?= =?us-ascii?Q?v01wQCu6b+/zm9zWKzdCaD3QJu8gYObc0HZQx/Ph8D+HbMpSPS2doOm0itX1?= =?us-ascii?Q?OI30W6l72VN9c6tiK3LbJHboCxkoH2zusk70AFtEEIkgAUDUBHQsKGNGuF0l?= =?us-ascii?Q?Y7txfWa17/V160lhPlmR4JWqID9xGxK73VYDz1FzMrpQQHG3R9LD3UZdaytd?= =?us-ascii?Q?WAugbB7djO535dZzhunS1sJCqq1zx33KRIG/kvQ86iHz1B2+4B58zpwVXcoZ?= =?us-ascii?Q?nCrgryNvR2ACJTXv2yJ/2XJrBJ2QAB6RSnkb2MgO2nevHnhl841CNp2aBlZT?= =?us-ascii?Q?IdOhEIllkN12eNGi8nZWdzgToJ5+buHHV6oIvyHPppjUetAfRmDn1vm3PWZc?= =?us-ascii?Q?M/GM1gCNDMIAzTasOpwqvom3iwuQPadxjdHhrJZkL6oT9qmMW9lZaMdDX07U?= =?us-ascii?Q?uSQmZQ1UpZ7rXB1gDIjwIjJ5Vf1+PgAl1yTNEInujRC9F77xi6+iHmi9pckZ?= =?us-ascii?Q?WQ=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3767.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a31cfdb-a21b-41da-57e7-08dc59623a8d X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Apr 2024 13:29:20.3429 (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: P+cJLXoTVXXc33nB9lYdIZTTcXQf5dF/4aSnWLf3J+z7UIO6h8VubAtfsaPTYyu4WSdzCICnVqqFQGif2ano1fFNsy+g4OJq0BdM67exzDU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB6622 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: Wed, 10 Apr 2024 06:30:10 -0700 Resent-From: krzysztof.lewandowski@intel.com Reply-To: devel@edk2.groups.io,krzysztof.lewandowski@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: fDZnGix3MZfMRXt8O0uhWMQqx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BYAPR11MB37678159BA062D4880F4EA26F3062BYAPR11MB3767namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=HJsm9MI8; 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 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io --_000_BYAPR11MB37678159BA062D4880F4EA26F3062BYAPR11MB3767namp_ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 ; Lim= ing Gao ; Lewandowski, Krzysztof ; Huang, Jenny ; Shih, More ; 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 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydz= ial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-31= 6 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu usta= wy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w trans= akcjach handlowych. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata= i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wi= adomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiek= olwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). If you are not the intended recipient= , please contact the sender and delete all copies; any review or distributi= on by others is strictly prohibited. -=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 (#117587): https://edk2.groups.io/g/devel/message/117587 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_BYAPR11MB37678159BA062D4880F4EA26F3062BYAPR11MB3767namp_ Content-Type: text/html; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable
Looks good to me.

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

From: Cai, Xianglei <xia= nglei.cai@intel.com>
Sent: Wednesday, April 10, 2024 09:01
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Cai, Xianglei <xianglei.cai@intel.com>; Ni, Ray <ray.ni= @intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Lewandowski, K= rzysztof <krzysztof.lewandowski@intel.com>; Huang, Jenny <jenny.hu= ang@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.huang@intel.com>
Cc: More Shih          &n= bsp;            = ;      <more.shih@intel.com>
Cc: Ian Chiu          &nb= sp;           <ian.chi= u@intel.com>

Signed-off-by: Xianglei Cai <xianglei.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


Intel = Technology Poland sp. z o.o.
ul. Słowackiego 173 | 80-298 Gdańsk | Sąd Rejonowy G= dańsk Północ | VII Wydział Gospodarczy Krajowego Rejest= ru Sądowego - KRS 101882 | NIP 957-07-52-316 | Kapitał zakła= dowy 200.000 PLN.
Spółka oświadcza, że posiada status du= 80;ego przedsiębiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o prz= eciwdziałaniu nadmiernym opóźnieniom w transakcjach handlowy= ch.

Ta wiadomość wraz z załącznikami jest przeznacz= ona dla określonego adresata i może zawierać informacje pouf= ne. W razie przypadkowego otrzymania tej wiadomości, prosimy o powiado= mienie nadawcy oraz trwałe jej usunięcie; jakiekolwiek przegl= 1;danie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material f= or the sole use of the intended recipient(s). If you are not the intended r= ecipient, please contact the sender and delete all copies; any review or di= stribution by others is strictly prohibited.

_._,_._,_

Groups.io Links:

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

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

_._,_._,_
--_000_BYAPR11MB37678159BA062D4880F4EA26F3062BYAPR11MB3767namp_--