]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg PCD: Reinstall PCD service PPIS when memory available
authorYeh, GregX <gregx.yeh@intel.com>
Thu, 12 Aug 2021 07:22:05 +0000 (15:22 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 13 Aug 2021 01:44:41 +0000 (01:44 +0000)
https://bugzilla.tianocore.org/show_bug.cgi?id=3525

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 <gregx.yeh@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
MdeModulePkg/Universal/PCD/Pei/Pcd.c

index 9c6346924f15706e2f8a40cb90e34298545947a7..f31e0be35f2f53bd9fc9ad646e60c5274d928277 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   All Pcd Ppi services are implemented here.\r
 \r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -339,6 +339,75 @@ PcdPeimInit (
 {\r
   EFI_STATUS Status;\r
 \r
+  Status = PeiServicesRegisterForShadow (FileHandle);\r
+  if (Status == EFI_ALREADY_STARTED) {\r
+    //\r
+    // This is now starting in memory, the second time starting.\r
+    //\r
+    EFI_PEI_PPI_DESCRIPTOR *OldPpiList;\r
+    EFI_PEI_PPI_DESCRIPTOR *OldPpiList2;\r
+    VOID *Ppi;\r
+    VOID *Ppi2;\r
+\r
+    OldPpiList = NULL;\r
+    Status = PeiServicesLocatePpi (\r
+               &gPcdPpiGuid,\r
+               0,\r
+               &OldPpiList,\r
+               &Ppi\r
+               );\r
+    ASSERT_EFI_ERROR (Status);\r
+\r
+    if (OldPpiList != NULL) {\r
+      Status = PeiServicesReInstallPpi (OldPpiList, &mPpiList[0]);\r
+      ASSERT_EFI_ERROR (Status);\r
+    }\r
+\r
+    OldPpiList2 = NULL;\r
+    Status = PeiServicesLocatePpi (\r
+               &gGetPcdInfoPpiGuid,\r
+               0,\r
+               &OldPpiList2,\r
+               &Ppi2\r
+               );\r
+    ASSERT_EFI_ERROR (Status);\r
+\r
+    if (OldPpiList2 != NULL) {\r
+      Status = PeiServicesReInstallPpi (OldPpiList2, &mPpiList2[0]);\r
+      ASSERT_EFI_ERROR (Status);\r
+    }\r
+\r
+    OldPpiList = NULL;\r
+    Status = PeiServicesLocatePpi (\r
+               &gEfiPeiPcdPpiGuid,\r
+               0,\r
+               &OldPpiList,\r
+               &Ppi\r
+               );\r
+    ASSERT_EFI_ERROR (Status);\r
+\r
+    if (OldPpiList != NULL) {\r
+      Status = PeiServicesReInstallPpi (OldPpiList, &mPpiList[1]);\r
+      ASSERT_EFI_ERROR (Status);\r
+    }\r
+\r
+    OldPpiList2 = NULL;\r
+    Status = PeiServicesLocatePpi (\r
+               &gEfiGetPcdInfoPpiGuid,\r
+               0,\r
+               &OldPpiList2,\r
+               &Ppi2\r
+               );\r
+    ASSERT_EFI_ERROR (Status);\r
+\r
+    if (OldPpiList2 != NULL) {\r
+      Status = PeiServicesReInstallPpi (OldPpiList2, &mPpiList2[1]);\r
+      ASSERT_EFI_ERROR (Status);\r
+    }\r
+\r
+    return Status;\r
+  }\r
+\r
   BuildPcdDatabase (FileHandle);\r
 \r
   //\r