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 SPDX-License-Identifier: BSD-2-Clause-Patent
10 @par Revision Reference:
11 This metadata layout definition was introduced in UEFI Specification 2.7.
19 /// The BTT layout and behavior is described by the GUID as below.
21 #define EFI_BTT_ABSTRACTION_GUID \
23 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 } \
27 // Alignment of all BTT structures
29 #define EFI_BTT_ALIGNMENT 4096
31 #define EFI_BTT_INFO_UNUSED_LEN 3968
33 #define EFI_BTT_INFO_BLOCK_SIG_LEN 16
36 /// Indicate inconsistent metadata or lost metadata due to unrecoverable media errors.
38 #define EFI_BTT_INFO_BLOCK_FLAGS_ERROR 0x00000001
40 #define EFI_BTT_INFO_BLOCK_MAJOR_VERSION 2
41 #define EFI_BTT_INFO_BLOCK_MINOR_VERSION 0
44 /// Block Translation Table (BTT) Info Block
46 typedef struct _EFI_BTT_INFO_BLOCK
{
48 /// Signature of the BTT Index Block data structure.
49 /// Shall be "BTT_ARENA_INFO\0\0".
51 CHAR8 Sig
[EFI_BTT_INFO_BLOCK_SIG_LEN
];
54 /// UUID identifying this BTT instance.
59 /// UUID of containing namespace.
64 /// Attributes of this BTT Info Block.
69 /// Major version number. Currently at version 2.
74 /// Minor version number. Currently at version 0.
79 /// Advertised LBA size in bytes. I/O requests shall be in this size chunk.
81 UINT32 ExternalLbaSize
;
84 /// Advertised number of LBAs in this arena.
89 /// Internal LBA size shall be greater than or equal to ExternalLbaSize and shall not be smaller than 512 bytes.
91 UINT32 InternalLbaSize
;
94 /// Number of internal blocks in the arena data area.
99 /// Number of free blocks maintained for writes to this arena.
104 /// The size of this info block in bytes.
109 /// Offset of next arena, relative to the beginning of this arena.
114 /// Offset of the data area for this arena, relative to the beginning of this arena.
119 /// Offset of the map for this arena, relative to the beginning of this arena.
124 /// Offset of the flog for this arena, relative to the beginning of this arena.
129 /// Offset of the backup copy of this arena's info block, relative to the beginning of this arena.
136 CHAR8 Unused
[EFI_BTT_INFO_UNUSED_LEN
];
139 /// 64-bit Fletcher64 checksum of all fields.
142 } EFI_BTT_INFO_BLOCK
;
145 /// BTT Map entry maps an LBA that indexes into the arena, to its actual location.
147 typedef struct _EFI_BTT_MAP_ENTRY
{
149 /// Post-map LBA number (block number in this arena's data area)
151 UINT32 PostMapLba
: 30;
154 /// When set and Zero is not set, reads on this block return an error.
155 /// When set and Zero is set, indicate a map entry in its normal, non-error state.
160 /// When set and Error is not set, reads on this block return a full block of zeros.
161 /// When set and Error is set, indicate a map entry in its normal, non-error state.
167 /// Alignment of each flog structure
169 #define EFI_BTT_FLOG_ENTRY_ALIGNMENT 64
172 /// The BTT Flog is both a free list and a log.
173 /// The Flog size is determined by the EFI_BTT_INFO_BLOCK.NFree which determines how many of these flog
174 /// entries there are.
175 /// The Flog location is the highest aligned address in the arena after space for the backup info block.
177 typedef struct _EFI_BTT_FLOG
{
179 /// Last pre-map LBA written using this flog entry.
184 /// Old post-map LBA.
189 /// New post-map LBA.
194 /// The Seq0 field in each flog entry is used to determine which set of fields is newer between the two sets
195 /// (Lba0, OldMap0, NewMpa0, Seq0 vs Lba1, Oldmap1, NewMap1, Seq1).
200 /// Alternate lba entry.
205 /// Alternate old entry.
210 /// Alternate new entry.
215 /// Alternate Seq entry.
220 extern GUID gEfiBttAbstractionGuid
;