]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Pi/PiFirmwareFile.h
MdePkg/PiFirmwareFile: fix undefined behavior in SECTION_SIZE
[mirror_edk2.git] / MdePkg / Include / Pi / PiFirmwareFile.h
CommitLineData
959ccb23 1/** @file\r
2 The firmware file related definitions in PI.\r
3\r
c8a9f069 4Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
9344f092 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
959ccb23 6\r
959ccb23 7 @par Revision Reference:\r
c8a9f069 8 PI Version 1.6.\r
959ccb23 9\r
10**/\r
11\r
0b3cac32 12\r
959ccb23 13#ifndef __PI_FIRMWARE_FILE_H__\r
14#define __PI_FIRMWARE_FILE_H__\r
15\r
62d1e08b 16#pragma pack(1)\r
dc53faa3 17///\r
18/// Used to verify the integrity of the file.\r
fbb393ab 19///\r
959ccb23 20typedef union {\r
21 struct {\r
1bf79370
LG
22 ///\r
23 /// The IntegrityCheck.Checksum.Header field is an 8-bit checksum of the file\r
24 /// header. The State and IntegrityCheck.Checksum.File fields are assumed\r
25 /// to be zero and the checksum is calculated such that the entire header sums to zero.\r
26 ///\r
959ccb23 27 UINT8 Header;\r
1bf79370
LG
28 ///\r
29 /// If the FFS_ATTRIB_CHECKSUM (see definition below) bit of the Attributes\r
30 /// field is set to one, the IntegrityCheck.Checksum.File field is an 8-bit\r
bf099261 31 /// checksum of the file data.\r
1bf79370
LG
32 /// If the FFS_ATTRIB_CHECKSUM bit of the Attributes field is cleared to zero,\r
33 /// the IntegrityCheck.Checksum.File field must be initialized with a value of\r
2bf0d835 34 /// 0xAA. The IntegrityCheck.Checksum.File field is valid any time the\r
1bf79370
LG
35 /// EFI_FILE_DATA_VALID bit is set in the State field.\r
36 ///\r
959ccb23 37 UINT8 File;\r
38 } Checksum;\r
1bf79370
LG
39 ///\r
40 /// This is the full 16 bits of the IntegrityCheck field.\r
41 ///\r
959ccb23 42 UINT16 Checksum16;\r
43} EFI_FFS_INTEGRITY_CHECK;\r
44\r
2bf0d835
LG
45///\r
46/// FFS_FIXED_CHECKSUM is the checksum value used when the\r
af2dc6a7 47/// FFS_ATTRIB_CHECKSUM attribute bit is clear.\r
2bf0d835
LG
48///\r
49#define FFS_FIXED_CHECKSUM 0xAA\r
50\r
959ccb23 51typedef UINT8 EFI_FV_FILETYPE;\r
52typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;\r
53typedef UINT8 EFI_FFS_FILE_STATE;\r
54\r
dc53faa3 55///\r
56/// File Types Definitions\r
fbb393ab 57///\r
d44d2087 58#define EFI_FV_FILETYPE_ALL 0x00\r
8fb30482 59#define EFI_FV_FILETYPE_RAW 0x01\r
60#define EFI_FV_FILETYPE_FREEFORM 0x02\r
61#define EFI_FV_FILETYPE_SECURITY_CORE 0x03\r
62#define EFI_FV_FILETYPE_PEI_CORE 0x04\r
63#define EFI_FV_FILETYPE_DXE_CORE 0x05\r
64#define EFI_FV_FILETYPE_PEIM 0x06\r
65#define EFI_FV_FILETYPE_DRIVER 0x07\r
66#define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08\r
67#define EFI_FV_FILETYPE_APPLICATION 0x09\r
f412ecc3
SV
68#define EFI_FV_FILETYPE_MM 0x0A\r
69#define EFI_FV_FILETYPE_SMM EFI_FV_FILETYPE_MM\r
8fb30482 70#define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B\r
f412ecc3
SV
71#define EFI_FV_FILETYPE_COMBINED_MM_DXE 0x0C\r
72#define EFI_FV_FILETYPE_COMBINED_SMM_DXE EFI_FV_FILETYPE_COMBINED_MM_DXE\r
73#define EFI_FV_FILETYPE_MM_CORE 0x0D\r
74#define EFI_FV_FILETYPE_SMM_CORE EFI_FV_FILETYPE_MM_CORE\r
75#define EFI_FV_FILETYPE_MM_STANDALONE 0x0E\r
76#define EFI_FV_FILETYPE_MM_CORE_STANDALONE 0x0F\r
8fb30482 77#define EFI_FV_FILETYPE_OEM_MIN 0xc0\r
78#define EFI_FV_FILETYPE_OEM_MAX 0xdf\r
79#define EFI_FV_FILETYPE_DEBUG_MIN 0xe0\r
80#define EFI_FV_FILETYPE_DEBUG_MAX 0xef\r
81#define EFI_FV_FILETYPE_FFS_MIN 0xf0\r
82#define EFI_FV_FILETYPE_FFS_MAX 0xff\r
83#define EFI_FV_FILETYPE_FFS_PAD 0xf0\r
fbb393ab 84///\r
dc53faa3 85/// FFS File Attributes.\r
fbb393ab 86///\r
3d4d4cfa 87#define FFS_ATTRIB_LARGE_FILE 0x01\r
c8a9f069 88#define FFS_ATTRIB_DATA_ALIGNMENT_2 0x02\r
959ccb23 89#define FFS_ATTRIB_FIXED 0x04\r
90#define FFS_ATTRIB_DATA_ALIGNMENT 0x38\r
91#define FFS_ATTRIB_CHECKSUM 0x40\r
92\r
fbb393ab 93///\r
dc53faa3 94/// FFS File State Bits.\r
fbb393ab 95///\r
959ccb23 96#define EFI_FILE_HEADER_CONSTRUCTION 0x01\r
97#define EFI_FILE_HEADER_VALID 0x02\r
98#define EFI_FILE_DATA_VALID 0x04\r
99#define EFI_FILE_MARKED_FOR_UPDATE 0x08\r
100#define EFI_FILE_DELETED 0x10\r
101#define EFI_FILE_HEADER_INVALID 0x20\r
102\r
103\r
dc53faa3 104///\r
fbb393ab 105/// Each file begins with the header that describe the\r
dc53faa3 106/// contents and state of the files.\r
fbb393ab 107///\r
959ccb23 108typedef struct {\r
1bf79370
LG
109 ///\r
110 /// This GUID is the file name. It is used to uniquely identify the file.\r
111 ///\r
959ccb23 112 EFI_GUID Name;\r
1bf79370
LG
113 ///\r
114 /// Used to verify the integrity of the file.\r
115 ///\r
959ccb23 116 EFI_FFS_INTEGRITY_CHECK IntegrityCheck;\r
1bf79370
LG
117 ///\r
118 /// Identifies the type of file.\r
119 ///\r
959ccb23 120 EFI_FV_FILETYPE Type;\r
1bf79370
LG
121 ///\r
122 /// Declares various file attribute bits.\r
123 ///\r
959ccb23 124 EFI_FFS_FILE_ATTRIBUTES Attributes;\r
1bf79370
LG
125 ///\r
126 /// The length of the file in bytes, including the FFS header.\r
127 ///\r
959ccb23 128 UINT8 Size[3];\r
1bf79370
LG
129 ///\r
130 /// Used to track the state of the file throughout the life of the file from creation to deletion.\r
131 ///\r
959ccb23 132 EFI_FFS_FILE_STATE State;\r
133} EFI_FFS_FILE_HEADER;\r
134\r
3d4d4cfa 135typedef struct {\r
136 ///\r
137 /// This GUID is the file name. It is used to uniquely identify the file. There may be only\r
138 /// one instance of a file with the file name GUID of Name in any given firmware\r
139 /// volume, except if the file type is EFI_FV_FILETYPE_FFS_PAD.\r
140 ///\r
141 EFI_GUID Name;\r
fbb393ab 142\r
3d4d4cfa 143 ///\r
144 /// Used to verify the integrity of the file.\r
fbb393ab 145 ///\r
3d4d4cfa 146 EFI_FFS_INTEGRITY_CHECK IntegrityCheck;\r
fbb393ab 147\r
3d4d4cfa 148 ///\r
149 /// Identifies the type of file.\r
fbb393ab 150 ///\r
3d4d4cfa 151 EFI_FV_FILETYPE Type;\r
fbb393ab 152\r
3d4d4cfa 153 ///\r
154 /// Declares various file attribute bits.\r
fbb393ab 155 ///\r
3d4d4cfa 156 EFI_FFS_FILE_ATTRIBUTES Attributes;\r
fbb393ab 157\r
3d4d4cfa 158 ///\r
159 /// The length of the file in bytes, including the FFS header.\r
160 /// The length of the file data is either (Size - sizeof(EFI_FFS_FILE_HEADER)). This calculation means a\r
161 /// zero-length file has a Size of 24 bytes, which is sizeof(EFI_FFS_FILE_HEADER).\r
162 /// Size is not required to be a multiple of 8 bytes. Given a file F, the next file header is\r
163 /// located at the next 8-byte aligned firmware volume offset following the last byte of the file F.\r
164 ///\r
165 UINT8 Size[3];\r
fbb393ab 166\r
3d4d4cfa 167 ///\r
168 /// Used to track the state of the file throughout the life of the file from creation to deletion.\r
169 ///\r
170 EFI_FFS_FILE_STATE State;\r
fbb393ab 171\r
3d4d4cfa 172 ///\r
af2dc6a7 173 /// If FFS_ATTRIB_LARGE_FILE is set in Attributes, then ExtendedSize exists and Size must be set to zero.\r
3d4d4cfa 174 /// If FFS_ATTRIB_LARGE_FILE is not set then EFI_FFS_FILE_HEADER is used.\r
175 ///\r
28fc9f47 176 UINT64 ExtendedSize;\r
3d4d4cfa 177} EFI_FFS_FILE_HEADER2;\r
959ccb23 178\r
30f001ca
SZ
179#define IS_FFS_FILE2(FfsFileHeaderPtr) \\r
180 (((((EFI_FFS_FILE_HEADER *) (UINTN) FfsFileHeaderPtr)->Attributes) & FFS_ATTRIB_LARGE_FILE) == FFS_ATTRIB_LARGE_FILE)\r
181\r
182#define FFS_FILE_SIZE(FfsFileHeaderPtr) \\r
183 ((UINT32) (*((UINT32 *) ((EFI_FFS_FILE_HEADER *) (UINTN) FfsFileHeaderPtr)->Size) & 0x00ffffff))\r
184\r
185#define FFS_FILE2_SIZE(FfsFileHeaderPtr) \\r
28fc9f47 186 ((UINT32) (((EFI_FFS_FILE_HEADER2 *) (UINTN) FfsFileHeaderPtr)->ExtendedSize))\r
30f001ca 187\r
959ccb23 188typedef UINT8 EFI_SECTION_TYPE;\r
189\r
dc53faa3 190///\r
af2dc6a7 191/// Pseudo type. It is used as a wild card when retrieving sections.\r
192/// The section type EFI_SECTION_ALL matches all section types.\r
dc53faa3 193///\r
959ccb23 194#define EFI_SECTION_ALL 0x00\r
195\r
dc53faa3 196///\r
af2dc6a7 197/// Encapsulation section Type values.\r
dc53faa3 198///\r
959ccb23 199#define EFI_SECTION_COMPRESSION 0x01\r
200\r
201#define EFI_SECTION_GUID_DEFINED 0x02\r
202\r
3d4d4cfa 203#define EFI_SECTION_DISPOSABLE 0x03\r
204\r
dc53faa3 205///\r
af2dc6a7 206/// Leaf section Type values.\r
dc53faa3 207///\r
959ccb23 208#define EFI_SECTION_PE32 0x10\r
209#define EFI_SECTION_PIC 0x11\r
210#define EFI_SECTION_TE 0x12\r
211#define EFI_SECTION_DXE_DEPEX 0x13\r
212#define EFI_SECTION_VERSION 0x14\r
213#define EFI_SECTION_USER_INTERFACE 0x15\r
214#define EFI_SECTION_COMPATIBILITY16 0x16\r
215#define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17\r
216#define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18\r
217#define EFI_SECTION_RAW 0x19\r
218#define EFI_SECTION_PEI_DEPEX 0x1B\r
f412ecc3
SV
219#define EFI_SECTION_MM_DEPEX 0x1C\r
220#define EFI_SECTION_SMM_DEPEX EFI_SECTION_MM_DEPEX\r
959ccb23 221\r
dc53faa3 222///\r
af2dc6a7 223/// Common section header.\r
fbb393ab 224///\r
959ccb23 225typedef struct {\r
1bf79370 226 ///\r
fbb393ab 227 /// A 24-bit unsigned integer that contains the total size of the section in bytes,\r
1bf79370
LG
228 /// including the EFI_COMMON_SECTION_HEADER.\r
229 ///\r
959ccb23 230 UINT8 Size[3];\r
231 EFI_SECTION_TYPE Type;\r
1bf79370
LG
232 ///\r
233 /// Declares the section type.\r
234 ///\r
959ccb23 235} EFI_COMMON_SECTION_HEADER;\r
236\r
3d4d4cfa 237typedef struct {\r
238 ///\r
fbb393ab 239 /// A 24-bit unsigned integer that contains the total size of the section in bytes,\r
3d4d4cfa 240 /// including the EFI_COMMON_SECTION_HEADER.\r
241 ///\r
242 UINT8 Size[3];\r
fbb393ab 243\r
3d4d4cfa 244 EFI_SECTION_TYPE Type;\r
fbb393ab 245\r
3d4d4cfa 246 ///\r
af2dc6a7 247 /// If Size is 0xFFFFFF, then ExtendedSize contains the size of the section. If\r
fbb393ab 248 /// Size is not equal to 0xFFFFFF, then this field does not exist.\r
3d4d4cfa 249 ///\r
250 UINT32 ExtendedSize;\r
251} EFI_COMMON_SECTION_HEADER2;\r
252\r
dc53faa3 253///\r
fbb393ab 254/// Leaf section type that contains an\r
dc53faa3 255/// IA-32 16-bit executable image.\r
fbb393ab 256///\r
3d4d4cfa 257typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;\r
258typedef EFI_COMMON_SECTION_HEADER2 EFI_COMPATIBILITY16_SECTION2;\r
959ccb23 259\r
dc53faa3 260///\r
261/// CompressionType of EFI_COMPRESSION_SECTION.\r
fbb393ab 262///\r
959ccb23 263#define EFI_NOT_COMPRESSED 0x00\r
264#define EFI_STANDARD_COMPRESSION 0x01\r
dc53faa3 265///\r
fbb393ab 266/// An encapsulation section type in which the\r
dc53faa3 267/// section data is compressed.\r
fbb393ab 268///\r
959ccb23 269typedef struct {\r
1bf79370
LG
270 ///\r
271 /// Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION.\r
272 ///\r
00edb218 273 EFI_COMMON_SECTION_HEADER CommonHeader;\r
1bf79370 274 ///\r
af2dc6a7 275 /// The UINT32 that indicates the size of the section data after decompression.\r
1bf79370 276 ///\r
00edb218 277 UINT32 UncompressedLength;\r
1bf79370
LG
278 ///\r
279 /// Indicates which compression algorithm is used.\r
280 ///\r
00edb218 281 UINT8 CompressionType;\r
959ccb23 282} EFI_COMPRESSION_SECTION;\r
283\r
3d4d4cfa 284typedef struct {\r
285 ///\r
286 /// Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION.\r
287 ///\r
288 EFI_COMMON_SECTION_HEADER2 CommonHeader;\r
289 ///\r
290 /// UINT32 that indicates the size of the section data after decompression.\r
291 ///\r
292 UINT32 UncompressedLength;\r
293 ///\r
294 /// Indicates which compression algorithm is used.\r
295 ///\r
296 UINT8 CompressionType;\r
297} EFI_COMPRESSION_SECTION2;\r
298\r
73d622ed 299///\r
300/// An encapsulation section type in which the section data is disposable.\r
301/// A disposable section is an encapsulation section in which the section data may be disposed of during\r
302/// the process of creating or updating a firmware image without significant impact on the usefulness of\r
303/// the file. The Type field in the section header is set to EFI_SECTION_DISPOSABLE. This\r
304/// allows optional or descriptive data to be included with the firmware file which can be removed in\r
305/// order to conserve space. The contents of this section are implementation specific, but might contain\r
306/// debug data or detailed integration instructions.\r
307///\r
3d4d4cfa 308typedef EFI_COMMON_SECTION_HEADER EFI_DISPOSABLE_SECTION;\r
309typedef EFI_COMMON_SECTION_HEADER2 EFI_DISPOSABLE_SECTION2;\r
73d622ed 310\r
dc53faa3 311///\r
af2dc6a7 312/// The leaf section which could be used to determine the dispatch order of DXEs.\r
fbb393ab 313///\r
3d4d4cfa 314typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;\r
315typedef EFI_COMMON_SECTION_HEADER2 EFI_DXE_DEPEX_SECTION2;\r
959ccb23 316\r
dc53faa3 317///\r
af2dc6a7 318/// The leaf section which contains a PI FV.\r
fbb393ab 319///\r
3d4d4cfa 320typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;\r
321typedef EFI_COMMON_SECTION_HEADER2 EFI_FIRMWARE_VOLUME_IMAGE_SECTION2;\r
959ccb23 322\r
dc53faa3 323///\r
af2dc6a7 324/// The leaf section which contains a single GUID.\r
fbb393ab 325///\r
959ccb23 326typedef struct {\r
1bf79370
LG
327 ///\r
328 /// Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID.\r
329 ///\r
00edb218 330 EFI_COMMON_SECTION_HEADER CommonHeader;\r
1bf79370
LG
331 ///\r
332 /// This GUID is defined by the creator of the file. It is a vendor-defined file type.\r
333 ///\r
00edb218 334 EFI_GUID SubTypeGuid;\r
959ccb23 335} EFI_FREEFORM_SUBTYPE_GUID_SECTION;\r
336\r
3d4d4cfa 337typedef struct {\r
338 ///\r
af2dc6a7 339 /// The common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID.\r
3d4d4cfa 340 ///\r
341 EFI_COMMON_SECTION_HEADER2 CommonHeader;\r
342 ///\r
343 /// This GUID is defined by the creator of the file. It is a vendor-defined file type.\r
fbb393ab 344 ///\r
3d4d4cfa 345 EFI_GUID SubTypeGuid;\r
346} EFI_FREEFORM_SUBTYPE_GUID_SECTION2;\r
347\r
dc53faa3 348///\r
af2dc6a7 349/// Attributes of EFI_GUID_DEFINED_SECTION.\r
fbb393ab 350///\r
959ccb23 351#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01\r
352#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02\r
dc53faa3 353///\r
af2dc6a7 354/// The leaf section which is encapsulation defined by specific GUID.\r
fbb393ab 355///\r
959ccb23 356typedef struct {\r
1bf79370 357 ///\r
af2dc6a7 358 /// The common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED.\r
1bf79370 359 ///\r
00edb218 360 EFI_COMMON_SECTION_HEADER CommonHeader;\r
1bf79370 361 ///\r
af2dc6a7 362 /// The GUID that defines the format of the data that follows. It is a vendor-defined section type.\r
1bf79370 363 ///\r
00edb218 364 EFI_GUID SectionDefinitionGuid;\r
1bf79370
LG
365 ///\r
366 /// Contains the offset in bytes from the beginning of the common header to the first byte of the data.\r
367 ///\r
00edb218 368 UINT16 DataOffset;\r
1bf79370 369 ///\r
af2dc6a7 370 /// The bit field that declares some specific characteristics of the section contents.\r
1bf79370 371 ///\r
00edb218 372 UINT16 Attributes;\r
959ccb23 373} EFI_GUID_DEFINED_SECTION;\r
374\r
3d4d4cfa 375typedef struct {\r
376 ///\r
af2dc6a7 377 /// The common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED.\r
3d4d4cfa 378 ///\r
379 EFI_COMMON_SECTION_HEADER2 CommonHeader;\r
380 ///\r
af2dc6a7 381 /// The GUID that defines the format of the data that follows. It is a vendor-defined section type.\r
fbb393ab 382 ///\r
3d4d4cfa 383 EFI_GUID SectionDefinitionGuid;\r
384 ///\r
385 /// Contains the offset in bytes from the beginning of the common header to the first byte of the data.\r
fbb393ab 386 ///\r
3d4d4cfa 387 UINT16 DataOffset;\r
388 ///\r
af2dc6a7 389 /// The bit field that declares some specific characteristics of the section contents.\r
fbb393ab 390 ///\r
3d4d4cfa 391 UINT16 Attributes;\r
392} EFI_GUID_DEFINED_SECTION2;\r
393\r
dc53faa3 394///\r
af2dc6a7 395/// The leaf section which contains PE32+ image.\r
fbb393ab 396///\r
3d4d4cfa 397typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;\r
398typedef EFI_COMMON_SECTION_HEADER2 EFI_PE32_SECTION2;\r
959ccb23 399\r
dc53faa3 400///\r
af2dc6a7 401/// The leaf section used to determine the dispatch order of PEIMs.\r
fbb393ab 402///\r
3d4d4cfa 403typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;\r
404typedef EFI_COMMON_SECTION_HEADER2 EFI_PEI_DEPEX_SECTION2;\r
405\r
406///\r
407/// A leaf section type that contains a position-independent-code (PIC) image.\r
408/// A PIC image section is a leaf section that contains a position-independent-code (PIC) image.\r
409/// In addition to normal PE32+ images that contain relocation information, PEIM executables may be\r
410/// PIC and are referred to as PIC images. A PIC image is the same as a PE32+ image except that all\r
411/// relocation information has been stripped from the image and the image can be moved and will\r
412/// execute correctly without performing any relocation or other fix-ups. EFI_PIC_SECTION2 must\r
413/// be used if the section is 16MB or larger.\r
414///\r
415typedef EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION;\r
416typedef EFI_COMMON_SECTION_HEADER2 EFI_PIC_SECTION2;\r
959ccb23 417\r
dc53faa3 418///\r
af2dc6a7 419/// The leaf section which constains the position-independent-code image.\r
fbb393ab 420///\r
3d4d4cfa 421typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;\r
422typedef EFI_COMMON_SECTION_HEADER2 EFI_TE_SECTION2;\r
959ccb23 423\r
dc53faa3 424///\r
af2dc6a7 425/// The leaf section which contains an array of zero or more bytes.\r
fbb393ab 426///\r
3d4d4cfa 427typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;\r
428typedef EFI_COMMON_SECTION_HEADER2 EFI_RAW_SECTION2;\r
429\r
fbb393ab 430///\r
3d4d4cfa 431/// The SMM dependency expression section is a leaf section that contains a dependency expression that\r
432/// is used to determine the dispatch order for SMM drivers. Before the SMRAM invocation of the\r
433/// SMM driver's entry point, this dependency expression must evaluate to TRUE. See the Platform\r
af2dc6a7 434/// Initialization Specification, Volume 2, for details regarding the format of the dependency expression.\r
3d4d4cfa 435/// The dependency expression may refer to protocols installed in either the UEFI or the SMM protocol\r
436/// database. EFI_SMM_DEPEX_SECTION2 must be used if the section is 16MB or larger.\r
fbb393ab 437///\r
3d4d4cfa 438typedef EFI_COMMON_SECTION_HEADER EFI_SMM_DEPEX_SECTION;\r
439typedef EFI_COMMON_SECTION_HEADER2 EFI_SMM_DEPEX_SECTION2;\r
959ccb23 440\r
dc53faa3 441///\r
fbb393ab 442/// The leaf section which contains a unicode string that\r
dc53faa3 443/// is human readable file name.\r
fbb393ab 444///\r
959ccb23 445typedef struct {\r
00edb218 446 EFI_COMMON_SECTION_HEADER CommonHeader;\r
959ccb23 447\r
dc53faa3 448 ///\r
449 /// Array of unicode string.\r
fbb393ab 450 ///\r
00edb218 451 CHAR16 FileNameString[1];\r
959ccb23 452} EFI_USER_INTERFACE_SECTION;\r
453\r
3d4d4cfa 454typedef struct {\r
455 EFI_COMMON_SECTION_HEADER2 CommonHeader;\r
456 CHAR16 FileNameString[1];\r
457} EFI_USER_INTERFACE_SECTION2;\r
959ccb23 458\r
dc53faa3 459///\r
af2dc6a7 460/// The leaf section which contains a numeric build number and\r
fbb393ab
LL
461/// an optional unicode string that represents the file revision.\r
462///\r
959ccb23 463typedef struct {\r
00edb218
A
464 EFI_COMMON_SECTION_HEADER CommonHeader;\r
465 UINT16 BuildNumber;\r
7b1bf9f6 466\r
467 ///\r
468 /// Array of unicode string.\r
fbb393ab 469 ///\r
00edb218 470 CHAR16 VersionString[1];\r
959ccb23 471} EFI_VERSION_SECTION;\r
472\r
3d4d4cfa 473typedef struct {\r
474 EFI_COMMON_SECTION_HEADER2 CommonHeader;\r
475 ///\r
476 /// A UINT16 that represents a particular build. Subsequent builds have monotonically\r
477 /// increasing build numbers relative to earlier builds.\r
478 ///\r
479 UINT16 BuildNumber;\r
480 CHAR16 VersionString[1];\r
481} EFI_VERSION_SECTION2;\r
ddd3f471 482\r
fc76bbd9
LE
483///\r
484/// The argument passed as the SectionHeaderPtr parameter to the SECTION_SIZE()\r
485/// and IS_SECTION2() function-like macros below must not have side effects:\r
486/// SectionHeaderPtr is evaluated multiple times.\r
487///\r
488#define SECTION_SIZE(SectionHeaderPtr) ((UINT32) ( \\r
489 (((EFI_COMMON_SECTION_HEADER *) (UINTN) (SectionHeaderPtr))->Size[0] ) | \\r
490 (((EFI_COMMON_SECTION_HEADER *) (UINTN) (SectionHeaderPtr))->Size[1] << 8) | \\r
491 (((EFI_COMMON_SECTION_HEADER *) (UINTN) (SectionHeaderPtr))->Size[2] << 16)))\r
30f001ca 492\r
d976f09d
LE
493#define IS_SECTION2(SectionHeaderPtr) \\r
494 (SECTION_SIZE (SectionHeaderPtr) == 0x00ffffff)\r
495\r
30f001ca
SZ
496#define SECTION2_SIZE(SectionHeaderPtr) \\r
497 (((EFI_COMMON_SECTION_HEADER2 *) (UINTN) SectionHeaderPtr)->ExtendedSize)\r
ddd3f471 498\r
62d1e08b 499#pragma pack()\r
ddd3f471 500\r
959ccb23 501#endif\r
502\r