]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Pi/PiFirmwareFile.h
Add comments for enumeration, structure data members those are referred by UefiServic...
[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 - 2008, 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#include <ProcessorBind.h>\r
23\r
24#pragma pack(1)\r
25///\r
26/// Used to verify the integrity of the file.\r
27/// \r
28typedef union {\r
29 struct {\r
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
35 UINT8 Header;\r
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
46 UINT8 File;\r
47 } Checksum;\r
48 ///\r
49 /// This is the full 16 bits of the IntegrityCheck field.\r
50 ///\r
51 UINT16 Checksum16;\r
52} EFI_FFS_INTEGRITY_CHECK;\r
53\r
54typedef UINT8 EFI_FV_FILETYPE;\r
55typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;\r
56typedef UINT8 EFI_FFS_FILE_STATE;\r
57\r
58///\r
59/// File Types Definitions\r
60/// \r
61#define EFI_FV_FILETYPE_ALL 0x00\r
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
79/// \r
80/// FFS File Attributes.\r
81/// \r
82#define FFS_ATTRIB_FIXED 0x04\r
83#define FFS_ATTRIB_DATA_ALIGNMENT 0x38\r
84#define FFS_ATTRIB_CHECKSUM 0x40\r
85\r
86/// \r
87/// FFS File State Bits.\r
88/// \r
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
97///\r
98/// Each file begins with the header that describe the \r
99/// contents and state of the files.\r
100/// \r
101typedef struct {\r
102 ///\r
103 /// This GUID is the file name. It is used to uniquely identify the file.\r
104 ///\r
105 EFI_GUID Name;\r
106 ///\r
107 /// Used to verify the integrity of the file.\r
108 ///\r
109 EFI_FFS_INTEGRITY_CHECK IntegrityCheck;\r
110 ///\r
111 /// Identifies the type of file.\r
112 ///\r
113 EFI_FV_FILETYPE Type;\r
114 ///\r
115 /// Declares various file attribute bits.\r
116 ///\r
117 EFI_FFS_FILE_ATTRIBUTES Attributes;\r
118 ///\r
119 /// The length of the file in bytes, including the FFS header.\r
120 ///\r
121 UINT8 Size[3];\r
122 ///\r
123 /// Used to track the state of the file throughout the life of the file from creation to deletion.\r
124 ///\r
125 EFI_FFS_FILE_STATE State;\r
126} EFI_FFS_FILE_HEADER;\r
127\r
128\r
129typedef UINT8 EFI_SECTION_TYPE;\r
130\r
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
136#define EFI_SECTION_ALL 0x00\r
137\r
138///\r
139/// Encapsulation section Type values\r
140///\r
141#define EFI_SECTION_COMPRESSION 0x01\r
142\r
143#define EFI_SECTION_GUID_DEFINED 0x02\r
144\r
145///\r
146/// Leaf section Type values\r
147///\r
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
160///\r
161/// Common section header\r
162/// \r
163typedef struct {\r
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
168 UINT8 Size[3];\r
169 EFI_SECTION_TYPE Type;\r
170 ///\r
171 /// Declares the section type.\r
172 ///\r
173} EFI_COMMON_SECTION_HEADER;\r
174\r
175///\r
176/// Leaf section type that contains an \r
177/// IA-32 16-bit executable image.\r
178/// \r
179typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;\r
180\r
181///\r
182/// CompressionType of EFI_COMPRESSION_SECTION.\r
183/// \r
184#define EFI_NOT_COMPRESSED 0x00\r
185#define EFI_STANDARD_COMPRESSION 0x01\r
186///\r
187/// An encapsulation section type in which the \r
188/// section data is compressed.\r
189/// \r
190typedef struct {\r
191 ///\r
192 /// Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION.\r
193 ///\r
194 EFI_COMMON_SECTION_HEADER CommonHeader;\r
195 ///\r
196 /// UINT32 that indicates the size of the section data after decompression.\r
197 ///\r
198 UINT32 UncompressedLength;\r
199 ///\r
200 /// Indicates which compression algorithm is used.\r
201 ///\r
202 UINT8 CompressionType;\r
203} EFI_COMPRESSION_SECTION;\r
204\r
205///\r
206/// Leaf section which could be used to determine the dispatch order of DXEs.\r
207/// \r
208typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;\r
209\r
210///\r
211/// Leaf section which contains a PI FV.\r
212/// \r
213typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;\r
214\r
215///\r
216/// Leaf section which contains a single GUID.\r
217/// \r
218typedef struct {\r
219 ///\r
220 /// Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID.\r
221 ///\r
222 EFI_COMMON_SECTION_HEADER CommonHeader;\r
223 ///\r
224 /// This GUID is defined by the creator of the file. It is a vendor-defined file type.\r
225 ///\r
226 EFI_GUID SubTypeGuid;\r
227} EFI_FREEFORM_SUBTYPE_GUID_SECTION;\r
228\r
229///\r
230/// Attributes of EFI_GUID_DEFINED_SECTION\r
231/// \r
232#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01\r
233#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02\r
234///\r
235/// Leaf section which is encapsulation defined by specific GUID\r
236/// \r
237typedef struct {\r
238 ///\r
239 /// Common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED.\r
240 ///\r
241 EFI_COMMON_SECTION_HEADER CommonHeader;\r
242 ///\r
243 /// GUID that defines the format of the data that follows. It is a vendor-defined section type.\r
244 ///\r
245 EFI_GUID SectionDefinitionGuid;\r
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
249 UINT16 DataOffset;\r
250 ///\r
251 /// Bit field that declares some specific characteristics of the section contents.\r
252 ///\r
253 UINT16 Attributes;\r
254} EFI_GUID_DEFINED_SECTION;\r
255\r
256///\r
257/// Leaf section which contains PE32+ image.\r
258/// \r
259typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;\r
260\r
261\r
262///\r
263/// Leaf section which used to determine the dispatch order of PEIMs.\r
264/// \r
265typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;\r
266\r
267///\r
268/// Leaf section which constains the position-independent-code image.\r
269/// \r
270typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;\r
271\r
272///\r
273/// Leaf section which contains an array of zero or more bytes.\r
274/// \r
275typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;\r
276\r
277///\r
278/// Leaf section which contains a unicode string that \r
279/// is human readable file name.\r
280/// \r
281typedef struct {\r
282 EFI_COMMON_SECTION_HEADER CommonHeader;\r
283\r
284 ///\r
285 /// Array of unicode string.\r
286 /// \r
287 CHAR16 FileNameString[1];\r
288} EFI_USER_INTERFACE_SECTION;\r
289\r
290\r
291///\r
292/// Leaf section which contains a numeric build number and\r
293/// an optional unicode string that represents the file revision. \r
294/// \r
295typedef struct {\r
296 EFI_COMMON_SECTION_HEADER CommonHeader;\r
297 UINT16 BuildNumber;\r
298\r
299 ///\r
300 /// Array of unicode string.\r
301 /// \r
302 CHAR16 VersionString[1];\r
303} EFI_VERSION_SECTION;\r
304\r
305\r
306#define SECTION_SIZE(SectionHeaderPtr) \\r
307 ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))\r
308\r
309#pragma pack()\r
310\r
311#endif\r
312\r