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