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 52651740034 for ; Wed, 27 Mar 2024 03:06:01 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=S4cizrjfIOY04musaGIVv0lMdGodctJp3X8U2lgkrRc=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1711508760; v=1; b=emiN/7qpwXDfTKmEw47+pRnVxs/bsDwH1ip+GFQeqPIXLS2BEbJ/JTwaFJOlIl+dqRdFgwKk yzhvMJaHEq7jkGFzTmwzw1PgzNZGgp0FtfHQ74ITSu00UOGbib79PHiek06LQptcS+//LMbErsr D76SkVd8ZxhDPlTJvdRMlt9Q4TMncJXPRc0u+atByofnxyxQYzrAv73mjjcOGFGJvFJkHitgGU+ GvYPHGVqqJlr50lFy4thVEOTz8eWmVXW1U+6ka4+xjhKsIzirFE9hr75KfT/+MFu+Wmgv/hO+t9 DI2Yvbk0AJKVvDw8C5T1XNXnGwEXuuuryNTg4Hcaki3BQ== X-Received: by 127.0.0.2 with SMTP id tFmFYY7687511xEKbVNxXpGX; Tue, 26 Mar 2024 20:06:00 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mx.groups.io with SMTP id smtpd.web10.28885.1711508759320857750 for ; Tue, 26 Mar 2024 20:05:59 -0700 X-CSE-ConnectionGUID: j12j9D7kS3e9vXOmDnMeAA== X-CSE-MsgGUID: oaVfV3guTf+4VWNV4N+HyA== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="6800435" X-IronPort-AV: E=Sophos;i="6.07,157,1708416000"; d="scan'208";a="6800435" X-Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 20:05:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,157,1708416000"; d="scan'208";a="20880490" X-Received: from shclientbuild02.ccr.corp.intel.com ([10.239.133.21]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 20:05:56 -0700 From: "Xianglei Cai" To: devel@edk2.groups.io Cc: Xianglei Cai , Hao A Wu , Ray Ni , Jian J Wang , Liming Gao , Jenny Huang , More Shih , Chiu, Ian Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST Date: Wed, 27 Mar 2024 11:05:47 +0800 Message-ID: In-Reply-To: References: MIME-Version: 1.0 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: Tue, 26 Mar 2024 20:05:59 -0700 Reply-To: devel@edk2.groups.io,xianglei.cai@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: JLQvgb9SoJ5HMB1AIaKkx6HHx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="emiN/7qp"; 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 https://bugzilla.tianocore.org/show_bug.cgi?id=4727 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: Hao A Wu Cc: Ray Ni Cc: Jian J Wang Cc: Liming Gao Cc: Jenny Huang Cc: More Shih Cc: Chiu, Ian 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/XhciDxe/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/Pci/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 ## Event @@ -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 = 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|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: You receive all messages sent to this group. View/Reply Online (#117147): https://edk2.groups.io/g/devel/message/117147 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] -=-=-=-=-=-=-=-=-=-=-=-