00001 /** @file 00002 The firmware file related definitions in PI. 00003 00004 Copyright (c) 2006 - 2008, Intel Corporation 00005 All rights reserved. This program and the accompanying materials 00006 are licensed and made available under the terms and conditions of the BSD License 00007 which accompanies this distribution. The full text of the license may be found at 00008 http://opensource.org/licenses/bsd-license.php 00009 00010 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 00011 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 00012 00013 @par Revision Reference: 00014 PI Version 1.0 00015 00016 **/ 00017 00018 00019 #ifndef __PI_FIRMWARE_FILE_H__ 00020 #define __PI_FIRMWARE_FILE_H__ 00021 00022 #include <gpxe/efi/ProcessorBind.h> 00023 00024 #pragma pack(1) 00025 /// 00026 /// Used to verify the integrity of the file. 00027 /// 00028 typedef union { 00029 struct { 00030 UINT8 Header; 00031 UINT8 File; 00032 } Checksum; 00033 UINT16 Checksum16; 00034 } EFI_FFS_INTEGRITY_CHECK; 00035 00036 typedef UINT8 EFI_FV_FILETYPE; 00037 typedef UINT8 EFI_FFS_FILE_ATTRIBUTES; 00038 typedef UINT8 EFI_FFS_FILE_STATE; 00039 00040 /// 00041 /// File Types Definitions 00042 /// 00043 #define EFI_FV_FILETYPE_ALL 0x00 00044 #define EFI_FV_FILETYPE_RAW 0x01 00045 #define EFI_FV_FILETYPE_FREEFORM 0x02 00046 #define EFI_FV_FILETYPE_SECURITY_CORE 0x03 00047 #define EFI_FV_FILETYPE_PEI_CORE 0x04 00048 #define EFI_FV_FILETYPE_DXE_CORE 0x05 00049 #define EFI_FV_FILETYPE_PEIM 0x06 00050 #define EFI_FV_FILETYPE_DRIVER 0x07 00051 #define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08 00052 #define EFI_FV_FILETYPE_APPLICATION 0x09 00053 #define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B 00054 #define EFI_FV_FILETYPE_OEM_MIN 0xc0 00055 #define EFI_FV_FILETYPE_OEM_MAX 0xdf 00056 #define EFI_FV_FILETYPE_DEBUG_MIN 0xe0 00057 #define EFI_FV_FILETYPE_DEBUG_MAX 0xef 00058 #define EFI_FV_FILETYPE_FFS_MIN 0xf0 00059 #define EFI_FV_FILETYPE_FFS_MAX 0xff 00060 #define EFI_FV_FILETYPE_FFS_PAD 0xf0 00061 /// 00062 /// FFS File Attributes. 00063 /// 00064 #define FFS_ATTRIB_FIXED 0x04 00065 #define FFS_ATTRIB_DATA_ALIGNMENT 0x38 00066 #define FFS_ATTRIB_CHECKSUM 0x40 00067 00068 /// 00069 /// FFS File State Bits. 00070 /// 00071 #define EFI_FILE_HEADER_CONSTRUCTION 0x01 00072 #define EFI_FILE_HEADER_VALID 0x02 00073 #define EFI_FILE_DATA_VALID 0x04 00074 #define EFI_FILE_MARKED_FOR_UPDATE 0x08 00075 #define EFI_FILE_DELETED 0x10 00076 #define EFI_FILE_HEADER_INVALID 0x20 00077 00078 00079 /// 00080 /// Each file begins with the header that describe the 00081 /// contents and state of the files. 00082 /// 00083 typedef struct { 00084 EFI_GUID Name; 00085 EFI_FFS_INTEGRITY_CHECK IntegrityCheck; 00086 EFI_FV_FILETYPE Type; 00087 EFI_FFS_FILE_ATTRIBUTES Attributes; 00088 UINT8 Size[3]; 00089 EFI_FFS_FILE_STATE State; 00090 } EFI_FFS_FILE_HEADER; 00091 00092 00093 typedef UINT8 EFI_SECTION_TYPE; 00094 00095 /// 00096 /// Pseudo type. It is 00097 /// used as a wild card when retrieving sections. The section 00098 /// type EFI_SECTION_ALL matches all section types. 00099 /// 00100 #define EFI_SECTION_ALL 0x00 00101 00102 /// 00103 /// Encapsulation section Type values 00104 /// 00105 #define EFI_SECTION_COMPRESSION 0x01 00106 00107 #define EFI_SECTION_GUID_DEFINED 0x02 00108 00109 /// 00110 /// Leaf section Type values 00111 /// 00112 #define EFI_SECTION_PE32 0x10 00113 #define EFI_SECTION_PIC 0x11 00114 #define EFI_SECTION_TE 0x12 00115 #define EFI_SECTION_DXE_DEPEX 0x13 00116 #define EFI_SECTION_VERSION 0x14 00117 #define EFI_SECTION_USER_INTERFACE 0x15 00118 #define EFI_SECTION_COMPATIBILITY16 0x16 00119 #define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17 00120 #define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18 00121 #define EFI_SECTION_RAW 0x19 00122 #define EFI_SECTION_PEI_DEPEX 0x1B 00123 00124 /// 00125 /// Common section header 00126 /// 00127 typedef struct { 00128 UINT8 Size[3]; 00129 EFI_SECTION_TYPE Type; 00130 } EFI_COMMON_SECTION_HEADER; 00131 00132 /// 00133 /// Leaf section type that contains an 00134 /// IA-32 16-bit executable image. 00135 /// 00136 typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION; 00137 00138 /// 00139 /// CompressionType of EFI_COMPRESSION_SECTION. 00140 /// 00141 #define EFI_NOT_COMPRESSED 0x00 00142 #define EFI_STANDARD_COMPRESSION 0x01 00143 /// 00144 /// An encapsulation section type in which the 00145 /// section data is compressed. 00146 /// 00147 typedef struct { 00148 EFI_COMMON_SECTION_HEADER CommonHeader; 00149 UINT32 UncompressedLength; 00150 UINT8 CompressionType; 00151 } EFI_COMPRESSION_SECTION; 00152 00153 /// 00154 /// Leaf section which could be used to determine the dispatch order of DXEs. 00155 /// 00156 typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION; 00157 00158 /// 00159 /// Leaf section which contains a PI FV. 00160 /// 00161 typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION; 00162 00163 /// 00164 /// Leaf section which contains a single GUID. 00165 /// 00166 typedef struct { 00167 EFI_COMMON_SECTION_HEADER CommonHeader; 00168 EFI_GUID SubTypeGuid; 00169 } EFI_FREEFORM_SUBTYPE_GUID_SECTION; 00170 00171 /// 00172 /// Attributes of EFI_GUID_DEFINED_SECTION 00173 /// 00174 #define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01 00175 #define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02 00176 /// 00177 /// Leaf section which is encapsulation defined by specific GUID 00178 /// 00179 typedef struct { 00180 EFI_COMMON_SECTION_HEADER CommonHeader; 00181 EFI_GUID SectionDefinitionGuid; 00182 UINT16 DataOffset; 00183 UINT16 Attributes; 00184 } EFI_GUID_DEFINED_SECTION; 00185 00186 /// 00187 /// Leaf section which contains PE32+ image. 00188 /// 00189 typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION; 00190 00191 00192 /// 00193 /// Leaf section which used to determine the dispatch order of PEIMs. 00194 /// 00195 typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION; 00196 00197 /// 00198 /// Leaf section which constains the position-independent-code image. 00199 /// 00200 typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION; 00201 00202 /// 00203 /// Leaf section which contains an array of zero or more bytes. 00204 /// 00205 typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION; 00206 00207 /// 00208 /// Leaf section which contains a unicode string that 00209 /// is human readable file name. 00210 /// 00211 typedef struct { 00212 EFI_COMMON_SECTION_HEADER CommonHeader; 00213 00214 /// 00215 /// Array of unicode string. 00216 /// 00217 CHAR16 FileNameString[1]; 00218 } EFI_USER_INTERFACE_SECTION; 00219 00220 00221 /// 00222 /// Leaf section which contains a numeric build number and 00223 /// an optional unicode string that represents the file revision. 00224 /// 00225 typedef struct { 00226 EFI_COMMON_SECTION_HEADER CommonHeader; 00227 UINT16 BuildNumber; 00228 00229 /// 00230 /// Array of unicode string. 00231 /// 00232 CHAR16 VersionString[1]; 00233 } EFI_VERSION_SECTION; 00234 00235 00236 #define SECTION_SIZE(SectionHeaderPtr) \ 00237 ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff)) 00238 00239 #pragma pack() 00240 00241 #endif 00242
1.5.7.1