iPXE
PiFirmwareVolume.h
Go to the documentation of this file.
1 /** @file
2  The firmware volume related definitions in PI.
3 
4  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
5  SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7  @par Revision Reference:
8  PI Version 1.6
9 
10 **/
11 
12 #ifndef __PI_FIRMWAREVOLUME_H__
13 #define __PI_FIRMWAREVOLUME_H__
14 
15 FILE_LICENCE ( BSD2_PATENT );
16 
17 ///
18 /// EFI_FV_FILE_ATTRIBUTES
19 ///
21 
22 //
23 // Value of EFI_FV_FILE_ATTRIBUTES.
24 //
25 #define EFI_FV_FILE_ATTRIB_ALIGNMENT 0x0000001F
26 #define EFI_FV_FILE_ATTRIB_FIXED 0x00000100
27 #define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED 0x00000200
28 
29 ///
30 /// type of EFI FVB attribute
31 ///
33 
34 //
35 // Attributes bit definitions
36 //
37 #define EFI_FVB2_READ_DISABLED_CAP 0x00000001
38 #define EFI_FVB2_READ_ENABLED_CAP 0x00000002
39 #define EFI_FVB2_READ_STATUS 0x00000004
40 #define EFI_FVB2_WRITE_DISABLED_CAP 0x00000008
41 #define EFI_FVB2_WRITE_ENABLED_CAP 0x00000010
42 #define EFI_FVB2_WRITE_STATUS 0x00000020
43 #define EFI_FVB2_LOCK_CAP 0x00000040
44 #define EFI_FVB2_LOCK_STATUS 0x00000080
45 #define EFI_FVB2_STICKY_WRITE 0x00000200
46 #define EFI_FVB2_MEMORY_MAPPED 0x00000400
47 #define EFI_FVB2_ERASE_POLARITY 0x00000800
48 #define EFI_FVB2_READ_LOCK_CAP 0x00001000
49 #define EFI_FVB2_READ_LOCK_STATUS 0x00002000
50 #define EFI_FVB2_WRITE_LOCK_CAP 0x00004000
51 #define EFI_FVB2_WRITE_LOCK_STATUS 0x00008000
52 #define EFI_FVB2_ALIGNMENT 0x001F0000
53 #define EFI_FVB2_ALIGNMENT_1 0x00000000
54 #define EFI_FVB2_ALIGNMENT_2 0x00010000
55 #define EFI_FVB2_ALIGNMENT_4 0x00020000
56 #define EFI_FVB2_ALIGNMENT_8 0x00030000
57 #define EFI_FVB2_ALIGNMENT_16 0x00040000
58 #define EFI_FVB2_ALIGNMENT_32 0x00050000
59 #define EFI_FVB2_ALIGNMENT_64 0x00060000
60 #define EFI_FVB2_ALIGNMENT_128 0x00070000
61 #define EFI_FVB2_ALIGNMENT_256 0x00080000
62 #define EFI_FVB2_ALIGNMENT_512 0x00090000
63 #define EFI_FVB2_ALIGNMENT_1K 0x000A0000
64 #define EFI_FVB2_ALIGNMENT_2K 0x000B0000
65 #define EFI_FVB2_ALIGNMENT_4K 0x000C0000
66 #define EFI_FVB2_ALIGNMENT_8K 0x000D0000
67 #define EFI_FVB2_ALIGNMENT_16K 0x000E0000
68 #define EFI_FVB2_ALIGNMENT_32K 0x000F0000
69 #define EFI_FVB2_ALIGNMENT_64K 0x00100000
70 #define EFI_FVB2_ALIGNMENT_128K 0x00110000
71 #define EFI_FVB2_ALIGNMENT_256K 0x00120000
72 #define EFI_FVB2_ALIGNMENT_512K 0x00130000
73 #define EFI_FVB2_ALIGNMENT_1M 0x00140000
74 #define EFI_FVB2_ALIGNMENT_2M 0x00150000
75 #define EFI_FVB2_ALIGNMENT_4M 0x00160000
76 #define EFI_FVB2_ALIGNMENT_8M 0x00170000
77 #define EFI_FVB2_ALIGNMENT_16M 0x00180000
78 #define EFI_FVB2_ALIGNMENT_32M 0x00190000
79 #define EFI_FVB2_ALIGNMENT_64M 0x001A0000
80 #define EFI_FVB2_ALIGNMENT_128M 0x001B0000
81 #define EFI_FVB2_ALIGNMENT_256M 0x001C0000
82 #define EFI_FVB2_ALIGNMENT_512M 0x001D0000
83 #define EFI_FVB2_ALIGNMENT_1G 0x001E0000
84 #define EFI_FVB2_ALIGNMENT_2G 0x001F0000
85 #define EFI_FVB2_WEAK_ALIGNMENT 0x80000000
86 
87 typedef struct {
88  ///
89  /// The number of sequential blocks which are of the same size.
90  ///
92  ///
93  /// The size of the blocks.
94  ///
97 
98 ///
99 /// Describes the features and layout of the firmware volume.
100 ///
101 typedef struct {
102  ///
103  /// The first 16 bytes are reserved to allow for the reset vector of
104  /// processors whose reset vector is at address 0.
105  ///
106  UINT8 ZeroVector[16];
107  ///
108  /// Declares the file system with which the firmware volume is formatted.
109  ///
111  ///
112  /// Length in bytes of the complete firmware volume, including the header.
113  ///
115  ///
116  /// Set to EFI_FVH_SIGNATURE
117  ///
119  ///
120  /// Declares capabilities and power-on defaults for the firmware volume.
121  ///
123  ///
124  /// Length in bytes of the complete firmware volume header.
125  ///
127  ///
128  /// A 16-bit checksum of the firmware volume header. A valid header sums to zero.
129  ///
131  ///
132  /// Offset, relative to the start of the header, of the extended header
133  /// (EFI_FIRMWARE_VOLUME_EXT_HEADER) or zero if there is no extended header.
134  ///
136  ///
137  /// This field must always be set to zero.
138  ///
140  ///
141  /// Set to 2. Future versions of this specification may define new header fields and will
142  /// increment the Revision field accordingly.
143  ///
145  ///
146  /// An array of run-length encoded FvBlockMapEntry structures. The array is
147  /// terminated with an entry of {0,0}.
148  ///
151 
152 #define EFI_FVH_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', 'H')
153 
154 ///
155 /// Firmware Volume Header Revision definition
156 ///
157 #define EFI_FVH_REVISION 0x02
158 
159 ///
160 /// Extension header pointed by ExtHeaderOffset of volume header.
161 ///
162 typedef struct {
163  ///
164  /// Firmware volume name.
165  ///
167  ///
168  /// Size of the rest of the extension header, including this structure.
169  ///
172 
173 ///
174 /// Entry struture for describing FV extension header
175 ///
176 typedef struct {
177  ///
178  /// Size of this header extension.
179  ///
181  ///
182  /// Type of the header.
183  ///
186 
187 #define EFI_FV_EXT_TYPE_OEM_TYPE 0x01
188 ///
189 /// This extension header provides a mapping between a GUID and an OEM file type.
190 ///
191 typedef struct {
192  ///
193  /// Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.
194  ///
196  ///
197  /// A bit mask, one bit for each file type between 0xC0 (bit 0) and 0xDF (bit 31). If a bit
198  /// is '1', then the GUID entry exists in Types. If a bit is '0' then no GUID entry exists in Types.
199  ///
201  ///
202  /// An array of GUIDs, each GUID representing an OEM file type.
203  ///
204  /// EFI_GUID Types[1];
205  ///
207 
208 #define EFI_FV_EXT_TYPE_GUID_TYPE 0x0002
209 
210 ///
211 /// This extension header EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE provides a vendor specific
212 /// GUID FormatType type which includes a length and a successive series of data bytes.
213 ///
214 typedef struct {
215  ///
216  /// Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.
217  ///
219  ///
220  /// Vendor-specific GUID.
221  ///
223  ///
224  /// An arry of bytes of length Length.
225  ///
226  /// UINT8 Data[1];
227  ///
229 
230 #define EFI_FV_EXT_TYPE_USED_SIZE_TYPE 0x03
231 
232 ///
233 /// The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find
234 /// out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV.
235 ///
236 typedef struct {
237  ///
238  /// Standard extension entry, with the type EFI_FV_EXT_TYPE_USED_SIZE_TYPE.
239  ///
241  ///
242  /// The number of bytes of the FV that are in uses. The remaining
243  /// EFI_FIRMWARE_VOLUME_HEADER FvLength minus UsedSize bytes in
244  /// the FV must contain the value implied by EFI_FVB2_ERASE_POLARITY.
245  ///
248 
249 #endif
Entry struture for describing FV extension header.
UINT16 Checksum
A 16-bit checksum of the firmware volume header.
128 bit buffer containing a unique identifier value.
Definition: Base.h:215
UINT32 UsedSize
The number of bytes of the FV that are in uses.
EFI_GUID FvName
Firmware volume name.
This extension header provides a mapping between a GUID and an OEM file type.
unsigned int UINT32
Definition: ProcessorBind.h:98
unsigned char UINT8
UINT32 Signature
Set to EFI_FVH_SIGNATURE.
EFI_GUID FormatType
Vendor-specific GUID.
UINT32 EFI_FV_FILE_ATTRIBUTES
EFI_FV_FILE_ATTRIBUTES.
FILE_LICENCE(BSD2_PATENT)
EFI_FVB_ATTRIBUTES_2 Attributes
Declares capabilities and power-on defaults for the firmware volume.
UINT16 HeaderLength
Length in bytes of the complete firmware volume header.
UINT32 NumBlocks
The number of sequential blocks which are of the same size.
UINT32 TypeMask
A bit mask, one bit for each file type between 0xC0 (bit 0) and 0xDF (bit 31).
UINT64 FvLength
Length in bytes of the complete firmware volume, including the header.
unsigned short UINT16
UINT8 Reserved
Must be zero.
Definition: Acpi30.h:50
This extension header EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE provides a vendor specific GUID FormatT...
UINT16 ExtHeaderOffset
Offset, relative to the start of the header, of the extended header (EFI_FIRMWARE_VOLUME_EXT_HEADER) ...
UINT32 EFI_FVB_ATTRIBUTES_2
type of EFI FVB attribute
UINT16 ExtEntrySize
Size of this header extension.
EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr
Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.
The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find out how many EFI_FVB2_ERASE_POLA...
unsigned long long UINT64
Definition: ProcessorBind.h:96
Extension header pointed by ExtHeaderOffset of volume header.
EFI_GUID FileSystemGuid
Declares the file system with which the firmware volume is formatted.
Describes the features and layout of the firmware volume.
UINT32 Length
The size of the blocks.
EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr
Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.
EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr
Standard extension entry, with the type EFI_FV_EXT_TYPE_USED_SIZE_TYPE.
UINT32 ExtHeaderSize
Size of the rest of the extension header, including this structure.
UINT16 ExtEntryType
Type of the header.