]>
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 | ||
f6eab262 | 270 | EFI_HOB_HANDOFF_INFO_TABLE* |
271 | HobConstructor ( | |
272 | IN VOID *EfiMemoryBegin, | |
273 | IN UINTN EfiMemoryLength, | |
274 | IN VOID *EfiFreeMemoryBottom, | |
275 | IN VOID *EfiFreeMemoryTop | |
276 | ); | |
2ef2b01e A |
277 | |
278 | /** | |
279 | Retrieves the magic value from the PE/COFF header. | |
280 | ||
281 | @param Hdr The buffer in which to return the PE32, PE32+, or TE header. | |
282 | ||
283 | @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32 | |
284 | @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+ | |
285 | ||
286 | **/ | |
287 | VOID | |
288 | CreateHobList ( | |
289 | IN VOID *MemoryBegin, | |
290 | IN UINTN MemoryLength, | |
291 | IN VOID *HobBase, | |
292 | IN VOID *StackBase | |
293 | ); | |
294 | ||
295 | ||
296 | /** | |
297 | This service enables PEIMs to create various types of HOBs. | |
298 | ||
299 | @param Type The type of HOB to be installed. | |
300 | @param Length The length of the HOB to be added. | |
301 | ||
302 | @retval !NULL The HOB was successfully created. | |
303 | @retval NULL There is no additional space for HOB creation. | |
304 | ||
305 | **/ | |
306 | VOID * | |
307 | CreateHob ( | |
308 | IN UINT16 HobType, | |
309 | IN UINT16 HobLenght | |
310 | ); | |
311 | ||
312 | ||
313 | /** | |
314 | Returns the next instance of a HOB type from the starting HOB. | |
315 | ||
316 | This function searches the first instance of a HOB type from the starting HOB pointer. | |
317 | If there does not exist such HOB type from the starting HOB pointer, it will return NULL. | |
318 | In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer | |
319 | unconditionally: it returns HobStart back if HobStart itself meets the requirement; | |
320 | caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. | |
321 | If HobStart is NULL, then ASSERT(). | |
322 | ||
323 | @param Type The HOB type to return. | |
324 | @param HobStart The starting HOB pointer to search from. | |
325 | ||
326 | @return The next instance of a HOB type from the starting HOB. | |
327 | ||
328 | **/ | |
329 | VOID * | |
330 | EFIAPI | |
331 | GetNextHob ( | |
332 | IN UINT16 Type, | |
333 | IN CONST VOID *HobStart | |
334 | ); | |
335 | ||
336 | /** | |
337 | Returns the first instance of a HOB type among the whole HOB list. | |
338 | ||
339 | This function searches the first instance of a HOB type among the whole HOB list. | |
340 | If there does not exist such HOB type in the HOB list, it will return NULL. | |
341 | ||
342 | @param Type The HOB type to return. | |
343 | ||
344 | @return The next instance of a HOB type from the starting HOB. | |
345 | ||
346 | **/ | |
347 | VOID * | |
348 | EFIAPI | |
349 | GetFirstHob ( | |
350 | IN UINT16 Type | |
351 | ); | |
352 | ||
353 | /** | |
354 | This function searches the first instance of a HOB from the starting HOB pointer. | |
355 | Such HOB should satisfy two conditions: | |
356 | its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. | |
357 | If there does not exist such HOB from the starting HOB pointer, it will return NULL. | |
358 | Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () | |
359 | to extract the data section and its size info respectively. | |
360 | In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer | |
361 | unconditionally: it returns HobStart back if HobStart itself meets the requirement; | |
362 | caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. | |
363 | If Guid is NULL, then ASSERT(). | |
364 | If HobStart is NULL, then ASSERT(). | |
365 | ||
366 | @param Guid The GUID to match with in the HOB list. | |
367 | @param HobStart A pointer to a Guid. | |
368 | ||
369 | @return The next instance of the matched GUID HOB from the starting HOB. | |
370 | ||
371 | **/ | |
372 | VOID * | |
373 | EFIAPI | |
374 | GetNextGuidHob ( | |
375 | IN CONST EFI_GUID *Guid, | |
376 | IN CONST VOID *HobStart | |
377 | ); | |
378 | ||
379 | /** | |
380 | This function searches the first instance of a HOB among the whole HOB list. | |
381 | Such HOB should satisfy two conditions: | |
382 | its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. | |
383 | If there does not exist such HOB from the starting HOB pointer, it will return NULL. | |
384 | Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () | |
385 | to extract the data section and its size info respectively. | |
386 | If Guid is NULL, then ASSERT(). | |
387 | ||
388 | @param Guid The GUID to match with in the HOB list. | |
389 | ||
390 | @return The first instance of the matched GUID HOB among the whole HOB list. | |
391 | ||
392 | **/ | |
393 | VOID * | |
394 | EFIAPI | |
395 | GetFirstGuidHob ( | |
396 | IN CONST EFI_GUID *Guid | |
397 | ); | |
398 | ||
399 | ||
400 | /** | |
401 | Builds a HOB for a loaded PE32 module. | |
402 | ||
403 | This function builds a HOB for a loaded PE32 module. | |
404 | It can only be invoked during PEI phase; | |
405 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
406 | If ModuleName is NULL, then ASSERT(). | |
407 | If there is no additional space for HOB creation, then ASSERT(). | |
408 | ||
409 | @param ModuleName The GUID File Name of the module. | |
410 | @param MemoryAllocationModule The 64 bit physical address of the module. | |
411 | @param ModuleLength The length of the module in bytes. | |
412 | @param EntryPoint The 64 bit physical address of the module entry point. | |
413 | ||
414 | **/ | |
415 | VOID | |
416 | EFIAPI | |
417 | BuildModuleHob ( | |
418 | IN CONST EFI_GUID *ModuleName, | |
419 | IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, | |
420 | IN UINT64 ModuleLength, | |
421 | IN EFI_PHYSICAL_ADDRESS EntryPoint | |
422 | ); | |
423 | ||
424 | /** | |
425 | Builds a HOB that describes a chunk of system memory. | |
426 | ||
427 | This function builds a HOB that describes a chunk of system memory. | |
428 | It can only be invoked during PEI phase; | |
429 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
430 | If there is no additional space for HOB creation, then ASSERT(). | |
431 | ||
432 | @param ResourceType The type of resource described by this HOB. | |
433 | @param ResourceAttribute The resource attributes of the memory described by this HOB. | |
434 | @param PhysicalStart The 64 bit physical address of memory described by this HOB. | |
435 | @param NumberOfBytes The length of the memory described by this HOB in bytes. | |
436 | ||
437 | **/ | |
438 | VOID | |
439 | EFIAPI | |
440 | BuildResourceDescriptorHob ( | |
441 | IN EFI_RESOURCE_TYPE ResourceType, | |
442 | IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, | |
443 | IN EFI_PHYSICAL_ADDRESS PhysicalStart, | |
444 | IN UINT64 NumberOfBytes | |
445 | ); | |
446 | ||
447 | /** | |
448 | Builds a GUID HOB with a certain data length. | |
449 | ||
450 | This function builds a customized HOB tagged with a GUID for identification | |
451 | and returns the start address of GUID HOB data so that caller can fill the customized data. | |
452 | The HOB Header and Name field is already stripped. | |
453 | It can only be invoked during PEI phase; | |
454 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
455 | If Guid is NULL, then ASSERT(). | |
456 | If there is no additional space for HOB creation, then ASSERT(). | |
457 | If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). | |
458 | ||
459 | @param Guid The GUID to tag the customized HOB. | |
460 | @param DataLength The size of the data payload for the GUID HOB. | |
461 | ||
462 | @return The start address of GUID HOB data. | |
463 | ||
464 | **/ | |
465 | VOID * | |
466 | EFIAPI | |
467 | BuildGuidHob ( | |
468 | IN CONST EFI_GUID *Guid, | |
469 | IN UINTN DataLength | |
470 | ); | |
471 | ||
472 | /** | |
473 | Copies a data buffer to a newly-built HOB. | |
474 | ||
475 | This function builds a customized HOB tagged with a GUID for identification, | |
476 | copies the input data to the HOB data field and returns the start address of the GUID HOB data. | |
477 | The HOB Header and Name field is already stripped. | |
478 | It can only be invoked during PEI phase; | |
479 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
480 | If Guid is NULL, then ASSERT(). | |
481 | If Data is NULL and DataLength > 0, then ASSERT(). | |
482 | If there is no additional space for HOB creation, then ASSERT(). | |
483 | If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). | |
484 | ||
485 | @param Guid The GUID to tag the customized HOB. | |
486 | @param Data The data to be copied into the data field of the GUID HOB. | |
487 | @param DataLength The size of the data payload for the GUID HOB. | |
488 | ||
489 | @return The start address of GUID HOB data. | |
490 | ||
491 | **/ | |
492 | VOID * | |
493 | EFIAPI | |
494 | BuildGuidDataHob ( | |
495 | IN CONST EFI_GUID *Guid, | |
496 | IN VOID *Data, | |
497 | IN UINTN DataLength | |
498 | ); | |
499 | ||
500 | /** | |
501 | Builds a Firmware Volume HOB. | |
502 | ||
503 | This function builds a Firmware Volume HOB. | |
504 | It can only be invoked during PEI phase; | |
505 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
506 | If there is no additional space for HOB creation, then ASSERT(). | |
507 | ||
508 | @param BaseAddress The base address of the Firmware Volume. | |
509 | @param Length The size of the Firmware Volume in bytes. | |
510 | ||
511 | **/ | |
512 | VOID | |
513 | EFIAPI | |
514 | BuildFvHob ( | |
515 | IN EFI_PHYSICAL_ADDRESS BaseAddress, | |
516 | IN UINT64 Length | |
517 | ); | |
518 | ||
519 | /** | |
520 | Builds a Firmware Volume HOB and a resrouce descriptor hob | |
521 | ||
522 | This function builds a Firmware Volume HOB. | |
523 | It can only be invoked during PEI phase; | |
524 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
525 | If there is no additional space for HOB creation, then ASSERT(). | |
526 | ||
527 | @param BaseAddress The base address of the Firmware Volume. | |
528 | @param Length The size of the Firmware Volume in bytes. | |
529 | ||
530 | **/ | |
531 | VOID | |
532 | EFIAPI | |
533 | BuildFvHobs ( | |
534 | IN EFI_PHYSICAL_ADDRESS PhysicalStart, | |
535 | IN UINT64 NumberOfBytes, | |
536 | IN EFI_RESOURCE_ATTRIBUTE_TYPE *ResourceAttribute OPTIONAL | |
537 | ); | |
538 | ||
539 | ||
540 | /** | |
541 | Builds a EFI_HOB_TYPE_FV2 HOB. | |
542 | ||
543 | This function builds a EFI_HOB_TYPE_FV2 HOB. | |
544 | It can only be invoked during PEI phase; | |
545 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
546 | If there is no additional space for HOB creation, then ASSERT(). | |
547 | ||
548 | @param BaseAddress The base address of the Firmware Volume. | |
549 | @param Length The size of the Firmware Volume in bytes. | |
550 | @param FvName The name of the Firmware Volume. | |
551 | @param FileName The name of the file. | |
552 | ||
553 | **/ | |
554 | VOID | |
555 | EFIAPI | |
556 | BuildFv2Hob ( | |
557 | IN EFI_PHYSICAL_ADDRESS BaseAddress, | |
558 | IN UINT64 Length, | |
559 | IN CONST EFI_GUID *FvName, | |
560 | IN CONST EFI_GUID *FileName | |
561 | ); | |
562 | ||
563 | /** | |
564 | Builds a Capsule Volume HOB. | |
565 | ||
566 | This function builds a Capsule Volume HOB. | |
567 | It can only be invoked during PEI phase; | |
568 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
569 | If there is no additional space for HOB creation, then ASSERT(). | |
570 | ||
571 | @param BaseAddress The base address of the Capsule Volume. | |
572 | @param Length The size of the Capsule Volume in bytes. | |
573 | ||
574 | **/ | |
575 | VOID | |
576 | EFIAPI | |
577 | BuildCvHob ( | |
578 | IN EFI_PHYSICAL_ADDRESS BaseAddress, | |
579 | IN UINT64 Length | |
580 | ); | |
581 | ||
582 | /** | |
583 | Builds a HOB for the CPU. | |
584 | ||
585 | This function builds a HOB for the CPU. | |
586 | It can only be invoked during PEI phase; | |
587 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
588 | If there is no additional space for HOB creation, then ASSERT(). | |
589 | ||
590 | @param SizeOfMemorySpace The maximum physical memory addressability of the processor. | |
591 | @param SizeOfIoSpace The maximum physical I/O addressability of the processor. | |
592 | ||
593 | **/ | |
594 | VOID | |
595 | EFIAPI | |
596 | BuildCpuHob ( | |
597 | IN UINT8 SizeOfMemorySpace, | |
598 | IN UINT8 SizeOfIoSpace | |
599 | ); | |
600 | ||
601 | /** | |
602 | Builds a HOB for the Stack. | |
603 | ||
604 | This function builds a HOB for the stack. | |
605 | It can only be invoked during PEI phase; | |
606 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
607 | If there is no additional space for HOB creation, then ASSERT(). | |
608 | ||
609 | @param BaseAddress The 64 bit physical address of the Stack. | |
610 | @param Length The length of the stack in bytes. | |
611 | ||
612 | **/ | |
613 | VOID | |
614 | EFIAPI | |
615 | BuildStackHob ( | |
616 | IN EFI_PHYSICAL_ADDRESS BaseAddress, | |
617 | IN UINT64 Length | |
618 | ); | |
619 | ||
620 | /** | |
621 | Update the Stack Hob if the stack has been moved | |
622 | ||
623 | @param BaseAddress The 64 bit physical address of the Stack. | |
624 | @param Length The length of the stack in bytes. | |
625 | ||
626 | **/ | |
627 | VOID | |
628 | UpdateStackHob ( | |
629 | IN EFI_PHYSICAL_ADDRESS BaseAddress, | |
630 | IN UINT64 Length | |
631 | ); | |
632 | ||
633 | ||
634 | /** | |
635 | Builds a HOB for the BSP store. | |
636 | ||
637 | This function builds a HOB for BSP store. | |
638 | It can only be invoked during PEI phase; | |
639 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
640 | If there is no additional space for HOB creation, then ASSERT(). | |
641 | ||
642 | @param BaseAddress The 64 bit physical address of the BSP. | |
643 | @param Length The length of the BSP store in bytes. | |
644 | @param MemoryType Type of memory allocated by this HOB. | |
645 | ||
646 | **/ | |
647 | VOID | |
648 | EFIAPI | |
649 | BuildBspStoreHob ( | |
650 | IN EFI_PHYSICAL_ADDRESS BaseAddress, | |
651 | IN UINT64 Length, | |
652 | IN EFI_MEMORY_TYPE MemoryType | |
653 | ); | |
654 | ||
655 | /** | |
656 | Builds a HOB for the memory allocation. | |
657 | ||
658 | This function builds a HOB for the memory allocation. | |
659 | It can only be invoked during PEI phase; | |
660 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. | |
661 | If there is no additional space for HOB creation, then ASSERT(). | |
662 | ||
663 | @param BaseAddress The 64 bit physical address of the memory. | |
664 | @param Length The length of the memory allocation in bytes. | |
665 | @param MemoryType Type of memory allocated by this HOB. | |
666 | ||
667 | **/ | |
668 | VOID | |
669 | EFIAPI | |
670 | BuildMemoryAllocationHob ( | |
671 | IN EFI_PHYSICAL_ADDRESS BaseAddress, | |
672 | IN UINT64 Length, | |
673 | IN EFI_MEMORY_TYPE MemoryType | |
674 | ); | |
675 | ||
676 | ||
e4dbec73 | 677 | VOID |
678 | EFIAPI | |
679 | BuildExtractSectionHob ( | |
680 | IN EFI_GUID *Guid, | |
681 | IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER SectionGetInfo, | |
682 | IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER SectionExtraction | |
683 | ); | |
684 | ||
685 | VOID | |
686 | EFIAPI | |
687 | BuildPeCoffLoaderHob ( | |
ca3ad58b | 688 | VOID |
e4dbec73 | 689 | ); |
690 | ||
691 | ||
2ef2b01e A |
692 | /** |
693 | Allocates one or more 4KB pages of type EfiBootServicesData. | |
694 | ||
695 | Allocates the number of 4KB pages of MemoryType and returns a pointer to the | |
696 | allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL | |
697 | is returned. If there is not enough memory remaining to satisfy the request, then NULL is | |
698 | returned. | |
699 | ||
700 | @param Pages The number of 4 KB pages to allocate. | |
701 | ||
702 | @return A pointer to the allocated buffer or NULL if allocation fails. | |
703 | ||
704 | **/ | |
705 | VOID * | |
706 | EFIAPI | |
707 | AllocatePages ( | |
708 | IN UINTN Pages | |
709 | ); | |
710 | ||
711 | /** | |
712 | Allocates a buffer of type EfiBootServicesData. | |
713 | ||
714 | Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a | |
715 | pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is | |
716 | returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. | |
717 | ||
718 | @param AllocationSize The number of bytes to allocate. | |
719 | ||
720 | @return A pointer to the allocated buffer or NULL if allocation fails. | |
721 | ||
722 | **/ | |
723 | VOID * | |
724 | EFIAPI | |
725 | AllocatePool ( | |
726 | IN UINTN AllocationSize | |
727 | ); | |
728 | ||
729 | ||
730 | /** | |
731 | Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment. | |
732 | ||
733 | Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an | |
734 | alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is | |
735 | returned. If there is not enough memory at the specified alignment remaining to satisfy the | |
736 | request, then NULL is returned. | |
737 | If Alignment is not a power of two and Alignment is not zero, then ASSERT(). | |
738 | ||
739 | @param Pages The number of 4 KB pages to allocate. | |
740 | @param Alignment The requested alignment of the allocation. Must be a power of two. | |
741 | If Alignment is zero, then byte alignment is used. | |
742 | ||
743 | @return A pointer to the allocated buffer or NULL if allocation fails. | |
744 | ||
745 | **/ | |
746 | VOID * | |
747 | EFIAPI | |
748 | AllocateAlignedPages ( | |
749 | IN UINTN Pages, | |
750 | IN UINTN Alignment | |
751 | ); | |
752 | ||
753 | ||
754 | EFI_STATUS | |
755 | EFIAPI | |
756 | LoadPeCoffImage ( | |
757 | IN VOID *PeCoffImage, | |
758 | OUT EFI_PHYSICAL_ADDRESS *ImageAddress, | |
759 | OUT UINT64 *ImageSize, | |
760 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint | |
761 | ); | |
762 | ||
763 | EFI_STATUS | |
764 | EFIAPI | |
765 | LoadDxeCoreFromFfsFile ( | |
766 | IN EFI_PEI_FILE_HANDLE FileHandle, | |
767 | IN UINTN StackSize | |
768 | ); | |
769 | ||
770 | EFI_STATUS | |
771 | EFIAPI | |
772 | LoadDxeCoreFromFv ( | |
773 | IN UINTN *FvInstance, OPTIONAL | |
774 | IN UINTN StackSize | |
775 | ); | |
776 | ||
777 | EFI_STATUS | |
778 | EFIAPI | |
779 | DecompressFirstFv ( | |
780 | VOID | |
781 | ); | |
782 | ||
783 | VOID | |
784 | EFIAPI | |
785 | AddDxeCoreReportStatusCodeCallback ( | |
786 | VOID | |
787 | ); | |
788 | ||
789 | ||
790 | #endif |