From 74dee93181ad4914e9a708494e2056f1b3c4776f Mon Sep 17 00:00:00 2001 From: li-elvin Date: Wed, 23 May 2012 07:26:17 +0000 Subject: [PATCH] Update the way to allocate high PMM, firstly try to allocate high PMM below 16MB, if it fails, allocate high PMM below 4GB. Signed-off-by: li-elvin Reviewed-by: jyao1 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13352 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Csm/LegacyBiosDxe/LegacyBios.c | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c index 194fee647b..c90231af07 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions @@ -922,21 +922,32 @@ LegacyBiosInstall ( EfiToLegacy16InitTable->LowPmmMemory = (UINT32) MemoryAddressUnder1MB; EfiToLegacy16InitTable->LowPmmMemorySizeInBytes = MemorySize; + MemorySize = PcdGet32 (PcdHighPmmMemorySize); + ASSERT ((MemorySize & 0xFFF) == 0); // // Allocate high PMM Memory under 16 MB - // - MemorySize = PcdGet32 (PcdHighPmmMemorySize); - ASSERT ((MemorySize & 0xFFF) == 0); + // Status = AllocateLegacyMemory ( AllocateMaxAddress, 0x1000000, EFI_SIZE_TO_PAGES (MemorySize), &MemoryAddress ); + if (EFI_ERROR (Status)) { + // + // If it fails, allocate high PMM Memory under 4GB + // + Status = AllocateLegacyMemory ( + AllocateMaxAddress, + 0xFFFFFFFF, + EFI_SIZE_TO_PAGES (MemorySize), + &MemoryAddress + ); + } if (!EFI_ERROR (Status)) { EfiToLegacy16InitTable->HiPmmMemory = (UINT32) (EFI_PHYSICAL_ADDRESS) (UINTN) MemoryAddress; EfiToLegacy16InitTable->HiPmmMemorySizeInBytes = MemorySize; - } + } // // ShutdownAPs(); -- 2.39.2