Path: blob/main/sys/contrib/edk2/Include/Pi/PiFirmwareVolume.h
96339 views
/** @file1The firmware volume related definitions in PI.23Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>4SPDX-License-Identifier: BSD-2-Clause-Patent56@par Revision Reference:7PI Version 1.689**/1011#ifndef __PI_FIRMWAREVOLUME_H__12#define __PI_FIRMWAREVOLUME_H__1314///15/// EFI_FV_FILE_ATTRIBUTES16///17typedef UINT32 EFI_FV_FILE_ATTRIBUTES;1819//20// Value of EFI_FV_FILE_ATTRIBUTES.21//22#define EFI_FV_FILE_ATTRIB_ALIGNMENT 0x0000001F23#define EFI_FV_FILE_ATTRIB_FIXED 0x0000010024#define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED 0x000002002526///27/// type of EFI FVB attribute28///29typedef UINT32 EFI_FVB_ATTRIBUTES_2;3031//32// Attributes bit definitions33//34#define EFI_FVB2_READ_DISABLED_CAP 0x0000000135#define EFI_FVB2_READ_ENABLED_CAP 0x0000000236#define EFI_FVB2_READ_STATUS 0x0000000437#define EFI_FVB2_WRITE_DISABLED_CAP 0x0000000838#define EFI_FVB2_WRITE_ENABLED_CAP 0x0000001039#define EFI_FVB2_WRITE_STATUS 0x0000002040#define EFI_FVB2_LOCK_CAP 0x0000004041#define EFI_FVB2_LOCK_STATUS 0x0000008042#define EFI_FVB2_STICKY_WRITE 0x0000020043#define EFI_FVB2_MEMORY_MAPPED 0x0000040044#define EFI_FVB2_ERASE_POLARITY 0x0000080045#define EFI_FVB2_READ_LOCK_CAP 0x0000100046#define EFI_FVB2_READ_LOCK_STATUS 0x0000200047#define EFI_FVB2_WRITE_LOCK_CAP 0x0000400048#define EFI_FVB2_WRITE_LOCK_STATUS 0x0000800049#define EFI_FVB2_ALIGNMENT 0x001F000050#define EFI_FVB2_ALIGNMENT_1 0x0000000051#define EFI_FVB2_ALIGNMENT_2 0x0001000052#define EFI_FVB2_ALIGNMENT_4 0x0002000053#define EFI_FVB2_ALIGNMENT_8 0x0003000054#define EFI_FVB2_ALIGNMENT_16 0x0004000055#define EFI_FVB2_ALIGNMENT_32 0x0005000056#define EFI_FVB2_ALIGNMENT_64 0x0006000057#define EFI_FVB2_ALIGNMENT_128 0x0007000058#define EFI_FVB2_ALIGNMENT_256 0x0008000059#define EFI_FVB2_ALIGNMENT_512 0x0009000060#define EFI_FVB2_ALIGNMENT_1K 0x000A000061#define EFI_FVB2_ALIGNMENT_2K 0x000B000062#define EFI_FVB2_ALIGNMENT_4K 0x000C000063#define EFI_FVB2_ALIGNMENT_8K 0x000D000064#define EFI_FVB2_ALIGNMENT_16K 0x000E000065#define EFI_FVB2_ALIGNMENT_32K 0x000F000066#define EFI_FVB2_ALIGNMENT_64K 0x0010000067#define EFI_FVB2_ALIGNMENT_128K 0x0011000068#define EFI_FVB2_ALIGNMENT_256K 0x0012000069#define EFI_FVB2_ALIGNMENT_512K 0x0013000070#define EFI_FVB2_ALIGNMENT_1M 0x0014000071#define EFI_FVB2_ALIGNMENT_2M 0x0015000072#define EFI_FVB2_ALIGNMENT_4M 0x0016000073#define EFI_FVB2_ALIGNMENT_8M 0x0017000074#define EFI_FVB2_ALIGNMENT_16M 0x0018000075#define EFI_FVB2_ALIGNMENT_32M 0x0019000076#define EFI_FVB2_ALIGNMENT_64M 0x001A000077#define EFI_FVB2_ALIGNMENT_128M 0x001B000078#define EFI_FVB2_ALIGNMENT_256M 0x001C000079#define EFI_FVB2_ALIGNMENT_512M 0x001D000080#define EFI_FVB2_ALIGNMENT_1G 0x001E000081#define EFI_FVB2_ALIGNMENT_2G 0x001F000082#define EFI_FVB2_WEAK_ALIGNMENT 0x800000008384typedef struct {85///86/// The number of sequential blocks which are of the same size.87///88UINT32 NumBlocks;89///90/// The size of the blocks.91///92UINT32 Length;93} EFI_FV_BLOCK_MAP_ENTRY;9495///96/// Describes the features and layout of the firmware volume.97///98typedef struct {99///100/// The first 16 bytes are reserved to allow for the reset vector of101/// processors whose reset vector is at address 0.102///103UINT8 ZeroVector[16];104///105/// Declares the file system with which the firmware volume is formatted.106///107EFI_GUID FileSystemGuid;108///109/// Length in bytes of the complete firmware volume, including the header.110///111UINT64 FvLength;112///113/// Set to EFI_FVH_SIGNATURE114///115UINT32 Signature;116///117/// Declares capabilities and power-on defaults for the firmware volume.118///119EFI_FVB_ATTRIBUTES_2 Attributes;120///121/// Length in bytes of the complete firmware volume header.122///123UINT16 HeaderLength;124///125/// A 16-bit checksum of the firmware volume header. A valid header sums to zero.126///127UINT16 Checksum;128///129/// Offset, relative to the start of the header, of the extended header130/// (EFI_FIRMWARE_VOLUME_EXT_HEADER) or zero if there is no extended header.131///132UINT16 ExtHeaderOffset;133///134/// This field must always be set to zero.135///136UINT8 Reserved[1];137///138/// Set to 2. Future versions of this specification may define new header fields and will139/// increment the Revision field accordingly.140///141UINT8 Revision;142///143/// An array of run-length encoded FvBlockMapEntry structures. The array is144/// terminated with an entry of {0,0}.145///146EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];147} EFI_FIRMWARE_VOLUME_HEADER;148149#define EFI_FVH_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', 'H')150151///152/// Firmware Volume Header Revision definition153///154#define EFI_FVH_REVISION 0x02155156///157/// Extension header pointed by ExtHeaderOffset of volume header.158///159typedef struct {160///161/// Firmware volume name.162///163EFI_GUID FvName;164///165/// Size of the rest of the extension header, including this structure.166///167UINT32 ExtHeaderSize;168} EFI_FIRMWARE_VOLUME_EXT_HEADER;169170///171/// Entry struture for describing FV extension header172///173typedef struct {174///175/// Size of this header extension.176///177UINT16 ExtEntrySize;178///179/// Type of the header.180///181UINT16 ExtEntryType;182} EFI_FIRMWARE_VOLUME_EXT_ENTRY;183184#define EFI_FV_EXT_TYPE_OEM_TYPE 0x01185///186/// This extension header provides a mapping between a GUID and an OEM file type.187///188typedef struct {189///190/// Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.191///192EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;193///194/// A bit mask, one bit for each file type between 0xC0 (bit 0) and 0xDF (bit 31). If a bit195/// is '1', then the GUID entry exists in Types. If a bit is '0' then no GUID entry exists in Types.196///197UINT32 TypeMask;198///199/// An array of GUIDs, each GUID representing an OEM file type.200///201/// EFI_GUID Types[1];202///203} EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;204205#define EFI_FV_EXT_TYPE_GUID_TYPE 0x0002206207///208/// This extension header EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE provides a vendor specific209/// GUID FormatType type which includes a length and a successive series of data bytes.210///211typedef struct {212///213/// Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.214///215EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;216///217/// Vendor-specific GUID.218///219EFI_GUID FormatType;220///221/// An arry of bytes of length Length.222///223/// UINT8 Data[1];224///225} EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE;226227#define EFI_FV_EXT_TYPE_USED_SIZE_TYPE 0x03228229///230/// The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find231/// out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV.232///233typedef struct {234///235/// Standard extension entry, with the type EFI_FV_EXT_TYPE_USED_SIZE_TYPE.236///237EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;238///239/// The number of bytes of the FV that are in uses. The remaining240/// EFI_FIRMWARE_VOLUME_HEADER FvLength minus UsedSize bytes in241/// the FV must contain the value implied by EFI_FVB2_ERASE_POLARITY.242///243UINT32 UsedSize;244} EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE;245246#endif247248249