iPXE
PiFirmwareVolume.h
Go to the documentation of this file.
00001 /** @file
00002   The firmware volume related definitions in PI.
00003 
00004   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
00005   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.3
00015 
00016 **/
00017 
00018 #ifndef __PI_FIRMWAREVOLUME_H__
00019 #define __PI_FIRMWAREVOLUME_H__
00020 
00021 FILE_LICENCE ( BSD3 );
00022 
00023 ///
00024 /// EFI_FV_FILE_ATTRIBUTES
00025 ///
00026 typedef UINT32  EFI_FV_FILE_ATTRIBUTES;
00027 
00028 //
00029 // Value of EFI_FV_FILE_ATTRIBUTES.
00030 //
00031 #define EFI_FV_FILE_ATTRIB_ALIGNMENT      0x0000001F
00032 #define EFI_FV_FILE_ATTRIB_FIXED          0x00000100
00033 #define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED  0x00000200
00034 
00035 ///
00036 /// type of EFI FVB attribute
00037 ///
00038 typedef UINT32  EFI_FVB_ATTRIBUTES_2;
00039 
00040 //
00041 // Attributes bit definitions
00042 //
00043 #define EFI_FVB2_READ_DISABLED_CAP  0x00000001
00044 #define EFI_FVB2_READ_ENABLED_CAP   0x00000002
00045 #define EFI_FVB2_READ_STATUS        0x00000004
00046 #define EFI_FVB2_WRITE_DISABLED_CAP 0x00000008
00047 #define EFI_FVB2_WRITE_ENABLED_CAP  0x00000010
00048 #define EFI_FVB2_WRITE_STATUS       0x00000020
00049 #define EFI_FVB2_LOCK_CAP           0x00000040
00050 #define EFI_FVB2_LOCK_STATUS        0x00000080
00051 #define EFI_FVB2_STICKY_WRITE       0x00000200
00052 #define EFI_FVB2_MEMORY_MAPPED      0x00000400
00053 #define EFI_FVB2_ERASE_POLARITY     0x00000800
00054 #define EFI_FVB2_READ_LOCK_CAP      0x00001000
00055 #define EFI_FVB2_READ_LOCK_STATUS   0x00002000
00056 #define EFI_FVB2_WRITE_LOCK_CAP     0x00004000
00057 #define EFI_FVB2_WRITE_LOCK_STATUS  0x00008000
00058 #define EFI_FVB2_ALIGNMENT          0x001F0000
00059 #define EFI_FVB2_ALIGNMENT_1        0x00000000
00060 #define EFI_FVB2_ALIGNMENT_2        0x00010000
00061 #define EFI_FVB2_ALIGNMENT_4        0x00020000
00062 #define EFI_FVB2_ALIGNMENT_8        0x00030000
00063 #define EFI_FVB2_ALIGNMENT_16       0x00040000
00064 #define EFI_FVB2_ALIGNMENT_32       0x00050000
00065 #define EFI_FVB2_ALIGNMENT_64       0x00060000
00066 #define EFI_FVB2_ALIGNMENT_128      0x00070000
00067 #define EFI_FVB2_ALIGNMENT_256      0x00080000
00068 #define EFI_FVB2_ALIGNMENT_512      0x00090000
00069 #define EFI_FVB2_ALIGNMENT_1K       0x000A0000
00070 #define EFI_FVB2_ALIGNMENT_2K       0x000B0000
00071 #define EFI_FVB2_ALIGNMENT_4K       0x000C0000
00072 #define EFI_FVB2_ALIGNMENT_8K       0x000D0000
00073 #define EFI_FVB2_ALIGNMENT_16K      0x000E0000
00074 #define EFI_FVB2_ALIGNMENT_32K      0x000F0000
00075 #define EFI_FVB2_ALIGNMENT_64K      0x00100000
00076 #define EFI_FVB2_ALIGNMENT_128K     0x00110000
00077 #define EFI_FVB2_ALIGNMENT_256K     0x00120000
00078 #define EFI_FVB2_ALIGNMENT_512K     0x00130000
00079 #define EFI_FVB2_ALIGNMENT_1M       0x00140000
00080 #define EFI_FVB2_ALIGNMENT_2M       0x00150000
00081 #define EFI_FVB2_ALIGNMENT_4M       0x00160000
00082 #define EFI_FVB2_ALIGNMENT_8M       0x00170000
00083 #define EFI_FVB2_ALIGNMENT_16M      0x00180000
00084 #define EFI_FVB2_ALIGNMENT_32M      0x00190000
00085 #define EFI_FVB2_ALIGNMENT_64M      0x001A0000
00086 #define EFI_FVB2_ALIGNMENT_128M     0x001B0000
00087 #define EFI_FVB2_ALIGNMENT_256M     0x001C0000
00088 #define EFI_FVB2_ALIGNMENT_512M     0x001D0000
00089 #define EFI_FVB2_ALIGNMENT_1G       0x001E0000
00090 #define EFI_FVB2_ALIGNMENT_2G       0x001F0000
00091 #define EFI_FVB2_WEAK_ALIGNMENT     0x80000000
00092 
00093 typedef struct {
00094   ///
00095   /// The number of sequential blocks which are of the same size.
00096   ///
00097   UINT32 NumBlocks;
00098   ///
00099   /// The size of the blocks.
00100   ///
00101   UINT32 Length;
00102 } EFI_FV_BLOCK_MAP_ENTRY;
00103 
00104 ///
00105 /// Describes the features and layout of the firmware volume.
00106 ///
00107 typedef struct {
00108   ///
00109   /// The first 16 bytes are reserved to allow for the reset vector of
00110   /// processors whose reset vector is at address 0.
00111   ///
00112   UINT8                     ZeroVector[16];
00113   ///
00114   /// Declares the file system with which the firmware volume is formatted.
00115   ///
00116   EFI_GUID                  FileSystemGuid;
00117   ///
00118   /// Length in bytes of the complete firmware volume, including the header.
00119   ///
00120   UINT64                    FvLength;
00121   ///
00122   /// Set to EFI_FVH_SIGNATURE
00123   ///
00124   UINT32                    Signature;
00125   ///
00126   /// Declares capabilities and power-on defaults for the firmware volume.
00127   ///
00128   EFI_FVB_ATTRIBUTES_2      Attributes;
00129   ///
00130   /// Length in bytes of the complete firmware volume header.
00131   ///
00132   UINT16                    HeaderLength;
00133   ///
00134   /// A 16-bit checksum of the firmware volume header. A valid header sums to zero.
00135   ///
00136   UINT16                    Checksum;
00137   ///
00138   /// Offset, relative to the start of the header, of the extended header
00139   /// (EFI_FIRMWARE_VOLUME_EXT_HEADER) or zero if there is no extended header.
00140   ///
00141   UINT16                    ExtHeaderOffset;
00142   ///
00143   /// This field must always be set to zero.
00144   ///
00145   UINT8                     Reserved[1];
00146   ///
00147   /// Set to 2. Future versions of this specification may define new header fields and will
00148   /// increment the Revision field accordingly.
00149   ///
00150   UINT8                     Revision;
00151   ///
00152   /// An array of run-length encoded FvBlockMapEntry structures. The array is
00153   /// terminated with an entry of {0,0}.
00154   ///
00155   EFI_FV_BLOCK_MAP_ENTRY    BlockMap[1];
00156 } EFI_FIRMWARE_VOLUME_HEADER;
00157 
00158 #define EFI_FVH_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', 'H')
00159 
00160 ///
00161 /// Firmware Volume Header Revision definition
00162 ///
00163 #define EFI_FVH_REVISION  0x02
00164 
00165 ///
00166 /// Extension header pointed by ExtHeaderOffset of volume header.
00167 ///
00168 typedef struct {
00169   ///
00170   /// Firmware volume name.
00171   ///
00172   EFI_GUID  FvName;
00173   ///
00174   /// Size of the rest of the extension header, including this structure.
00175   ///
00176   UINT32    ExtHeaderSize;
00177 } EFI_FIRMWARE_VOLUME_EXT_HEADER;
00178 
00179 ///
00180 /// Entry struture for describing FV extension header
00181 ///
00182 typedef struct {
00183   ///
00184   /// Size of this header extension.
00185   ///
00186   UINT16    ExtEntrySize;
00187   ///
00188   /// Type of the header.
00189   ///
00190   UINT16    ExtEntryType;
00191 } EFI_FIRMWARE_VOLUME_EXT_ENTRY;
00192 
00193 #define EFI_FV_EXT_TYPE_OEM_TYPE  0x01
00194 ///
00195 /// This extension header provides a mapping between a GUID and an OEM file type.
00196 ///
00197 typedef struct {
00198   ///
00199   /// Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.
00200   ///
00201   EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
00202   ///
00203   /// A bit mask, one bit for each file type between 0xC0 (bit 0) and 0xDF (bit 31). If a bit
00204   /// is '1', then the GUID entry exists in Types. If a bit is '0' then no GUID entry exists in Types.
00205   ///
00206   UINT32    TypeMask;
00207   ///
00208   /// An array of GUIDs, each GUID representing an OEM file type.
00209   ///
00210   /// EFI_GUID  Types[1];
00211   ///
00212 } EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;
00213 
00214 #define EFI_FV_EXT_TYPE_GUID_TYPE 0x0002
00215 
00216 ///
00217 /// This extension header EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE provides a vendor specific
00218 /// GUID FormatType type which includes a length and a successive series of data bytes.
00219 ///
00220 typedef struct {
00221   ///
00222   /// Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.
00223   ///
00224   EFI_FIRMWARE_VOLUME_EXT_ENTRY     Hdr;
00225   ///
00226   /// Vendor-specific GUID.
00227   ///
00228   EFI_GUID                          FormatType;
00229   ///
00230   /// An arry of bytes of length Length.
00231   ///
00232   /// UINT8                             Data[1];
00233   ///
00234 } EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE;
00235 
00236 #endif