diff options
Diffstat (limited to 'OvmfPkg/PlatformPei/Fv.c')
-rw-r--r-- | OvmfPkg/PlatformPei/Fv.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/OvmfPkg/PlatformPei/Fv.c b/OvmfPkg/PlatformPei/Fv.c index 3ed775c850..248c585085 100644 --- a/OvmfPkg/PlatformPei/Fv.c +++ b/OvmfPkg/PlatformPei/Fv.c @@ -32,6 +32,8 @@ PeiFvInitialization ( VOID
)
{
+ BOOLEAN SecureS3Needed;
+
DEBUG ((EFI_D_INFO, "Platform PEI Firmware Volume Initialization\n"));
//
@@ -50,16 +52,39 @@ PeiFvInitialization ( //
BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSize));
+ SecureS3Needed = mS3Supported && FeaturePcdGet (PcdSmmSmramRequire);
+
//
// Create a memory allocation HOB for the DXE FV.
//
+ // If "secure" S3 is needed, then SEC will decompress both PEI and DXE
+ // firmware volumes at S3 resume too, hence we need to keep away the OS from
+ // DXEFV as well. Otherwise we only need to keep away DXE itself from the
+ // DXEFV area.
+ //
BuildMemoryAllocationHob (
PcdGet32 (PcdOvmfDxeMemFvBase),
PcdGet32 (PcdOvmfDxeMemFvSize),
- EfiBootServicesData
+ SecureS3Needed ? EfiACPIMemoryNVS : EfiBootServicesData
);
//
+ // Additionally, said decompression will use temporary memory above the end
+ // of DXEFV, so let's keep away the OS from there too.
+ //
+ if (SecureS3Needed) {
+ UINT32 DxeMemFvEnd;
+
+ DxeMemFvEnd = PcdGet32 (PcdOvmfDxeMemFvBase) +
+ PcdGet32 (PcdOvmfDxeMemFvSize);
+ BuildMemoryAllocationHob (
+ DxeMemFvEnd,
+ PcdGet32 (PcdOvmfDecompressionScratchEnd) - DxeMemFvEnd,
+ EfiACPIMemoryNVS
+ );
+ }
+
+ //
// Let PEI know about the DXE FV so it can find the DXE Core
//
PeiServicesInstallFvInfoPpi (
|