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