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