]>
Commit | Line | Data |
---|---|---|
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 | |
16 | \r | |
17 | /**\r | |
b36f701d JJ |
18 | Publish PEI & DXE (Decompressed) Memory based FVs to let PEI\r |
19 | and DXE know about them.\r | |
49ba9447 | 20 | \r |
21 | @retval EFI_SUCCESS Platform PEI FVs were initialized successfully.\r | |
22 | \r | |
23 | **/\r | |
24 | EFI_STATUS\r | |
25 | PeiFvInitialization (\r | |
26 | VOID\r | |
27 | )\r | |
28 | {\r | |
efb0f16e LE |
29 | BOOLEAN SecureS3Needed;\r |
30 | \r | |
70d5086c | 31 | DEBUG ((DEBUG_INFO, "Platform PEI Firmware Volume Initialization\n"));\r |
49ba9447 | 32 | \r |
b36f701d JJ |
33 | //\r |
34 | // Create a memory allocation HOB for the PEI FV.\r | |
35 | //\r | |
74e5c158 | 36 | // Allocate as ACPI NVS is S3 is supported\r |
b36f701d JJ |
37 | //\r |
38 | BuildMemoryAllocationHob (\r | |
39 | PcdGet32 (PcdOvmfPeiMemFvBase),\r | |
40 | PcdGet32 (PcdOvmfPeiMemFvSize),\r | |
74e5c158 | 41 | mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData\r |
49ba9447 | 42 | );\r |
43 | \r | |
b36f701d JJ |
44 | //\r |
45 | // Let DXE know about the DXE FV\r | |
46 | //\r | |
47 | BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSize));\r | |
49ba9447 | 48 | \r |
efb0f16e LE |
49 | SecureS3Needed = mS3Supported && FeaturePcdGet (PcdSmmSmramRequire);\r |
50 | \r | |
c1c2669c | 51 | //\r |
b36f701d | 52 | // Create a memory allocation HOB for the DXE FV.\r |
c1c2669c | 53 | //\r |
efb0f16e LE |
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 | |
c1c2669c | 59 | BuildMemoryAllocationHob (\r |
b36f701d JJ |
60 | PcdGet32 (PcdOvmfDxeMemFvBase),\r |
61 | PcdGet32 (PcdOvmfDxeMemFvSize),\r | |
efb0f16e | 62 | SecureS3Needed ? EfiACPIMemoryNVS : EfiBootServicesData\r |
49ba9447 | 63 | );\r |
64 | \r | |
efb0f16e LE |
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 | |
b36f701d JJ |
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 | |
49ba9447 | 92 | return EFI_SUCCESS;\r |
93 | }\r | |
94 | \r |