summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2007-08-30 08:20:57 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2007-08-30 08:20:57 +0000
commit14e8823a34c01cf6d75b37c959fb2cae91caf771 (patch)
tree8c292f0ca04b6ab49ffb3f51dd1508b1ed9928c4
parent3a63377f2b683e2159a7b9dea04166987d899022 (diff)
downloadedk2-14e8823a34c01cf6d75b37c959fb2cae91caf771.tar.gz
edk2-14e8823a34c01cf6d75b37c959fb2cae91caf771.tar.bz2
edk2-14e8823a34c01cf6d75b37c959fb2cae91caf771.zip
[PI compatible enabling] Add PeiRegisterForShadow interface for PEI_SERVICE
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3743 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c40
-rw-r--r--MdeModulePkg/Core/Pei/PeiMain.h19
-rw-r--r--MdeModulePkg/Core/Pei/PeiMain/PeiMain.c8
3 files changed, 66 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index 7ae8347963..67aa1bd535 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -536,3 +536,43 @@ Returns:
return BuildGuidDataHob (&gEfiPeiCorePrivateGuid, PrivateData, sizeof (PEI_CORE_INSTANCE));
}
+/**
+ This routine enable a PEIM to register itself to shadow when PEI Foundation
+ discovery permanent memory.
+
+ @param FileHandle File handle of a PEIM.
+
+ @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
+ @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
+ @retval EFI_SUCCESS Successfully to register itself.
+
+**/
+EFI_STATUS
+EFIAPI
+PeiRegisterForShadow (
+ IN EFI_PEI_FILE_HANDLE FileHandle
+ )
+{
+ PEI_CORE_INSTANCE *Private;
+ Private = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ());
+
+ if (Private->CurrentFileHandle != FileHandle) {
+ //
+ // The FileHandle must be for the current PEIM
+ //
+ return EFI_NOT_FOUND;
+ }
+
+ if (Private->Fv[Private->CurrentPeimFvCount].PeimState[Private->CurrentPeimCount] >= PEIM_STATE_REGISITER_FOR_SHADOW) {
+ //
+ // If the PEIM has already entered the PEIM_STATE_REGISTER_FOR_SHADOW or PEIM_STATE_DONE then it's already been started
+ //
+ return EFI_ALREADY_STARTED;
+ }
+
+ Private->Fv[Private->CurrentPeimFvCount].PeimState[Private->CurrentPeimCount] = PEIM_STATE_REGISITER_FOR_SHADOW;
+
+ return EFI_SUCCESS;
+}
+
+
diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h
index 023114750d..e71ae78b04 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.h
+++ b/MdeModulePkg/Core/Pei/PeiMain.h
@@ -45,6 +45,7 @@ Revision History
#include <Library/BaseMemoryLib.h>
#include <Library/TimerLib.h>
#include <IndustryStandard/PeImage.h>
+#include <Library/PeiServicesTablePointerLib.h>
extern EFI_GUID gEfiPeiCorePrivateGuid;
@@ -1162,6 +1163,24 @@ Returns:
;
/**
+ This routine enable a PEIM to register itself to shadow when PEI Foundation
+ discovery permanent memory.
+
+ @param FileHandle File handle of a PEIM.
+
+ @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
+ @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
+ @retval EFI_SUCCESS Successfully to register itself.
+
+**/
+EFI_STATUS
+EFIAPI
+PeiRegisterForShadow (
+ IN EFI_PEI_FILE_HANDLE FileHandle
+ )
+;
+
+/**
Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack
diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
index 5d439f74ac..b2f7807479 100644
--- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
+++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
@@ -69,7 +69,13 @@ static EFI_PEI_SERVICES mPS = {
PeiReportStatusCode,
- PeiResetSystem
+ PeiResetSystem,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ PeiRegisterForShadow
};
EFI_STATUS