diff options
author | Laszlo Ersek <lersek@redhat.com> | 2014-03-31 20:35:50 +0000 |
---|---|---|
committer | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-03-31 20:35:50 +0000 |
commit | 0e8a31f5c918edecd150c52e531bbaff0d5e0680 (patch) | |
tree | bad99bdb074ef6847c9e2e9668ef1d01750b7e11 | |
parent | cbbac2e1efea27460d330ea87fefc2d86cf6b8bd (diff) | |
download | edk2-0e8a31f5c918edecd150c52e531bbaff0d5e0680.tar.gz edk2-0e8a31f5c918edecd150c52e531bbaff0d5e0680.tar.bz2 edk2-0e8a31f5c918edecd150c52e531bbaff0d5e0680.zip |
OvmfPkg: PlatformPei: lifecycle fixes for the LockBox area
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
-rw-r--r-- | OvmfPkg/PlatformPei/MemDetect.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c index c1350b931f..15b279e445 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -218,13 +218,19 @@ InitializeRamRegions ( EfiACPIMemoryNVS
);
#endif
+ }
+ if (mBootMode != BOOT_ON_S3_RESUME) {
//
// Reserve the lock box storage area
//
// 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
+ // such that they would overlap the LockBox storage.
+ //
ZeroMem (
(VOID*)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),
(UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize)
@@ -232,7 +238,7 @@ InitializeRamRegions ( BuildMemoryAllocationHob (
(EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),
(UINT64)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize),
- EfiACPIMemoryNVS
+ mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData
);
}
}
|