X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FPi%2FPiFirmwareFile.h;h=734344430aa6cdf90b1e3107190e1a5005d9864e;hb=6535266574ac0478314d65953f2abf4091d55ee2;hp=6b61de1bd3b253772a6ef8e869fb0b383b681d98;hpb=95ba3c4150701418aa0806597fdc2e3099b62f79;p=mirror_edk2.git diff --git a/MdePkg/Include/Pi/PiFirmwareFile.h b/MdePkg/Include/Pi/PiFirmwareFile.h index 6b61de1bd3..734344430a 100644 --- a/MdePkg/Include/Pi/PiFirmwareFile.h +++ b/MdePkg/Include/Pi/PiFirmwareFile.h @@ -1,17 +1,17 @@ /** @file The firmware file related definitions in PI. - Copyright (c) 2006 - 2009, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php +Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @par Revision Reference: - PI Version 1.2 + PI Version 1.4. **/ @@ -22,7 +22,7 @@ #pragma pack(1) /// /// Used to verify the integrity of the file. -/// +/// typedef union { struct { /// @@ -34,11 +34,10 @@ typedef union { /// /// If the FFS_ATTRIB_CHECKSUM (see definition below) bit of the Attributes /// field is set to one, the IntegrityCheck.Checksum.File field is an 8-bit - /// checksum of the entire file The State field and the file tail are assumed to be zero - /// and the checksum is calculated such that the entire file sums to zero. + /// checksum of the file data. /// If the FFS_ATTRIB_CHECKSUM bit of the Attributes field is cleared to zero, /// the IntegrityCheck.Checksum.File field must be initialized with a value of - /// 0x55AA. The IntegrityCheck.Checksum.File field is valid any time the + /// 0xAA. The IntegrityCheck.Checksum.File field is valid any time the /// EFI_FILE_DATA_VALID bit is set in the State field. /// UINT8 File; @@ -49,13 +48,19 @@ typedef union { UINT16 Checksum16; } EFI_FFS_INTEGRITY_CHECK; +/// +/// FFS_FIXED_CHECKSUM is the checksum value used when the +/// FFS_ATTRIB_CHECKSUM attribute bit is clear. +/// +#define FFS_FIXED_CHECKSUM 0xAA + typedef UINT8 EFI_FV_FILETYPE; typedef UINT8 EFI_FFS_FILE_ATTRIBUTES; typedef UINT8 EFI_FFS_FILE_STATE; /// /// File Types Definitions -/// +/// #define EFI_FV_FILETYPE_ALL 0x00 #define EFI_FV_FILETYPE_RAW 0x01 #define EFI_FV_FILETYPE_FREEFORM 0x02 @@ -77,17 +82,17 @@ typedef UINT8 EFI_FFS_FILE_STATE; #define EFI_FV_FILETYPE_FFS_MIN 0xf0 #define EFI_FV_FILETYPE_FFS_MAX 0xff #define EFI_FV_FILETYPE_FFS_PAD 0xf0 -/// +/// /// FFS File Attributes. -/// +/// #define FFS_ATTRIB_LARGE_FILE 0x01 #define FFS_ATTRIB_FIXED 0x04 #define FFS_ATTRIB_DATA_ALIGNMENT 0x38 #define FFS_ATTRIB_CHECKSUM 0x40 -/// +/// /// FFS File State Bits. -/// +/// #define EFI_FILE_HEADER_CONSTRUCTION 0x01 #define EFI_FILE_HEADER_VALID 0x02 #define EFI_FILE_DATA_VALID 0x04 @@ -97,9 +102,9 @@ typedef UINT8 EFI_FFS_FILE_STATE; /// -/// Each file begins with the header that describe the +/// Each file begins with the header that describe the /// contents and state of the files. -/// +/// typedef struct { /// /// This GUID is the file name. It is used to uniquely identify the file. @@ -134,22 +139,22 @@ typedef struct { /// volume, except if the file type is EFI_FV_FILETYPE_FFS_PAD. /// EFI_GUID Name; - + /// /// Used to verify the integrity of the file. - /// + /// EFI_FFS_INTEGRITY_CHECK IntegrityCheck; - + /// /// Identifies the type of file. - /// + /// EFI_FV_FILETYPE Type; - + /// /// Declares various file attribute bits. - /// + /// EFI_FFS_FILE_ATTRIBUTES Attributes; - + /// /// The length of the file in bytes, including the FFS header. /// The length of the file data is either (Size - sizeof(EFI_FFS_FILE_HEADER)). This calculation means a @@ -158,30 +163,38 @@ typedef struct { /// located at the next 8-byte aligned firmware volume offset following the last byte of the file F. /// UINT8 Size[3]; - + /// /// Used to track the state of the file throughout the life of the file from creation to deletion. /// EFI_FFS_FILE_STATE State; - + /// - /// If FFS_ATTRIB_LARGE_FILE is set in Attributes then ExtendedSize exists and Size must be set to zero. + /// If FFS_ATTRIB_LARGE_FILE is set in Attributes, then ExtendedSize exists and Size must be set to zero. /// If FFS_ATTRIB_LARGE_FILE is not set then EFI_FFS_FILE_HEADER is used. /// - EFI_FFS_FILE_STATE ExtendedSize; + UINT64 ExtendedSize; } EFI_FFS_FILE_HEADER2; +#define IS_FFS_FILE2(FfsFileHeaderPtr) \ + (((((EFI_FFS_FILE_HEADER *) (UINTN) FfsFileHeaderPtr)->Attributes) & FFS_ATTRIB_LARGE_FILE) == FFS_ATTRIB_LARGE_FILE) + +#define FFS_FILE_SIZE(FfsFileHeaderPtr) \ + ((UINT32) (*((UINT32 *) ((EFI_FFS_FILE_HEADER *) (UINTN) FfsFileHeaderPtr)->Size) & 0x00ffffff)) + +#define FFS_FILE2_SIZE(FfsFileHeaderPtr) \ + ((UINT32) (((EFI_FFS_FILE_HEADER2 *) (UINTN) FfsFileHeaderPtr)->ExtendedSize)) + typedef UINT8 EFI_SECTION_TYPE; /// -/// Pseudo type. It is -/// used as a wild card when retrieving sections. The section -/// type EFI_SECTION_ALL matches all section types. +/// Pseudo type. It is used as a wild card when retrieving sections. +/// The section type EFI_SECTION_ALL matches all section types. /// #define EFI_SECTION_ALL 0x00 /// -/// Encapsulation section Type values +/// Encapsulation section Type values. /// #define EFI_SECTION_COMPRESSION 0x01 @@ -190,7 +203,7 @@ typedef UINT8 EFI_SECTION_TYPE; #define EFI_SECTION_DISPOSABLE 0x03 /// -/// Leaf section Type values +/// Leaf section Type values. /// #define EFI_SECTION_PE32 0x10 #define EFI_SECTION_PIC 0x11 @@ -206,11 +219,11 @@ typedef UINT8 EFI_SECTION_TYPE; #define EFI_SECTION_SMM_DEPEX 0x1C /// -/// Common section header -/// +/// Common section header. +/// typedef struct { /// - /// A 24-bit unsigned integer that contains the total size of the section in bytes, + /// A 24-bit unsigned integer that contains the total size of the section in bytes, /// including the EFI_COMMON_SECTION_HEADER. /// UINT8 Size[3]; @@ -222,43 +235,43 @@ typedef struct { typedef struct { /// - /// A 24-bit unsigned integer that contains the total size of the section in bytes, + /// A 24-bit unsigned integer that contains the total size of the section in bytes, /// including the EFI_COMMON_SECTION_HEADER. /// UINT8 Size[3]; - + EFI_SECTION_TYPE Type; - + /// - /// If Size is 0xFFFFFF then ExtendedSize contains the size of the section. If - /// Size is not equal to 0xFFFFFF then this field does not exist. + /// If Size is 0xFFFFFF, then ExtendedSize contains the size of the section. If + /// Size is not equal to 0xFFFFFF, then this field does not exist. /// UINT32 ExtendedSize; } EFI_COMMON_SECTION_HEADER2; /// -/// Leaf section type that contains an +/// Leaf section type that contains an /// IA-32 16-bit executable image. -/// +/// typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_COMPATIBILITY16_SECTION2; /// /// CompressionType of EFI_COMPRESSION_SECTION. -/// +/// #define EFI_NOT_COMPRESSED 0x00 #define EFI_STANDARD_COMPRESSION 0x01 /// -/// An encapsulation section type in which the +/// An encapsulation section type in which the /// section data is compressed. -/// +/// typedef struct { /// /// Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION. /// EFI_COMMON_SECTION_HEADER CommonHeader; /// - /// UINT32 that indicates the size of the section data after decompression. + /// The UINT32 that indicates the size of the section data after decompression. /// UINT32 UncompressedLength; /// @@ -295,20 +308,20 @@ typedef EFI_COMMON_SECTION_HEADER EFI_DISPOSABLE_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_DISPOSABLE_SECTION2; /// -/// Leaf section which could be used to determine the dispatch order of DXEs. -/// +/// The leaf section which could be used to determine the dispatch order of DXEs. +/// typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_DXE_DEPEX_SECTION2; /// -/// Leaf section which contains a PI FV. -/// +/// The leaf section which contains a PI FV. +/// typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_FIRMWARE_VOLUME_IMAGE_SECTION2; /// -/// Leaf section which contains a single GUID. -/// +/// The leaf section which contains a single GUID. +/// typedef struct { /// /// Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID. @@ -322,30 +335,30 @@ typedef struct { typedef struct { /// - /// Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID. + /// The common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID. /// EFI_COMMON_SECTION_HEADER2 CommonHeader; /// /// This GUID is defined by the creator of the file. It is a vendor-defined file type. - /// + /// EFI_GUID SubTypeGuid; } EFI_FREEFORM_SUBTYPE_GUID_SECTION2; /// -/// Attributes of EFI_GUID_DEFINED_SECTION -/// +/// Attributes of EFI_GUID_DEFINED_SECTION. +/// #define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01 #define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02 /// -/// Leaf section which is encapsulation defined by specific GUID -/// +/// The leaf section which is encapsulation defined by specific GUID. +/// typedef struct { /// - /// Common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED. + /// The common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED. /// EFI_COMMON_SECTION_HEADER CommonHeader; /// - /// GUID that defines the format of the data that follows. It is a vendor-defined section type. + /// The GUID that defines the format of the data that follows. It is a vendor-defined section type. /// EFI_GUID SectionDefinitionGuid; /// @@ -353,39 +366,39 @@ typedef struct { /// UINT16 DataOffset; /// - /// Bit field that declares some specific characteristics of the section contents. + /// The bit field that declares some specific characteristics of the section contents. /// UINT16 Attributes; } EFI_GUID_DEFINED_SECTION; typedef struct { /// - /// Common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED. + /// The common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED. /// EFI_COMMON_SECTION_HEADER2 CommonHeader; /// - /// GUID that defines the format of the data that follows. It is a vendor-defined section type. - /// + /// The GUID that defines the format of the data that follows. It is a vendor-defined section type. + /// EFI_GUID SectionDefinitionGuid; /// /// Contains the offset in bytes from the beginning of the common header to the first byte of the data. - /// + /// UINT16 DataOffset; /// - /// Bit field that declares some specific characteristics of the section contents. - /// + /// The bit field that declares some specific characteristics of the section contents. + /// UINT16 Attributes; } EFI_GUID_DEFINED_SECTION2; /// -/// Leaf section which contains PE32+ image. -/// +/// The leaf section which contains PE32+ image. +/// typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_PE32_SECTION2; /// -/// Leaf section which used to determine the dispatch order of PEIMs. -/// +/// The leaf section used to determine the dispatch order of PEIMs. +/// typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_PEI_DEPEX_SECTION2; @@ -402,38 +415,38 @@ typedef EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_PIC_SECTION2; /// -/// Leaf section which constains the position-independent-code image. -/// +/// The leaf section which constains the position-independent-code image. +/// typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_TE_SECTION2; /// -/// Leaf section which contains an array of zero or more bytes. -/// +/// The leaf section which contains an array of zero or more bytes. +/// typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_RAW_SECTION2; -/// +/// /// The SMM dependency expression section is a leaf section that contains a dependency expression that /// is used to determine the dispatch order for SMM drivers. Before the SMRAM invocation of the /// SMM driver's entry point, this dependency expression must evaluate to TRUE. See the Platform -/// Initialization Specification, Volume 2for details regarding the format of the dependency expression. +/// Initialization Specification, Volume 2, for details regarding the format of the dependency expression. /// The dependency expression may refer to protocols installed in either the UEFI or the SMM protocol /// database. EFI_SMM_DEPEX_SECTION2 must be used if the section is 16MB or larger. -/// +/// typedef EFI_COMMON_SECTION_HEADER EFI_SMM_DEPEX_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_SMM_DEPEX_SECTION2; /// -/// Leaf section which contains a unicode string that +/// The leaf section which contains a unicode string that /// is human readable file name. -/// +/// typedef struct { EFI_COMMON_SECTION_HEADER CommonHeader; /// /// Array of unicode string. - /// + /// CHAR16 FileNameString[1]; } EFI_USER_INTERFACE_SECTION; @@ -443,16 +456,16 @@ typedef struct { } EFI_USER_INTERFACE_SECTION2; /// -/// Leaf section which contains a numeric build number and -/// an optional unicode string that represents the file revision. -/// +/// The leaf section which contains a numeric build number and +/// an optional unicode string that represents the file revision. +/// typedef struct { EFI_COMMON_SECTION_HEADER CommonHeader; UINT16 BuildNumber; /// /// Array of unicode string. - /// + /// CHAR16 VersionString[1]; } EFI_VERSION_SECTION; @@ -466,8 +479,14 @@ typedef struct { CHAR16 VersionString[1]; } EFI_VERSION_SECTION2; +#define IS_SECTION2(SectionHeaderPtr) \ + ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) (UINTN) SectionHeaderPtr)->Size) & 0x00ffffff) == 0x00ffffff) + #define SECTION_SIZE(SectionHeaderPtr) \ - ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff)) + ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) (UINTN) SectionHeaderPtr)->Size) & 0x00ffffff)) + +#define SECTION2_SIZE(SectionHeaderPtr) \ + (((EFI_COMMON_SECTION_HEADER2 *) (UINTN) SectionHeaderPtr)->ExtendedSize) #pragma pack()