diff options
author | Liming Gao <liming.gao@intel.com> | 2015-08-03 03:18:37 +0000 |
---|---|---|
committer | lgao4 <lgao4@Edk2> | 2015-08-03 03:18:37 +0000 |
commit | 3d44658ca89b36a492ba2ab648617d53be2693fd (patch) | |
tree | 3d96cccf6b03170185d6f9957708fcd507c557d5 /MdeModulePkg/Core/Pei/Dispatcher | |
parent | 496b0dd00c377461bd059c0027ec2437630e2496 (diff) | |
download | edk2-3d44658ca89b36a492ba2ab648617d53be2693fd.tar.gz edk2-3d44658ca89b36a492ba2ab648617d53be2693fd.tar.bz2 edk2-3d44658ca89b36a492ba2ab648617d53be2693fd.zip |
MdeModulePkg PeiCore: Add PCD to specify PEIM Shadow
v2 changelog:
Check CurrentPeimHandle to check the matched PeimHandle.
Add check point to ShadowPeiCore based on PCD.
v1 changelog:
PeiCore LoadImage always shadow itself and PEIM on normal boot after
the physical memory is installed. On the emulator platform, the shadow
may be not necessary. To support such usage, new PCD PcdShadowPeimOnBoot
is introduced to specify whether loads PEIM in memory by default.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18125 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Pei/Dispatcher')
-rw-r--r-- | MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c index 3a85502dbe..46e990d75d 100644 --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c @@ -697,6 +697,9 @@ PeiDispatcher ( for (Index2 = 0; (Index2 < PcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->Fv[Index1].FvFileHandles[Index2] != NULL); Index2++) {
if (Private->Fv[Index1].PeimState[Index2] == PEIM_STATE_REGISITER_FOR_SHADOW) {
PeimFileHandle = Private->Fv[Index1].FvFileHandles[Index2];
+ Private->CurrentFileHandle = PeimFileHandle;
+ Private->CurrentPeimFvCount = Index1;
+ Private->CurrentPeimCount = Index2;
Status = PeiLoadImage (
(CONST EFI_PEI_SERVICES **) &Private->Ps,
PeimFileHandle,
@@ -709,9 +712,6 @@ PeiDispatcher ( // PEIM_STATE_REGISITER_FOR_SHADOW move to PEIM_STATE_DONE
//
Private->Fv[Index1].PeimState[Index2]++;
- Private->CurrentFileHandle = PeimFileHandle;
- Private->CurrentPeimFvCount = Index1;
- Private->CurrentPeimCount = Index2;
//
// Call the PEIM entry point
//
@@ -1108,6 +1108,21 @@ PeiDispatcher ( // We call the entry point a 2nd time so the module knows it's shadowed.
//
//PERF_START (PeiServices, L"PEIM", PeimFileHandle, 0);
+ if ((Private->HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME) && !PcdGetBool (PcdShadowPeimOnBoot)) {
+ //
+ // Load PEIM into Memory for Register for shadow PEIM.
+ //
+ Status = PeiLoadImage (
+ PeiServices,
+ PeimFileHandle,
+ PEIM_STATE_REGISITER_FOR_SHADOW,
+ &EntryPoint,
+ &AuthenticationState
+ );
+ if (Status == EFI_SUCCESS) {
+ PeimEntryPoint = (EFI_PEIM_ENTRY_POINT2)(UINTN)EntryPoint;
+ }
+ }
ASSERT (PeimEntryPoint != NULL);
PeimEntryPoint (PeimFileHandle, (const EFI_PEI_SERVICES **) PeiServices);
//PERF_END (PeiServices, L"PEIM", PeimFileHandle, 0);
|