public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: pankaj.bansal@nxp.com
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Pankaj Bansal <pankaj.bansal@nxp.com>,
	Dandan Bi <dandan.bi@intel.com>,
	Liming Gao <liming.gao@intel.com>
Subject: [PATCH] MdeModulePkg PeiCore: Install SEC PPIs before library constructor call
Date: Sun, 29 Dec 2019 04:53:44 +0000	[thread overview]
Message-ID: <20191229101353.20820-1-pankaj.bansal@nxp.com> (raw)

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


             reply	other threads:[~2019-12-29  4:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-29  4:53 pankaj.bansal [this message]
2020-01-03  5:30 ` [PATCH] MdeModulePkg PeiCore: Install SEC PPIs before library constructor call Liming Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191229101353.20820-1-pankaj.bansal@nxp.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox