summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>2012-05-23 07:26:17 +0000
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>2012-05-23 07:26:17 +0000
commit74dee93181ad4914e9a708494e2056f1b3c4776f (patch)
treeb2b927cdc321e70771d508a1a1cb49ea686fdef4
parentbce3e2ab3c8b310d1561a42a243be9ea7ac71500 (diff)
downloadedk2-platforms-74dee93181ad4914e9a708494e2056f1b3c4776f.tar.xz
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 <elvin.li@intel.com> Reviewed-by: jyao1 <jiewen.yao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13352 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c21
1 files 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.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
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();