You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PiHob.h 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. /** @file
  2. HOB related definitions in PI.
  3. Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
  4. This program and the accompanying materials are licensed and made available under
  5. the terms and conditions of the BSD License that accompanies this distribution.
  6. The full text of the license may be found at
  7. http://opensource.org/licenses/bsd-license.php.
  8. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  10. @par Revision Reference:
  11. PI Version 1.0
  12. **/
  13. #ifndef __PI_HOB_H__
  14. #define __PI_HOB_H__
  15. //
  16. // HobType of EFI_HOB_GENERIC_HEADER.
  17. //
  18. #define EFI_HOB_TYPE_HANDOFF 0x0001
  19. #define EFI_HOB_TYPE_MEMORY_ALLOCATION 0x0002
  20. #define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR 0x0003
  21. #define EFI_HOB_TYPE_GUID_EXTENSION 0x0004
  22. #define EFI_HOB_TYPE_FV 0x0005
  23. #define EFI_HOB_TYPE_CPU 0x0006
  24. #define EFI_HOB_TYPE_MEMORY_POOL 0x0007
  25. #define EFI_HOB_TYPE_FV2 0x0009
  26. #define EFI_HOB_TYPE_LOAD_PEIM_UNUSED 0x000A
  27. #define EFI_HOB_TYPE_UEFI_CAPSULE 0x000B
  28. #define EFI_HOB_TYPE_UNUSED 0xFFFE
  29. #define EFI_HOB_TYPE_END_OF_HOB_LIST 0xFFFF
  30. ///
  31. /// Describes the format and size of the data inside the HOB.
  32. /// All HOBs must contain this generic HOB header.
  33. ///
  34. typedef struct {
  35. ///
  36. /// Identifies the HOB data structure type.
  37. ///
  38. UINT16 HobType;
  39. ///
  40. /// The length in bytes of the HOB.
  41. ///
  42. UINT16 HobLength;
  43. ///
  44. /// This field must always be set to zero.
  45. ///
  46. UINT32 Reserved;
  47. } EFI_HOB_GENERIC_HEADER;
  48. ///
  49. /// Value of version in EFI_HOB_HANDOFF_INFO_TABLE.
  50. ///
  51. #define EFI_HOB_HANDOFF_TABLE_VERSION 0x0009
  52. ///
  53. /// Contains general state information used by the HOB producer phase.
  54. /// This HOB must be the first one in the HOB list.
  55. ///
  56. typedef struct {
  57. ///
  58. /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_HANDOFF.
  59. ///
  60. EFI_HOB_GENERIC_HEADER Header;
  61. ///
  62. /// The version number pertaining to the PHIT HOB definition.
  63. /// This value is four bytes in length to provide an 8-byte aligned entry
  64. /// when it is combined with the 4-byte BootMode.
  65. ///
  66. UINT32 Version;
  67. ///
  68. /// The system boot mode as determined during the HOB producer phase.
  69. ///
  70. EFI_BOOT_MODE BootMode;
  71. ///
  72. /// The highest address location of memory that is allocated for use by the HOB producer
  73. /// phase. This address must be 4-KB aligned to meet page restrictions of UEFI.
  74. ///
  75. EFI_PHYSICAL_ADDRESS EfiMemoryTop;
  76. ///
  77. /// The lowest address location of memory that is allocated for use by the HOB producer phase.
  78. ///
  79. EFI_PHYSICAL_ADDRESS EfiMemoryBottom;
  80. ///
  81. /// The highest address location of free memory that is currently available
  82. /// for use by the HOB producer phase.
  83. ///
  84. EFI_PHYSICAL_ADDRESS EfiFreeMemoryTop;
  85. ///
  86. /// The lowest address location of free memory that is available for use by the HOB producer phase.
  87. ///
  88. EFI_PHYSICAL_ADDRESS EfiFreeMemoryBottom;
  89. ///
  90. /// The end of the HOB list.
  91. ///
  92. EFI_PHYSICAL_ADDRESS EfiEndOfHobList;
  93. } EFI_HOB_HANDOFF_INFO_TABLE;
  94. ///
  95. /// EFI_HOB_MEMORY_ALLOCATION_HEADER describes the
  96. /// various attributes of the logical memory allocation. The type field will be used for
  97. /// subsequent inclusion in the UEFI memory map.
  98. ///
  99. typedef struct {
  100. ///
  101. /// A GUID that defines the memory allocation region's type and purpose, as well as
  102. /// other fields within the memory allocation HOB. This GUID is used to define the
  103. /// additional data within the HOB that may be present for the memory allocation HOB.
  104. /// Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0
  105. /// specification.
  106. ///
  107. EFI_GUID Name;
  108. ///
  109. /// The base address of memory allocated by this HOB. Type
  110. /// EFI_PHYSICAL_ADDRESS is defined in AllocatePages() in the UEFI 2.0
  111. /// specification.
  112. ///
  113. EFI_PHYSICAL_ADDRESS MemoryBaseAddress;
  114. ///
  115. /// The length in bytes of memory allocated by this HOB.
  116. ///
  117. UINT64 MemoryLength;
  118. ///
  119. /// Defines the type of memory allocated by this HOB. The memory type definition
  120. /// follows the EFI_MEMORY_TYPE definition. Type EFI_MEMORY_TYPE is defined
  121. /// in AllocatePages() in the UEFI 2.0 specification.
  122. ///
  123. EFI_MEMORY_TYPE MemoryType;
  124. ///
  125. /// Padding for Itanium processor family
  126. ///
  127. UINT8 Reserved[4];
  128. } EFI_HOB_MEMORY_ALLOCATION_HEADER;
  129. ///
  130. /// Describes all memory ranges used during the HOB producer
  131. /// phase that exist outside the HOB list. This HOB type
  132. /// describes how memory is used, not the physical attributes of memory.
  133. ///
  134. typedef struct {
  135. ///
  136. /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
  137. ///
  138. EFI_HOB_GENERIC_HEADER Header;
  139. ///
  140. /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
  141. /// various attributes of the logical memory allocation.
  142. ///
  143. EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;
  144. //
  145. // Additional data pertaining to the "Name" Guid memory
  146. // may go here.
  147. //
  148. } EFI_HOB_MEMORY_ALLOCATION;
  149. ///
  150. /// Describes the memory stack that is produced by the HOB producer
  151. /// phase and upon which all post-memory-installed executable
  152. /// content in the HOB producer phase is executing.
  153. ///
  154. typedef struct {
  155. ///
  156. /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
  157. ///
  158. EFI_HOB_GENERIC_HEADER Header;
  159. ///
  160. /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
  161. /// various attributes of the logical memory allocation.
  162. ///
  163. EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;
  164. } EFI_HOB_MEMORY_ALLOCATION_STACK;
  165. ///
  166. /// Defines the location of the boot-strap
  167. /// processor (BSP) BSPStore ("Backing Store Pointer Store").
  168. /// This HOB is valid for the Itanium processor family only
  169. /// register overflow store.
  170. ///
  171. typedef struct {
  172. ///
  173. /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
  174. ///
  175. EFI_HOB_GENERIC_HEADER Header;
  176. ///
  177. /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
  178. /// various attributes of the logical memory allocation.
  179. ///
  180. EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;
  181. } EFI_HOB_MEMORY_ALLOCATION_BSP_STORE;
  182. ///
  183. /// Defines the location and entry point of the HOB consumer phase.
  184. ///
  185. typedef struct {
  186. ///
  187. /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
  188. ///
  189. EFI_HOB_GENERIC_HEADER Header;
  190. ///
  191. /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
  192. /// various attributes of the logical memory allocation.
  193. ///
  194. EFI_HOB_MEMORY_ALLOCATION_HEADER MemoryAllocationHeader;
  195. ///
  196. /// The GUID specifying the values of the firmware file system name
  197. /// that contains the HOB consumer phase component.
  198. ///
  199. EFI_GUID ModuleName;
  200. ///
  201. /// The address of the memory-mapped firmware volume
  202. /// that contains the HOB consumer phase firmware file.
  203. ///
  204. EFI_PHYSICAL_ADDRESS EntryPoint;
  205. } EFI_HOB_MEMORY_ALLOCATION_MODULE;
  206. ///
  207. /// The resource type.
  208. ///
  209. typedef UINT32 EFI_RESOURCE_TYPE;
  210. //
  211. // Value of ResourceType in EFI_HOB_RESOURCE_DESCRIPTOR.
  212. //
  213. #define EFI_RESOURCE_SYSTEM_MEMORY 0x00000000
  214. #define EFI_RESOURCE_MEMORY_MAPPED_IO 0x00000001
  215. #define EFI_RESOURCE_IO 0x00000002
  216. #define EFI_RESOURCE_FIRMWARE_DEVICE 0x00000003
  217. #define EFI_RESOURCE_MEMORY_MAPPED_IO_PORT 0x00000004
  218. #define EFI_RESOURCE_MEMORY_RESERVED 0x00000005
  219. #define EFI_RESOURCE_IO_RESERVED 0x00000006
  220. #define EFI_RESOURCE_MAX_MEMORY_TYPE 0x00000007
  221. ///
  222. /// A type of recount attribute type.
  223. ///
  224. typedef UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE;
  225. //
  226. // These types can be ORed together as needed.
  227. //
  228. // The first three enumerations describe settings
  229. //
  230. #define EFI_RESOURCE_ATTRIBUTE_PRESENT 0x00000001
  231. #define EFI_RESOURCE_ATTRIBUTE_INITIALIZED 0x00000002
  232. #define EFI_RESOURCE_ATTRIBUTE_TESTED 0x00000004
  233. //
  234. // The rest of the settings describe capabilities
  235. //
  236. #define EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC 0x00000008
  237. #define EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC 0x00000010
  238. #define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_1 0x00000020
  239. #define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_2 0x00000040
  240. #define EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED 0x00000080
  241. #define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED 0x00000100
  242. #define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED 0x00000200
  243. #define EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE 0x00000400
  244. #define EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE 0x00000800
  245. #define EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE 0x00001000
  246. #define EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE 0x00002000
  247. #define EFI_RESOURCE_ATTRIBUTE_16_BIT_IO 0x00004000
  248. #define EFI_RESOURCE_ATTRIBUTE_32_BIT_IO 0x00008000
  249. #define EFI_RESOURCE_ATTRIBUTE_64_BIT_IO 0x00010000
  250. #define EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED 0x00020000
  251. ///
  252. /// Describes the resource properties of all fixed,
  253. /// nonrelocatable resource ranges found on the processor
  254. /// host bus during the HOB producer phase.
  255. ///
  256. typedef struct {
  257. ///
  258. /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_RESOURCE_DESCRIPTOR.
  259. ///
  260. EFI_HOB_GENERIC_HEADER Header;
  261. ///
  262. /// A GUID representing the owner of the resource. This GUID is used by HOB
  263. /// consumer phase components to correlate device ownership of a resource.
  264. ///
  265. EFI_GUID Owner;
  266. ///
  267. /// The resource type enumeration as defined by EFI_RESOURCE_TYPE.
  268. ///
  269. EFI_RESOURCE_TYPE ResourceType;
  270. ///
  271. /// Resource attributes as defined by EFI_RESOURCE_ATTRIBUTE_TYPE.
  272. ///
  273. EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
  274. ///
  275. /// The physical start address of the resource region.
  276. ///
  277. EFI_PHYSICAL_ADDRESS PhysicalStart;
  278. ///
  279. /// The number of bytes of the resource region.
  280. ///
  281. UINT64 ResourceLength;
  282. } EFI_HOB_RESOURCE_DESCRIPTOR;
  283. ///
  284. /// Allows writers of executable content in the HOB producer phase to
  285. /// maintain and manage HOBs with specific GUID.
  286. ///
  287. typedef struct {
  288. ///
  289. /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_GUID_EXTENSION.
  290. ///
  291. EFI_HOB_GENERIC_HEADER Header;
  292. ///
  293. /// A GUID that defines the contents of this HOB.
  294. ///
  295. EFI_GUID Name;
  296. //
  297. // Guid specific data goes here
  298. //
  299. } EFI_HOB_GUID_TYPE;
  300. ///
  301. /// Details the location of firmware volumes that contain firmware files.
  302. ///
  303. typedef struct {
  304. ///
  305. /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_FV.
  306. ///
  307. EFI_HOB_GENERIC_HEADER Header;
  308. ///
  309. /// The physical memory-mapped base address of the firmware volume.
  310. ///
  311. EFI_PHYSICAL_ADDRESS BaseAddress;
  312. ///
  313. /// The length in bytes of the firmware volume.
  314. ///
  315. UINT64 Length;
  316. } EFI_HOB_FIRMWARE_VOLUME;
  317. ///
  318. /// Details the location of a firmware volume that was extracted
  319. /// from a file within another firmware volume.
  320. ///
  321. typedef struct {
  322. ///
  323. /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_FV2.
  324. ///
  325. EFI_HOB_GENERIC_HEADER Header;
  326. ///
  327. /// The physical memory-mapped base address of the firmware volume.
  328. ///
  329. EFI_PHYSICAL_ADDRESS BaseAddress;
  330. ///
  331. /// The length in bytes of the firmware volume.
  332. ///
  333. UINT64 Length;
  334. ///
  335. /// The name of the firmware volume.
  336. ///
  337. EFI_GUID FvName;
  338. ///
  339. /// The name of the firmware file that contained this firmware volume.
  340. ///
  341. EFI_GUID FileName;
  342. } EFI_HOB_FIRMWARE_VOLUME2;
  343. ///
  344. /// Describes processor information, such as address space and I/O space capabilities.
  345. ///
  346. typedef struct {
  347. ///
  348. /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_CPU.
  349. ///
  350. EFI_HOB_GENERIC_HEADER Header;
  351. ///
  352. /// Identifies the maximum physical memory addressability of the processor.
  353. ///
  354. UINT8 SizeOfMemorySpace;
  355. ///
  356. /// Identifies the maximum physical I/O addressability of the processor.
  357. ///
  358. UINT8 SizeOfIoSpace;
  359. ///
  360. /// This field will always be set to zero.
  361. ///
  362. UINT8 Reserved[6];
  363. } EFI_HOB_CPU;
  364. ///
  365. /// Describes pool memory allocations.
  366. ///
  367. typedef struct {
  368. ///
  369. /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_POOL.
  370. ///
  371. EFI_HOB_GENERIC_HEADER Header;
  372. } EFI_HOB_MEMORY_POOL;
  373. ///
  374. /// Each UEFI capsule HOB details the location of a UEFI capsule. It includes a base address and length
  375. /// which is based upon memory blocks with a EFI_CAPSULE_HEADER and the associated
  376. /// CapsuleImageSize-based payloads. These HOB's shall be created by the PEI PI firmware
  377. /// sometime after the UEFI UpdateCapsule service invocation with the
  378. /// CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE flag set in the EFI_CAPSULE_HEADER.
  379. ///
  380. typedef struct {
  381. ///
  382. /// The HOB generic header where Header.HobType = EFI_HOB_TYPE_UEFI_CAPSULE.
  383. ///
  384. EFI_HOB_GENERIC_HEADER Header;
  385. ///
  386. /// The physical memory-mapped base address of an UEFI capsule. This value is set to
  387. /// point to the base of the contiguous memory of the UEFI capsule.
  388. /// The length of the contiguous memory in bytes.
  389. ///
  390. EFI_PHYSICAL_ADDRESS BaseAddress;
  391. UINT64 Length;
  392. } EFI_HOB_UEFI_CAPSULE;
  393. ///
  394. /// Union of all the possible HOB Types.
  395. ///
  396. typedef union {
  397. EFI_HOB_GENERIC_HEADER *Header;
  398. EFI_HOB_HANDOFF_INFO_TABLE *HandoffInformationTable;
  399. EFI_HOB_MEMORY_ALLOCATION *MemoryAllocation;
  400. EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *MemoryAllocationBspStore;
  401. EFI_HOB_MEMORY_ALLOCATION_STACK *MemoryAllocationStack;
  402. EFI_HOB_MEMORY_ALLOCATION_MODULE *MemoryAllocationModule;
  403. EFI_HOB_RESOURCE_DESCRIPTOR *ResourceDescriptor;
  404. EFI_HOB_GUID_TYPE *Guid;
  405. EFI_HOB_FIRMWARE_VOLUME *FirmwareVolume;
  406. EFI_HOB_FIRMWARE_VOLUME2 *FirmwareVolume2;
  407. EFI_HOB_CPU *Cpu;
  408. EFI_HOB_MEMORY_POOL *Pool;
  409. EFI_HOB_UEFI_CAPSULE *Capsule;
  410. UINT8 *Raw;
  411. } EFI_PEI_HOB_POINTERS;
  412. #endif