]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
UefiCpuPkg/MpInitLib: Fix MemTest86 failure.
[mirror_edk2.git] / UefiCpuPkg / Library / MpInitLib / DxeMpLib.c
index b2307cbb618db18205b9d065694a4630f8d74494..cef5b49dde4be0225b2b1fec4935c5032b13b206 100644 (file)
@@ -76,7 +76,7 @@ SaveCpuMpData (
 }\r
 \r
 /**\r
-  Get available system memory below 1MB by specified size.\r
+  Get available system memory below 0x88000 by specified size.\r
 \r
   @param[in] WakeupBufferSize   Wakeup buffer size required\r
 \r
@@ -91,7 +91,15 @@ GetWakeupBuffer (
   EFI_STATUS              Status;\r
   EFI_PHYSICAL_ADDRESS    StartAddress;\r
 \r
-  StartAddress = BASE_1MB;\r
+  //\r
+  // Try to allocate buffer below 1M for waking vector.\r
+  // LegacyBios driver only reports warning when page allocation in range\r
+  // [0x60000, 0x88000) fails.\r
+  // This library is consumed by CpuDxe driver to produce CPU Arch protocol.\r
+  // LagacyBios driver depends on CPU Arch protocol which guarantees below\r
+  // allocation runs earlier than LegacyBios driver.\r
+  //\r
+  StartAddress = 0x88000;\r
   Status = gBS->AllocatePages (\r
                   AllocateMaxAddress,\r
                   EfiBootServicesData,\r
@@ -99,17 +107,13 @@ GetWakeupBuffer (
                   &StartAddress\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
-  if (!EFI_ERROR (Status)) {\r
-    Status = gBS->FreePages(\r
-               StartAddress,\r
-               EFI_SIZE_TO_PAGES (WakeupBufferSize)\r
-               );\r
-    ASSERT_EFI_ERROR (Status);\r
-    DEBUG ((DEBUG_INFO, "WakeupBufferStart = %x, WakeupBufferSize = %x\n",\r
-                        (UINTN) StartAddress, WakeupBufferSize));\r
-  } else {\r
+  if (EFI_ERROR (Status)) {\r
     StartAddress = (EFI_PHYSICAL_ADDRESS) -1;\r
   }\r
+\r
+  DEBUG ((DEBUG_INFO, "WakeupBufferStart = %x, WakeupBufferSize = %x\n",\r
+                      (UINTN) StartAddress, WakeupBufferSize));\r
+\r
   return (UINTN) StartAddress;\r
 }\r
 \r