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 E8118D80212 for ; Mon, 15 Apr 2024 06:25:43 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=h3WLlvLNhC/dRGJfgwJK4D3rA/CuVuKqqTPH6oGpKgQ=; 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=1713162342; v=1; b=briwjEfDj3FMDrhxkurjpU06cp1I/BF2cBs6j7XCkGbVojEMBJ0wD/By+nWd+Z89vMWpTU02 gGzcc1BMaxGUiXg8cwsbmc5N9Io4KNCsvCws3HOBqRDKjD0sdgAweeEFhUPi74BXrjkfbeJLu0b WlSXe9HPsqstk8dGyp4YeJmgUfbAneeVqpCY8BBpXu3zsRH8+0tOS8CDt8ZeA1Qu3dF6rs6q68n ruZYQkiA2YnRFUm/DM2ZMnRJgvh+aMSjm32kohP9BTwp/et6x6dVZhwfoRey/GYrzAWjuq+wQG6 tq8f25xoOum9rQnLFXbtqC1egHf3Ve4lgta9hGOunQqWA== X-Received: by 127.0.0.2 with SMTP id iBrPYY7687511xdxaEXPEG9P; Sun, 14 Apr 2024 23:25:42 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by mx.groups.io with SMTP id smtpd.web11.14891.1713162341770331922 for ; Sun, 14 Apr 2024 23:25:41 -0700 X-CSE-ConnectionGUID: 5r41dWmqRayf/YSlyFFCxg== X-CSE-MsgGUID: kUJhDfHgTYSj8Me5p5D+kg== X-IronPort-AV: E=McAfee;i="6600,9927,11044"; a="26045230" X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="26045230" X-Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2024 23:25:41 -0700 X-CSE-ConnectionGUID: JjbNvtYSTE2I0cPOUSIUVQ== X-CSE-MsgGUID: DhFJMqdLTguOwFg5baFnMw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="22284703" X-Received: from unknown (HELO shclientbuild02.ccr.corp.intel.com) ([10.239.133.21]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2024 23:25:39 -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 V2 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST Date: Mon, 15 Apr 2024 14:25:16 +0800 Message-ID: <3a92577fa30900a7c16a73ce312e0166fc9950b5.1713162269.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:25:41 -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: QAWpKvQIXAHFvgAMg9wA5UbYx7686176AA= 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=briwjEfD; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.9 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) 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 +++++ MdeModulePkg/MdeModulePkg.dsc | 1 + 5 files changed, 12 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 diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index c0f1df3bfbca..0ce4f687679a 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -210,6 +210,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x0 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x0 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries|28 + gEfiMdePkgTokenSpaceGuid.PcdDelayXhciHCReset|2000 [PcdsDynamicExDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdRecoveryFileName|L"FVMAIN.FV" -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117755): https://edk2.groups.io/g/devel/message/117755 Mute This Topic: https://groups.io/mt/105531022/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-