]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg/NvdimmLabel.h: Add NVDIMM_LABEL protocol definition
authorRuiyu Ni <ruiyu.ni@intel.com>
Wed, 1 Nov 2017 09:34:52 +0000 (17:34 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Thu, 9 Nov 2017 03:09:16 +0000 (11:09 +0800)
NVDIMM_LABEL protocol is defined in UEFI 2.7 spec, to provide
services that allow management of labels contained in a Label
Storage Area in NVDIMM.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Include/Protocol/NvdimmLabel.h [new file with mode: 0644]
MdePkg/MdePkg.dec

diff --git a/MdePkg/Include/Protocol/NvdimmLabel.h b/MdePkg/Include/Protocol/NvdimmLabel.h
new file mode 100644 (file)
index 0000000..0d70bdf
--- /dev/null
@@ -0,0 +1,351 @@
+/** @file\r
+  EFI NVDIMM Label Protocol Definition\r
+\r
+  The EFI NVDIMM Label Protocol is used to Provides services that allow management\r
+  of labels contained in a Label Storage Area that are associated with a specific\r
+  NVDIMM Device Path.\r
+\r
+Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under\r
+the terms and conditions of the BSD License that accompanies this distribution.\r
+The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php.\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  @par Revision Reference:\r
+  This Protocol was introduced in UEFI Specification 2.7.\r
+\r
+**/\r
+\r
+#ifndef __EFI_NVDIMM_LABEL_PROTOCOL_H__\r
+#define __EFI_NVDIMM_LABEL_PROTOCOL_H__\r
+\r
+#define EFI_NVDIMM_LABEL_PROTOCOL_GUID \\r
+  { \\r
+    0xd40b6b80, 0x97d5, 0x4282, {0xbb, 0x1d, 0x22, 0x3a, 0x16, 0x91, 0x80, 0x58 } \\r
+  }\r
+\r
+typedef struct _EFI_NVDIMM_LABEL_PROTOCOL EFI_NVDIMM_LABEL_PROTOCOL;\r
+\r
+#define EFI_NVDIMM_LABEL_INDEX_SIG_LEN 16\r
+#define EFI_NVDIMM_LABEL_INDEX_ALIGN   256\r
+typedef struct {\r
+  ///\r
+  /// Signature of the Index Block data structure. Must be "NAMESPACE_INDEX\0".\r
+  ///\r
+  CHAR8  Sig[EFI_NVDIMM_LABEL_INDEX_SIG_LEN];\r
+\r
+  ///\r
+  /// Attributes of this Label Storage Area.\r
+  ///\r
+  UINT8  Flags[3];\r
+\r
+  ///\r
+  /// Size of each label in bytes, 128 bytes << LabelSize.\r
+  /// 1 means 256 bytes, 2 means 512 bytes, etc. Shall be 1 or greater.\r
+  ///\r
+  UINT8  LabelSize;\r
+\r
+  ///\r
+  /// Sequence number used to identify which of the two Index Blocks is current.\r
+  ///\r
+  UINT32 Seq;\r
+\r
+  ///\r
+  /// The offset of this Index Block in the Label Storage Area.\r
+  ///\r
+  UINT64 MyOff;\r
+\r
+  ///\r
+  /// The size of this Index Block in bytes.\r
+  /// This field must be a multiple of the EFI_NVDIMM_LABEL_INDEX_ALIGN.\r
+  ///\r
+  UINT64 MySize;\r
+\r
+  ///\r
+  /// The offset of the other Index Block paired with this one.\r
+  ///\r
+  UINT64 OtherOff;\r
+\r
+  ///\r
+  /// The offset of the first slot where labels are stored in this Label Storage Area.\r
+  ///\r
+  UINT64 LabelOff;\r
+\r
+  ///\r
+  /// The total number of slots for storing labels in this Label Storage Area.\r
+  ///\r
+  UINT32 NSlot;\r
+\r
+  ///\r
+  /// Major version number. Value shall be 1.\r
+  ///\r
+  UINT16 Major;\r
+\r
+  ///\r
+  /// Minor version number. Value shall be 2.\r
+  ///\r
+  UINT16 Minor;\r
+\r
+  ///\r
+  /// 64-bit Fletcher64 checksum of all fields in this Index Block.\r
+  ///\r
+  UINT64 Checksum;\r
+\r
+  ///\r
+  /// Array of unsigned bytes implementing a bitmask that tracks which label slots are free.\r
+  /// A bit value of 0 indicates in use, 1 indicates free.\r
+  /// The size of this field is the number of bytes required to hold the bitmask with NSlot bits,\r
+  /// padded with additional zero bytes to make the Index Block size a multiple of EFI_NVDIMM_LABEL_INDEX_ALIGN.\r
+  /// Any bits allocated beyond NSlot bits must be zero.\r
+  ///\r
+  UINT8  Free[];\r
+} EFI_NVDIMM_LABEL_INDEX_BLOCK;\r
+\r
+#define EFI_NVDIMM_LABEL_NAME_LEN 64\r
+\r
+///\r
+/// The label is read-only.\r
+///\r
+#define EFI_NVDIMM_LABEL_FLAGS_ROLABEL 0x00000001\r
+\r
+///\r
+/// When set, the complete label set is local to a single NVDIMM Label Storage Area.\r
+/// When clear, the complete label set is contained on multiple NVDIMM Label Storage Areas.\r
+///\r
+#define EFI_NVDIMM_LABEL_FLAGS_LOCAL 0x00000002\r
+\r
+///\r
+/// This reserved flag is utilized on older implementations and has been deprecated.\r
+/// Do not use.\r
+//\r
+#define EFI_NVDIMM_LABEL_FLAGS_RESERVED 0x00000004\r
+\r
+///\r
+/// When set, the label set is being updated.\r
+///\r
+#define EFI_NVDIMM_LABEL_FLAGS_UPDATING 0x00000008\r
+\r
+typedef struct {\r
+  ///\r
+  /// Unique Label Identifier UUID per RFC 4122.\r
+  ///\r
+  EFI_GUID Uuid;\r
+\r
+  ///\r
+  /// NULL-terminated string using UTF-8 character formatting.\r
+  ///\r
+  CHAR8    Name[EFI_NVDIMM_LABEL_NAME_LEN];\r
+\r
+  ///\r
+  /// Attributes of this namespace.\r
+  ///\r
+  UINT32   Flags;\r
+\r
+  ///\r
+  /// Total number of labels describing this namespace.\r
+  ///\r
+  UINT16   NLabel;\r
+\r
+  ///\r
+  /// Position of this label in list of labels for this namespace.\r
+  ///\r
+  UINT16   Position;\r
+\r
+  ///\r
+  /// The SetCookie is utilized by SW to perform consistency checks on the Interleave Set to verify the current\r
+  /// physical device configuration matches the original physical configuration when the labels were created\r
+  /// for the set.The label is considered invalid if the actual label set cookie doesn't match the cookie stored here.\r
+  ///\r
+  UINT64   SetCookie;\r
+\r
+  ///\r
+  /// This is the default logical block size in bytes and may be superseded by a block size that is specified\r
+  /// in the AbstractionGuid.\r
+  ///\r
+  UINT64   LbaSize;\r
+\r
+  ///\r
+  /// The DPA is the DIMM Physical address where the NVM contributing to this namespace begins on this NVDIMM.\r
+  ///\r
+  UINT64   Dpa;\r
+\r
+  ///\r
+  /// The extent of the DPA contributed by this label.\r
+  ///\r
+  UINT64   RawSize;\r
+\r
+  ///\r
+  /// Current slot in the Label Storage Area where this label is stored.\r
+  ///\r
+  UINT32   Slot;\r
+\r
+  ///\r
+  /// Alignment hint used to advertise the preferred alignment of the data from within the namespace defined by this label.\r
+  ///\r
+  UINT8    Alignment;\r
+\r
+  ///\r
+  /// Shall be 0.\r
+  ///\r
+  UINT8    Reserved[3];\r
+\r
+  ///\r
+  /// Range Type GUID that describes the access mechanism for the specified DPA range.\r
+  ///\r
+  EFI_GUID TypeGuid;\r
+\r
+  ///\r
+  /// Identifies the address abstraction mechanism for this namespace. A value of 0 indicates no mechanism used.\r
+  ///\r
+  EFI_GUID AddressAbstractionGuid;\r
+\r
+  ///\r
+  /// Shall be 0.\r
+  ///\r
+  UINT8    Reserved1[88];\r
+\r
+  ///\r
+  /// 64-bit Fletcher64 checksum of all fields in this Label.\r
+  /// This field is considered zero when the checksum is computed.\r
+  ///\r
+  UINT64   Checksum;\r
+} EFI_NVDIMM_LABEL;\r
+\r
+typedef struct  {\r
+  ///\r
+  /// The Region Offset field from the ACPI NFIT NVDIMM Region Mapping Structure for a given entry.\r
+  ///\r
+  UINT64 RegionOffset;\r
+\r
+  ///\r
+  /// The serial number of the NVDIMM, assigned by the module vendor.\r
+  ///\r
+  UINT32 SerialNumber;\r
+\r
+  ///\r
+  /// The identifier indicating the vendor of the NVDIMM.\r
+  ///\r
+  UINT16 VendorId;\r
+\r
+  ///\r
+  /// The manufacturing date of the NVDIMM, assigned by the module vendor.\r
+  ///\r
+  UINT16 ManufacturingDate;\r
+\r
+  ///\r
+  /// The manufacturing location from for the NVDIMM, assigned by the module vendor.\r
+  ///\r
+  UINT8  ManufacturingLocation;\r
+\r
+  ///\r
+  /// Shall be 0.\r
+  ///\r
+  UINT8  Reserved[31];\r
+} EFI_NVDIMM_LABEL_SET_COOKIE_MAP;\r
+\r
+typedef struct {\r
+  ///\r
+  /// Array size is 1 if EFI_NVDIMM_LABEL_FLAGS_LOCAL is set indicating a Local Namespaces.\r
+  ///\r
+  EFI_NVDIMM_LABEL_SET_COOKIE_MAP Mapping[0];\r
+} EFI_NVDIMM_LABEL_SET_COOKIE_INFO;\r
+\r
+/**\r
+  Retrieves the Label Storage Area size and the maximum transfer size for the LabelStorageRead and\r
+  LabelStorageWrite methods.\r
+\r
+  @param  This                   A pointer to the EFI_NVDIMM_LABEL_PROTOCOL instance.\r
+  @param  SizeOfLabelStorageArea The size of the Label Storage Area for the NVDIMM in bytes.\r
+  @param  MaxTransferLength      The maximum number of bytes that can be transferred in a single call to\r
+                                 LabelStorageRead or LabelStorageWrite.\r
+\r
+  @retval EFI_SUCCESS            The size of theLabel Storage Area and maximum transfer size returned are valid.\r
+  @retval EFI_ACCESS_DENIED      The Label Storage Area for the NVDIMM device is not currently accessible.\r
+  @retval EFI_DEVICE_ERROR       A physical device error occurred and the data transfer failed to complete.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_NVDIMM_LABEL_STORAGE_INFORMATION) (\r
+  IN  EFI_NVDIMM_LABEL_PROTOCOL *This,\r
+  OUT UINT32                    *SizeOfLabelStorageArea,\r
+  OUT UINT32                    *MaxTransferLength\r
+  );\r
+\r
+/**\r
+  Retrieves the label data for the requested offset and length from within the Label Storage Area for\r
+  the NVDIMM.\r
+\r
+  @param  This                   A pointer to the EFI_NVDIMM_LABEL_PROTOCOL instance.\r
+  @param  Offset                 The byte offset within the Label Storage Area to read from.\r
+  @param  TransferLength         Number of bytes to read from the Label Storage Area beginning at the byte\r
+                                 Offset specified. A TransferLength of 0 reads no data.\r
+  @param  LabelData              The return label data read at the requested offset and length from within\r
+                                 the Label Storage Area.\r
+\r
+  @retval EFI_SUCCESS            The label data from the Label Storage Area for the NVDIMM was read successfully\r
+                                 at the specified Offset and TransferLength and LabelData contains valid data.\r
+  @retval EFI_INVALID_PARAMETER  Any of the following are true:\r
+                                 - Offset > SizeOfLabelStorageArea reported in the LabelStorageInformation return data.\r
+                                 - Offset + TransferLength is > SizeOfLabelStorageArea reported in the\r
+                                   LabelStorageInformation return data.\r
+                                 - TransferLength is > MaxTransferLength reported in the LabelStorageInformation return\r
+                                   data.\r
+  @retval EFI_ACCESS_DENIED      The Label Storage Area for the NVDIMM device is not currently accessible and labels\r
+                                 cannot be read at this time.\r
+  @retval EFI_DEVICE_ERROR       A physical device error occurred and the data transfer failed to complete.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_NVDIMM_LABEL_STORAGE_READ) (\r
+  IN CONST EFI_NVDIMM_LABEL_PROTOCOL *This,\r
+  IN UINT32                          Offset,\r
+  IN UINT32                          TransferLength,\r
+  OUT UINT8                          *LabelData\r
+  );\r
+\r
+/**\r
+  Writes the label data for the requested offset and length in to the Label Storage Area for the NVDIMM.\r
+\r
+  @param  This                   A pointer to the EFI_NVDIMM_LABEL_PROTOCOL instance.\r
+  @param  Offset                 The byte offset within the Label Storage Area to write to.\r
+  @param  TransferLength         Number of bytes to write to the Label Storage Area beginning at the byte\r
+                                 Offset specified. A TransferLength of 0 writes no data.\r
+  @param  LabelData              The return label data write at the requested offset and length from within\r
+                                 the Label Storage Area.\r
+\r
+  @retval EFI_SUCCESS            The label data from the Label Storage Area for the NVDIMM written read successfully\r
+                                 at the specified Offset and TransferLength.\r
+  @retval EFI_INVALID_PARAMETER  Any of the following are true:\r
+                                 - Offset > SizeOfLabelStorageArea reported in the LabelStorageInformation return data.\r
+                                 - Offset + TransferLength is > SizeOfLabelStorageArea reported in the\r
+                                   LabelStorageInformation return data.\r
+                                 - TransferLength is > MaxTransferLength reported in the LabelStorageInformation return\r
+                                   data.\r
+  @retval EFI_ACCESS_DENIED      The Label Storage Area for the NVDIMM device is not currently accessible and labels\r
+                                 cannot be written at this time.\r
+  @retval EFI_DEVICE_ERROR       A physical device error occurred and the data transfer failed to complete.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_NVDIMM_LABEL_STORAGE_WRITE) (\r
+  IN CONST EFI_NVDIMM_LABEL_PROTOCOL *This,\r
+  IN UINT32                          Offset,\r
+  IN UINT32                          TransferLength,\r
+  IN UINT8                           *LabelData\r
+  );\r
+\r
+///\r
+/// Provides services that allow management of labels contained in a Label Storage Area.\r
+///\r
+struct _EFI_NVDIMM_LABEL_PROTOCOL {\r
+  EFI_NVDIMM_LABEL_STORAGE_INFORMATION LabelStorageInformation;\r
+  EFI_NVDIMM_LABEL_STORAGE_READ        LabelStorageRead;\r
+  EFI_NVDIMM_LABEL_STORAGE_WRITE       LabelStorageWrite;\r
+};\r
+\r
+extern EFI_GUID gEfiNvdimmLabelProtocolGuid;\r
+\r
+#endif\r
index c5279298e8e32af494a60ef24ce61ef4800b3fd7..3ccd3dd5a9388862889fcb87a51d75e366a3de46 100644 (file)
   ## Include/Protocol/HiiPopup.h\r
   gEfiHiiPopupProtocolGuid                  = { 0x4311edc0, 0x6054, 0x46d4, { 0x9e, 0x40, 0x89, 0x3e, 0xa9, 0x52, 0xfc, 0xcc }}\r
 \r
+  ## Include/Protocol/NvdimmLabel.h\r
+  gEfiNvdimmLabelProtocolGuid               = { 0xd40b6b80, 0x97d5, 0x4282, { 0xbb, 0x1d, 0x22, 0x3a, 0x16, 0x91, 0x80, 0x58 }}\r
+\r
   #\r
   # Protocols defined in Shell2.0\r
   #\r