]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: PlatformPei: don't allocate fake lockbox if SMM_REQUIRE
authorLaszlo Ersek <lersek@redhat.com>
Mon, 30 Nov 2015 18:42:10 +0000 (18:42 +0000)
committerlersek <lersek@Edk2>
Mon, 30 Nov 2015 18:42:10 +0000 (18:42 +0000)
Since our fake LockBox must not be selected with -D SMM_REQUIRE (see the
previous patch), it makes sense to set aside memory for it only if -D
SMM_REQUIRE is absent. Modify InitializeRamRegions() accordingly.

This patch completes the -D SMM_REQUIRE-related tweaking of the special
OVMF memory areas.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19047 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/PlatformPei/MemDetect.c

index 1bdc2df6ed91910fa30411f29abcf377027cb63e..455fcbb49d13a590b7a118e3a7fbcf3efed00f9a 100644 (file)
@@ -407,25 +407,27 @@ InitializeRamRegions (
   }\r
 \r
   if (mBootMode != BOOT_ON_S3_RESUME) {\r
-    //\r
-    // Reserve the lock box storage area\r
-    //\r
-    // Since this memory range will be used on S3 resume, it must be\r
-    // reserved as ACPI NVS.\r
-    //\r
-    // If S3 is unsupported, then various drivers might still write to the\r
-    // LockBox area. We ought to prevent DXE from serving allocation requests\r
-    // such that they would overlap the LockBox storage.\r
-    //\r
-    ZeroMem (\r
-      (VOID*)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),\r
-      (UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize)\r
-      );\r
-    BuildMemoryAllocationHob (\r
-      (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),\r
-      (UINT64)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize),\r
-      mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData\r
-      );\r
+    if (!FeaturePcdGet (PcdSmmSmramRequire)) {\r
+      //\r
+      // Reserve the lock box storage area\r
+      //\r
+      // Since this memory range will be used on S3 resume, it must be\r
+      // reserved as ACPI NVS.\r
+      //\r
+      // If S3 is unsupported, then various drivers might still write to the\r
+      // LockBox area. We ought to prevent DXE from serving allocation requests\r
+      // such that they would overlap the LockBox storage.\r
+      //\r
+      ZeroMem (\r
+        (VOID*)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),\r
+        (UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize)\r
+        );\r
+      BuildMemoryAllocationHob (\r
+        (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),\r
+        (UINT64)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize),\r
+        mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData\r
+        );\r
+    }\r
 \r
     if (FeaturePcdGet (PcdSmmSmramRequire)) {\r
       UINT32 TsegSize;\r