]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Pi/PiFirmwareFile.h
6ebd42e50c759635591967f6a97e7c69b0934bdd
[mirror_edk2.git] / MdePkg / Include / Pi / PiFirmwareFile.h
1 /** @file
2 The firmware file related definitions in PI.
3
4 Copyright (c) 2006 - 2007, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 @par Revision Reference:
14 Version 1.0.
15
16 **/
17
18 #ifndef __PI_FIRMWARE_FILE_H__
19 #define __PI_FIRMWARE_FILE_H__
20
21 //
22 // Used to verify the integrity of the file.
23 //
24 typedef union {
25 struct {
26 UINT8 Header;
27 UINT8 File;
28 } Checksum;
29 UINT16 Checksum16;
30 } EFI_FFS_INTEGRITY_CHECK;
31
32 typedef UINT8 EFI_FV_FILETYPE;
33 typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;
34 typedef UINT8 EFI_FFS_FILE_STATE;
35
36 //
37 // FFS File Attributes.
38 //
39 #define FFS_ATTRIB_FIXED 0x04
40 #define FFS_ATTRIB_DATA_ALIGNMENT 0x38
41 #define FFS_ATTRIB_CHECKSUM 0x40
42
43 //
44 // FFS File State Bits.
45 //
46 #define EFI_FILE_HEADER_CONSTRUCTION 0x01
47 #define EFI_FILE_HEADER_VALID 0x02
48 #define EFI_FILE_DATA_VALID 0x04
49 #define EFI_FILE_MARKED_FOR_UPDATE 0x08
50 #define EFI_FILE_DELETED 0x10
51 #define EFI_FILE_HEADER_INVALID 0x20
52
53
54 //
55 // Each file begins with the header that describe the
56 // contents and state of the files.
57 //
58 typedef struct {
59 EFI_GUID Name;
60 EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
61 EFI_FV_FILETYPE Type;
62 EFI_FFS_FILE_ATTRIBUTES Attributes;
63 UINT8 Size[3];
64 EFI_FFS_FILE_STATE State;
65 } EFI_FFS_FILE_HEADER;
66
67
68 typedef UINT8 EFI_SECTION_TYPE;
69
70 //
71 // Pseudo type. It is
72 // used as a wild card when retrieving sections. The section
73 // type EFI_SECTION_ALL matches all section types.
74 //
75 #define EFI_SECTION_ALL 0x00
76
77 //
78 // Encapsulation section Type values
79 //
80 #define EFI_SECTION_COMPRESSION 0x01
81
82 #define EFI_SECTION_GUID_DEFINED 0x02
83
84 //
85 // Leaf section Type values
86 //
87 #define EFI_SECTION_PE32 0x10
88 #define EFI_SECTION_PIC 0x11
89 #define EFI_SECTION_TE 0x12
90 #define EFI_SECTION_DXE_DEPEX 0x13
91 #define EFI_SECTION_VERSION 0x14
92 #define EFI_SECTION_USER_INTERFACE 0x15
93 #define EFI_SECTION_COMPATIBILITY16 0x16
94 #define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17
95 #define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18
96 #define EFI_SECTION_RAW 0x19
97 #define EFI_SECTION_PEI_DEPEX 0x1B
98
99 typedef struct {
100 UINT8 Size[3];
101 EFI_SECTION_TYPE Type;
102 } EFI_COMMON_SECTION_HEADER;
103
104 //
105 // Leaf section type that contains an
106 // IA-32 16-bit executable image.
107 //
108 typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
109
110 //
111 // CompressionType of EFI_COMPRESSION_SECTION.
112 //
113 #define EFI_NOT_COMPRESSED 0x00
114 #define EFI_STANDARD_COMPRESSION 0x01
115 //
116 // An encapsulation section type in which the
117 // section data is compressed.
118 //
119 typedef struct {
120 EFI_COMMON_SECTION_HEADER CommonHeader;
121 UINT32 UncompressedLength;
122 UINT8 CompressionType;
123 } EFI_COMPRESSION_SECTION;
124
125 //
126 // Leaf section which could be used to determine the dispatch order of DXEs.
127 //
128 typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;
129
130 //
131 // Leaf section witch contains a PI FV.
132 //
133 typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
134
135 //
136 // Leaf section which contains a single GUID.
137 //
138 typedef struct {
139 EFI_COMMON_SECTION_HEADER CommonHeader;
140 EFI_GUID SubTypeGuid;
141 } EFI_FREEFORM_SUBTYPE_GUID_SECTION;
142
143 //
144 // Attributes of EFI_GUID_DEFINED_SECTION
145 //
146 #define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01
147 #define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02
148 //
149 // Leaf section which is encapsulation defined by specific GUID
150 //
151 typedef struct {
152 EFI_COMMON_SECTION_HEADER CommonHeader;
153 EFI_GUID SectionDefinitionGuid;
154 UINT16 DataOffset;
155 UINT16 Attributes;
156 } EFI_GUID_DEFINED_SECTION;
157
158 //
159 // Leaf section which contains PE32+ image.
160 //
161 typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;
162
163
164 //
165 // Leaf section which used to determine the dispatch order of PEIMs.
166 //
167 typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;
168
169 //
170 // Leaf section which constains the position-independent-code image.
171 //
172 typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;
173
174 //
175 // Leaf section which contains an array of zero or more bytes.
176 //
177 typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;
178
179 //
180 // Leaf section which contains a unicode string that
181 // is human readable file name.
182 //
183 typedef struct {
184 EFI_COMMON_SECTION_HEADER CommonHeader;
185
186 //
187 // Array of unicode string.
188 //
189 CHAR16 FileNameString[1];
190 } EFI_USER_INTERFACE_SECTION;
191
192
193 //
194 // Leaf section which contains a numeric build number and
195 // an optional unicode string that represent the file revision.
196 //
197 typedef struct {
198 EFI_COMMON_SECTION_HEADER CommonHeader;
199 UINT16 BuildNumber;
200 CHAR16 VersionString[1];
201 } EFI_VERSION_SECTION;
202
203 #endif
204