TianoCore EDK2 master
Loading...
Searching...
No Matches
Common.c File Reference

Go to the source code of this file.

Functions

VOID *EFIAPI GetHobList (VOID)
 
VOID *EFIAPI GetNextHob (IN UINT16 Type, IN CONST VOID *HobStart)
 
VOID *EFIAPI GetFirstHob (IN UINT16 Type)
 
VOID *EFIAPI GetNextGuidHob (IN CONST EFI_GUID *Guid, IN CONST VOID *HobStart)
 
VOID *EFIAPI GetFirstGuidHob (IN CONST EFI_GUID *Guid)
 
EFI_BOOT_MODE EFIAPI GetBootModeHob (VOID)
 
VOID EFIAPI BuildResourceDescriptorWithOwnerHob (IN EFI_RESOURCE_TYPE ResourceType, IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, IN EFI_PHYSICAL_ADDRESS PhysicalStart, IN UINT64 NumberOfBytes, IN EFI_GUID *OwnerGUID)
 
VOID EFIAPI BuildCvHob (IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
 
VOID EFIAPI BuildBspStoreHob (IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN EFI_MEMORY_TYPE MemoryType)
 
VOID EFIAPI BuildStackHob (IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
 

Detailed Description

HOB Library implementation for Standalone MM Core.

Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Common.c.

Function Documentation

◆ BuildBspStoreHob()

VOID EFIAPI BuildBspStoreHob ( IN EFI_PHYSICAL_ADDRESS  BaseAddress,
IN UINT64  Length,
IN EFI_MEMORY_TYPE  MemoryType 
)

Builds a HOB for the BSP store.

This function builds a HOB for BSP store. If there is no additional space for HOB creation, then ASSERT().

Parameters
BaseAddressThe 64 bit physical address of the BSP.
LengthThe length of the BSP store in bytes.
MemoryTypeType of memory allocated by this HOB.

Definition at line 266 of file Common.c.

◆ BuildCvHob()

VOID EFIAPI BuildCvHob ( IN EFI_PHYSICAL_ADDRESS  BaseAddress,
IN UINT64  Length 
)

Builds a Capsule Volume HOB.

This function builds a Capsule Volume HOB. If the platform does not support Capsule Volume HOBs, then ASSERT(). If there is no additional space for HOB creation, then ASSERT().

Parameters
BaseAddressThe base address of the Capsule Volume.
LengthThe size of the Capsule Volume in bytes.

Definition at line 245 of file Common.c.

◆ BuildResourceDescriptorWithOwnerHob()

VOID EFIAPI BuildResourceDescriptorWithOwnerHob ( IN EFI_RESOURCE_TYPE  ResourceType,
IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
IN EFI_PHYSICAL_ADDRESS  PhysicalStart,
IN UINT64  NumberOfBytes,
IN EFI_GUID OwnerGUID 
)

Builds a HOB that describes a chunk of system memory with Owner GUID.

This function builds a HOB that describes a chunk of system memory. If there is no additional space for HOB creation, then ASSERT().

Parameters
ResourceTypeThe type of resource described by this HOB.
ResourceAttributeThe resource attributes of the memory described by this HOB.
PhysicalStartThe 64 bit physical address of memory described by this HOB.
NumberOfBytesThe length of the memory described by this HOB in bytes.
OwnerGUIDGUID for the owner of this resource.

Definition at line 221 of file Common.c.

◆ BuildStackHob()

VOID EFIAPI BuildStackHob ( IN EFI_PHYSICAL_ADDRESS  BaseAddress,
IN UINT64  Length 
)

Builds a HOB for the Stack.

This function builds a HOB for the stack. If there is no additional space for HOB creation, then ASSERT().

Parameters
BaseAddressThe 64 bit physical address of the Stack.
LengthThe length of the stack in bytes.

Definition at line 287 of file Common.c.

◆ GetBootModeHob()

EFI_BOOT_MODE EFIAPI GetBootModeHob ( VOID  )

Get the system boot mode from the HOB list.

This function returns the system boot mode information from the PHIT HOB in HOB list.

If the pointer to the HOB list is NULL, then ASSERT().

Parameters
VOID
Returns
The Boot Mode.

Definition at line 195 of file Common.c.

◆ GetFirstGuidHob()

VOID *EFIAPI GetFirstGuidHob ( IN CONST EFI_GUID Guid)

Returns the first instance of the matched GUID HOB among the whole HOB list.

This function searches the first instance of a HOB among the whole HOB list. Such HOB should satisfy two conditions: its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. If such a HOB from the starting HOB pointer does not exist, it will return NULL. Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () to extract the data section and its size information, respectively.

If the pointer to the HOB list is NULL, then ASSERT(). If Guid is NULL, then ASSERT().

Parameters
GuidThe GUID to match with in the HOB list.
Returns
The first instance of the matched GUID HOB among the whole HOB list.

Definition at line 170 of file Common.c.

◆ GetFirstHob()

VOID *EFIAPI GetFirstHob ( IN UINT16  Type)

Returns the first instance of a HOB type among the whole HOB list.

This function searches the first instance of a HOB type among the whole HOB list. If there does not exist such HOB type in the HOB list, it will return NULL.

If the pointer to the HOB list is NULL, then ASSERT().

Parameters
TypeThe HOB type to return.
Returns
The next instance of a HOB type from the starting HOB.

Definition at line 97 of file Common.c.

◆ GetHobList()

VOID *EFIAPI GetHobList ( VOID  )

Returns the pointer to the HOB list.

This function returns the pointer to first HOB in the list. If the pointer to the HOB list is NULL, then ASSERT().

Returns
The pointer to the HOB list.

Definition at line 31 of file Common.c.

◆ GetNextGuidHob()

VOID *EFIAPI GetNextGuidHob ( IN CONST EFI_GUID Guid,
IN CONST VOID *  HobStart 
)

Returns the next instance of the matched GUID HOB from the starting HOB.

This function searches the first instance of a HOB from the starting HOB pointer. Such HOB should satisfy two conditions: its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equals to the input Guid. If such a HOB from the starting HOB pointer does not exist, it will return NULL. Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () to extract the data section and its size information, respectively. In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer unconditionally: it returns HobStart back if HobStart itself meets the requirement; caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.

If Guid is NULL, then ASSERT(). If HobStart is NULL, then ASSERT().

Parameters
GuidThe GUID to match with in the HOB list.
HobStartA pointer to a Guid.
Returns
The next instance of the matched GUID HOB from the starting HOB.

Definition at line 131 of file Common.c.

◆ GetNextHob()

VOID *EFIAPI GetNextHob ( IN UINT16  Type,
IN CONST VOID *  HobStart 
)

Returns the next instance of a HOB type from the starting HOB.

This function searches the first instance of a HOB type from the starting HOB pointer. If there does not exist such HOB type from the starting HOB pointer, it will return NULL. In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer unconditionally: it returns HobStart back if HobStart itself meets the requirement; caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.

If HobStart is NULL, then ASSERT().

Parameters
TypeThe HOB type to return.
HobStartThe starting HOB pointer to search from.
Returns
The next instance of a HOB type from the starting HOB.

Definition at line 58 of file Common.c.