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