]>
Commit | Line | Data |
---|---|---|
959ccb23 | 1 | /** @file\r |
2 | The firmware file related definitions in PI.\r | |
3 | \r | |
d7dfd027 | 4 | Copyright (c) 2006 - 2009, Intel Corporation \r |
959ccb23 | 5 | All rights reserved. This program and the accompanying materials \r |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
12 | \r | |
959ccb23 | 13 | @par Revision Reference:\r |
0047820e | 14 | PI Version 1.0\r |
959ccb23 | 15 | \r |
16 | **/\r | |
17 | \r | |
0b3cac32 | 18 | \r |
959ccb23 | 19 | #ifndef __PI_FIRMWARE_FILE_H__\r |
20 | #define __PI_FIRMWARE_FILE_H__\r | |
21 | \r | |
62d1e08b | 22 | #pragma pack(1)\r |
dc53faa3 | 23 | ///\r |
24 | /// Used to verify the integrity of the file.\r | |
25 | /// \r | |
959ccb23 | 26 | typedef union {\r |
27 | struct {\r | |
1bf79370 LG |
28 | ///\r |
29 | /// The IntegrityCheck.Checksum.Header field is an 8-bit checksum of the file\r | |
30 | /// header. The State and IntegrityCheck.Checksum.File fields are assumed\r | |
31 | /// to be zero and the checksum is calculated such that the entire header sums to zero.\r | |
32 | ///\r | |
959ccb23 | 33 | UINT8 Header;\r |
1bf79370 LG |
34 | ///\r |
35 | /// If the FFS_ATTRIB_CHECKSUM (see definition below) bit of the Attributes\r | |
36 | /// field is set to one, the IntegrityCheck.Checksum.File field is an 8-bit\r | |
37 | /// checksum of the entire file The State field and the file tail are assumed to be zero\r | |
38 | /// and the checksum is calculated such that the entire file sums to zero.\r | |
39 | /// If the FFS_ATTRIB_CHECKSUM bit of the Attributes field is cleared to zero,\r | |
40 | /// the IntegrityCheck.Checksum.File field must be initialized with a value of\r | |
41 | /// 0x55AA. The IntegrityCheck.Checksum.File field is valid any time the\r | |
42 | /// EFI_FILE_DATA_VALID bit is set in the State field.\r | |
43 | ///\r | |
959ccb23 | 44 | UINT8 File;\r |
45 | } Checksum;\r | |
1bf79370 LG |
46 | ///\r |
47 | /// This is the full 16 bits of the IntegrityCheck field.\r | |
48 | ///\r | |
959ccb23 | 49 | UINT16 Checksum16;\r |
50 | } EFI_FFS_INTEGRITY_CHECK;\r | |
51 | \r | |
52 | typedef UINT8 EFI_FV_FILETYPE;\r | |
53 | typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;\r | |
54 | typedef UINT8 EFI_FFS_FILE_STATE;\r | |
55 | \r | |
dc53faa3 | 56 | ///\r |
57 | /// File Types Definitions\r | |
58 | /// \r | |
d44d2087 | 59 | #define EFI_FV_FILETYPE_ALL 0x00\r |
8fb30482 | 60 | #define EFI_FV_FILETYPE_RAW 0x01\r |
61 | #define EFI_FV_FILETYPE_FREEFORM 0x02\r | |
62 | #define EFI_FV_FILETYPE_SECURITY_CORE 0x03\r | |
63 | #define EFI_FV_FILETYPE_PEI_CORE 0x04\r | |
64 | #define EFI_FV_FILETYPE_DXE_CORE 0x05\r | |
65 | #define EFI_FV_FILETYPE_PEIM 0x06\r | |
66 | #define EFI_FV_FILETYPE_DRIVER 0x07\r | |
67 | #define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08\r | |
68 | #define EFI_FV_FILETYPE_APPLICATION 0x09\r | |
69 | #define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B\r | |
70 | #define EFI_FV_FILETYPE_OEM_MIN 0xc0\r | |
71 | #define EFI_FV_FILETYPE_OEM_MAX 0xdf\r | |
72 | #define EFI_FV_FILETYPE_DEBUG_MIN 0xe0\r | |
73 | #define EFI_FV_FILETYPE_DEBUG_MAX 0xef\r | |
74 | #define EFI_FV_FILETYPE_FFS_MIN 0xf0\r | |
75 | #define EFI_FV_FILETYPE_FFS_MAX 0xff\r | |
76 | #define EFI_FV_FILETYPE_FFS_PAD 0xf0\r | |
dc53faa3 | 77 | /// \r |
78 | /// FFS File Attributes.\r | |
79 | /// \r | |
959ccb23 | 80 | #define FFS_ATTRIB_FIXED 0x04\r |
81 | #define FFS_ATTRIB_DATA_ALIGNMENT 0x38\r | |
82 | #define FFS_ATTRIB_CHECKSUM 0x40\r | |
83 | \r | |
dc53faa3 | 84 | /// \r |
85 | /// FFS File State Bits.\r | |
86 | /// \r | |
959ccb23 | 87 | #define EFI_FILE_HEADER_CONSTRUCTION 0x01\r |
88 | #define EFI_FILE_HEADER_VALID 0x02\r | |
89 | #define EFI_FILE_DATA_VALID 0x04\r | |
90 | #define EFI_FILE_MARKED_FOR_UPDATE 0x08\r | |
91 | #define EFI_FILE_DELETED 0x10\r | |
92 | #define EFI_FILE_HEADER_INVALID 0x20\r | |
93 | \r | |
94 | \r | |
dc53faa3 | 95 | ///\r |
96 | /// Each file begins with the header that describe the \r | |
97 | /// contents and state of the files.\r | |
98 | /// \r | |
959ccb23 | 99 | typedef struct {\r |
1bf79370 LG |
100 | ///\r |
101 | /// This GUID is the file name. It is used to uniquely identify the file.\r | |
102 | ///\r | |
959ccb23 | 103 | EFI_GUID Name;\r |
1bf79370 LG |
104 | ///\r |
105 | /// Used to verify the integrity of the file.\r | |
106 | ///\r | |
959ccb23 | 107 | EFI_FFS_INTEGRITY_CHECK IntegrityCheck;\r |
1bf79370 LG |
108 | ///\r |
109 | /// Identifies the type of file.\r | |
110 | ///\r | |
959ccb23 | 111 | EFI_FV_FILETYPE Type;\r |
1bf79370 LG |
112 | ///\r |
113 | /// Declares various file attribute bits.\r | |
114 | ///\r | |
959ccb23 | 115 | EFI_FFS_FILE_ATTRIBUTES Attributes;\r |
1bf79370 LG |
116 | ///\r |
117 | /// The length of the file in bytes, including the FFS header.\r | |
118 | ///\r | |
959ccb23 | 119 | UINT8 Size[3];\r |
1bf79370 LG |
120 | ///\r |
121 | /// Used to track the state of the file throughout the life of the file from creation to deletion.\r | |
122 | ///\r | |
959ccb23 | 123 | EFI_FFS_FILE_STATE State;\r |
124 | } EFI_FFS_FILE_HEADER;\r | |
125 | \r | |
126 | \r | |
127 | typedef UINT8 EFI_SECTION_TYPE;\r | |
128 | \r | |
dc53faa3 | 129 | ///\r |
130 | /// Pseudo type. It is\r | |
131 | /// used as a wild card when retrieving sections. The section\r | |
132 | /// type EFI_SECTION_ALL matches all section types.\r | |
133 | ///\r | |
959ccb23 | 134 | #define EFI_SECTION_ALL 0x00\r |
135 | \r | |
dc53faa3 | 136 | ///\r |
137 | /// Encapsulation section Type values\r | |
138 | ///\r | |
959ccb23 | 139 | #define EFI_SECTION_COMPRESSION 0x01\r |
140 | \r | |
141 | #define EFI_SECTION_GUID_DEFINED 0x02\r | |
142 | \r | |
dc53faa3 | 143 | ///\r |
144 | /// Leaf section Type values\r | |
145 | ///\r | |
959ccb23 | 146 | #define EFI_SECTION_PE32 0x10\r |
147 | #define EFI_SECTION_PIC 0x11\r | |
148 | #define EFI_SECTION_TE 0x12\r | |
149 | #define EFI_SECTION_DXE_DEPEX 0x13\r | |
150 | #define EFI_SECTION_VERSION 0x14\r | |
151 | #define EFI_SECTION_USER_INTERFACE 0x15\r | |
152 | #define EFI_SECTION_COMPATIBILITY16 0x16\r | |
153 | #define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17\r | |
154 | #define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18\r | |
155 | #define EFI_SECTION_RAW 0x19\r | |
156 | #define EFI_SECTION_PEI_DEPEX 0x1B\r | |
157 | \r | |
dc53faa3 | 158 | ///\r |
159 | /// Common section header\r | |
160 | /// \r | |
959ccb23 | 161 | typedef struct {\r |
1bf79370 LG |
162 | ///\r |
163 | /// A 24-bit unsigned integer that contains the total size of the section in bytes, \r | |
164 | /// including the EFI_COMMON_SECTION_HEADER.\r | |
165 | ///\r | |
959ccb23 | 166 | UINT8 Size[3];\r |
167 | EFI_SECTION_TYPE Type;\r | |
1bf79370 LG |
168 | ///\r |
169 | /// Declares the section type.\r | |
170 | ///\r | |
959ccb23 | 171 | } EFI_COMMON_SECTION_HEADER;\r |
172 | \r | |
dc53faa3 | 173 | ///\r |
174 | /// Leaf section type that contains an \r | |
175 | /// IA-32 16-bit executable image.\r | |
176 | /// \r | |
959ccb23 | 177 | typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;\r |
178 | \r | |
dc53faa3 | 179 | ///\r |
180 | /// CompressionType of EFI_COMPRESSION_SECTION.\r | |
181 | /// \r | |
959ccb23 | 182 | #define EFI_NOT_COMPRESSED 0x00\r |
183 | #define EFI_STANDARD_COMPRESSION 0x01\r | |
dc53faa3 | 184 | ///\r |
185 | /// An encapsulation section type in which the \r | |
186 | /// section data is compressed.\r | |
187 | /// \r | |
959ccb23 | 188 | typedef struct {\r |
1bf79370 LG |
189 | ///\r |
190 | /// Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION.\r | |
191 | ///\r | |
00edb218 | 192 | EFI_COMMON_SECTION_HEADER CommonHeader;\r |
1bf79370 LG |
193 | ///\r |
194 | /// UINT32 that indicates the size of the section data after decompression.\r | |
195 | ///\r | |
00edb218 | 196 | UINT32 UncompressedLength;\r |
1bf79370 LG |
197 | ///\r |
198 | /// Indicates which compression algorithm is used.\r | |
199 | ///\r | |
00edb218 | 200 | UINT8 CompressionType;\r |
959ccb23 | 201 | } EFI_COMPRESSION_SECTION;\r |
202 | \r | |
dc53faa3 | 203 | ///\r |
204 | /// Leaf section which could be used to determine the dispatch order of DXEs.\r | |
205 | /// \r | |
959ccb23 | 206 | typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;\r |
207 | \r | |
dc53faa3 | 208 | ///\r |
4b503a77 | 209 | /// Leaf section which contains a PI FV.\r |
dc53faa3 | 210 | /// \r |
959ccb23 | 211 | typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;\r |
212 | \r | |
dc53faa3 | 213 | ///\r |
214 | /// Leaf section which contains a single GUID.\r | |
215 | /// \r | |
959ccb23 | 216 | typedef struct {\r |
1bf79370 LG |
217 | ///\r |
218 | /// Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID.\r | |
219 | ///\r | |
00edb218 | 220 | EFI_COMMON_SECTION_HEADER CommonHeader;\r |
1bf79370 LG |
221 | ///\r |
222 | /// This GUID is defined by the creator of the file. It is a vendor-defined file type.\r | |
223 | ///\r | |
00edb218 | 224 | EFI_GUID SubTypeGuid;\r |
959ccb23 | 225 | } EFI_FREEFORM_SUBTYPE_GUID_SECTION;\r |
226 | \r | |
dc53faa3 | 227 | ///\r |
228 | /// Attributes of EFI_GUID_DEFINED_SECTION\r | |
229 | /// \r | |
959ccb23 | 230 | #define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01\r |
231 | #define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02\r | |
dc53faa3 | 232 | ///\r |
233 | /// Leaf section which is encapsulation defined by specific GUID\r | |
234 | /// \r | |
959ccb23 | 235 | typedef struct {\r |
1bf79370 LG |
236 | ///\r |
237 | /// Common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED.\r | |
238 | ///\r | |
00edb218 | 239 | EFI_COMMON_SECTION_HEADER CommonHeader;\r |
1bf79370 LG |
240 | ///\r |
241 | /// GUID that defines the format of the data that follows. It is a vendor-defined section type.\r | |
242 | ///\r | |
00edb218 | 243 | EFI_GUID SectionDefinitionGuid;\r |
1bf79370 LG |
244 | ///\r |
245 | /// Contains the offset in bytes from the beginning of the common header to the first byte of the data.\r | |
246 | ///\r | |
00edb218 | 247 | UINT16 DataOffset;\r |
1bf79370 LG |
248 | ///\r |
249 | /// Bit field that declares some specific characteristics of the section contents.\r | |
250 | ///\r | |
00edb218 | 251 | UINT16 Attributes;\r |
959ccb23 | 252 | } EFI_GUID_DEFINED_SECTION;\r |
253 | \r | |
dc53faa3 | 254 | ///\r |
255 | /// Leaf section which contains PE32+ image.\r | |
256 | /// \r | |
959ccb23 | 257 | typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;\r |
258 | \r | |
259 | \r | |
dc53faa3 | 260 | ///\r |
261 | /// Leaf section which used to determine the dispatch order of PEIMs.\r | |
262 | /// \r | |
959ccb23 | 263 | typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;\r |
264 | \r | |
dc53faa3 | 265 | ///\r |
266 | /// Leaf section which constains the position-independent-code image.\r | |
267 | /// \r | |
959ccb23 | 268 | typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;\r |
269 | \r | |
dc53faa3 | 270 | ///\r |
271 | /// Leaf section which contains an array of zero or more bytes.\r | |
272 | /// \r | |
959ccb23 | 273 | typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;\r |
274 | \r | |
dc53faa3 | 275 | ///\r |
276 | /// Leaf section which contains a unicode string that \r | |
277 | /// is human readable file name.\r | |
278 | /// \r | |
959ccb23 | 279 | typedef struct {\r |
00edb218 | 280 | EFI_COMMON_SECTION_HEADER CommonHeader;\r |
959ccb23 | 281 | \r |
dc53faa3 | 282 | ///\r |
283 | /// Array of unicode string.\r | |
284 | /// \r | |
00edb218 | 285 | CHAR16 FileNameString[1];\r |
959ccb23 | 286 | } EFI_USER_INTERFACE_SECTION;\r |
287 | \r | |
288 | \r | |
dc53faa3 | 289 | ///\r |
290 | /// Leaf section which contains a numeric build number and\r | |
4b503a77 | 291 | /// an optional unicode string that represents the file revision. \r |
dc53faa3 | 292 | /// \r |
959ccb23 | 293 | typedef struct {\r |
00edb218 A |
294 | EFI_COMMON_SECTION_HEADER CommonHeader;\r |
295 | UINT16 BuildNumber;\r | |
7b1bf9f6 | 296 | \r |
297 | ///\r | |
298 | /// Array of unicode string.\r | |
299 | /// \r | |
00edb218 | 300 | CHAR16 VersionString[1];\r |
959ccb23 | 301 | } EFI_VERSION_SECTION;\r |
302 | \r | |
ddd3f471 | 303 | \r |
304 | #define SECTION_SIZE(SectionHeaderPtr) \\r | |
305 | ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))\r | |
306 | \r | |
62d1e08b | 307 | #pragma pack()\r |
ddd3f471 | 308 | \r |
959ccb23 | 309 | #endif\r |
310 | \r |