public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg PeiCore: Install SEC PPIs before library constructor call
@ 2019-12-29  4:53 pankaj.bansal
  2020-01-03  5:30 ` Liming Gao
  0 siblings, 1 reply; 2+ messages in thread
From: pankaj.bansal @ 2019-12-29  4:53 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Pankaj Bansal, Dandan Bi, Liming Gao

Install PPIs received from SEC phase before library constructor call, so
that any platform specific library can make use of the PPIs exposed by SEC
phase.

Since SEC phase can expose HOBs also in PPI list, we need to Initialize
memory service before installing SEC PPIs.

Therefore, the sequence becomes:
Initialize memory -> install SEC PPIs -> Call libraries' constructors

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 MdeModulePkg/Core/Pei/PeiMain/PeiMain.c | 24 ++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
index 025d7f98ec..3dd69ddde0 100644
--- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
+++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
@@ -366,14 +366,23 @@ PeiCore (
   SetPeiServicesTablePointer ((CONST EFI_PEI_SERVICES **)&PrivateData.Ps);
 
   //
-  // Initialize libraries that the PEI Core is linked against
+  // Initialize PEI Core Services
   //
-  ProcessLibraryConstructorList (NULL, (CONST EFI_PEI_SERVICES **)&PrivateData.Ps);
+  InitializeMemoryServices   (&PrivateData, SecCoreData, OldCoreData);
+
+  if (OldCoreData == NULL) {
+    //
+    // If SEC provided the PpiList, process it.
+    //
+    if (PpiList != NULL) {
+      ProcessPpiListFromSec ((CONST EFI_PEI_SERVICES **) &PrivateData.Ps, PpiList);
+    }
+  }
 
   //
-  // Initialize PEI Core Services
+  // Initialize libraries that the PEI Core is linked against
   //
-  InitializeMemoryServices   (&PrivateData, SecCoreData, OldCoreData);
+  ProcessLibraryConstructorList (NULL, (CONST EFI_PEI_SERVICES **)&PrivateData.Ps);
 
   //
   // Update performance measurements
@@ -410,13 +419,6 @@ PeiCore (
       EFI_PROGRESS_CODE,
       (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT)
       );
-
-    //
-    // If SEC provided the PpiList, process it.
-    //
-    if (PpiList != NULL) {
-      ProcessPpiListFromSec ((CONST EFI_PEI_SERVICES **) &PrivateData.Ps, PpiList);
-    }
   } else {
     //
     // Try to locate Temporary RAM Done Ppi.
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-03  5:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-29  4:53 [PATCH] MdeModulePkg PeiCore: Install SEC PPIs before library constructor call pankaj.bansal
2020-01-03  5:30 ` Liming Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox