]>
Commit | Line | Data |
---|---|---|
f6c488b7 KQ |
1 | /** @file\r |
2 | HOB Library implementation for Standalone MM Core.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r | |
5 | Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR>\r | |
6 | \r | |
7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
8 | \r | |
9 | **/\r | |
10 | \r | |
11 | #include <PiMm.h>\r | |
12 | \r | |
13 | #include <Library/HobLib.h>\r | |
14 | #include <Library/DebugLib.h>\r | |
15 | #include <Library/BaseMemoryLib.h>\r | |
16 | \r | |
17 | #include <Guid/MemoryAllocationHob.h>\r | |
18 | \r | |
19 | /**\r | |
20 | Builds a HOB for a loaded PE32 module.\r | |
21 | \r | |
22 | This function builds a HOB for a loaded PE32 module.\r | |
23 | It can only be invoked during PEI phase;\r | |
24 | for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.\r | |
25 | \r | |
26 | If ModuleName is NULL, then ASSERT().\r | |
27 | If there is no additional space for HOB creation, then ASSERT().\r | |
28 | \r | |
29 | @param ModuleName The GUID File Name of the module.\r | |
30 | @param MemoryAllocationModule The 64 bit physical address of the module.\r | |
31 | @param ModuleLength The length of the module in bytes.\r | |
32 | @param EntryPoint The 64 bit physical address of the module entry point.\r | |
33 | \r | |
34 | **/\r | |
35 | VOID\r | |
36 | EFIAPI\r | |
37 | BuildModuleHob (\r | |
38 | IN CONST EFI_GUID *ModuleName,\r | |
39 | IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r | |
40 | IN UINT64 ModuleLength,\r | |
41 | IN EFI_PHYSICAL_ADDRESS EntryPoint\r | |
42 | )\r | |
43 | {\r | |
44 | //\r | |
45 | // PEI HOB is read only for MM phase\r | |
46 | //\r | |
47 | ASSERT (FALSE);\r | |
48 | }\r | |
49 | \r | |
50 | /**\r | |
51 | Builds a HOB that describes a chunk of system memory.\r | |
52 | \r | |
53 | This function builds a HOB that describes a chunk of system memory.\r | |
54 | It can only be invoked during PEI phase;\r | |
55 | for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.\r | |
56 | \r | |
57 | If there is no additional space for HOB creation, then ASSERT().\r | |
58 | \r | |
59 | @param ResourceType The type of resource described by this HOB.\r | |
60 | @param ResourceAttribute The resource attributes of the memory described by this HOB.\r | |
61 | @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r | |
62 | @param NumberOfBytes The length of the memory described by this HOB in bytes.\r | |
63 | \r | |
64 | **/\r | |
65 | VOID\r | |
66 | EFIAPI\r | |
67 | BuildResourceDescriptorHob (\r | |
68 | IN EFI_RESOURCE_TYPE ResourceType,\r | |
69 | IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r | |
70 | IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r | |
71 | IN UINT64 NumberOfBytes\r | |
72 | )\r | |
73 | {\r | |
74 | //\r | |
75 | // PEI HOB is read only for MM phase\r | |
76 | //\r | |
77 | ASSERT (FALSE);\r | |
78 | }\r | |
79 | \r | |
80 | /**\r | |
81 | Builds a customized HOB tagged with a GUID for identification and returns\r | |
82 | the start address of GUID HOB data.\r | |
83 | \r | |
84 | This function builds a customized HOB tagged with a GUID for identification\r | |
85 | and returns the start address of GUID HOB data so that caller can fill the customized data.\r | |
86 | The HOB Header and Name field is already stripped.\r | |
87 | It can only be invoked during PEI phase.\r | |
88 | For MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.\r | |
89 | \r | |
90 | If Guid is NULL, then ASSERT().\r | |
91 | If there is no additional space for HOB creation, then ASSERT().\r | |
92 | If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r | |
93 | HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r | |
94 | \r | |
95 | @param Guid The GUID to tag the customized HOB.\r | |
96 | @param DataLength The size of the data payload for the GUID HOB.\r | |
97 | \r | |
98 | @retval NULL The GUID HOB could not be allocated.\r | |
99 | @retval others The start address of GUID HOB data.\r | |
100 | \r | |
101 | **/\r | |
102 | VOID *\r | |
103 | EFIAPI\r | |
104 | BuildGuidHob (\r | |
105 | IN CONST EFI_GUID *Guid,\r | |
106 | IN UINTN DataLength\r | |
107 | )\r | |
108 | {\r | |
109 | //\r | |
110 | // PEI HOB is read only for MM phase\r | |
111 | //\r | |
112 | ASSERT (FALSE);\r | |
113 | return NULL;\r | |
114 | }\r | |
115 | \r | |
116 | /**\r | |
117 | Builds a customized HOB tagged with a GUID for identification, copies the input data to the HOB\r | |
118 | data field, and returns the start address of the GUID HOB data.\r | |
119 | \r | |
120 | This function builds a customized HOB tagged with a GUID for identification and copies the input\r | |
121 | data to the HOB data field and returns the start address of the GUID HOB data. It can only be\r | |
122 | invoked during PEI phase; for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.\r | |
123 | The HOB Header and Name field is already stripped.\r | |
124 | It can only be invoked during PEI phase.\r | |
125 | For MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.\r | |
126 | \r | |
127 | If Guid is NULL, then ASSERT().\r | |
128 | If Data is NULL and DataLength > 0, then ASSERT().\r | |
129 | If there is no additional space for HOB creation, then ASSERT().\r | |
130 | If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r | |
131 | HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r | |
132 | \r | |
133 | @param Guid The GUID to tag the customized HOB.\r | |
134 | @param Data The data to be copied into the data field of the GUID HOB.\r | |
135 | @param DataLength The size of the data payload for the GUID HOB.\r | |
136 | \r | |
137 | @retval NULL The GUID HOB could not be allocated.\r | |
138 | @retval others The start address of GUID HOB data.\r | |
139 | \r | |
140 | **/\r | |
141 | VOID *\r | |
142 | EFIAPI\r | |
143 | BuildGuidDataHob (\r | |
144 | IN CONST EFI_GUID *Guid,\r | |
145 | IN VOID *Data,\r | |
146 | IN UINTN DataLength\r | |
147 | )\r | |
148 | {\r | |
149 | //\r | |
150 | // PEI HOB is read only for MM phase\r | |
151 | //\r | |
152 | ASSERT (FALSE);\r | |
153 | return NULL;\r | |
154 | }\r | |
155 | \r | |
156 | /**\r | |
157 | Builds a Firmware Volume HOB.\r | |
158 | \r | |
159 | This function builds a Firmware Volume HOB.\r | |
160 | It can only be invoked during PEI phase;\r | |
161 | for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.\r | |
162 | \r | |
163 | If there is no additional space for HOB creation, then ASSERT().\r | |
164 | If the FvImage buffer is not at its required alignment, then ASSERT().\r | |
165 | \r | |
166 | @param BaseAddress The base address of the Firmware Volume.\r | |
167 | @param Length The size of the Firmware Volume in bytes.\r | |
168 | \r | |
169 | **/\r | |
170 | VOID\r | |
171 | EFIAPI\r | |
172 | BuildFvHob (\r | |
173 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
174 | IN UINT64 Length\r | |
175 | )\r | |
176 | {\r | |
177 | //\r | |
178 | // PEI HOB is read only for MM phase\r | |
179 | //\r | |
180 | ASSERT (FALSE);\r | |
181 | }\r | |
182 | \r | |
183 | /**\r | |
184 | Builds a EFI_HOB_TYPE_FV2 HOB.\r | |
185 | \r | |
186 | This function builds a EFI_HOB_TYPE_FV2 HOB.\r | |
187 | It can only be invoked during PEI phase;\r | |
188 | for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.\r | |
189 | \r | |
190 | If there is no additional space for HOB creation, then ASSERT().\r | |
191 | If the FvImage buffer is not at its required alignment, then ASSERT().\r | |
192 | \r | |
193 | @param BaseAddress The base address of the Firmware Volume.\r | |
194 | @param Length The size of the Firmware Volume in bytes.\r | |
195 | @param FvName The name of the Firmware Volume.\r | |
196 | @param FileName The name of the file.\r | |
197 | \r | |
198 | **/\r | |
199 | VOID\r | |
200 | EFIAPI\r | |
201 | BuildFv2Hob (\r | |
202 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
203 | IN UINT64 Length,\r | |
204 | IN CONST EFI_GUID *FvName,\r | |
205 | IN CONST EFI_GUID *FileName\r | |
206 | )\r | |
207 | {\r | |
208 | ASSERT (FALSE);\r | |
209 | }\r | |
210 | \r | |
211 | /**\r | |
212 | Builds a EFI_HOB_TYPE_FV3 HOB.\r | |
213 | \r | |
214 | This function builds a EFI_HOB_TYPE_FV3 HOB.\r | |
215 | It can only be invoked during PEI phase;\r | |
216 | for MM phase, it will ASSERT() since PEI HOB is read-only for MM phase.\r | |
217 | \r | |
218 | If there is no additional space for HOB creation, then ASSERT().\r | |
219 | If the FvImage buffer is not at its required alignment, then ASSERT().\r | |
220 | \r | |
221 | @param BaseAddress The base address of the Firmware Volume.\r | |
222 | @param Length The size of the Firmware Volume in bytes.\r | |
223 | @param AuthenticationStatus The authentication status.\r | |
224 | @param ExtractedFv TRUE if the FV was extracted as a file within\r | |
225 | another firmware volume. FALSE otherwise.\r | |
226 | @param FvName The name of the Firmware Volume.\r | |
227 | Valid only if IsExtractedFv is TRUE.\r | |
228 | @param FileName The name of the file.\r | |
229 | Valid only if IsExtractedFv is TRUE.\r | |
230 | \r | |
231 | **/\r | |
232 | VOID\r | |
233 | EFIAPI\r | |
234 | BuildFv3Hob (\r | |
235 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
236 | IN UINT64 Length,\r | |
237 | IN UINT32 AuthenticationStatus,\r | |
238 | IN BOOLEAN ExtractedFv,\r | |
902e76de | 239 | IN CONST EFI_GUID *FvName OPTIONAL,\r |
f6c488b7 KQ |
240 | IN CONST EFI_GUID *FileName OPTIONAL\r |
241 | )\r | |
242 | {\r | |
243 | ASSERT (FALSE);\r | |
244 | }\r | |
245 | \r | |
246 | /**\r | |
247 | Builds a HOB for the CPU.\r | |
248 | \r | |
249 | This function builds a HOB for the CPU.\r | |
250 | It can only be invoked during PEI phase;\r | |
251 | for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.\r | |
252 | \r | |
253 | If there is no additional space for HOB creation, then ASSERT().\r | |
254 | \r | |
255 | @param SizeOfMemorySpace The maximum physical memory addressability of the processor.\r | |
256 | @param SizeOfIoSpace The maximum physical I/O addressability of the processor.\r | |
257 | \r | |
258 | **/\r | |
259 | VOID\r | |
260 | EFIAPI\r | |
261 | BuildCpuHob (\r | |
262 | IN UINT8 SizeOfMemorySpace,\r | |
263 | IN UINT8 SizeOfIoSpace\r | |
264 | )\r | |
265 | {\r | |
266 | //\r | |
267 | // PEI HOB is read only for MM phase\r | |
268 | //\r | |
269 | ASSERT (FALSE);\r | |
270 | }\r | |
271 | \r | |
272 | /**\r | |
273 | Builds a HOB for the memory allocation.\r | |
274 | \r | |
275 | This function builds a HOB for the memory allocation.\r | |
276 | It can only be invoked during PEI phase;\r | |
277 | for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.\r | |
278 | \r | |
279 | If there is no additional space for HOB creation, then ASSERT().\r | |
280 | \r | |
281 | @param BaseAddress The 64 bit physical address of the memory.\r | |
282 | @param Length The length of the memory allocation in bytes.\r | |
283 | @param MemoryType Type of memory allocated by this HOB.\r | |
284 | \r | |
285 | **/\r | |
286 | VOID\r | |
287 | EFIAPI\r | |
288 | BuildMemoryAllocationHob (\r | |
289 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
290 | IN UINT64 Length,\r | |
291 | IN EFI_MEMORY_TYPE MemoryType\r | |
292 | )\r | |
293 | {\r | |
294 | //\r | |
295 | // PEI HOB is read only for MM phase\r | |
296 | //\r | |
297 | ASSERT (FALSE);\r | |
298 | }\r |