VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/NvdimmLabel.h@ 105681

最後變更 在這個檔案從105681是 105670,由 vboxsync 提交於 7 月 前

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette