diff options
author | Laszlo Ersek <lersek@redhat.com> | 2017-07-04 12:44:05 +0200 |
---|---|---|
committer | Laszlo Ersek <lersek@redhat.com> | 2017-07-05 22:21:27 +0200 |
commit | 23bfb5c0aab6bda348ac03e160d4a8432031fac1 (patch) | |
tree | 8a8041b87abafc79fa52e52e156b8bc9bdc9b266 /OvmfPkg/PlatformPei/MemDetect.c | |
parent | 5b31f660c92c7c8b9cfc727cb6802602e64eee0d (diff) | |
download | edk2-23bfb5c0aab6bda348ac03e160d4a8432031fac1.tar.gz edk2-23bfb5c0aab6bda348ac03e160d4a8432031fac1.tar.bz2 edk2-23bfb5c0aab6bda348ac03e160d4a8432031fac1.zip |
OvmfPkg/PlatformPei: prepare for PcdQ35TsegMbytes becoming dynamic
In one of the next patches we'll turn PcdQ35TsegMbytes into a dynamic PCD,
to be set by PlatformPei. Introduce the Q35TsegMbytesInitialization()
function and the "mQ35TsegMbytes" global variable to support this.
Q35TsegMbytesInitialization() manages the PCD and caches its final value
into "mQ35TsegMbytes". Call Q35TsegMbytesInitialization() from
InitializePlatform() just in time for the current PCD consumers,
PublishPeiMemory(), InitializeRamRegions() and QemuInitializeRam() --
which is called from InitializeRamRegions() -- to be rebased on top of
"mQ35TsegMbytes".
Call Q35TsegMbytesInitialization() only when PcdSmmSmramRequire is TRUE,
given that PcdQ35TsegMbytes is consumed in that case only.
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>
Diffstat (limited to 'OvmfPkg/PlatformPei/MemDetect.c')
-rw-r--r-- | OvmfPkg/PlatformPei/MemDetect.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c index 78a8e0de34..886d236226 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -42,6 +42,17 @@ UINT8 mPhysMemAddressWidth; STATIC UINT32 mS3AcpiReservedMemoryBase;
STATIC UINT32 mS3AcpiReservedMemorySize;
+STATIC UINT16 mQ35TsegMbytes;
+
+VOID
+Q35TsegMbytesInitialization (
+ VOID
+ )
+{
+ mQ35TsegMbytes = PcdGet16 (PcdQ35TsegMbytes);
+}
+
+
UINT32
GetSystemMemorySizeBelow4gb (
VOID
@@ -348,7 +359,7 @@ PublishPeiMemory ( //
// TSEG is chipped from the end of low RAM
//
- LowerMemorySize -= FixedPcdGet16 (PcdQ35TsegMbytes) * SIZE_1MB;
+ LowerMemorySize -= mQ35TsegMbytes * SIZE_1MB;
}
//
@@ -456,7 +467,7 @@ QemuInitializeRam ( if (FeaturePcdGet (PcdSmmSmramRequire)) {
UINT32 TsegSize;
- TsegSize = FixedPcdGet16 (PcdQ35TsegMbytes) * SIZE_1MB;
+ TsegSize = mQ35TsegMbytes * SIZE_1MB;
AddMemoryRangeHob (BASE_1MB, LowerMemorySize - TsegSize);
AddReservedMemoryBaseSizeHob (LowerMemorySize - TsegSize, TsegSize,
TRUE);
@@ -605,7 +616,7 @@ InitializeRamRegions ( // Make sure the TSEG area that we reported as a reserved memory resource
// cannot be used for reserved memory allocations.
//
- TsegSize = FixedPcdGet16 (PcdQ35TsegMbytes) * SIZE_1MB;
+ TsegSize = mQ35TsegMbytes * SIZE_1MB;
BuildMemoryAllocationHob (
GetSystemMemorySizeBelow4gb() - TsegSize,
TsegSize,
|