12#ifndef __PI_FIRMWARE_FILE_H__
13#define __PI_FIRMWARE_FILE_H__
51#define FFS_FIXED_CHECKSUM 0xAA
60#define EFI_FV_FILETYPE_ALL 0x00
61#define EFI_FV_FILETYPE_RAW 0x01
62#define EFI_FV_FILETYPE_FREEFORM 0x02
63#define EFI_FV_FILETYPE_SECURITY_CORE 0x03
64#define EFI_FV_FILETYPE_PEI_CORE 0x04
65#define EFI_FV_FILETYPE_DXE_CORE 0x05
66#define EFI_FV_FILETYPE_PEIM 0x06
67#define EFI_FV_FILETYPE_DRIVER 0x07
68#define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08
69#define EFI_FV_FILETYPE_APPLICATION 0x09
70#define EFI_FV_FILETYPE_MM 0x0A
71#define EFI_FV_FILETYPE_SMM EFI_FV_FILETYPE_MM
72#define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B
73#define EFI_FV_FILETYPE_COMBINED_MM_DXE 0x0C
74#define EFI_FV_FILETYPE_COMBINED_SMM_DXE EFI_FV_FILETYPE_COMBINED_MM_DXE
75#define EFI_FV_FILETYPE_MM_CORE 0x0D
76#define EFI_FV_FILETYPE_SMM_CORE EFI_FV_FILETYPE_MM_CORE
77#define EFI_FV_FILETYPE_MM_STANDALONE 0x0E
78#define EFI_FV_FILETYPE_MM_CORE_STANDALONE 0x0F
79#define EFI_FV_FILETYPE_OEM_MIN 0xc0
80#define EFI_FV_FILETYPE_OEM_MAX 0xdf
81#define EFI_FV_FILETYPE_DEBUG_MIN 0xe0
82#define EFI_FV_FILETYPE_DEBUG_MAX 0xef
83#define EFI_FV_FILETYPE_FFS_MIN 0xf0
84#define EFI_FV_FILETYPE_FFS_MAX 0xff
85#define EFI_FV_FILETYPE_FFS_PAD 0xf0
89#define FFS_ATTRIB_LARGE_FILE 0x01
90#define FFS_ATTRIB_DATA_ALIGNMENT_2 0x02
91#define FFS_ATTRIB_FIXED 0x04
92#define FFS_ATTRIB_DATA_ALIGNMENT 0x38
93#define FFS_ATTRIB_CHECKSUM 0x40
98#define EFI_FILE_HEADER_CONSTRUCTION 0x01
99#define EFI_FILE_HEADER_VALID 0x02
100#define EFI_FILE_DATA_VALID 0x04
101#define EFI_FILE_MARKED_FOR_UPDATE 0x08
102#define EFI_FILE_DELETED 0x10
103#define EFI_FILE_HEADER_INVALID 0x20
180#define IS_FFS_FILE2(FfsFileHeaderPtr) \
181 (((((EFI_FFS_FILE_HEADER *) (UINTN) FfsFileHeaderPtr)->Attributes) & FFS_ATTRIB_LARGE_FILE) == FFS_ATTRIB_LARGE_FILE)
188#define FFS_FILE_SIZE(FfsFileHeaderPtr) ((UINT32) (\
189 (((EFI_FFS_FILE_HEADER *) (UINTN) (FfsFileHeaderPtr))->Size[0] ) | \
190 (((EFI_FFS_FILE_HEADER *) (UINTN) (FfsFileHeaderPtr))->Size[1] << 8) | \
191 (((EFI_FFS_FILE_HEADER *) (UINTN) (FfsFileHeaderPtr))->Size[2] << 16)))
193#define FFS_FILE2_SIZE(FfsFileHeaderPtr) \
194 ((UINT32) (((EFI_FFS_FILE_HEADER2 *) (UINTN) FfsFileHeaderPtr)->ExtendedSize))
202#define EFI_SECTION_ALL 0x00
207#define EFI_SECTION_COMPRESSION 0x01
209#define EFI_SECTION_GUID_DEFINED 0x02
211#define EFI_SECTION_DISPOSABLE 0x03
216#define EFI_SECTION_PE32 0x10
217#define EFI_SECTION_PIC 0x11
218#define EFI_SECTION_TE 0x12
219#define EFI_SECTION_DXE_DEPEX 0x13
220#define EFI_SECTION_VERSION 0x14
221#define EFI_SECTION_USER_INTERFACE 0x15
222#define EFI_SECTION_COMPATIBILITY16 0x16
223#define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17
224#define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18
225#define EFI_SECTION_RAW 0x19
226#define EFI_SECTION_PEI_DEPEX 0x1B
227#define EFI_SECTION_MM_DEPEX 0x1C
228#define EFI_SECTION_SMM_DEPEX EFI_SECTION_MM_DEPEX
271#define EFI_NOT_COMPRESSED 0x00
272#define EFI_STANDARD_COMPRESSION 0x01
359#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01
360#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02
496#define SECTION_SIZE(SectionHeaderPtr) ((UINT32) (\
497 (((EFI_COMMON_SECTION_HEADER *) (UINTN) (SectionHeaderPtr))->Size[0] ) | \
498 (((EFI_COMMON_SECTION_HEADER *) (UINTN) (SectionHeaderPtr))->Size[1] << 8) | \
499 (((EFI_COMMON_SECTION_HEADER *) (UINTN) (SectionHeaderPtr))->Size[2] << 16)))
501#define IS_SECTION2(SectionHeaderPtr) \
502 (SECTION_SIZE (SectionHeaderPtr) == 0x00ffffff)
504#define SECTION2_SIZE(SectionHeaderPtr) \
505 (((EFI_COMMON_SECTION_HEADER2 *) (UINTN) SectionHeaderPtr)->ExtendedSize)
unsigned short UINT16
2-byte unsigned value.
unsigned long long UINT64
8-byte unsigned value.
unsigned short CHAR16
2-byte Character.
unsigned char UINT8
1-byte unsigned value.
unsigned int UINT32
4-byte unsigned value.
EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION
The leaf section which contains PE32+ image.
EFI_COMMON_SECTION_HEADER EFI_SMM_DEPEX_SECTION
The SMM dependency expression section is a leaf section that contains a dependency expression that is...
EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION
The leaf section which contains a PI FV.
EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION
A leaf section type that contains a position-independent-code (PIC) image.
EFI_COMMON_SECTION_HEADER2 EFI_PE32_SECTION2
EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION
The leaf section which contains an array of zero or more bytes.
EFI_COMMON_SECTION_HEADER2 EFI_COMPATIBILITY16_SECTION2
EFI_COMMON_SECTION_HEADER2 EFI_DISPOSABLE_SECTION2
EFI_COMMON_SECTION_HEADER2 EFI_RAW_SECTION2
EFI_COMMON_SECTION_HEADER EFI_DISPOSABLE_SECTION
An encapsulation section type in which the section data is disposable.
EFI_COMMON_SECTION_HEADER2 EFI_DXE_DEPEX_SECTION2
EFI_COMMON_SECTION_HEADER2 EFI_SMM_DEPEX_SECTION2
EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION
The leaf section which could be used to determine the dispatch order of DXEs.
EFI_COMMON_SECTION_HEADER EFI_TE_SECTION
The leaf section which constains the position-independent-code image.
EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION
The leaf section used to determine the dispatch order of PEIMs.
EFI_COMMON_SECTION_HEADER2 EFI_FIRMWARE_VOLUME_IMAGE_SECTION2
UINT8 EFI_FFS_FILE_ATTRIBUTES
EFI_COMMON_SECTION_HEADER2 EFI_PIC_SECTION2
EFI_COMMON_SECTION_HEADER2 EFI_PEI_DEPEX_SECTION2
EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION
Leaf section type that contains an IA-32 16-bit executable image.
EFI_COMMON_SECTION_HEADER2 EFI_TE_SECTION2
GUID EFI_GUID
128-bit buffer containing a unique identifier value.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
UINT8_t Checksum
Checksum.
UINT8 CompressionType
Indicates which compression algorithm is used.
UINT32 UncompressedLength
UINT32 that indicates the size of the section data after decompression.
EFI_COMMON_SECTION_HEADER2 CommonHeader
Usual common section header.
An encapsulation section type in which the section data is compressed.
EFI_COMMON_SECTION_HEADER CommonHeader
Usual common section header.
UINT8 CompressionType
Indicates which compression algorithm is used.
UINT32 UncompressedLength
The UINT32 that indicates the size of the section data after decompression.
UINT16 DataOffset
Contains the offset in bytes from the beginning of the common header to the first byte of the data.
UINT16 Attributes
The bit field that declares some specific characteristics of the section contents.
EFI_GUID SectionDefinitionGuid
The GUID that defines the format of the data that follows.
EFI_COMMON_SECTION_HEADER2 CommonHeader
The common section header.
The leaf section which is encapsulation defined by specific GUID.
EFI_COMMON_SECTION_HEADER CommonHeader
The common section header.
UINT16 Attributes
The bit field that declares some specific characteristics of the section contents.
UINT16 DataOffset
Contains the offset in bytes from the beginning of the common header to the first byte of the data.
EFI_GUID SectionDefinitionGuid
The GUID that defines the format of the data that follows.
EFI_COMMON_SECTION_HEADER2 CommonHeader
The leaf section which contains a unicode string that is human readable file name.
EFI_COMMON_SECTION_HEADER CommonHeader
CHAR16 FileNameString[1]
Array of unicode string.
UINT16 BuildNumber
A UINT16 that represents a particular build.
EFI_COMMON_SECTION_HEADER2 CommonHeader
The leaf section which contains a numeric build number and an optional unicode string that represents...
EFI_COMMON_SECTION_HEADER CommonHeader
CHAR16 VersionString[1]
Array of unicode string.
Used to verify the integrity of the file.
UINT8 Header
The IntegrityCheck.Checksum.Header field is an 8-bit checksum of the file header.
UINT8 File
If the FFS_ATTRIB_CHECKSUM (see definition below) bit of the Attributes field is set to one,...
UINT16 Checksum16
This is the full 16 bits of the IntegrityCheck field.