From 3152f167db23cfb4d777dd4ad5131b4a026ac6f0 Mon Sep 17 00:00:00 2001 From: klu2 Date: Thu, 12 Mar 2009 07:43:02 +0000 Subject: [PATCH] PeiInstallPeiMemory should only be called one time. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7867 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Pei/Memory/MemoryServices.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c index 22e04cd46a..02e83a18fc 100644 --- a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c +++ b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c @@ -89,6 +89,17 @@ PeiInstallPeiMemory ( DEBUG ((EFI_D_INFO, "PeiInstallPeiMemory MemoryBegin 0x%LX, MemoryLength 0x%LX\n", MemoryBegin, MemoryLength)); PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices); + // + // PEI_SERVICE.InstallPeiMemory should only be called one time during whole PEI phase. + // If it is invoked more than one time, ASSERT information is given for developer debugging in debug tip and + // simply return EFI_SUCESS in release tip to ignore it. + // + if (PrivateData->PeiMemoryInstalled) { + DEBUG ((EFI_D_ERROR, "ERROR: PeiInstallPeiMemory is called more than once!\n")); + ASSERT (PrivateData->PeiMemoryInstalled); + return EFI_SUCCESS; + } + PrivateData->PhysicalMemoryBegin = MemoryBegin; PrivateData->PhysicalMemoryLength = MemoryLength; PrivateData->FreePhysicalMemoryTop = MemoryBegin + MemoryLength;