X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=BaseTools%2FSource%2FC%2FInclude%2FCommon%2FPiFirmwareFile.h;h=7d8acb669b69a379f06a78b500bf70306575f040;hb=d3b3ee09a675cca1617a21a4f967457f92ebe3a6;hp=8c54021393b5f742969071437dc5dd0da20478da;hpb=116f23e8b22001249212f1ed945920994584c220;p=mirror_edk2.git diff --git a/BaseTools/Source/C/Include/Common/PiFirmwareFile.h b/BaseTools/Source/C/Include/Common/PiFirmwareFile.h index 8c54021393..7d8acb669b 100644 --- a/BaseTools/Source/C/Include/Common/PiFirmwareFile.h +++ b/BaseTools/Source/C/Include/Common/PiFirmwareFile.h @@ -1,18 +1,12 @@ /** @file The firmware file related definitions in PI. - + @par Revision Reference: Version 1.4. - 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 which accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -22,7 +16,7 @@ #pragma pack(1) // // Used to verify the integrity of the file. -// +// typedef union { struct { UINT8 Header; @@ -37,7 +31,7 @@ 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 @@ -61,10 +55,11 @@ 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_DATA_ALIGNMENT2 0x02 #define FFS_ATTRIB_FIXED 0x04 #define FFS_ATTRIB_DATA_ALIGNMENT 0x38 #define FFS_ATTRIB_CHECKSUM 0x40 @@ -74,9 +69,9 @@ typedef UINT8 EFI_FFS_FILE_STATE; // #define FFS_FIXED_CHECKSUM 0xAA -// +// // FFS File State Bits. -// +// #define EFI_FILE_HEADER_CONSTRUCTION 0x01 #define EFI_FILE_HEADER_VALID 0x02 #define EFI_FILE_DATA_VALID 0x04 @@ -93,9 +88,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 { EFI_GUID Name; EFI_FFS_INTEGRITY_CHECK IntegrityCheck; @@ -163,21 +158,21 @@ typedef struct { #define MAX_SECTION_SIZE 0x1000000 // -// 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 { EFI_COMMON_SECTION_HEADER CommonHeader; UINT32 UncompressedLength; @@ -192,19 +187,19 @@ typedef struct { // // 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 witch 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. -// +// typedef struct { EFI_COMMON_SECTION_HEADER CommonHeader; EFI_GUID SubTypeGuid; @@ -217,12 +212,12 @@ typedef struct { // // 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 -// +// typedef struct { EFI_COMMON_SECTION_HEADER CommonHeader; EFI_GUID SectionDefinitionGuid; @@ -239,44 +234,44 @@ typedef struct { // // 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 contains PIC image. -// +// typedef EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_PIC_SECTION2; // // Leaf section which 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; // // 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. -// +// typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION; typedef EFI_COMMON_SECTION_HEADER2 EFI_RAW_SECTION2; // -// Leaf section which contains a unicode string that +// 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; @@ -285,14 +280,14 @@ typedef struct { // // Array of unicode string. - // + // CHAR16 FileNameString[1]; } EFI_USER_INTERFACE_SECTION2; // // Leaf section which contains a numeric build number and -// an optional unicode string that represent the file revision. -// +// an optional unicode string that represent the file revision. +// typedef struct { EFI_COMMON_SECTION_HEADER CommonHeader; UINT16 BuildNumber; @@ -305,8 +300,15 @@ typedef struct { CHAR16 VersionString[1]; } EFI_VERSION_SECTION2; -#define SECTION_SIZE(SectionHeaderPtr) \ - ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff)) +// +// The argument passed as the SectionHeaderPtr parameter to the SECTION_SIZE() +// function-like macro below must not have side effects: SectionHeaderPtr is +// evaluated multiple times. +// +#define SECTION_SIZE(SectionHeaderPtr) ((UINT32) ( \ + (((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[0] ) | \ + (((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[1] << 8) | \ + (((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[2] << 16))) #pragma pack()