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