From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.17670.1628476072427400780 for ; Sun, 08 Aug 2021 19:27:52 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: gregx.yeh@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10070"; a="194878634" X-IronPort-AV: E=Sophos;i="5.84,305,1620716400"; d="scan'208";a="194878634" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2021 19:27:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,305,1620716400"; d="scan'208";a="438779378" Received: from chinghux-desk1.gar.corp.intel.com ([10.5.215.161]) by orsmga002.jf.intel.com with ESMTP; 08 Aug 2021 19:27:49 -0700 From: "GregX Yeh" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Dandan Bi , Liming Gao Subject: [PATCH] MdeModulePkg PCD: FSP NotifyPhase APIs caused 100ms delay Date: Mon, 9 Aug 2021 10:27:32 +0800 Message-Id: <20210809022732.1753-1-gregx.yeh@intel.com> X-Mailer: git-send-email 2.32.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable https://bugzilla.tianocore.org/show_bug.cgi?id=3D3525 After PciSegmentLib using Dynamic PCD for Pcie base address such long delay found in FSP. The root cause is some of the PCD service PPIs not shadowed to memory and flash cache may have been disabled in NotifyPhase stage. Solution is to shadow all PCD service PPIs to memory. Signed-off-by: GregX Yeh Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Liming Gao --- MdeModulePkg/Universal/PCD/Pei/Pcd.c | 71 +++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/PCD/Pei/Pcd.c b/MdeModulePkg/Universal/= PCD/Pei/Pcd.c index 9c6346924f..f31e0be35f 100644 --- a/MdeModulePkg/Universal/PCD/Pei/Pcd.c +++ b/MdeModulePkg/Universal/PCD/Pei/Pcd.c @@ -1,7 +1,7 @@ /** @file=0D All Pcd Ppi services are implemented here.=0D =0D -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
=0D +Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
=0D (C) Copyright 2016 Hewlett Packard Enterprise Development LP
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -339,6 +339,75 @@ PcdPeimInit ( {=0D EFI_STATUS Status;=0D =0D + Status =3D PeiServicesRegisterForShadow (FileHandle);=0D + if (Status =3D=3D EFI_ALREADY_STARTED) {=0D + //=0D + // This is now starting in memory, the second time starting.=0D + //=0D + EFI_PEI_PPI_DESCRIPTOR *OldPpiList;=0D + EFI_PEI_PPI_DESCRIPTOR *OldPpiList2;=0D + VOID *Ppi;=0D + VOID *Ppi2;=0D +=0D + OldPpiList =3D NULL;=0D + Status =3D PeiServicesLocatePpi (=0D + &gPcdPpiGuid,=0D + 0,=0D + &OldPpiList,=0D + &Ppi=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + if (OldPpiList !=3D NULL) {=0D + Status =3D PeiServicesReInstallPpi (OldPpiList, &mPpiList[0]);=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D +=0D + OldPpiList2 =3D NULL;=0D + Status =3D PeiServicesLocatePpi (=0D + &gGetPcdInfoPpiGuid,=0D + 0,=0D + &OldPpiList2,=0D + &Ppi2=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + if (OldPpiList2 !=3D NULL) {=0D + Status =3D PeiServicesReInstallPpi (OldPpiList2, &mPpiList2[0]);=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D +=0D + OldPpiList =3D NULL;=0D + Status =3D PeiServicesLocatePpi (=0D + &gEfiPeiPcdPpiGuid,=0D + 0,=0D + &OldPpiList,=0D + &Ppi=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + if (OldPpiList !=3D NULL) {=0D + Status =3D PeiServicesReInstallPpi (OldPpiList, &mPpiList[1]);=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D +=0D + OldPpiList2 =3D NULL;=0D + Status =3D PeiServicesLocatePpi (=0D + &gEfiGetPcdInfoPpiGuid,=0D + 0,=0D + &OldPpiList2,=0D + &Ppi2=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + if (OldPpiList2 !=3D NULL) {=0D + Status =3D PeiServicesReInstallPpi (OldPpiList2, &mPpiList2[1]);=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D +=0D + return Status;=0D + }=0D +=0D BuildPcdDatabase (FileHandle);=0D =0D //=0D --=20 2.32.0.windows.1