2 The firmware volume related definitions in PI.
4 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 @par Revision Reference:
18 #ifndef __PI_FIRMWAREVOLUME_H__
19 #define __PI_FIRMWAREVOLUME_H__
22 /// EFI_FV_FILE_ATTRIBUTES
24 typedef UINT32 EFI_FV_FILE_ATTRIBUTES
;
27 // Value of EFI_FV_FILE_ATTRIBUTES.
29 #define EFI_FV_FILE_ATTRIB_ALIGNMENT 0x0000001F
30 #define EFI_FV_FILE_ATTRIB_FIXED 0x00000100
31 #define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED 0x00000200
34 /// type of EFI FVB attribute
36 typedef UINT32 EFI_FVB_ATTRIBUTES_2
;
39 // Attributes bit definitions
41 #define EFI_FVB2_READ_DISABLED_CAP 0x00000001
42 #define EFI_FVB2_READ_ENABLED_CAP 0x00000002
43 #define EFI_FVB2_READ_STATUS 0x00000004
44 #define EFI_FVB2_WRITE_DISABLED_CAP 0x00000008
45 #define EFI_FVB2_WRITE_ENABLED_CAP 0x00000010
46 #define EFI_FVB2_WRITE_STATUS 0x00000020
47 #define EFI_FVB2_LOCK_CAP 0x00000040
48 #define EFI_FVB2_LOCK_STATUS 0x00000080
49 #define EFI_FVB2_STICKY_WRITE 0x00000200
50 #define EFI_FVB2_MEMORY_MAPPED 0x00000400
51 #define EFI_FVB2_ERASE_POLARITY 0x00000800
52 #define EFI_FVB2_READ_LOCK_CAP 0x00001000
53 #define EFI_FVB2_READ_LOCK_STATUS 0x00002000
54 #define EFI_FVB2_WRITE_LOCK_CAP 0x00004000
55 #define EFI_FVB2_WRITE_LOCK_STATUS 0x00008000
56 #define EFI_FVB2_ALIGNMENT 0x001F0000
57 #define EFI_FVB2_ALIGNMENT_1 0x00000000
58 #define EFI_FVB2_ALIGNMENT_2 0x00010000
59 #define EFI_FVB2_ALIGNMENT_4 0x00020000
60 #define EFI_FVB2_ALIGNMENT_8 0x00030000
61 #define EFI_FVB2_ALIGNMENT_16 0x00040000
62 #define EFI_FVB2_ALIGNMENT_32 0x00050000
63 #define EFI_FVB2_ALIGNMENT_64 0x00060000
64 #define EFI_FVB2_ALIGNMENT_128 0x00070000
65 #define EFI_FVB2_ALIGNMENT_256 0x00080000
66 #define EFI_FVB2_ALIGNMENT_512 0x00090000
67 #define EFI_FVB2_ALIGNMENT_1K 0x000A0000
68 #define EFI_FVB2_ALIGNMENT_2K 0x000B0000
69 #define EFI_FVB2_ALIGNMENT_4K 0x000C0000
70 #define EFI_FVB2_ALIGNMENT_8K 0x000D0000
71 #define EFI_FVB2_ALIGNMENT_16K 0x000E0000
72 #define EFI_FVB2_ALIGNMENT_32K 0x000F0000
73 #define EFI_FVB2_ALIGNMENT_64K 0x00100000
74 #define EFI_FVB2_ALIGNMENT_128K 0x00110000
75 #define EFI_FVB2_ALIGNMENT_256K 0x00120000
76 #define EFI_FVB2_ALIGNMENT_512K 0x00130000
77 #define EFI_FVB2_ALIGNMENT_1M 0x00140000
78 #define EFI_FVB2_ALIGNMENT_2M 0x00150000
79 #define EFI_FVB2_ALIGNMENT_4M 0x00160000
80 #define EFI_FVB2_ALIGNMENT_8M 0x00170000
81 #define EFI_FVB2_ALIGNMENT_16M 0x00180000
82 #define EFI_FVB2_ALIGNMENT_32M 0x00190000
83 #define EFI_FVB2_ALIGNMENT_64M 0x001A0000
84 #define EFI_FVB2_ALIGNMENT_128M 0x001B0000
85 #define EFI_FVB2_ALIGNMENT_256M 0x001C0000
86 #define EFI_FVB2_ALIGNMENT_512M 0x001D0000
87 #define EFI_FVB2_ALIGNMENT_1G 0x001E0000
88 #define EFI_FVB2_ALIGNMENT_2G 0x001F0000
89 #define EFI_FVB2_WEAK_ALIGNMENT 0x80000000
93 /// The number of sequential blocks which are of the same size.
97 /// The size of the blocks.
100 } EFI_FV_BLOCK_MAP_ENTRY
;
103 /// Describes the features and layout of the firmware volume.
107 /// The first 16 bytes are reserved to allow for the reset vector of
108 /// processors whose reset vector is at address 0.
110 UINT8 ZeroVector
[16];
112 /// Declares the file system with which the firmware volume is formatted.
114 EFI_GUID FileSystemGuid
;
116 /// Length in bytes of the complete firmware volume, including the header.
120 /// Set to EFI_FVH_SIGNATURE
124 /// Declares capabilities and power-on defaults for the firmware volume.
126 EFI_FVB_ATTRIBUTES_2 Attributes
;
128 /// Length in bytes of the complete firmware volume header.
132 /// A 16-bit checksum of the firmware volume header. A valid header sums to zero.
136 /// Offset, relative to the start of the header, of the extended header
137 /// (EFI_FIRMWARE_VOLUME_EXT_HEADER) or zero if there is no extended header.
139 UINT16 ExtHeaderOffset
;
141 /// This field must always be set to zero.
145 /// Set to 2. Future versions of this specification may define new header fields and will
146 /// increment the Revision field accordingly.
150 /// An array of run-length encoded FvBlockMapEntry structures. The array is
151 /// terminated with an entry of {0,0}.
153 EFI_FV_BLOCK_MAP_ENTRY BlockMap
[1];
154 } EFI_FIRMWARE_VOLUME_HEADER
;
156 #define EFI_FVH_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', 'H')
159 /// Firmware Volume Header Revision definition
161 #define EFI_FVH_REVISION 0x02
164 /// Extension header pointed by ExtHeaderOffset of volume header.
168 /// Firmware volume name.
172 /// Size of the rest of the extension header, including this structure.
174 UINT32 ExtHeaderSize
;
175 } EFI_FIRMWARE_VOLUME_EXT_HEADER
;
178 /// Entry struture for describing FV extension header
182 /// Size of this header extension.
186 /// Type of the header.
189 } EFI_FIRMWARE_VOLUME_EXT_ENTRY
;
191 #define EFI_FV_EXT_TYPE_OEM_TYPE 0x01
193 /// This extension header provides a mapping between a GUID and an OEM file type.
197 /// Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.
199 EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr
;
201 /// A bit mask, one bit for each file type between 0xC0 (bit 0) and 0xDF (bit 31). If a bit
202 /// is '1', then the GUID entry exists in Types. If a bit is '0' then no GUID entry exists in Types.
206 /// An array of GUIDs, each GUID representing an OEM file type.
208 /// EFI_GUID Types[1];
210 } EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE
;
212 #define EFI_FV_EXT_TYPE_GUID_TYPE 0x0002
215 /// This extension header EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE provides a vendor specific
216 /// GUID FormatType type which includes a length and a successive series of data bytes.
220 /// Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.
222 EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr
;
224 /// Vendor-specific GUID.
228 /// An arry of bytes of length Length.
232 } EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE
;
234 #define EFI_FV_EXT_TYPE_USED_SIZE_TYPE 0x03
237 /// The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find
238 /// out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV.
242 /// Standard extension entry, with the type EFI_FV_EXT_TYPE_USED_SIZE_TYPE.
244 EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr
;
246 /// The number of bytes of the FV that are in uses. The remaining
247 /// EFI_FIRMWARE_VOLUME_HEADER FvLength minus UsedSize bytes in
248 /// the FV must contain the value implied by EFI_FVB2_ERASE_POLARITY.
251 } EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE
;