2 Build FV related hobs for platform.
4 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/DebugLib.h>
12 #include <Library/HobLib.h>
13 #include <Library/PeiServicesLib.h>
14 #include <Library/PcdLib.h>
17 Publish PEI & DXE (Decompressed) Memory based FVs to let PEI
18 and DXE know about them.
20 @retval EFI_SUCCESS Platform PEI FVs were initialized successfully.
28 BOOLEAN SecureS3Needed
;
30 DEBUG ((DEBUG_INFO
, "Platform PEI Firmware Volume Initialization\n"));
33 // Create a memory allocation HOB for the PEI FV.
35 // Allocate as ACPI NVS is S3 is supported
37 BuildMemoryAllocationHob (
38 PcdGet32 (PcdOvmfPeiMemFvBase
),
39 PcdGet32 (PcdOvmfPeiMemFvSize
),
40 mPlatformInfoHob
.S3Supported
? EfiACPIMemoryNVS
: EfiBootServicesData
44 // Let DXE know about the DXE FV
46 BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase
), PcdGet32 (PcdOvmfDxeMemFvSize
));
48 SecureS3Needed
= mPlatformInfoHob
.S3Supported
&& mPlatformInfoHob
.SmmSmramRequire
;
51 // Create a memory allocation HOB for the DXE FV.
53 // If "secure" S3 is needed, then SEC will decompress both PEI and DXE
54 // firmware volumes at S3 resume too, hence we need to keep away the OS from
55 // DXEFV as well. Otherwise we only need to keep away DXE itself from the
58 BuildMemoryAllocationHob (
59 PcdGet32 (PcdOvmfDxeMemFvBase
),
60 PcdGet32 (PcdOvmfDxeMemFvSize
),
61 SecureS3Needed
? EfiACPIMemoryNVS
: EfiBootServicesData
65 // Additionally, said decompression will use temporary memory above the end
66 // of DXEFV, so let's keep away the OS from there too.
71 DxeMemFvEnd
= PcdGet32 (PcdOvmfDxeMemFvBase
) +
72 PcdGet32 (PcdOvmfDxeMemFvSize
);
73 BuildMemoryAllocationHob (
75 PcdGet32 (PcdOvmfDecompressionScratchEnd
) - DxeMemFvEnd
,
81 // Let PEI know about the DXE FV so it can find the DXE Core
83 PeiServicesInstallFvInfoPpi (
85 (VOID
*)(UINTN
)PcdGet32 (PcdOvmfDxeMemFvBase
),
86 PcdGet32 (PcdOvmfDxeMemFvSize
),