OvmfPkg: PlatformPei: don't allocate fake lockbox if SMM_REQUIRE

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
This commit is contained in:
Laszlo Ersek
2015-11-30 18:42:10 +00:00
committed by lersek
parent 542534456b
commit 1a7edbbca1

View File

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