]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update the way to allocate high PMM, firstly try to allocate high PMM below 16MB...
authorli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 23 May 2012 07:26:17 +0000 (07:26 +0000)
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 23 May 2012 07:26:17 +0000 (07:26 +0000)
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

IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c

index 194fee647be416b56779daca0491a53844d831ae..c90231af07dcd2bb35a410e6efee4aaccc0ae269 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -922,21 +922,32 @@ LegacyBiosInstall (
   EfiToLegacy16InitTable->LowPmmMemory            = (UINT32) MemoryAddressUnder1MB;\r
   EfiToLegacy16InitTable->LowPmmMemorySizeInBytes = MemorySize;\r
 \r
+  MemorySize = PcdGet32 (PcdHighPmmMemorySize);\r
+  ASSERT ((MemorySize & 0xFFF) == 0);\r
   //\r
   // Allocate high PMM Memory under 16 MB\r
-  //\r
-  MemorySize = PcdGet32 (PcdHighPmmMemorySize);\r
-  ASSERT ((MemorySize & 0xFFF) == 0);    \r
+  //   \r
   Status = AllocateLegacyMemory (\r
              AllocateMaxAddress,\r
              0x1000000,\r
              EFI_SIZE_TO_PAGES (MemorySize),\r
              &MemoryAddress\r
              );\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // If it fails, allocate high PMM Memory under 4GB\r
+    //   \r
+    Status = AllocateLegacyMemory (\r
+               AllocateMaxAddress,\r
+               0xFFFFFFFF,\r
+               EFI_SIZE_TO_PAGES (MemorySize),\r
+               &MemoryAddress\r
+               );    \r
+  }\r
   if (!EFI_ERROR (Status)) {\r
     EfiToLegacy16InitTable->HiPmmMemory            = (UINT32) (EFI_PHYSICAL_ADDRESS) (UINTN) MemoryAddress;\r
     EfiToLegacy16InitTable->HiPmmMemorySizeInBytes = MemorySize;\r
-  }\r
+  } \r
 \r
   //\r
   //  ShutdownAPs();\r