TianoCore EDK2 master
Loading...
Searching...
No Matches
Fv.c
Go to the documentation of this file.
1
9#include "PiPei.h"
10#include "Platform.h"
11#include <Library/DebugLib.h>
12#include <Library/HobLib.h>
14#include <Library/PcdLib.h>
15
25 IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
26 )
27{
28 BOOLEAN SecureS3Needed;
29
30 DEBUG ((DEBUG_INFO, "Platform PEI Firmware Volume Initialization\n"));
31
32 //
33 // Create a memory allocation HOB for the PEI FV.
34 //
35 // Allocate as ACPI NVS is S3 is supported
36 //
38 PcdGet32 (PcdOvmfPeiMemFvBase),
39 PcdGet32 (PcdOvmfPeiMemFvSize),
40 PlatformInfoHob->S3Supported ? EfiACPIMemoryNVS : EfiBootServicesData
41 );
42
43 //
44 // Let DXE know about the DXE FV
45 //
46 BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSize));
47
48 SecureS3Needed = PlatformInfoHob->S3Supported && PlatformInfoHob->SmmSmramRequire;
49
50 //
51 // Create a memory allocation HOB for the DXE FV.
52 //
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
56 // DXEFV area.
57 //
59 PcdGet32 (PcdOvmfDxeMemFvBase),
60 PcdGet32 (PcdOvmfDxeMemFvSize),
61 SecureS3Needed ? EfiACPIMemoryNVS : EfiBootServicesData
62 );
63
64 //
65 // Additionally, said decompression will use temporary memory above the end
66 // of DXEFV, so let's keep away the OS from there too.
67 //
68 if (SecureS3Needed) {
69 UINT32 DxeMemFvEnd;
70
71 DxeMemFvEnd = PcdGet32 (PcdOvmfDxeMemFvBase) +
72 PcdGet32 (PcdOvmfDxeMemFvSize);
74 DxeMemFvEnd,
75 PcdGet32 (PcdOvmfDecompressionScratchEnd) - DxeMemFvEnd,
77 );
78 }
79
80 //
81 // Let PEI know about the DXE FV so it can find the DXE Core
82 //
84 NULL,
85 (VOID *)(UINTN)PcdGet32 (PcdOvmfDxeMemFvBase),
86 PcdGet32 (PcdOvmfDxeMemFvSize),
87 NULL,
88 NULL
89 );
90
91 return EFI_SUCCESS;
92}
UINT64 UINTN
VOID EFIAPI BuildFvHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
Definition: HobLib.c:404
VOID EFIAPI BuildMemoryAllocationHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN EFI_MEMORY_TYPE MemoryType)
Definition: HobLib.c:601
EFI_STATUS PeiFvInitialization(VOID)
Definition: Fv.c:24
VOID EFIAPI PeiServicesInstallFvInfoPpi(IN CONST EFI_GUID *FvFormat OPTIONAL, IN CONST VOID *FvInfo, IN UINT32 FvInfoSize, IN CONST EFI_GUID *ParentFvName OPTIONAL, IN CONST EFI_GUID *ParentFileName OPTIONAL)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define DEBUG(Expression)
Definition: DebugLib.h:434
#define PcdGet32(TokenName)
Definition: PcdLib.h:362
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
@ EfiBootServicesData
@ EfiACPIMemoryNVS