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>
18 Publish PEI & DXE (Decompressed) Memory based FVs to let PEI
19 and DXE know about them.
21 @retval EFI_SUCCESS Platform PEI FVs were initialized successfully.
29 BOOLEAN SecureS3Needed
;
31 DEBUG ((EFI_D_INFO
, "Platform PEI Firmware Volume Initialization\n"));
34 // Create a memory allocation HOB for the PEI FV.
36 // Allocate as ACPI NVS is S3 is supported
38 BuildMemoryAllocationHob (
39 PcdGet32 (PcdOvmfPeiMemFvBase
),
40 PcdGet32 (PcdOvmfPeiMemFvSize
),
41 mS3Supported
? EfiACPIMemoryNVS
: EfiBootServicesData
45 // Let DXE know about the DXE FV
47 BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase
), PcdGet32 (PcdOvmfDxeMemFvSize
));
49 SecureS3Needed
= mS3Supported
&& FeaturePcdGet (PcdSmmSmramRequire
);
52 // Create a memory allocation HOB for the DXE FV.
54 // If "secure" S3 is needed, then SEC will decompress both PEI and DXE
55 // firmware volumes at S3 resume too, hence we need to keep away the OS from
56 // DXEFV as well. Otherwise we only need to keep away DXE itself from the
59 BuildMemoryAllocationHob (
60 PcdGet32 (PcdOvmfDxeMemFvBase
),
61 PcdGet32 (PcdOvmfDxeMemFvSize
),
62 SecureS3Needed
? EfiACPIMemoryNVS
: EfiBootServicesData
66 // Additionally, said decompression will use temporary memory above the end
67 // of DXEFV, so let's keep away the OS from there too.
72 DxeMemFvEnd
= PcdGet32 (PcdOvmfDxeMemFvBase
) +
73 PcdGet32 (PcdOvmfDxeMemFvSize
);
74 BuildMemoryAllocationHob (
76 PcdGet32 (PcdOvmfDecompressionScratchEnd
) - DxeMemFvEnd
,
82 // Let PEI know about the DXE FV so it can find the DXE Core
84 PeiServicesInstallFvInfoPpi (
86 (VOID
*)(UINTN
) PcdGet32 (PcdOvmfDxeMemFvBase
),
87 PcdGet32 (PcdOvmfDxeMemFvSize
),