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.

PiFirmwareVolume.h 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /** @file
  2. The firmware volume related definitions in PI.
  3. Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
  4. This program and the accompanying materials
  5. are licensed and made available under the terms and conditions of the BSD License
  6. which accompanies this distribution. 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_FIRMWAREVOLUME_H__
  14. #define __PI_FIRMWAREVOLUME_H__
  15. ///
  16. /// EFI_FV_FILE_ATTRIBUTES
  17. ///
  18. typedef UINT32 EFI_FV_FILE_ATTRIBUTES;
  19. //
  20. // Value of EFI_FV_FILE_ATTRIBUTES.
  21. //
  22. #define EFI_FV_FILE_ATTRIB_ALIGNMENT 0x0000001F
  23. #define EFI_FV_FILE_ATTRIB_FIXED 0x00000100
  24. #define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED 0x00000200
  25. ///
  26. /// type of EFI FVB attribute
  27. ///
  28. typedef UINT32 EFI_FVB_ATTRIBUTES_2;
  29. //
  30. // Attributes bit definitions
  31. //
  32. #define EFI_FVB2_READ_DISABLED_CAP 0x00000001
  33. #define EFI_FVB2_READ_ENABLED_CAP 0x00000002
  34. #define EFI_FVB2_READ_STATUS 0x00000004
  35. #define EFI_FVB2_WRITE_DISABLED_CAP 0x00000008
  36. #define EFI_FVB2_WRITE_ENABLED_CAP 0x00000010
  37. #define EFI_FVB2_WRITE_STATUS 0x00000020
  38. #define EFI_FVB2_LOCK_CAP 0x00000040
  39. #define EFI_FVB2_LOCK_STATUS 0x00000080
  40. #define EFI_FVB2_STICKY_WRITE 0x00000200
  41. #define EFI_FVB2_MEMORY_MAPPED 0x00000400
  42. #define EFI_FVB2_ERASE_POLARITY 0x00000800
  43. #define EFI_FVB2_READ_LOCK_CAP 0x00001000
  44. #define EFI_FVB2_READ_LOCK_STATUS 0x00002000
  45. #define EFI_FVB2_WRITE_LOCK_CAP 0x00004000
  46. #define EFI_FVB2_WRITE_LOCK_STATUS 0x00008000
  47. #define EFI_FVB2_ALIGNMENT 0x001F0000
  48. #define EFI_FVB2_ALIGNMENT_1 0x00000000
  49. #define EFI_FVB2_ALIGNMENT_2 0x00010000
  50. #define EFI_FVB2_ALIGNMENT_4 0x00020000
  51. #define EFI_FVB2_ALIGNMENT_8 0x00030000
  52. #define EFI_FVB2_ALIGNMENT_16 0x00040000
  53. #define EFI_FVB2_ALIGNMENT_32 0x00050000
  54. #define EFI_FVB2_ALIGNMENT_64 0x00060000
  55. #define EFI_FVB2_ALIGNMENT_128 0x00070000
  56. #define EFI_FVB2_ALIGNMENT_256 0x00080000
  57. #define EFI_FVB2_ALIGNMENT_512 0x00090000
  58. #define EFI_FVB2_ALIGNMENT_1K 0x000A0000
  59. #define EFI_FVB2_ALIGNMENT_2K 0x000B0000
  60. #define EFI_FVB2_ALIGNMENT_4K 0x000C0000
  61. #define EFI_FVB2_ALIGNMENT_8K 0x000D0000
  62. #define EFI_FVB2_ALIGNMENT_16K 0x000E0000
  63. #define EFI_FVB2_ALIGNMENT_32K 0x000F0000
  64. #define EFI_FVB2_ALIGNMENT_64K 0x00100000
  65. #define EFI_FVB2_ALIGNMENT_128K 0x00110000
  66. #define EFI_FVB2_ALIGNMENT_256K 0x00120000
  67. #define EFI_FVB2_ALIGNMNET_512K 0x00130000
  68. #define EFI_FVB2_ALIGNMENT_1M 0x00140000
  69. #define EFI_FVB2_ALIGNMENT_2M 0x00150000
  70. #define EFI_FVB2_ALIGNMENT_4M 0x00160000
  71. #define EFI_FVB2_ALIGNMENT_8M 0x00170000
  72. #define EFI_FVB2_ALIGNMENT_16M 0x00180000
  73. #define EFI_FVB2_ALIGNMENT_32M 0x00190000
  74. #define EFI_FVB2_ALIGNMENT_64M 0x001A0000
  75. #define EFI_FVB2_ALIGNMENT_128M 0x001B0000
  76. #define EFI_FVB2_ALIGNMENT_256M 0x001C0000
  77. #define EFI_FVB2_ALIGNMENT_512M 0x001D0000
  78. #define EFI_FVB2_ALIGNMENT_1G 0x001E0000
  79. #define EFI_FVB2_ALIGNMENT_2G 0x001F0000
  80. typedef struct {
  81. ///
  82. /// The number of sequential blocks which are of the same size.
  83. ///
  84. UINT32 NumBlocks;
  85. ///
  86. /// The size of the blocks.
  87. ///
  88. UINT32 Length;
  89. } EFI_FV_BLOCK_MAP_ENTRY;
  90. ///
  91. /// Describes the features and layout of the firmware volume.
  92. ///
  93. typedef struct {
  94. ///
  95. /// The first 16 bytes are reserved to allow for the reset vector of
  96. /// processors whose reset vector is at address 0.
  97. ///
  98. UINT8 ZeroVector[16];
  99. ///
  100. /// Declares the file system with which the firmware volume is formatted.
  101. ///
  102. EFI_GUID FileSystemGuid;
  103. ///
  104. /// Length in bytes of the complete firmware volume, including the header.
  105. ///
  106. UINT64 FvLength;
  107. ///
  108. /// Set to EFI_FVH_SIGNATURE
  109. ///
  110. UINT32 Signature;
  111. ///
  112. /// Declares capabilities and power-on defaults for the firmware volume.
  113. ///
  114. EFI_FVB_ATTRIBUTES_2 Attributes;
  115. ///
  116. /// Length in bytes of the complete firmware volume header.
  117. ///
  118. UINT16 HeaderLength;
  119. ///
  120. /// A 16-bit checksum of the firmware volume header. A valid header sums to zero.
  121. ///
  122. UINT16 Checksum;
  123. ///
  124. /// Offset, relative to the start of the header, of the extended header
  125. /// (EFI_FIRMWARE_VOLUME_EXT_HEADER) or zero if there is no extended header.
  126. ///
  127. UINT16 ExtHeaderOffset;
  128. ///
  129. /// This field must always be set to zero.
  130. ///
  131. UINT8 Reserved[1];
  132. ///
  133. /// Set to 2. Future versions of this specification may define new header fields and will
  134. /// increment the Revision field accordingly.
  135. ///
  136. UINT8 Revision;
  137. ///
  138. /// An array of run-length encoded FvBlockMapEntry structures. The array is
  139. /// terminated with an entry of {0,0}.
  140. ///
  141. EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];
  142. } EFI_FIRMWARE_VOLUME_HEADER;
  143. #define EFI_FVH_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', 'H')
  144. ///
  145. /// Firmware Volume Header Revision definition
  146. ///
  147. #define EFI_FVH_REVISION 0x02
  148. ///
  149. /// Extension header pointed by ExtHeaderOffset of volume header.
  150. ///
  151. typedef struct {
  152. ///
  153. /// Firmware volume name.
  154. ///
  155. EFI_GUID FvName;
  156. ///
  157. /// Size of the rest of the extension header, including this structure.
  158. ///
  159. UINT32 ExtHeaderSize;
  160. } EFI_FIRMWARE_VOLUME_EXT_HEADER;
  161. ///
  162. /// Entry struture for describing FV extension header
  163. ///
  164. typedef struct {
  165. ///
  166. /// Size of this header extension.
  167. ///
  168. UINT16 ExtEntrySize;
  169. ///
  170. /// Type of the header.
  171. ///
  172. UINT16 ExtEntryType;
  173. } EFI_FIRMWARE_VOLUME_EXT_ENTRY;
  174. #define EFI_FV_EXT_TYPE_OEM_TYPE 0x01
  175. ///
  176. /// This extension header provides a mapping between a GUID and an OEM file type.
  177. ///
  178. typedef struct {
  179. ///
  180. /// Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.
  181. ///
  182. EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
  183. ///
  184. /// A bit mask, one bit for each file type between 0xC0 (bit 0) and 0xDF (bit 31). If a bit
  185. /// is '1', then the GUID entry exists in Types. If a bit is '0' then no GUID entry exists in Types.
  186. ///
  187. UINT32 TypeMask;
  188. ///
  189. /// An array of GUIDs, each GUID representing an OEM file type.
  190. ///
  191. EFI_GUID Types[1];
  192. } EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;
  193. #endif