EFI_STATUS GetDxeCoreHobInfo ( IN VOID *HobStart, OUT EFI_PHYSICAL_ADDRESS *BaseAddress, OUT UINT64 *Length, OUT VOID **EntryPoint, OUT EFI_GUID **FileName ) /*++ Routine Description: Get memory allocation hob created for DXE core and extract its information Arguments: HobStart - Start pointer of the hob list BaseAddress - Start address of memory allocated for DXE core Length - Length of memory allocated for DXE core EntryPoint - DXE core file name FileName - File Name Returns: EFI_NOT_FOUND - DxeCoreHob not found EFI_SUCCESS - DxeCoreHob found and information got --*/ { EFI_PEI_HOB_POINTERS DxeCoreHob; DxeCoreHob.Raw = HobStart; DxeCoreHob.Raw = GetHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, DxeCoreHob.Raw); while (DxeCoreHob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION && !EfiCompareGuid (&DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.Name, &gEfiHobMemeryAllocModuleGuid)) { DxeCoreHob.Raw = GET_NEXT_HOB (DxeCoreHob); DxeCoreHob.Raw = GetHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, DxeCoreHob.Raw); } if (DxeCoreHob.Header->HobType != EFI_HOB_TYPE_MEMORY_ALLOCATION) { return EFI_NOT_FOUND; } *BaseAddress = DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.MemoryBaseAddress; *Length = DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.MemoryLength; *EntryPoint = (VOID *) (UINTN) DxeCoreHob.MemoryAllocationModule->EntryPoint; *FileName = &DxeCoreHob.MemoryAllocationModule->ModuleName; return EFI_SUCCESS; }
EFI_STATUS GetNextFirmwareVolume2Hob ( IN OUT VOID **HobStart, OUT EFI_PHYSICAL_ADDRESS *BaseAddress, OUT UINT64 *Length, OUT EFI_GUID *FileName ) /*++ Routine Description: Get next firmware volume2 hob from HobStart Arguments: HobStart - Start pointer of hob list BaseAddress - Start address of next firmware volume Length - Length of next firmware volume Returns: EFI_NOT_FOUND - Next firmware volume not found EFI_SUCCESS - Next firmware volume found with address information --*/ { EFI_PEI_HOB_POINTERS FirmwareVolumeHob; FirmwareVolumeHob.Raw = *HobStart; if (END_OF_HOB_LIST (FirmwareVolumeHob)) { return EFI_NOT_FOUND; } FirmwareVolumeHob.Raw = GetHob (EFI_HOB_TYPE_FV2, *HobStart); if (FirmwareVolumeHob.Header->HobType != EFI_HOB_TYPE_FV2) { return EFI_NOT_FOUND; } *BaseAddress = FirmwareVolumeHob.FirmwareVolume2->BaseAddress; *Length = FirmwareVolumeHob.FirmwareVolume2->Length; EfiCommonLibCopyMem(FileName,&FirmwareVolumeHob.FirmwareVolume2->FileName,sizeof(EFI_GUID)); *HobStart = GET_NEXT_HOB (FirmwareVolumeHob); return EFI_SUCCESS; }
STATIC EFI_STATUS GetNextCapsuleVolumeHob ( IN OUT VOID **HobStart, OUT EFI_PHYSICAL_ADDRESS *BaseAddress, OUT UINT64 *Length ) /*++ Routine Description: Find the next Capsule volume HOB Arguments: HobStart - start of HOBs BaseAddress - returned base address of capsule volume Length - length of capsule volume pointed to by BaseAddress Returns: EFI_SUCCESS - one found EFI_NOT_FOUND - did not find one --*/ { EFI_PEI_HOB_POINTERS Hob; Hob.Raw = *HobStart; if (END_OF_HOB_LIST (Hob)) { return EFI_NOT_FOUND; } Hob.Raw = GetHob (EFI_HOB_TYPE_CV, *HobStart); if (Hob.Header->HobType != EFI_HOB_TYPE_CV) { return EFI_NOT_FOUND; } *BaseAddress = Hob.CapsuleVolume->BaseAddress; *Length = Hob.CapsuleVolume->Length; *HobStart = GET_NEXT_HOB (Hob); return EFI_SUCCESS; }
EFI_STATUS GetCpuHobInfo ( IN VOID *HobStart, OUT UINT8 *SizeOfMemorySpace, OUT UINT8 *SizeOfIoSpace ) /*++ Routine Description: Get information recorded in CPU hob (Memory space size, Io space size) Arguments: HobStart - Start pointer of hob list SizeOfMemorySpace - Size of memory size SizeOfIoSpace - Size of IO size Returns: EFI_NOT_FOUND - CPU hob not found EFI_SUCCESS - CPU hob found and information got. --*/ { EFI_PEI_HOB_POINTERS CpuHob; CpuHob.Raw = HobStart; CpuHob.Raw = GetHob (EFI_HOB_TYPE_CPU, CpuHob.Raw); if (CpuHob.Header->HobType != EFI_HOB_TYPE_CPU) { return EFI_NOT_FOUND; } *SizeOfMemorySpace = CpuHob.Cpu->SizeOfMemorySpace; *SizeOfIoSpace = CpuHob.Cpu->SizeOfIoSpace; return EFI_SUCCESS; }