本文整理匯總了C++中GET_NEXT_HOB函數的典型用法代碼示例。如果您正苦於以下問題:C++ GET_NEXT_HOB函數的具體用法?C++ GET_NEXT_HOB怎麽用?C++ GET_NEXT_HOB使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GET_NEXT_HOB函數的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: 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;
}
示例3: 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;
}
示例4: install_e820_map
unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
{
unsigned num_entries = 0;
EFI_PEI_HOB_POINTERS hob;
hob.Raw = gd->arch.hob_list;
while (!END_OF_HOB_LIST(hob)) {
if (hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
entries[num_entries].addr = hob.ResourceDescriptor->PhysicalStart;
entries[num_entries].size = hob.ResourceDescriptor->ResourceLength;
entries[num_entries].type = E820_RAM;
} else if (hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) {
entries[num_entries].addr = hob.ResourceDescriptor->PhysicalStart;
entries[num_entries].size = hob.ResourceDescriptor->ResourceLength;
entries[num_entries].type = E820_RESERVED;
}
}
hob.Raw = GET_NEXT_HOB(hob);
num_entries++;
}
return num_entries;
}
示例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: ProcessFspHobList
/**
Process FSP HOB list
@param[in] FspHobList Pointer to the HOB data structure produced by FSP.
**/
VOID
ProcessFspHobList (
IN VOID *FspHobList
)
{
EFI_PEI_HOB_POINTERS FspHob;
FspHob.Raw = FspHobList;
//
// Add all the HOBs from FSP binary to FSP wrapper
//
while (!END_OF_HOB_LIST (FspHob)) {
if (FspHob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) {
//
// Skip FSP binary creates PcdDataBaseHobGuid
//
if (!CompareGuid(&FspHob.Guid->Name, &gPcdDataBaseHobGuid)) {
BuildGuidDataHob (
&FspHob.Guid->Name,
GET_GUID_HOB_DATA(FspHob),
GET_GUID_HOB_DATA_SIZE(FspHob)
);
}
}
FspHob.Raw = GET_NEXT_HOB (FspHob);
}
}
示例7: 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);
}
}
示例8: 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);
}
}
示例9: 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;
}
示例10: HeapGetBaseAddressInTempMem
/**
*
* HeapGetBaseAddressInTempMem
*
* This function gets heap base address in HEAP_TEMP_MEM phase
*
* @param[in] StdHeader - Pointer to AMD_CONFIG_PARAMS struct.
*
* @retval UINT64 - Heap base address in HEAP_TEMP_MEM phase
*
*/
UINT64
HeapGetBaseAddressInTempMem (
IN AMD_CONFIG_PARAMS *StdHeader
)
{
EFI_PEI_SERVICES **PeiServices;
EFI_PEI_HOB_POINTERS Hob;
AGESA_STATUS IgnoredStatus;
UINT64 BaseAddress;
BaseAddress = UserOptions.CfgHeapDramAddress;
if (IsBsp (StdHeader, &IgnoredStatus) && (StdHeader->HeapStatus != HEAP_LOCAL_CACHE)) {
PeiServices = (EFI_PEI_SERVICES **) StdHeader->ImageBasePtr;
//
// Retrieve the new Heap Manager base in HOB and update StdHeader
//
(*PeiServices)->GetHobList (PeiServices, &Hob.Raw);
while (!END_OF_HOB_LIST (Hob)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION &&
CompareGuid ( &Hob.Guid->Name, &gAmdHeapHobGuid)) {
BaseAddress = (UINT64) (VOID *) (Hob.Raw +
sizeof (EFI_HOB_GENERIC_HEADER) +
sizeof (EFI_GUID));
break;
}
Hob.Raw = GET_NEXT_HOB (Hob);
}
}
return BaseAddress;
}
示例11: ReportStatusCode
/**
Remove a previously registered callback function from the notification list.
ReportStatusCode() messages will no longer be forwarded to the Callback function.
@param[in] Callback A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is to be
unregistered.
@retval EFI_SUCCESS The function was successfully unregistered.
@retval EFI_INVALID_PARAMETER The callback function was NULL.
@retval EFI_NOT_FOUND The callback function was not found to be unregistered.
**/
EFI_STATUS
EFIAPI
Unregister (
IN EFI_PEI_RSC_HANDLER_CALLBACK Callback
)
{
EFI_PEI_HOB_POINTERS Hob;
EFI_PEI_RSC_HANDLER_CALLBACK *CallbackEntry;
UINTN *NumberOfEntries;
UINTN Index;
if (Callback == NULL) {
return EFI_INVALID_PARAMETER;
}
Hob.Raw = GetFirstGuidHob (&gStatusCodeCallbackGuid);
while (Hob.Raw != NULL) {
NumberOfEntries = GET_GUID_HOB_DATA (Hob);
CallbackEntry = (EFI_PEI_RSC_HANDLER_CALLBACK *) (NumberOfEntries + 1);
for (Index = 0; Index < *NumberOfEntries; Index++) {
if (CallbackEntry[Index] == Callback) {
//
// Set removed entry as NULL.
//
CallbackEntry[Index] = NULL;
return EFI_SUCCESS;
}
}
Hob.Raw = GET_NEXT_HOB (Hob);
Hob.Raw = GetNextGuidHob (&gStatusCodeCallbackGuid, Hob.Raw);
}
return EFI_NOT_FOUND;
}
示例12: 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;
}
示例13: 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);
}
}
示例14: GetDxeCoreHobInfo
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;
}
示例15: GetPeiProtocol
EFI_STATUS
GetPeiProtocol (
IN EFI_GUID *ProtocolGuid,
IN VOID **Interface
)
/*++
Routine Description:
Searches for a Protocol Interface passed from PEI through a HOB
Arguments:
ProtocolGuid - The Protocol GUID to search for in the HOB List
Interface - A pointer to the interface for the Protocol GUID
Returns:
EFI_SUCCESS - The Protocol GUID was found and its interface is returned in Interface
EFI_NOT_FOUND - The Protocol GUID was not found in the HOB List
--*/
{
EFI_STATUS Status;
EFI_PEI_HOB_POINTERS GuidHob;
//
// Get Hob list
//
Status = EfiLibGetSystemConfigurationTable (&gEfiHobListGuid, (VOID **) &GuidHob.Raw);
if (EFI_ERROR (Status)) {
return Status;
}
for (Status = EFI_NOT_FOUND; EFI_ERROR (Status);) {
if (END_OF_HOB_LIST (GuidHob)) {
Status = EFI_NOT_FOUND;
break;
}
if (GET_HOB_TYPE (GuidHob) == EFI_HOB_TYPE_GUID_EXTENSION) {
if (EfiCompareGuid (ProtocolGuid, &GuidHob.Guid->Name)) {
Status = EFI_SUCCESS;
*Interface = (VOID *) *(UINTN *) ((UINT8 *) (&GuidHob.Guid->Name) + sizeof (EFI_GUID));
}
}
GuidHob.Raw = GET_NEXT_HOB (GuidHob);
}
return Status;
}