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