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