OvmfPkg/PlatformPei: don't allocate reserved mem varstore if SMM_REQUIRE
authorLaszlo Ersek <lersek@redhat.com>
Sun, 12 Mar 2017 21:01:40 +0000 (22:01 +0100)
committerLaszlo Ersek <lersek@redhat.com>
Thu, 18 May 2017 08:13:01 +0000 (10:13 +0200)
For the emulated variable store, PlatformPei allocates reserved memory (as
early as possible, so that the address remains the same during reboot),
and PcdEmuVariableNvStoreReserved carries the address to
EmuVariableFvbRuntimeDxe.

However, EmuVariableFvbRuntimeDxe is excluded from the SMM_REQUIRE build,
and then noone consumes PcdEmuVariableNvStoreReserved. Don't waste
reserved memory whenever that's the case.

(Even a dynamic default for PcdEmuVariableNvStoreReserved would be
unnecessary; but that way the PcdSet64S() call in the
ReserveEmuVariableNvStore() function doesn't compile.)

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgX64.dsc
OvmfPkg/PlatformPei/Platform.c

index 64427716c53c40f1e6059c26d60257b801060789..b46eef6cabc3dd39f48c3caebf78ff00bd509a91 100644 (file)
 ################################################################################\r
 \r
 [PcdsDynamicDefault]\r
+  # only set when\r
+  #   ($(SMM_REQUIRE) == FALSE)\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0\r
+\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0\r
index 887964cd27c2774a75040073dea1b9e6c6be4bf2..08f471fbc54267bc9910061ec3c7a44aa4701c51 100644 (file)
 ################################################################################\r
 \r
 [PcdsDynamicDefault]\r
+  # only set when\r
+  #   ($(SMM_REQUIRE) == FALSE)\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0\r
+\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0\r
index dc5fea3577d43037d326d5eeee956a1ea0207724..24053e5ff82d7f936d83d20dddc260dbbeebec1b 100644 (file)
 ################################################################################\r
 \r
 [PcdsDynamicDefault]\r
+  # only set when\r
+  #   ($(SMM_REQUIRE) == FALSE)\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0\r
+\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0\r
index 5e983a8dcea9bb9f79fcd7d255866315f22ad517..1b4dc00b01803356c1ec69b4a6879ca358591dfb 100644 (file)
@@ -672,7 +672,9 @@ InitializePlatform (
   mHostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);\r
 \r
   if (mBootMode != BOOT_ON_S3_RESUME) {\r
-    ReserveEmuVariableNvStore ();\r
+    if (!FeaturePcdGet (PcdSmmSmramRequire)) {\r
+      ReserveEmuVariableNvStore ();\r
+    }\r
     PeiFvInitialization ();\r
     MemMapInitialization ();\r
     NoexecDxeInitialization ();\r