]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: PlatformPei: lifecycle fixes for the LockBox area
authorLaszlo Ersek <lersek@redhat.com>
Mon, 31 Mar 2014 20:35:50 +0000 (20:35 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 31 Mar 2014 20:35:50 +0000 (20:35 +0000)
If (mBootMode == BOOT_ON_S3_RESUME) -- that is, we are resuming --, then
the patch has no observable effect.

If (mBootMode != BOOT_ON_S3_RESUME && mS3Supported) -- that is, we are
booting or rebooting, and S3 is supported), then the patch has no
observable effect either.

If (mBootMode != BOOT_ON_S3_RESUME && !mS3Supported) -- that is, we are
booting or rebooting, and S3 is unsupported), then the patch effects the
following two fixes:

- The LockBox storage is reserved from DXE (but not the OS). Drivers in
  DXE may save data in the LockBox regardless of S3 support, potentially
  corrupting any overlapping allocations. Make sure there's no overlap.

- The LockBox storage is cleared. A LockBox inherited across a non-resume
  reboot, populated with well-known GUIDs, breaks drivers that want to
  save entries with those GUIDs.

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

OvmfPkg/PlatformPei/MemDetect.c

index c1350b931f3a445bc2e9800928aa80e58e109009..15b279e4456c525ab18912bb4aafa096ad0204a3 100644 (file)
@@ -218,13 +218,19 @@ InitializeRamRegions (
       EfiACPIMemoryNVS\r
       );\r
 #endif\r
+  }\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
@@ -232,7 +238,7 @@ InitializeRamRegions (
     BuildMemoryAllocationHob (\r
       (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),\r
       (UINT64)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize),\r
-      EfiACPIMemoryNVS\r
+      mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData\r
       );\r
   }\r
 }\r