efiimg.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. efiimg.h
  5. Abstract:
  6. This header contains definitions for the EFI image format.
  7. Author:
  8. Evan Green 6-Mar-2014
  9. --*/
  10. //
  11. // ------------------------------------------------------------------- Includes
  12. //
  13. //
  14. // --------------------------------------------------------------------- Macros
  15. //
  16. //
  17. // ---------------------------------------------------------------- Definitions
  18. //
  19. //
  20. // Define EFI file types.
  21. //
  22. #define EFI_FV_FILETYPE_ALL 0x00
  23. #define EFI_FV_FILETYPE_RAW 0x01
  24. #define EFI_FV_FILETYPE_FREEFORM 0x02
  25. #define EFI_FV_FILETYPE_SECURITY_CORE 0x03
  26. #define EFI_FV_FILETYPE_PEI_CORE 0x04
  27. #define EFI_FV_FILETYPE_DXE_CORE 0x05
  28. #define EFI_FV_FILETYPE_PEIM 0x06
  29. #define EFI_FV_FILETYPE_DRIVER 0x07
  30. #define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08
  31. #define EFI_FV_FILETYPE_APPLICATION 0x09
  32. #define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B
  33. #define EFI_SECTION_ALL 0x00
  34. //
  35. // Define EFI encapsulation section types.
  36. //
  37. #define EFI_SECTION_COMPRESSION 0x01
  38. #define EFI_SECTION_GUID_DEFINED 0x02
  39. //
  40. // Define EFI leaf section types.
  41. //
  42. #define EFI_SECTION_FIRST_LEAF_SECTION_TYPE 0x10
  43. #define EFI_SECTION_PE32 0x10
  44. #define EFI_SECTION_PIC 0x11
  45. #define EFI_SECTION_TE 0x12
  46. #define EFI_SECTION_DXE_DEPEX 0x13
  47. #define EFI_SECTION_VERSION 0x14
  48. #define EFI_SECTION_USER_INTERFACE 0x15
  49. #define EFI_SECTION_COMPATIBILITY16 0x16
  50. #define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17
  51. #define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18
  52. #define EFI_SECTION_RAW 0x19
  53. #define EFI_SECTION_PEI_DEPEX 0x1B
  54. #define EFI_SECTION_LAST_LEAF_SECTION_TYPE 0x1B
  55. #define EFI_SECTION_LAST_SECTION_TYPE 0x1B
  56. //
  57. // Define compression type values.
  58. //
  59. #define EFI_NOT_COMPRESSED 0x00
  60. #define EFI_STANDARD_COMPRESSION 0x01
  61. #define EFI_CUSTOMIZED_COMPRESSION 0x02
  62. //
  63. // Define GUIDed section attributes.
  64. //
  65. #define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01
  66. #define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02
  67. //
  68. // Define authentication status bits.
  69. //
  70. #define EFI_AGGREGATE_AUTH_STATUS_PLATFORM_OVERRIDE 0x000001
  71. #define EFI_AGGREGATE_AUTH_STATUS_IMAGE_SIGNED 0x000002
  72. #define EFI_AGGREGATE_AUTH_STATUS_NOT_TESTED 0x000004
  73. #define EFI_AGGREGATE_AUTH_STATUS_TEST_FAILED 0x000008
  74. #define EFI_AGGREGATE_AUTH_STATUS_ALL 0x00000f
  75. #define EFI_LOCAL_AUTH_STATUS_PLATFORM_OVERRIDE 0x010000
  76. #define EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED 0x020000
  77. #define EFI_LOCAL_AUTH_STATUS_NOT_TESTED 0x040000
  78. #define EFI_LOCAL_AUTH_STATUS_TEST_FAILED 0x080000
  79. #define EFI_LOCAL_AUTH_STATUS_ALL 0x0f0000
  80. //
  81. // ------------------------------------------------------ Data Type Definitions
  82. //
  83. typedef UINT8 EFI_FV_FILETYPE, *PEFI_FV_FILETYPE;
  84. typedef UINT8 EFI_SECTION_TYPE, *PEFI_SECTION_TYPE;
  85. typedef union _EFI_COMMON_SECTION_HEADER {
  86. struct {
  87. UINT8 Size[3];
  88. UINT8 Type;
  89. } Elements;
  90. UINT32 AsUint32;
  91. } PACKED EFI_COMMON_SECTION_HEADER, *PEFI_COMMON_SECTION_HEADER;
  92. typedef union _EFI_COMMON_SECTION_HEADER2 {
  93. struct {
  94. UINT8 Size[3];
  95. EFI_SECTION_TYPE Type;
  96. UINT32 ExtendedSize;
  97. } Elements;
  98. UINT32 AsUint32;
  99. } PACKED EFI_COMMON_SECTION_HEADER2, *PEFI_COMMON_SECTION_HEADER2;
  100. typedef struct _EFI_COMPRESSION_SECTION {
  101. EFI_COMMON_SECTION_HEADER CommonHeader;
  102. UINT32 UncompressedLength;
  103. UINT8 CompressionType;
  104. } PACKED EFI_COMPRESSION_SECTION, *PEFI_COMPRESSION_SECTION;
  105. typedef struct _EFI_GUID_DEFINED_SECTION {
  106. EFI_COMMON_SECTION_HEADER CommonHeader;
  107. EFI_GUID SectionDefinitionGuid;
  108. UINT16 DataOffset;
  109. UINT16 Attributes;
  110. } PACKED EFI_GUID_DEFINED_SECTION, *PEFI_GUID_DEFINED_SECTION;
  111. typedef struct _EFI_GUID_DEFINED_SECTION2 {
  112. EFI_COMMON_SECTION_HEADER2 CommonHeader;
  113. EFI_GUID SectionDefinitionGuid;
  114. UINT16 DataOffset;
  115. UINT16 Attributes;
  116. } PACKED EFI_GUID_DEFINED_SECTION2, *PEFI_GUID_DEFINED_SECTION2;
  117. typedef struct _EFI_PE32_SECTION {
  118. EFI_COMMON_SECTION_HEADER CommonHeader;
  119. } PACKED EFI_PE32_SECTION, *PEFI_PE32_SECTION;
  120. typedef struct _EFI_PIC_SECTION {
  121. EFI_COMMON_SECTION_HEADER CommonHeader;
  122. } PACKED EFI_PIC_SECTION, *PEFI_PIC_SECTION;
  123. typedef struct _EFI_PEIM_HEADER_SECTION {
  124. EFI_COMMON_SECTION_HEADER CommonHeader;
  125. } PACKED EFI_PEIM_HEADER_SECTION, *PEFI_PEIM_HEADER_SECTION;
  126. typedef struct _EFI_DEPEX_SECTION {
  127. EFI_COMMON_SECTION_HEADER CommonHeader;
  128. } PACKED EFI_DEPEX_SECTION, *PEFI_DEPEX_SECTION;
  129. typedef struct _EFI_VERSION_SECTION {
  130. EFI_COMMON_SECTION_HEADER CommonHeader;
  131. UINT16 BuildNumber;
  132. INT16 VersionString[1];
  133. } PACKED EFI_VERSION_SECTION, *PEFI_VERSION_SECTION;
  134. typedef struct _EFI_USER_INTERFACE_SECTION {
  135. EFI_COMMON_SECTION_HEADER CommonHeader;
  136. INT16 FileNameString[1];
  137. } PACKED EFI_USER_INTERFACE_SECTION, *PEFI_USER_INTERFACE_SECTION;
  138. typedef struct _EFI_CODE16_SECTION {
  139. EFI_COMMON_SECTION_HEADER CommonHeader;
  140. } PACKED EFI_CODE16_SECTION, *PEFI_CODE16_SECTION;
  141. typedef struct _EFI_FIRMWARE_VOLUME_IMAGE_SECTION {
  142. EFI_COMMON_SECTION_HEADER CommonHeader;
  143. } PACKED EFI_FIRMWARE_VOLUME_IMAGE_SECTION, *PEFI_FIRMWARE_VOLUME_IMAGE_SECTION;
  144. typedef struct _EFI_FREEFORM_SUBTYPE_GUID_SECTION {
  145. EFI_COMMON_SECTION_HEADER CommonHeader;
  146. EFI_GUID SubTypeGuid;
  147. } PACKED EFI_FREEFORM_SUBTYPE_GUID_SECTION, *PEFI_FREEFORM_SUBTYPE_GUID_SECTION;
  148. typedef struct _EFI_RAW_SECTION {
  149. EFI_COMMON_SECTION_HEADER CommonHeader;
  150. } PACKED EFI_RAW_SECTION, *PEFI_RAW_SECTION;
  151. typedef union _EFI_FILE_SECTION_POINTER {
  152. EFI_COMMON_SECTION_HEADER *CommonHeader;
  153. EFI_COMPRESSION_SECTION *CompressionSection;
  154. EFI_GUID_DEFINED_SECTION *GuidDefinedSection;
  155. EFI_PE32_SECTION *Pe32Section;
  156. EFI_PIC_SECTION *PicSection;
  157. EFI_PEIM_HEADER_SECTION *PeimHeaderSection;
  158. EFI_DEPEX_SECTION *DependencySection;
  159. EFI_VERSION_SECTION *VersionSection;
  160. EFI_USER_INTERFACE_SECTION *UISection;
  161. EFI_CODE16_SECTION *Code16Section;
  162. EFI_FIRMWARE_VOLUME_IMAGE_SECTION *FVImageSection;
  163. EFI_FREEFORM_SUBTYPE_GUID_SECTION *FreeformSubtypeSection;
  164. EFI_RAW_SECTION *RawSection;
  165. } EFI_FILE_SECTION_POINTER, *PEFI_FILE_SECTION_POINTER;
  166. //
  167. // -------------------------------------------------------------------- Globals
  168. //
  169. //
  170. // -------------------------------------------------------- Function Prototypes
  171. //