]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Pi/PiFirmwareFile.h
Add missing status code definitions.
[mirror_edk2.git] / MdePkg / Include / Pi / PiFirmwareFile.h
... / ...
CommitLineData
1/** @file\r
2 The firmware file related definitions in PI.\r
3\r
4 Copyright (c) 2006 - 2009, Intel Corporation \r
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
13 @par Revision Reference:\r
14 PI Version 1.0\r
15\r
16**/\r
17\r
18\r
19#ifndef __PI_FIRMWARE_FILE_H__\r
20#define __PI_FIRMWARE_FILE_H__\r
21\r
22#pragma pack(1)\r
23///\r
24/// Used to verify the integrity of the file.\r
25/// \r
26typedef union {\r
27 struct {\r
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
33 UINT8 Header;\r
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
44 UINT8 File;\r
45 } Checksum;\r
46 ///\r
47 /// This is the full 16 bits of the IntegrityCheck field.\r
48 ///\r
49 UINT16 Checksum16;\r
50} EFI_FFS_INTEGRITY_CHECK;\r
51\r
52typedef UINT8 EFI_FV_FILETYPE;\r
53typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;\r
54typedef UINT8 EFI_FFS_FILE_STATE;\r
55\r
56///\r
57/// File Types Definitions\r
58/// \r
59#define EFI_FV_FILETYPE_ALL 0x00\r
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
77/// \r
78/// FFS File Attributes.\r
79/// \r
80#define FFS_ATTRIB_FIXED 0x04\r
81#define FFS_ATTRIB_DATA_ALIGNMENT 0x38\r
82#define FFS_ATTRIB_CHECKSUM 0x40\r
83\r
84/// \r
85/// FFS File State Bits.\r
86/// \r
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
95///\r
96/// Each file begins with the header that describe the \r
97/// contents and state of the files.\r
98/// \r
99typedef struct {\r
100 ///\r
101 /// This GUID is the file name. It is used to uniquely identify the file.\r
102 ///\r
103 EFI_GUID Name;\r
104 ///\r
105 /// Used to verify the integrity of the file.\r
106 ///\r
107 EFI_FFS_INTEGRITY_CHECK IntegrityCheck;\r
108 ///\r
109 /// Identifies the type of file.\r
110 ///\r
111 EFI_FV_FILETYPE Type;\r
112 ///\r
113 /// Declares various file attribute bits.\r
114 ///\r
115 EFI_FFS_FILE_ATTRIBUTES Attributes;\r
116 ///\r
117 /// The length of the file in bytes, including the FFS header.\r
118 ///\r
119 UINT8 Size[3];\r
120 ///\r
121 /// Used to track the state of the file throughout the life of the file from creation to deletion.\r
122 ///\r
123 EFI_FFS_FILE_STATE State;\r
124} EFI_FFS_FILE_HEADER;\r
125\r
126\r
127typedef UINT8 EFI_SECTION_TYPE;\r
128\r
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
134#define EFI_SECTION_ALL 0x00\r
135\r
136///\r
137/// Encapsulation section Type values\r
138///\r
139#define EFI_SECTION_COMPRESSION 0x01\r
140\r
141#define EFI_SECTION_GUID_DEFINED 0x02\r
142\r
143///\r
144/// Leaf section Type values\r
145///\r
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
158///\r
159/// Common section header\r
160/// \r
161typedef struct {\r
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
166 UINT8 Size[3];\r
167 EFI_SECTION_TYPE Type;\r
168 ///\r
169 /// Declares the section type.\r
170 ///\r
171} EFI_COMMON_SECTION_HEADER;\r
172\r
173///\r
174/// Leaf section type that contains an \r
175/// IA-32 16-bit executable image.\r
176/// \r
177typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;\r
178\r
179///\r
180/// CompressionType of EFI_COMPRESSION_SECTION.\r
181/// \r
182#define EFI_NOT_COMPRESSED 0x00\r
183#define EFI_STANDARD_COMPRESSION 0x01\r
184///\r
185/// An encapsulation section type in which the \r
186/// section data is compressed.\r
187/// \r
188typedef struct {\r
189 ///\r
190 /// Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION.\r
191 ///\r
192 EFI_COMMON_SECTION_HEADER CommonHeader;\r
193 ///\r
194 /// UINT32 that indicates the size of the section data after decompression.\r
195 ///\r
196 UINT32 UncompressedLength;\r
197 ///\r
198 /// Indicates which compression algorithm is used.\r
199 ///\r
200 UINT8 CompressionType;\r
201} EFI_COMPRESSION_SECTION;\r
202\r
203///\r
204/// An encapsulation section type in which the section data is disposable.\r
205/// A disposable section is an encapsulation section in which the section data may be disposed of during\r
206/// the process of creating or updating a firmware image without significant impact on the usefulness of\r
207/// the file. The Type field in the section header is set to EFI_SECTION_DISPOSABLE. This\r
208/// allows optional or descriptive data to be included with the firmware file which can be removed in\r
209/// order to conserve space. The contents of this section are implementation specific, but might contain\r
210/// debug data or detailed integration instructions.\r
211///\r
212typedef EFI_COMMON_SECTION_HEADER EFI_DISPOSABLE_SECTION;\r
213\r
214///\r
215/// Leaf section which could be used to determine the dispatch order of DXEs.\r
216/// \r
217typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;\r
218\r
219///\r
220/// Leaf section which contains a PI FV.\r
221/// \r
222typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;\r
223\r
224///\r
225/// Leaf section which contains a single GUID.\r
226/// \r
227typedef struct {\r
228 ///\r
229 /// Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID.\r
230 ///\r
231 EFI_COMMON_SECTION_HEADER CommonHeader;\r
232 ///\r
233 /// This GUID is defined by the creator of the file. It is a vendor-defined file type.\r
234 ///\r
235 EFI_GUID SubTypeGuid;\r
236} EFI_FREEFORM_SUBTYPE_GUID_SECTION;\r
237\r
238///\r
239/// Attributes of EFI_GUID_DEFINED_SECTION\r
240/// \r
241#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01\r
242#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02\r
243///\r
244/// Leaf section which is encapsulation defined by specific GUID\r
245/// \r
246typedef struct {\r
247 ///\r
248 /// Common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED.\r
249 ///\r
250 EFI_COMMON_SECTION_HEADER CommonHeader;\r
251 ///\r
252 /// GUID that defines the format of the data that follows. It is a vendor-defined section type.\r
253 ///\r
254 EFI_GUID SectionDefinitionGuid;\r
255 ///\r
256 /// Contains the offset in bytes from the beginning of the common header to the first byte of the data.\r
257 ///\r
258 UINT16 DataOffset;\r
259 ///\r
260 /// Bit field that declares some specific characteristics of the section contents.\r
261 ///\r
262 UINT16 Attributes;\r
263} EFI_GUID_DEFINED_SECTION;\r
264\r
265///\r
266/// Leaf section which contains PE32+ image.\r
267/// \r
268typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;\r
269\r
270\r
271///\r
272/// Leaf section which used to determine the dispatch order of PEIMs.\r
273/// \r
274typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;\r
275\r
276///\r
277/// Leaf section which constains the position-independent-code image.\r
278/// \r
279typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;\r
280\r
281///\r
282/// Leaf section which contains an array of zero or more bytes.\r
283/// \r
284typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;\r
285\r
286///\r
287/// Leaf section which contains a unicode string that \r
288/// is human readable file name.\r
289/// \r
290typedef struct {\r
291 EFI_COMMON_SECTION_HEADER CommonHeader;\r
292\r
293 ///\r
294 /// Array of unicode string.\r
295 /// \r
296 CHAR16 FileNameString[1];\r
297} EFI_USER_INTERFACE_SECTION;\r
298\r
299\r
300///\r
301/// Leaf section which contains a numeric build number and\r
302/// an optional unicode string that represents the file revision. \r
303/// \r
304typedef struct {\r
305 EFI_COMMON_SECTION_HEADER CommonHeader;\r
306 UINT16 BuildNumber;\r
307\r
308 ///\r
309 /// Array of unicode string.\r
310 /// \r
311 CHAR16 VersionString[1];\r
312} EFI_VERSION_SECTION;\r
313\r
314\r
315#define SECTION_SIZE(SectionHeaderPtr) \\r
316 ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))\r
317\r
318#pragma pack()\r
319\r
320#endif\r
321\r