]>
Commit | Line | Data |
---|---|---|
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 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include "PiPei.h"\r | |
16 | #include "Platform.h"\r | |
17 | #include <Library/DebugLib.h>\r | |
18 | #include <Library/HobLib.h>\r | |
19 | #include <Library/PeiServicesLib.h>\r | |
20 | #include <Library/PcdLib.h>\r | |
21 | \r | |
22 | \r | |
23 | /**\r | |
24 | Publish PEI & DXE (Decompressed) Memory based FVs to let PEI\r | |
25 | and DXE know about them.\r | |
26 | \r | |
27 | @retval EFI_SUCCESS Platform PEI FVs were initialized successfully.\r | |
28 | \r | |
29 | **/\r | |
30 | EFI_STATUS\r | |
31 | PeiFvInitialization (\r | |
32 | VOID\r | |
33 | )\r | |
34 | {\r | |
35 | BOOLEAN SecureS3Needed;\r | |
36 | \r | |
37 | DEBUG ((EFI_D_INFO, "Platform PEI Firmware Volume Initialization\n"));\r | |
38 | \r | |
39 | //\r | |
40 | // Create a memory allocation HOB for the PEI FV.\r | |
41 | //\r | |
42 | // Allocate as ACPI NVS is S3 is supported\r | |
43 | //\r | |
44 | BuildMemoryAllocationHob (\r | |
45 | PcdGet32 (PcdOvmfPeiMemFvBase),\r | |
46 | PcdGet32 (PcdOvmfPeiMemFvSize),\r | |
47 | mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData\r | |
48 | );\r | |
49 | \r | |
50 | //\r | |
51 | // Let DXE know about the DXE FV\r | |
52 | //\r | |
53 | BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSize));\r | |
54 | \r | |
55 | SecureS3Needed = mS3Supported && FeaturePcdGet (PcdSmmSmramRequire);\r | |
56 | \r | |
57 | //\r | |
58 | // Create a memory allocation HOB for the DXE FV.\r | |
59 | //\r | |
60 | // If "secure" S3 is needed, then SEC will decompress both PEI and DXE\r | |
61 | // firmware volumes at S3 resume too, hence we need to keep away the OS from\r | |
62 | // DXEFV as well. Otherwise we only need to keep away DXE itself from the\r | |
63 | // DXEFV area.\r | |
64 | //\r | |
65 | BuildMemoryAllocationHob (\r | |
66 | PcdGet32 (PcdOvmfDxeMemFvBase),\r | |
67 | PcdGet32 (PcdOvmfDxeMemFvSize),\r | |
68 | SecureS3Needed ? EfiACPIMemoryNVS : EfiBootServicesData\r | |
69 | );\r | |
70 | \r | |
71 | //\r | |
72 | // Additionally, said decompression will use temporary memory above the end\r | |
73 | // of DXEFV, so let's keep away the OS from there too.\r | |
74 | //\r | |
75 | if (SecureS3Needed) {\r | |
76 | UINT32 DxeMemFvEnd;\r | |
77 | \r | |
78 | DxeMemFvEnd = PcdGet32 (PcdOvmfDxeMemFvBase) +\r | |
79 | PcdGet32 (PcdOvmfDxeMemFvSize);\r | |
80 | BuildMemoryAllocationHob (\r | |
81 | DxeMemFvEnd,\r | |
82 | PcdGet32 (PcdOvmfDecompressionScratchEnd) - DxeMemFvEnd,\r | |
83 | EfiACPIMemoryNVS\r | |
84 | );\r | |
85 | }\r | |
86 | \r | |
87 | //\r | |
88 | // Let PEI know about the DXE FV so it can find the DXE Core\r | |
89 | //\r | |
90 | PeiServicesInstallFvInfoPpi (\r | |
91 | NULL,\r | |
92 | (VOID *)(UINTN) PcdGet32 (PcdOvmfDxeMemFvBase),\r | |
93 | PcdGet32 (PcdOvmfDxeMemFvSize),\r | |
94 | NULL,\r | |
95 | NULL\r | |
96 | );\r | |
97 | \r | |
98 | return EFI_SUCCESS;\r | |
99 | }\r | |
100 | \r |