TianoCore EDK2 master
PiFirmwareFile.h
Go to the documentation of this file.
1
12#ifndef __PI_FIRMWARE_FILE_H__
13#define __PI_FIRMWARE_FILE_H__
14
15#pragma pack(1)
19typedef union {
20 struct {
26 UINT8 Header;
36 UINT8 File;
37 } Checksum;
41 UINT16 Checksum16;
43
48#define FFS_FIXED_CHECKSUM 0xAA
49
50typedef UINT8 EFI_FV_FILETYPE;
51typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;
52typedef UINT8 EFI_FFS_FILE_STATE;
53
57#define EFI_FV_FILETYPE_ALL 0x00
58#define EFI_FV_FILETYPE_RAW 0x01
59#define EFI_FV_FILETYPE_FREEFORM 0x02
60#define EFI_FV_FILETYPE_SECURITY_CORE 0x03
61#define EFI_FV_FILETYPE_PEI_CORE 0x04
62#define EFI_FV_FILETYPE_DXE_CORE 0x05
63#define EFI_FV_FILETYPE_PEIM 0x06
64#define EFI_FV_FILETYPE_DRIVER 0x07
65#define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08
66#define EFI_FV_FILETYPE_APPLICATION 0x09
67#define EFI_FV_FILETYPE_MM 0x0A
68#define EFI_FV_FILETYPE_SMM EFI_FV_FILETYPE_MM
69#define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B
70#define EFI_FV_FILETYPE_COMBINED_MM_DXE 0x0C
71#define EFI_FV_FILETYPE_COMBINED_SMM_DXE EFI_FV_FILETYPE_COMBINED_MM_DXE
72#define EFI_FV_FILETYPE_MM_CORE 0x0D
73#define EFI_FV_FILETYPE_SMM_CORE EFI_FV_FILETYPE_MM_CORE
74#define EFI_FV_FILETYPE_MM_STANDALONE 0x0E
75#define EFI_FV_FILETYPE_MM_CORE_STANDALONE 0x0F
76#define EFI_FV_FILETYPE_OEM_MIN 0xc0
77#define EFI_FV_FILETYPE_OEM_MAX 0xdf
78#define EFI_FV_FILETYPE_DEBUG_MIN 0xe0
79#define EFI_FV_FILETYPE_DEBUG_MAX 0xef
80#define EFI_FV_FILETYPE_FFS_MIN 0xf0
81#define EFI_FV_FILETYPE_FFS_MAX 0xff
82#define EFI_FV_FILETYPE_FFS_PAD 0xf0
86#define FFS_ATTRIB_LARGE_FILE 0x01
87#define FFS_ATTRIB_DATA_ALIGNMENT_2 0x02
88#define FFS_ATTRIB_FIXED 0x04
89#define FFS_ATTRIB_DATA_ALIGNMENT 0x38
90#define FFS_ATTRIB_CHECKSUM 0x40
91
95#define EFI_FILE_HEADER_CONSTRUCTION 0x01
96#define EFI_FILE_HEADER_VALID 0x02
97#define EFI_FILE_DATA_VALID 0x04
98#define EFI_FILE_MARKED_FOR_UPDATE 0x08
99#define EFI_FILE_DELETED 0x10
100#define EFI_FILE_HEADER_INVALID 0x20
101
106typedef struct {
118 EFI_FV_FILETYPE Type;
122 EFI_FFS_FILE_ATTRIBUTES Attributes;
126 UINT8 Size[3];
130 EFI_FFS_FILE_STATE State;
132
133typedef struct {
140
145
149 EFI_FV_FILETYPE Type;
150
154 EFI_FFS_FILE_ATTRIBUTES Attributes;
155
163 UINT8 Size[3];
164
168 EFI_FFS_FILE_STATE State;
169
176
177#define IS_FFS_FILE2(FfsFileHeaderPtr) \
178 (((((EFI_FFS_FILE_HEADER *) (UINTN) FfsFileHeaderPtr)->Attributes) & FFS_ATTRIB_LARGE_FILE) == FFS_ATTRIB_LARGE_FILE)
179
185#define FFS_FILE_SIZE(FfsFileHeaderPtr) ((UINT32) (\
186 (((EFI_FFS_FILE_HEADER *) (UINTN) (FfsFileHeaderPtr))->Size[0] ) | \
187 (((EFI_FFS_FILE_HEADER *) (UINTN) (FfsFileHeaderPtr))->Size[1] << 8) | \
188 (((EFI_FFS_FILE_HEADER *) (UINTN) (FfsFileHeaderPtr))->Size[2] << 16)))
189
190#define FFS_FILE2_SIZE(FfsFileHeaderPtr) \
191 ((UINT32) (((EFI_FFS_FILE_HEADER2 *) (UINTN) FfsFileHeaderPtr)->ExtendedSize))
192
193typedef UINT8 EFI_SECTION_TYPE;
194
199#define EFI_SECTION_ALL 0x00
200
204#define EFI_SECTION_COMPRESSION 0x01
205
206#define EFI_SECTION_GUID_DEFINED 0x02
207
208#define EFI_SECTION_DISPOSABLE 0x03
209
213#define EFI_SECTION_PE32 0x10
214#define EFI_SECTION_PIC 0x11
215#define EFI_SECTION_TE 0x12
216#define EFI_SECTION_DXE_DEPEX 0x13
217#define EFI_SECTION_VERSION 0x14
218#define EFI_SECTION_USER_INTERFACE 0x15
219#define EFI_SECTION_COMPATIBILITY16 0x16
220#define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17
221#define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18
222#define EFI_SECTION_RAW 0x19
223#define EFI_SECTION_PEI_DEPEX 0x1B
224#define EFI_SECTION_MM_DEPEX 0x1C
225#define EFI_SECTION_SMM_DEPEX EFI_SECTION_MM_DEPEX
226
230typedef struct {
235 UINT8 Size[3];
236 EFI_SECTION_TYPE Type;
241
242typedef struct {
247 UINT8 Size[3];
248
249 EFI_SECTION_TYPE Type;
250
257
264
268#define EFI_NOT_COMPRESSED 0x00
269#define EFI_STANDARD_COMPRESSION 0x01
274typedef struct {
288
289typedef struct {
303
315
321
327
331typedef struct {
341
342typedef struct {
352
356#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01
357#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02
361typedef struct {
379
380typedef struct {
398
404
410
422
428
434
445
450typedef struct {
451 EFI_COMMON_SECTION_HEADER CommonHeader;
452
456 CHAR16 FileNameString[1];
458
459typedef struct {
460 EFI_COMMON_SECTION_HEADER2 CommonHeader;
461 CHAR16 FileNameString[1];
463
468typedef struct {
469 EFI_COMMON_SECTION_HEADER CommonHeader;
470 UINT16 BuildNumber;
471
475 CHAR16 VersionString[1];
477
478typedef struct {
479 EFI_COMMON_SECTION_HEADER2 CommonHeader;
485 CHAR16 VersionString[1];
487
493#define SECTION_SIZE(SectionHeaderPtr) ((UINT32) (\
494 (((EFI_COMMON_SECTION_HEADER *) (UINTN) (SectionHeaderPtr))->Size[0] ) | \
495 (((EFI_COMMON_SECTION_HEADER *) (UINTN) (SectionHeaderPtr))->Size[1] << 8) | \
496 (((EFI_COMMON_SECTION_HEADER *) (UINTN) (SectionHeaderPtr))->Size[2] << 16)))
497
498#define IS_SECTION2(SectionHeaderPtr) \
499 (SECTION_SIZE (SectionHeaderPtr) == 0x00ffffff)
500
501#define SECTION2_SIZE(SectionHeaderPtr) \
502 (((EFI_COMMON_SECTION_HEADER2 *) (UINTN) SectionHeaderPtr)->ExtendedSize)
503
504#pragma pack()
505
506#endif
EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION
EFI_COMMON_SECTION_HEADER EFI_SMM_DEPEX_SECTION
EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION
EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION
EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION
EFI_COMMON_SECTION_HEADER EFI_DISPOSABLE_SECTION
EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION
EFI_COMMON_SECTION_HEADER EFI_TE_SECTION
EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION
EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION
EFI_COMMON_SECTION_HEADER2 CommonHeader
EFI_COMMON_SECTION_HEADER CommonHeader
EFI_FFS_INTEGRITY_CHECK IntegrityCheck
EFI_FV_FILETYPE Type
EFI_FFS_FILE_STATE State
EFI_FFS_FILE_ATTRIBUTES Attributes
EFI_FFS_INTEGRITY_CHECK IntegrityCheck
EFI_FV_FILETYPE Type
EFI_FFS_FILE_ATTRIBUTES Attributes
EFI_FFS_FILE_STATE State
EFI_COMMON_SECTION_HEADER2 CommonHeader
EFI_COMMON_SECTION_HEADER CommonHeader
EFI_COMMON_SECTION_HEADER2 CommonHeader
EFI_COMMON_SECTION_HEADER CommonHeader
Definition: Base.h:213