32 Hob.Raw =
GetFirstHob (EFI_HOB_TYPE_MEMORY_ALLOCATION);
33 while (Hob.Raw !=
NULL) {
39 Hob.Raw =
GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, GET_NEXT_HOB (Hob));
63 OUT UINT64 *ImageSize,
71 ZeroMem (&ImageContext,
sizeof (ImageContext));
73 ImageContext.
Handle = PeCoffImage;
77 if (EFI_ERROR (Status)) {
87 return EFI_OUT_OF_RESOURCES;
96 if (EFI_ERROR (Status)) {
105 if (EFI_ERROR (Status)) {
133 IN EFI_FV_FILETYPE FileType,
145 EndOfFirmwareVolume = CurrentAddress + FvHeader->FvLength;
150 for (EndOfFile = CurrentAddress + FvHeader->HeaderLength; ; ) {
151 CurrentAddress = (EndOfFile + 7) & 0xfffffffffffffff8ULL;
152 if (CurrentAddress > EndOfFirmwareVolume) {
157 if (IS_FFS_FILE2 (File)) {
158 Size = FFS_FILE2_SIZE (File);
159 if (Size <= 0x00FFFFFF) {
169 EndOfFile = CurrentAddress + Size;
170 if (EndOfFile > EndOfFirmwareVolume) {
177 if (File->
Type == FileType) {
185 return EFI_NOT_FOUND;
203 IN EFI_SECTION_TYPE SectionType,
204 OUT VOID **SectionData
212 if (IS_FFS_FILE2 (FileHeader)) {
213 FileSize = FFS_FILE2_SIZE (FileHeader);
223 while (Index < FileSize) {
224 if (Section->Type == SectionType) {
225 if (IS_SECTION2 (Section)) {
234 if (IS_SECTION2 (Section)) {
235 SectionSize = SECTION2_SIZE (Section);
240 SectionSize = GET_OCCUPIED_SIZE (SectionSize, 4);
241 ASSERT (SectionSize != 0);
242 Index += SectionSize;
247 return EFI_NOT_FOUND;
260 OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint
277 if (EFI_ERROR (Status)) {
281 Status =
FileFindSection (FileHeader, EFI_SECTION_FIRMWARE_VOLUME_IMAGE, (VOID **)&DxeCoreFv);
282 if (EFI_ERROR (Status)) {
295 if (EFI_ERROR (Status)) {
300 if (EFI_ERROR (Status)) {
307 Status =
LoadPeCoffImage (PeCoffImage, &ImageAddress, &ImageSize, DxeCoreEntryPoint);
308 if (EFI_ERROR (Status)) {
329 OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint
342 if (EFI_ERROR (Status)) {
347 if (EFI_ERROR (Status)) {
354 Status =
LoadPeCoffImage (PeCoffImage, &ImageAddress, &ImageSize, DxeCoreEntryPoint);
355 if (EFI_ERROR (Status)) {
VOID *EFIAPI GetFirstHob(IN UINT16 Type)
VOID EFIAPI BuildModuleHob(IN CONST EFI_GUID *ModuleName, IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, IN UINT64 ModuleLength, IN EFI_PHYSICAL_ADDRESS EntryPoint)
VOID EFIAPI BuildFvHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
VOID *EFIAPI GetNextHob(IN UINT16 Type, IN CONST VOID *HobStart)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
EFI_STATUS UniversalLoadDxeCore(IN EFI_FIRMWARE_VOLUME_HEADER *DxeFv, OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint)
EFI_STATUS FileFindSection(IN EFI_FFS_FILE_HEADER *FileHeader, IN EFI_SECTION_TYPE SectionType, OUT VOID **SectionData)
EFI_STATUS LoadDxeCore(OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint)
VOID * AllocateCodePages(IN UINTN Pages)
EFI_STATUS FvFindFileByTypeGuid(IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader, IN EFI_FV_FILETYPE FileType, IN EFI_GUID *Guid OPTIONAL, OUT EFI_FFS_FILE_HEADER **FileHeader)
EFI_STATUS LoadPeCoffImage(IN VOID *PeCoffImage, OUT EFI_PHYSICAL_ADDRESS *ImageAddress, OUT UINT64 *ImageSize, OUT EFI_PHYSICAL_ADDRESS *EntryPoint)
#define ASSERT_EFI_ERROR(StatusParameter)
#define PcdGet32(TokenName)
RETURN_STATUS EFIAPI PeCoffLoaderLoadImage(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
RETURN_STATUS EFIAPI PeCoffLoaderRelocateImage(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
RETURN_STATUS EFIAPI PeCoffLoaderGetImageInfo(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
RETURN_STATUS EFIAPI PeCoffLoaderImageReadFromMemory(IN VOID *FileHandle, IN UINTN FileOffset, IN OUT UINTN *ReadSize, OUT VOID *Buffer)
#define FFS_FILE_SIZE(FfsFileHeaderPtr)
#define SECTION_SIZE(SectionHeaderPtr)
VOID *EFIAPI AllocatePages(IN UINTN Pages)
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_SIZE_TO_PAGES(Size)
EFI_PHYSICAL_ADDRESS MemoryBaseAddress
EFI_MEMORY_TYPE MemoryType
EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor
PE_COFF_LOADER_READ_FILE ImageRead
PHYSICAL_ADDRESS EntryPoint
PHYSICAL_ADDRESS ImageAddress