]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/PlatformPei: assert there's no permanent PEI RAM at default SMBASE
authorLaszlo Ersek <lersek@redhat.com>
Fri, 20 Sep 2019 15:07:43 +0000 (17:07 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 5 Feb 2020 12:59:32 +0000 (12:59 +0000)
The permanent PEI RAM that is published on the normal boot path starts
strictly above MEMFD_BASE_ADDRESS (8 MB -- see the FDF files), regardless
of whether PEI decompression will be necessary on S3 resume due to
SMM_REQUIRE. Therefore the normal boot permanent PEI RAM never overlaps
with the SMRAM at the default SMBASE (192 KB).

The S3 resume permanent PEI RAM is strictly above the normal boot one.
Therefore the no-overlap statement holds true on the S3 resume path as
well.

Assert the no-overlap condition commonly for both boot paths in
PublishPeiMemory().

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1512
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Message-Id: <20200129214412.2361-7-lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
OvmfPkg/PlatformPei/MemDetect.c

index 2bc1c46dffc2e8c8d2adfb80fcda32e0f75f9370..4879ee87b797613fe9f024fcf47cebca92d8632d 100644 (file)
@@ -17,6 +17,7 @@ Module Name:
 #include <IndustryStandard/I440FxPiix4.h>\r
 #include <IndustryStandard/Q35MchIch9.h>\r
 #include <PiPei.h>\r
+#include <Register/Intel/SmramSaveStateMap.h>\r
 \r
 //\r
 // The Library classes this module consumes\r
@@ -626,6 +627,15 @@ PublishPeiMemory (
     }\r
   }\r
 \r
+  //\r
+  // MEMFD_BASE_ADDRESS separates the SMRAM at the default SMBASE from the\r
+  // normal boot permanent PEI RAM. Regarding the S3 boot path, the S3\r
+  // permanent PEI RAM is located even higher.\r
+  //\r
+  if (FeaturePcdGet (PcdSmmSmramRequire) && mQ35SmramAtDefaultSmbase) {\r
+    ASSERT (SMM_DEFAULT_SMBASE + MCH_DEFAULT_SMBASE_SIZE <= MemoryBase);\r
+  }\r
+\r
   //\r
   // Publish this memory to the PEI Core\r
   //\r