[edk2-devel] [PATCH] MdeModulePkg PeiCore: Install SEC PPIs before library constructor call

Liming Gao liming.gao at intel.com
Fri Jan 3 05:30:58 UTC 2020


This change looks good. What functionality test have been done? 

-----Original Message-----
From: Pankaj Bansal <pankaj.bansal at nxp.com> 
Sent: 2019年12月29日 12:54
To: devel at edk2.groups.io
Cc: Pankaj Bansal <pankaj.bansal at nxp.com>; Bi, Dandan <dandan.bi at intel.com>; Gao, Liming <liming.gao at intel.com>
Subject: [PATCH] MdeModulePkg PeiCore: Install SEC PPIs before library constructor call

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 at nxp.com>

Cc: Dandan Bi <dandan.bi at intel.com>
Cc: Liming Gao <liming.gao at 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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52730): https://edk2.groups.io/g/devel/message/52730
Mute This Topic: https://groups.io/mt/69312521/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list