PrePiLib.h 23 KB

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