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