DEBUG ((EFI_D_INFO, "PeiInstallPeiMemory MemoryBegin 0x%LX, MemoryLength 0x%LX\n", MemoryBegin, MemoryLength));\r
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);\r
\r
+ //\r
+ // PEI_SERVICE.InstallPeiMemory should only be called one time during whole PEI phase.\r
+ // If it is invoked more than one time, ASSERT information is given for developer debugging in debug tip and\r
+ // simply return EFI_SUCESS in release tip to ignore it.\r
+ // \r
+ if (PrivateData->PeiMemoryInstalled) {\r
+ DEBUG ((EFI_D_ERROR, "ERROR: PeiInstallPeiMemory is called more than once!\n"));\r
+ ASSERT (PrivateData->PeiMemoryInstalled);\r
+ return EFI_SUCCESS;\r
+ }\r
+ \r
PrivateData->PhysicalMemoryBegin = MemoryBegin;\r
PrivateData->PhysicalMemoryLength = MemoryLength;\r
PrivateData->FreePhysicalMemoryTop = MemoryBegin + MemoryLength;\r
//\r
if (!PrivateData->PeiMemoryInstalled) {\r
//\r
- // When PeiInstallMemory is called but CAR has *not* been moved to temporary memory,\r
+ // When PeiInstallMemory is called but temporary memory has *not* been moved to temporary memory,\r
// the AllocatePage will depend on the field of PEI_CORE_INSTANCE structure.\r
//\r
if (!PrivateData->SwitchStackSignal) {\r
/**\r
\r
Pool allocation service. Before permenent memory is discoveried, the pool will \r
- be allocated the heap in the CAR. Genenrally, the size of heap in temporary \r
+ be allocated the heap in the temporary memory. Genenrally, the size of heap in temporary \r
memory does not exceed to 64K, so the biggest pool size could be allocated is \r
64K.\r
\r