Path: blob/main/sys/contrib/edk2/Include/Pi/PiHob.h
96339 views
/** @file1HOB related definitions in PI.23Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>4SPDX-License-Identifier: BSD-2-Clause-Patent56@par Revision Reference:7PI Version 1.989**/1011#ifndef __PI_HOB_H__12#define __PI_HOB_H__1314//15// HobType of EFI_HOB_GENERIC_HEADER.16//17#define EFI_HOB_TYPE_HANDOFF 0x000118#define EFI_HOB_TYPE_MEMORY_ALLOCATION 0x000219#define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR 0x000320#define EFI_HOB_TYPE_GUID_EXTENSION 0x000421#define EFI_HOB_TYPE_FV 0x000522#define EFI_HOB_TYPE_CPU 0x000623#define EFI_HOB_TYPE_MEMORY_POOL 0x000724#define EFI_HOB_TYPE_FV2 0x000925#define EFI_HOB_TYPE_LOAD_PEIM_UNUSED 0x000A26#define EFI_HOB_TYPE_UEFI_CAPSULE 0x000B27#define EFI_HOB_TYPE_FV3 0x000C28#define EFI_HOB_TYPE_UNUSED 0xFFFE29#define EFI_HOB_TYPE_END_OF_HOB_LIST 0xFFFF3031///32/// Describes the format and size of the data inside the HOB.33/// All HOBs must contain this generic HOB header.34///35typedef struct {36///37/// Identifies the HOB data structure type.38///39UINT16 HobType;40///41/// The length in bytes of the HOB.42///43UINT16 HobLength;44///45/// This field must always be set to zero.46///47UINT32 Reserved;48} EFI_HOB_GENERIC_HEADER;4950///51/// Value of version in EFI_HOB_HANDOFF_INFO_TABLE.52///53#define EFI_HOB_HANDOFF_TABLE_VERSION 0x00095455///56/// Contains general state information used by the HOB producer phase.57/// This HOB must be the first one in the HOB list.58///59typedef struct {60///61/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_HANDOFF.62///63EFI_HOB_GENERIC_HEADER Header;64///65/// The version number pertaining to the PHIT HOB definition.66/// This value is four bytes in length to provide an 8-byte aligned entry67/// when it is combined with the 4-byte BootMode.68///69UINT32 Version;70///71/// The system boot mode as determined during the HOB producer phase.72///73EFI_BOOT_MODE BootMode;74///75/// The highest address location of memory that is allocated for use by the HOB producer76/// phase. This address must be 4-KB aligned to meet page restrictions of UEFI.77///78EFI_PHYSICAL_ADDRESS EfiMemoryTop;79///80/// The lowest address location of memory that is allocated for use by the HOB producer phase.81///82EFI_PHYSICAL_ADDRESS EfiMemoryBottom;83///84/// The highest address location of free memory that is currently available85/// for use by the HOB producer phase.86///87EFI_PHYSICAL_ADDRESS EfiFreeMemoryTop;88///89/// The lowest address location of free memory that is available for use by the HOB producer phase.90///91EFI_PHYSICAL_ADDRESS EfiFreeMemoryBottom;92///93/// The end of the HOB list.94///95EFI_PHYSICAL_ADDRESS EfiEndOfHobList;96} EFI_HOB_HANDOFF_INFO_TABLE;9798///99/// EFI_HOB_MEMORY_ALLOCATION_HEADER describes the100/// various attributes of the logical memory allocation. The type field will be used for101/// subsequent inclusion in the UEFI memory map.102///103typedef struct {104///105/// A GUID that defines the memory allocation region's type and purpose, as well as106/// other fields within the memory allocation HOB. This GUID is used to define the107/// additional data within the HOB that may be present for the memory allocation HOB.108/// Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0109/// specification.110///111EFI_GUID Name;112113///114/// The base address of memory allocated by this HOB. Type115/// EFI_PHYSICAL_ADDRESS is defined in AllocatePages() in the UEFI 2.0116/// specification.117///118EFI_PHYSICAL_ADDRESS MemoryBaseAddress;119120///121/// The length in bytes of memory allocated by this HOB.122///123UINT64 MemoryLength;124125///126/// Defines the type of memory allocated by this HOB. The memory type definition127/// follows the EFI_MEMORY_TYPE definition. Type EFI_MEMORY_TYPE is defined128/// in AllocatePages() in the UEFI 2.0 specification.129///130EFI_MEMORY_TYPE MemoryType;131132///133/// Padding for Itanium processor family134///135UINT8 Reserved[4];136} EFI_HOB_MEMORY_ALLOCATION_HEADER;137138///139/// Describes all memory ranges used during the HOB producer140/// phase that exist outside the HOB list. This HOB type141/// describes how memory is used, not the physical attributes of memory.142///143typedef struct {144///145/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.146///147EFI_HOB_GENERIC_HEADER Header;148///149/// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the150/// various attributes of the logical memory allocation.151///152EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;153//154// Additional data pertaining to the "Name" Guid memory155// may go here.156//157} EFI_HOB_MEMORY_ALLOCATION;158159///160/// Describes the memory stack that is produced by the HOB producer161/// phase and upon which all post-memory-installed executable162/// content in the HOB producer phase is executing.163///164typedef struct {165///166/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.167///168EFI_HOB_GENERIC_HEADER Header;169///170/// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the171/// various attributes of the logical memory allocation.172///173EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;174} EFI_HOB_MEMORY_ALLOCATION_STACK;175176///177/// Defines the location of the boot-strap178/// processor (BSP) BSPStore ("Backing Store Pointer Store").179/// This HOB is valid for the Itanium processor family only180/// register overflow store.181///182typedef struct {183///184/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.185///186EFI_HOB_GENERIC_HEADER Header;187///188/// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the189/// various attributes of the logical memory allocation.190///191EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;192} EFI_HOB_MEMORY_ALLOCATION_BSP_STORE;193194///195/// Defines the location and entry point of the HOB consumer phase.196///197typedef struct {198///199/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.200///201EFI_HOB_GENERIC_HEADER Header;202///203/// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the204/// various attributes of the logical memory allocation.205///206EFI_HOB_MEMORY_ALLOCATION_HEADER MemoryAllocationHeader;207///208/// The GUID specifying the values of the firmware file system name209/// that contains the HOB consumer phase component.210///211EFI_GUID ModuleName;212///213/// The address of the memory-mapped firmware volume214/// that contains the HOB consumer phase firmware file.215///216EFI_PHYSICAL_ADDRESS EntryPoint;217} EFI_HOB_MEMORY_ALLOCATION_MODULE;218219///220/// The resource type.221///222typedef UINT32 EFI_RESOURCE_TYPE;223224//225// Value of ResourceType in EFI_HOB_RESOURCE_DESCRIPTOR.226//227#define EFI_RESOURCE_SYSTEM_MEMORY 0x00000000228#define EFI_RESOURCE_MEMORY_MAPPED_IO 0x00000001229#define EFI_RESOURCE_IO 0x00000002230#define EFI_RESOURCE_FIRMWARE_DEVICE 0x00000003231#define EFI_RESOURCE_MEMORY_MAPPED_IO_PORT 0x00000004232#define EFI_RESOURCE_MEMORY_RESERVED 0x00000005233#define EFI_RESOURCE_IO_RESERVED 0x00000006234#define EFI_RESOURCE_MEMORY_UNACCEPTED 0x00000007235#define EFI_RESOURCE_MAX_MEMORY_TYPE 0x00000008236237///238/// A type of recount attribute type.239///240typedef UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE;241242//243// These types can be ORed together as needed.244//245// The following attributes are used to describe settings246//247#define EFI_RESOURCE_ATTRIBUTE_PRESENT 0x00000001248#define EFI_RESOURCE_ATTRIBUTE_INITIALIZED 0x00000002249#define EFI_RESOURCE_ATTRIBUTE_TESTED 0x00000004250#define EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED 0x00000080251//252// This is typically used as memory cacheability attribute today.253// NOTE: Since PI spec 1.4, please use EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTED254// as Physical write protected attribute, and EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED255// means Memory cacheability attribute: The memory supports being programmed with256// a writeprotected cacheable attribute.257//258#define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED 0x00000100259#define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED 0x00000200260#define EFI_RESOURCE_ATTRIBUTE_PERSISTENT 0x00800000261//262// The rest of the attributes are used to describe capabilities263//264#define EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC 0x00000008265#define EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC 0x00000010266#define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_1 0x00000020267#define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_2 0x00000040268#define EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE 0x00000400269#define EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE 0x00000800270#define EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE 0x00001000271#define EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE 0x00002000272#define EFI_RESOURCE_ATTRIBUTE_16_BIT_IO 0x00004000273#define EFI_RESOURCE_ATTRIBUTE_32_BIT_IO 0x00008000274#define EFI_RESOURCE_ATTRIBUTE_64_BIT_IO 0x00010000275#define EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED 0x00020000276#define EFI_RESOURCE_ATTRIBUTE_READ_PROTECTABLE 0x00100000277//278// This is typically used as memory cacheability attribute today.279// NOTE: Since PI spec 1.4, please use EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTABLE280// as Memory capability attribute: The memory supports being protected from processor281// writes, and EFI_RESOURCE_ATTRIBUTE_WRITE_PROTEC TABLE means Memory cacheability attribute:282// The memory supports being programmed with a writeprotected cacheable attribute.283//284#define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTABLE 0x00200000285#define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTABLE 0x00400000286#define EFI_RESOURCE_ATTRIBUTE_PERSISTABLE 0x01000000287288#define EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTED 0x00040000289#define EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTABLE 0x00080000290291#define EFI_RESOURCE_ATTRIBUTE_ENCRYPTED 0x04000000292#define EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE 0x08000000293#define EFI_RESOURCE_ATTRIBUTE_HOT_PLUGGABLE 0x10000000294//295// Physical memory relative reliability attribute. This296// memory provides higher reliability relative to other297// memory in the system. If all memory has the same298// reliability, then this bit is not used.299//300#define EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE 0x02000000301302///303/// Describes the resource properties of all fixed,304/// nonrelocatable resource ranges found on the processor305/// host bus during the HOB producer phase.306///307typedef struct {308///309/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_RESOURCE_DESCRIPTOR.310///311EFI_HOB_GENERIC_HEADER Header;312///313/// A GUID representing the owner of the resource. This GUID is used by HOB314/// consumer phase components to correlate device ownership of a resource.315///316EFI_GUID Owner;317///318/// The resource type enumeration as defined by EFI_RESOURCE_TYPE.319///320EFI_RESOURCE_TYPE ResourceType;321///322/// Resource attributes as defined by EFI_RESOURCE_ATTRIBUTE_TYPE.323///324EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;325///326/// The physical start address of the resource region.327///328EFI_PHYSICAL_ADDRESS PhysicalStart;329///330/// The number of bytes of the resource region.331///332UINT64 ResourceLength;333} EFI_HOB_RESOURCE_DESCRIPTOR;334335///336/// Allows writers of executable content in the HOB producer phase to337/// maintain and manage HOBs with specific GUID.338///339typedef struct {340///341/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_GUID_EXTENSION.342///343EFI_HOB_GENERIC_HEADER Header;344///345/// A GUID that defines the contents of this HOB.346///347EFI_GUID Name;348//349// Guid specific data goes here350//351} EFI_HOB_GUID_TYPE;352353///354/// Details the location of firmware volumes that contain firmware files.355///356typedef struct {357///358/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_FV.359///360EFI_HOB_GENERIC_HEADER Header;361///362/// The physical memory-mapped base address of the firmware volume.363///364EFI_PHYSICAL_ADDRESS BaseAddress;365///366/// The length in bytes of the firmware volume.367///368UINT64 Length;369} EFI_HOB_FIRMWARE_VOLUME;370371///372/// Details the location of a firmware volume that was extracted373/// from a file within another firmware volume.374///375typedef struct {376///377/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_FV2.378///379EFI_HOB_GENERIC_HEADER Header;380///381/// The physical memory-mapped base address of the firmware volume.382///383EFI_PHYSICAL_ADDRESS BaseAddress;384///385/// The length in bytes of the firmware volume.386///387UINT64 Length;388///389/// The name of the firmware volume.390///391EFI_GUID FvName;392///393/// The name of the firmware file that contained this firmware volume.394///395EFI_GUID FileName;396} EFI_HOB_FIRMWARE_VOLUME2;397398///399/// Details the location of a firmware volume that was extracted400/// from a file within another firmware volume.401///402typedef struct {403///404/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_FV3.405///406EFI_HOB_GENERIC_HEADER Header;407///408/// The physical memory-mapped base address of the firmware volume.409///410EFI_PHYSICAL_ADDRESS BaseAddress;411///412/// The length in bytes of the firmware volume.413///414UINT64 Length;415///416/// The authentication status.417///418UINT32 AuthenticationStatus;419///420/// TRUE if the FV was extracted as a file within another firmware volume.421/// FALSE otherwise.422///423BOOLEAN ExtractedFv;424///425/// The name of the firmware volume.426/// Valid only if IsExtractedFv is TRUE.427///428EFI_GUID FvName;429///430/// The name of the firmware file that contained this firmware volume.431/// Valid only if IsExtractedFv is TRUE.432///433EFI_GUID FileName;434} EFI_HOB_FIRMWARE_VOLUME3;435436///437/// Describes processor information, such as address space and I/O space capabilities.438///439typedef struct {440///441/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_CPU.442///443EFI_HOB_GENERIC_HEADER Header;444///445/// Identifies the maximum physical memory addressability of the processor.446///447UINT8 SizeOfMemorySpace;448///449/// Identifies the maximum physical I/O addressability of the processor.450///451UINT8 SizeOfIoSpace;452///453/// This field will always be set to zero.454///455UINT8 Reserved[6];456} EFI_HOB_CPU;457458///459/// Describes pool memory allocations.460///461typedef struct {462///463/// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_POOL.464///465EFI_HOB_GENERIC_HEADER Header;466} EFI_HOB_MEMORY_POOL;467468///469/// Each UEFI capsule HOB details the location of a UEFI capsule. It includes a base address and length470/// which is based upon memory blocks with a EFI_CAPSULE_HEADER and the associated471/// CapsuleImageSize-based payloads. These HOB's shall be created by the PEI PI firmware472/// sometime after the UEFI UpdateCapsule service invocation with the473/// CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE flag set in the EFI_CAPSULE_HEADER.474///475typedef struct {476///477/// The HOB generic header where Header.HobType = EFI_HOB_TYPE_UEFI_CAPSULE.478///479EFI_HOB_GENERIC_HEADER Header;480481///482/// The physical memory-mapped base address of an UEFI capsule. This value is set to483/// point to the base of the contiguous memory of the UEFI capsule.484/// The length of the contiguous memory in bytes.485///486EFI_PHYSICAL_ADDRESS BaseAddress;487UINT64 Length;488} EFI_HOB_UEFI_CAPSULE;489490///491/// Union of all the possible HOB Types.492///493typedef union {494EFI_HOB_GENERIC_HEADER *Header;495EFI_HOB_HANDOFF_INFO_TABLE *HandoffInformationTable;496EFI_HOB_MEMORY_ALLOCATION *MemoryAllocation;497EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *MemoryAllocationBspStore;498EFI_HOB_MEMORY_ALLOCATION_STACK *MemoryAllocationStack;499EFI_HOB_MEMORY_ALLOCATION_MODULE *MemoryAllocationModule;500EFI_HOB_RESOURCE_DESCRIPTOR *ResourceDescriptor;501EFI_HOB_GUID_TYPE *Guid;502EFI_HOB_FIRMWARE_VOLUME *FirmwareVolume;503EFI_HOB_FIRMWARE_VOLUME2 *FirmwareVolume2;504EFI_HOB_FIRMWARE_VOLUME3 *FirmwareVolume3;505EFI_HOB_CPU *Cpu;506EFI_HOB_MEMORY_POOL *Pool;507EFI_HOB_UEFI_CAPSULE *Capsule;508UINT8 *Raw;509} EFI_PEI_HOB_POINTERS;510511#endif512513514