summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2008-08-18 08:38:00 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2008-08-18 08:38:00 +0000
commit82b8c8df0763d3ce93281d489e512bee12068873 (patch)
tree1eee47c0376b767a47dbde4c40ccb856526d3868 /MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
parentb3bc6cd9e3f72d0b587983f222ba5455bda78a7e (diff)
downloadedk2-platforms-82b8c8df0763d3ce93281d489e512bee12068873.tar.xz
Re-integrate patch in r5626~r5628:Enhance PeiCore dispatcher and fix a bug in the patch.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5669 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Pei/PeiMain/PeiMain.c')
-rw-r--r--MdeModulePkg/Core/Pei/PeiMain/PeiMain.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
index d257eaee43..6e032783d0 100644
--- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
+++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
@@ -21,8 +21,7 @@ STATIC EFI_PEI_PPI_DESCRIPTOR mMemoryDiscoveredPpi = {
};
///
-/// Pei Core Module Variables
-///
+/// Pei service instance
///
STATIC EFI_PEI_SERVICES gPs = {
{
@@ -67,11 +66,10 @@ STATIC EFI_PEI_SERVICES gPs = {
/**
- The entry routine to Pei Core, invoked by PeiMain during transition
+ This routine is invoked by main entry of PeiMain module during transition
from SEC to PEI. After switching stack in the PEI core, it will restart
with the old core data.
-
@param SecCoreData Points to a data structure containing information about the PEI core's operating
environment, such as the size and location of temporary RAM, the stack location and
the BFV location.
@@ -83,6 +81,7 @@ STATIC EFI_PEI_SERVICES gPs = {
calls and/or code in these early PPIs
@param Data Pointer to old core data that is used to initialize the
core's data areas.
+ If NULL, it is first PeiCore entering.
@retval EFI_NOT_FOUND Never reach
@@ -98,13 +97,13 @@ PeiCore (
PEI_CORE_INSTANCE PrivateData;
EFI_STATUS Status;
PEI_CORE_TEMP_POINTERS TempPtr;
- UINT64 mTick;
+ UINT64 Tick;
PEI_CORE_INSTANCE *OldCoreData;
EFI_PEI_CPU_IO_PPI *CpuIo;
EFI_PEI_PCI_CFG2_PPI *PciCfg;
PEICORE_FUNCTION_POINTER ShadowedPeiCore;
- mTick = 0;
+ Tick = 0;
OldCoreData = (PEI_CORE_INSTANCE *) Data;
//
@@ -113,16 +112,17 @@ PeiCore (
//
if (PerformanceMeasurementEnabled()) {
if (OldCoreData == NULL) {
- mTick = GetPerformanceCounter ();
+ Tick = GetPerformanceCounter ();
}
}
- //
- // PeiCore has been shadowed to memory for first entering, so
- // just jump to PeiCore in memory here.
- //
if (OldCoreData != NULL) {
ShadowedPeiCore = (PEICORE_FUNCTION_POINTER) (UINTN) OldCoreData->ShadowedPeiCore;
+
+ //
+ // PeiCore has been shadowed to memory for first entering, so
+ // just jump to PeiCore in memory here.
+ //
if (ShadowedPeiCore != NULL) {
OldCoreData->ShadowedPeiCore = NULL;
ShadowedPeiCore (
@@ -142,6 +142,10 @@ PeiCore (
PrivateData.ServiceTableShadow.CpuIo = CpuIo;
PrivateData.ServiceTableShadow.PciCfg = PciCfg;
} else {
+ //
+ // If OldCoreData is NULL, means current is first Peicore's entering.
+ //
+
ZeroMem (&PrivateData, sizeof (PEI_CORE_INSTANCE));
PrivateData.Signature = PEI_CORE_HANDLE_SIGNATURE;
CopyMem (&PrivateData.ServiceTableShadow, &gPs, sizeof (gPs));
@@ -186,11 +190,11 @@ PeiCore (
FixedPcdGet32 (PcdStatusCodeValuePeiCoreEntry)
);
- PERF_START (NULL,"PEI", NULL, mTick);
+ PERF_START (NULL,"PEI", NULL, Tick);
//
// If first pass, start performance measurement.
//
- PERF_START (NULL,"PreMem", NULL, mTick);
+ PERF_START (NULL,"PreMem", NULL, Tick);
//
// If SEC provided any PPI services to PEI, install them.