1 /*++ 2 3 Copyright (c) 2004, 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 9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 12 Module Name: 13 14 EfiImageFormat.h 15 16 Abstract: 17 18 This file defines the data structures that are architecturally defined for file 19 images loaded via the FirmwareVolume protocol. The Firmware Volume specification 20 is the basis for these definitions. 21 22 --*/ 23 24 #ifndef _EFI_IMAGE_FORMAT_H_ 25 #define _EFI_IMAGE_FORMAT_H_ 26 27 // 28 // pack all data structures since this is actually a binary format and we cannot 29 // allow internal padding in the data structures because of some compilerism.. 30 // 31 #pragma pack(1) 32 // 33 // //////////////////////////////////////////////////////////////////////////// 34 // 35 // Architectural file types 36 // 37 typedef UINT8 EFI_FV_FILETYPE; 38 39 #define EFI_FV_FILETYPE_ALL 0x00 40 #define EFI_FV_FILETYPE_RAW 0x01 41 #define EFI_FV_FILETYPE_FREEFORM 0x02 42 #define EFI_FV_FILETYPE_SECURITY_CORE 0x03 43 #define EFI_FV_FILETYPE_PEI_CORE 0x04 44 #define EFI_FV_FILETYPE_DXE_CORE 0x05 45 #define EFI_FV_FILETYPE_PEIM 0x06 46 #define EFI_FV_FILETYPE_DRIVER 0x07 47 #define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08 48 #define EFI_FV_FILETYPE_APPLICATION 0x09 49 // 50 // File type 0x0A is reserved and should not be used 51 // 52 #define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B 53 54 // 55 // //////////////////////////////////////////////////////////////////////////// 56 // 57 // Section types 58 // 59 typedef UINT8 EFI_SECTION_TYPE; 60 61 // 62 // ************************************************************ 63 // The section type EFI_SECTION_ALL is a psuedo type. It is 64 // used as a wildcard when retrieving sections. The section 65 // type EFI_SECTION_ALL matches all section types. 66 // ************************************************************ 67 // 68 #define EFI_SECTION_ALL 0x00 69 70 // 71 // ************************************************************ 72 // Encapsulation section Type values 73 // ************************************************************ 74 // 75 #define EFI_SECTION_COMPRESSION 0x01 76 #define EFI_SECTION_GUID_DEFINED 0x02 77 78 // 79 // ************************************************************ 80 // Leaf section Type values 81 // ************************************************************ 82 // 83 #define EFI_SECTION_FIRST_LEAF_SECTION_TYPE 0x10 84 85 #define EFI_SECTION_PE32 0x10 86 #define EFI_SECTION_PIC 0x11 87 #define EFI_SECTION_TE 0x12 88 #define EFI_SECTION_DXE_DEPEX 0x13 89 #define EFI_SECTION_VERSION 0x14 90 #define EFI_SECTION_USER_INTERFACE 0x15 91 #define EFI_SECTION_COMPATIBILITY16 0x16 92 #define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17 93 #define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18 94 #define EFI_SECTION_RAW 0x19 95 #define EFI_SECTION_PEI_DEPEX 0x1B 96 97 #define EFI_SECTION_LAST_LEAF_SECTION_TYPE 0x1B 98 #define EFI_SECTION_LAST_SECTION_TYPE 0x1B 99 100 // 101 // //////////////////////////////////////////////////////////////////////////// 102 // 103 // Common section header 104 // 105 typedef struct { 106 UINT8 Size[3]; 107 UINT8 Type; 108 } EFI_COMMON_SECTION_HEADER; 109 110 #define SECTION_SIZE(SectionHeaderPtr) \ 111 ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff)) 112 113 // 114 // //////////////////////////////////////////////////////////////////////////// 115 // 116 // Compression section 117 // 118 // 119 // CompressionType values 120 // 121 #define EFI_NOT_COMPRESSED 0x00 122 #define EFI_STANDARD_COMPRESSION 0x01 123 #define EFI_CUSTOMIZED_COMPRESSION 0x02 124 125 typedef struct { 126 EFI_COMMON_SECTION_HEADER CommonHeader; 127 UINT32 UncompressedLength; 128 UINT8 CompressionType; 129 } EFI_COMPRESSION_SECTION; 130 131 // 132 // //////////////////////////////////////////////////////////////////////////// 133 // 134 // GUID defined section 135 // 136 typedef struct { 137 EFI_COMMON_SECTION_HEADER CommonHeader; 138 EFI_GUID SectionDefinitionGuid; 139 UINT16 DataOffset; 140 UINT16 Attributes; 141 } EFI_GUID_DEFINED_SECTION; 142 143 // 144 // Bit values for Attributes 145 // 146 #define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01 147 #define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02 148 149 // 150 // Bit values for AuthenticationStatus 151 // 152 #define EFI_AGGREGATE_AUTH_STATUS_PLATFORM_OVERRIDE 0x000001 153 #define EFI_AGGREGATE_AUTH_STATUS_IMAGE_SIGNED 0x000002 154 #define EFI_AGGREGATE_AUTH_STATUS_NOT_TESTED 0x000004 155 #define EFI_AGGREGATE_AUTH_STATUS_TEST_FAILED 0x000008 156 #define EFI_AGGREGATE_AUTH_STATUS_ALL 0x00000f 157 158 #define EFI_LOCAL_AUTH_STATUS_PLATFORM_OVERRIDE 0x010000 159 #define EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED 0x020000 160 #define EFI_LOCAL_AUTH_STATUS_NOT_TESTED 0x040000 161 #define EFI_LOCAL_AUTH_STATUS_TEST_FAILED 0x080000 162 #define EFI_LOCAL_AUTH_STATUS_ALL 0x0f0000 163 164 // 165 // //////////////////////////////////////////////////////////////////////////// 166 // 167 // PE32+ section 168 // 169 typedef struct { 170 EFI_COMMON_SECTION_HEADER CommonHeader; 171 } EFI_PE32_SECTION; 172 173 // 174 // //////////////////////////////////////////////////////////////////////////// 175 // 176 // PIC section 177 // 178 typedef struct { 179 EFI_COMMON_SECTION_HEADER CommonHeader; 180 } EFI_PIC_SECTION; 181 182 // 183 // //////////////////////////////////////////////////////////////////////////// 184 // 185 // PEIM header section 186 // 187 typedef struct { 188 EFI_COMMON_SECTION_HEADER CommonHeader; 189 } EFI_PEIM_HEADER_SECTION; 190 191 // 192 // //////////////////////////////////////////////////////////////////////////// 193 // 194 // DEPEX section 195 // 196 typedef struct { 197 EFI_COMMON_SECTION_HEADER CommonHeader; 198 } EFI_DEPEX_SECTION; 199 200 // 201 // //////////////////////////////////////////////////////////////////////////// 202 // 203 // Version section 204 // 205 typedef struct { 206 EFI_COMMON_SECTION_HEADER CommonHeader; 207 UINT16 BuildNumber; 208 INT16 VersionString[1]; 209 } EFI_VERSION_SECTION; 210 211 // 212 // //////////////////////////////////////////////////////////////////////////// 213 // 214 // User interface section 215 // 216 typedef struct { 217 EFI_COMMON_SECTION_HEADER CommonHeader; 218 INT16 FileNameString[1]; 219 } EFI_USER_INTERFACE_SECTION; 220 221 // 222 // //////////////////////////////////////////////////////////////////////////// 223 // 224 // Code16 section 225 // 226 typedef struct { 227 EFI_COMMON_SECTION_HEADER CommonHeader; 228 } EFI_CODE16_SECTION; 229 230 // 231 // //////////////////////////////////////////////////////////////////////////// 232 // 233 // Firmware Volume Image section 234 // 235 typedef struct { 236 EFI_COMMON_SECTION_HEADER CommonHeader; 237 } EFI_FIRMWARE_VOLUME_IMAGE_SECTION; 238 239 // 240 // //////////////////////////////////////////////////////////////////////////// 241 // 242 // Freeform subtype GUID section 243 // 244 typedef struct { 245 EFI_COMMON_SECTION_HEADER CommonHeader; 246 EFI_GUID SubTypeGuid; 247 } EFI_FREEFORM_SUBTYPE_GUID_SECTION; 248 249 // 250 // //////////////////////////////////////////////////////////////////////////// 251 // 252 // Raw section 253 // 254 typedef struct { 255 EFI_COMMON_SECTION_HEADER CommonHeader; 256 } EFI_RAW_SECTION; 257 258 // 259 // undo the pragma from the beginning... 260 // 261 #pragma pack() 262 263 typedef union { 264 EFI_COMMON_SECTION_HEADER *CommonHeader; 265 EFI_COMPRESSION_SECTION *CompressionSection; 266 EFI_GUID_DEFINED_SECTION *GuidDefinedSection; 267 EFI_PE32_SECTION *Pe32Section; 268 EFI_PIC_SECTION *PicSection; 269 EFI_PEIM_HEADER_SECTION *PeimHeaderSection; 270 EFI_DEPEX_SECTION *DependencySection; 271 EFI_VERSION_SECTION *VersionSection; 272 EFI_USER_INTERFACE_SECTION *UISection; 273 EFI_CODE16_SECTION *Code16Section; 274 EFI_FIRMWARE_VOLUME_IMAGE_SECTION *FVImageSection; 275 EFI_FREEFORM_SUBTYPE_GUID_SECTION *FreeformSubtypeSection; 276 EFI_RAW_SECTION *RawSection; 277 } EFI_FILE_SECTION_POINTER; 278 279 #endif 280