]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/NvdimmLabel.h
MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
[mirror_edk2.git] / MdePkg / Include / Protocol / NvdimmLabel.h
CommitLineData
c2c90b42
RN
1/** @file\r
2 EFI NVDIMM Label Protocol Definition\r
3\r
4 The EFI NVDIMM Label Protocol is used to Provides services that allow management\r
5 of labels contained in a Label Storage Area that are associated with a specific\r
6 NVDIMM Device Path.\r
7\r
8Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
9This program and the accompanying materials are licensed and made available under\r
10the terms and conditions of the BSD License that accompanies this distribution.\r
11The full text of the license may be found at\r
12http://opensource.org/licenses/bsd-license.php.\r
13\r
14THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16\r
17 @par Revision Reference:\r
18 This Protocol was introduced in UEFI Specification 2.7.\r
19\r
20**/\r
21\r
22#ifndef __EFI_NVDIMM_LABEL_PROTOCOL_H__\r
23#define __EFI_NVDIMM_LABEL_PROTOCOL_H__\r
24\r
25#define EFI_NVDIMM_LABEL_PROTOCOL_GUID \\r
26 { \\r
27 0xd40b6b80, 0x97d5, 0x4282, {0xbb, 0x1d, 0x22, 0x3a, 0x16, 0x91, 0x80, 0x58 } \\r
28 }\r
29\r
30typedef struct _EFI_NVDIMM_LABEL_PROTOCOL EFI_NVDIMM_LABEL_PROTOCOL;\r
31\r
32#define EFI_NVDIMM_LABEL_INDEX_SIG_LEN 16\r
33#define EFI_NVDIMM_LABEL_INDEX_ALIGN 256\r
34typedef struct {\r
35 ///\r
36 /// Signature of the Index Block data structure. Must be "NAMESPACE_INDEX\0".\r
37 ///\r
38 CHAR8 Sig[EFI_NVDIMM_LABEL_INDEX_SIG_LEN];\r
39\r
40 ///\r
41 /// Attributes of this Label Storage Area.\r
42 ///\r
43 UINT8 Flags[3];\r
44\r
45 ///\r
46 /// Size of each label in bytes, 128 bytes << LabelSize.\r
47 /// 1 means 256 bytes, 2 means 512 bytes, etc. Shall be 1 or greater.\r
48 ///\r
49 UINT8 LabelSize;\r
50\r
51 ///\r
52 /// Sequence number used to identify which of the two Index Blocks is current.\r
53 ///\r
54 UINT32 Seq;\r
55\r
56 ///\r
57 /// The offset of this Index Block in the Label Storage Area.\r
58 ///\r
59 UINT64 MyOff;\r
60\r
61 ///\r
62 /// The size of this Index Block in bytes.\r
63 /// This field must be a multiple of the EFI_NVDIMM_LABEL_INDEX_ALIGN.\r
64 ///\r
65 UINT64 MySize;\r
66\r
67 ///\r
68 /// The offset of the other Index Block paired with this one.\r
69 ///\r
70 UINT64 OtherOff;\r
71\r
72 ///\r
73 /// The offset of the first slot where labels are stored in this Label Storage Area.\r
74 ///\r
75 UINT64 LabelOff;\r
76\r
77 ///\r
78 /// The total number of slots for storing labels in this Label Storage Area.\r
79 ///\r
80 UINT32 NSlot;\r
81\r
82 ///\r
83 /// Major version number. Value shall be 1.\r
84 ///\r
85 UINT16 Major;\r
86\r
87 ///\r
88 /// Minor version number. Value shall be 2.\r
89 ///\r
90 UINT16 Minor;\r
91\r
92 ///\r
93 /// 64-bit Fletcher64 checksum of all fields in this Index Block.\r
94 ///\r
95 UINT64 Checksum;\r
96\r
97 ///\r
98 /// Array of unsigned bytes implementing a bitmask that tracks which label slots are free.\r
99 /// A bit value of 0 indicates in use, 1 indicates free.\r
100 /// The size of this field is the number of bytes required to hold the bitmask with NSlot bits,\r
101 /// padded with additional zero bytes to make the Index Block size a multiple of EFI_NVDIMM_LABEL_INDEX_ALIGN.\r
102 /// Any bits allocated beyond NSlot bits must be zero.\r
103 ///\r
104 UINT8 Free[];\r
105} EFI_NVDIMM_LABEL_INDEX_BLOCK;\r
106\r
107#define EFI_NVDIMM_LABEL_NAME_LEN 64\r
108\r
109///\r
110/// The label is read-only.\r
111///\r
112#define EFI_NVDIMM_LABEL_FLAGS_ROLABEL 0x00000001\r
113\r
114///\r
115/// When set, the complete label set is local to a single NVDIMM Label Storage Area.\r
116/// When clear, the complete label set is contained on multiple NVDIMM Label Storage Areas.\r
117///\r
118#define EFI_NVDIMM_LABEL_FLAGS_LOCAL 0x00000002\r
119\r
120///\r
121/// This reserved flag is utilized on older implementations and has been deprecated.\r
122/// Do not use.\r
123//\r
124#define EFI_NVDIMM_LABEL_FLAGS_RESERVED 0x00000004\r
125\r
126///\r
127/// When set, the label set is being updated.\r
128///\r
129#define EFI_NVDIMM_LABEL_FLAGS_UPDATING 0x00000008\r
130\r
131typedef struct {\r
132 ///\r
133 /// Unique Label Identifier UUID per RFC 4122.\r
134 ///\r
135 EFI_GUID Uuid;\r
136\r
137 ///\r
138 /// NULL-terminated string using UTF-8 character formatting.\r
139 ///\r
140 CHAR8 Name[EFI_NVDIMM_LABEL_NAME_LEN];\r
141\r
142 ///\r
143 /// Attributes of this namespace.\r
144 ///\r
145 UINT32 Flags;\r
146\r
147 ///\r
148 /// Total number of labels describing this namespace.\r
149 ///\r
150 UINT16 NLabel;\r
151\r
152 ///\r
153 /// Position of this label in list of labels for this namespace.\r
154 ///\r
155 UINT16 Position;\r
156\r
157 ///\r
158 /// The SetCookie is utilized by SW to perform consistency checks on the Interleave Set to verify the current\r
159 /// physical device configuration matches the original physical configuration when the labels were created\r
160 /// for the set.The label is considered invalid if the actual label set cookie doesn't match the cookie stored here.\r
161 ///\r
162 UINT64 SetCookie;\r
163\r
164 ///\r
165 /// This is the default logical block size in bytes and may be superseded by a block size that is specified\r
166 /// in the AbstractionGuid.\r
167 ///\r
168 UINT64 LbaSize;\r
169\r
170 ///\r
171 /// The DPA is the DIMM Physical address where the NVM contributing to this namespace begins on this NVDIMM.\r
172 ///\r
173 UINT64 Dpa;\r
174\r
175 ///\r
176 /// The extent of the DPA contributed by this label.\r
177 ///\r
178 UINT64 RawSize;\r
179\r
180 ///\r
181 /// Current slot in the Label Storage Area where this label is stored.\r
182 ///\r
183 UINT32 Slot;\r
184\r
185 ///\r
186 /// Alignment hint used to advertise the preferred alignment of the data from within the namespace defined by this label.\r
187 ///\r
188 UINT8 Alignment;\r
189\r
190 ///\r
191 /// Shall be 0.\r
192 ///\r
193 UINT8 Reserved[3];\r
194\r
195 ///\r
196 /// Range Type GUID that describes the access mechanism for the specified DPA range.\r
197 ///\r
198 EFI_GUID TypeGuid;\r
199\r
200 ///\r
201 /// Identifies the address abstraction mechanism for this namespace. A value of 0 indicates no mechanism used.\r
202 ///\r
203 EFI_GUID AddressAbstractionGuid;\r
204\r
205 ///\r
206 /// Shall be 0.\r
207 ///\r
208 UINT8 Reserved1[88];\r
209\r
210 ///\r
211 /// 64-bit Fletcher64 checksum of all fields in this Label.\r
212 /// This field is considered zero when the checksum is computed.\r
213 ///\r
214 UINT64 Checksum;\r
215} EFI_NVDIMM_LABEL;\r
216\r
217typedef struct {\r
218 ///\r
219 /// The Region Offset field from the ACPI NFIT NVDIMM Region Mapping Structure for a given entry.\r
220 ///\r
221 UINT64 RegionOffset;\r
222\r
223 ///\r
224 /// The serial number of the NVDIMM, assigned by the module vendor.\r
225 ///\r
226 UINT32 SerialNumber;\r
227\r
228 ///\r
229 /// The identifier indicating the vendor of the NVDIMM.\r
230 ///\r
231 UINT16 VendorId;\r
232\r
233 ///\r
234 /// The manufacturing date of the NVDIMM, assigned by the module vendor.\r
235 ///\r
236 UINT16 ManufacturingDate;\r
237\r
238 ///\r
239 /// The manufacturing location from for the NVDIMM, assigned by the module vendor.\r
240 ///\r
241 UINT8 ManufacturingLocation;\r
242\r
243 ///\r
244 /// Shall be 0.\r
245 ///\r
246 UINT8 Reserved[31];\r
247} EFI_NVDIMM_LABEL_SET_COOKIE_MAP;\r
248\r
249typedef struct {\r
250 ///\r
251 /// Array size is 1 if EFI_NVDIMM_LABEL_FLAGS_LOCAL is set indicating a Local Namespaces.\r
252 ///\r
253 EFI_NVDIMM_LABEL_SET_COOKIE_MAP Mapping[0];\r
254} EFI_NVDIMM_LABEL_SET_COOKIE_INFO;\r
255\r
256/**\r
257 Retrieves the Label Storage Area size and the maximum transfer size for the LabelStorageRead and\r
258 LabelStorageWrite methods.\r
259\r
260 @param This A pointer to the EFI_NVDIMM_LABEL_PROTOCOL instance.\r
261 @param SizeOfLabelStorageArea The size of the Label Storage Area for the NVDIMM in bytes.\r
262 @param MaxTransferLength The maximum number of bytes that can be transferred in a single call to\r
263 LabelStorageRead or LabelStorageWrite.\r
264\r
265 @retval EFI_SUCCESS The size of theLabel Storage Area and maximum transfer size returned are valid.\r
266 @retval EFI_ACCESS_DENIED The Label Storage Area for the NVDIMM device is not currently accessible.\r
267 @retval EFI_DEVICE_ERROR A physical device error occurred and the data transfer failed to complete.\r
268**/\r
269typedef\r
270EFI_STATUS\r
271(EFIAPI *EFI_NVDIMM_LABEL_STORAGE_INFORMATION) (\r
272 IN EFI_NVDIMM_LABEL_PROTOCOL *This,\r
273 OUT UINT32 *SizeOfLabelStorageArea,\r
274 OUT UINT32 *MaxTransferLength\r
275 );\r
276\r
277/**\r
278 Retrieves the label data for the requested offset and length from within the Label Storage Area for\r
279 the NVDIMM.\r
280\r
281 @param This A pointer to the EFI_NVDIMM_LABEL_PROTOCOL instance.\r
282 @param Offset The byte offset within the Label Storage Area to read from.\r
283 @param TransferLength Number of bytes to read from the Label Storage Area beginning at the byte\r
284 Offset specified. A TransferLength of 0 reads no data.\r
285 @param LabelData The return label data read at the requested offset and length from within\r
286 the Label Storage Area.\r
287\r
288 @retval EFI_SUCCESS The label data from the Label Storage Area for the NVDIMM was read successfully\r
289 at the specified Offset and TransferLength and LabelData contains valid data.\r
290 @retval EFI_INVALID_PARAMETER Any of the following are true:\r
291 - Offset > SizeOfLabelStorageArea reported in the LabelStorageInformation return data.\r
292 - Offset + TransferLength is > SizeOfLabelStorageArea reported in the\r
293 LabelStorageInformation return data.\r
294 - TransferLength is > MaxTransferLength reported in the LabelStorageInformation return\r
295 data.\r
296 @retval EFI_ACCESS_DENIED The Label Storage Area for the NVDIMM device is not currently accessible and labels\r
297 cannot be read at this time.\r
298 @retval EFI_DEVICE_ERROR A physical device error occurred and the data transfer failed to complete.\r
299**/\r
300typedef\r
301EFI_STATUS\r
302(EFIAPI *EFI_NVDIMM_LABEL_STORAGE_READ) (\r
303 IN CONST EFI_NVDIMM_LABEL_PROTOCOL *This,\r
304 IN UINT32 Offset,\r
305 IN UINT32 TransferLength,\r
306 OUT UINT8 *LabelData\r
307 );\r
308\r
309/**\r
310 Writes the label data for the requested offset and length in to the Label Storage Area for the NVDIMM.\r
311\r
312 @param This A pointer to the EFI_NVDIMM_LABEL_PROTOCOL instance.\r
313 @param Offset The byte offset within the Label Storage Area to write to.\r
314 @param TransferLength Number of bytes to write to the Label Storage Area beginning at the byte\r
315 Offset specified. A TransferLength of 0 writes no data.\r
316 @param LabelData The return label data write at the requested offset and length from within\r
317 the Label Storage Area.\r
318\r
319 @retval EFI_SUCCESS The label data from the Label Storage Area for the NVDIMM written read successfully\r
320 at the specified Offset and TransferLength.\r
321 @retval EFI_INVALID_PARAMETER Any of the following are true:\r
322 - Offset > SizeOfLabelStorageArea reported in the LabelStorageInformation return data.\r
323 - Offset + TransferLength is > SizeOfLabelStorageArea reported in the\r
324 LabelStorageInformation return data.\r
325 - TransferLength is > MaxTransferLength reported in the LabelStorageInformation return\r
326 data.\r
327 @retval EFI_ACCESS_DENIED The Label Storage Area for the NVDIMM device is not currently accessible and labels\r
328 cannot be written at this time.\r
329 @retval EFI_DEVICE_ERROR A physical device error occurred and the data transfer failed to complete.\r
330**/\r
331typedef\r
332EFI_STATUS\r
333(EFIAPI *EFI_NVDIMM_LABEL_STORAGE_WRITE) (\r
334 IN CONST EFI_NVDIMM_LABEL_PROTOCOL *This,\r
335 IN UINT32 Offset,\r
336 IN UINT32 TransferLength,\r
337 IN UINT8 *LabelData\r
338 );\r
339\r
340///\r
341/// Provides services that allow management of labels contained in a Label Storage Area.\r
342///\r
343struct _EFI_NVDIMM_LABEL_PROTOCOL {\r
344 EFI_NVDIMM_LABEL_STORAGE_INFORMATION LabelStorageInformation;\r
345 EFI_NVDIMM_LABEL_STORAGE_READ LabelStorageRead;\r
346 EFI_NVDIMM_LABEL_STORAGE_WRITE LabelStorageWrite;\r
347};\r
348\r
349extern EFI_GUID gEfiNvdimmLabelProtocolGuid;\r
350\r
351#endif\r