]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/PlatformPei/Fv.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / PlatformPei / Fv.c
CommitLineData
49ba9447 1/** @file\r
2 Build FV related hobs for platform.\r
3\r
b36f701d 4 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
b26f0cf9 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
49ba9447 6\r
7**/\r
8\r
9#include "PiPei.h"\r
74e5c158 10#include "Platform.h"\r
49ba9447 11#include <Library/DebugLib.h>\r
49ba9447 12#include <Library/HobLib.h>\r
13#include <Library/PeiServicesLib.h>\r
49ba9447 14#include <Library/PcdLib.h>\r
15\r
49ba9447 16/**\r
b36f701d
JJ
17 Publish PEI & DXE (Decompressed) Memory based FVs to let PEI\r
18 and DXE know about them.\r
49ba9447 19\r
20 @retval EFI_SUCCESS Platform PEI FVs were initialized successfully.\r
21\r
22**/\r
23EFI_STATUS\r
24PeiFvInitialization (\r
25 VOID\r
26 )\r
27{\r
ac0a286f 28 BOOLEAN SecureS3Needed;\r
efb0f16e 29\r
70d5086c 30 DEBUG ((DEBUG_INFO, "Platform PEI Firmware Volume Initialization\n"));\r
49ba9447 31\r
b36f701d
JJ
32 //\r
33 // Create a memory allocation HOB for the PEI FV.\r
34 //\r
74e5c158 35 // Allocate as ACPI NVS is S3 is supported\r
b36f701d
JJ
36 //\r
37 BuildMemoryAllocationHob (\r
38 PcdGet32 (PcdOvmfPeiMemFvBase),\r
39 PcdGet32 (PcdOvmfPeiMemFvSize),\r
74e5c158 40 mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData\r
49ba9447 41 );\r
42\r
b36f701d
JJ
43 //\r
44 // Let DXE know about the DXE FV\r
45 //\r
46 BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSize));\r
49ba9447 47\r
efb0f16e
LE
48 SecureS3Needed = mS3Supported && FeaturePcdGet (PcdSmmSmramRequire);\r
49\r
c1c2669c 50 //\r
b36f701d 51 // Create a memory allocation HOB for the DXE FV.\r
c1c2669c 52 //\r
efb0f16e
LE
53 // If "secure" S3 is needed, then SEC will decompress both PEI and DXE\r
54 // firmware volumes at S3 resume too, hence we need to keep away the OS from\r
55 // DXEFV as well. Otherwise we only need to keep away DXE itself from the\r
56 // DXEFV area.\r
57 //\r
c1c2669c 58 BuildMemoryAllocationHob (\r
b36f701d
JJ
59 PcdGet32 (PcdOvmfDxeMemFvBase),\r
60 PcdGet32 (PcdOvmfDxeMemFvSize),\r
efb0f16e 61 SecureS3Needed ? EfiACPIMemoryNVS : EfiBootServicesData\r
49ba9447 62 );\r
63\r
efb0f16e
LE
64 //\r
65 // Additionally, said decompression will use temporary memory above the end\r
66 // of DXEFV, so let's keep away the OS from there too.\r
67 //\r
68 if (SecureS3Needed) {\r
ac0a286f 69 UINT32 DxeMemFvEnd;\r
efb0f16e
LE
70\r
71 DxeMemFvEnd = PcdGet32 (PcdOvmfDxeMemFvBase) +\r
72 PcdGet32 (PcdOvmfDxeMemFvSize);\r
73 BuildMemoryAllocationHob (\r
74 DxeMemFvEnd,\r
75 PcdGet32 (PcdOvmfDecompressionScratchEnd) - DxeMemFvEnd,\r
76 EfiACPIMemoryNVS\r
77 );\r
78 }\r
79\r
b36f701d
JJ
80 //\r
81 // Let PEI know about the DXE FV so it can find the DXE Core\r
82 //\r
83 PeiServicesInstallFvInfoPpi (\r
84 NULL,\r
ac0a286f 85 (VOID *)(UINTN)PcdGet32 (PcdOvmfDxeMemFvBase),\r
b36f701d
JJ
86 PcdGet32 (PcdOvmfDxeMemFvSize),\r
87 NULL,\r
88 NULL\r
89 );\r
90\r
49ba9447 91 return EFI_SUCCESS;\r
92}\r