iPXE
PiHob.h
Go to the documentation of this file.
00001 /** @file
00002   HOB related definitions in PI.
00003 
00004 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
00005 This program and the accompanying materials are licensed and made available under
00006 the terms and conditions of the BSD License that accompanies this distribution.
00007 The full text of the license may be found at
00008 http://opensource.org/licenses/bsd-license.php.
00009 
00010 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00011 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00012 
00013   @par Revision Reference:
00014   PI Version 1.4a
00015 
00016 **/
00017 
00018 #ifndef __PI_HOB_H__
00019 #define __PI_HOB_H__
00020 
00021 FILE_LICENCE ( BSD3 );
00022 
00023 //
00024 // HobType of EFI_HOB_GENERIC_HEADER.
00025 //
00026 #define EFI_HOB_TYPE_HANDOFF              0x0001
00027 #define EFI_HOB_TYPE_MEMORY_ALLOCATION    0x0002
00028 #define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR  0x0003
00029 #define EFI_HOB_TYPE_GUID_EXTENSION       0x0004
00030 #define EFI_HOB_TYPE_FV                   0x0005
00031 #define EFI_HOB_TYPE_CPU                  0x0006
00032 #define EFI_HOB_TYPE_MEMORY_POOL          0x0007
00033 #define EFI_HOB_TYPE_FV2                  0x0009
00034 #define EFI_HOB_TYPE_LOAD_PEIM_UNUSED     0x000A
00035 #define EFI_HOB_TYPE_UEFI_CAPSULE         0x000B
00036 #define EFI_HOB_TYPE_UNUSED               0xFFFE
00037 #define EFI_HOB_TYPE_END_OF_HOB_LIST      0xFFFF
00038 
00039 ///
00040 /// Describes the format and size of the data inside the HOB.
00041 /// All HOBs must contain this generic HOB header.
00042 ///
00043 typedef struct {
00044   ///
00045   /// Identifies the HOB data structure type.
00046   ///
00047   UINT16    HobType;
00048   ///
00049   /// The length in bytes of the HOB.
00050   ///
00051   UINT16    HobLength;
00052   ///
00053   /// This field must always be set to zero.
00054   ///
00055   UINT32    Reserved;
00056 } EFI_HOB_GENERIC_HEADER;
00057 
00058 
00059 ///
00060 /// Value of version  in EFI_HOB_HANDOFF_INFO_TABLE.
00061 ///
00062 #define EFI_HOB_HANDOFF_TABLE_VERSION 0x0009
00063 
00064 ///
00065 /// Contains general state information used by the HOB producer phase.
00066 /// This HOB must be the first one in the HOB list.
00067 ///
00068 typedef struct {
00069   ///
00070   /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_HANDOFF.
00071   ///
00072   EFI_HOB_GENERIC_HEADER  Header;
00073   ///
00074   /// The version number pertaining to the PHIT HOB definition.
00075   /// This value is four bytes in length to provide an 8-byte aligned entry
00076   /// when it is combined with the 4-byte BootMode.
00077   ///
00078   UINT32                  Version;
00079   ///
00080   /// The system boot mode as determined during the HOB producer phase.
00081   ///
00082   EFI_BOOT_MODE           BootMode;
00083   ///
00084   /// The highest address location of memory that is allocated for use by the HOB producer
00085   /// phase. This address must be 4-KB aligned to meet page restrictions of UEFI.
00086   ///
00087   EFI_PHYSICAL_ADDRESS    EfiMemoryTop;
00088   ///
00089   /// The lowest address location of memory that is allocated for use by the HOB producer phase.
00090   ///
00091   EFI_PHYSICAL_ADDRESS    EfiMemoryBottom;
00092   ///
00093   /// The highest address location of free memory that is currently available
00094   /// for use by the HOB producer phase.
00095   ///
00096   EFI_PHYSICAL_ADDRESS    EfiFreeMemoryTop;
00097   ///
00098   /// The lowest address location of free memory that is available for use by the HOB producer phase.
00099   ///
00100   EFI_PHYSICAL_ADDRESS    EfiFreeMemoryBottom;
00101   ///
00102   /// The end of the HOB list.
00103   ///
00104   EFI_PHYSICAL_ADDRESS    EfiEndOfHobList;
00105 } EFI_HOB_HANDOFF_INFO_TABLE;
00106 
00107 ///
00108 /// EFI_HOB_MEMORY_ALLOCATION_HEADER describes the
00109 /// various attributes of the logical memory allocation. The type field will be used for
00110 /// subsequent inclusion in the UEFI memory map.
00111 ///
00112 typedef struct {
00113   ///
00114   /// A GUID that defines the memory allocation region's type and purpose, as well as
00115   /// other fields within the memory allocation HOB. This GUID is used to define the
00116   /// additional data within the HOB that may be present for the memory allocation HOB.
00117   /// Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0
00118   /// specification.
00119   ///
00120   EFI_GUID              Name;
00121 
00122   ///
00123   /// The base address of memory allocated by this HOB. Type
00124   /// EFI_PHYSICAL_ADDRESS is defined in AllocatePages() in the UEFI 2.0
00125   /// specification.
00126   ///
00127   EFI_PHYSICAL_ADDRESS  MemoryBaseAddress;
00128 
00129   ///
00130   /// The length in bytes of memory allocated by this HOB.
00131   ///
00132   UINT64                MemoryLength;
00133 
00134   ///
00135   /// Defines the type of memory allocated by this HOB. The memory type definition
00136   /// follows the EFI_MEMORY_TYPE definition. Type EFI_MEMORY_TYPE is defined
00137   /// in AllocatePages() in the UEFI 2.0 specification.
00138   ///
00139   EFI_MEMORY_TYPE       MemoryType;
00140 
00141   ///
00142   /// Padding for Itanium processor family
00143   ///
00144   UINT8                 Reserved[4];
00145 } EFI_HOB_MEMORY_ALLOCATION_HEADER;
00146 
00147 ///
00148 /// Describes all memory ranges used during the HOB producer
00149 /// phase that exist outside the HOB list. This HOB type
00150 /// describes how memory is used, not the physical attributes of memory.
00151 ///
00152 typedef struct {
00153   ///
00154   /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
00155   ///
00156   EFI_HOB_GENERIC_HEADER            Header;
00157   ///
00158   /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
00159   /// various attributes of the logical memory allocation.
00160   ///
00161   EFI_HOB_MEMORY_ALLOCATION_HEADER  AllocDescriptor;
00162   //
00163   // Additional data pertaining to the "Name" Guid memory
00164   // may go here.
00165   //
00166 } EFI_HOB_MEMORY_ALLOCATION;
00167 
00168 
00169 ///
00170 /// Describes the memory stack that is produced by the HOB producer
00171 /// phase and upon which all post-memory-installed executable
00172 /// content in the HOB producer phase is executing.
00173 ///
00174 typedef struct {
00175   ///
00176   /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
00177   ///
00178   EFI_HOB_GENERIC_HEADER            Header;
00179   ///
00180   /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
00181   /// various attributes of the logical memory allocation.
00182   ///
00183   EFI_HOB_MEMORY_ALLOCATION_HEADER  AllocDescriptor;
00184 } EFI_HOB_MEMORY_ALLOCATION_STACK;
00185 
00186 ///
00187 /// Defines the location of the boot-strap
00188 /// processor (BSP) BSPStore ("Backing Store Pointer Store").
00189 /// This HOB is valid for the Itanium processor family only
00190 /// register overflow store.
00191 ///
00192 typedef struct {
00193   ///
00194   /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
00195   ///
00196   EFI_HOB_GENERIC_HEADER            Header;
00197   ///
00198   /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
00199   /// various attributes of the logical memory allocation.
00200   ///
00201   EFI_HOB_MEMORY_ALLOCATION_HEADER  AllocDescriptor;
00202 } EFI_HOB_MEMORY_ALLOCATION_BSP_STORE;
00203 
00204 ///
00205 /// Defines the location and entry point of the HOB consumer phase.
00206 ///
00207 typedef struct {
00208   ///
00209   /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
00210   ///
00211   EFI_HOB_GENERIC_HEADER            Header;
00212   ///
00213   /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
00214   /// various attributes of the logical memory allocation.
00215   ///
00216   EFI_HOB_MEMORY_ALLOCATION_HEADER  MemoryAllocationHeader;
00217   ///
00218   /// The GUID specifying the values of the firmware file system name
00219   /// that contains the HOB consumer phase component.
00220   ///
00221   EFI_GUID                          ModuleName;
00222   ///
00223   /// The address of the memory-mapped firmware volume
00224   /// that contains the HOB consumer phase firmware file.
00225   ///
00226   EFI_PHYSICAL_ADDRESS              EntryPoint;
00227 } EFI_HOB_MEMORY_ALLOCATION_MODULE;
00228 
00229 ///
00230 /// The resource type.
00231 ///
00232 typedef UINT32 EFI_RESOURCE_TYPE;
00233 
00234 //
00235 // Value of ResourceType in EFI_HOB_RESOURCE_DESCRIPTOR.
00236 //
00237 #define EFI_RESOURCE_SYSTEM_MEMORY          0x00000000
00238 #define EFI_RESOURCE_MEMORY_MAPPED_IO       0x00000001
00239 #define EFI_RESOURCE_IO                     0x00000002
00240 #define EFI_RESOURCE_FIRMWARE_DEVICE        0x00000003
00241 #define EFI_RESOURCE_MEMORY_MAPPED_IO_PORT  0x00000004
00242 #define EFI_RESOURCE_MEMORY_RESERVED        0x00000005
00243 #define EFI_RESOURCE_IO_RESERVED            0x00000006
00244 #define EFI_RESOURCE_MAX_MEMORY_TYPE        0x00000007
00245 
00246 ///
00247 /// A type of recount attribute type.
00248 ///
00249 typedef UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE;
00250 
00251 //
00252 // These types can be ORed together as needed.
00253 //
00254 // The following attributes are used to describe settings
00255 //
00256 #define EFI_RESOURCE_ATTRIBUTE_PRESENT                  0x00000001
00257 #define EFI_RESOURCE_ATTRIBUTE_INITIALIZED              0x00000002
00258 #define EFI_RESOURCE_ATTRIBUTE_TESTED                   0x00000004
00259 #define EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED           0x00000080
00260 //
00261 // This is typically used as memory cacheability attribute today.
00262 // NOTE: Since PI spec 1.4, please use EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTED
00263 // as Physical write protected attribute, and EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED
00264 // means Memory cacheability attribute: The memory supports being programmed with
00265 // a writeprotected cacheable attribute.
00266 //
00267 #define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED          0x00000100
00268 #define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED      0x00000200
00269 #define EFI_RESOURCE_ATTRIBUTE_PERSISTENT               0x00800000
00270 //
00271 // The rest of the attributes are used to describe capabilities
00272 //
00273 #define EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC           0x00000008
00274 #define EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC         0x00000010
00275 #define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_1           0x00000020
00276 #define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_2           0x00000040
00277 #define EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE              0x00000400
00278 #define EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE        0x00000800
00279 #define EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE  0x00001000
00280 #define EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE     0x00002000
00281 #define EFI_RESOURCE_ATTRIBUTE_16_BIT_IO                0x00004000
00282 #define EFI_RESOURCE_ATTRIBUTE_32_BIT_IO                0x00008000
00283 #define EFI_RESOURCE_ATTRIBUTE_64_BIT_IO                0x00010000
00284 #define EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED        0x00020000
00285 #define EFI_RESOURCE_ATTRIBUTE_READ_PROTECTABLE         0x00100000
00286 //
00287 // This is typically used as memory cacheability attribute today.
00288 // NOTE: Since PI spec 1.4, please use EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTABLE
00289 // as Memory capability attribute: The memory supports being protected from processor
00290 // writes, and EFI_RESOURCE_ATTRIBUTE_WRITE_PROTEC TABLE means Memory cacheability attribute:
00291 // The memory supports being programmed with a writeprotected cacheable attribute.
00292 //
00293 #define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTABLE        0x00200000
00294 #define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTABLE    0x00400000
00295 #define EFI_RESOURCE_ATTRIBUTE_PERSISTABLE              0x01000000
00296 
00297 #define EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTED      0x00040000
00298 #define EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTABLE    0x00080000
00299 
00300 //
00301 // Physical memory relative reliability attribute. This
00302 // memory provides higher reliability relative to other
00303 // memory in the system. If all memory has the same
00304 // reliability, then this bit is not used.
00305 //
00306 #define EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE            0x02000000
00307 
00308 ///
00309 /// Describes the resource properties of all fixed,
00310 /// nonrelocatable resource ranges found on the processor
00311 /// host bus during the HOB producer phase.
00312 ///
00313 typedef struct {
00314   ///
00315   /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_RESOURCE_DESCRIPTOR.
00316   ///
00317   EFI_HOB_GENERIC_HEADER      Header;
00318   ///
00319   /// A GUID representing the owner of the resource. This GUID is used by HOB
00320   /// consumer phase components to correlate device ownership of a resource.
00321   ///
00322   EFI_GUID                    Owner;
00323   ///
00324   /// The resource type enumeration as defined by EFI_RESOURCE_TYPE.
00325   ///
00326   EFI_RESOURCE_TYPE           ResourceType;
00327   ///
00328   /// Resource attributes as defined by EFI_RESOURCE_ATTRIBUTE_TYPE.
00329   ///
00330   EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
00331   ///
00332   /// The physical start address of the resource region.
00333   ///
00334   EFI_PHYSICAL_ADDRESS        PhysicalStart;
00335   ///
00336   /// The number of bytes of the resource region.
00337   ///
00338   UINT64                      ResourceLength;
00339 } EFI_HOB_RESOURCE_DESCRIPTOR;
00340 
00341 ///
00342 /// Allows writers of executable content in the HOB producer phase to
00343 /// maintain and manage HOBs with specific GUID.
00344 ///
00345 typedef struct {
00346   ///
00347   /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_GUID_EXTENSION.
00348   ///
00349   EFI_HOB_GENERIC_HEADER      Header;
00350   ///
00351   /// A GUID that defines the contents of this HOB.
00352   ///
00353   EFI_GUID                    Name;
00354   //
00355   // Guid specific data goes here
00356   //
00357 } EFI_HOB_GUID_TYPE;
00358 
00359 ///
00360 /// Details the location of firmware volumes that contain firmware files.
00361 ///
00362 typedef struct {
00363   ///
00364   /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_FV.
00365   ///
00366   EFI_HOB_GENERIC_HEADER Header;
00367   ///
00368   /// The physical memory-mapped base address of the firmware volume.
00369   ///
00370   EFI_PHYSICAL_ADDRESS   BaseAddress;
00371   ///
00372   /// The length in bytes of the firmware volume.
00373   ///
00374   UINT64                 Length;
00375 } EFI_HOB_FIRMWARE_VOLUME;
00376 
00377 ///
00378 /// Details the location of a firmware volume that was extracted
00379 /// from a file within another firmware volume.
00380 ///
00381 typedef struct {
00382   ///
00383   /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_FV2.
00384   ///
00385   EFI_HOB_GENERIC_HEADER  Header;
00386   ///
00387   /// The physical memory-mapped base address of the firmware volume.
00388   ///
00389   EFI_PHYSICAL_ADDRESS    BaseAddress;
00390   ///
00391   /// The length in bytes of the firmware volume.
00392   ///
00393   UINT64                  Length;
00394   ///
00395   /// The name of the firmware volume.
00396   ///
00397   EFI_GUID                FvName;
00398   ///
00399   /// The name of the firmware file that contained this firmware volume.
00400   ///
00401   EFI_GUID                FileName;
00402 } EFI_HOB_FIRMWARE_VOLUME2;
00403 
00404 
00405 ///
00406 /// Describes processor information, such as address space and I/O space capabilities.
00407 ///
00408 typedef struct {
00409   ///
00410   /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_CPU.
00411   ///
00412   EFI_HOB_GENERIC_HEADER  Header;
00413   ///
00414   /// Identifies the maximum physical memory addressability of the processor.
00415   ///
00416   UINT8                   SizeOfMemorySpace;
00417   ///
00418   /// Identifies the maximum physical I/O addressability of the processor.
00419   ///
00420   UINT8                   SizeOfIoSpace;
00421   ///
00422   /// This field will always be set to zero.
00423   ///
00424   UINT8                   Reserved[6];
00425 } EFI_HOB_CPU;
00426 
00427 
00428 ///
00429 /// Describes pool memory allocations.
00430 ///
00431 typedef struct {
00432   ///
00433   /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_POOL.
00434   ///
00435   EFI_HOB_GENERIC_HEADER  Header;
00436 } EFI_HOB_MEMORY_POOL;
00437 
00438 ///
00439 /// Each UEFI capsule HOB details the location of a UEFI capsule. It includes a base address and length
00440 /// which is based upon memory blocks with a EFI_CAPSULE_HEADER and the associated
00441 /// CapsuleImageSize-based payloads. These HOB's shall be created by the PEI PI firmware
00442 /// sometime after the UEFI UpdateCapsule service invocation with the
00443 /// CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE flag set in the EFI_CAPSULE_HEADER.
00444 ///
00445 typedef struct {
00446   ///
00447   /// The HOB generic header where Header.HobType = EFI_HOB_TYPE_UEFI_CAPSULE.
00448   ///
00449   EFI_HOB_GENERIC_HEADER Header;
00450 
00451   ///
00452   /// The physical memory-mapped base address of an UEFI capsule. This value is set to
00453   /// point to the base of the contiguous memory of the UEFI capsule.
00454   /// The length of the contiguous memory in bytes.
00455   ///
00456   EFI_PHYSICAL_ADDRESS   BaseAddress;
00457   UINT64                 Length;
00458 } EFI_HOB_UEFI_CAPSULE;
00459 
00460 ///
00461 /// Union of all the possible HOB Types.
00462 ///
00463 typedef union {
00464   EFI_HOB_GENERIC_HEADER              *Header;
00465   EFI_HOB_HANDOFF_INFO_TABLE          *HandoffInformationTable;
00466   EFI_HOB_MEMORY_ALLOCATION           *MemoryAllocation;
00467   EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *MemoryAllocationBspStore;
00468   EFI_HOB_MEMORY_ALLOCATION_STACK     *MemoryAllocationStack;
00469   EFI_HOB_MEMORY_ALLOCATION_MODULE    *MemoryAllocationModule;
00470   EFI_HOB_RESOURCE_DESCRIPTOR         *ResourceDescriptor;
00471   EFI_HOB_GUID_TYPE                   *Guid;
00472   EFI_HOB_FIRMWARE_VOLUME             *FirmwareVolume;
00473   EFI_HOB_FIRMWARE_VOLUME2            *FirmwareVolume2;
00474   EFI_HOB_CPU                         *Cpu;
00475   EFI_HOB_MEMORY_POOL                 *Pool;
00476   EFI_HOB_UEFI_CAPSULE                *Capsule;
00477   UINT8                               *Raw;
00478 } EFI_PEI_HOB_POINTERS;
00479 
00480 
00481 #endif