Porting SecMain module for Nt32Pkg, but not enable PI, so it currently dependent...
[mirror_edk2.git] / MdePkg / Include / Pi / PiFirmwareFile.h
CommitLineData
959ccb23 1/** @file\r
2 The firmware file related definitions in PI.\r
3\r
4 Copyright (c) 2006 - 2007, 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
959ccb23 13 @par Revision Reference:\r
14 Version 1.0.\r
15\r
16**/\r
17\r
18#ifndef __PI_FIRMWARE_FILE_H__\r
19#define __PI_FIRMWARE_FILE_H__\r
20\r
21//\r
22// Used to verify the integrity of the file.\r
23// \r
24typedef union {\r
25 struct {\r
26 UINT8 Header;\r
27 UINT8 File;\r
28 } Checksum;\r
29 UINT16 Checksum16;\r
30} EFI_FFS_INTEGRITY_CHECK;\r
31\r
32typedef UINT8 EFI_FV_FILETYPE;\r
2e19fd0f 33\r
34#define EFI_FV_FILETYPE_ALL 0x00\r
35#define EFI_FV_FILETYPE_RAW 0x01\r
36#define EFI_FV_FILETYPE_FREEFORM 0x02\r
37#define EFI_FV_FILETYPE_SECURITY_CORE 0x03\r
38#define EFI_FV_FILETYPE_PEI_CORE 0x04\r
39#define EFI_FV_FILETYPE_DXE_CORE 0x05\r
40#define EFI_FV_FILETYPE_PEIM 0x06\r
41#define EFI_FV_FILETYPE_DRIVER 0x07\r
42#define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08\r
43#define EFI_FV_FILETYPE_APPLICATION 0x09\r
44//\r
45// File type 0x0A is reserved and should not be used\r
46//\r
47#define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B\r
48\r
959ccb23 49typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;\r
50typedef UINT8 EFI_FFS_FILE_STATE;\r
51\r
8fb30482 52//\r
53// File Types Definitions\r
54// \r
55#define EFI_FV_FILETYPE_RAW 0x01\r
56#define EFI_FV_FILETYPE_FREEFORM 0x02\r
57#define EFI_FV_FILETYPE_SECURITY_CORE 0x03\r
58#define EFI_FV_FILETYPE_PEI_CORE 0x04\r
59#define EFI_FV_FILETYPE_DXE_CORE 0x05\r
60#define EFI_FV_FILETYPE_PEIM 0x06\r
61#define EFI_FV_FILETYPE_DRIVER 0x07\r
62#define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08\r
63#define EFI_FV_FILETYPE_APPLICATION 0x09\r
64#define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B\r
65#define EFI_FV_FILETYPE_OEM_MIN 0xc0\r
66#define EFI_FV_FILETYPE_OEM_MAX 0xdf\r
67#define EFI_FV_FILETYPE_DEBUG_MIN 0xe0\r
68#define EFI_FV_FILETYPE_DEBUG_MAX 0xef\r
69#define EFI_FV_FILETYPE_FFS_MIN 0xf0\r
70#define EFI_FV_FILETYPE_FFS_MAX 0xff\r
71#define EFI_FV_FILETYPE_FFS_PAD 0xf0\r
959ccb23 72// \r
73// FFS File Attributes.\r
74// \r
75#define FFS_ATTRIB_FIXED 0x04\r
76#define FFS_ATTRIB_DATA_ALIGNMENT 0x38\r
77#define FFS_ATTRIB_CHECKSUM 0x40\r
78\r
79// \r
80// FFS File State Bits.\r
81// \r
82#define EFI_FILE_HEADER_CONSTRUCTION 0x01\r
83#define EFI_FILE_HEADER_VALID 0x02\r
84#define EFI_FILE_DATA_VALID 0x04\r
85#define EFI_FILE_MARKED_FOR_UPDATE 0x08\r
86#define EFI_FILE_DELETED 0x10\r
87#define EFI_FILE_HEADER_INVALID 0x20\r
88\r
89\r
90//\r
91// Each file begins with the header that describe the \r
92// contents and state of the files.\r
93// \r
94typedef struct {\r
95 EFI_GUID Name;\r
96 EFI_FFS_INTEGRITY_CHECK IntegrityCheck;\r
97 EFI_FV_FILETYPE Type;\r
98 EFI_FFS_FILE_ATTRIBUTES Attributes;\r
99 UINT8 Size[3];\r
100 EFI_FFS_FILE_STATE State;\r
101} EFI_FFS_FILE_HEADER;\r
102\r
103\r
104typedef UINT8 EFI_SECTION_TYPE;\r
105\r
106//\r
107// Pseudo type. It is\r
108// used as a wild card when retrieving sections. The section\r
109// type EFI_SECTION_ALL matches all section types.\r
110//\r
111#define EFI_SECTION_ALL 0x00\r
112\r
113//\r
114// Encapsulation section Type values\r
115//\r
116#define EFI_SECTION_COMPRESSION 0x01\r
117\r
118#define EFI_SECTION_GUID_DEFINED 0x02\r
119\r
120//\r
121// Leaf section Type values\r
122//\r
123#define EFI_SECTION_PE32 0x10\r
124#define EFI_SECTION_PIC 0x11\r
125#define EFI_SECTION_TE 0x12\r
126#define EFI_SECTION_DXE_DEPEX 0x13\r
127#define EFI_SECTION_VERSION 0x14\r
128#define EFI_SECTION_USER_INTERFACE 0x15\r
129#define EFI_SECTION_COMPATIBILITY16 0x16\r
130#define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17\r
131#define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18\r
132#define EFI_SECTION_RAW 0x19\r
133#define EFI_SECTION_PEI_DEPEX 0x1B\r
134\r
135typedef struct {\r
136 UINT8 Size[3];\r
137 EFI_SECTION_TYPE Type;\r
138} EFI_COMMON_SECTION_HEADER;\r
139\r
140//\r
141// Leaf section type that contains an \r
142// IA-32 16-bit executable image.\r
143// \r
144typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;\r
145\r
146//\r
147// CompressionType of EFI_COMPRESSION_SECTION.\r
148// \r
149#define EFI_NOT_COMPRESSED 0x00\r
150#define EFI_STANDARD_COMPRESSION 0x01\r
151//\r
152// An encapsulation section type in which the \r
153// section data is compressed.\r
154// \r
155typedef struct {\r
00edb218
A
156 EFI_COMMON_SECTION_HEADER CommonHeader;\r
157 UINT32 UncompressedLength;\r
158 UINT8 CompressionType;\r
959ccb23 159} EFI_COMPRESSION_SECTION;\r
160\r
161//\r
162// Leaf section which could be used to determine the dispatch order of DXEs.\r
163// \r
164typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;\r
165\r
166//\r
167// Leaf section witch contains a PI FV.\r
168// \r
169typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;\r
170\r
171//\r
172// Leaf section which contains a single GUID.\r
173// \r
174typedef struct {\r
00edb218
A
175 EFI_COMMON_SECTION_HEADER CommonHeader;\r
176 EFI_GUID SubTypeGuid;\r
959ccb23 177} EFI_FREEFORM_SUBTYPE_GUID_SECTION;\r
178\r
179//\r
180// Attributes of EFI_GUID_DEFINED_SECTION\r
181// \r
182#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01\r
183#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02\r
184//\r
185// Leaf section which is encapsulation defined by specific GUID\r
186// \r
187typedef struct {\r
00edb218
A
188 EFI_COMMON_SECTION_HEADER CommonHeader;\r
189 EFI_GUID SectionDefinitionGuid;\r
190 UINT16 DataOffset;\r
191 UINT16 Attributes;\r
959ccb23 192} EFI_GUID_DEFINED_SECTION;\r
193\r
194//\r
195// Leaf section which contains PE32+ image.\r
196// \r
197typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;\r
198\r
199\r
200//\r
201// Leaf section which used to determine the dispatch order of PEIMs.\r
202// \r
203typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;\r
204\r
205//\r
206// Leaf section which constains the position-independent-code image.\r
207// \r
208typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;\r
209\r
210//\r
211// Leaf section which contains an array of zero or more bytes.\r
212// \r
213typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;\r
214\r
215//\r
216// Leaf section which contains a unicode string that \r
217// is human readable file name.\r
218// \r
219typedef struct {\r
00edb218 220 EFI_COMMON_SECTION_HEADER CommonHeader;\r
959ccb23 221\r
222 //\r
223 // Array of unicode string.\r
224 // \r
00edb218 225 CHAR16 FileNameString[1];\r
959ccb23 226} EFI_USER_INTERFACE_SECTION;\r
227\r
228\r
229//\r
230// Leaf section which contains a numeric build number and\r
231// an optional unicode string that represent the file revision. \r
232// \r
233typedef struct {\r
00edb218
A
234 EFI_COMMON_SECTION_HEADER CommonHeader;\r
235 UINT16 BuildNumber;\r
236 CHAR16 VersionString[1];\r
959ccb23 237} EFI_VERSION_SECTION;\r
238\r
239#endif\r
240\r