From nobody Wed Dec 25 14:53:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1509529626632723.6378171957982; Wed, 1 Nov 2017 02:47:06 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1832720347175; Wed, 1 Nov 2017 02:43:11 -0700 (PDT) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3783C21C913D3 for ; Wed, 1 Nov 2017 02:43:10 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2017 02:47:02 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.7]) by fmsmga004.fm.intel.com with ESMTP; 01 Nov 2017 02:47:01 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,327,1505804400"; d="scan'208";a="330481110" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Wed, 1 Nov 2017 17:46:58 +0800 Message-Id: <20171101094659.36992-2-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.12.2.windows.2 In-Reply-To: <20171101094659.36992-1-ruiyu.ni@intel.com> References: <20171101094659.36992-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH 1/2] MdePkg/Btt.h: Add Block Translation Table definitions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" BTT definitions are defined in UEFI spec 2.7, to defines a layout and set of rules for doing block I/O that provide powerfail write atomicity of a single block in NVDIMM. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Liming Gao --- MdePkg/Include/IndustryStandard/Btt.h | 229 ++++++++++++++++++++++++++++++= ++++ MdePkg/MdePkg.dec | 7 ++ 2 files changed, 236 insertions(+) create mode 100644 MdePkg/Include/IndustryStandard/Btt.h diff --git a/MdePkg/Include/IndustryStandard/Btt.h b/MdePkg/Include/Industr= yStandard/Btt.h new file mode 100644 index 0000000000..e7fab243a1 --- /dev/null +++ b/MdePkg/Include/IndustryStandard/Btt.h @@ -0,0 +1,229 @@ +/** @file + Block Translation Table (BTT) metadata layout definition. + + BTT is a layout and set of rules for doing block I/O that provide powerf= ail + write atomicity of a single block. + +Copyright (c) 2017, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made availabl= e under +the terms and conditions of the BSD License that accompanies this distribu= tion. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. + + @par Revision Reference: + This metadata layout definition was introduced in UEFI Specification 2.7. + +**/ + +#ifndef _BTT_H_ +#define _BTT_H_ + + +// +// Alignment of all BTT structures +// +#define EFI_BTT_ALIGNMENT 4096 + +#define EFI_BTT_INFO_UNUSED_LEN 3968 + +#define EFI_BTT_INFO_BLOCK_SIG_LEN 16 + +/// +/// Indicate inconsistent metadata or lost metadata due to unrecoverable m= edia errors. +/// +#define EFI_BTT_INFO_BLOCK_FLAGS_ERROR 0x00000001 + +#define EFI_BTT_INFO_BLOCK_MAJOR_VERSION 2 +#define EFI_BTT_INFO_BLOCK_MINOR_VERSION 0 + +/// +/// Block Translation Table (BTT) Info Block +/// +typedef struct _EFI_BTT_INFO_BLOCK { + /// + /// Signature of the BTT Index Block data structure. + /// Shall be "BTT_ARENA_INFO\0\0". + /// + CHAR8 Sig[EFI_BTT_INFO_BLOCK_SIG_LEN]; + + /// + /// UUID identifying this BTT instance. + /// + GUID Uuid; + + /// + /// UUID of containing namespace. + /// + GUID ParentUuid; + + /// + /// Attributes of this BTT Info Block. + /// + UINT32 Flags; + + /// + /// Major version number. Currently at version 2. + /// + UINT16 Major; + + /// + /// Minor version number. Currently at version 0. + /// + UINT16 Minor; + + /// + /// Advertised LBA size in bytes. I/O requests shall be in this size chu= nk. + /// + UINT32 ExternalLbaSize; + + /// + /// Advertised number of LBAs in this arena. + /// + UINT32 ExternalNLba; + + /// + /// Internal LBA size shall be greater than or equal to ExternalLbaSize = and shall not be smaller than 512 bytes. + /// + UINT32 InternalLbaSize; + + /// + /// Number of internal blocks in the arena data area. + /// + UINT32 InternalNLba; + + /// + /// Number of free blocks maintained for writes to this arena. + /// + UINT32 NFree; + + /// + /// The size of this info block in bytes. + /// + UINT32 InfoSize; + + /// + /// Offset of next arena, relative to the beginning of this arena. + /// + UINT64 NextOff; + + /// + /// Offset of the data area for this arena, relative to the beginning of= this arena. + /// + UINT64 DataOff; + + /// + /// Offset of the map for this arena, relative to the beginning of this = arena. + /// + UINT64 MapOff; + + /// + /// Offset of the flog for this arena, relative to the beginning of this= arena. + /// + UINT64 FlogOff; + + /// + /// Offset of the backup copy of this arena's info block, relative to th= e beginning of this arena. + /// + UINT64 InfoOff; + + /// + /// Shall be zero. + /// + CHAR8 Unused[EFI_BTT_INFO_UNUSED_LEN]; + + /// + /// 64-bit Fletcher64 checksum of all fields. + /// + UINT64 Checksum; +} EFI_BTT_INFO_BLOCK; + +/// +/// BTT Map entry maps an LBA that indexes into the arena, to its actual l= ocation. +/// +typedef struct _EFI_BTT_MAP_ENTRY { + /// + /// Post-map LBA number (block number in this arena's data area) + /// + UINT32 PostMapLba : 30; + + /// + /// When set and Zero is not set, reads on this block return an error. + /// When set and Zero is set, indicate a map entry in its normal, non-er= ror state. + /// + UINT32 Error : 1; + + /// + /// When set and Error is not set, reads on this block return a full blo= ck of zeros. + /// When set and Error is set, indicate a map entry in its normal, non-e= rror state. + /// + UINT32 Zero : 1; +} EFI_BTT_MAP_ENTRY; + +/// +/// Alignment of each flog structure +/// +#define EFI_BTT_FLOG_ENTRY_ALIGNMENT 64 + +/// +/// The BTT Flog is both a free list and a log. +/// The Flog size is determined by the EFI_BTT_INFO_BLOCK.NFree which dete= rmines how many of these flog +/// entries there are. +/// The Flog location is the highest aligned address in the arena after sp= ace for the backup info block. +/// +typedef struct _EFI_BTT_FLOG { + /// + /// Last pre-map LBA written using this flog entry. + /// + UINT32 Lba0; + + /// + /// Old post-map LBA. + /// + UINT32 OldMap0; + + /// + /// New post-map LBA. + /// + UINT32 NewMap0; + + /// + /// The Seq0 field in each flog entry is used to determine which set of = fields is newer between the two sets + /// (Lba0, OldMap0, NewMpa0, Seq0 vs Lba1, Oldmap1, NewMap1, Seq1). + /// + UINT32 Seq0; + + /// + /// Alternate lba entry. + /// + UINT32 Lba1; + + /// + /// Alternate old entry. + /// + UINT32 OldMap1; + + /// + /// Alternate new entry. + /// + UINT32 NewMap1; + + /// + /// Alternate Seq entry. + /// + UINT32 Seq1; +} EFI_BTT_FLOG; + +/// +/// The BTT layout and behavior is described by the AddressAbstractionGuid= as below. +/// +#define EFI_BTT_ABSTRACTION_GUID \ + { \ + 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3= , 0xf8 } \ + } + +extern GUID gEfiAddressAbstractionGuid; + +#endif //_BTT_H_ diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 1867c54c3b..39e31a4561 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -646,6 +646,13 @@ [Guids] gEfiHiiImageDecoderNamePngGuid =3D { 0xaf060190, 0x5e3a, 0x40= 25, { 0xaf, 0xbd, 0xe1, 0xf9, 0x05, 0xbf, 0xaa, 0x4c }} =20 # + # GUIDs defined in UEFI2.7 + # + + ## Include/IndustryStandard/Btt.h + gEfiAddressAbstractionGuid =3D { 0x18633bfc, 0x1735, 0x4217, { 0x8a,= 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 }} + + # # GUID defined in PI1.0 # ## Include/Guid/AprioriFileName.h --=20 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel