From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.groups.io (mail04.groups.io [45.79.224.9]) by spool.mail.gandi.net (Postfix) with ESMTPS id ABD1F740032 for ; Mon, 15 Apr 2024 06:34:14 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=gbug9PvppM5lh66IqXiNfB7pIsbm3TMRbsRvoAUS49E=; 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:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1713162853; v=1; b=Sk7qCk5esJViDewIsOYWxP6/sU7egs9mZ2qaWQsLZx/iI77AiHtnwP/Lzdd+cfbs2cIsi66B 6wyZ0tQbAj/8xYdDbNBVaJwFBxnco11ztrlokmOj2CrGCoFYyaIXiarobg7vbMvmbPWshy0epc6 K90LRYAm8fRuUDugkf3GLujamGPwaoXp/lbA8jiwqKDDitq/mjMvT7hMFjLECsOzC0DRNK6UVM2 2sUpS0O3McpS64eLUBPlBaq9qJtFWSHU6iqeYoJLXqgVNucWJai9LNJOjP5UNs751X4Bjd9FFur 1zs/JvP8Rg3fhR8U80vaTGbWb1AEilj2XDwRePCMOSmSQ== X-Received: by 127.0.0.2 with SMTP id XIO4YY7687511xf6rhwNjuRV; Sun, 14 Apr 2024 23:34:13 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mx.groups.io with SMTP id smtpd.web11.14981.1713162847768101269 for ; Sun, 14 Apr 2024 23:34:07 -0700 X-CSE-ConnectionGUID: dIcaOcupRtefjbl5u52Mfg== X-CSE-MsgGUID: ieF2OTvqQh6NNT0/GEeiTw== X-IronPort-AV: E=McAfee;i="6600,9927,11044"; a="19924255" X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="19924255" X-Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2024 23:34:08 -0700 X-CSE-ConnectionGUID: 7rnTR/acSvi66bbTiQh25Q== X-CSE-MsgGUID: xypN/NUvRYSvIMqmMqdYjg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="21805979" X-Received: from unknown (HELO shclientbuild02.ccr.corp.intel.com) ([10.239.133.21]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2024 23:34:05 -0700 From: "Xianglei Cai" To: devel@edk2.groups.io Cc: Xianglei Cai , Ray Ni , Liming Gao , Krzysztof Lewandowski , Jenny Huang , More Shih , Ian Chiu Subject: [edk2-devel] [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST Date: Mon, 15 Apr 2024 14:33:54 +0800 Message-ID: <6ccbc5f73881bc59b8260f947ca092a6a3d6c60c.1713162827.git.xianglei.cai@intel.com> 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: Sun, 14 Apr 2024 23:34:07 -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: Dq0Tmm4C4ejoerPwO14nzUMix7686176AA= 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=Sk7qCk5e; 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.224.9 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: Ray Ni Cc: Liming Gao Cc: Krzysztof Lewandowski Cc: Jenny Huang Cc: More Shih Cc: Ian Chiu Signed-off-by: Xianglei Cai Reviewed-by: Krzysztof Lewandowski --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h | 1 + MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf | 4 ++++ MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 2 +- MdeModulePkg/MdeModulePkg.dec | 5 +++++ 4 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..e6c1ac8a6346 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] + gEfiMdeModulePkgTokenSpaceGuid.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/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index a91058e5b5df..d9e2e724df9e 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -1148,6 +1148,11 @@ # @Prompt Enable large address image loading. gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BOOLEAN|0x30001059 + ## Indicates time delay for XHCI registers access after it issues HCRST. + # Default is 2000, it represent delay is 2 ms. + # @Prompt Delay access XHCI register after it issues HCRST (us) + gEfiMdeModulePkgTokenSpaceGuid.PcdDelayXhciHCReset|2000|UINT16|0x30001060 + [PcdsFixedAtBuild, PcdsPatchableInModule] ## Dynamic type PCD can be registered callback function for Pcd setting action. # PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of callback function -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117758): https://edk2.groups.io/g/devel/message/117758 Mute This Topic: https://groups.io/mt/105531079/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-