本文整理汇总了C++中GetHobList函数的典型用法代码示例。如果您正苦于以下问题:C++ GetHobList函数的具体用法?C++ GetHobList怎么用?C++ GetHobList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetHobList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitCapsulePtr
/**
This function initializes the mCapsulePtr, mCapsuleStatusArray and mCapsuleTotalNumber.
**/
VOID
InitCapsulePtr (
VOID
)
{
EFI_PEI_HOB_POINTERS HobPointer;
UINTN Index;
//
// Find all capsule images from hob
//
HobPointer.Raw = GetHobList ();
while ((HobPointer.Raw = GetNextHob (EFI_HOB_TYPE_UEFI_CAPSULE, HobPointer.Raw)) != NULL) {
if (!IsValidCapsuleHeader((VOID *)(UINTN)HobPointer.Capsule->BaseAddress, HobPointer.Capsule->Length)) {
HobPointer.Header->HobType = EFI_HOB_TYPE_UNUSED; // Mark this hob as invalid
} else {
mCapsuleTotalNumber++;
}
HobPointer.Raw = GET_NEXT_HOB (HobPointer);
}
DEBUG ((DEBUG_INFO, "mCapsuleTotalNumber - 0x%x\n", mCapsuleTotalNumber));
if (mCapsuleTotalNumber == 0) {
return ;
}
//
// Init temp Capsule Data table.
//
mCapsulePtr = (VOID **) AllocateZeroPool (sizeof (VOID *) * mCapsuleTotalNumber);
if (mCapsulePtr == NULL) {
DEBUG ((DEBUG_ERROR, "Allocate mCapsulePtr fail!\n"));
mCapsuleTotalNumber = 0;
return ;
}
mCapsuleStatusArray = (EFI_STATUS *) AllocateZeroPool (sizeof (EFI_STATUS) * mCapsuleTotalNumber);
if (mCapsuleStatusArray == NULL) {
DEBUG ((DEBUG_ERROR, "Allocate mCapsuleStatusArray fail!\n"));
FreePool (mCapsulePtr);
mCapsulePtr = NULL;
mCapsuleTotalNumber = 0;
return ;
}
SetMemN (mCapsuleStatusArray, sizeof (EFI_STATUS) * mCapsuleTotalNumber, EFI_NOT_READY);
//
// Find all capsule images from hob
//
HobPointer.Raw = GetHobList ();
Index = 0;
while ((HobPointer.Raw = GetNextHob (EFI_HOB_TYPE_UEFI_CAPSULE, HobPointer.Raw)) != NULL) {
mCapsulePtr [Index++] = (VOID *) (UINTN) HobPointer.Capsule->BaseAddress;
HobPointer.Raw = GET_NEXT_HOB (HobPointer);
}
}
示例2: UpdateStackHob
/**
Update the Stack Hob if the stack has been moved
@param BaseAddress The 64 bit physical address of the Stack.
@param Length The length of the stack in bytes.
**/
VOID
UpdateStackHob (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
{
EFI_PEI_HOB_POINTERS Hob;
Hob.Raw = GetHobList ();
while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, Hob.Raw)) != NULL) {
if (CompareGuid (&gEfiHobMemoryAllocStackGuid, &(Hob.MemoryAllocationStack->AllocDescriptor.Name))) {
//
// Build a new memory allocation HOB with old stack info with EfiConventionalMemory type
// to be reclaimed by DXE core.
//
BuildMemoryAllocationHob (
Hob.MemoryAllocationStack->AllocDescriptor.MemoryBaseAddress,
Hob.MemoryAllocationStack->AllocDescriptor.MemoryLength,
EfiConventionalMemory
);
//
// Update the BSP Stack Hob to reflect the new stack info.
//
Hob.MemoryAllocationStack->AllocDescriptor.MemoryBaseAddress = BaseAddress;
Hob.MemoryAllocationStack->AllocDescriptor.MemoryLength = Length;
break;
}
Hob.Raw = GET_NEXT_HOB (Hob);
}
}
示例3: FspGetResourceDescriptorByOwner
EFIAPI
FspGetResourceDescriptorByOwner (
IN EFI_GUID *OwnerGuid
)
{
EFI_PEI_HOB_POINTERS Hob;
//
// Get the HOB list for processing
//
Hob.Raw = GetHobList ();
//
// Collect memory ranges
//
while (!END_OF_HOB_LIST (Hob)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) && \
(CompareGuid (&Hob.ResourceDescriptor->Owner, OwnerGuid))) {
return Hob.ResourceDescriptor;
}
}
Hob.Raw = GET_NEXT_HOB (Hob);
}
return NULL;
}
示例4: CheckOverlapWithAllocatedBuffer
/**
Check if AP wakeup buffer is overlapped with existing allocated buffer.
@param[in] WakeupBufferStart AP wakeup buffer start address.
@param[in] WakeupBufferEnd AP wakeup buffer end address.
@retval TRUE There is overlap.
@retval FALSE There is no overlap.
**/
BOOLEAN
CheckOverlapWithAllocatedBuffer (
IN UINT64 WakeupBufferStart,
IN UINT64 WakeupBufferEnd
)
{
EFI_PEI_HOB_POINTERS Hob;
EFI_HOB_MEMORY_ALLOCATION *MemoryHob;
BOOLEAN Overlapped;
UINT64 MemoryStart;
UINT64 MemoryEnd;
Overlapped = FALSE;
//
// Get the HOB list for processing
//
Hob.Raw = GetHobList ();
//
// Collect memory ranges
//
while (!END_OF_HOB_LIST (Hob)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {
MemoryHob = Hob.MemoryAllocation;
MemoryStart = MemoryHob->AllocDescriptor.MemoryBaseAddress;
MemoryEnd = MemoryHob->AllocDescriptor.MemoryBaseAddress + MemoryHob->AllocDescriptor.MemoryLength;
if (!((WakeupBufferStart >= MemoryEnd) || (WakeupBufferEnd <= MemoryStart))) {
Overlapped = TRUE;
break;
}
}
Hob.Raw = GET_NEXT_HOB (Hob);
}
return Overlapped;
}
示例5: GetHighMemorySize
void
GetHighMemorySize (
uint64_t *HighMemoryLength
)
{
EFI_PEI_HOB_POINTERS Hob;
*HighMemoryLength = 0x0;
//
// Get the HOB list for processing
//
Hob.Raw = GetHobList();
//
// Collect memory ranges
//
while (!END_OF_HOB_LIST (Hob)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
//
// Need memory above 4GB to be collected here
//
if (Hob.ResourceDescriptor->PhysicalStart >= (EFI_PHYSICAL_ADDRESS) 0x100000000) {
*HighMemoryLength += (uint64_t) (Hob.ResourceDescriptor->ResourceLength);
}
}
}
Hob.Raw = GET_NEXT_HOB (Hob);
}
return;
}
示例6: GetPlatformInfoHob
EFI_STATUS
GetPlatformInfoHob (
IN CONST EFI_PEI_SERVICES **PeiServices,
OUT EFI_PLATFORM_INFO_HOB **PlatformInfoHob
)
{
EFI_PEI_HOB_POINTERS GuidHob;
//
// Find the PlatformInfo HOB
//
GuidHob.Raw = GetHobList ();
if (GuidHob.Raw == NULL) {
return EFI_NOT_FOUND;
}
if ((GuidHob.Raw = GetNextGuidHob (&gEfiPlatformInfoGuid, GuidHob.Raw)) != NULL) {
*PlatformInfoHob = GET_GUID_HOB_DATA (GuidHob.Guid);
}
//
// PlatformInfo PEIM should provide this HOB data, if not ASSERT and return error.
//
ASSERT (*PlatformInfoHob != NULL);
if (!(*PlatformInfoHob)) {
return EFI_NOT_FOUND;
}
return EFI_SUCCESS;
}
示例7: GetFspReservedMemoryFromGuid
void
GetFspReservedMemoryFromGuid (
uint32_t *FspMemoryBase,
uint32_t *FspMemoryLength,
EFI_GUID FspReservedMemoryGuid
)
{
EFI_PEI_HOB_POINTERS Hob;
//
// Get the HOB list for processing
//
Hob.Raw = GetHobList();
*FspMemoryBase = 0;
*FspMemoryLength = 0;
//
// Collect memory ranges
//
while (!END_OF_HOB_LIST (Hob)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) {
if (CompareGuid(&Hob.ResourceDescriptor->Owner, &FspReservedMemoryGuid)) {
*FspMemoryBase = (uint32_t) (Hob.ResourceDescriptor->PhysicalStart);
*FspMemoryLength = (uint32_t) (Hob.ResourceDescriptor->ResourceLength);
break;
}
}
}
Hob.Raw = GET_NEXT_HOB (Hob);
}
return;
}
示例8: GenericMemoryTestEntryPoint
/**
The generic memory test driver's entry point.
It initializes private data to default value.
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
@retval EFI_NOT_FOUND Can't find HandOff Hob in HobList.
@retval other Some error occurs when executing this entry point.
**/
EFI_STATUS
EFIAPI
GenericMemoryTestEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
VOID *HobList;
EFI_BOOT_MODE BootMode;
EFI_PEI_HOB_POINTERS Hob;
//
// Use the generic pattern to test compatible memory range
//
mGenericMemoryTestPrivate.MonoPattern = GenericMemoryTestMonoPattern;
mGenericMemoryTestPrivate.MonoTestSize = GENERIC_CACHELINE_SIZE;
//
// Get the platform boot mode
//
HobList = GetHobList ();
Hob.Raw = HobList;
if (Hob.Header->HobType != EFI_HOB_TYPE_HANDOFF) {
return EFI_NOT_FOUND;
}
BootMode = Hob.HandoffInformationTable->BootMode;
//
// Get the platform boot mode and create the default memory test coverage
// level and span size for compatible memory test using
//
switch (BootMode) {
case BOOT_WITH_FULL_CONFIGURATION:
case BOOT_WITH_DEFAULT_SETTINGS:
mGenericMemoryTestPrivate.CoverageSpan = SPARSE_SPAN_SIZE;
break;
case BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS:
mGenericMemoryTestPrivate.CoverageSpan = GENERIC_CACHELINE_SIZE;
break;
default:
mGenericMemoryTestPrivate.CoverageSpan = QUICK_SPAN_SIZE;
break;
}
//
// Install the protocol
//
Status = gBS->InstallProtocolInterface (
&mGenericMemoryTestPrivate.Handle,
&gEfiGenericMemTestProtocolGuid,
EFI_NATIVE_INTERFACE,
&mGenericMemoryTestPrivate.GenericMemoryTest
);
return Status;
}
示例9: PrePeiCoreGetMpCoreInfo
//
// Return list of cores in the system
//
EFI_STATUS
PrePeiCoreGetMpCoreInfo (
OUT UINTN *ArmCoreCount,
OUT ARM_CORE_INFO **ArmCoreInfoTable
)
{
EFI_PEI_HOB_POINTERS Hob;
if (ArmIsMpCore()) {
// Iterate through the HOBs and find if there is ARM PROCESSOR ENTRY HOB
for (Hob.Raw = GetHobList (); !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
// Check for Correct HOB type
if ((GET_HOB_TYPE (Hob)) == EFI_HOB_TYPE_GUID_EXTENSION) {
// Check for correct GUID type
if (CompareGuid(&(Hob.Guid->Name), &gAmdStyxMpCoreInfoGuid)) {
*ArmCoreInfoTable = (ARM_CORE_INFO *) GET_GUID_HOB_DATA(Hob);
*ArmCoreCount = GET_GUID_HOB_DATA_SIZE(Hob)/sizeof(ARM_CORE_INFO);
return EFI_SUCCESS;
}
}
}
}
return EFI_UNSUPPORTED;
}
示例10: UpdateStackHob
/**
Updates the Stack HOB passed to DXE phase.
This function traverses the whole HOB list and update the stack HOB to
reflect the real stack that is used by DXE core.
@param BaseAddress The lower address of stack used by DxeCore.
@param Length The length of stack used by DxeCore.
**/
VOID
UpdateStackHob (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
{
EFI_PEI_HOB_POINTERS Hob;
Hob.Raw = GetHobList ();
while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, Hob.Raw)) != NULL) {
if (CompareGuid (&gEfiHobMemoryAllocStackGuid, &(Hob.MemoryAllocationStack->AllocDescriptor.Name))) {
//
// Build a new memory allocation HOB with old stack info with EfiBootServicesData type. Need to
// avoid this region be reclaimed by DXE core as the IDT built in SEC might be on stack, and some
// PEIMs may also keep key information on stack
//
BuildMemoryAllocationHob (
Hob.MemoryAllocationStack->AllocDescriptor.MemoryBaseAddress,
Hob.MemoryAllocationStack->AllocDescriptor.MemoryLength,
EfiBootServicesData
);
//
// Update the BSP Stack Hob to reflect the new stack info.
//
Hob.MemoryAllocationStack->AllocDescriptor.MemoryBaseAddress = BaseAddress;
Hob.MemoryAllocationStack->AllocDescriptor.MemoryLength = Length;
break;
}
Hob.Raw = GET_NEXT_HOB (Hob);
}
}
示例11: AllocatePeiAccessiblePages
EFIAPI
AllocatePeiAccessiblePages (
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages
)
{
EFI_STATUS Status;
EFI_ALLOCATE_TYPE AllocType;
EFI_PHYSICAL_ADDRESS Memory;
EFI_HOB_HANDOFF_INFO_TABLE *PhitHob;
if (Pages == 0) {
return NULL;
}
AllocType = AllocateAnyPages;
//
// A X64 build of DXE may be combined with a 32-bit build of PEI, and so we
// need to check the memory limit set by PEI, and allocate below 4 GB if the
// limit is set to 4 GB or lower.
//
PhitHob = (EFI_HOB_HANDOFF_INFO_TABLE *)GetHobList ();
if (PhitHob->EfiFreeMemoryTop <= MAX_UINT32) {
AllocType = AllocateMaxAddress;
Memory = MAX_UINT32;
}
Status = gBS->AllocatePages (AllocType, MemoryType, Pages, &Memory);
if (EFI_ERROR (Status)) {
return NULL;
}
return (VOID *)(UINTN)Memory;
}
示例12: FspGetSystemMemorySize
/**
Get system memory from HOB.
@param[in,out] LowMemoryLength less than 4G memory length
@param[in,out] HighMemoryLength greater than 4G memory length
**/
VOID
EFIAPI
FspGetSystemMemorySize (
IN OUT UINT64 *LowMemoryLength,
IN OUT UINT64 *HighMemoryLength
)
{
EFI_STATUS Status;
EFI_BOOT_MODE BootMode;
EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
EFI_PEI_HOB_POINTERS Hob;
ResourceAttribute = (
EFI_RESOURCE_ATTRIBUTE_PRESENT |
EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
);
Status = PeiServicesGetBootMode (&BootMode);
ASSERT_EFI_ERROR (Status);
if (BootMode != BOOT_ON_S3_RESUME) {
ResourceAttribute |= EFI_RESOURCE_ATTRIBUTE_TESTED;
}
*HighMemoryLength = 0;
*LowMemoryLength = SIZE_1MB;
//
// Get the HOB list for processing
//
Hob.Raw = GetHobList ();
//
// Collect memory ranges
//
while (!END_OF_HOB_LIST (Hob)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) ||
((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) &&
(Hob.ResourceDescriptor->ResourceAttribute == ResourceAttribute))) {
//
// Need memory above 1MB to be collected here
//
if (Hob.ResourceDescriptor->PhysicalStart >= BASE_1MB &&
Hob.ResourceDescriptor->PhysicalStart < (EFI_PHYSICAL_ADDRESS) BASE_4GB) {
*LowMemoryLength += (UINT64) (Hob.ResourceDescriptor->ResourceLength);
} else if (Hob.ResourceDescriptor->PhysicalStart >= (EFI_PHYSICAL_ADDRESS) BASE_4GB) {
*HighMemoryLength += (UINT64) (Hob.ResourceDescriptor->ResourceLength);
}
}
}
Hob.Raw = GET_NEXT_HOB (Hob);
}
}
示例13: GetFirstHob
EFIAPI
GetFirstHob (
IN UINT16 Type
)
{
VOID *HobList;
HobList = GetHobList ();
return GetNextHob (Type, HobList);
}
示例14: GetFirstGuidHob
EFIAPI
GetFirstGuidHob (
IN CONST EFI_GUID *Guid
)
{
VOID *HobList;
HobList = GetHobList ();
return GetNextGuidHob (Guid, HobList);
}
示例15: GetHobList
/**
The constructor function caches the pointer to HOB list by calling GetHobList()
and will always return EFI_SUCCESS.
@param ImageHandle The firmware allocated handle for the EFI image.
@param SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The constructor successfully gets HobList.
**/
EFI_STATUS
EFIAPI
HobLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
GetHobList ();
return EFI_SUCCESS;
}