From 4a9fab7d72dc7f0bf4cae454e403bd939ca6f32d Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 26 Dec 2013 20:44:29 +0000 Subject: [PATCH] OvmfPkg: PlatformPei: reuse PublishPeiMemory() in MemDetect() Although SVN r14944 ("OvmfPkg: introduce PublishPeiMemory") copied a big chunk of code from MemDetect(), calling the new PublishPeiMemory() function in MemDetect() could not have replaced the original code in the latter. However, with the help of the previous patch, we can do it now. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15023 6f19259b-4bc3-4df7-8a09-765794883524 --- OvmfPkg/PlatformPei/MemDetect.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c index 7192b2bf73..a1de762681 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -101,6 +101,9 @@ PublishPeiMemory ( LowerMemorySize = GetSystemMemorySizeBelow4gb (); + // + // Determine the range of memory to use during PEI + // MemoryBase = PcdGet32 (PcdOvmfMemFvBase) + PcdGet32 (PcdOvmfMemFvSize); MemorySize = LowerMemorySize - MemoryBase; if (MemorySize > SIZE_64MB) { @@ -128,9 +131,6 @@ EFI_PHYSICAL_ADDRESS MemDetect ( ) { - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS MemoryBase; - UINT64 MemorySize; UINT64 LowerMemorySize; UINT64 UpperMemorySize; @@ -142,21 +142,7 @@ MemDetect ( LowerMemorySize = GetSystemMemorySizeBelow4gb (); UpperMemorySize = GetSystemMemorySizeAbove4gb (); - // - // Determine the range of memory to use during PEI - // - MemoryBase = PcdGet32 (PcdOvmfMemFvBase) + PcdGet32 (PcdOvmfMemFvSize); - MemorySize = LowerMemorySize - MemoryBase; - if (MemorySize > SIZE_64MB) { - MemoryBase = LowerMemorySize - SIZE_64MB; - MemorySize = SIZE_64MB; - } - - // - // Publish this memory to the PEI Core - // - Status = PublishSystemMemory(MemoryBase, MemorySize); - ASSERT_EFI_ERROR (Status); + PublishPeiMemory (); // // Create memory HOBs -- 2.39.2