PrePiLib.h 22 KB

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