X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=OvmfPkg%2FPlatformPei%2FFv.c;h=248c58508558a2741848073776a8db3d4a17193e;hb=97cdb33b575a80ca5c20ad862331f3c6d9415575;hp=fbdb597043ec5a124d5422c65b1484b3e339e796;hpb=b36f701d4f925172516cfdee72915e3217c92551;p=mirror_edk2.git diff --git a/OvmfPkg/PlatformPei/Fv.c b/OvmfPkg/PlatformPei/Fv.c index fbdb597043..248c585085 100644 --- a/OvmfPkg/PlatformPei/Fv.c +++ b/OvmfPkg/PlatformPei/Fv.c @@ -13,6 +13,7 @@ **/ #include "PiPei.h" +#include "Platform.h" #include #include #include @@ -31,17 +32,19 @@ PeiFvInitialization ( VOID ) { + BOOLEAN SecureS3Needed; + DEBUG ((EFI_D_INFO, "Platform PEI Firmware Volume Initialization\n")); // // Create a memory allocation HOB for the PEI FV. // - // This is marked as ACPI NVS so it will still be available on S3 resume. + // Allocate as ACPI NVS is S3 is supported // BuildMemoryAllocationHob ( PcdGet32 (PcdOvmfPeiMemFvBase), PcdGet32 (PcdOvmfPeiMemFvSize), - EfiACPIMemoryNVS + mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData ); // @@ -49,15 +52,38 @@ 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 //