2 Block Translation Table (BTT) metadata layout definition.
4 BTT is a layout and set of rules for doing block I/O that provide powerfail
5 write atomicity of a single block.
7 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available under
9 the terms and conditions of the BSD License that accompanies this distribution.
10 The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 @par Revision Reference:
17 This metadata layout definition was introduced in UEFI Specification 2.7.
25 /// The BTT layout and behavior is described by the GUID as below.
27 #define EFI_BTT_ABSTRACTION_GUID \
29 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 } \
33 // Alignment of all BTT structures
35 #define EFI_BTT_ALIGNMENT 4096
37 #define EFI_BTT_INFO_UNUSED_LEN 3968
39 #define EFI_BTT_INFO_BLOCK_SIG_LEN 16
42 /// Indicate inconsistent metadata or lost metadata due to unrecoverable media errors.
44 #define EFI_BTT_INFO_BLOCK_FLAGS_ERROR 0x00000001
46 #define EFI_BTT_INFO_BLOCK_MAJOR_VERSION 2
47 #define EFI_BTT_INFO_BLOCK_MINOR_VERSION 0
50 /// Block Translation Table (BTT) Info Block
52 typedef struct _EFI_BTT_INFO_BLOCK
{
54 /// Signature of the BTT Index Block data structure.
55 /// Shall be "BTT_ARENA_INFO\0\0".
57 CHAR8 Sig
[EFI_BTT_INFO_BLOCK_SIG_LEN
];
60 /// UUID identifying this BTT instance.
65 /// UUID of containing namespace.
70 /// Attributes of this BTT Info Block.
75 /// Major version number. Currently at version 2.
80 /// Minor version number. Currently at version 0.
85 /// Advertised LBA size in bytes. I/O requests shall be in this size chunk.
87 UINT32 ExternalLbaSize
;
90 /// Advertised number of LBAs in this arena.
95 /// Internal LBA size shall be greater than or equal to ExternalLbaSize and shall not be smaller than 512 bytes.
97 UINT32 InternalLbaSize
;
100 /// Number of internal blocks in the arena data area.
105 /// Number of free blocks maintained for writes to this arena.
110 /// The size of this info block in bytes.
115 /// Offset of next arena, relative to the beginning of this arena.
120 /// Offset of the data area for this arena, relative to the beginning of this arena.
125 /// Offset of the map for this arena, relative to the beginning of this arena.
130 /// Offset of the flog for this arena, relative to the beginning of this arena.
135 /// Offset of the backup copy of this arena's info block, relative to the beginning of this arena.
142 CHAR8 Unused
[EFI_BTT_INFO_UNUSED_LEN
];
145 /// 64-bit Fletcher64 checksum of all fields.
148 } EFI_BTT_INFO_BLOCK
;
151 /// BTT Map entry maps an LBA that indexes into the arena, to its actual location.
153 typedef struct _EFI_BTT_MAP_ENTRY
{
155 /// Post-map LBA number (block number in this arena's data area)
157 UINT32 PostMapLba
: 30;
160 /// When set and Zero is not set, reads on this block return an error.
161 /// When set and Zero is set, indicate a map entry in its normal, non-error state.
166 /// When set and Error is not set, reads on this block return a full block of zeros.
167 /// When set and Error is set, indicate a map entry in its normal, non-error state.
173 /// Alignment of each flog structure
175 #define EFI_BTT_FLOG_ENTRY_ALIGNMENT 64
178 /// The BTT Flog is both a free list and a log.
179 /// The Flog size is determined by the EFI_BTT_INFO_BLOCK.NFree which determines how many of these flog
180 /// entries there are.
181 /// The Flog location is the highest aligned address in the arena after space for the backup info block.
183 typedef struct _EFI_BTT_FLOG
{
185 /// Last pre-map LBA written using this flog entry.
190 /// Old post-map LBA.
195 /// New post-map LBA.
200 /// The Seq0 field in each flog entry is used to determine which set of fields is newer between the two sets
201 /// (Lba0, OldMap0, NewMpa0, Seq0 vs Lba1, Oldmap1, NewMap1, Seq1).
206 /// Alternate lba entry.
211 /// Alternate old entry.
216 /// Alternate new entry.
221 /// Alternate Seq entry.
226 extern GUID gEfiBttAbstractionGuid
;