]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Pi/PiFirmwareFile.h
Add EFI_DISPOSABLE_SECTION type defined in PI 1.2 specification.
[mirror_edk2.git] / MdePkg / Include / Pi / PiFirmwareFile.h
CommitLineData
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 26typedef 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
52typedef UINT8 EFI_FV_FILETYPE;\r
53typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;\r
54typedef 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 99typedef 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
127typedef 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 161typedef 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 177typedef 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 188typedef 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
73d622ed 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
dc53faa3 214///\r
215/// Leaf section which could be used to determine the dispatch order of DXEs.\r
216/// \r
959ccb23 217typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;\r
218\r
dc53faa3 219///\r
4b503a77 220/// Leaf section which contains a PI FV.\r
dc53faa3 221/// \r
959ccb23 222typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;\r
223\r
dc53faa3 224///\r
225/// Leaf section which contains a single GUID.\r
226/// \r
959ccb23 227typedef struct {\r
1bf79370
LG
228 ///\r
229 /// Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID.\r
230 ///\r
00edb218 231 EFI_COMMON_SECTION_HEADER CommonHeader;\r
1bf79370
LG
232 ///\r
233 /// This GUID is defined by the creator of the file. It is a vendor-defined file type.\r
234 ///\r
00edb218 235 EFI_GUID SubTypeGuid;\r
959ccb23 236} EFI_FREEFORM_SUBTYPE_GUID_SECTION;\r
237\r
dc53faa3 238///\r
239/// Attributes of EFI_GUID_DEFINED_SECTION\r
240/// \r
959ccb23 241#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01\r
242#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02\r
dc53faa3 243///\r
244/// Leaf section which is encapsulation defined by specific GUID\r
245/// \r
959ccb23 246typedef struct {\r
1bf79370
LG
247 ///\r
248 /// Common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED.\r
249 ///\r
00edb218 250 EFI_COMMON_SECTION_HEADER CommonHeader;\r
1bf79370
LG
251 ///\r
252 /// GUID that defines the format of the data that follows. It is a vendor-defined section type.\r
253 ///\r
00edb218 254 EFI_GUID SectionDefinitionGuid;\r
1bf79370
LG
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
00edb218 258 UINT16 DataOffset;\r
1bf79370
LG
259 ///\r
260 /// Bit field that declares some specific characteristics of the section contents.\r
261 ///\r
00edb218 262 UINT16 Attributes;\r
959ccb23 263} EFI_GUID_DEFINED_SECTION;\r
264\r
dc53faa3 265///\r
266/// Leaf section which contains PE32+ image.\r
267/// \r
959ccb23 268typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;\r
269\r
270\r
dc53faa3 271///\r
272/// Leaf section which used to determine the dispatch order of PEIMs.\r
273/// \r
959ccb23 274typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;\r
275\r
dc53faa3 276///\r
277/// Leaf section which constains the position-independent-code image.\r
278/// \r
959ccb23 279typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;\r
280\r
dc53faa3 281///\r
282/// Leaf section which contains an array of zero or more bytes.\r
283/// \r
959ccb23 284typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;\r
285\r
dc53faa3 286///\r
287/// Leaf section which contains a unicode string that \r
288/// is human readable file name.\r
289/// \r
959ccb23 290typedef struct {\r
00edb218 291 EFI_COMMON_SECTION_HEADER CommonHeader;\r
959ccb23 292\r
dc53faa3 293 ///\r
294 /// Array of unicode string.\r
295 /// \r
00edb218 296 CHAR16 FileNameString[1];\r
959ccb23 297} EFI_USER_INTERFACE_SECTION;\r
298\r
299\r
dc53faa3 300///\r
301/// Leaf section which contains a numeric build number and\r
4b503a77 302/// an optional unicode string that represents the file revision. \r
dc53faa3 303/// \r
959ccb23 304typedef struct {\r
00edb218
A
305 EFI_COMMON_SECTION_HEADER CommonHeader;\r
306 UINT16 BuildNumber;\r
7b1bf9f6 307\r
308 ///\r
309 /// Array of unicode string.\r
310 /// \r
00edb218 311 CHAR16 VersionString[1];\r
959ccb23 312} EFI_VERSION_SECTION;\r
313\r
ddd3f471 314\r
315#define SECTION_SIZE(SectionHeaderPtr) \\r
316 ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))\r
317\r
62d1e08b 318#pragma pack()\r
ddd3f471 319\r
959ccb23 320#endif\r
321\r