2 Build FV related hobs for platform.
4 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Library/DebugLib.h>
18 #include <Library/HobLib.h>
19 #include <Library/PeiServicesLib.h>
20 #include <Library/PcdLib.h>
24 Publish PEI & DXE (Decompressed) Memory based FVs to let PEI
25 and DXE know about them.
27 @retval EFI_SUCCESS Platform PEI FVs were initialized successfully.
35 BOOLEAN SecureS3Needed
;
37 DEBUG ((EFI_D_INFO
, "Platform PEI Firmware Volume Initialization\n"));
40 // Create a memory allocation HOB for the PEI FV.
42 // Allocate as ACPI NVS is S3 is supported
44 BuildMemoryAllocationHob (
45 PcdGet32 (PcdOvmfPeiMemFvBase
),
46 PcdGet32 (PcdOvmfPeiMemFvSize
),
47 mS3Supported
? EfiACPIMemoryNVS
: EfiBootServicesData
51 // Let DXE know about the DXE FV
53 BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase
), PcdGet32 (PcdOvmfDxeMemFvSize
));
55 SecureS3Needed
= mS3Supported
&& FeaturePcdGet (PcdSmmSmramRequire
);
58 // Create a memory allocation HOB for the DXE FV.
60 // If "secure" S3 is needed, then SEC will decompress both PEI and DXE
61 // firmware volumes at S3 resume too, hence we need to keep away the OS from
62 // DXEFV as well. Otherwise we only need to keep away DXE itself from the
65 BuildMemoryAllocationHob (
66 PcdGet32 (PcdOvmfDxeMemFvBase
),
67 PcdGet32 (PcdOvmfDxeMemFvSize
),
68 SecureS3Needed
? EfiACPIMemoryNVS
: EfiBootServicesData
72 // Additionally, said decompression will use temporary memory above the end
73 // of DXEFV, so let's keep away the OS from there too.
78 DxeMemFvEnd
= PcdGet32 (PcdOvmfDxeMemFvBase
) +
79 PcdGet32 (PcdOvmfDxeMemFvSize
);
80 BuildMemoryAllocationHob (
82 PcdGet32 (PcdOvmfDecompressionScratchEnd
) - DxeMemFvEnd
,
88 // Let PEI know about the DXE FV so it can find the DXE Core
90 PeiServicesInstallFvInfoPpi (
92 (VOID
*)(UINTN
) PcdGet32 (PcdOvmfDxeMemFvBase
),
93 PcdGet32 (PcdOvmfDxeMemFvSize
),