]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/PlatformPei/Platform.c
OvmfPkg/PlatformPei: align EmuVariableNvStore at any page boundary
[mirror_edk2.git] / OvmfPkg / PlatformPei / Platform.c
index 1b4dc00b01803356c1ec69b4a6879ca358591dfb..3e9fda7c7ab019c11fe4b32b5ca75d7a33a88196 100644 (file)
@@ -504,7 +504,6 @@ ReserveEmuVariableNvStore (
 {\r
   EFI_PHYSICAL_ADDRESS VariableStore;\r
   RETURN_STATUS        PcdStatus;\r
-  UINT32               Alignment;\r
 \r
   //\r
   // Allocate storage for NV variables early on so it will be\r
@@ -512,26 +511,15 @@ ReserveEmuVariableNvStore (
   // across reboots, this allows the NV variable storage to survive\r
   // a VM reboot.\r
   //\r
-  Alignment = PcdGet32 (PcdFlashNvStorageFtwSpareSize);\r
-  if ((Alignment & (Alignment - 1)) != 0) {\r
-    //\r
-    // Round up Alignment to the next power of two.\r
-    //\r
-    Alignment = GetPowerOfTwo32 (Alignment) << 1;\r
-  }\r
-\r
   VariableStore =\r
     (EFI_PHYSICAL_ADDRESS)(UINTN)\r
-      AllocateAlignedRuntimePages (\r
-        EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)),\r
-        Alignment\r
+      AllocateRuntimePages (\r
+        EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize))\r
         );\r
   DEBUG ((EFI_D_INFO,\r
-          "Reserved variable store memory: 0x%lX; size: %dkb, "\r
-          "alignment: 0x%x\n",\r
+          "Reserved variable store memory: 0x%lX; size: %dkb\n",\r
           VariableStore,\r
-          (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) / 1024,\r
-          Alignment\r
+          (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) / 1024\r
         ));\r
   PcdStatus = PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore);\r
   ASSERT_RETURN_ERROR (PcdStatus);\r