Commit | Line | Data |
---|---|---|
1e57a462 | 1 | /** @file\r |
2 | Library that helps implement monolithic PEI. (SEC goes to DXE)\r | |
3 | \r | |
4 | Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r | |
5 | \r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef __PRE_PI_LIB_H__\r | |
17 | #define __PRE_PI_LIB_H__\r | |
18 | \r | |
19 | #include <Guid/ExtractSection.h>\r | |
20 | \r | |
21 | /**\r | |
22 | This service enables discovery of additional firmware volumes.\r | |
23 | \r | |
24 | @param Instance This instance of the firmware volume to find. The value 0 is the\r | |
25 | Boot Firmware Volume (BFV).\r | |
26 | @param FwVolHeader Pointer to the firmware volume header of the volume to return.\r | |
27 | \r | |
28 | @retval EFI_SUCCESS The volume was found.\r | |
29 | @retval EFI_NOT_FOUND The volume was not found.\r | |
30 | @retval EFI_INVALID_PARAMETER FwVolHeader is NULL.\r | |
31 | \r | |
32 | **/\r | |
33 | EFI_STATUS\r | |
34 | EFIAPI\r | |
35 | FfsFindNextVolume (\r | |
36 | IN UINTN Instance,\r | |
37 | IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r | |
38 | );\r | |
39 | \r | |
40 | \r | |
41 | /**\r | |
42 | This service enables discovery of additional firmware files.\r | |
43 | \r | |
44 | @param SearchType A filter to find files only of this type.\r | |
45 | @param FwVolHeader Pointer to the firmware volume header of the volume to search.\r | |
46 | This parameter must point to a valid FFS volume.\r | |
47 | @param FileHeader Pointer to the current file from which to begin searching.\r | |
48 | \r | |
49 | @retval EFI_SUCCESS The file was found.\r | |
50 | @retval EFI_NOT_FOUND The file was not found.\r | |
51 | @retval EFI_NOT_FOUND The header checksum was not zero.\r | |
52 | \r | |
53 | **/\r | |
54 | EFI_STATUS\r | |
55 | EFIAPI\r | |
56 | FfsFindNextFile (\r | |
57 | IN EFI_FV_FILETYPE SearchType,\r | |
58 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
59 | IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
60 | );\r | |
61 | \r | |
62 | \r | |
63 | /**\r | |
64 | This service enables discovery sections of a given type within a valid FFS file.\r | |
65 | \r | |
66 | @param SearchType The value of the section type to find.\r | |
67 | @param FfsFileHeader A pointer to the file header that contains the set of sections to\r | |
68 | be searched.\r | |
69 | @param SectionData A pointer to the discovered section, if successful.\r | |
70 | \r | |
71 | @retval EFI_SUCCESS The section was found.\r | |
72 | @retval EFI_NOT_FOUND The section was not found.\r | |
73 | \r | |
74 | **/\r | |
75 | EFI_STATUS\r | |
76 | EFIAPI\r | |
77 | FfsFindSectionData (\r | |
78 | IN EFI_SECTION_TYPE SectionType,\r | |
79 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
80 | OUT VOID **SectionData\r | |
81 | );\r | |
82 | \r | |
83 | \r | |
84 | /**\r | |
85 | Find a file in the volume by name\r | |
3402aac7 | 86 | \r |
1e57a462 | 87 | @param FileName A pointer to the name of the file to\r |
88 | find within the firmware volume.\r | |
89 | \r | |
90 | @param VolumeHandle The firmware volume to search FileHandle\r | |
91 | Upon exit, points to the found file's\r | |
92 | handle or NULL if it could not be found.\r | |
93 | \r | |
94 | @retval EFI_SUCCESS File was found.\r | |
95 | \r | |
96 | @retval EFI_NOT_FOUND File was not found.\r | |
97 | \r | |
98 | @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or\r | |
99 | FileName was NULL.\r | |
100 | \r | |
101 | **/\r | |
102 | EFI_STATUS\r | |
103 | EFIAPI\r | |
7381bd3e | 104 | FfsFindFileByName (\r |
1e57a462 | 105 | IN CONST EFI_GUID *FileName,\r |
106 | IN CONST EFI_PEI_FV_HANDLE VolumeHandle,\r | |
107 | OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
108 | );\r | |
109 | \r | |
110 | \r | |
111 | /**\r | |
112 | Get information about the file by name.\r | |
113 | \r | |
114 | @param FileHandle Handle of the file.\r | |
115 | \r | |
116 | @param FileInfo Upon exit, points to the file's\r | |
117 | information.\r | |
118 | \r | |
119 | @retval EFI_SUCCESS File information returned.\r | |
3402aac7 | 120 | \r |
1e57a462 | 121 | @retval EFI_INVALID_PARAMETER If FileHandle does not\r |
122 | represent a valid file.\r | |
3402aac7 | 123 | \r |
1e57a462 | 124 | @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r |
3402aac7 | 125 | \r |
1e57a462 | 126 | **/\r |
127 | EFI_STATUS\r | |
3402aac7 | 128 | EFIAPI\r |
1e57a462 | 129 | FfsGetFileInfo (\r |
130 | IN CONST EFI_PEI_FILE_HANDLE FileHandle,\r | |
131 | OUT EFI_FV_FILE_INFO *FileInfo\r | |
132 | );\r | |
133 | \r | |
134 | \r | |
135 | /**\r | |
136 | Get Information about the volume by name\r | |
137 | \r | |
138 | @param VolumeHandle Handle of the volume.\r | |
139 | \r | |
140 | @param VolumeInfo Upon exit, points to the volume's\r | |
141 | information.\r | |
142 | \r | |
143 | @retval EFI_SUCCESS File information returned.\r | |
3402aac7 | 144 | \r |
1e57a462 | 145 | @retval EFI_INVALID_PARAMETER If FileHandle does not\r |
146 | represent a valid file.\r | |
3402aac7 | 147 | \r |
1e57a462 | 148 | @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r |
149 | \r | |
150 | **/\r | |
151 | EFI_STATUS\r | |
152 | EFIAPI\r | |
153 | FfsGetVolumeInfo (\r | |
154 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
155 | OUT EFI_FV_INFO *VolumeInfo\r | |
156 | );\r | |
157 | \r | |
158 | \r | |
159 | \r | |
160 | /**\r | |
161 | Get Fv image from the FV type file, then add FV & FV2 Hob.\r | |
162 | \r | |
91c38d4e | 163 | @param FileHandle File handle of a Fv type file.\r |
1e57a462 | 164 | \r |
91c38d4e RC |
165 | @retval EFI_NOT_FOUND FV image can't be found.\r |
166 | @retval EFI_SUCCESS Successfully to process it.\r | |
1e57a462 | 167 | \r |
168 | **/\r | |
169 | EFI_STATUS\r | |
170 | EFIAPI\r | |
171 | FfsProcessFvFile (\r | |
172 | IN EFI_PEI_FILE_HANDLE FvFileHandle\r | |
173 | );\r | |
174 | \r | |
175 | \r | |
176 | /**\r | |
177 | Search through every FV until you find a file of type FileType\r | |
178 | \r | |
91c38d4e RC |
179 | @param FileType File handle of a Fv type file.\r |
180 | @param Volumehandle On succes Volume Handle of the match\r | |
181 | @param FileHandle On success File Handle of the match\r | |
3402aac7 | 182 | \r |
91c38d4e RC |
183 | @retval EFI_NOT_FOUND FV image can't be found.\r |
184 | @retval EFI_SUCCESS Successfully found FileType\r | |
1e57a462 | 185 | \r |
186 | **/\r | |
187 | EFI_STATUS\r | |
188 | EFIAPI\r | |
189 | FfsAnyFvFindFirstFile (\r | |
190 | IN EFI_FV_FILETYPE FileType,\r | |
191 | OUT EFI_PEI_FV_HANDLE *VolumeHandle,\r | |
192 | OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
193 | );\r | |
194 | \r | |
195 | \r | |
196 | /**\r | |
197 | Get Fv image from the FV type file, then add FV & FV2 Hob.\r | |
198 | \r | |
91c38d4e | 199 | @param FileHandle File handle of a Fv type file.\r |
1e57a462 | 200 | \r |
201 | \r | |
91c38d4e RC |
202 | @retval EFI_NOT_FOUND FV image can't be found.\r |
203 | @retval EFI_SUCCESS Successfully to process it.\r | |
1e57a462 | 204 | \r |
205 | **/\r | |
206 | EFI_STATUS\r | |
207 | EFIAPI\r | |
208 | FfsProcessFvFile (\r | |
209 | IN EFI_PEI_FILE_HANDLE FvFileHandle\r | |
210 | );\r | |
211 | \r | |
212 | \r | |
213 | /**\r | |
3402aac7 | 214 | This service enables PEIMs to ascertain the present value of the boot mode.\r |
1e57a462 | 215 | \r |
216 | \r | |
3402aac7 | 217 | @retval BootMode\r |
1e57a462 | 218 | \r |
219 | **/\r | |
220 | EFI_BOOT_MODE\r | |
221 | EFIAPI\r | |
222 | GetBootMode (\r | |
223 | VOID\r | |
224 | );\r | |
225 | \r | |
226 | \r | |
227 | /**\r | |
3402aac7 | 228 | This service enables PEIMs to update the boot mode variable.\r |
1e57a462 | 229 | \r |
230 | @param BootMode The value of the boot mode to set.\r | |
231 | \r | |
232 | @retval EFI_SUCCESS The value was successfully updated\r | |
233 | \r | |
234 | **/\r | |
235 | EFI_STATUS\r | |
236 | EFIAPI\r | |
237 | SetBootMode (\r | |
238 | IN EFI_BOOT_MODE BootMode\r | |
239 | );\r | |
240 | \r | |
241 | /**\r | |
242 | This service enables a PEIM to ascertain the address of the list of HOBs in memory.\r | |
243 | \r | |
244 | @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.\r | |
245 | \r | |
246 | @retval EFI_SUCCESS The list was successfully returned.\r | |
247 | @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.\r | |
248 | \r | |
249 | **/\r | |
250 | VOID *\r | |
251 | EFIAPI\r | |
252 | GetHobList (\r | |
3402aac7 | 253 | VOID\r |
1e57a462 | 254 | );\r |
255 | \r | |
256 | \r | |
257 | /**\r | |
258 | Updates the pointer to the HOB list.\r | |
259 | \r | |
260 | @param HobList Hob list pointer to store\r | |
3402aac7 | 261 | \r |
1e57a462 | 262 | **/\r |
263 | EFI_STATUS\r | |
264 | EFIAPI\r | |
265 | SetHobList (\r | |
266 | IN VOID *HobList\r | |
267 | );\r | |
268 | \r | |
269 | EFI_HOB_HANDOFF_INFO_TABLE*\r | |
270 | HobConstructor (\r | |
271 | IN VOID *EfiMemoryBegin,\r | |
272 | IN UINTN EfiMemoryLength,\r | |
273 | IN VOID *EfiFreeMemoryBottom,\r | |
274 | IN VOID *EfiFreeMemoryTop\r | |
275 | );\r | |
276 | \r | |
1e57a462 | 277 | /**\r |
278 | This service enables PEIMs to create various types of HOBs.\r | |
279 | \r | |
280 | @param Type The type of HOB to be installed.\r | |
281 | @param Length The length of the HOB to be added.\r | |
282 | \r | |
283 | @retval !NULL The HOB was successfully created.\r | |
284 | @retval NULL There is no additional space for HOB creation.\r | |
285 | \r | |
286 | **/\r | |
287 | VOID *\r | |
288 | CreateHob (\r | |
289 | IN UINT16 HobType,\r | |
290 | IN UINT16 HobLenght\r | |
291 | );\r | |
292 | \r | |
293 | \r | |
294 | /**\r | |
295 | Returns the next instance of a HOB type from the starting HOB.\r | |
296 | \r | |
3402aac7 | 297 | This function searches the first instance of a HOB type from the starting HOB pointer.\r |
1e57a462 | 298 | If there does not exist such HOB type from the starting HOB pointer, it will return NULL.\r |
299 | In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r | |
300 | unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r | |
301 | caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r | |
302 | If HobStart is NULL, then ASSERT().\r | |
303 | \r | |
304 | @param Type The HOB type to return.\r | |
305 | @param HobStart The starting HOB pointer to search from.\r | |
306 | \r | |
307 | @return The next instance of a HOB type from the starting HOB.\r | |
308 | \r | |
309 | **/\r | |
310 | VOID *\r | |
311 | EFIAPI\r | |
312 | GetNextHob (\r | |
313 | IN UINT16 Type,\r | |
314 | IN CONST VOID *HobStart\r | |
315 | );\r | |
316 | \r | |
317 | /**\r | |
318 | Returns the first instance of a HOB type among the whole HOB list.\r | |
319 | \r | |
3402aac7 RC |
320 | This function searches the first instance of a HOB type among the whole HOB list.\r |
321 | If there does not exist such HOB type in the HOB list, it will return NULL.\r | |
1e57a462 | 322 | \r |
323 | @param Type The HOB type to return.\r | |
324 | \r | |
325 | @return The next instance of a HOB type from the starting HOB.\r | |
326 | \r | |
327 | **/\r | |
328 | VOID *\r | |
329 | EFIAPI\r | |
330 | GetFirstHob (\r | |
331 | IN UINT16 Type\r | |
332 | );\r | |
333 | \r | |
334 | /**\r | |
3402aac7 RC |
335 | This function searches the first instance of a HOB from the starting HOB pointer.\r |
336 | Such HOB should satisfy two conditions:\r | |
337 | its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r | |
338 | If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r | |
1e57a462 | 339 | Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r |
340 | to extract the data section and its size info respectively.\r | |
341 | In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r | |
342 | unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r | |
343 | caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r | |
344 | If Guid is NULL, then ASSERT().\r | |
345 | If HobStart is NULL, then ASSERT().\r | |
346 | \r | |
347 | @param Guid The GUID to match with in the HOB list.\r | |
348 | @param HobStart A pointer to a Guid.\r | |
349 | \r | |
350 | @return The next instance of the matched GUID HOB from the starting HOB.\r | |
351 | \r | |
352 | **/\r | |
353 | VOID *\r | |
354 | EFIAPI\r | |
355 | GetNextGuidHob (\r | |
356 | IN CONST EFI_GUID *Guid,\r | |
357 | IN CONST VOID *HobStart\r | |
358 | );\r | |
359 | \r | |
360 | /**\r | |
3402aac7 | 361 | This function searches the first instance of a HOB among the whole HOB list.\r |
1e57a462 | 362 | Such HOB should satisfy two conditions:\r |
363 | its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r | |
364 | If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r | |
365 | Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r | |
366 | to extract the data section and its size info respectively.\r | |
367 | If Guid is NULL, then ASSERT().\r | |
368 | \r | |
369 | @param Guid The GUID to match with in the HOB list.\r | |
370 | \r | |
371 | @return The first instance of the matched GUID HOB among the whole HOB list.\r | |
372 | \r | |
373 | **/\r | |
374 | VOID *\r | |
375 | EFIAPI\r | |
376 | GetFirstGuidHob (\r | |
377 | IN CONST EFI_GUID *Guid\r | |
378 | );\r | |
379 | \r | |
380 | \r | |
381 | /**\r | |
382 | Builds a HOB for a loaded PE32 module.\r | |
383 | \r | |
384 | This function builds a HOB for a loaded PE32 module.\r | |
385 | It can only be invoked during PEI phase;\r | |
386 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
387 | If ModuleName is NULL, then ASSERT().\r | |
388 | If there is no additional space for HOB creation, then ASSERT().\r | |
389 | \r | |
390 | @param ModuleName The GUID File Name of the module.\r | |
391 | @param MemoryAllocationModule The 64 bit physical address of the module.\r | |
392 | @param ModuleLength The length of the module in bytes.\r | |
393 | @param EntryPoint The 64 bit physical address of the module entry point.\r | |
394 | \r | |
395 | **/\r | |
396 | VOID\r | |
397 | EFIAPI\r | |
398 | BuildModuleHob (\r | |
399 | IN CONST EFI_GUID *ModuleName,\r | |
400 | IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r | |
401 | IN UINT64 ModuleLength,\r | |
402 | IN EFI_PHYSICAL_ADDRESS EntryPoint\r | |
403 | );\r | |
404 | \r | |
405 | /**\r | |
406 | Builds a HOB that describes a chunk of system memory.\r | |
407 | \r | |
408 | This function builds a HOB that describes a chunk of system memory.\r | |
409 | It can only be invoked during PEI phase;\r | |
410 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
411 | If there is no additional space for HOB creation, then ASSERT().\r | |
412 | \r | |
413 | @param ResourceType The type of resource described by this HOB.\r | |
414 | @param ResourceAttribute The resource attributes of the memory described by this HOB.\r | |
415 | @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r | |
416 | @param NumberOfBytes The length of the memory described by this HOB in bytes.\r | |
417 | \r | |
418 | **/\r | |
419 | VOID\r | |
420 | EFIAPI\r | |
421 | BuildResourceDescriptorHob (\r | |
422 | IN EFI_RESOURCE_TYPE ResourceType,\r | |
423 | IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r | |
424 | IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r | |
425 | IN UINT64 NumberOfBytes\r | |
426 | );\r | |
427 | \r | |
428 | /**\r | |
429 | Builds a GUID HOB with a certain data length.\r | |
430 | \r | |
3402aac7 RC |
431 | This function builds a customized HOB tagged with a GUID for identification\r |
432 | and returns the start address of GUID HOB data so that caller can fill the customized data.\r | |
1e57a462 | 433 | The HOB Header and Name field is already stripped.\r |
434 | It can only be invoked during PEI phase;\r | |
435 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
436 | If Guid is NULL, then ASSERT().\r | |
437 | If there is no additional space for HOB creation, then ASSERT().\r | |
438 | If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r | |
439 | \r | |
440 | @param Guid The GUID to tag the customized HOB.\r | |
441 | @param DataLength The size of the data payload for the GUID HOB.\r | |
442 | \r | |
443 | @return The start address of GUID HOB data.\r | |
444 | \r | |
445 | **/\r | |
446 | VOID *\r | |
447 | EFIAPI\r | |
448 | BuildGuidHob (\r | |
449 | IN CONST EFI_GUID *Guid,\r | |
450 | IN UINTN DataLength\r | |
451 | );\r | |
452 | \r | |
453 | /**\r | |
454 | Copies a data buffer to a newly-built HOB.\r | |
455 | \r | |
456 | This function builds a customized HOB tagged with a GUID for identification,\r | |
457 | copies the input data to the HOB data field and returns the start address of the GUID HOB data.\r | |
458 | The HOB Header and Name field is already stripped.\r | |
459 | It can only be invoked during PEI phase;\r | |
460 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
461 | If Guid is NULL, then ASSERT().\r | |
462 | If Data is NULL and DataLength > 0, then ASSERT().\r | |
463 | If there is no additional space for HOB creation, then ASSERT().\r | |
464 | If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r | |
465 | \r | |
466 | @param Guid The GUID to tag the customized HOB.\r | |
467 | @param Data The data to be copied into the data field of the GUID HOB.\r | |
468 | @param DataLength The size of the data payload for the GUID HOB.\r | |
469 | \r | |
470 | @return The start address of GUID HOB data.\r | |
471 | \r | |
472 | **/\r | |
473 | VOID *\r | |
474 | EFIAPI\r | |
475 | BuildGuidDataHob (\r | |
476 | IN CONST EFI_GUID *Guid,\r | |
477 | IN VOID *Data,\r | |
478 | IN UINTN DataLength\r | |
479 | );\r | |
480 | \r | |
481 | /**\r | |
482 | Builds a Firmware Volume HOB.\r | |
483 | \r | |
484 | This function builds a Firmware Volume HOB.\r | |
485 | It can only be invoked during PEI phase;\r | |
486 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
487 | If there is no additional space for HOB creation, then ASSERT().\r | |
488 | \r | |
489 | @param BaseAddress The base address of the Firmware Volume.\r | |
490 | @param Length The size of the Firmware Volume in bytes.\r | |
491 | \r | |
492 | **/\r | |
493 | VOID\r | |
494 | EFIAPI\r | |
495 | BuildFvHob (\r | |
496 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
497 | IN UINT64 Length\r | |
498 | );\r | |
499 | \r | |
500 | /**\r | |
3402aac7 | 501 | Builds a Firmware Volume HOB and a resrouce descriptor hob\r |
1e57a462 | 502 | \r |
503 | This function builds a Firmware Volume HOB.\r | |
504 | It can only be invoked during PEI phase;\r | |
505 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
506 | If there is no additional space for HOB creation, then ASSERT().\r | |
507 | \r | |
508 | @param BaseAddress The base address of the Firmware Volume.\r | |
509 | @param Length The size of the Firmware Volume in bytes.\r | |
510 | \r | |
511 | **/\r | |
512 | VOID\r | |
513 | EFIAPI\r | |
3402aac7 | 514 | BuildFvHobs (\r |
1e57a462 | 515 | IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r |
516 | IN UINT64 NumberOfBytes,\r | |
517 | IN EFI_RESOURCE_ATTRIBUTE_TYPE *ResourceAttribute OPTIONAL\r | |
3402aac7 | 518 | );\r |
1e57a462 | 519 | \r |
520 | \r | |
521 | /**\r | |
522 | Builds a EFI_HOB_TYPE_FV2 HOB.\r | |
523 | \r | |
524 | This function builds a EFI_HOB_TYPE_FV2 HOB.\r | |
525 | It can only be invoked during PEI phase;\r | |
526 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
527 | If there is no additional space for HOB creation, then ASSERT().\r | |
528 | \r | |
529 | @param BaseAddress The base address of the Firmware Volume.\r | |
530 | @param Length The size of the Firmware Volume in bytes.\r | |
531 | @param FvName The name of the Firmware Volume.\r | |
532 | @param FileName The name of the file.\r | |
3402aac7 | 533 | \r |
1e57a462 | 534 | **/\r |
535 | VOID\r | |
536 | EFIAPI\r | |
537 | BuildFv2Hob (\r | |
538 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
539 | IN UINT64 Length,\r | |
540 | IN CONST EFI_GUID *FvName,\r | |
541 | IN CONST EFI_GUID *FileName\r | |
542 | );\r | |
543 | \r | |
544 | /**\r | |
545 | Builds a Capsule Volume HOB.\r | |
546 | \r | |
547 | This function builds a Capsule Volume HOB.\r | |
548 | It can only be invoked during PEI phase;\r | |
549 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
550 | If there is no additional space for HOB creation, then ASSERT().\r | |
551 | \r | |
552 | @param BaseAddress The base address of the Capsule Volume.\r | |
553 | @param Length The size of the Capsule Volume in bytes.\r | |
554 | \r | |
555 | **/\r | |
556 | VOID\r | |
557 | EFIAPI\r | |
558 | BuildCvHob (\r | |
559 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
560 | IN UINT64 Length\r | |
561 | );\r | |
562 | \r | |
563 | /**\r | |
564 | Builds a HOB for the CPU.\r | |
565 | \r | |
566 | This function builds a HOB for the CPU.\r | |
567 | It can only be invoked during PEI phase;\r | |
568 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
569 | If there is no additional space for HOB creation, then ASSERT().\r | |
570 | \r | |
571 | @param SizeOfMemorySpace The maximum physical memory addressability of the processor.\r | |
572 | @param SizeOfIoSpace The maximum physical I/O addressability of the processor.\r | |
573 | \r | |
574 | **/\r | |
575 | VOID\r | |
576 | EFIAPI\r | |
577 | BuildCpuHob (\r | |
578 | IN UINT8 SizeOfMemorySpace,\r | |
579 | IN UINT8 SizeOfIoSpace\r | |
580 | );\r | |
581 | \r | |
582 | /**\r | |
583 | Builds a HOB for the Stack.\r | |
584 | \r | |
585 | This function builds a HOB for the stack.\r | |
586 | It can only be invoked during PEI phase;\r | |
587 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
588 | If there is no additional space for HOB creation, then ASSERT().\r | |
589 | \r | |
590 | @param BaseAddress The 64 bit physical address of the Stack.\r | |
591 | @param Length The length of the stack in bytes.\r | |
592 | \r | |
593 | **/\r | |
594 | VOID\r | |
595 | EFIAPI\r | |
596 | BuildStackHob (\r | |
597 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
598 | IN UINT64 Length\r | |
599 | );\r | |
600 | \r | |
601 | /**\r | |
602 | Update the Stack Hob if the stack has been moved\r | |
603 | \r | |
604 | @param BaseAddress The 64 bit physical address of the Stack.\r | |
605 | @param Length The length of the stack in bytes.\r | |
606 | \r | |
607 | **/\r | |
608 | VOID\r | |
609 | UpdateStackHob (\r | |
610 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
611 | IN UINT64 Length\r | |
612 | );\r | |
613 | \r | |
614 | \r | |
615 | /**\r | |
616 | Builds a HOB for the BSP store.\r | |
617 | \r | |
618 | This function builds a HOB for BSP store.\r | |
619 | It can only be invoked during PEI phase;\r | |
620 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
621 | If there is no additional space for HOB creation, then ASSERT().\r | |
622 | \r | |
623 | @param BaseAddress The 64 bit physical address of the BSP.\r | |
624 | @param Length The length of the BSP store in bytes.\r | |
625 | @param MemoryType Type of memory allocated by this HOB.\r | |
626 | \r | |
627 | **/\r | |
628 | VOID\r | |
629 | EFIAPI\r | |
630 | BuildBspStoreHob (\r | |
631 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
632 | IN UINT64 Length,\r | |
633 | IN EFI_MEMORY_TYPE MemoryType\r | |
634 | );\r | |
635 | \r | |
636 | /**\r | |
637 | Builds a HOB for the memory allocation.\r | |
638 | \r | |
639 | This function builds a HOB for the memory allocation.\r | |
640 | It can only be invoked during PEI phase;\r | |
641 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
642 | If there is no additional space for HOB creation, then ASSERT().\r | |
643 | \r | |
644 | @param BaseAddress The 64 bit physical address of the memory.\r | |
645 | @param Length The length of the memory allocation in bytes.\r | |
646 | @param MemoryType Type of memory allocated by this HOB.\r | |
647 | \r | |
648 | **/\r | |
649 | VOID\r | |
650 | EFIAPI\r | |
651 | BuildMemoryAllocationHob (\r | |
652 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
653 | IN UINT64 Length,\r | |
654 | IN EFI_MEMORY_TYPE MemoryType\r | |
655 | );\r | |
656 | \r | |
657 | \r | |
658 | VOID\r | |
659 | EFIAPI\r | |
660 | BuildExtractSectionHob (\r | |
661 | IN EFI_GUID *Guid,\r | |
662 | IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER SectionGetInfo,\r | |
663 | IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER SectionExtraction\r | |
664 | );\r | |
665 | \r | |
666 | VOID\r | |
667 | EFIAPI\r | |
668 | BuildPeCoffLoaderHob (\r | |
669 | VOID\r | |
670 | );\r | |
671 | \r | |
672 | \r | |
673 | /**\r | |
674 | Allocates one or more 4KB pages of type EfiBootServicesData.\r | |
675 | \r | |
676 | Allocates the number of 4KB pages of MemoryType and returns a pointer to the\r | |
677 | allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL\r | |
678 | is returned. If there is not enough memory remaining to satisfy the request, then NULL is\r | |
679 | returned.\r | |
680 | \r | |
681 | @param Pages The number of 4 KB pages to allocate.\r | |
682 | \r | |
683 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
684 | \r | |
685 | **/\r | |
3402aac7 | 686 | VOID *\r |
1e57a462 | 687 | EFIAPI\r |
688 | AllocatePages (\r | |
689 | IN UINTN Pages\r | |
690 | );\r | |
3402aac7 | 691 | \r |
1e57a462 | 692 | /**\r |
693 | Allocates a buffer of type EfiBootServicesData.\r | |
694 | \r | |
695 | Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a\r | |
696 | pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is\r | |
697 | returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
698 | \r | |
699 | @param AllocationSize The number of bytes to allocate.\r | |
700 | \r | |
701 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
702 | \r | |
703 | **/\r | |
704 | VOID *\r | |
705 | EFIAPI\r | |
706 | AllocatePool (\r | |
707 | IN UINTN AllocationSize\r | |
708 | );\r | |
3402aac7 RC |
709 | \r |
710 | \r | |
1e57a462 | 711 | /**\r |
712 | Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.\r | |
713 | \r | |
714 | Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an\r | |
715 | alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is\r | |
716 | returned. If there is not enough memory at the specified alignment remaining to satisfy the\r | |
717 | request, then NULL is returned.\r | |
718 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
719 | \r | |
720 | @param Pages The number of 4 KB pages to allocate.\r | |
721 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
722 | If Alignment is zero, then byte alignment is used.\r | |
723 | \r | |
724 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
725 | \r | |
726 | **/\r | |
727 | VOID *\r | |
728 | EFIAPI\r | |
729 | AllocateAlignedPages (\r | |
730 | IN UINTN Pages,\r | |
731 | IN UINTN Alignment\r | |
732 | );\r | |
733 | \r | |
734 | \r | |
735 | EFI_STATUS\r | |
736 | EFIAPI\r | |
737 | LoadPeCoffImage (\r | |
738 | IN VOID *PeCoffImage,\r | |
739 | OUT EFI_PHYSICAL_ADDRESS *ImageAddress,\r | |
740 | OUT UINT64 *ImageSize,\r | |
741 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint\r | |
742 | );\r | |
743 | \r | |
744 | EFI_STATUS\r | |
745 | EFIAPI\r | |
746 | LoadDxeCoreFromFfsFile (\r | |
747 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
748 | IN UINTN StackSize\r | |
749 | );\r | |
750 | \r | |
751 | EFI_STATUS\r | |
752 | EFIAPI\r | |
753 | LoadDxeCoreFromFv (\r | |
754 | IN UINTN *FvInstance, OPTIONAL\r | |
755 | IN UINTN StackSize\r | |
756 | );\r | |
757 | \r | |
758 | EFI_STATUS\r | |
759 | EFIAPI\r | |
760 | DecompressFirstFv (\r | |
761 | VOID\r | |
762 | );\r | |
763 | \r | |
764 | VOID\r | |
765 | EFIAPI\r | |
766 | AddDxeCoreReportStatusCodeCallback (\r | |
767 | VOID\r | |
768 | );\r | |
769 | \r | |
770 | \r | |
771 | #endif\r |