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