Debian Codegraph @

src/nvme/types.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /*
3 * This file is part of libnvme.
4 * Copyright (c) 2020 Western Digital Corporation or its affiliates.
5 *
6 * Authors: Keith Busch <[email protected]>
7 * Chaitanya Kulkarni <[email protected]>
8 */
9
10 #ifndef _LIBNVME_TYPES_H
11 #define _LIBNVME_TYPES_H
12
13 #include <stdbool.h>
14 #include <stdint.h>
15
16 #include <linux/types.h>
17
18 /**
19 * DOC: types.h
20 *
21 * NVMe standard definitions
22 */
23
24 #define NVME_UUID_LEN 16
25 #define NVME_UUID_LEN_STRING 37 /* 1b4e28ba-2fa1-11d2-883f-0016d3cca427 + \0 */
26
27 /**
28 * NVME_GET() - extract field from complex value
29 * @value: The original value of a complex field
30 * @name: The name of the sub-field within an nvme value
31 *
32 * By convention, this library defines _SHIFT and _MASK such that mask can be
33 * applied after the shift to isolate a specific set of bits that decode to a
34 * sub-field.
35 *
36 * Returns: The 'name' field from 'value'
37 */
38 #define NVME_GET(value, name) \
39 (((value) >> NVME_##name##_SHIFT) & NVME_##name##_MASK)
40
41 /**
42 * NVME_SET() - set field into complex value
43 * @value: The value to be set in its completed position
44 * @name: The name of the sub-field within an nvme value
45 *
46 * Returns: The 'name' field from 'value'
47 */
48 #define NVME_SET(value, name) \
49 (((__u32)(value) & NVME_##name##_MASK) << NVME_##name##_SHIFT)
50
51 /**
52 * NVME_CHECK() - check value to compare field value
53 * @value: The value to be checked
54 * @name: The name of the sub-field within an nvme value
55 * @check: The sub-field value to check
56 *
57 * Returns: The result of compare the value and the sub-field value
58 */
59 #define NVME_CHECK(value, name, check) ((value) == NVME_##name##_##check)
60
61 /**
62 * NVME_VAL() - get mask value shifted
63 * @name: The name of the sub-field within an nvme value
64 *
65 * Returns: The mask value shifted
66 */
67 #define NVME_VAL(name) (NVME_##name##_MASK << NVME_##name##_SHIFT)
68
69 /**
70 * enum nvme_constants - A place to stash various constant nvme values
71 * @NVME_NSID_ALL: A broadcast value that is used to specify all
72 * namespaces
73 * @NVME_NSID_NONE: The invalid namespace id, for when the nsid
74 * parameter is not used in a command
75 * @NVME_UUID_NONE: Use to omit a uuid command parameter
76 * @NVME_CNTLID_NONE: Use to omit a cntlid command parameter
77 * @NVME_CNSSPECID_NONE: Use to omit a cns_specific_id command parameter
78 * @NVME_LOG_LSP_NONE: Use to omit a log lsp command parameter
79 * @NVME_LOG_LSI_NONE: Use to omit a log lsi command parameter
80 * @NVME_LOG_LPO_NONE: Use to omit a log lpo command parameter
81 * @NVME_IDENTIFY_DATA_SIZE: The transfer size for nvme identify commands
82 * @NVME_LOG_SUPPORTED_LOG_PAGES_MAX: The largest possible index in the supported
83 * log pages log.
84 * @NVME_ID_NVMSET_LIST_MAX: The largest possible nvmset index in identify
85 * nvmeset
86 * @NVME_ID_UUID_LIST_MAX: The largest possible uuid index in identify
87 * uuid list
88 * @NVME_ID_CTRL_LIST_MAX: The largest possible controller index in
89 * identify controller list
90 * @NVME_ID_NS_LIST_MAX: The largest possible namespace index in
91 * identify namespace list
92 * @NVME_ID_SECONDARY_CTRL_MAX: The largest possible secondary controller index
93 * in identify secondary controller
94 * @NVME_ID_DOMAIN_LIST_MAX: The largest possible domain index in the
95 * in domain list
96 * @NVME_ID_ENDURANCE_GROUP_LIST_MAX: The largest possible endurance group
97 * index in the endurance group list
98 * @NVME_ID_ND_DESCRIPTOR_MAX: The largest possible namespace granularity
99 * index in the namespace granularity descriptor
100 * list
101 * @NVME_FEAT_LBA_RANGE_MAX: The largest possible LBA range index in feature
102 * lba range type
103 * @NVME_LOG_ST_MAX_RESULTS: The largest possible self test result index in the
104 * device self test log
105 * @NVME_LOG_FID_SUPPORTED_EFFECTS_MAX: The largest possible FID index in the
106 * feature identifiers effects log.
107 * @NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_MAX: The largest possible MI Command index
108 * in the MI Command effects log.
109 * @NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_RESERVED: The reserved space in the MI Command
110 * effects log.
111 * @NVME_LOG_TELEM_BLOCK_SIZE: Specification defined size of Telemetry Data Blocks
112 * @NVME_DSM_MAX_RANGES: The largest possible range index in a data-set
113 * management command
114 * @NVME_NQN_LENGTH: Max length for NVMe Qualified Name
115 * @NVMF_TRADDR_SIZE: Max Transport Address size
116 * @NVMF_TSAS_SIZE: Max Transport Specific Address Subtype size
117 * @NVME_ZNS_CHANGED_ZONES_MAX: Max number of zones in the changed zones log
118 * page
119 * @NVME_STREAM_ID_MAX: Max number of stream IDs
120 */
121 enum nvme_constants {
122 NVME_NSID_ALL = 0xffffffff,
123 NVME_NSID_NONE = 0,
124 NVME_UUID_NONE = 0,
125 NVME_CNTLID_NONE = 0,
126 NVME_CNSSPECID_NONE = 0,
127 NVME_LOG_LSP_NONE = 0,
128 NVME_LOG_LSI_NONE = 0,
129 NVME_LOG_LPO_NONE = 0,
130 NVME_IDENTIFY_DATA_SIZE = 4096,
131 NVME_LOG_SUPPORTED_LOG_PAGES_MAX = 256,
132 NVME_ID_NVMSET_LIST_MAX = 31,
133 NVME_ID_UUID_LIST_MAX = 127,
134 NVME_ID_CTRL_LIST_MAX = 2047,
135 NVME_ID_NS_LIST_MAX = 1024,
136 NVME_ID_SECONDARY_CTRL_MAX = 127,
137 NVME_ID_DOMAIN_LIST_MAX = 31,
138 NVME_ID_ENDURANCE_GROUP_LIST_MAX = 2047,
139 NVME_ID_ND_DESCRIPTOR_MAX = 16,
140 NVME_FEAT_LBA_RANGE_MAX = 64,
141 NVME_LOG_ST_MAX_RESULTS = 20,
142 NVME_LOG_TELEM_BLOCK_SIZE = 512,
143 NVME_LOG_FID_SUPPORTED_EFFECTS_MAX = 256,
144 NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_MAX = 256,
145 NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_RESERVED = 768,
146 NVME_DSM_MAX_RANGES = 256,
147 NVME_NQN_LENGTH = 256,
148 NVMF_TRADDR_SIZE = 256,
149 NVMF_TSAS_SIZE = 256,
150 NVME_ZNS_CHANGED_ZONES_MAX = 511,
151 NVME_STREAM_ID_MAX = 0xffff,
152 };
153
154 /**
155 * enum nvme_csi - Defined command set indicators
156 * @NVME_CSI_NVM: NVM Command Set Indicator
157 * @NVME_CSI_KV: Key Value Command Set
158 * @NVME_CSI_ZNS: Zoned Namespace Command Set
159 * @NVME_CSI_SLM: Subsystem Local Memory Command Set
160 * @NVME_CSI_CP: Computational Programs Command Set
161 */
162 enum nvme_csi {
163 NVME_CSI_NVM = 0,
164 NVME_CSI_KV = 1,
165 NVME_CSI_ZNS = 2,
166 NVME_CSI_SLM = 3,
167 NVME_CSI_CP = 4,
168 };
169
170 /**
171 * enum nvme_register_offsets - controller registers for all transports. This
172 * is the layout of BAR0/1 for PCIe, and
173 * properties for fabrics.
174 * @NVME_REG_CAP: Controller Capabilities
175 * @NVME_REG_VS: Version
176 * @NVME_REG_INTMS: Interrupt Mask Set
177 * @NVME_REG_INTMC: Interrupt Mask Clear
178 * @NVME_REG_CC: Controller Configuration
179 * @NVME_REG_CSTS: Controller Status
180 * @NVME_REG_NSSR: NVM Subsystem Reset
181 * @NVME_REG_AQA: Admin Queue Attributes
182 * @NVME_REG_ASQ: Admin SQ Base Address
183 * @NVME_REG_ACQ: Admin CQ Base Address
184 * @NVME_REG_CMBLOC: Controller Memory Buffer Location
185 * @NVME_REG_CMBSZ: Controller Memory Buffer Size
186 * @NVME_REG_BPINFO: Boot Partition Information
187 * @NVME_REG_BPRSEL: Boot Partition Read Select
188 * @NVME_REG_BPMBL: Boot Partition Memory Buffer Location
189 * @NVME_REG_CMBMSC: Controller Memory Buffer Memory Space Control
190 * @NVME_REG_CMBSTS: Controller Memory Buffer Status
191 * @NVME_REG_CMBEBS: Controller Memory Buffer Elasticity Buffer Size
192 * @NVME_REG_CMBSWTP: Controller Memory Buffer Sustained Write Throughput
193 * @NVME_REG_NSSD: NVM Subsystem Shutdown
194 * @NVME_REG_CRTO: Controller Ready Timeouts
195 * @NVME_REG_PMRCAP: Persistent Memory Capabilities
196 * @NVME_REG_PMRCTL: Persistent Memory Region Control
197 * @NVME_REG_PMRSTS: Persistent Memory Region Status
198 * @NVME_REG_PMREBS: Persistent Memory Region Elasticity Buffer Size
199 * @NVME_REG_PMRSWTP: Memory Region Sustained Write Throughput
200 * @NVME_REG_PMRMSCL: Persistent Memory Region Controller Memory Space Control Lower
201 * @NVME_REG_PMRMSCU: Persistent Memory Region Controller Memory Space Control Upper
202 */
203 enum nvme_register_offsets {
204 NVME_REG_CAP = 0x0000,
205 NVME_REG_VS = 0x0008,
206 NVME_REG_INTMS = 0x000c,
207 NVME_REG_INTMC = 0x0010,
208 NVME_REG_CC = 0x0014,
209 NVME_REG_CSTS = 0x001c,
210 NVME_REG_NSSR = 0x0020,
211 NVME_REG_AQA = 0x0024,
212 NVME_REG_ASQ = 0x0028,
213 NVME_REG_ACQ = 0x0030,
214 NVME_REG_CMBLOC = 0x0038,
215 NVME_REG_CMBSZ = 0x003c,
216 NVME_REG_BPINFO = 0x0040,
217 NVME_REG_BPRSEL = 0x0044,
218 NVME_REG_BPMBL = 0x0048,
219 NVME_REG_CMBMSC = 0x0050,
220 NVME_REG_CMBSTS = 0x0058,
221 NVME_REG_CMBEBS = 0x005c,
222 NVME_REG_CMBSWTP = 0x0060,
223 NVME_REG_NSSD = 0x0064,
224 NVME_REG_CRTO = 0x0068,
225 NVME_REG_PMRCAP = 0x0e00,
226 NVME_REG_PMRCTL = 0x0e04,
227 NVME_REG_PMRSTS = 0x0e08,
228 NVME_REG_PMREBS = 0x0e0c,
229 NVME_REG_PMRSWTP = 0x0e10,
230 NVME_REG_PMRMSCL = 0x0e14,
231 NVME_REG_PMRMSCU = 0x0e18,
232 };
233
234 /**
235 * nvme_is_64bit_reg() - Checks if offset of the controller register is a know
236 * 64bit value.
237 * @offset: Offset of controller register field in bytes
238 *
239 * This function does not care about transport so that the offset is not going
240 * to be checked inside of this function for the unsupported fields in a
241 * specific transport. For example, BPMBL(Boot Partition Memory Buffer
242 * Location) register is not supported by fabrics, but it can be checked here.
243 *
244 * Returns: true if given offset is 64bit register, otherwise it returns false.
245 */
246 static inline bool nvme_is_64bit_reg(__u32 offset)
247 {
248 switch (offset) {
249 case NVME_REG_CAP:
250 case NVME_REG_ASQ:
251 case NVME_REG_ACQ:
252 case NVME_REG_BPMBL:
253 case NVME_REG_CMBMSC:
254 return true;
255 default:
256 return false;
257 }
258 }
259
260 /**
261 * enum nvme_cap - This field indicates the controller capabilities register
262 * @NVME_CAP_MQES_SHIFT: Shift amount to get the maximum queue entries supported
263 * @NVME_CAP_CQR_SHIFT: Shift amount to get the contiguous queues required
264 * @NVME_CAP_AMS_SHIFT: Shift amount to get the arbitration mechanism supported
265 * @NVME_CAP_TO_SHIFT: Shift amount to get the timeout
266 * @NVME_CAP_DSTRD_SHIFT: Shift amount to get the doorbell stride
267 * @NVME_CAP_NSSRC_SHIFT: Shift amount to get the NVM subsystem reset supported
268 * @NVME_CAP_CSS_SHIFT: Shift amount to get the command sets supported
269 * @NVME_CAP_BPS_SHIFT: Shift amount to get the boot partition support
270 * @NVME_CAP_CPS_SHIFT: Shift amount to get the controller power scope
271 * @NVME_CAP_MPSMIN_SHIFT: Shift amount to get the memory page size minimum
272 * @NVME_CAP_MPSMAX_SHIFT: Shift amount to get the memory page size maximum
273 * @NVME_CAP_PMRS_SHIFT: Shift amount to get the persistent memory region supported
274 * @NVME_CAP_CMBS_SHIFT: Shift amount to get the controller memory buffer supported
275 * @NVME_CAP_NSSS_SHIFT: Shift amount to get the NVM subsystem shutdown supported
276 * @NVME_CAP_CRMS_SHIFT: Shift amount to get the controller ready modes supported
277 * @NVME_CAP_MQES_MASK: Mask to get the maximum queue entries supported
278 * @NVME_CAP_CQR_MASK: Mask to get the contiguous queues required
279 * @NVME_CAP_AMS_MASK: Mask to get the arbitration mechanism supported
280 * @NVME_CAP_TO_MASK: Mask to get the timeout
281 * @NVME_CAP_DSTRD_MASK: Mask to get the doorbell stride
282 * @NVME_CAP_NSSRC_MASK: Mask to get the NVM subsystem reset supported
283 * @NVME_CAP_CSS_MASK: Mask to get the command sets supported
284 * @NVME_CAP_BPS_MASK: Mask to get the boot partition support
285 * @NVME_CAP_CPS_MASK: Mask to get the controller power scope
286 * @NVME_CAP_MPSMIN_MASK: Mask to get the memory page size minimum
287 * @NVME_CAP_MPSMAX_MASK: Mask to get the memory page size maximum
288 * @NVME_CAP_PMRS_MASK: Mask to get the persistent memory region supported
289 * @NVME_CAP_CMBS_MASK: Mask to get the controller memory buffer supported
290 * @NVME_CAP_NSSS_MASK: Mask to get the NVM subsystem shutdown supported
291 * @NVME_CAP_CRMS_MASK: Mask to get the controller ready modes supported
292 * @NVME_CAP_AMS_WRR: Weighted round robin with urgent priority class
293 * @NVME_CAP_AMS_VS: Vendor specific
294 * @NVME_CAP_CSS_NVM: NVM command set or a discovery controller
295 * @NVME_CAP_CSS_CSI: Controller supports one or more I/O command sets
296 * @NVME_CAP_CSS_ADMIN: No I/O command set is supported
297 * @NVME_CAP_CPS_NONE: Not reported
298 * @NVME_CAP_CPS_CTRL: Controller scope
299 * @NVME_CAP_CPS_DOMAIN: Domain scope
300 * @NVME_CAP_CPS_NVMS: NVM subsystem scope
301 * @NVME_CAP_CRWMS: Controller ready with media support
302 * @NVME_CAP_CRIMS: Controller ready independent of media support
303 */
304 enum nvme_cap {
305 NVME_CAP_MQES_SHIFT = 0,
306 NVME_CAP_CQR_SHIFT = 16,
307 NVME_CAP_AMS_SHIFT = 17,
308 NVME_CAP_TO_SHIFT = 24,
309 NVME_CAP_DSTRD_SHIFT = 32,
310 NVME_CAP_NSSRC_SHIFT = 36,
311 NVME_CAP_CSS_SHIFT = 37,
312 NVME_CAP_BPS_SHIFT = 45,
313 NVME_CAP_CPS_SHIFT = 46,
314 NVME_CAP_MPSMIN_SHIFT = 48,
315 NVME_CAP_MPSMAX_SHIFT = 52,
316 NVME_CAP_PMRS_SHIFT = 56,
317 NVME_CAP_CMBS_SHIFT = 57,
318 NVME_CAP_NSSS_SHIFT = 58,
319 NVME_CAP_CRMS_SHIFT = 59,
320 NVME_CAP_MQES_MASK = 0xffff,
321 NVME_CAP_CQR_MASK = 0x1,
322 NVME_CAP_AMS_MASK = 0x3,
323 NVME_CAP_TO_MASK = 0xff,
324 NVME_CAP_DSTRD_MASK = 0xf,
325 NVME_CAP_NSSRC_MASK = 0x1,
326 NVME_CAP_CSS_MASK = 0xff,
327 NVME_CAP_BPS_MASK = 0x1,
328 NVME_CAP_CPS_MASK = 0x3,
329 NVME_CAP_MPSMIN_MASK = 0xf,
330 NVME_CAP_MPSMAX_MASK = 0xf,
331 NVME_CAP_PMRS_MASK = 0x1,
332 NVME_CAP_CMBS_MASK = 0x1,
333 NVME_CAP_NSSS_MASK = 0x1,
334 NVME_CAP_CRMS_MASK = 0x3,
335 NVME_CAP_AMS_WRR = 1 << 0,
336 NVME_CAP_AMS_VS = 1 << 1,
337 NVME_CAP_CSS_NVM = 1 << 0,
338 NVME_CAP_CSS_CSI = 1 << 6,
339 NVME_CAP_CSS_ADMIN = 1 << 7,
340 NVME_CAP_CPS_NONE = 0,
341 NVME_CAP_CPS_CTRL = 1,
342 NVME_CAP_CPS_DOMAIN = 2,
343 NVME_CAP_CPS_NVMS = 3,
344 NVME_CAP_CRWMS = 1 << 0,
345 NVME_CAP_CRIMS = 1 << 1,
346 };
347
348 #define NVME_CAP_MQES(cap) NVME_GET(cap, CAP_MQES)
349 #define NVME_CAP_CQR(cap) NVME_GET(cap, CAP_CQR)
350 #define NVME_CAP_AMS(cap) NVME_GET(cap, CAP_AMS)
351 #define NVME_CAP_TO(cap) NVME_GET(cap, CAP_TO)
352 #define NVME_CAP_DSTRD(cap) NVME_GET(cap, CAP_DSTRD)
353 #define NVME_CAP_NSSRC(cap) NVME_GET(cap, CAP_NSSRC)
354 #define NVME_CAP_CSS(cap) NVME_GET(cap, CAP_CSS)
355 #define NVME_CAP_BPS(cap) NVME_GET(cap, CAP_BPS)
356 #define NVME_CAP_CPS(cap) NVME_GET(cap, CAP_CPS)
357 #define NVME_CAP_MPSMIN(cap) NVME_GET(cap, CAP_MPSMIN)
358 #define NVME_CAP_MPSMAX(cap) NVME_GET(cap, CAP_MPSMAX)
359 #define NVME_CAP_PMRS(cap) NVME_GET(cap, CAP_PMRS)
360 #define NVME_CAP_CMBS(cap) NVME_GET(cap, CAP_CMBS)
361 #define NVME_CAP_NSSS(cap) NVME_GET(cap, CAP_NSSS)
362 #define NVME_CAP_CRMS(cap) NVME_GET(cap, CAP_CRMS)
363
364 /**
365 * enum nvme_vs - This field indicates the version
366 * @NVME_VS_TER_SHIFT: Shift amount to get the tertiary version
367 * @NVME_VS_MNR_SHIFT: Shift amount to get the minor version
368 * @NVME_VS_MJR_SHIFT: Shift amount to get the major version
369 * @NVME_VS_TER_MASK: Mask to get the tertiary version
370 * @NVME_VS_MNR_MASK: Mask to get the minor version
371 * @NVME_VS_MJR_MASK: Mask to get the major version
372 */
373 enum nvme_vs {
374 NVME_VS_TER_SHIFT = 0,
375 NVME_VS_MNR_SHIFT = 8,
376 NVME_VS_MJR_SHIFT = 16,
377 NVME_VS_TER_MASK = 0xff,
378 NVME_VS_MNR_MASK = 0xff,
379 NVME_VS_MJR_MASK = 0xffff,
380 };
381
382 #define NVME_VS_TER(vs) NVME_GET(vs, VS_TER)
383 #define NVME_VS_MNR(vs) NVME_GET(vs, VS_MNR)
384 #define NVME_VS_MJR(vs) NVME_GET(vs, VS_MJR)
385
386 #define NVME_MAJOR(ver) NVME_VS_MJR(ver)
387 #define NVME_MINOR(ver) NVME_VS_MNR(ver)
388 #define NVME_TERTIARY(ver) NVME_VS_TER(ver)
389
390 /**
391 * enum nvme_cc - This field indicates the controller configuration
392 * @NVME_CC_EN_SHIFT: Shift amount to get the enable
393 * @NVME_CC_CSS_SHIFT: Shift amount to get the I/O command set selected
394 * @NVME_CC_MPS_SHIFT: Shift amount to get the memory page size
395 * @NVME_CC_AMS_SHIFT: Shift amount to get the arbitration mechanism selected
396 * @NVME_CC_SHN_SHIFT: Shift amount to get the shutdown notification
397 * @NVME_CC_IOSQES_SHIFT: Shift amount to get the I/O submission queue entry size
398 * @NVME_CC_IOCQES_SHIFT: Shift amount to get the I/O completion queue entry size
399 * @NVME_CC_CRIME_SHIFT: Shift amount to get the controller ready independent of media enable
400 * @NVME_CC_EN_MASK: Mask to get the enable
401 * @NVME_CC_CSS_MASK: Mask to get the I/O command set selected
402 * @NVME_CC_MPS_MASK: Mask to get the memory page size
403 * @NVME_CC_AMS_MASK: Mask to get the arbitration mechanism selected
404 * @NVME_CC_SHN_MASK: Mask to get the shutdown notification
405 * @NVME_CC_CRIME_MASK: Mask to get the I/O submission queue entry size
406 * @NVME_CC_IOSQES_MASK: Mask to get the I/O completion queue entry size
407 * @NVME_CC_IOCQES_MASK: Mask to get the controller ready independent of media enable
408 * @NVME_CC_CSS_NVM: NVM command set
409 * @NVME_CC_CSS_CSI: All supported I/O command sets
410 * @NVME_CC_CSS_ADMIN: Admin command set only
411 * @NVME_CC_AMS_RR: Round robin
412 * @NVME_CC_AMS_WRRU: Weighted round robin with urgent priority class
413 * @NVME_CC_AMS_VS: Vendor specific
414 * @NVME_CC_SHN_NONE: No notification; no effect
415 * @NVME_CC_SHN_NORMAL: Normal shutdown notification
416 * @NVME_CC_SHN_ABRUPT: Abrupt shutdown notification
417 * @NVME_CC_CRWME: Controller ready with media enable
418 * @NVME_CC_CRIME: Controller ready independent of media enable
419 */
420 enum nvme_cc {
421 NVME_CC_EN_SHIFT = 0,
422 NVME_CC_CSS_SHIFT = 4,
423 NVME_CC_MPS_SHIFT = 7,
424 NVME_CC_AMS_SHIFT = 11,
425 NVME_CC_SHN_SHIFT = 14,
426 NVME_CC_IOSQES_SHIFT = 16,
427 NVME_CC_IOCQES_SHIFT = 20,
428 NVME_CC_CRIME_SHIFT = 24,
429 NVME_CC_EN_MASK = 0x1,
430 NVME_CC_CSS_MASK = 0x7,
431 NVME_CC_MPS_MASK = 0xf,
432 NVME_CC_AMS_MASK = 0x7,
433 NVME_CC_SHN_MASK = 0x3,
434 NVME_CC_CRIME_MASK = 0x1,
435 NVME_CC_IOSQES_MASK = 0xf,
436 NVME_CC_IOCQES_MASK = 0xf,
437 NVME_CC_CSS_NVM = 0,
438 NVME_CC_CSS_CSI = 6,
439 NVME_CC_CSS_ADMIN = 7,
440 NVME_CC_AMS_RR = 0,
441 NVME_CC_AMS_WRRU = 1,
442 NVME_CC_AMS_VS = 7,
443 NVME_CC_SHN_NONE = 0,
444 NVME_CC_SHN_NORMAL = 1,
445 NVME_CC_SHN_ABRUPT = 2,
446 NVME_CC_CRWME = 0,
447 NVME_CC_CRIME = 1,
448 };
449
450 #define NVME_CC_EN(cc) NVME_GET(cc, CC_EN)
451 #define NVME_CC_CSS(cc) NVME_GET(cc, CC_CSS)
452 #define NVME_CC_MPS(cc) NVME_GET(cc, CC_MPS)
453 #define NVME_CC_AMS(cc) NVME_GET(cc, CC_AMS)
454 #define NVME_CC_SHN(cc) NVME_GET(cc, CC_SHN)
455 #define NVME_CC_IOSQES(cc) NVME_GET(cc, CC_IOSQES)
456 #define NVME_CC_IOCQES(cc) NVME_GET(cc, CC_IOCQES)
457 #define NVME_CC_CRIME(cc) NVME_GET(cc, CC_CRIME)
458
459 /**
460 * enum nvme_csts - This field indicates the controller status register
461 * @NVME_CSTS_RDY_SHIFT: Shift amount to get the ready
462 * @NVME_CSTS_CFS_SHIFT: Shift amount to get the controller fatal status
463 * @NVME_CSTS_SHST_SHIFT: Shift amount to get the shutdown status
464 * @NVME_CSTS_NSSRO_SHIFT: Shift amount to get the NVM subsystem reset occurred
465 * @NVME_CSTS_PP_SHIFT: Shift amount to get the processing paused
466 * @NVME_CSTS_ST_SHIFT: Shift amount to get the shutdown type
467 * @NVME_CSTS_RDY_MASK: Mask to get the ready
468 * @NVME_CSTS_CFS_MASK: Mask to get the controller fatal status
469 * @NVME_CSTS_SHST_MASK: Mask to get the shutdown status
470 * @NVME_CSTS_NSSRO_MASK: Mask to get the NVM subsystem reset occurred
471 * @NVME_CSTS_PP_MASK: Mask to get the processing paused
472 * @NVME_CSTS_ST_MASK: Mask to get the shutdown type
473 * @NVME_CSTS_SHST_NORMAL: Normal operation
474 * @NVME_CSTS_SHST_OCCUR: Shutdown processing occurring
475 * @NVME_CSTS_SHST_CMPLT: Shutdown processing complete
476 * @NVME_CSTS_SHN_MASK: Deprecated mask to get the shutdown status
477 */
478 enum nvme_csts {
479 NVME_CSTS_RDY_SHIFT = 0,
480 NVME_CSTS_CFS_SHIFT = 1,
481 NVME_CSTS_SHST_SHIFT = 2,
482 NVME_CSTS_NSSRO_SHIFT = 4,
483 NVME_CSTS_PP_SHIFT = 5,
484 NVME_CSTS_ST_SHIFT = 6,
485 NVME_CSTS_RDY_MASK = 0x1,
486 NVME_CSTS_CFS_MASK = 0x1,
487 NVME_CSTS_SHST_MASK = 0x3,
488 NVME_CSTS_NSSRO_MASK = 0x1,
489 NVME_CSTS_PP_MASK = 0x1,
490 NVME_CSTS_ST_MASK = 0x1,
491 NVME_CSTS_SHST_NORMAL = 0,
492 NVME_CSTS_SHST_OCCUR = 1,
493 NVME_CSTS_SHST_CMPLT = 2,
494 NVME_CSTS_SHN_MASK = NVME_CSTS_SHST_MASK, /* Deprecated */
495 };
496
497 #define NVME_CSTS_RDY(csts) NVME_GET(csts, CSTS_RDY)
498 #define NVME_CSTS_CFS(csts) NVME_GET(csts, CSTS_CFS)
499 #define NVME_CSTS_SHST(csts) NVME_GET(csts, CSTS_SHST)
500 #define NVME_CSTS_NSSRO(csts) NVME_GET(csts, CSTS_NSSRO)
501 #define NVME_CSTS_PP(csts) NVME_GET(csts, CSTS_PP)
502 #define NVME_CSTS_ST(csts) NVME_GET(csts, CSTS_ST)
503
504 /**
505 * enum nvme_aqa - This field indicates the admin queue attributes
506 * @NVME_AQA_ASQS_SHIFT: Shift amount to get the admin submission queue size
507 * @NVME_AQA_ACQS_SHIFT: Shift amount to get the admin completion queue size
508 * @NVME_AQA_ASQS_MASK: Mask to get the admin submission queue size
509 * @NVME_AQA_ACQS_MASK: Mask to get the admin completion queue size
510 */
511 enum nvme_aqa {
512 NVME_AQA_ASQS_SHIFT = 0,
513 NVME_AQA_ACQS_SHIFT = 16,
514 NVME_AQA_ASQS_MASK = 0xfff,
515 NVME_AQA_ACQS_MASK = 0xfff,
516 };
517
518 #define NVME_AQA_ASQS(aqa) NVME_GET(aqa, AQA_ASQS)
519 #define NVME_AQA_ACQS(aqa) NVME_GET(aqa, AQA_ACQS)
520
521 /**
522 * enum nvme_asq - This field indicates the admin submission queue base address
523 * @NVME_ASQ_ASQB_SHIFT: Shift amount to get the admin submission queue base
524 */
525 enum nvme_asq {
526 NVME_ASQ_ASQB_SHIFT = 12,
527 };
528 static const __u64 NVME_ASQ_ASQB_MASK = 0xfffffffffffffull;
529
530 #define NVME_ASQ_ASQB(asq) NVME_GET(asq, ASQ_ASQB)
531
532 /**
533 * enum nvme_acq - This field indicates the admin completion queue base address
534 * @NVME_ACQ_ACQB_SHIFT: Shift amount to get the admin completion queue base
535 */
536 enum nvme_acq {
537 NVME_ACQ_ACQB_SHIFT = 12,
538 };
539 static const __u64 NVME_ACQ_ACQB_MASK = 0xfffffffffffffull;
540
541 #define NVME_ACQ_ACQB(acq) NVME_GET(acq, ACQ_ACQB)
542
543 /**
544 * enum nvme_cmbloc - This field indicates the controller memory buffer location
545 * @NVME_CMBLOC_BIR_SHIFT: Shift amount to get the base indicator register
546 * @NVME_CMBLOC_CQMMS_SHIFT: Shift amount to get the CMB queue mixed memory support
547 * @NVME_CMBLOC_CQPDS_SHIFT: Shift amount to get the CMB queue physically discontiguous support
548 * @NVME_CMBLOC_CDPLMS_SHIFT: Shift amount to get the CMB data pointer mixed locations support
549 * @NVME_CMBLOC_CDPCILS_SHIFT: Shift amount to get the CMB data pointer and command independent locations support
550 * @NVME_CMBLOC_CDMMMS_SHIFT: Shift amount to get the CMB data metadata mixed memory support
551 * @NVME_CMBLOC_CQDA_SHIFT: Shift amount to get the CMB queue dword alignment
552 * @NVME_CMBLOC_OFST_SHIFT: Shift amount to get the offset
553 * @NVME_CMBLOC_BIR_MASK: Mask to get the base indicator register
554 * @NVME_CMBLOC_CQMMS_MASK: Mask to get the CMB queue mixed memory support
555 * @NVME_CMBLOC_CQPDS_MASK: Mask to get the CMB queue physically discontiguous support
556 * @NVME_CMBLOC_CDPLMS_MASK: Mask to get the CMB data pointer mixed locations support
557 * @NVME_CMBLOC_CDPCILS_MASK: Mask to get the CMB data pointer and command independent locations support
558 * @NVME_CMBLOC_CDMMMS_MASK: Mask to get the CMB data metadata mixed memory support
559 * @NVME_CMBLOC_CQDA_MASK: Mask to get the CMB queue dword alignment
560 * @NVME_CMBLOC_OFST_MASK: Mask to get the offset
561 */
562 enum nvme_cmbloc {
563 NVME_CMBLOC_BIR_SHIFT = 0,
564 NVME_CMBLOC_CQMMS_SHIFT = 3,
565 NVME_CMBLOC_CQPDS_SHIFT = 4,
566 NVME_CMBLOC_CDPLMS_SHIFT = 5,
567 NVME_CMBLOC_CDPCILS_SHIFT = 6,
568 NVME_CMBLOC_CDMMMS_SHIFT = 7,
569 NVME_CMBLOC_CQDA_SHIFT = 8,
570 NVME_CMBLOC_OFST_SHIFT = 12,
571 NVME_CMBLOC_BIR_MASK = 0x7,
572 NVME_CMBLOC_CQMMS_MASK = 0x1,
573 NVME_CMBLOC_CQPDS_MASK = 0x1,
574 NVME_CMBLOC_CDPLMS_MASK = 0x1,
575 NVME_CMBLOC_CDPCILS_MASK = 0x1,
576 NVME_CMBLOC_CDMMMS_MASK = 0x1,
577 NVME_CMBLOC_CQDA_MASK = 0x1,
578 NVME_CMBLOC_OFST_MASK = 0xfffff,
579 };
580
581 #define NVME_CMBLOC_BIR(cmbloc) NVME_GET(cmbloc, CMBLOC_BIR)
582 #define NVME_CMBLOC_CQMMS(cmbloc) NVME_GET(cmbloc, CMBLOC_CQMMS)
583 #define NVME_CMBLOC_CQPDS(cmbloc) NVME_GET(cmbloc, CMBLOC_CQPDS)
584 #define NVME_CMBLOC_CDPLMS(cmbloc) NVME_GET(cmbloc, CMBLOC_CDPLMS)
585 #define NVME_CMBLOC_CDPCILS(cmbloc) NVME_GET(cmbloc, CMBLOC_CDPCILS)
586 #define NVME_CMBLOC_CDMMMS(cmbloc) NVME_GET(cmbloc, CMBLOC_CDMMMS)
587 #define NVME_CMBLOC_CQDA(cmbloc) NVME_GET(cmbloc, CMBLOC_CQDA)
588 #define NVME_CMBLOC_OFST(cmbloc) NVME_GET(cmbloc, CMBLOC_OFST)
589
590 /**
591 * enum nvme_cmbsz - This field indicates the controller memory buffer size
592 * @NVME_CMBSZ_SQS_SHIFT: Shift amount to get the submission queue support
593 * @NVME_CMBSZ_CQS_SHIFT: Shift amount to get the completion queue support
594 * @NVME_CMBSZ_LISTS_SHIFT: Shift amount to get the PLP SGL list support
595 * @NVME_CMBSZ_RDS_SHIFT: Shift amount to get the read data support
596 * @NVME_CMBSZ_WDS_SHIFT: Shift amount to get the write data support
597 * @NVME_CMBSZ_SZU_SHIFT: Shift amount to get the size units
598 * @NVME_CMBSZ_SZ_SHIFT: Shift amount to get the size
599 * @NVME_CMBSZ_SQS_MASK: Mask to get the submission queue support
600 * @NVME_CMBSZ_CQS_MASK: Mask to get the completion queue support
601 * @NVME_CMBSZ_LISTS_MASK: Mask to get the PLP SGL list support
602 * @NVME_CMBSZ_RDS_MASK: Mask to get the read data support
603 * @NVME_CMBSZ_WDS_MASK: Mask to get the write data support
604 * @NVME_CMBSZ_SZU_MASK: Mask to get the size units
605 * @NVME_CMBSZ_SZ_MASK: Mask to get the size
606 * @NVME_CMBSZ_SZU_4K: 4 KiB
607 * @NVME_CMBSZ_SZU_64K: 64 KiB
608 * @NVME_CMBSZ_SZU_1M: 1 MiB
609 * @NVME_CMBSZ_SZU_16M: 16 MiB
610 * @NVME_CMBSZ_SZU_256M: 256 MiB
611 * @NVME_CMBSZ_SZU_4G: 4 GiB
612 * @NVME_CMBSZ_SZU_64G: 64 GiB
613 */
614 enum nvme_cmbsz {
615 NVME_CMBSZ_SQS_SHIFT = 0,
616 NVME_CMBSZ_CQS_SHIFT = 1,
617 NVME_CMBSZ_LISTS_SHIFT = 2,
618 NVME_CMBSZ_RDS_SHIFT = 3,
619 NVME_CMBSZ_WDS_SHIFT = 4,
620 NVME_CMBSZ_SZU_SHIFT = 8,
621 NVME_CMBSZ_SZ_SHIFT = 12,
622 NVME_CMBSZ_SQS_MASK = 0x1,
623 NVME_CMBSZ_CQS_MASK = 0x1,
624 NVME_CMBSZ_LISTS_MASK = 0x1,
625 NVME_CMBSZ_RDS_MASK = 0x1,
626 NVME_CMBSZ_WDS_MASK = 0x1,
627 NVME_CMBSZ_SZU_MASK = 0xf,
628 NVME_CMBSZ_SZ_MASK = 0xfffff,
629 NVME_CMBSZ_SZU_4K = 0,
630 NVME_CMBSZ_SZU_64K = 1,
631 NVME_CMBSZ_SZU_1M = 2,
632 NVME_CMBSZ_SZU_16M = 3,
633 NVME_CMBSZ_SZU_256M = 4,
634 NVME_CMBSZ_SZU_4G = 5,
635 NVME_CMBSZ_SZU_64G = 6,
636 };
637
638 #define NVME_CMBSZ_SQS(cmbsz) NVME_GET(cmbsz, CMBSZ_SQS)
639 #define NVME_CMBSZ_CQS(cmbsz) NVME_GET(cmbsz, CMBSZ_CQS)
640 #define NVME_CMBSZ_LISTS(cmbsz) NVME_GET(cmbsz, CMBSZ_LISTS)
641 #define NVME_CMBSZ_RDS(cmbsz) NVME_GET(cmbsz, CMBSZ_RDS)
642 #define NVME_CMBSZ_WDS(cmbsz) NVME_GET(cmbsz, CMBSZ_WDS)
643 #define NVME_CMBSZ_SZU(cmbsz) NVME_GET(cmbsz, CMBSZ_SZU)
644 #define NVME_CMBSZ_SZ(cmbsz) NVME_GET(cmbsz, CMBSZ_SZ)
645
646 /**
647 * nvme_cmb_size() - Calculate size of the controller memory buffer
648 * @cmbsz: Value from controller register %NVME_REG_CMBSZ
649 *
650 * Returns: size of controller memory buffer in bytes
651 */
652 static inline __u64 nvme_cmb_size(__u32 cmbsz)
653 {
654 return ((__u64)NVME_CMBSZ_SZ(cmbsz)) *
655 (1ULL << (12 + 4 * NVME_CMBSZ_SZU(cmbsz)));
656 }
657
658 /**
659 * enum nvme_bpinfo - This field indicates the boot partition information
660 * @NVME_BPINFO_BPSZ_SHIFT: Shift amount to get the boot partition size
661 * @NVME_BPINFO_BRS_SHIFT: Shift amount to get the boot read status
662 * @NVME_BPINFO_ABPID_SHIFT: Shift amount to get the active boot partition ID
663 * @NVME_BPINFO_BPSZ_MASK: Mask to get the boot partition size
664 * @NVME_BPINFO_BRS_MASK: Mask to get the boot read status
665 * @NVME_BPINFO_ABPID_MASK: Mask to get the active boot partition ID
666 * @NVME_BPINFO_BRS_NONE: No boot partition read operation requested
667 * @NVME_BPINFO_BRS_READ_IN_PROGRESS: Boot partition read in progress
668 * @NVME_BPINFO_BRS_READ_SUCCESS: Boot partition read completed successfully
669 * @NVME_BPINFO_BRS_READ_ERROR: Error completing boot partition read
670 */
671 enum nvme_bpinfo {
672 NVME_BPINFO_BPSZ_SHIFT = 0,
673 NVME_BPINFO_BRS_SHIFT = 24,
674 NVME_BPINFO_ABPID_SHIFT = 31,
675 NVME_BPINFO_BPSZ_MASK = 0x7fff,
676 NVME_BPINFO_BRS_MASK = 0x3,
677 NVME_BPINFO_ABPID_MASK = 0x1,
678 NVME_BPINFO_BRS_NONE = 0,
679 NVME_BPINFO_BRS_READ_IN_PROGRESS = 1,
680 NVME_BPINFO_BRS_READ_SUCCESS = 2,
681 NVME_BPINFO_BRS_READ_ERROR = 3,
682 };
683
684 #define NVME_BPINFO_BPSZ(bpinfo) NVME_GET(bpinfo, BPINFO_BPSZ)
685 #define NVME_BPINFO_BRS(bpinfo) NVME_GET(bpinfo, BPINFO_BRS)
686 #define NVME_BPINFO_ABPID(bpinfo) NVME_GET(bpinfo, BPINFO_ABPID)
687
688 /**
689 * enum nvme_bprsel - This field indicates the boot partition read select
690 * @NVME_BPRSEL_BPRSZ_SHIFT: Shift amount to get the boot partition read size
691 * @NVME_BPRSEL_BPROF_SHIFT: Shift amount to get the boot partition read offset
692 * @NVME_BPRSEL_BPID_SHIFT: Shift amount to get the boot partition identifier
693 * @NVME_BPRSEL_BPRSZ_MASK: Mask to get the boot partition read size
694 * @NVME_BPRSEL_BPROF_MASK: Mask to get the boot partition read offset
695 * @NVME_BPRSEL_BPID_MASK: Mask to get the boot partition identifier
696 */
697 enum nvme_bprsel {
698 NVME_BPRSEL_BPRSZ_SHIFT = 0,
699 NVME_BPRSEL_BPROF_SHIFT = 10,
700 NVME_BPRSEL_BPID_SHIFT = 31,
701 NVME_BPRSEL_BPRSZ_MASK = 0x3ff,
702 NVME_BPRSEL_BPROF_MASK = 0xfffff,
703 NVME_BPRSEL_BPID_MASK = 0x1,
704 };
705
706 #define NVME_BPRSEL_BPRSZ(bprsel) NVME_GET(bprsel, BPRSEL_BPRSZ)
707 #define NVME_BPRSEL_BPROF(bprsel) NVME_GET(bprsel, BPRSEL_BPROF)
708 #define NVME_BPRSEL_BPID(bprsel) NVME_GET(bprsel, BPRSEL_BPID)
709
710 /**
711 * enum nvme_bpmbl - This field indicates the boot partition memory buffer location
712 * @NVME_BPMBL_BMBBA_SHIFT: Shift amount to get the boot partition memory buffer base address
713 */
714 enum nvme_bpmbl {
715 NVME_BPMBL_BMBBA_SHIFT = 12,
716 };
717 static const __u64 NVME_BPMBL_BMBBA_MASK = 0xfffffffffffffull;
718
719 #define NVME_BPMBL_BMBBA(bpmbl) NVME_GET(bpmbl, BPMBL_BMBBA)
720
721 /**
722 * enum nvme_cmbmsc - This field indicates the controller memory buffer memory space control
723 * @NVME_CMBMSC_CRE_SHIFT: Shift amount to get the capabilities registers enabled
724 * @NVME_CMBMSC_CMSE_SHIFT: Shift amount to get the controller memory space enable
725 * @NVME_CMBMSC_CBA_SHIFT: Shift amount to get the controller base address
726 * @NVME_CMBMSC_CRE_MASK: Mask to get the capabilities registers enabled
727 * @NVME_CMBMSC_CMSE_MASK: Mask to get the controller memory space enable
728 */
729 enum nvme_cmbmsc {
730 NVME_CMBMSC_CRE_SHIFT = 0,
731 NVME_CMBMSC_CMSE_SHIFT = 1,
732 NVME_CMBMSC_CBA_SHIFT = 12,
733 NVME_CMBMSC_CRE_MASK = 0x1,
734 NVME_CMBMSC_CMSE_MASK = 0x1,
735 };
736 static const __u64 NVME_CMBMSC_CBA_MASK = 0xfffffffffffffull;
737
738 #define NVME_CMBMSC_CRE(cmbmsc) NVME_GET(cmbmsc, CMBMSC_CRE)
739 #define NVME_CMBMSC_CMSE(cmbmsc) NVME_GET(cmbmsc, CMBMSC_CMSE)
740 #define NVME_CMBMSC_CBA(cmbmsc) NVME_GET(cmbmsc, CMBMSC_CBA)
741
742 /**
743 * enum nvme_cmbsts - This field indicates the controller memory buffer status
744 * @NVME_CMBSTS_CBAI_SHIFT: Shift amount to get the controller base address invalid
745 * @NVME_CMBSTS_CBAI_MASK: Mask to get the controller base address invalid
746 */
747 enum nvme_cmbsts {
748 NVME_CMBSTS_CBAI_SHIFT = 0,
749 NVME_CMBSTS_CBAI_MASK = 0x1,
750 };
751
752 #define NVME_CMBSTS_CBAI(cmbsts) NVME_GET(cmbsts, CMBSTS_CBAI)
753
754 /**
755 * enum nvme_unit - Defined buffer size and write throughput granularity units
756 * @NVME_UNIT_B: Bytes or Bytes/second
757 * @NVME_UNIT_1K: 1 KiB or 1 KiB/second
758 * @NVME_UNIT_1M: 1 MiB or 1 MiB/second
759 * @NVME_UNIT_1G: 1 GiB or 1 GiB/second
760 */
761 enum nvme_unit {
762 NVME_UNIT_B = 0,
763 NVME_UNIT_1K = 1,
764 NVME_UNIT_1M = 2,
765 NVME_UNIT_1G = 3,
766 };
767
768 /**
769 * enum nvme_cmbebs - This field indicates the controller memory buffer elasticity buffer size
770 * @NVME_CMBEBS_CMBSZU_SHIFT: Shift amount to get the CMB elasticity buffer size units
771 * @NVME_CMBEBS_RBB_SHIFT: Shift amount to get the read bypass behavior
772 * @NVME_CMBEBS_CMBWBZ_SHIFT: Shift amount to get the CMB elasiticity buffer size base
773 * @NVME_CMBEBS_CMBSZU_MASK: Mask to get the CMB elasticity buffer size units
774 * @NVME_CMBEBS_RBB_MASK: Mask to get the read bypass behavior
775 * @NVME_CMBEBS_CMBWBZ_MASK: Mask to get the CMB elasiticity buffer size base
776 * @NVME_CMBEBS_CMBSZU_B: Bytes granularity
777 * @NVME_CMBEBS_CMBSZU_1K: 1 KiB granularity
778 * @NVME_CMBEBS_CMBSZU_1M: 1 MiB granularity
779 * @NVME_CMBEBS_CMBSZU_1G: 1 GiB granularity
780 */
781 enum nvme_cmbebs {
782 NVME_CMBEBS_CMBSZU_SHIFT = 0,
783 NVME_CMBEBS_RBB_SHIFT = 4,
784 NVME_CMBEBS_CMBWBZ_SHIFT = 8,
785 NVME_CMBEBS_CMBSZU_MASK = 0xf,
786 NVME_CMBEBS_RBB_MASK = 0x1,
787 NVME_CMBEBS_CMBWBZ_MASK = 0xffffff,
788 NVME_CMBEBS_CMBSZU_B = NVME_UNIT_B,
789 NVME_CMBEBS_CMBSZU_1K = NVME_UNIT_1K,
790 NVME_CMBEBS_CMBSZU_1M = NVME_UNIT_1M,
791 NVME_CMBEBS_CMBSZU_1G = NVME_UNIT_1G,
792 };
793
794 #define NVME_CMBEBS_CMBSZU(cmbebs) NVME_GET(cmbebs, CMBEBS_CMBSZU)
795 #define NVME_CMBEBS_RBB(cmbebs) NVME_GET(cmbebs, CMBEBS_RBB)
796 #define NVME_CMBEBS_CMBWBZ(cmbebs) NVME_GET(cmbebs, CMBEBS_CMBWBZ)
797
798 /**
799 * enum nvme_cmbswtp - This field indicates the controller memory buffer sustained write throughput
800 * @NVME_CMBSWTP_CMBSWTU_SHIFT: Shift amount to get the CMB sustained write throughput units
801 * @NVME_CMBSWTP_CMBSWTV_SHIFT: Shift amount to get the CMB sustained write throughput
802 * @NVME_CMBSWTP_CMBSWTU_MASK: Mask to get the CMB sustained write throughput units
803 * @NVME_CMBSWTP_CMBSWTV_MASK: Mask to get the CMB sustained write throughput
804 * @NVME_CMBSWTP_CMBSWTU_B: Bytes/second granularity
805 * @NVME_CMBSWTP_CMBSWTU_1K: 1 KiB/second granularity
806 * @NVME_CMBSWTP_CMBSWTU_1M: 1 MiB/second granularity
807 * @NVME_CMBSWTP_CMBSWTU_1G: 1 GiB/second granularity
808 */
809 enum nvme_cmbswtp {
810 NVME_CMBSWTP_CMBSWTU_SHIFT = 0,
811 NVME_CMBSWTP_CMBSWTV_SHIFT = 8,
812 NVME_CMBSWTP_CMBSWTU_MASK = 0xf,
813 NVME_CMBSWTP_CMBSWTV_MASK = 0xffffff,
814 NVME_CMBSWTP_CMBSWTU_B = NVME_UNIT_B,
815 NVME_CMBSWTP_CMBSWTU_1K = NVME_UNIT_1K,
816 NVME_CMBSWTP_CMBSWTU_1M = NVME_UNIT_1M,
817 NVME_CMBSWTP_CMBSWTU_1G = NVME_UNIT_1G,
818 };
819
820 #define NVME_CMBSWTP_CMBSWTU(cmbswtp) NVME_GET(cmbswtp, CMBSWTP_CMBSWTU)
821 #define NVME_CMBSWTP_CMBSWTV(cmbswtp) NVME_GET(cmbswtp, CMBSWTP_CMBSWTV)
822
823 /**
824 * enum nvme_crto - This field indicates the controller ready timeouts
825 * @NVME_CRTO_CRWMT_SHIFT: Shift amount to get the controller ready with media timeout
826 * @NVME_CRTO_CRIMT_SHIFT: Shift amount to get the controller ready independent of media timeout
827 * @NVME_CRTO_CRWMT_MASK: Mask to get the controller ready with media timeout
828 * @NVME_CRTO_CRIMT_MASK: Mask to get the controller ready independent of media timeout
829 */
830 enum nvme_crto {
831 NVME_CRTO_CRWMT_SHIFT = 0,
832 NVME_CRTO_CRIMT_SHIFT = 16,
833 NVME_CRTO_CRWMT_MASK = 0xffff,
834 NVME_CRTO_CRIMT_MASK = 0xffff,
835 };
836
837 #define NVME_CRTO_CRIMT(crto) NVME_GET(crto, CRTO_CRIMT)
838 #define NVME_CRTO_CRWMT(crto) NVME_GET(crto, CRTO_CRWMT)
839
840 /**
841 * enum nvme_pmrcap - This field indicates the persistent memory region capabilities
842 * @NVME_PMRCAP_RDS_SHIFT: Shift amount to get the read data support
843 * @NVME_PMRCAP_WDS_SHIFT: Shift amount to get the write data support
844 * @NVME_PMRCAP_BIR_SHIFT: Shift amount to get the base indicator register
845 * @NVME_PMRCAP_PMRTU_SHIFT: Shift amount to get the persistent memory region time units
846 * @NVME_PMRCAP_PMRWBM_SHIFT: Shift amount to get the persistent memory region write barrier mechanisms
847 * @NVME_PMRCAP_PMRTO_SHIFT: Shift amount to get the persistent memory region timeout
848 * @NVME_PMRCAP_CMSS_SHIFT: Shift amount to get the controller memory space supported
849 * @NVME_PMRCAP_PMRWMB_SHIFT: Deprecated shift amount to get the persistent memory region write barrier mechanisms
850 * @NVME_PMRCAP_RDS_MASK: Mask to get the read data support
851 * @NVME_PMRCAP_WDS_MASK: Mask to get the write data support
852 * @NVME_PMRCAP_BIR_MASK: Mask to get the base indicator register
853 * @NVME_PMRCAP_PMRTU_MASK: Mask to get the persistent memory region time units
854 * @NVME_PMRCAP_PMRWBM_MASK: Mask to get the persistent memory region write barrier mechanisms
855 * @NVME_PMRCAP_PMRTO_MASK: Mask to get the persistent memory region timeout
856 * @NVME_PMRCAP_CMSS_MASK: Mask to get the controller memory space supported
857 * @NVME_PMRCAP_PMRWMB_MASK: Deprecated mask to get the persistent memory region write barrier mechanisms
858 * @NVME_PMRCAP_PMRTU_500MS: 500 milliseconds
859 * @NVME_PMRCAP_PMRTU_60S: minutes
860 */
861 enum nvme_pmrcap {
862 NVME_PMRCAP_RDS_SHIFT = 3,
863 NVME_PMRCAP_WDS_SHIFT = 4,
864 NVME_PMRCAP_BIR_SHIFT = 5,
865 NVME_PMRCAP_PMRTU_SHIFT = 8,
866 NVME_PMRCAP_PMRWBM_SHIFT = 10,
867 NVME_PMRCAP_PMRTO_SHIFT = 16,
868 NVME_PMRCAP_CMSS_SHIFT = 24,
869 NVME_PMRCAP_PMRWMB_SHIFT = NVME_PMRCAP_PMRWBM_SHIFT, /* Deprecated */
870 NVME_PMRCAP_RDS_MASK = 0x1,
871 NVME_PMRCAP_WDS_MASK = 0x1,
872 NVME_PMRCAP_BIR_MASK = 0x7,
873 NVME_PMRCAP_PMRTU_MASK = 0x3,
874 NVME_PMRCAP_PMRWBM_MASK = 0xf,
875 NVME_PMRCAP_PMRTO_MASK = 0xff,
876 NVME_PMRCAP_CMSS_MASK = 0x1,
877 NVME_PMRCAP_PMRWMB_MASK = NVME_PMRCAP_PMRWBM_MASK, /* Deprecated */
878 NVME_PMRCAP_PMRTU_500MS = 0,
879 NVME_PMRCAP_PMRTU_60S = 1,
880 };
881
882 #define NVME_PMRCAP_RDS(pmrcap) NVME_GET(pmrcap, PMRCAP_RDS)
883 #define NVME_PMRCAP_WDS(pmrcap) NVME_GET(pmrcap, PMRCAP_WDS)
884 #define NVME_PMRCAP_BIR(pmrcap) NVME_GET(pmrcap, PMRCAP_BIR)
885 #define NVME_PMRCAP_PMRTU(pmrcap) NVME_GET(pmrcap, PMRCAP_PMRTU)
886 #define NVME_PMRCAP_PMRWBM(pmrcap) NVME_GET(pmrcap, PMRCAP_PMRWBM)
887 #define NVME_PMRCAP_PMRTO(pmrcap) NVME_GET(pmrcap, PMRCAP_PMRTO)
888 #define NVME_PMRCAP_CMSS(pmrcap) NVME_GET(pmrcap, PMRCAP_CMSS)
889 #define NVME_PMRCAP_PMRWMB(pmrcap) NVME_GET(pmrcap, PMRCAP_PMRWMB) /* Deprecated */
890
891 /**
892 * enum nvme_pmrctl - This field indicates the persistent memory region control
893 * @NVME_PMRCTL_EN_SHIFT: Shift amount to get the enable
894 * @NVME_PMRCTL_EN_MASK: Mask to get the enable
895 */
896 enum nvme_pmrctl {
897 NVME_PMRCTL_EN_SHIFT = 0,
898 NVME_PMRCTL_EN_MASK = 0x1,
899 };
900
901 #define NVME_PMRCTL_EN(pmrctl) NVME_GET(pmrctl, PMRCTL_EN)
902
903 /**
904 * enum nvme_pmrsts - This field indicates the persistent memory region status
905 * @NVME_PMRSTS_ERR_SHIFT: Shift amount to get the error
906 * @NVME_PMRSTS_NRDY_SHIFT: Shift amount to get the not ready
907 * @NVME_PMRSTS_HSTS_SHIFT: Shift amount to get the health status
908 * @NVME_PMRSTS_CBAI_SHIFT: Shift amount to get the controller base address invalid
909 * @NVME_PMRSTS_ERR_MASK: Mask to get the error
910 * @NVME_PMRSTS_NRDY_MASK: Mask to get the not ready
911 * @NVME_PMRSTS_HSTS_MASK: Mask to get the health status
912 * @NVME_PMRSTS_CBAI_MASK: Mask to get the controller base address invalid
913 */
914 enum nvme_pmrsts {
915 NVME_PMRSTS_ERR_SHIFT = 0,
916 NVME_PMRSTS_NRDY_SHIFT = 8,
917 NVME_PMRSTS_HSTS_SHIFT = 9,
918 NVME_PMRSTS_CBAI_SHIFT = 12,
919 NVME_PMRSTS_ERR_MASK = 0xff,
920 NVME_PMRSTS_NRDY_MASK = 0x1,
921 NVME_PMRSTS_HSTS_MASK = 0x7,
922 NVME_PMRSTS_CBAI_MASK = 0x1,
923 };
924
925 #define NVME_PMRSTS_ERR(pmrsts) NVME_GET(pmrsts, PMRSTS_ERR)
926 #define NVME_PMRSTS_NRDY(pmrsts) NVME_GET(pmrsts, PMRSTS_NRDY)
927 #define NVME_PMRSTS_HSTS(pmrsts) NVME_GET(pmrsts, PMRSTS_HSTS)
928 #define NVME_PMRSTS_CBAI(pmrsts) NVME_GET(pmrsts, PMRSTS_CBAI)
929
930 /**
931 * enum nvme_pmrebs - This field indicates the persistent memory region elasticity buffer size
932 * @NVME_PMREBS_PMRSZU_SHIFT: Shift amount to get the PMR elasticity buffer size units
933 * @NVME_PMREBS_RBB_SHIFT: Shift amount to get the read bypass behavior
934 * @NVME_PMREBS_PMRWBZ_SHIFT: Shift amount to get the PMR elasticity buffer size base
935 * @NVME_PMREBS_PMRSZU_MASK: Mask to get the PMR elasticity buffer size units
936 * @NVME_PMREBS_RBB_MASK: Mask to get the read bypass behavior
937 * @NVME_PMREBS_PMRWBZ_MASK: Mask to get the PMR elasticity buffer size base
938 * @NVME_PMREBS_PMRSZU_B: Bytes
939 * @NVME_PMREBS_PMRSZU_1K: 1 KiB
940 * @NVME_PMREBS_PMRSZU_1M: 1 MiB
941 * @NVME_PMREBS_PMRSZU_1G: 1 GiB
942 */
943 enum nvme_pmrebs {
944 NVME_PMREBS_PMRSZU_SHIFT = 0,
945 NVME_PMREBS_RBB_SHIFT = 4,
946 NVME_PMREBS_PMRWBZ_SHIFT = 8,
947 NVME_PMREBS_PMRSZU_MASK = 0xf,
948 NVME_PMREBS_RBB_MASK = 0x1,
949 NVME_PMREBS_PMRWBZ_MASK = 0xffffff,
950 NVME_PMREBS_PMRSZU_B = NVME_UNIT_B,
951 NVME_PMREBS_PMRSZU_1K = NVME_UNIT_1K,
952 NVME_PMREBS_PMRSZU_1M = NVME_UNIT_1M,
953 NVME_PMREBS_PMRSZU_1G = NVME_UNIT_1G,
954 };
955
956 #define NVME_PMREBS_PMRSZU(pmrebs) NVME_GET(pmrebs, PMREBS_PMRSZU)
957 #define NVME_PMREBS_RBB(pmrebs) NVME_GET(pmrebs, PMREBS_RBB)
958 #define NVME_PMREBS_PMRWBZ(pmrebs) NVME_GET(pmrebs, PMREBS_PMRWBZ)
959
960 /**
961 * nvme_pmr_size() - Calculate size of persistent memory region elasticity
962 * buffer
963 * @pmrebs: Value from controller register %NVME_REG_PMREBS
964 *
965 * Returns: size of controller persistent memory buffer in bytes
966 */
967 static inline __u64 nvme_pmr_size(__u32 pmrebs)
968 {
969 return ((__u64)NVME_PMREBS_PMRWBZ(pmrebs)) *
970 (1ULL << (10 * NVME_PMREBS_PMRSZU(pmrebs)));
971 }
972
973 /**
974 * enum nvme_pmrswtp - This field indicates the persistent memory region sustained write throughput
975 * @NVME_PMRSWTP_PMRSWTU_SHIFT: Shift amount to get the PMR sustained write throughput units
976 * @NVME_PMRSWTP_PMRSWTV_SHIFT: Shift amount to get the PMR sustained write throughput
977 * @NVME_PMRSWTP_PMRSWTU_MASK: Mask to get the PMR sustained write throughput units
978 * @NVME_PMRSWTP_PMRSWTV_MASK: Mask to get the PMR sustained write throughput
979 * @NVME_PMRSWTP_PMRSWTU_BPS: Bytes per second
980 * @NVME_PMRSWTP_PMRSWTU_KBPS: 1 KiB / s
981 * @NVME_PMRSWTP_PMRSWTU_MBPS: 1 MiB / s
982 * @NVME_PMRSWTP_PMRSWTU_GBPS: 1 GiB / s
983 */
984 enum nvme_pmrswtp {
985 NVME_PMRSWTP_PMRSWTU_SHIFT = 0,
986 NVME_PMRSWTP_PMRSWTV_SHIFT = 8,
987 NVME_PMRSWTP_PMRSWTU_MASK = 0xf,
988 NVME_PMRSWTP_PMRSWTV_MASK = 0xffffff,
989 NVME_PMRSWTP_PMRSWTU_BPS = NVME_UNIT_B,
990 NVME_PMRSWTP_PMRSWTU_KBPS = NVME_UNIT_1K,
991 NVME_PMRSWTP_PMRSWTU_MBPS = NVME_UNIT_1M,
992 NVME_PMRSWTP_PMRSWTU_GBPS = NVME_UNIT_1G,
993 };
994
995 #define NVME_PMRSWTP_PMRSWTU(pmrswtp) NVME_GET(pmrswtp, PMRSWTP_PMRSWTU)
996 #define NVME_PMRSWTP_PMRSWTV(pmrswtp) NVME_GET(pmrswtp, PMRSWTP_PMRSWTU)
997
998 /**
999 * nvme_pmr_throughput() - Calculate throughput of persistent memory buffer
1000 * @pmrswtp: Value from controller register %NVME_REG_PMRSWTP
1001 *
1002 * Returns: throughput of controller persistent memory buffer in bytes/second
1003 */
1004 static inline __u64 nvme_pmr_throughput(__u32 pmrswtp)
1005 {
1006 return ((__u64)NVME_PMRSWTP_PMRSWTV(pmrswtp)) *
1007 (1ULL << (10 * NVME_PMRSWTP_PMRSWTU(pmrswtp)));
1008 }
1009
1010 /**
1011 * enum nvme_pmrmsc - This field indicates the persistent memory region memory space control
1012 * @NVME_PMRMSC_CMSE_SHIFT: Shift amount to get the controller memory space enable
1013 * @NVME_PMRMSC_CBA_SHIFT: Shift amount to get the controller base address
1014 * @NVME_PMRMSC_CMSE_MASK: Mask to get the controller memory space enable
1015 */
1016 enum nvme_pmrmsc {
1017 NVME_PMRMSC_CMSE_SHIFT = 1,
1018 NVME_PMRMSC_CBA_SHIFT = 12,
1019 NVME_PMRMSC_CMSE_MASK = 0x1,
1020 };
1021 static const __u64 NVME_PMRMSC_CBA_MASK = 0xfffffffffffffull;
1022
1023 #define NVME_PMRMSC_CMSE(pmrmsc) NVME_GET(pmrmsc, PMRMSC_CMSE)
1024 #define NVME_PMRMSC_CBA(pmrmsc) NVME_GET(pmrmsc, PMRMSC_CBA)
1025
1026 /**
1027 * enum nvme_flbas - This field indicates the formatted LBA size
1028 * @NVME_FLBAS_LOWER_SHIFT: Shift amount to get the format index least significant 4 bits
1029 * @NVME_FLBAS_META_EXT_SHIFT: Shift amount to get the metadata transferred
1030 * @NVME_FLBAS_HIGHER_SHIFT: Shift amount to get the format index most significant 2 bits
1031 * @NVME_FLBAS_LOWER_MASK: Mask to get the format index least significant 4 bits
1032 * @NVME_FLBAS_META_EXT_MASK: Mask to get the metadata transferred
1033 * @NVME_FLBAS_HIGHER_MASK: Mask to get the format index most significant 2 bits
1034 */
1035 enum nvme_flbas {
1036 NVME_FLBAS_LOWER_SHIFT = 0,
1037 NVME_FLBAS_META_EXT_SHIFT = 4,
1038 NVME_FLBAS_HIGHER_SHIFT = 5,
1039 NVME_FLBAS_LOWER_MASK = 0xf,
1040 NVME_FLBAS_META_EXT_MASK = 0x1,
1041 NVME_FLBAS_HIGHER_MASK = 0x3,
1042 };
1043
1044 #define NVME_FLBAS_LOWER(flbas) NVME_GET(flbas, FLBAS_LOWER)
1045 #define NVME_FLBAS_META_EXT(flbas) NVME_GET(flbas, FLBAS_META_EXT)
1046 #define NVME_FLBAS_HIGHER(flbas) NVME_GET(flbas, FLBAS_HIGHER)
1047
1048 /**
1049 * enum nvme_psd_flags - Possible flag values in nvme power state descriptor
1050 * @NVME_PSD_FLAGS_MXPS: Indicates the scale for the Maximum Power
1051 * field. If this bit is cleared, then the scale of the
1052 * Maximum Power field is in 0.01 Watts. If this bit is
1053 * set, then the scale of the Maximum Power field is in
1054 * 0.0001 Watts.
1055 * @NVME_PSD_FLAGS_NOPS: Indicates whether the controller processes I/O
1056 * commands in this power state. If this bit is cleared,
1057 * then the controller processes I/O commands in this
1058 * power state. If this bit is set, then the controller
1059 * does not process I/O commands in this power state.
1060 */
1061 enum nvme_psd_flags {
1062 NVME_PSD_FLAGS_MXPS = 1 << 0,
1063 NVME_PSD_FLAGS_NOPS = 1 << 1,
1064 };
1065
1066 /**
1067 * enum nvme_psd_ps - Known values for &struct nvme_psd %ips and %aps. Use with
1068 * nvme_psd_power_scale() to extract the power scale field
1069 * to match this enum.
1070 * @NVME_PSD_PS_NOT_REPORTED: Not reported
1071 * @NVME_PSD_PS_100_MICRO_WATT: 0.0001 watt scale
1072 * @NVME_PSD_PS_10_MILLI_WATT: 0.01 watt scale
1073 */
1074 enum nvme_psd_ps {
1075 NVME_PSD_PS_NOT_REPORTED = 0,
1076 NVME_PSD_PS_100_MICRO_WATT = 1,
1077 NVME_PSD_PS_10_MILLI_WATT = 2,
1078 };
1079
1080 /**
1081 * nvme_psd_power_scale() - power scale occupies the upper 3 bits
1082 * @ps: power scale value
1083 *
1084 * Returns: power scale value
1085 */
1086 static inline unsigned int nvme_psd_power_scale(__u8 ps)
1087 {
1088 return ps >> 6;
1089 }
1090
1091 /**
1092 * enum nvme_psd_workload - Specifies a workload hint in the Power Management
1093 * Feature (see &struct nvme_psd.apw) to inform the
1094 * NVM subsystem or indicate the conditions for the
1095 * active power level.
1096 * @NVME_PSD_WORKLOAD_NP: The workload is unknown or not provided.
1097 * @NVME_PSD_WORKLOAD_1: Extended Idle Period with a Burst of Random Write
1098 * consists of five minutes of idle followed by
1099 * thirty-two random write commands of size 1 MiB
1100 * submitted to a single controller while all other
1101 * controllers in the NVM subsystem are idle, and then
1102 * thirty (30) seconds of idle.
1103 * @NVME_PSD_WORKLOAD_2: Heavy Sequential Writes consists of 80,000
1104 * sequential write commands of size 128 KiB submitted to
1105 * a single controller while all other controllers in the
1106 * NVM subsystem are idle. The submission queue(s)
1107 * should be sufficiently large allowing the host to
1108 * ensure there are multiple commands pending at all
1109 * times during the workload.
1110 */
1111 enum nvme_psd_workload {
1112 NVME_PSD_WORKLOAD_NP = 0,
1113 NVME_PSD_WORKLOAD_1 = 1,
1114 NVME_PSD_WORKLOAD_2 = 2,
1115 };
1116
1117 /**
1118 * struct nvme_id_psd - Power Management data structure
1119 * @mp: Maximum Power indicates the sustained maximum power consumed by the
1120 * NVM subsystem in this power state. The power in Watts is equal to
1121 * the value in this field multiplied by the scale specified in the Max
1122 * Power Scale bit (see &enum nvme_psd_flags). A value of 0 indicates
1123 * Maximum Power is not reported.
1124 * @rsvd2: Reserved
1125 * @flags: Additional decoding flags, see &enum nvme_psd_flags.
1126 * @enlat: Entry Latency indicates the maximum latency in microseconds
1127 * associated with entering this power state. A value of 0 indicates
1128 * Entry Latency is not reported.
1129 * @exlat: Exit Latency indicates the maximum latency in microseconds
1130 * associated with exiting this power state. A value of 0 indicates
1131 * Exit Latency is not reported.
1132 * @rrt: Relative Read Throughput indicates the read throughput rank
1133 * associated with this power state relative to others. The value in
1134 * this is less than the number of supported power states.
1135 * @rrl: Relative Read Latency indicates the read latency rank associated
1136 * with this power state relative to others. The value in this field is
1137 * less than the number of supported power states.
1138 * @rwt: Relative Write Throughput indicates write throughput rank associated
1139 * with this power state relative to others. The value in this field is
1140 * less than the number of supported power states
1141 * @rwl: Relative Write Latency indicates the write latency rank associated
1142 * with this power state relative to others. The value in this field is
1143 * less than the number of supported power states
1144 * @idlp: Idle Power indicates the typical power consumed by the NVM
1145 * subsystem over 30 seconds in this power state when idle.
1146 * @ips: Idle Power Scale indicates the scale for &struct nvme_id_psd.idlp,
1147 * see &enum nvme_psd_ps for decoding this field.
1148 * @rsvd19: Reserved
1149 * @actp: Active Power indicates the largest average power consumed by the
1150 * NVM subsystem over a 10 second period in this power state with
1151 * the workload indicated in the Active Power Workload field.
1152 * @apws: Bits 7-6: Active Power Scale(APS) indicates the scale for the &struct
1153 * nvme_id_psd.actp, see &enum nvme_psd_ps for decoding this value.
1154 * Bits 2-0: Active Power Workload(APW) indicates the workload
1155 * used to calculate maximum power for this power state.
1156 * See &enum nvme_psd_workload for decoding this field.
1157 * @epfrt: Emergency power fail recovery time
1158 * @fqvt: Forced quiescence vault time
1159 * @epfvt: Emergency power fail vault time
1160 * @epfr_fqv_ts: Bits 7-4: Forced quiescence vault time scale
1161 * Bits 3-0: Emergency power fail recovery time scale
1162 * @epfvts: Bits 3-0: Emergency power fail vault time scale
1163 * @rsvd28: Reserved
1164 */
1165 struct nvme_id_psd {
1166 __le16 mp;
1167 __u8 rsvd2;
1168 __u8 flags;
1169 __le32 enlat;
1170 __le32 exlat;
1171 __u8 rrt;
1172 __u8 rrl;
1173 __u8 rwt;
1174 __u8 rwl;
1175 __le16 idlp;
1176 __u8 ips;
1177 __u8 rsvd19;
1178 __le16 actp;
1179 __u8 apws;
1180 __u8 epfrt;
1181 __u8 fqvt;
1182 __u8 epfvt;
1183 __u8 epfr_fqv_ts;
1184 __u8 epfvts;
1185 __u8 rsvd28[4];
1186 };
1187
1188 /**
1189 * struct nvme_id_ctrl - Identify Controller data structure
1190 * @vid: PCI Vendor ID, the company vendor identifier that is assigned by
1191 * the PCI SIG.
1192 * @ssvid: PCI Subsystem Vendor ID, the company vendor identifier that is
1193 * assigned by the PCI SIG for the subsystem.
1194 * @sn: Serial Number in ASCII
1195 * @mn: Model Number in ASCII
1196 * @fr: Firmware Revision in ASCII, the currently active firmware
1197 * revision for the NVM subsystem
1198 * @rab: Recommended Arbitration Burst, reported as a power of two
1199 * @ieee: IEEE assigned Organization Unique Identifier
1200 * @cmic: Controller Multipath IO and Namespace Sharing Capabilities of
1201 * the controller and NVM subsystem. See &enum nvme_id_ctrl_cmic.
1202 * @mdts: Max Data Transfer Size is the largest data transfer size. The
1203 * host should not submit a command that exceeds this maximum data
1204 * transfer size. The value is in units of the minimum memory page
1205 * size (CAP.MPSMIN) and is reported as a power of two
1206 * @cntlid: Controller ID, the NVM subsystem unique controller identifier
1207 * associated with the controller.
1208 * @ver: Version, this field contains the value reported in the Version
1209 * register, or property (see &enum nvme_registers %NVME_REG_VS).
1210 * @rtd3r: RTD3 Resume Latency, the expected latency in microseconds to resume
1211 * from Runtime D3
1212 * @rtd3e: RTD3 Exit Latency, the typical latency in microseconds to enter
1213 * Runtime D3.
1214 * @oaes: Optional Async Events Supported, see @enum nvme_id_ctrl_oaes.
1215 * @ctratt: Controller Attributes, see @enum nvme_id_ctrl_ctratt.
1216 * @rrls: Read Recovery Levels. If a bit is set, then the corresponding
1217 * Read Recovery Level is supported. If a bit is cleared, then the
1218 * corresponding Read Recovery Level is not supported.
1219 * @bpcap: Boot Partition Capabilities, see &enum nvme_id_ctrl_bpcap.
1220 * @rsvd103: Reserved
1221 * @nssl: NVM Subsystem Shutdown Latency (NSSL). This field indicates the
1222 * typical latency in microseconds for an NVM Subsystem Shutdown to
1223 * complete.
1224 * @rsvd108: Reserved
1225 * @plsi: Power Loss Signaling Information (PLSI), see &enum nvme_id_ctrl_plsi
1226 * @cntrltype: Controller Type, see &enum nvme_id_ctrl_cntrltype
1227 * @fguid: FRU GUID, a 128-bit value that is globally unique for a given
1228 * Field Replaceable Unit
1229 * @crdt1: Controller Retry Delay time in 100 millisecond units if CQE CRD
1230 * field is 1
1231 * @crdt2: Controller Retry Delay time in 100 millisecond units if CQE CRD
1232 * field is 2
1233 * @crdt3: Controller Retry Delay time in 100 millisecond units if CQE CRD
1234 * field is 3
1235 * @crcap: Controller Reachability Capabilities (CRCAP), see
1236 * &enum nvme_id_ctrl_crcap
1237 * @rsvd135: Reserved
1238 * @nvmsr: NVM Subsystem Report, see &enum nvme_id_ctrl_nvmsr
1239 * @vwci: VPD Write Cycle Information, see &enum nvme_id_ctrl_vwci
1240 * @mec: Management Endpoint Capabilities, see &enum nvme_id_ctrl_mec
1241 * @oacs: Optional Admin Command Support,the optional Admin commands and
1242 * features supported by the controller, see &enum nvme_id_ctrl_oacs.
1243 * @acl: Abort Command Limit, the maximum number of concurrently
1244 * executing Abort commands supported by the controller. This is a
1245 * 0's based value.
1246 * @aerl: Async Event Request Limit, the maximum number of concurrently
1247 * outstanding Asynchronous Event Request commands supported by the
1248 * controller This is a 0's based value.
1249 * @frmw: Firmware Updates indicates capabilities regarding firmware
1250 * updates. See &enum nvme_id_ctrl_frmw.
1251 * @lpa: Log Page Attributes, see &enum nvme_id_ctrl_lpa.
1252 * @elpe: Error Log Page Entries, the maximum number of Error Information
1253 * log entries that are stored by the controller. This field is a
1254 * 0's based value.
1255 * @npss: Number of Power States Supported, the number of NVM Express
1256 * power states supported by the controller, indicating the number
1257 * of valid entries in &struct nvme_id_ctrl.psd. This is a 0's
1258 * based value.
1259 * @avscc: Admin Vendor Specific Command Configuration, see
1260 * &enum nvme_id_ctrl_avscc.
1261 * @apsta: Autonomous Power State Transition Attributes, see
1262 * &enum nvme_id_ctrl_apsta.
1263 * @wctemp: Warning Composite Temperature Threshold indicates
1264 * the minimum Composite Temperature field value (see &struct
1265 * nvme_smart_log.critical_comp_time) that indicates an overheating
1266 * condition during which controller operation continues.
1267 * @cctemp: Critical Composite Temperature Threshold, field indicates the
1268 * minimum Composite Temperature field value (see &struct
1269 * nvme_smart_log.critical_comp_time) that indicates a critical
1270 * overheating condition.
1271 * @mtfa: Maximum Time for Firmware Activation indicates the maximum time
1272 * the controller temporarily stops processing commands to activate
1273 * the firmware image, specified in 100 millisecond units. This
1274 * field is always valid if the controller supports firmware
1275 * activation without a reset.
1276 * @hmpre: Host Memory Buffer Preferred Size indicates the preferred size
1277 * that the host is requested to allocate for the Host Memory
1278 * Buffer feature in 4 KiB units.
1279 * @hmmin: Host Memory Buffer Minimum Size indicates the minimum size that
1280 * the host is requested to allocate for the Host Memory Buffer
1281 * feature in 4 KiB units.
1282 * @tnvmcap: Total NVM Capacity, the total NVM capacity in the NVM subsystem.
1283 * The value is in bytes.
1284 * @unvmcap: Unallocated NVM Capacity, the unallocated NVM capacity in the
1285 * NVM subsystem. The value is in bytes.
1286 * @rpmbs: Replay Protected Memory Block Support, see
1287 * &enum nvme_id_ctrl_rpmbs.
1288 * @edstt: Extended Device Self-test Time, if Device Self-test command is
1289 * supported (see &struct nvme_id_ctrl.oacs, %NVME_CTRL_OACS_SELF_TEST),
1290 * then this field indicates the nominal amount of time in one
1291 * minute units that the controller takes to complete an extended
1292 * device self-test operation when in power state 0.
1293 * @dsto: Device Self-test Options, see &enum nvme_id_ctrl_dsto.
1294 * @fwug: Firmware Update Granularity indicates the granularity and
1295 * alignment requirement of the firmware image being updated by the
1296 * Firmware Image Download command. The value is reported in 4 KiB
1297 * units. A value of 0h indicates no information on granularity is
1298 * provided. A value of FFh indicates no restriction
1299 * @kas: Keep Alive Support indicates the granularity of the Keep Alive
1300 * Timer in 100 millisecond units.
1301 * @hctma: Host Controlled Thermal Management Attributes, see
1302 * &enum nvme_id_ctrl_hctm.
1303 * @mntmt: Minimum Thermal Management Temperature indicates the minimum
1304 * temperature, in degrees Kelvin, that the host may request in the
1305 * Thermal Management Temperature 1 field and Thermal Management
1306 * Temperature 2 field of a Set Features command with the Feature
1307 * Identifier field set to %NVME_FEAT_FID_HCTM.
1308 * @mxtmt: Maximum Thermal Management Temperature indicates the maximum
1309 * temperature, in degrees Kelvin, that the host may request in the
1310 * Thermal Management Temperature 1 field and Thermal Management
1311 * Temperature 2 field of the Set Features command with the Feature
1312 * Identifier set to %NVME_FEAT_FID_HCTM.
1313 * @sanicap: Sanitize Capabilities, see &enum nvme_id_ctrl_sanicap
1314 * @hmminds: Host Memory Buffer Minimum Descriptor Entry Size indicates the
1315 * minimum usable size of a Host Memory Buffer Descriptor Entry in
1316 * 4 KiB units.
1317 * @hmmaxd: Host Memory Maximum Descriptors Entries indicates the number of
1318 * usable Host Memory Buffer Descriptor Entries.
1319 * @nsetidmax: NVM Set Identifier Maximum, defines the maximum value of a valid
1320 * NVM Set Identifier for any controller in the NVM subsystem.
1321 * @endgidmax: Endurance Group Identifier Maximum, defines the maximum value of
1322 * a valid Endurance Group Identifier for any controller in the NVM
1323 * subsystem.
1324 * @anatt: ANA Transition Time indicates the maximum amount of time, in
1325 * seconds, for a transition between ANA states or the maximum
1326 * amount of time, in seconds, that the controller reports the ANA
1327 * change state.
1328 * @anacap: Asymmetric Namespace Access Capabilities, see
1329 * &enum nvme_id_ctrl_anacap.
1330 * @anagrpmax: ANA Group Identifier Maximum indicates the maximum value of a
1331 * valid ANA Group Identifier for any controller in the NVM
1332 * subsystem.
1333 * @nanagrpid: Number of ANA Group Identifiers indicates the number of ANA
1334 * groups supported by this controller.
1335 * @pels: Persistent Event Log Size indicates the maximum reportable size
1336 * for the Persistent Event Log.
1337 * @domainid: Domain Identifier indicates the identifier of the domain
1338 * that contains this controller.
1339 * @kpioc: Key Per I/O Capabilities (KPIOC), see &enum nvme_id_ctrl_kpioc
1340 * @rsvd359: Reserved
1341 * @mptfawr: Maximum Processing Time for Firmware Activation Without Reset
1342 * (MPTFAWR). This field shall indicate the estimated maximum time
1343 * in 100 ms units required by the controller to process a Firmware
1344 * Commit command that specifies a value of 011b in the Commit
1345 * Action field
1346 * @rsvd362: Reserved
1347 * @megcap: Max Endurance Group Capacity indicates the maximum capacity
1348 * of a single Endurance Group.
1349 * @tmpthha: Temperature Threshold Hysteresis Attributes
1350 * @rsvd385: Reserved
1351 * @cqt: Command Quiesce Time (CQT). his field indicates the expected
1352 * worst-case time in 1 millisecond units for the controller to
1353 * quiesce all outstanding commands after a Keep Alive Timeout or
1354 * other communication loss.
1355 * @rsvd388: Reserved
1356 * @sqes: Submission Queue Entry Size, see &enum nvme_id_ctrl_sqes.
1357 * @cqes: Completion Queue Entry Size, see &enum nvme_id_ctrl_cqes.
1358 * @maxcmd: Maximum Outstanding Commands indicates the maximum number of
1359 * commands that the controller processes at one time for a
1360 * particular queue.
1361 * @nn: Number of Namespaces indicates the maximum value of a valid
1362 * nsid for the NVM subsystem. If the MNAN (&struct nvme_id_ctrl.mnan
1363 * field is cleared to 0h, then this field also indicates the
1364 * maximum number of namespaces supported by the NVM subsystem.
1365 * @oncs: Optional NVM Command Support, see &enum nvme_id_ctrl_oncs.
1366 * @fuses: Fused Operation Support, see &enum nvme_id_ctrl_fuses.
1367 * @fna: Format NVM Attributes, see &enum nvme_id_ctrl_fna.
1368 * @vwc: Volatile Write Cache, see &enum nvme_id_ctrl_vwc.
1369 * @awun: Atomic Write Unit Normal indicates the size of the write
1370 * operation guaranteed to be written atomically to the NVM across
1371 * all namespaces with any supported namespace format during normal
1372 * operation. This field is specified in logical blocks and is a
1373 * 0's based value.
1374 * @awupf: Atomic Write Unit Power Fail indicates the size of the write
1375 * operation guaranteed to be written atomically to the NVM across
1376 * all namespaces with any supported namespace format during a
1377 * power fail or error condition. This field is specified in
1378 * logical blocks and is a 0’s based value.
1379 * @icsvscc: NVM Vendor Specific Command Configuration, see
1380 * &enum nvme_id_ctrl_nvscc.
1381 * @nwpc: Namespace Write Protection Capabilities, see
1382 * &enum nvme_id_ctrl_nwpc.
1383 * @acwu: Atomic Compare & Write Unit indicates the size of the write
1384 * operation guaranteed to be written atomically to the NVM across
1385 * all namespaces with any supported namespace format for a Compare
1386 * and Write fused operation. This field is specified in logical
1387 * blocks and is a 0’s based value.
1388 * @ocfs: Optional Copy Formats Supported, each bit n means controller
1389 * supports Copy Format n.
1390 * @sgls: SGL Support, see &enum nvme_id_ctrl_sgls
1391 * @mnan: Maximum Number of Allowed Namespaces indicates the maximum
1392 * number of namespaces supported by the NVM subsystem.
1393 * @maxdna: Maximum Domain Namespace Attachments indicates the maximum
1394 * of the sum of the number of namespaces attached to each I/O
1395 * controller in the Domain.
1396 * @maxcna: Maximum I/O Controller Namespace Attachments indicates the
1397 * maximum number of namespaces that are allowed to be attached to
1398 * this I/O controller.
1399 * @oaqd: Optimal Aggregated Queue Depth indicates the recommended maximum
1400 * total number of outstanding I/O commands across all I/O queues
1401 * on the controller for optimal operation.
1402 * @rhiri: Recommended Host-Initiated Refresh Interval (RHIRI). If the
1403 * Host-Initiated Refresh capability is supported, then this field
1404 * indicates the recommended time interval in days from last power
1405 * down to the time at which the host should initiate the
1406 * Host-Initiated Refresh operation. If this field is cleared to
1407 * 0h, then this field is not reported.
1408 * @hirt: Host-Initiated Refresh Time (HIRT). If the Host-Initiated
1409 * Refresh capability is supported, then this field indicates the
1410 * nominal amount of time in minutes that the controller takes to
1411 * complete the Host-Initiated Refresh operation. If this field is
1412 * cleared to 0h, then this field is not reported.
1413 * @cmmrtd: Controller Maximum Memory Range Tracking Descriptors indicates
1414 * the maximum number of Memory Range Tracking Descriptors the
1415 * controller supports.
1416 * @nmmrtd: NVM Subsystem Maximum Memory Range Tracking Descriptors
1417 * indicates the maximum number of Memory Range Tracking Descriptors
1418 * the NVM subsystem supports.
1419 * @minmrtg: Minimum Memory Range Tracking Granularity indicates the minimum
1420 * value supported in the Requested Memory Range Tracking
1421 * Granularity (RMRTG) field of the Track Memory Ranges data
1422 * structure.
1423 * @maxmrtg: Maximum Memory Range Tracking Granularity indicates the maximum
1424 * value supported in the Requested Memory Range Tracking
1425 * Granularity (RMRTG) field of the Track Memory Ranges data
1426 * structure.
1427 * @trattr: Tracking Attributes indicates supported attributes for the Track Send
1428 * command and Track Receive command. see &enum nvme_id_ctrl_trattr
1429 * @rsvd577: Reserved
1430 * @mcudmq: Maximum Controller User Data Migration Queues indicates the
1431 * maximum number of User Data Migration Queues supported by the
1432 * controller.
1433 * @mnsudmq: Maximum NVM Subsystem User Data Migration Queues indicates the
1434 * maximum number of User Data Migration Queues supported by the NVM
1435 * subsystem.
1436 * @mcmr: Maximum CDQ Memory Ranges indicates the maximum number of
1437 * memory ranges allowed to be specified by the PRP1 field of a
1438 * Controller Data Queue command.
1439 * @nmcmr: NVM Subsystem Maximum CDQ Memory Ranges indicates the maximum
1440 * number of memory ranges for all Controller Data Queues in the
1441 * NVM subsystem.
1442 * @mcdqpc: Maximum Controller Data Queue PRP Count indicates the maximum
1443 * number of PRPs allowed to be specified in the PRP list in the
1444 * Controller Data Queue command.
1445 * @rsvd588: Reserved
1446 * @subnqn: NVM Subsystem NVMe Qualified Name, UTF-8 null terminated string
1447 * @rsvd1024: Reserved
1448 * @ioccsz: I/O Queue Command Capsule Supported Size, defines the maximum
1449 * I/O command capsule size in 16 byte units.
1450 * @iorcsz: I/O Queue Response Capsule Supported Size, defines the maximum
1451 * I/O response capsule size in 16 byte units.
1452 * @icdoff: In Capsule Data Offset, defines the offset where data starts
1453 * within a capsule. This value is applicable to I/O Queues only.
1454 * @fcatt: Fabrics Controller Attributes, see &enum nvme_id_ctrl_fcatt.
1455 * @msdbd: Maximum SGL Data Block Descriptors indicates the maximum
1456 * number of SGL Data Block or Keyed SGL Data Block descriptors
1457 * that a host is allowed to place in a capsule. A value of 0h
1458 * indicates no limit.
1459 * @ofcs: Optional Fabric Commands Support, see &enum nvme_id_ctrl_ofcs.
1460 * @dctype: Discovery Controller Type (DCTYPE). This field indicates what
1461 * type of Discovery controller the controller is (see enum
1462 * nvme_id_ctrl_dctype)
1463 * @rsvd1807: Reserved
1464 * @psd: Power State Descriptors, see &struct nvme_id_psd.
1465 * @vs: Vendor Specific
1466 */
1467 struct nvme_id_ctrl {
1468 __le16 vid;
1469 __le16 ssvid;
1470 char sn[20];
1471 char mn[40];
1472 char fr[8];
1473 __u8 rab;
1474 __u8 ieee[3];
1475 __u8 cmic;
1476 __u8 mdts;
1477 __le16 cntlid;
1478 __le32 ver;
1479 __le32 rtd3r;
1480 __le32 rtd3e;
1481 __le32 oaes;
1482 __le32 ctratt;
1483 __le16 rrls;
1484 __u8 bpcap;
1485 __u8 rsvd103;
1486 __le32 nssl;
1487 __u8 rsvd108[2];
1488 __u8 plsi;
1489 __u8 cntrltype;
1490 __u8 fguid[16];
1491 __le16 crdt1;
1492 __le16 crdt2;
1493 __le16 crdt3;
1494 __u8 crcap;
1495 __u8 rsvd135[118];
1496 __u8 nvmsr;
1497 __u8 vwci;
1498 __u8 mec;
1499 __le16 oacs;
1500 __u8 acl;
1501 __u8 aerl;
1502 __u8 frmw;
1503 __u8 lpa;
1504 __u8 elpe;
1505 __u8 npss;
1506 __u8 avscc;
1507 __u8 apsta;
1508 __le16 wctemp;
1509 __le16 cctemp;
1510 __le16 mtfa;
1511 __le32 hmpre;
1512 __le32 hmmin;
1513 __u8 tnvmcap[16];
1514 __u8 unvmcap[16];
1515 __le32 rpmbs;
1516 __le16 edstt;
1517 __u8 dsto;
1518 __u8 fwug;
1519 __le16 kas;
1520 __le16 hctma;
1521 __le16 mntmt;
1522 __le16 mxtmt;
1523 __le32 sanicap;
1524 __le32 hmminds;
1525 __le16 hmmaxd;
1526 __le16 nsetidmax;
1527 __le16 endgidmax;
1528 __u8 anatt;
1529 __u8 anacap;
1530 __le32 anagrpmax;
1531 __le32 nanagrpid;
1532 __le32 pels;
1533 __le16 domainid;
1534 __u8 kpioc;
1535 __u8 rsvd359;
1536 __le16 mptfawr;
1537 __u8 rsvd362[6];
1538 __u8 megcap[16];
1539 __u8 tmpthha;
1540 __u8 rsvd385;
1541 __le16 cqt;
1542 __u8 rsvd388[124];
1543 __u8 sqes;
1544 __u8 cqes;
1545 __le16 maxcmd;
1546 __le32 nn;
1547 __le16 oncs;
1548 __le16 fuses;
1549 __u8 fna;
1550 __u8 vwc;
1551 __le16 awun;
1552 __le16 awupf;
1553 __u8 icsvscc;
1554 __u8 nwpc;
1555 __le16 acwu;
1556 __le16 ocfs;
1557 __le32 sgls;
1558 __le32 mnan;
1559 __u8 maxdna[16];
1560 __le32 maxcna;
1561 __le32 oaqd;
1562 __u8 rhiri;
1563 __u8 hirt;
1564 __le16 cmmrtd;
1565 __le16 nmmrtd;
1566 __u8 minmrtg;
1567 __u8 maxmrtg;
1568 __u8 trattr;
1569 __u8 rsvd577;
1570 __le16 mcudmq;
1571 __le16 mnsudmq;
1572 __le16 mcmr;
1573 __le16 nmcmr;
1574 __le16 mcdqpc;
1575 __u8 rsvd588[180];
1576 char subnqn[NVME_NQN_LENGTH];
1577 __u8 rsvd1024[768];
1578
1579 /* Fabrics Only */
1580 __le32 ioccsz;
1581 __le32 iorcsz;
1582 __le16 icdoff;
1583 __u8 fcatt;
1584 __u8 msdbd;
1585 __le16 ofcs;
1586 __u8 dctype;
1587 __u8 rsvd1807[241];
1588
1589 struct nvme_id_psd psd[32];
1590 __u8 vs[1024];
1591 };
1592
1593 /**
1594 * enum nvme_cmic - This field indicates the controller multi-path I/O and NS sharing capabilities
1595 * @NVME_CMIC_MULTI_PORT_SHIFT: Shift amount to get the NVM subsystem port
1596 * @NVME_CMIC_MULTI_CTRL_SHIFT: Shift amount to get the controllers
1597 * @NVME_CMIC_MULTI_SRIOV_SHIFT: Shift amount to get the SR-IOV virtual function
1598 * @NVME_CMIC_MULTI_ANA_SHIFT: Shift amount to get the asymmetric namespace access reporting
1599 * @NVME_CMIC_MULTI_RSVD_SHIFT: Shift amount to get the reserved
1600 * @NVME_CMIC_MULTI_PORT_MASK: Mask to get the NVM subsystem port
1601 * @NVME_CMIC_MULTI_CTRL_MASK: Mask to get the controllers
1602 * @NVME_CMIC_MULTI_SRIOV_MASK: Mask to get the SR-IOV virtual function
1603 * @NVME_CMIC_MULTI_ANA_MASK: Mask to get the asymmetric namespace access reporting
1604 * @NVME_CMIC_MULTI_RSVD_MASK: Mask to get the reserved
1605 */
1606 enum nvme_cmic {
1607 NVME_CMIC_MULTI_PORT_SHIFT = 0,
1608 NVME_CMIC_MULTI_CTRL_SHIFT = 1,
1609 NVME_CMIC_MULTI_SRIOV_SHIFT = 2,
1610 NVME_CMIC_MULTI_ANA_SHIFT = 3,
1611 NVME_CMIC_MULTI_RSVD_SHIFT = 4,
1612 NVME_CMIC_MULTI_PORT_MASK = 0x1,
1613 NVME_CMIC_MULTI_CTRL_MASK = 0x1,
1614 NVME_CMIC_MULTI_SRIOV_MASK = 0x1,
1615 NVME_CMIC_MULTI_ANA_MASK = 0x1,
1616 NVME_CMIC_MULTI_RSVD_MASK = 0xf,
1617 };
1618
1619 #define NVME_CMIC_MULTI_PORT(cmic) NVME_GET(cmic, CMIC_MULTI_PORT)
1620 #define NVME_CMIC_MULTI_CTRL(cmic) NVME_GET(cmic, CMIC_MULTI_CTRL)
1621 #define NVME_CMIC_MULTI_SRIOV(cmic) NVME_GET(cmic, CMIC_MULTI_SRIOV)
1622 #define NVME_CMIC_MULTI_ANA(cmic) NVME_GET(cmic, CMIC_MULTI_ANA)
1623 #define NVME_CMIC_MULTI_RSVD(cmic) NVME_GET(cmic, CMIC_MULTI_RSVD)
1624
1625 /**
1626 * enum nvme_id_ctrl_cmic - Controller Multipath IO and Namespace Sharing
1627 * Capabilities of the controller and NVM subsystem.
1628 * @NVME_CTRL_CMIC_MULTI_PORT: If set, then the NVM subsystem may contain
1629 * more than one NVM subsystem port, otherwise
1630 * the NVM subsystem contains only a single
1631 * NVM subsystem port.
1632 * @NVME_CTRL_CMIC_MULTI_CTRL: If set, then the NVM subsystem may contain
1633 * two or more controllers, otherwise the
1634 * NVM subsystem contains only a single
1635 * controller. An NVM subsystem that contains
1636 * multiple controllers may be used by
1637 * multiple hosts, or may provide multiple
1638 * paths for a single host.
1639 * @NVME_CTRL_CMIC_MULTI_SRIOV: If set, then the controller is associated
1640 * with an SR-IOV Virtual Function, otherwise
1641 * it is associated with a PCI Function
1642 * or a Fabrics connection.
1643 * @NVME_CTRL_CMIC_MULTI_ANA_REPORTING: If set, then the NVM subsystem supports
1644 * Asymmetric Namespace Access Reporting.
1645 */
1646 enum nvme_id_ctrl_cmic {
1647 NVME_CTRL_CMIC_MULTI_PORT = 1 << 0,
1648 NVME_CTRL_CMIC_MULTI_CTRL = 1 << 1,
1649 NVME_CTRL_CMIC_MULTI_SRIOV = 1 << 2,
1650 NVME_CTRL_CMIC_MULTI_ANA_REPORTING = 1 << 3,
1651 };
1652
1653 /**
1654 * enum nvme_id_ctrl_oaes - Optional Asynchronous Events Supported
1655 * @NVME_CTRL_OAES_NA_SHIFT: Shift amount to get the Namespace Attribute Notices event supported
1656 * @NVME_CTRL_OAES_FA_SHIFT: Shift amount to get the Firmware Activation Notices event supported
1657 * @NVME_CTRL_OAES_ANA_SHIFT: Shift amount to get the ANA Change Notices supported
1658 * @NVME_CTRL_OAES_PLEA_SHIFT: Shift amount to get the Predictable Latency Event Aggregate Log
1659 * Change Notices event supported
1660 * @NVME_CTRL_OAES_LBAS_SHIFT: Shift amount to get the LBA Status Information Notices event
1661 * supported
1662 * @NVME_CTRL_OAES_EGE_SHIFT: Shift amount to get the Endurance Group Events Aggregate Log Change
1663 * Notices event supported
1664 * @NVME_CTRL_OAES_NS_SHIFT: Shift amount to get the Normal NVM Subsystem Shutdown event supported
1665 * @NVME_CTRL_OAES_TTH_SHIFT: Shift amount to get the Temperature Threshold Hysteresis Recovery
1666 * event supported
1667 * @NVME_CTRL_OAES_RGCNS_SHIFT: Shift amount to get the Reachability Groups Change Notices supported
1668 * @NVME_CTRL_OAES_ANSAN_SHIFT: Shift amount to get the Allocated Namespace Attribute Notices
1669 * supported
1670 * @NVME_CTRL_OAES_ZD_SHIFT: Shift amount to get the Zone Descriptor Change Notifications supported
1671 * @NVME_CTRL_OAES_DL_SHIFT: Shift amount to get the Discover Log Page Change Notifications
1672 * supported
1673 * @NVME_CTRL_OAES_NA_MASK: Mask to get the Namespace Attribute Notices event supported
1674 * @NVME_CTRL_OAES_FA_MASK: Mask to get the Firmware Activation Notices event supported
1675 * @NVME_CTRL_OAES_ANA_MASK: Mask to get the ANA Change Notices supported
1676 * @NVME_CTRL_OAES_PLEA_MASK: Mask to get the Predictable Latency Event Aggregate Log Change Notices
1677 * event supported
1678 * @NVME_CTRL_OAES_LBAS_MASK: Mask to get the LBA Status Information Notices event supported
1679 * @NVME_CTRL_OAES_EGE_MASK: Mask to get the Endurance Group Events Aggregate Log Change Notices
1680 * event supported
1681 * @NVME_CTRL_OAES_NS_MASK: Mask to get the Normal NVM Subsystem Shutdown event supported
1682 * @NVME_CTRL_OAES_TTH_MASK: Mask to get the Temperature Threshold Hysteresis Recovery event
1683 * supported
1684 * @NVME_CTRL_OAES_RGCNS_MASK: Mask to get the Reachability Groups Change Notices supported
1685 * @NVME_CTRL_OAES_ANSAN_MASK: Mask to get the Allocated Namespace Attribute Notices supported
1686 * @NVME_CTRL_OAES_ZD_MASK: Mask to get the Zone Descriptor Change Notifications supported
1687 * @NVME_CTRL_OAES_DL_MASK: Mask to get the Discover Log Page Change Notifications supported
1688 * @NVME_CTRL_OAES_NA: Namespace Attribute Notices event supported
1689 * @NVME_CTRL_OAES_FA: Firmware Activation Notices event supported
1690 * @NVME_CTRL_OAES_ANA: ANA Change Notices supported
1691 * @NVME_CTRL_OAES_PLEA: Predictable Latency Event Aggregate Log Change Notices event supported
1692 * @NVME_CTRL_OAES_LBAS: LBA Status Information Notices event supported
1693 * @NVME_CTRL_OAES_EGE: Endurance Group Events Aggregate Log Change Notices event supported
1694 * @NVME_CTRL_OAES_NS: Normal NVM Subsystem Shutdown event supported
1695 * @NVME_CTRL_OAES_TTH: Temperature Threshold Hysteresis Recovery event supported
1696 * @NVME_CTRL_OAES_RGCNS: Reachability Groups Change Notices supported
1697 * @NVME_CTRL_OAES_ANSAN: Allocated Namespace Attribute Notices supported
1698 * @NVME_CTRL_OAES_ZD: Zone Descriptor Change Notifications supported
1699 * @NVME_CTRL_OAES_DL: Discover Log Page Change Notifications supported
1700 */
1701 enum nvme_id_ctrl_oaes {
1702 NVME_CTRL_OAES_NA_SHIFT = 8,
1703 NVME_CTRL_OAES_FA_SHIFT = 9,
1704 NVME_CTRL_OAES_ANA_SHIFT = 11,
1705 NVME_CTRL_OAES_PLEA_SHIFT = 12,
1706 NVME_CTRL_OAES_LBAS_SHIFT = 13,
1707 NVME_CTRL_OAES_EGE_SHIFT = 14,
1708 NVME_CTRL_OAES_NS_SHIFT = 15,
1709 NVME_CTRL_OAES_TTH_SHIFT = 16,
1710 NVME_CTRL_OAES_RGCNS_SHIFT = 17,
1711 NVME_CTRL_OAES_ANSAN_SHIFT = 19,
1712 NVME_CTRL_OAES_ZD_SHIFT = 27,
1713 NVME_CTRL_OAES_DL_SHIFT = 31,
1714 NVME_CTRL_OAES_NA_MASK = 0x1,
1715 NVME_CTRL_OAES_FA_MASK = 0x1,
1716 NVME_CTRL_OAES_ANA_MASK = 0x1,
1717 NVME_CTRL_OAES_PLEA_MASK = 0x1,
1718 NVME_CTRL_OAES_LBAS_MASK = 0x1,
1719 NVME_CTRL_OAES_EGE_MASK = 0x1,
1720 NVME_CTRL_OAES_NS_MASK = 0x1,
1721 NVME_CTRL_OAES_TTH_MASK = 0x1,
1722 NVME_CTRL_OAES_RGCNS_MASK = 0x1,
1723 NVME_CTRL_OAES_ANSAN_MASK = 0x1,
1724 NVME_CTRL_OAES_ZD_MASK = 0x1,
1725 NVME_CTRL_OAES_DL_MASK = 0x1,
1726 NVME_CTRL_OAES_NA = NVME_VAL(CTRL_OAES_NA),
1727 NVME_CTRL_OAES_FA = NVME_VAL(CTRL_OAES_FA),
1728 NVME_CTRL_OAES_ANA = NVME_VAL(CTRL_OAES_ANA),
1729 NVME_CTRL_OAES_PLEA = NVME_VAL(CTRL_OAES_PLEA),
1730 NVME_CTRL_OAES_LBAS = NVME_VAL(CTRL_OAES_LBAS),
1731 NVME_CTRL_OAES_EGE = NVME_VAL(CTRL_OAES_EGE),
1732 NVME_CTRL_OAES_NS = NVME_VAL(CTRL_OAES_NS),
1733 NVME_CTRL_OAES_TTH = NVME_VAL(CTRL_OAES_TTH),
1734 NVME_CTRL_OAES_RGCNS = NVME_VAL(CTRL_OAES_RGCNS),
1735 NVME_CTRL_OAES_ANSAN = NVME_VAL(CTRL_OAES_ANSAN),
1736 NVME_CTRL_OAES_ZD = NVME_VAL(CTRL_OAES_ZD),
1737 NVME_CTRL_OAES_DL = NVME_VAL(CTRL_OAES_DL),
1738 };
1739
1740 #define NVME_CTRL_OAES_NAN(oaes) NVME_GET(oaes, CTRL_OAES_NA)
1741 #define NVME_CTRL_OAES_FAN(oaes) NVME_GET(oaes, CTRL_OAES_FA)
1742 #define NVME_CTRL_OAES_ANACN(oaes) NVME_GET(oaes, CTRL_OAES_ANA)
1743 #define NVME_CTRL_OAES_PLEALCN(oaes) NVME_GET(oaes, CTRL_OAES_PLEA)
1744 #define NVME_CTRL_OAES_LBASIAN(oaes) NVME_GET(oaes, CTRL_OAES_LBAS)
1745 #define NVME_CTRL_OAES_EGEALPCN(oaes) NVME_GET(oaes, CTRL_OAES_EGE)
1746 #define NVME_CTRL_OAES_NNVMSS(oaes) NVME_GET(oaes, CTRL_OAES_NS)
1747 #define NVME_CTRL_OAES_TTHR(oaes) NVME_GET(oaes, CTRL_OAES_TTH)
1748 #define NVME_CTRL_OAES_RGCNS(oaes) NVME_GET(oaes, CTRL_OAES_RGCNS)
1749 #define NVME_CTRL_OAES_ANSAN(oaes) NVME_GET(oaes, CTRL_OAES_ANSAN)
1750 #define NVME_CTRL_OAES_ZDCN(oaes) NVME_GET(oaes, CTRL_OAES_ZD)
1751 #define NVME_CTRL_OAES_DLPCN(oaes) NVME_GET(oaes, CTRL_OAES_DL)
1752
1753 /**
1754 * enum nvme_id_ctrl_ctratt - Controller attributes
1755 * @NVME_CTRL_CTRATT_128_ID: 128-bit Host Identifier supported
1756 * @NVME_CTRL_CTRATT_NON_OP_PSP: Non-Operational Poser State Permissive Mode
1757 * supported
1758 * @NVME_CTRL_CTRATT_NVM_SETS: NVM Sets supported
1759 * @NVME_CTRL_CTRATT_READ_RECV_LVLS: Read Recovery Levels supported
1760 * @NVME_CTRL_CTRATT_ENDURANCE_GROUPS: Endurance Groups supported
1761 * @NVME_CTRL_CTRATT_PREDICTABLE_LAT: Predictable Latency Mode supported
1762 * @NVME_CTRL_CTRATT_TBKAS: Traffic Based Keep Alive Support
1763 * @NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY: Namespace Granularity reporting
1764 * supported
1765 * @NVME_CTRL_CTRATT_SQ_ASSOCIATIONS: SQ Associations supported
1766 * @NVME_CTRL_CTRATT_UUID_LIST: UUID List reporting supported
1767 * @NVME_CTRL_CTRATT_MDS: Multi-Domain Subsystem supported
1768 * @NVME_CTRL_CTRATT_FIXED_CAP: Fixed Capacity Management supported
1769 * @NVME_CTRL_CTRATT_VARIABLE_CAP: Variable Capacity Management supported
1770 * @NVME_CTRL_CTRATT_DEL_ENDURANCE_GROUPS: Delete Endurance Groups supported
1771 * @NVME_CTRL_CTRATT_DEL_NVM_SETS: Delete NVM Sets supported
1772 * @NVME_CTRL_CTRATT_ELBAS: Extended LBA Formats supported
1773 * @NVME_CTRL_CTRATT_MEM: MDTS and Size Limits Exclude Metadata supported
1774 * @NVME_CTRL_CTRATT_HMBR: HMB Restrict Non-Operational Power State Access
1775 * @NVME_CTRL_CTRATT_RHII: Reservations and Host Identifier Interaction
1776 * @NVME_CTRL_CTRATT_FDPS: Flexible Data Placement supported
1777 */
1778 enum nvme_id_ctrl_ctratt {
1779 NVME_CTRL_CTRATT_128_ID = 1 << 0,
1780 NVME_CTRL_CTRATT_NON_OP_PSP = 1 << 1,
1781 NVME_CTRL_CTRATT_NVM_SETS = 1 << 2,
1782 NVME_CTRL_CTRATT_READ_RECV_LVLS = 1 << 3,
1783 NVME_CTRL_CTRATT_ENDURANCE_GROUPS = 1 << 4,
1784 NVME_CTRL_CTRATT_PREDICTABLE_LAT = 1 << 5,
1785 NVME_CTRL_CTRATT_TBKAS = 1 << 6,
1786 NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY = 1 << 7,
1787 NVME_CTRL_CTRATT_SQ_ASSOCIATIONS = 1 << 8,
1788 NVME_CTRL_CTRATT_UUID_LIST = 1 << 9,
1789 NVME_CTRL_CTRATT_MDS = 1 << 10,
1790 NVME_CTRL_CTRATT_FIXED_CAP = 1 << 11,
1791 NVME_CTRL_CTRATT_VARIABLE_CAP = 1 << 12,
1792 NVME_CTRL_CTRATT_DEL_ENDURANCE_GROUPS = 1 << 13,
1793 NVME_CTRL_CTRATT_DEL_NVM_SETS = 1 << 14,
1794 NVME_CTRL_CTRATT_ELBAS = 1 << 15,
1795 NVME_CTRL_CTRATT_MEM = 1 << 16,
1796 NVME_CTRL_CTRATT_HMBR = 1 << 17,
1797 NVME_CTRL_CTRATT_RHII = 1 << 18,
1798 NVME_CTRL_CTRATT_FDPS = 1 << 19,
1799 };
1800
1801 /**
1802 * enum nvme_id_ctrl_bpcap - Boot Partition Capabilities
1803 * @NVME_CTRL_BACAP_RPMBBPWPS_SHIFT: Shift amount to get the RPMB Boot Partition Write
1804 * Protection Support from the &struct
1805 * nvme_id_ctrl.bpcap field.
1806 * @NVME_CTRL_BACAP_SFBPWPS_SHIFT: Shift amount to get the Set Features Boot Partition
1807 * Write Protection Support from the &struct
1808 * nvme_id_ctrl.bpcap field.
1809 * @NVME_CTRL_BACAP_RPMBBPWPS_MASK: Mask to get the RPMB Boot Partition Write
1810 * Protection Support from the &struct
1811 * nvme_id_ctrl.bpcap field.
1812 * @NVME_CTRL_BACAP_SFBPWPS_MASK: Mask to get the Set Features Boot Partition Write
1813 * Protection Support from the &struct
1814 * nvme_id_ctrl.bpcap field.
1815 * @NVME_CTRL_BACAP_RPMBBPWPS_NOT_SPECIFIED: Support for RPMB Boot Partition Write Protection
1816 * is not specified.
1817 * @NVME_CTRL_BACAP_RPMBBPWPS_NOT_SUPPORTED: RPMB Boot Partition Write Protection is not
1818 * supported by this controller.
1819 * @NVME_CTRL_BACAP_RPMBBPWPS_SUPPORTED: RPMB Boot Partition Write Protection is supported
1820 * by this controller.
1821 */
1822 enum nvme_id_ctrl_bpcap {
1823 NVME_CTRL_BACAP_RPMBBPWPS_SHIFT = 0,
1824 NVME_CTRL_BACAP_SFBPWPS_SHIFT = 2,
1825 NVME_CTRL_BACAP_RPMBBPWPS_MASK = 0x3,
1826 NVME_CTRL_BACAP_SFBPWPS_MASK = 0x1,
1827 NVME_CTRL_BACAP_RPMBBPWPS_NOT_SPECIFIED = 0,
1828 NVME_CTRL_BACAP_RPMBBPWPS_NOT_SUPPORTED = 1,
1829 NVME_CTRL_BACAP_RPMBBPWPS_SUPPORTED = 2,
1830 };
1831
1832 /**
1833 * enum nvme_id_ctrl_plsi - Power Loss Signaling Information
1834 * @NVME_CTRL_PLSI_PLSEPF_SHIFT: Shift amount to get the PLS Emergency Power Fail from the
1835 * &struct nvme_id_ctrl.plsi field.
1836 * @NVME_CTRL_PLSI_PLSFQ_SHIFT: Shift amount to get the PLS Forced Quiescence from the
1837 * &struct nvme_id_ctrl.plsi field.
1838 * @NVME_CTRL_PLSI_PLSEPF_MASK: Mask to get the PLS Emergency Power Fail from the
1839 * &struct nvme_id_ctrl.plsi field.
1840 * @NVME_CTRL_PLSI_PLSFQ_MASK: Mask to get the PLS Forced Quiescence from the
1841 * &struct nvme_id_ctrl.plsi field.
1842 */
1843 enum nvme_id_ctrl_plsi {
1844 NVME_CTRL_PLSI_PLSEPF_SHIFT = 0,
1845 NVME_CTRL_PLSI_PLSFQ_SHIFT = 1,
1846 NVME_CTRL_PLSI_PLSEPF_MASK = 0x1,
1847 NVME_CTRL_PLSI_PLSFQ_MASK = 0x1,
1848 };
1849
1850 /**
1851 * enum nvme_id_ctrl_crcap - Power Loss Signaling Information
1852 * @NVME_CTRL_CRCAP_RRSUP_SHIFT: Shift amount to get the Reachability Reporting Supported
1853 * from the &struct nvme_id_ctrl.crcap field.
1854 * @NVME_CTRL_CRCAP_RGIDC_SHIFT: Shift amount to get the Reachability Group ID Changeable
1855 * from the &struct nvme_id_ctrl.crcap field.
1856 * @NVME_CTRL_CRCAP_RRSUP_MASK: Mask to get the Reachability Reporting Supported from the
1857 * &struct nvme_id_ctrl.crcap field.
1858 * @NVME_CTRL_CRCAP_RGIDC_MASK: Mask to get the Reachability Group ID Changeable from the
1859 * &struct nvme_id_ctrl.crcap field.
1860 */
1861 enum nvme_id_ctrl_crcap {
1862 NVME_CTRL_CRCAP_RRSUP_SHIFT = 0,
1863 NVME_CTRL_CRCAP_RGIDC_SHIFT = 1,
1864 NVME_CTRL_CRCAP_RRSUP_MASK = 0x1,
1865 NVME_CTRL_CRCAP_RGIDC_MASK = 0x1,
1866 };
1867
1868 /**
1869 * enum nvme_id_ctrl_cntrltype - Controller types
1870 * @NVME_CTRL_CNTRLTYPE_IO: NVM I/O controller
1871 * @NVME_CTRL_CNTRLTYPE_DISCOVERY: Discovery controller
1872 * @NVME_CTRL_CNTRLTYPE_ADMIN: Admin controller
1873 */
1874 enum nvme_id_ctrl_cntrltype {
1875 NVME_CTRL_CNTRLTYPE_IO = 1,
1876 NVME_CTRL_CNTRLTYPE_DISCOVERY = 2,
1877 NVME_CTRL_CNTRLTYPE_ADMIN = 3,
1878 };
1879
1880 /**
1881 * enum nvme_id_ctrl_dctype - Discovery Controller types
1882 * @NVME_CTRL_DCTYPE_NOT_REPORTED: Not reported (I/O, Admin, and pre-TP8010)
1883 * @NVME_CTRL_DCTYPE_DDC: Direct Discovery controller
1884 * @NVME_CTRL_DCTYPE_CDC: Central Discovery controller
1885 */
1886 enum nvme_id_ctrl_dctype {
1887 NVME_CTRL_DCTYPE_NOT_REPORTED = 0,
1888 NVME_CTRL_DCTYPE_DDC = 1,
1889 NVME_CTRL_DCTYPE_CDC = 2,
1890 };
1891
1892 /**
1893 * enum nvme_id_ctrl_nvmsr - This field reports information associated with the
1894 * NVM Subsystem, see &struct nvme_id_ctrl.nvmsr.
1895 * @NVME_CTRL_NVMSR_NVMESD: If set, then the NVM Subsystem is part of an NVMe
1896 * Storage Device; if cleared, then the NVM Subsystem
1897 * is not part of an NVMe Storage Device.
1898 * @NVME_CTRL_NVMSR_NVMEE: If set, then the NVM Subsystem is part of an NVMe
1899 * Enclosure; if cleared, then the NVM Subsystem is
1900 * not part of an NVMe Enclosure.
1901 */
1902 enum nvme_id_ctrl_nvmsr {
1903 NVME_CTRL_NVMSR_NVMESD = 1 << 0,
1904 NVME_CTRL_NVMSR_NVMEE = 1 << 1,
1905 };
1906
1907 /**
1908 * enum nvme_id_ctrl_vwci - This field indicates information about remaining
1909 * number of times that VPD contents are able to be
1910 * updated using the VPD Write command, see &struct
1911 * nvme_id_ctrl.vwci.
1912 * @NVME_CTRL_VWCI_VWCR: Mask to get value of VPD Write Cycles Remaining. If
1913 * the VPD Write Cycle Remaining Valid bit is set, then
1914 * this field contains a value indicating the remaining
1915 * number of times that VPD contents are able to be
1916 * updated using the VPD Write command. If this field is
1917 * set to 7Fh, then the remaining number of times that
1918 * VPD contents are able to be updated using the VPD
1919 * Write command is greater than or equal to 7Fh.
1920 * @NVME_CTRL_VWCI_VWCRV: VPD Write Cycle Remaining Valid. If this bit is set,
1921 * then the VPD Write Cycle Remaining field is valid. If
1922 * this bit is cleared, then the VPD Write Cycles
1923 * Remaining field is invalid and cleared to 0h.
1924 */
1925 enum nvme_id_ctrl_vwci {
1926 NVME_CTRL_VWCI_VWCR = 0x7f << 0,
1927 NVME_CTRL_VWCI_VWCRV = 1 << 7,
1928 };
1929
1930 /**
1931 * enum nvme_id_ctrl_mec - Flags indicating the capabilities of the Management
1932 * Endpoint in the Controller, &struct nvme_id_ctrl.mec.
1933 * @NVME_CTRL_MEC_SMBUSME: If set, then the NVM Subsystem contains a Management
1934 * Endpoint on an SMBus/I2C port.
1935 * @NVME_CTRL_MEC_PCIEME: If set, then the NVM Subsystem contains a Management
1936 * Endpoint on a PCIe port.
1937 */
1938 enum nvme_id_ctrl_mec {
1939 NVME_CTRL_MEC_SMBUSME = 1 << 0,
1940 NVME_CTRL_MEC_PCIEME = 1 << 1,
1941 };
1942
1943 /**
1944 * enum nvme_id_ctrl_oacs - Flags indicating the optional Admin commands and
1945 * features supported by the controller, see
1946 * &struct nvme_id_ctrl.oacs.
1947 * @NVME_CTRL_OACS_SSRS_SHIFT: Shift amount to get the Security Send Receive supported
1948 * @NVME_CTRL_OACS_FNVMS_SHIFT:Shift amount to get the Format NVM supported
1949 * @NVME_CTRL_OACS_FWDS_SHIFT: Shift amount to get the Firmware Download supported
1950 * @NVME_CTRL_OACS_NMS_SHIFT: Shift amount to get the Namespace Management supported
1951 * @NVME_CTRL_OACS_DSTS_SHIFT: Shift amount to get the Device Self-test supported
1952 * @NVME_CTRL_OACS_DIRS_SHIFT: Shift amount to get the Directives supported
1953 * @NVME_CTRL_OACS_NSRS_SHIFT: Shift amount to get the NVMe-MI Send Receive supported
1954 * @NVME_CTRL_OACS_VMS_SHIFT: Shift amount to get the Virtualization Management supported
1955 * @NVME_CTRL_OACS_DBCS_SHIFT: Shift amount to get the Doorbell Buffer Config supported
1956 * @NVME_CTRL_OACS_GLSS_SHIFT: Shift amount to get the Get LBA Status supported
1957 * @NVME_CTRL_OACS_CFLS_SHIFT: Shift amount to get the Command and Feature Lockdown supported
1958 * @NVME_CTRL_OACS_HMLMS_SHIFT:Shift amount to get the Host Managed Live Migration support
1959 * @NVME_CTRL_OACS_SSRS_MASK: Mask to get the Security Send Receive supported
1960 * @NVME_CTRL_OACS_FNVMS_MASK: Mask to get the Format NVM supported
1961 * @NVME_CTRL_OACS_FWDS_MASK: Mask to get the Firmware Download supported
1962 * @NVME_CTRL_OACS_NMS_MASK: Mask to get the Namespace Management supported
1963 * @NVME_CTRL_OACS_DSTS_MASK: Mask to get the Device Self-test supported
1964 * @NVME_CTRL_OACS_DIRS_MASK: Mask to get the Directives supported
1965 * @NVME_CTRL_OACS_NSRS_MASK: Mask to get the NVMe-MI Send Receive supported
1966 * @NVME_CTRL_OACS_VMS_MASK: Mask to get the Virtualization Management supported
1967 * @NVME_CTRL_OACS_DBCS_MASK: Mask to get the Doorbell Buffer Config supported
1968 * @NVME_CTRL_OACS_GLSS_MASK: Mask to get the Get LBA Status supported
1969 * @NVME_CTRL_OACS_CFLS_MASK: Mask to get the Command and Feature Lockdown supported
1970 * @NVME_CTRL_OACS_HMLMS_MASK: Mask to get the Host Managed Live Migration support
1971 * @NVME_CTRL_OACS_SECURITY: If set, then the controller supports the
1972 * Security Send and Security Receive commands.
1973 * @NVME_CTRL_OACS_FORMAT: If set then the controller supports the Format
1974 * NVM command.
1975 * @NVME_CTRL_OACS_FW: If set, then the controller supports the
1976 * Firmware Commit and Firmware Image Download commands.
1977 * @NVME_CTRL_OACS_NS_MGMT: If set, then the controller supports the
1978 * Namespace Management capability
1979 * @NVME_CTRL_OACS_SELF_TEST: If set, then the controller supports the Device
1980 * Self-test command.
1981 * @NVME_CTRL_OACS_DIRECTIVES: If set, then the controller supports Directives
1982 * and the Directive Send and Directive Receive
1983 * commands.
1984 * @NVME_CTRL_OACS_NVME_MI: If set, then the controller supports the NVMe-MI
1985 * Send and NVMe-MI Receive commands.
1986 * @NVME_CTRL_OACS_VIRT_MGMT: If set, then the controller supports the
1987 * Virtualization Management command.
1988 * @NVME_CTRL_OACS_DBBUF_CFG: If set, then the controller supports the
1989 * Doorbell Buffer Config command.
1990 * @NVME_CTRL_OACS_LBA_STATUS: If set, then the controller supports the Get LBA
1991 * Status capability.
1992 * @NVME_CTRL_OACS_CMD_FEAT_LD:If set, then the controller supports the command
1993 * and feature lockdown capability.
1994 * @NVME_CTRL_OACS_HMLM: If set, then the controller supports the command
1995 * and Host Managed Live Migration capability.
1996 */
1997 enum nvme_id_ctrl_oacs {
1998 NVME_CTRL_OACS_SSRS_SHIFT = 0,
1999 NVME_CTRL_OACS_FNVMS_SHIFT = 1,
2000 NVME_CTRL_OACS_FWDS_SHIFT = 2,
2001 NVME_CTRL_OACS_NMS_SHIFT = 3,
2002 NVME_CTRL_OACS_DSTS_SHIFT = 4,
2003 NVME_CTRL_OACS_DIRS_SHIFT = 5,
2004 NVME_CTRL_OACS_NSRS_SHIFT = 6,
2005 NVME_CTRL_OACS_VMS_SHIFT = 7,
2006 NVME_CTRL_OACS_DBCS_SHIFT = 8,
2007 NVME_CTRL_OACS_GLSS_SHIFT = 9,
2008 NVME_CTRL_OACS_CFLS_SHIFT = 10,
2009 NVME_CTRL_OACS_HMLMS_SHIFT = 11,
2010 NVME_CTRL_OACS_SSRS_MASK = 1,
2011 NVME_CTRL_OACS_FNVMS_MASK = 1,
2012 NVME_CTRL_OACS_FWDS_MASK = 1,
2013 NVME_CTRL_OACS_NMS_MASK = 1,
2014 NVME_CTRL_OACS_DSTS_MASK = 1,
2015 NVME_CTRL_OACS_DIRS_MASK = 1,
2016 NVME_CTRL_OACS_NSRS_MASK = 1,
2017 NVME_CTRL_OACS_VMS_MASK = 1,
2018 NVME_CTRL_OACS_DBCS_MASK = 1,
2019 NVME_CTRL_OACS_GLSS_MASK = 1,
2020 NVME_CTRL_OACS_CFLS_MASK = 1,
2021 NVME_CTRL_OACS_HMLMS_MASK = 1,
2022 NVME_CTRL_OACS_SECURITY = NVME_VAL(CTRL_OACS_SSRS),
2023 NVME_CTRL_OACS_FORMAT = NVME_VAL(CTRL_OACS_FNVMS),
2024 NVME_CTRL_OACS_FW = NVME_VAL(CTRL_OACS_FWDS),
2025 NVME_CTRL_OACS_NS_MGMT = NVME_VAL(CTRL_OACS_NMS),
2026 NVME_CTRL_OACS_SELF_TEST = NVME_VAL(CTRL_OACS_DSTS),
2027 NVME_CTRL_OACS_DIRECTIVES = NVME_VAL(CTRL_OACS_DIRS),
2028 NVME_CTRL_OACS_NVME_MI = NVME_VAL(CTRL_OACS_NSRS),
2029 NVME_CTRL_OACS_VIRT_MGMT = NVME_VAL(CTRL_OACS_VMS),
2030 NVME_CTRL_OACS_DBBUF_CFG = NVME_VAL(CTRL_OACS_DBCS),
2031 NVME_CTRL_OACS_LBA_STATUS = NVME_VAL(CTRL_OACS_GLSS),
2032 NVME_CTRL_OACS_CMD_FEAT_LD = NVME_VAL(CTRL_OACS_CFLS),
2033 NVME_CTRL_OACS_HMLM = NVME_VAL(CTRL_OACS_HMLMS),
2034 };
2035
2036 #define NVME_CTRL_OACS_SSRS(oacs) NVME_GET(CTRL_OACS_SSRS)
2037 #define NVME_CTRL_OACS_FNVMS(oacs) NVME_GET(CTRL_OACS_FNVMS)
2038 #define NVME_CTRL_OACS_FWDS(oacs) NVME_GET(CTRL_OACS_FWDS)
2039 #define NVME_CTRL_OACS_NMS_M(oacs) NVME_GET(CTRL_OACS_NMS)
2040 #define NVME_CTRL_OACS_DSTS(oacs) NVME_GET(CTRL_OACS_DSTS)
2041 #define NVME_CTRL_OACS_DIRS(oacs) NVME_GET(CTRL_OACS_DIRS)
2042 #define NVME_CTRL_OACS_NSRS(oacs) NVME_GET(CTRL_OACS_NSRS)
2043 #define NVME_CTRL_OACS_VMS_M(oacs) NVME_GET(CTRL_OACS_VMS)
2044 #define NVME_CTRL_OACS_DBCS(oacs) NVME_GET(CTRL_OACS_DBCS)
2045 #define NVME_CTRL_OACS_GLSS(oacs) NVME_GET(CTRL_OACS_GLSS)
2046 #define NVME_CTRL_OACS_CFLS(oacs) NVME_GET(CTRL_OACS_CFLS)
2047 #define NVME_CTRL_OACS_HMLMS(oacs) NVME_GET(CTRL_OACS_HMLMS)
2048
2049 /**
2050 * enum nvme_id_ctrl_frmw - Flags and values indicates capabilities regarding
2051 * firmware updates from &struct nvme_id_ctrl.frmw.
2052 * @NVME_CTRL_FRMW_1ST_RO: If set, the first firmware slot is readonly
2053 * @NVME_CTRL_FRMW_NR_SLOTS: Mask to get the value of the number of
2054 * firmware slots that the controller supports.
2055 * @NVME_CTRL_FRMW_FW_ACT_NO_RESET: If set, the controller supports firmware
2056 * activation without a reset.
2057 * @NVME_CTRL_FRMW_MP_UP_DETECTION: If set, the controller is able to detect
2058 * overlapping firmware/boot partition
2059 * image update.
2060 */
2061 enum nvme_id_ctrl_frmw {
2062 NVME_CTRL_FRMW_1ST_RO = 1 << 0,
2063 NVME_CTRL_FRMW_NR_SLOTS = 3 << 1,
2064 NVME_CTRL_FRMW_FW_ACT_NO_RESET = 1 << 4,
2065 NVME_CTRL_FRMW_MP_UP_DETECTION = 1 << 5,
2066 };
2067
2068 /**
2069 * enum nvme_id_ctrl_lpa - Flags indicating optional attributes for log pages
2070 * that are accessed via the Get Log Page command.
2071 * @NVME_CTRL_LPA_SMART_PER_NS: If set, controller supports SMART/Health log
2072 * page on a per namespace basis.
2073 * @NVME_CTRL_LPA_CMD_EFFECTS: If Set, the controller supports the commands
2074 * supported and effects log page.
2075 * @NVME_CTRL_LPA_EXTENDED: If set, the controller supports extended data
2076 * for log page command including extended number
2077 * of dwords and log page offset fields.
2078 * @NVME_CTRL_LPA_TELEMETRY: If set, the controller supports the telemetry
2079 * host-initiated and telemetry controller-initiated
2080 * log pages and sending telemetry log notices.
2081 * @NVME_CTRL_LPA_PERSETENT_EVENT: If set, the controller supports
2082 * persistent event log.
2083 * @NVME_CTRL_LPA_LI0_LI5_LI12_LI13: If set, the controller supports
2084 * - log pages log page.
2085 * - returning scope of each command in
2086 * commands supported and effects log
2087 * page.
2088 * - feature identifiers supported and
2089 * effects log page.
2090 * - NVMe-MI commands supported and
2091 * effects log page.
2092 * @NVME_CTRL_LPA_DA4_TELEMETRY: If set, the controller supports data
2093 * area 4 for telemetry host-initiated and
2094 * telemetry.
2095 */
2096 enum nvme_id_ctrl_lpa {
2097 NVME_CTRL_LPA_SMART_PER_NS = 1 << 0,
2098 NVME_CTRL_LPA_CMD_EFFECTS = 1 << 1,
2099 NVME_CTRL_LPA_EXTENDED = 1 << 2,
2100 NVME_CTRL_LPA_TELEMETRY = 1 << 3,
2101 NVME_CTRL_LPA_PERSETENT_EVENT = 1 << 4,
2102 NVME_CTRL_LPA_LI0_LI5_LI12_LI13 = 1 << 5,
2103 NVME_CTRL_LPA_DA4_TELEMETRY = 1 << 6,
2104 };
2105
2106 /**
2107 * enum nvme_id_ctrl_avscc - Flags indicating the configuration settings for
2108 * Admin Vendor Specific command handling.
2109 * @NVME_CTRL_AVSCC_AVS: If set, all Admin Vendor Specific Commands use the
2110 * optional vendor specific command format with NDT and
2111 * NDM fields.
2112 */
2113 enum nvme_id_ctrl_avscc {
2114 NVME_CTRL_AVSCC_AVS = 1 << 0,
2115 };
2116
2117 /**
2118 * enum nvme_id_ctrl_apsta - Flags indicating the attributes of the autonomous
2119 * power state transition feature.
2120 * @NVME_CTRL_APSTA_APST: If set, then the controller supports autonomous power
2121 * state transitions.
2122 */
2123 enum nvme_id_ctrl_apsta {
2124 NVME_CTRL_APSTA_APST = 1 << 0,
2125 };
2126
2127 /**
2128 * enum nvme_id_ctrl_rpmbs - This field indicates if the controller supports
2129 * one or more Replay Protected Memory Blocks, from
2130 * &struct nvme_id_ctrl.rpmbs.
2131 * @NVME_CTRL_RPMBS_NR_UNITS: Mask to get the value of the Number of RPMB Units
2132 * @NVME_CTRL_RPMBS_AUTH_METHOD: Mask to get the value of the Authentication Method
2133 * @NVME_CTRL_RPMBS_TOTAL_SIZE: Mask to get the value of Total Size
2134 * @NVME_CTRL_RPMBS_ACCESS_SIZE: Mask to get the value of Access Size
2135 */
2136 enum nvme_id_ctrl_rpmbs {
2137 NVME_CTRL_RPMBS_NR_UNITS = 7 << 0,
2138 NVME_CTRL_RPMBS_AUTH_METHOD = 7 << 3,
2139 NVME_CTRL_RPMBS_TOTAL_SIZE = 0xff << 16,
2140 NVME_CTRL_RPMBS_ACCESS_SIZE = 0xff << 24,
2141 };
2142
2143 /**
2144 * enum nvme_id_ctrl_dsto - Flags indicating the optional Device Self-test
2145 * command or operation behaviors supported by the
2146 * controller or NVM subsystem.
2147 * @NVME_CTRL_DSTO_SDSO_SHIFT: Shift amount to get the value of Single Device Self-test
2148 * Operation from Device Self-test Options field.
2149 * @NVME_CTRL_DSTO_HIRS_SHIFT: Shift amount to get the value of Host-Initiated Refresh
2150 * Support from Device Self-test Options field.
2151 * @NVME_CTRL_DSTO_SDSO_MASK: Mask to get the value of Single Device Self-test Operation
2152 * @NVME_CTRL_DSTO_HIRS_MASK: Mask to get the value of Host-Initiated Refresh Support
2153 * @NVME_CTRL_DSTO_ONE_DST: If set, then the NVM subsystem supports only one device
2154 * self-test operation in progress at a time. If cleared,
2155 * then the NVM subsystem supports one device self-test
2156 * operation per controller at a time.
2157 * @NVME_CTRL_DSTO_HIRS: If set, then the controller supports the Host-Initiated
2158 * Refresh capability.
2159 */
2160 enum nvme_id_ctrl_dsto {
2161 NVME_CTRL_DSTO_SDSO_SHIFT = 0,
2162 NVME_CTRL_DSTO_HIRS_SHIFT = 1,
2163 NVME_CTRL_DSTO_SDSO_MASK = 0x1,
2164 NVME_CTRL_DSTO_HIRS_MASK = 0x1,
2165 NVME_CTRL_DSTO_ONE_DST = NVME_VAL(CTRL_DSTO_SDSO),
2166 NVME_CTRL_DSTO_HIRS = NVME_VAL(CTRL_DSTO_HIRS),
2167 };
2168
2169 /**
2170 * enum nvme_id_ctrl_hctm - Flags indicate the attributes of the host
2171 * controlled thermal management feature
2172 * @NVME_CTRL_HCTMA_HCTM: then the controller supports host controlled thermal
2173 * management, and the Set Features command and Get
2174 * Features command with the Feature Identifier field
2175 * set to %NVME_FEAT_FID_HCTM.
2176 */
2177 enum nvme_id_ctrl_hctm {
2178 NVME_CTRL_HCTMA_HCTM = 1 << 0,
2179 };
2180
2181 /**
2182 * enum nvme_id_ctrl_sanicap - Indicates attributes for sanitize operations.
2183 * @NVME_CTRL_SANICAP_CES: Crypto Erase Support. If set, then the
2184 * controller supports the Crypto Erase sanitize operation.
2185 * @NVME_CTRL_SANICAP_BES: Block Erase Support. If set, then the controller
2186 * supports the Block Erase sanitize operation.
2187 * @NVME_CTRL_SANICAP_OWS: Overwrite Support. If set, then the controller
2188 * supports the Overwrite sanitize operation.
2189 * @NVME_CTRL_SANICAP_NDI: No-Deallocate Inhibited. If set and the No-
2190 * Deallocate Response Mode bit is set, then the
2191 * controller deallocates after the sanitize
2192 * operation even if the No-Deallocate After
2193 * Sanitize bit is set in a Sanitize command.
2194 * @NVME_CTRL_SANICAP_NODMMAS: No-Deallocate Modifies Media After Sanitize,
2195 * mask to extract value.
2196 */
2197 enum nvme_id_ctrl_sanicap {
2198 NVME_CTRL_SANICAP_CES = 1 << 0,
2199 NVME_CTRL_SANICAP_BES = 1 << 1,
2200 NVME_CTRL_SANICAP_OWS = 1 << 2,
2201 NVME_CTRL_SANICAP_NDI = 1 << 29,
2202 NVME_CTRL_SANICAP_NODMMAS = 3 << 30,
2203 };
2204
2205 /**
2206 * enum nvme_id_ctrl_anacap - This field indicates the capabilities associated
2207 * with Asymmetric Namespace Access Reporting.
2208 * @NVME_CTRL_ANACAP_OPT: If set, then the controller is able to
2209 * report ANA Optimized state.
2210 * @NVME_CTRL_ANACAP_NON_OPT: If set, then the controller is able to
2211 * report ANA Non-Optimized state.
2212 * @NVME_CTRL_ANACAP_INACCESSIBLE: If set, then the controller is able to
2213 * report ANA Inaccessible state.
2214 * @NVME_CTRL_ANACAP_PERSISTENT_LOSS: If set, then the controller is able to
2215 * report ANA Persistent Loss state.
2216 * @NVME_CTRL_ANACAP_CHANGE: If set, then the controller is able to
2217 * report ANA Change state.
2218 * @NVME_CTRL_ANACAP_GRPID_NO_CHG: If set, then the ANAGRPID field in the
2219 * Identify Namespace data structure
2220 * (&struct nvme_id_ns.anagrpid), does not
2221 * change while the namespace is attached to
2222 * any controller.
2223 * @NVME_CTRL_ANACAP_GRPID_MGMT: If set, then the controller supports a
2224 * non-zero value in the ANAGRPID field of
2225 * the Namespace Management command.
2226 */
2227 enum nvme_id_ctrl_anacap {
2228 NVME_CTRL_ANACAP_OPT = 1 << 0,
2229 NVME_CTRL_ANACAP_NON_OPT = 1 << 1,
2230 NVME_CTRL_ANACAP_INACCESSIBLE = 1 << 2,
2231 NVME_CTRL_ANACAP_PERSISTENT_LOSS = 1 << 3,
2232 NVME_CTRL_ANACAP_CHANGE = 1 << 4,
2233 NVME_CTRL_ANACAP_GRPID_NO_CHG = 1 << 6,
2234 NVME_CTRL_ANACAP_GRPID_MGMT = 1 << 7,
2235 };
2236
2237
2238 /**
2239 * enum nvme_id_ctrl_kpioc - Key Per I/O Capabilities
2240 * @NVME_CTRL_KPIOC_KPIOS_SHIFT: Shift amount to get the Key Per I/O Supported from the
2241 * &struct nvme_id_ctrl.kpioc field.
2242 * @NVME_CTRL_KPIOC_KPIOSC_SHIFT: Shift amount to get the Key Per I/O Scope from the
2243 * &struct nvme_id_ctrl.kpioc field.
2244 * @NVME_CTRL_KPIOC_KPIOS_MASK: Mask to get the Key Per I/O Supported from the
2245 * &struct nvme_id_ctrl.kpioc field.
2246 * @NVME_CTRL_KPIOC_KPIOSC_MASK: Mask to get the Key Per I/O Scope from the
2247 * &struct nvme_id_ctrl.kpioc field.
2248 */
2249 enum nvme_id_ctrl_kpioc {
2250 NVME_CTRL_KPIOC_KPIOS_SHIFT = 0,
2251 NVME_CTRL_KPIOC_KPIOSC_SHIFT = 1,
2252 NVME_CTRL_KPIOC_KPIOS_MASK = 0x1,
2253 NVME_CTRL_KPIOC_KPIOSC_MASK = 0x1,
2254 };
2255
2256 /**
2257 * enum nvme_id_ctrl_sqes - Defines the required and maximum Submission Queue
2258 * entry size when using the NVM Command Set.
2259 * @NVME_CTRL_SQES_MIN: Mask to get the value of the required Submission Queue
2260 * Entry size when using the NVM Command Set.
2261 * @NVME_CTRL_SQES_MAX: Mask to get the value of the maximum Submission Queue
2262 * entry size when using the NVM Command Set.
2263 */
2264 enum nvme_id_ctrl_sqes {
2265 NVME_CTRL_SQES_MIN = 0xf << 0,
2266 NVME_CTRL_SQES_MAX = 0xf << 4,
2267 };
2268
2269 /**
2270 * enum nvme_id_ctrl_cqes - Defines the required and maximum Completion Queue
2271 * entry size when using the NVM Command Set.
2272 * @NVME_CTRL_CQES_MIN: Mask to get the value of the required Completion Queue
2273 * Entry size when using the NVM Command Set.
2274 * @NVME_CTRL_CQES_MAX: Mask to get the value of the maximum Completion Queue
2275 * entry size when using the NVM Command Set.
2276 */
2277 enum nvme_id_ctrl_cqes {
2278 NVME_CTRL_CQES_MIN = 0xf << 0,
2279 NVME_CTRL_CQES_MAX = 0xf << 4,
2280 };
2281
2282 /**
2283 * enum nvme_id_ctrl_oncs - This field indicates the optional NVM commands and
2284 * features supported by the controller.
2285 * @NVME_CTRL_ONCS_COMPARE: If set, then the controller supports
2286 * the Compare command.
2287 * @NVME_CTRL_ONCS_WRITE_UNCORRECTABLE: If set, then the controller supports
2288 * the Write Uncorrectable command.
2289 * @NVME_CTRL_ONCS_DSM: If set, then the controller supports
2290 * the Dataset Management command.
2291 * @NVME_CTRL_ONCS_WRITE_ZEROES: If set, then the controller supports
2292 * the Write Zeroes command.
2293 * @NVME_CTRL_ONCS_SAVE_FEATURES: If set, then the controller supports
2294 * the Save field set to a non-zero value
2295 * in the Set Features command and the
2296 * Select field set to a non-zero value in
2297 * the Get Features command.
2298 * @NVME_CTRL_ONCS_RESERVATIONS: If set, then the controller supports
2299 * reservations.
2300 * @NVME_CTRL_ONCS_TIMESTAMP: If set, then the controller supports
2301 * the Timestamp feature.
2302 * @NVME_CTRL_ONCS_VERIFY: If set, then the controller supports
2303 * the Verify command.
2304 * @NVME_CTRL_ONCS_COPY: If set, then the controller supports
2305 * the copy command.
2306 * @NVME_CTRL_ONCS_COPY_SINGLE_ATOMICITY: If set, then the write portion of a
2307 * Copy command is performed as a single
2308 * write command to which the same
2309 * atomicity requirements that apply to
2310 * a write command apply.
2311 * @NVME_CTRL_ONCS_ALL_FAST_COPY: If set, then all copy operations for
2312 * the Copy command are fast copy
2313 * operations.
2314 * @NVME_CTRL_ONCS_WRITE_ZEROES_DEALLOCATE: If MAXWZD bit set, then the maximum data
2315 * size for Write Zeroes command depends on the
2316 * value of the Deallocate bit in the Write Zeroes
2317 * command and the value in the WZDSL field in the
2318 * I/O Command Set specific Identify Controller
2319 * data structure.
2320 * @NVME_CTRL_ONCS_NAMESPACE_ZEROES: If NSZS bit set, then the controller supports
2321 * the Namespace Zeroes (NSZ) bit in the NVM
2322 * Command Set Write Zeroes command.
2323 */
2324 enum nvme_id_ctrl_oncs {
2325 NVME_CTRL_ONCS_COMPARE = 1 << 0,
2326 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
2327 NVME_CTRL_ONCS_DSM = 1 << 2,
2328 NVME_CTRL_ONCS_WRITE_ZEROES = 1 << 3,
2329 NVME_CTRL_ONCS_SAVE_FEATURES = 1 << 4,
2330 NVME_CTRL_ONCS_RESERVATIONS = 1 << 5,
2331 NVME_CTRL_ONCS_TIMESTAMP = 1 << 6,
2332 NVME_CTRL_ONCS_VERIFY = 1 << 7,
2333 NVME_CTRL_ONCS_COPY = 1 << 8,
2334 NVME_CTRL_ONCS_COPY_SINGLE_ATOMICITY = 1 << 9,
2335 NVME_CTRL_ONCS_ALL_FAST_COPY = 1 << 10,
2336 NVME_CTRL_ONCS_WRITE_ZEROES_DEALLOCATE = 1 << 11,
2337 NVME_CTRL_ONCS_NAMESPACE_ZEROES = 1 << 12,
2338 };
2339
2340 /**
2341 * enum nvme_id_ctrl_fuses - This field indicates the fused operations that the
2342 * controller supports.
2343 * @NVME_CTRL_FUSES_COMPARE_AND_WRITE: If set, then the controller supports the
2344 * Compare and Write fused operation.
2345 */
2346 enum nvme_id_ctrl_fuses {
2347 NVME_CTRL_FUSES_COMPARE_AND_WRITE = 1 << 0,
2348 };
2349
2350 /**
2351 * enum nvme_id_ctrl_fna - This field indicates attributes for the Format NVM
2352 * command.
2353 * @NVME_CTRL_FNA_FMT_ALL_NS_SHIFT: Shift amount to get the format applied to all namespaces
2354 * @NVME_CTRL_FNA_SEC_ALL_NS_SHIFT: Shift amount to get the secure erase applied to all namespaces
2355 * @NVME_CTRL_FNA_CES_SHIFT: Shift amount to get the cryptographic erase supported
2356 * @NVME_CTRL_FNA_NSID_ALL_F_SHIFT: Shift amount to get the format supported an NSID FFFFFFFFh
2357 * @NVME_CTRL_FNA_FMT_ALL_NS_MASK: Mask to get the format applied to all namespaces
2358 * @NVME_CTRL_FNA_SEC_ALL_NS_MASK: Mask to get the secure erase applied to all namespaces
2359 * @NVME_CTRL_FNA_CES_MASK: Mask to get the cryptographic erase supported
2360 * @NVME_CTRL_FNA_NSID_ALL_F_MASK: Mask to get the format supported an NSID FFFFFFFFh
2361 * @NVME_CTRL_FNA_FMT_ALL_NAMESPACES: If set, then all namespaces in an NVM
2362 * subsystem shall be configured with the
2363 * same attributes and a format (excluding
2364 * secure erase) of any namespace results in
2365 * a format of all namespaces in an NVM
2366 * subsystem. If cleared, then the
2367 * controller supports format on a per
2368 * namespace basis.
2369 * @NVME_CTRL_FNA_SEC_ALL_NAMESPACES: If set, then any secure erase performed
2370 * as part of a format operation results in
2371 * a secure erase of all namespaces in the
2372 * NVM subsystem. If cleared, then any
2373 * secure erase performed as part of a
2374 * format results in a secure erase of the
2375 * particular namespace specified.
2376 * @NVME_CTRL_FNA_CRYPTO_ERASE: If set, then cryptographic erase is
2377 * supported. If cleared, then cryptographic
2378 * erase is not supported.
2379 * @NVME_CTRL_FNA_NSID_FFFFFFFF: If set, then format does not support
2380 * nsid value set to FFFFFFFFh. If cleared,
2381 * format supports nsid value set to
2382 * FFFFFFFFh.
2383 */
2384 enum nvme_id_ctrl_fna {
2385 NVME_CTRL_FNA_FMT_ALL_NS_SHIFT = 0,
2386 NVME_CTRL_FNA_SEC_ALL_NS_SHIFT = 1,
2387 NVME_CTRL_FNA_CES_SHIFT = 2,
2388 NVME_CTRL_FNA_NSID_ALL_F_SHIFT = 3,
2389 NVME_CTRL_FNA_FMT_ALL_NS_MASK = 0x1,
2390 NVME_CTRL_FNA_SEC_ALL_NS_MASK = 0x1,
2391 NVME_CTRL_FNA_CES_MASK = 0x1,
2392 NVME_CTRL_FNA_NSID_ALL_F_MASK = 0x1,
2393 NVME_CTRL_FNA_FMT_ALL_NAMESPACES = NVME_VAL(CTRL_FNA_FMT_ALL_NS),
2394 NVME_CTRL_FNA_SEC_ALL_NAMESPACES = NVME_VAL(CTRL_FNA_SEC_ALL_NS),
2395 NVME_CTRL_FNA_CRYPTO_ERASE = NVME_VAL(CTRL_FNA_CES),
2396 NVME_CTRL_FNA_NSID_FFFFFFFF = NVME_VAL(CTRL_FNA_NSID_ALL_F),
2397 };
2398
2399 #define NVME_CTRL_FNA_FMT_ALL_NS(fna) NVME_GET(fna, CTRL_FNA_FMT_ALL_NS)
2400 #define NVME_CTRL_FNA_SEC_ALL_NS(fna) NVME_GET(fna, CTRL_FNA_SEC_ALL_NS)
2401 #define NVME_CTRL_FNA_CES(fna) NVME_GET(fna, CTRL_FNA_CES)
2402 #define NVME_CTRL_FNA_NSID_ALL_F(fna) NVME_GET(fna, CTRL_FNA_NSID_ALL_F)
2403
2404 /**
2405 * enum nvme_id_ctrl_vwc - Volatile write cache
2406 * @NVME_CTRL_VWC_PRESENT: If set, indicates a volatile write cache is present.
2407 * If a volatile write cache is present, then the host
2408 * controls whether the volatile write cache is enabled
2409 * with a Set Features command specifying the value
2410 * %NVME_FEAT_FID_VOLATILE_WC.
2411 * @NVME_CTRL_VWC_FLUSH: Mask to get the value of the flush command behavior.
2412 */
2413 enum nvme_id_ctrl_vwc {
2414 NVME_CTRL_VWC_PRESENT = 1 << 0,
2415 NVME_CTRL_VWC_FLUSH = 3 << 1,
2416 };
2417
2418 /**
2419 * enum nvme_id_ctrl_nvscc - This field indicates the configuration settings
2420 * for NVM Vendor Specific command handling.
2421 * @NVME_CTRL_NVSCC_FMT: If set, all NVM Vendor Specific Commands use the
2422 * format with NDT and NDM fields.
2423 */
2424 enum nvme_id_ctrl_nvscc {
2425 NVME_CTRL_NVSCC_FMT = 1 << 0,
2426 };
2427
2428 /**
2429 * enum nvme_id_ctrl_nwpc - This field indicates the optional namespace write
2430 * protection capabilities supported by the
2431 * controller.
2432 * @NVME_CTRL_NWPC_WRITE_PROTECT: If set, then the controller shall
2433 * support the No Write Protect and
2434 * Write Protect namespace write
2435 * protection states and may support
2436 * the Write Protect Until Power
2437 * Cycle state and Permanent Write
2438 * Protect namespace write
2439 * protection states.
2440 * @NVME_CTRL_NWPC_WRITE_PROTECT_POWER_CYCLE: If set, then the controller
2441 * supports the Write Protect Until
2442 * Power Cycle state.
2443 * @NVME_CTRL_NWPC_WRITE_PROTECT_PERMANENT: If set, then the controller
2444 * supports the Permanent Write
2445 * Protect state.
2446 */
2447 enum nvme_id_ctrl_nwpc {
2448 NVME_CTRL_NWPC_WRITE_PROTECT = 1 << 0,
2449 NVME_CTRL_NWPC_WRITE_PROTECT_POWER_CYCLE= 1 << 1,
2450 NVME_CTRL_NWPC_WRITE_PROTECT_PERMANENT = 1 << 2,
2451 };
2452
2453 /**
2454 * enum nvme_id_ctrl_sgls - This field indicates if SGLs are supported for the
2455 * NVM Command Set and the particular SGL types supported.
2456 * @NVME_CTRL_SGLS_SUPPORTED:
2457 * @NVME_CTRL_SGLS_KEYED:
2458 * @NVME_CTRL_SGLS_BIT_BUCKET:
2459 * @NVME_CTRL_SGLS_MPTR_BYTE_ALIGNED:
2460 * @NVME_CTRL_SGLS_OVERSIZE:
2461 * @NVME_CTRL_SGLS_MPTR_SGL:
2462 * @NVME_CTRL_SGLS_OFFSET:
2463 * @NVME_CTRL_SGLS_TPORT:
2464 */
2465 enum nvme_id_ctrl_sgls {
2466 NVME_CTRL_SGLS_SUPPORTED = 3 << 0,
2467 NVME_CTRL_SGLS_KEYED = 1 << 2,
2468 NVME_CTRL_SGLS_BIT_BUCKET = 1 << 16,
2469 NVME_CTRL_SGLS_MPTR_BYTE_ALIGNED = 1 << 17,
2470 NVME_CTRL_SGLS_OVERSIZE = 1 << 18,
2471 NVME_CTRL_SGLS_MPTR_SGL = 1 << 19,
2472 NVME_CTRL_SGLS_OFFSET = 1 << 20,
2473 NVME_CTRL_SGLS_TPORT = 1 << 21,
2474 };
2475
2476 /**
2477 * enum nvme_id_ctrl_trattr - Tracking Attributes
2478 * @NVME_CTRL_TRATTR_THMCS_SHIFT: Shift amount to get the Track Host Memory Changes Support
2479 * from the &struct nvme_id_ctrl.trattr field.
2480 * @NVME_CTRL_TRATTR_TUDCS_SHIFT: Shift amount to get the Track User Data Changes Support
2481 * from the &struct nvme_id_ctrl.trattr field.
2482 * @NVME_CTRL_TRATTR_MRTLL_SHIFT: Shift amount to get the Memory Range Tracking Length Limit
2483 * from the &struct nvme_id_ctrl.trattr field.
2484 * @NVME_CTRL_TRATTR_THMCS_MASK: Mask to get the Track Host Memory Changes Support
2485 * from the &struct nvme_id_ctrl.trattr field.
2486 * @NVME_CTRL_TRATTR_TUDCS_MASK: Mask to get the Track User Data Changes Support
2487 * from the &struct nvme_id_ctrl.trattr field.
2488 * @NVME_CTRL_TRATTR_MRTLL_MASK: Mask to get the Memory Range Tracking Length Limit
2489 * from the &struct nvme_id_ctrl.trattr field.
2490 */
2491 enum nvme_id_ctrl_trattr {
2492 NVME_CTRL_TRATTR_THMCS_SHIFT = 0,
2493 NVME_CTRL_TRATTR_TUDCS_SHIFT = 1,
2494 NVME_CTRL_TRATTR_MRTLL_SHIFT = 2,
2495 NVME_CTRL_TRATTR_THMCS_MASK = 0x1,
2496 NVME_CTRL_TRATTR_TUDCS_MASK = 0x1,
2497 NVME_CTRL_TRATTR_MRTLL_MASK = 0x1,
2498 };
2499
2500 /**
2501 * enum nvme_id_ctrl_fcatt - This field indicates attributes of the controller
2502 * that are specific to NVMe over Fabrics.
2503 * @NVME_CTRL_FCATT_DYNAMIC: If cleared, then the NVM subsystem uses a dynamic
2504 * controller model. If set, then the NVM subsystem
2505 * uses a static controller model.
2506 */
2507 enum nvme_id_ctrl_fcatt {
2508 NVME_CTRL_FCATT_DYNAMIC = 1 << 0,
2509 };
2510
2511 /**
2512 * enum nvme_id_ctrl_ofcs - Indicate whether the controller supports optional
2513 * fabric commands.
2514 * @NVME_CTRL_OFCS_DISCONNECT: If set, then the controller supports the
2515 * Disconnect command and deletion of individual
2516 * I/O Queues.
2517 */
2518 enum nvme_id_ctrl_ofcs {
2519 NVME_CTRL_OFCS_DISCONNECT = 1 << 0,
2520 };
2521
2522 /**
2523 * struct nvme_lbaf - LBA Format Data Structure
2524 * @ms: Metadata Size indicates the number of metadata bytes provided per LBA
2525 * based on the LBA Data Size indicated.
2526 * @ds: LBA Data Size indicates the LBA data size supported, reported as a
2527 * power of two.
2528 * @rp: Relative Performance, see &enum nvme_lbaf_rp.
2529 */
2530 struct nvme_lbaf {
2531 __le16 ms;
2532 __u8 ds;
2533 __u8 rp;
2534 };
2535
2536 /**
2537 * enum nvme_lbaf_rp - This field indicates the relative performance of the LBA
2538 * format indicated relative to other LBA formats supported
2539 * by the controller.
2540 * @NVME_LBAF_RP_BEST: Best performance
2541 * @NVME_LBAF_RP_BETTER: Better performance
2542 * @NVME_LBAF_RP_GOOD: Good performance
2543 * @NVME_LBAF_RP_DEGRADED: Degraded performance
2544 * @NVME_LBAF_RP_MASK: Mask to get the relative performance value from the
2545 * field
2546 */
2547 enum nvme_lbaf_rp {
2548 NVME_LBAF_RP_BEST = 0,
2549 NVME_LBAF_RP_BETTER = 1,
2550 NVME_LBAF_RP_GOOD = 2,
2551 NVME_LBAF_RP_DEGRADED = 3,
2552 NVME_LBAF_RP_MASK = 3,
2553 };
2554
2555 /**
2556 * struct nvme_id_ns - Identify Namespace data structure
2557 * @nsze: Namespace Size indicates the total size of the namespace in
2558 * logical blocks. The number of logical blocks is based on the
2559 * formatted LBA size.
2560 * @ncap: Namespace Capacity indicates the maximum number of logical blocks
2561 * that may be allocated in the namespace at any point in time. The
2562 * number of logical blocks is based on the formatted LBA size.
2563 * @nuse: Namespace Utilization indicates the current number of logical
2564 * blocks allocated in the namespace. This field is smaller than or
2565 * equal to the Namespace Capacity. The number of logical blocks is
2566 * based on the formatted LBA size.
2567 * @nsfeat: Namespace Features, see &enum nvme_id_nsfeat.
2568 * @nlbaf: Number of LBA Formats defines the number of supported LBA data
2569 * size and metadata size combinations supported by the namespace
2570 * and the highest possible index to &struct nvme_id_ns.lbaf.
2571 * @flbas: Formatted LBA Size, see &enum nvme_id_ns_flbas.
2572 * @mc: Metadata Capabilities, see &enum nvme_id_ns_mc.
2573 * @dpc: End-to-end Data Protection Capabilities, see
2574 * &enum nvme_id_ns_dpc.
2575 * @dps: End-to-end Data Protection Type Settings, see
2576 * &enum nvme_id_ns_dps.
2577 * @nmic: Namespace Multi-path I/O and Namespace Sharing Capabilities, see
2578 * &enum nvme_id_ns_nmic.
2579 * @rescap: Reservation Capabilities, see &enum nvme_id_ns_rescap.
2580 * @fpi: Format Progress Indicator, see &enum nvme_nd_ns_fpi.
2581 * @dlfeat: Deallocate Logical Block Features, see &enum nvme_id_ns_dlfeat.
2582 * @nawun: Namespace Atomic Write Unit Normal indicates the
2583 * namespace specific size of the write operation guaranteed to be
2584 * written atomically to the NVM during normal operation.
2585 * @nawupf: Namespace Atomic Write Unit Power Fail indicates the
2586 * namespace specific size of the write operation guaranteed to be
2587 * written atomically to the NVM during a power fail or error
2588 * condition.
2589 * @nacwu: Namespace Atomic Compare & Write Unit indicates the namespace
2590 * specific size of the write operation guaranteed to be written
2591 * atomically to the NVM for a Compare and Write fused command.
2592 * @nabsn: Namespace Atomic Boundary Size Normal indicates the atomic
2593 * boundary size for this namespace for the NAWUN value. This field
2594 * is specified in logical blocks.
2595 * @nabo: Namespace Atomic Boundary Offset indicates the LBA on this
2596 * namespace where the first atomic boundary starts.
2597 * @nabspf: Namespace Atomic Boundary Size Power Fail indicates the atomic
2598 * boundary size for this namespace specific to the Namespace Atomic
2599 * Write Unit Power Fail value. This field is specified in logical
2600 * blocks.
2601 * @noiob: Namespace Optimal I/O Boundary indicates the optimal I/O boundary
2602 * for this namespace. This field is specified in logical blocks.
2603 * The host should construct Read and Write commands that do not
2604 * cross the I/O boundary to achieve optimal performance.
2605 * @nvmcap: NVM Capacity indicates the total size of the NVM allocated to
2606 * this namespace. The value is in bytes.
2607 * @npwg: Namespace Preferred Write Granularity indicates the smallest
2608 * recommended write granularity in logical blocks for this
2609 * namespace. This is a 0's based value.
2610 * @npwa: Namespace Preferred Write Alignment indicates the recommended
2611 * write alignment in logical blocks for this namespace. This is a
2612 * 0's based value.
2613 * @npdg: Namespace Preferred Deallocate Granularity indicates the
2614 * recommended granularity in logical blocks for the Dataset
2615 * Management command with the Attribute - Deallocate bit.
2616 * @npda: Namespace Preferred Deallocate Alignment indicates the
2617 * recommended alignment in logical blocks for the Dataset
2618 * Management command with the Attribute - Deallocate bit
2619 * @nows: Namespace Optimal Write Size indicates the size in logical blocks
2620 * for optimal write performance for this namespace. This is a 0's
2621 * based value.
2622 * @mssrl: Maximum Single Source Range Length indicates the maximum number
2623 * of logical blocks that may be specified in each valid Source Range
2624 * field of a Copy command.
2625 * @mcl: Maximum Copy Length indicates the maximum number of logical
2626 * blocks that may be specified in a Copy command.
2627 * @msrc: Maximum Source Range Count indicates the maximum number of Source
2628 * Range entries that may be used to specify source data in a Copy
2629 * command. This is a 0’s based value.
2630 * @kpios: Key Per I/O Status indicates namespace Key Per I/O capability status.
2631 * @nulbaf: Number of Unique Capability LBA Formats defines the number of
2632 * supported user data size and metadata size combinations supported
2633 * by the namespace that may not share the same capabilities. LBA
2634 * formats shall be allocated in order and packed sequentially.
2635 * @rsvd83: Reserved
2636 * @kpiodaag: Key Per I/O Data Access Alignment and Granularity indicates the
2637 * alignment and granularity in logical blocks that is required
2638 * for commands that support a KPIOTAG value in the CETYPE field.
2639 * @rsvd88: Reserved
2640 * @anagrpid: ANA Group Identifier indicates the ANA Group Identifier of the
2641 * ANA group of which the namespace is a member.
2642 * @rsvd96: Reserved
2643 * @nsattr: Namespace Attributes, see &enum nvme_id_ns_attr.
2644 * @nvmsetid: NVM Set Identifier indicates the NVM Set with which this
2645 * namespace is associated.
2646 * @endgid: Endurance Group Identifier indicates the Endurance Group with
2647 * which this namespace is associated.
2648 * @nguid: Namespace Globally Unique Identifier contains a 128-bit value
2649 * that is globally unique and assigned to the namespace when the
2650 * namespace is created. This field remains fixed throughout the
2651 * life of the namespace and is preserved across namespace and
2652 * controller operations
2653 * @eui64: IEEE Extended Unique Identifier contains a 64-bit IEEE Extended
2654 * Unique Identifier (EUI-64) that is globally unique and assigned
2655 * to the namespace when the namespace is created. This field
2656 * remains fixed throughout the life of the namespace and is
2657 * preserved across namespace and controller operations
2658 * @lbaf: LBA Format, see &struct nvme_lbaf.
2659 * @vs: Vendor Specific
2660 */
2661 struct nvme_id_ns {
2662 __le64 nsze;
2663 __le64 ncap;
2664 __le64 nuse;
2665 __u8 nsfeat;
2666 __u8 nlbaf;
2667 __u8 flbas;
2668 __u8 mc;
2669 __u8 dpc;
2670 __u8 dps;
2671 __u8 nmic;
2672 __u8 rescap;
2673 __u8 fpi;
2674 __u8 dlfeat;
2675 __le16 nawun;
2676 __le16 nawupf;
2677 __le16 nacwu;
2678 __le16 nabsn;
2679 __le16 nabo;
2680 __le16 nabspf;
2681 __le16 noiob;
2682 __u8 nvmcap[16];
2683 __le16 npwg;
2684 __le16 npwa;
2685 __le16 npdg;
2686 __le16 npda;
2687 __le16 nows;
2688 __le16 mssrl;
2689 __le32 mcl;
2690 __u8 msrc;
2691 __u8 kpios;
2692 __u8 nulbaf;
2693 __u8 rsvd83;
2694 __le32 kpiodaag;
2695 __u8 rsvd88[4];
2696 __le32 anagrpid;
2697 __u8 rsvd96[3];
2698 __u8 nsattr;
2699 __le16 nvmsetid;
2700 __le16 endgid;
2701 __u8 nguid[16];
2702 __u8 eui64[8];
2703 struct nvme_lbaf lbaf[64];
2704 __u8 vs[3712];
2705 };
2706
2707 /**
2708 * enum nvme_id_nsfeat - This field defines features of the namespace.
2709 * @NVME_NS_FEAT_THIN: If set, indicates that the namespace supports thin
2710 * provisioning. Specifically, the Namespace Capacity
2711 * reported may be less than the Namespace Size.
2712 * @NVME_NS_FEAT_NATOMIC: If set, indicates that the fields NAWUN, NAWUPF, and
2713 * NACWU are defined for this namespace and should be
2714 * used by the host for this namespace instead of the
2715 * AWUN, AWUPF, and ACWU fields in the Identify
2716 * Controller data structure.
2717 * @NVME_NS_FEAT_DULBE: If set, indicates that the controller supports the
2718 * Deallocated or Unwritten Logical Block error for
2719 * this namespace.
2720 * @NVME_NS_FEAT_ID_REUSE: If set, indicates that the value in the NGUID field
2721 * for this namespace, if non- zero, is never reused by
2722 * the controller and that the value in the EUI64 field
2723 * for this namespace, if non-zero, is never reused by
2724 * the controller.
2725 * @NVME_NS_FEAT_IO_OPT: If set, indicates that the fields NPWG, NPWA, NPDG,
2726 * NPDA, and NOWS are defined for this namespace and
2727 * should be used by the host for I/O optimization
2728 */
2729 enum nvme_id_nsfeat {
2730 NVME_NS_FEAT_THIN = 1 << 0,
2731 NVME_NS_FEAT_NATOMIC = 1 << 1,
2732 NVME_NS_FEAT_DULBE = 1 << 2,
2733 NVME_NS_FEAT_ID_REUSE = 1 << 3,
2734 NVME_NS_FEAT_IO_OPT = 3 << 4,
2735 };
2736
2737 /**
2738 * enum nvme_id_ns_flbas - This field indicates the LBA data size & metadata
2739 * size combination that the namespace has been
2740 * formatted with
2741 * @NVME_NS_FLBAS_LOWER_MASK: Mask to get the index of one of the supported
2742 * LBA Formats's least significant
2743 * 4bits indicated in
2744 * :c:type:`struct nvme_id_ns <nvme_id_ns>`.lbaf.
2745 * @NVME_NS_FLBAS_META_EXT: Applicable only if format contains metadata. If
2746 * this bit is set, indicates that the metadata is
2747 * transferred at the end of the data LBA, creating an
2748 * extended data LBA. If cleared, indicates that all
2749 * of the metadata for a command is transferred as a
2750 * separate contiguous buffer of data.
2751 * @NVME_NS_FLBAS_HIGHER_MASK: Mask to get the index of one of
2752 * the supported LBA Formats's most significant
2753 * 2bits indicated in
2754 * :c:type:`struct nvme_id_ns <nvme_id_ns>`.lbaf.
2755 */
2756 enum nvme_id_ns_flbas {
2757 NVME_NS_FLBAS_LOWER_MASK = 15 << 0,
2758 NVME_NS_FLBAS_META_EXT = 1 << 4,
2759 NVME_NS_FLBAS_HIGHER_MASK = 3 << 5,
2760 };
2761
2762 /**
2763 * enum nvme_nvm_id_ns_elbaf - This field indicates the extended LBA format
2764 * @NVME_NVM_ELBAF_STS_MASK: Mask to get the storage tag size used to determine
2765 * the variable-sized storage tag/reference tag fields
2766 * @NVME_NVM_ELBAF_PIF_MASK: Mask to get the protection information format for
2767 * the extended LBA format.
2768 * @NVME_NVM_ELBAF_QPIF_MASK: Mask to get the Qualified Protection Information
2769 * Format.
2770 */
2771 enum nvme_nvm_id_ns_elbaf {
2772 NVME_NVM_ELBAF_STS_MASK = 127 << 0,
2773 NVME_NVM_ELBAF_PIF_MASK = 3 << 7,
2774 NVME_NVM_ELBAF_QPIF_MASK = 15 << 9,
2775 };
2776
2777 /**
2778 * enum nvme_nvm_id_ns_pif - This field indicates the type of the Protection
2779 * Information Format
2780 * @NVME_NVM_PIF_16B_GUARD: 16-bit Guard Protection Information Format
2781 * @NVME_NVM_PIF_32B_GUARD: 32-bit Guard Protection Information Format
2782 * @NVME_NVM_PIF_64B_GUARD: 64-bit Guard Protection Information Format
2783 * @NVME_NVM_PIF_QTYPE: If Qualified Protection Information Format Supports
2784 * and Protection Information Format is set to 3, then
2785 * protection information format is taken from Qualified
2786 * Protection Information Format field.
2787 */
2788 enum nvme_nvm_id_ns_pif {
2789 NVME_NVM_PIF_16B_GUARD = 0,
2790 NVME_NVM_PIF_32B_GUARD = 1,
2791 NVME_NVM_PIF_64B_GUARD = 2,
2792 NVME_NVM_PIF_QTYPE = 3,
2793 };
2794
2795 /**
2796 * enum nvme_id_ns_mc - This field indicates the capabilities for metadata.
2797 * @NVME_NS_MC_EXTENDED: If set, indicates the namespace supports the metadata
2798 * being transferred as part of a separate buffer that is
2799 * specified in the Metadata Pointer.
2800 * @NVME_NS_MC_SEPARATE: If set, indicates that the namespace supports the
2801 * metadata being transferred as part of an extended data LBA.
2802 */
2803 enum nvme_id_ns_mc {
2804 NVME_NS_MC_EXTENDED = 1 << 0,
2805 NVME_NS_MC_SEPARATE = 1 << 1,
2806 };
2807
2808 /**
2809 * enum nvme_id_ns_dpc - This field indicates the capabilities for the
2810 * end-to-end data protection feature.
2811 * @NVME_NS_DPC_PI_TYPE1: If set, indicates that the namespace supports
2812 * Protection Information Type 1.
2813 * @NVME_NS_DPC_PI_TYPE2: If set, indicates that the namespace supports
2814 * Protection Information Type 2.
2815 * @NVME_NS_DPC_PI_TYPE3: If set, indicates that the namespace supports
2816 * Protection Information Type 3.
2817 * @NVME_NS_DPC_PI_FIRST: If set, indicates that the namespace supports
2818 * protection information transferred as the first eight
2819 * bytes of metadata.
2820 * @NVME_NS_DPC_PI_LAST: If set, indicates that the namespace supports
2821 * protection information transferred as the last eight
2822 * bytes of metadata.
2823 */
2824 enum nvme_id_ns_dpc {
2825 NVME_NS_DPC_PI_TYPE1 = 1 << 0,
2826 NVME_NS_DPC_PI_TYPE2 = 1 << 1,
2827 NVME_NS_DPC_PI_TYPE3 = 1 << 2,
2828 NVME_NS_DPC_PI_FIRST = 1 << 3,
2829 NVME_NS_DPC_PI_LAST = 1 << 4,
2830 };
2831
2832 /**
2833 * enum nvme_id_ns_dps - This field indicates the Type settings for the
2834 * end-to-end data protection feature.
2835 * @NVME_NS_DPS_PI_NONE: Protection information is not enabled
2836 * @NVME_NS_DPS_PI_TYPE1: Protection information is enabled, Type 1
2837 * @NVME_NS_DPS_PI_TYPE2: Protection information is enabled, Type 2
2838 * @NVME_NS_DPS_PI_TYPE3: Protection information is enabled, Type 3
2839 * @NVME_NS_DPS_PI_MASK: Mask to get the value of the PI type
2840 * @NVME_NS_DPS_PI_FIRST: If set, indicates that the protection information, if
2841 * enabled, is transferred as the first eight bytes of
2842 * metadata.
2843 */
2844 enum nvme_id_ns_dps {
2845 NVME_NS_DPS_PI_NONE = 0,
2846 NVME_NS_DPS_PI_TYPE1 = 1,
2847 NVME_NS_DPS_PI_TYPE2 = 2,
2848 NVME_NS_DPS_PI_TYPE3 = 3,
2849 NVME_NS_DPS_PI_MASK = 7 << 0,
2850 NVME_NS_DPS_PI_FIRST = 1 << 3,
2851 };
2852
2853 /**
2854 * enum nvme_id_ns_nmic - This field specifies multi-path I/O and namespace
2855 * sharing capabilities of the namespace.
2856 * @NVME_NS_NMIC_SHARED: If set, then the namespace may be attached to two or
2857 * more controllers in the NVM subsystem concurrently
2858 */
2859 enum nvme_id_ns_nmic {
2860 NVME_NS_NMIC_SHARED = 1 << 0,
2861 };
2862
2863 /**
2864 * enum nvme_id_ns_rescap - This field indicates the reservation capabilities
2865 * of the namespace.
2866 * @NVME_NS_RESCAP_PTPL: If set, indicates that the namespace supports the
2867 * Persist Through Power Loss capability.
2868 * @NVME_NS_RESCAP_WE: If set, indicates that the namespace supports the
2869 * Write Exclusive reservation type.
2870 * @NVME_NS_RESCAP_EA: If set, indicates that the namespace supports the
2871 * Exclusive Access reservation type.
2872 * @NVME_NS_RESCAP_WERO: If set, indicates that the namespace supports the
2873 * Write Exclusive - Registrants Only reservation type.
2874 * @NVME_NS_RESCAP_EARO: If set, indicates that the namespace supports the
2875 * Exclusive Access - Registrants Only reservation type.
2876 * @NVME_NS_RESCAP_WEAR: If set, indicates that the namespace supports the
2877 * Write Exclusive - All Registrants reservation type.
2878 * @NVME_NS_RESCAP_EAAR: If set, indicates that the namespace supports the
2879 * Exclusive Access - All Registrants reservation type.
2880 * @NVME_NS_RESCAP_IEK_13: If set, indicates that Ignore Existing Key is used
2881 * as defined in revision 1.3 or later of this specification.
2882 */
2883 enum nvme_id_ns_rescap {
2884 NVME_NS_RESCAP_PTPL = 1 << 0,
2885 NVME_NS_RESCAP_WE = 1 << 1,
2886 NVME_NS_RESCAP_EA = 1 << 2,
2887 NVME_NS_RESCAP_WERO = 1 << 3,
2888 NVME_NS_RESCAP_EARO = 1 << 4,
2889 NVME_NS_RESCAP_WEAR = 1 << 5,
2890 NVME_NS_RESCAP_EAAR = 1 << 6,
2891 NVME_NS_RESCAP_IEK_13 = 1 << 7,
2892 };
2893
2894 /**
2895 * enum nvme_nd_ns_fpi - If a format operation is in progress, this field
2896 * indicates the percentage of the namespace that remains
2897 * to be formatted.
2898 * @NVME_NS_FPI_REMAINING: Mask to get the format percent remaining value
2899 * @NVME_NS_FPI_SUPPORTED: If set, indicates that the namespace supports the
2900 * Format Progress Indicator defined for the field.
2901 */
2902 enum nvme_nd_ns_fpi {
2903 NVME_NS_FPI_REMAINING = 0x7f << 0,
2904 NVME_NS_FPI_SUPPORTED = 1 << 7,
2905 };
2906
2907 /**
2908 * enum nvme_id_ns_dlfeat - This field indicates information about features
2909 * that affect deallocating logical blocks for this
2910 * namespace.
2911 * @NVME_NS_DLFEAT_RB: Mask to get the value of the read behavior
2912 * @NVME_NS_DLFEAT_RB_NR: Read behvaior is not reported
2913 * @NVME_NS_DLFEAT_RB_ALL_0S: A deallocated logical block returns all bytes
2914 * cleared to 0h.
2915 * @NVME_NS_DLFEAT_RB_ALL_FS: A deallocated logical block returns all bytes
2916 * set to FFh.
2917 * @NVME_NS_DLFEAT_WRITE_ZEROES: If set, indicates that the controller supports
2918 * the Deallocate bit in the Write Zeroes command
2919 * for this namespace.
2920 * @NVME_NS_DLFEAT_CRC_GUARD: If set, indicates that the Guard field for
2921 * deallocated logical blocks that contain
2922 * protection information is set to the CRC for
2923 * the value read from the deallocated logical
2924 * block and its metadata
2925 */
2926 enum nvme_id_ns_dlfeat {
2927 NVME_NS_DLFEAT_RB = 7 << 0,
2928 NVME_NS_DLFEAT_RB_NR = 0,
2929 NVME_NS_DLFEAT_RB_ALL_0S = 1,
2930 NVME_NS_DLFEAT_RB_ALL_FS = 2,
2931 NVME_NS_DLFEAT_WRITE_ZEROES = 1 << 3,
2932 NVME_NS_DLFEAT_CRC_GUARD = 1 << 4,
2933 };
2934
2935 /**
2936 * enum nvme_id_ns_attr - Specifies attributes of the namespace.
2937 * @NVME_NS_NSATTR_WRITE_PROTECTED: If set, then the namespace is currently
2938 * write protected and all write access to the
2939 * namespace shall fail.
2940 */
2941 enum nvme_id_ns_attr {
2942 NVME_NS_NSATTR_WRITE_PROTECTED = 1 << 0
2943 };
2944
2945 /**
2946 * struct nvme_ns_id_desc - Namespace identifier type descriptor
2947 * @nidt: Namespace Identifier Type, see &enum nvme_ns_id_desc_nidt
2948 * @nidl: Namespace Identifier Length contains the length in bytes of the
2949 * &struct nvme_id_ns.nid.
2950 * @rsvd: Reserved
2951 * @nid: Namespace Identifier contains a value that is globally unique and
2952 * assigned to the namespace when the namespace is created. The length
2953 * is defined in &struct nvme_id_ns.nidl.
2954 */
2955 struct nvme_ns_id_desc {
2956 __u8 nidt;
2957 __u8 nidl;
2958 __le16 rsvd;
2959 __u8 nid[];
2960 } __attribute__((packed));
2961
2962 /**
2963 * enum nvme_ns_id_desc_nidt - Known namespace identifier types
2964 * @NVME_NIDT_EUI64: IEEE Extended Unique Identifier, the NID field contains a
2965 * copy of the EUI64 field in the struct nvme_id_ns.eui64.
2966 * @NVME_NIDT_NGUID: Namespace Globally Unique Identifier, the NID field
2967 * contains a copy of the NGUID field in struct nvme_id_ns.nguid.
2968 * @NVME_NIDT_UUID: The NID field contains a 128-bit Universally Unique
2969 * Identifier (UUID) as specified in RFC 4122.
2970 * @NVME_NIDT_CSI: The NID field contains the command set identifier.
2971 */
2972 enum nvme_ns_id_desc_nidt {
2973 NVME_NIDT_EUI64 = 1,
2974 NVME_NIDT_NGUID = 2,
2975 NVME_NIDT_UUID = 3,
2976 NVME_NIDT_CSI = 4,
2977 };
2978
2979 enum nvme_ns_id_desc_nidt_lens {
2980 NVME_NIDT_EUI64_LEN = 8,
2981 NVME_NIDT_NGUID_LEN = 16,
2982 NVME_NIDT_UUID_LEN = 16,
2983 NVME_NIDT_CSI_LEN = 1,
2984 };
2985
2986 /**
2987 * struct nvme_nvmset_attr - NVM Set Attributes Entry
2988 * @nvmsetid: NVM Set Identifier
2989 * @endgid: Endurance Group Identifier
2990 * @rsvd4: Reserved
2991 * @rr4kt: Random 4 KiB Read Typical indicates the typical
2992 * time to complete a 4 KiB random read in 100 nanosecond units
2993 * when the NVM Set is in a Predictable Latency Mode Deterministic
2994 * Window and there is 1 outstanding command per NVM Set.
2995 * @ows: Optimal Write Size
2996 * @tnvmsetcap: Total NVM Set Capacity
2997 * @unvmsetcap: Unallocated NVM Set Capacity
2998 * @rsvd48: Reserved
2999 */
3000 struct nvme_nvmset_attr {
3001 __le16 nvmsetid;
3002 __le16 endgid;
3003 __u8 rsvd4[4];
3004 __le32 rr4kt;
3005 __le32 ows;
3006 __u8 tnvmsetcap[16];
3007 __u8 unvmsetcap[16];
3008 __u8 rsvd48[80];
3009 };
3010
3011 /**
3012 * struct nvme_id_nvmset_list - NVM set list
3013 * @nid: Nvmset id
3014 * @rsvd1: Reserved
3015 * @ent: nvmset id list
3016 */
3017 struct nvme_id_nvmset_list {
3018 __u8 nid;
3019 __u8 rsvd1[127];
3020 struct nvme_nvmset_attr ent[NVME_ID_NVMSET_LIST_MAX];
3021 };
3022
3023 /**
3024 * struct nvme_id_independent_id_ns - Identify - I/O Command Set Independent Identify Namespace Data Structure
3025 * @nsfeat: common namespace features
3026 * @nmic: Namespace Multi-path I/O and Namespace
3027 * Sharing Capabilities
3028 * @rescap: Reservation Capabilities
3029 * @fpi: Format Progress Indicator
3030 * @anagrpid: ANA Group Identifier
3031 * @nsattr: Namespace Attributes
3032 * @rsvd9: reserved
3033 * @nvmsetid: NVM Set Identifier
3034 * @endgid: Endurance Group Identifier
3035 * @nstat: Namespace Status
3036 * @kpios: Key Per I/O Status
3037 * @maxkt: Maximum Key Tag
3038 * @rsvd18: Reserved
3039 * @rgrpid: Reachability Group Identifier
3040 * @rsvd24: Reserved
3041 */
3042 struct nvme_id_independent_id_ns {
3043 __u8 nsfeat;
3044 __u8 nmic;
3045 __u8 rescap;
3046 __u8 fpi;
3047 __le32 anagrpid;
3048 __u8 nsattr;
3049 __u8 rsvd9;
3050 __le16 nvmsetid;
3051 __le16 endgid;
3052 __u8 nstat;
3053 __u8 kpios;
3054 __le16 maxkt;
3055 __u8 rsvd18[2];
3056 __le32 rgrpid;
3057 __u8 rsvd24[4072];
3058 };
3059
3060 /**
3061 * struct nvme_id_ns_granularity_desc - Namespace Granularity Descriptor
3062 * @nszegran: Namespace Size Granularity
3063 * @ncapgran: Namespace Capacity Granularity
3064 */
3065 struct nvme_id_ns_granularity_desc {
3066 __le64 nszegran;
3067 __le64 ncapgran;
3068 };
3069
3070 /**
3071 * struct nvme_id_ns_granularity_list - Namespace Granularity List
3072 * @attributes: Namespace Granularity Attributes
3073 * @num_descriptors: Number of Descriptors
3074 * @rsvd5: reserved
3075 * @entry: Namespace Granularity Descriptor
3076 * @rsvd288: reserved
3077 */
3078 struct nvme_id_ns_granularity_list {
3079 __le32 attributes;
3080 __u8 num_descriptors;
3081 __u8 rsvd5[27];
3082 struct nvme_id_ns_granularity_desc entry[NVME_ID_ND_DESCRIPTOR_MAX];
3083 __u8 rsvd288[3808];
3084 };
3085
3086 /**
3087 * struct nvme_id_uuid_list_entry - UUID List Entry
3088 * @header: UUID Lists Entry Header
3089 * @rsvd1: reserved
3090 * @uuid: 128-bit Universally Unique Identifier
3091 */
3092 struct nvme_id_uuid_list_entry {
3093 __u8 header;
3094 __u8 rsvd1[15];
3095 __u8 uuid[16];
3096 };
3097
3098 /**
3099 * enum nvme_id_uuid - Identifier Association
3100 * @NVME_ID_UUID_HDR_ASSOCIATION_MASK:
3101 * @NVME_ID_UUID_ASSOCIATION_NONE:
3102 * @NVME_ID_UUID_ASSOCIATION_VENDOR:
3103 * @NVME_ID_UUID_ASSOCIATION_SUBSYSTEM_VENDOR:
3104 */
3105 enum nvme_id_uuid {
3106 NVME_ID_UUID_HDR_ASSOCIATION_MASK = 0x3,
3107 NVME_ID_UUID_ASSOCIATION_NONE = 0,
3108 NVME_ID_UUID_ASSOCIATION_VENDOR = 1,
3109 NVME_ID_UUID_ASSOCIATION_SUBSYSTEM_VENDOR = 2,
3110 };
3111
3112 /**
3113 * struct nvme_id_uuid_list - UUID list
3114 * @rsvd0: reserved
3115 * @entry: UUID list entry
3116 */
3117 struct nvme_id_uuid_list {
3118 __u8 rsvd0[32];
3119 struct nvme_id_uuid_list_entry entry[NVME_ID_UUID_LIST_MAX];
3120 };
3121
3122 /**
3123 * struct nvme_ctrl_list - Controller List
3124 * @num: Number of Identifiers
3125 * @identifier: NVM subsystem unique controller identifier
3126 */
3127 struct nvme_ctrl_list {
3128 __le16 num;
3129 __le16 identifier[NVME_ID_CTRL_LIST_MAX];
3130 };
3131
3132 /**
3133 * struct nvme_ns_list - Namespace List
3134 * @ns: Namespace Identifier
3135 */
3136 struct nvme_ns_list {
3137 __le32 ns[NVME_ID_NS_LIST_MAX];
3138 };
3139
3140 /**
3141 * enum nvme_id_ctrl_nvm_lbamqf - LBA Migration Queue Format
3142 * @NVME_ID_CTRL_NVM_LBAMQF_TYPE_0:
3143 * @NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MIN:
3144 * @NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MAX:
3145 */
3146 enum nvme_id_ctrl_nvm_lbamqf {
3147 NVME_ID_CTRL_NVM_LBAMQF_TYPE_0 = 0x0,
3148 NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MIN = 0xc0,
3149 NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MAX = 0xff,
3150 };
3151
3152 /**
3153 * struct nvme_id_ctrl_nvm - I/O Command Set Specific Identify Controller data structure
3154 * @vsl: Verify Size Limit
3155 * @wzsl: Write Zeroes Size Limit
3156 * @wusl: Write Uncorrectable Size Limit
3157 * @dmrl: Dataset Management Ranges Limit
3158 * @dmrsl: Dataset Management Range Size Limit
3159 * @dmsl: Dataset Management Size Limit
3160 * @kpiocap: Key Per I/O Capabilities
3161 * @wzdsl: Write Zeroes With Deallocate Size Limit
3162 * @aocs: Admin Optional Command Support
3163 * @ver: Version
3164 * @lbamqf: LBA Migration Queue Format
3165 * @rsvd25: Reserved
3166 */
3167 struct nvme_id_ctrl_nvm {
3168 __u8 vsl;
3169 __u8 wzsl;
3170 __u8 wusl;
3171 __u8 dmrl;
3172 __le32 dmrsl;
3173 __le64 dmsl;
3174 __u8 kpiocap;
3175 __u8 wzdsl;
3176 __le16 aocs;
3177 __le32 ver;
3178 __u8 lbamqf;
3179 __u8 rsvd25[4071];
3180 };
3181
3182 /**
3183 * struct nvme_nvm_id_ns - NVME Command Set I/O Command Set Specific Identify Namespace Data Structure
3184 * @lbstm: Logical Block Storage Tag Mask
3185 * @pic: Protection Information Capabilities
3186 * @pifa: Protection Information Format Attribute
3187 * @rsvd10: Reserved
3188 * @elbaf: List of Extended LBA Format Support
3189 * @npdgl: Namespace Preferred Deallocate Granularity Large
3190 * @nprg: Namespace Preferred Read Granularity
3191 * @npra: Namespace Preferred Read Alignment
3192 * @nors: Namespace Optimal Read Size
3193 * @npdal: Namespace Preferred Deallocate Alignment Large
3194 * @lbapss: LBA Format Placement Shard Size
3195 * @tlbaag: Tracked LBA Allocation Granularity
3196 * @rsvd296: Reserved
3197 */
3198 struct nvme_nvm_id_ns {
3199 __le64 lbstm;
3200 __u8 pic;
3201 __u8 pifa;
3202 __u8 rsvd10[2];
3203 __le32 elbaf[64];
3204 __le32 npdgl;
3205 __le32 nprg;
3206 __le32 npra;
3207 __le32 nors;
3208 __le32 npdal;
3209 __le32 lbapss;
3210 __le32 tlbaag;
3211 __u8 rsvd296[3800];
3212 };
3213
3214 /**
3215 * struct nvme_zns_lbafe - LBA Format Extension Data Structure
3216 * @zsze: Zone Size
3217 * @zdes: Zone Descriptor Extension Size
3218 * @rsvd9: reserved
3219 */
3220 struct nvme_zns_lbafe {
3221 __le64 zsze;
3222 __u8 zdes;
3223 __u8 rsvd9[7];
3224 };
3225
3226 /**
3227 * struct nvme_zns_id_ns - Zoned Namespace Command Set Specific Identify Namespace Data Structure
3228 * @zoc: Zone Operation Characteristics
3229 * @ozcs: Optional Zoned Command Support
3230 * @mar: Maximum Active Resources
3231 * @mor: Maximum Open Resources
3232 * @rrl: Reset Recommended Limit
3233 * @frl: Finish Recommended Limit
3234 * @rrl1: Reset Recommended Limit 1
3235 * @rrl2: Reset Recommended Limit 2
3236 * @rrl3: Reset Recommended Limit 3
3237 * @frl1: Finish Recommended Limit 1
3238 * @frl2: Finish Recommended Limit 2
3239 * @frl3: Finish Recommended Limit 3
3240 * @numzrwa: Number of ZRWA Resources
3241 * @zrwafg: ZRWA Flush Granularity
3242 * @zrwasz: ZRWA Size
3243 * @zrwacap: ZRWA Capability
3244 * @rsvd53: Reserved
3245 * @lbafe: LBA Format Extension
3246 * @vs: Vendor Specific
3247 */
3248 struct nvme_zns_id_ns {
3249 __le16 zoc;
3250 __le16 ozcs;
3251 __le32 mar;
3252 __le32 mor;
3253 __le32 rrl;
3254 __le32 frl;
3255 __le32 rrl1;
3256 __le32 rrl2;
3257 __le32 rrl3;
3258 __le32 frl1;
3259 __le32 frl2;
3260 __le32 frl3;
3261 __le32 numzrwa;
3262 __le16 zrwafg;
3263 __le16 zrwasz;
3264 __u8 zrwacap;
3265 __u8 rsvd53[2763];
3266 struct nvme_zns_lbafe lbafe[64];
3267 __u8 vs[256];
3268 };
3269
3270 /**
3271 * struct nvme_zns_id_ctrl - I/O Command Set Specific Identify Controller Data Structure for the Zoned Namespace Command Set
3272 * @zasl: Zone Append Size Limit
3273 * @rsvd1: Reserved
3274 */
3275 struct nvme_zns_id_ctrl {
3276 __u8 zasl;
3277 __u8 rsvd1[4095];
3278 };
3279
3280 /**
3281 * struct nvme_primary_ctrl_cap - Identify - Controller Capabilities Structure
3282 * @cntlid: Controller Identifier
3283 * @portid: Port Identifier
3284 * @crt: Controller Resource Types
3285 * @rsvd5: reserved
3286 * @vqfrt: VQ Resources Flexible Total
3287 * @vqrfa: VQ Resources Flexible Assigned
3288 * @vqrfap: VQ Resources Flexible Allocated to Primary
3289 * @vqprt: VQ Resources Private Total
3290 * @vqfrsm: VQ Resources Flexible Secondary Maximum
3291 * @vqgran: VQ Flexible Resource Preferred Granularity
3292 * @rsvd48: reserved
3293 * @vifrt: VI Resources Flexible Total
3294 * @virfa: VI Resources Flexible Assigned
3295 * @virfap: VI Resources Flexible Allocated to Primary
3296 * @viprt: VI Resources Private Total
3297 * @vifrsm: VI Resources Flexible Secondary Maximum
3298 * @vigran: VI Flexible Resource Preferred Granularity
3299 * @rsvd80: reserved
3300 */
3301 struct nvme_primary_ctrl_cap {
3302 __le16 cntlid;
3303 __le16 portid;
3304 __u8 crt;
3305 __u8 rsvd5[27];
3306 __le32 vqfrt;
3307 __le32 vqrfa;
3308 __le16 vqrfap;
3309 __le16 vqprt;
3310 __le16 vqfrsm;
3311 __le16 vqgran;
3312 __u8 rsvd48[16];
3313 __le32 vifrt;
3314 __le32 virfa;
3315 __le16 virfap;
3316 __le16 viprt;
3317 __le16 vifrsm;
3318 __le16 vigran;
3319 __u8 rsvd80[4016];
3320 };
3321
3322 /**
3323 * struct nvme_secondary_ctrl - Secondary Controller Entry
3324 * @scid: Secondary Controller Identifier
3325 * @pcid: Primary Controller Identifier
3326 * @scs: Secondary Controller State
3327 * @rsvd5: Reserved
3328 * @vfn: Virtual Function Number
3329 * @nvq: Number of VQ Flexible Resources Assigned
3330 * @nvi: Number of VI Flexible Resources Assigned
3331 * @rsvd14: Reserved
3332 */
3333 struct nvme_secondary_ctrl {
3334 __le16 scid;
3335 __le16 pcid;
3336 __u8 scs;
3337 __u8 rsvd5[3];
3338 __le16 vfn;
3339 __le16 nvq;
3340 __le16 nvi;
3341 __u8 rsvd14[18];
3342 };
3343
3344 /**
3345 * struct nvme_secondary_ctrl_list - Secondary Controller List
3346 * @num: Number of Identifiers
3347 * @rsvd: Reserved
3348 * @sc_entry: Secondary Controller Entry
3349 */
3350 struct nvme_secondary_ctrl_list {
3351 __u8 num;
3352 __u8 rsvd[31];
3353 struct nvme_secondary_ctrl sc_entry[NVME_ID_SECONDARY_CTRL_MAX];
3354 };
3355
3356 /**
3357 * struct nvme_id_iocs - NVMe Identify IO Command Set data structure
3358 * @iocsc: List of supported IO Command Set Combination vectors
3359 */
3360 struct nvme_id_iocs {
3361 __le64 iocsc[512];
3362 };
3363
3364 /**
3365 * enum nvme_id_iocs_iocsc - This field indicates the Identify I/O Command Set Data Structure
3366 * @NVME_IOCS_IOCSC_NVMCS_SHIFT: Shift amount to get the value of NVM Command Set
3367 * @NVME_IOCS_IOCSC_NVMCS_MASK: Mask to get the value of NVM Command Set
3368 * @NVME_IOCS_IOCSC_KVCS_SHIFT: Shift amount to get the value of Key Value Command Set
3369 * @NVME_IOCS_IOCSC_KVCS_MASK: Mask to get the value of Key Value Command Set
3370 * @NVME_IOCS_IOCSC_ZNSCS_SHIFT: Shift amount to get the value of Zoned Namespace Command
3371 * Set
3372 * @NVME_IOCS_IOCSC_ZNSCS_MASK: Mask to get the value of Zoned Namespace Command Set
3373 * @NVME_IOCS_IOCSC_SLMCS_SHIFT: Shift amount to get the value of Subsystem Local Memory
3374 * Command Set
3375 * @NVME_IOCS_IOCSC_SLMCS_MASK: Mask to get the value of Subsystem Local Memory Command Set
3376 * @NVME_IOCS_IOCSC_CPNCS_SHIFT: Shift amount to get the value of Computational Programs
3377 * Namespace Command Set
3378 * @NVME_IOCS_IOCSC_CPNCS_MASK: Mask to get the value of Computational Programs Namespace
3379 * Command Set
3380 */
3381 enum nvme_id_iocs_iocsc {
3382 NVME_IOCS_IOCSC_NVMCS_SHIFT = 0,
3383 NVME_IOCS_IOCSC_NVMCS_MASK = 0x1,
3384 NVME_IOCS_IOCSC_KVCS_SHIFT = 1,
3385 NVME_IOCS_IOCSC_KVCS_MASK = 0x1,
3386 NVME_IOCS_IOCSC_ZNSCS_SHIFT = 2,
3387 NVME_IOCS_IOCSC_ZNSCS_MASK = 0x1,
3388 NVME_IOCS_IOCSC_SLMCS_SHIFT = 3,
3389 NVME_IOCS_IOCSC_SLMCS_MASK = 0x1,
3390 NVME_IOCS_IOCSC_CPNCS_SHIFT = 4,
3391 NVME_IOCS_IOCSC_CPNCS_MASK = 0x1,
3392 };
3393
3394 /**
3395 * struct nvme_id_domain_attr - Domain Attributes Entry
3396 * @dom_id: Domain Identifier
3397 * @rsvd2: Reserved
3398 * @dom_cap: Total Domain Capacity
3399 * @unalloc_dom_cap: Unallocated Domain Capacity
3400 * @max_egrp_dom_cap: Max Endurance Group Domain Capacity
3401 * @rsvd64: Reserved
3402 */
3403 struct nvme_id_domain_attr {
3404 __le16 dom_id;
3405 __u8 rsvd2[14];
3406 __u8 dom_cap[16];
3407 __u8 unalloc_dom_cap[16];
3408 __u8 max_egrp_dom_cap[16];
3409 __u8 rsvd64[64];
3410 };
3411
3412 /**
3413 * struct nvme_id_domain_list - Domain List
3414 * @num: Number of domain attributes
3415 * @rsvd: Reserved
3416 * @domain_attr: List of domain attributes
3417 */
3418 struct nvme_id_domain_list {
3419 __u8 num;
3420 __u8 rsvd[127];
3421 struct nvme_id_domain_attr domain_attr[NVME_ID_DOMAIN_LIST_MAX];
3422 };
3423
3424 /**
3425 * struct nvme_id_endurance_group_list - Endurance Group List
3426 * @num: Number of Identifiers
3427 * @identifier: Endurance Group Identifier
3428 */
3429 struct nvme_id_endurance_group_list {
3430 __le16 num;
3431 __le16 identifier[NVME_ID_ENDURANCE_GROUP_LIST_MAX];
3432 };
3433
3434 /**
3435 * struct nvme_supported_log_pages - Supported Log Pages - Log
3436 * @lid_support: Log Page Identifier Supported
3437 *
3438 * Supported Log Pages (Log Identifier 00h)
3439 */
3440 struct nvme_supported_log_pages {
3441 __le32 lid_support[NVME_LOG_SUPPORTED_LOG_PAGES_MAX];
3442 };
3443
3444 /**
3445 * struct nvme_error_log_page - Error Information Log Entry (Log Identifier 01h)
3446 * @error_count: Error Count: a 64-bit incrementing error count,
3447 * indicating a unique identifier for this error. The error
3448 * count starts at %1h, is incremented for each unique error
3449 * log entry, and is retained across power off conditions.
3450 * A value of %0h indicates an invalid entry; this value
3451 * is used when there are lost entries or when there are
3452 * fewer errors than the maximum number of entries the
3453 * controller supports. If the value of this field is
3454 * %FFFFFFFFh, then the field shall be set to 1h when
3455 * incremented (i.e., rolls over to %1h). Prior to NVMe
3456 * 1.4, processing of incrementing beyond %FFFFFFFFh is
3457 * unspecified.
3458 * @sqid: Submission Queue ID: indicates the Submission Queue
3459 * Identifier of the command that the error information is
3460 * associated with. If the error is not specific to
3461 * a particular command, then this field shall be set to
3462 * %FFFFh.
3463 * @cmdid: Command ID: indicates the Command Identifier of the
3464 * command that the error is associated with. If the error
3465 * is not specific to a particular command, then this field
3466 * shall be set to %FFFFh.
3467 * @status_field: Bits 15-1: Status Field: indicates the Status Field for
3468 * the command that completed. If the error is not specific
3469 * to a particular command, then this field reports the most
3470 * applicable status value.
3471 * Bit 0: Phase Tag: may indicate the Phase Tag posted for
3472 * the command.
3473 * @parm_error_location: Parameter Error Location: indicates the byte and bit of
3474 * the command parameter that the error is associated with,
3475 * if applicable. If the parameter spans multiple bytes or
3476 * bits, then the location indicates the first byte and bit
3477 * of the parameter.
3478 * Bits 10-8: Bit in command that contained the error.
3479 * Valid values are 0 to 7.
3480 * Bits 7-0: Byte in command that contained the error.
3481 * Valid values are 0 to 63.
3482 * @lba: LBA: This field indicates the first LBA that experienced
3483 * the error condition, if applicable.
3484 * @nsid: Namespace: This field indicates the NSID of the namespace
3485 * that the error is associated with, if applicable.
3486 * @vs: Vendor Specific Information Available: If there is
3487 * additional vendor specific error information available,
3488 * this field provides the log page identifier associated
3489 * with that page. A value of %0h indicates that no additional
3490 * information is available. Valid values are in the range
3491 * of %80h to %FFh.
3492 * @trtype: Transport Type (TRTYPE): indicates the Transport Type of
3493 * the transport associated with the error. The values in
3494 * this field are the same as the TRTYPE values in the
3495 * Discovery Log Page Entry. If the error is not transport
3496 * related, this field shall be cleared to %0h. If the error
3497 * is transport related, this field shall be set to the type
3498 * of the transport - see &enum nvme_trtype.
3499 * @csi: Command Set Indicator: This field contains command set
3500 * indicator for the command that the error is associated
3501 * with.
3502 * @opcode: Opcode: This field contains opcode for the command that
3503 * the error is associated with.
3504 * @cs: Command Specific Information: This field contains command
3505 * specific information. If used, the command definition
3506 * specifies the information returned.
3507 * @trtype_spec_info: Transport Type Specific Information
3508 * @rsvd: Reserved: [62:42]
3509 * @log_page_version: This field shall be set to 1h. If set, @csi and @opcode
3510 * will have valid values.
3511 */
3512 struct nvme_error_log_page {
3513 __le64 error_count;
3514 __le16 sqid;
3515 __le16 cmdid;
3516 __le16 status_field;
3517 __le16 parm_error_location;
3518 __le64 lba;
3519 __le32 nsid;
3520 __u8 vs;
3521 __u8 trtype;
3522 __u8 csi;
3523 __u8 opcode;
3524 __le64 cs;
3525 __le16 trtype_spec_info;
3526 __u8 rsvd[21];
3527 __u8 log_page_version;
3528 };
3529
3530 enum nvme_err_pel {
3531 NVME_ERR_PEL_BYTE_MASK = 0xf,
3532 NVME_ERR_PEL_BIT_MASK = 0x70,
3533 };
3534
3535 /**
3536 * enum nvme_err_status_field - This field indicates the error information log entry status field
3537 * @NVME_ERR_SF_PHASE_TAG_SHIFT: Shift amount to get the phase tag
3538 * @NVME_ERR_SF_STATUS_FIELD_SHIFT: Shift amount to get the status field
3539 * @NVME_ERR_SF_PHASE_TAG_MASK: Mask to get the phase tag
3540 * @NVME_ERR_SF_STATUS_FIELD_MASK: Mask to get the status field
3541 */
3542 enum nvme_err_status_field {
3543 NVME_ERR_SF_PHASE_TAG_SHIFT = 0,
3544 NVME_ERR_SF_STATUS_FIELD_SHIFT = 1,
3545 NVME_ERR_SF_PHASE_TAG_MASK = 1,
3546 NVME_ERR_SF_STATUS_FIELD_MASK = 0x7fff,
3547 };
3548
3549 #define NVME_ERR_SF_PHASE_TAG(status_field) NVME_GET(status_field, ERR_SF_PHASE_TAG)
3550 #define NVME_ERR_SF_STATUS_FIELD(status_field) NVME_GET(status_field, ERR_SF_STATUS_FIELD)
3551
3552 /**
3553 * struct nvme_smart_log - SMART / Health Information Log (Log Identifier 02h)
3554 * @critical_warning: This field indicates critical warnings for the state
3555 * of the controller. Critical warnings may result in an
3556 * asynchronous event notification to the host. Bits in
3557 * this field represent the current associated state and
3558 * are not persistent (see &enum nvme_smart_crit).
3559 * @temperature: Composite Temperature: Contains a value corresponding
3560 * to a temperature in Kelvins that represents the current
3561 * composite temperature of the controller and namespace(s)
3562 * associated with that controller. The manner in which
3563 * this value is computed is implementation specific and
3564 * may not represent the actual temperature of any physical
3565 * point in the NVM subsystem. Warning and critical
3566 * overheating composite temperature threshold values are
3567 * reported by the WCTEMP and CCTEMP fields in the Identify
3568 * Controller data structure.
3569 * @avail_spare: Available Spare: Contains a normalized percentage (0%
3570 * to 100%) of the remaining spare capacity available.
3571 * @spare_thresh: Available Spare Threshold: When the Available Spare
3572 * falls below the threshold indicated in this field, an
3573 * asynchronous event completion may occur. The value is
3574 * indicated as a normalized percentage (0% to 100%).
3575 * The values 101 to 255 are reserved.
3576 * @percent_used: Percentage Used: Contains a vendor specific estimate
3577 * of the percentage of NVM subsystem life used based on
3578 * the actual usage and the manufacturer's prediction of
3579 * NVM life. A value of 100 indicates that the estimated
3580 * endurance of the NVM in the NVM subsystem has been
3581 * consumed, but may not indicate an NVM subsystem failure.
3582 * The value is allowed to exceed 100. Percentages greater
3583 * than 254 shall be represented as 255. This value shall
3584 * be updated once per power-on hour (when the controller
3585 * is not in a sleep state).
3586 * @endu_grp_crit_warn_sumry: Endurance Group Critical Warning Summary: This field
3587 * indicates critical warnings for the state of Endurance
3588 * Groups. Bits in this field represent the current associated
3589 * state and are not persistent (see &enum nvme_smart_egcw).
3590 * @rsvd7: Reserved
3591 * @data_units_read: Data Units Read: Contains the number of 512 byte data
3592 * units the host has read from the controller; this value
3593 * does not include metadata. This value is reported in
3594 * thousands (i.e., a value of 1 corresponds to 1000
3595 * units of 512 bytes read) and is rounded up (e.g., one
3596 * indicates the that number of 512 byte data units read
3597 * is from 1 to 1000, three indicates that the number of
3598 * 512 byte data units read is from 2001 to 3000). When
3599 * the LBA size is a value other than 512 bytes, the
3600 * controller shall convert the amount of data read to
3601 * 512 byte units. For the NVM command set, logical blocks
3602 * read as part of Compare, Read, and Verify operations
3603 * shall be included in this value. A value of %0h in
3604 * this field indicates that the number of Data Units Read
3605 * is not reported.
3606 * @data_units_written: Data Units Written: Contains the number of 512 byte
3607 * data units the host has written to the controller;
3608 * this value does not include metadata. This value is
3609 * reported in thousands (i.e., a value of 1 corresponds
3610 * to 1000 units of 512 bytes written) and is rounded up
3611 * (e.g., one indicates that the number of 512 byte data
3612 * units written is from 1 to 1,000, three indicates that
3613 * the number of 512 byte data units written is from 2001
3614 * to 3000). When the LBA size is a value other than 512
3615 * bytes, the controller shall convert the amount of data
3616 * written to 512 byte units. For the NVM command set,
3617 * logical blocks written as part of Write operations shall
3618 * be included in this value. Write Uncorrectable commands
3619 * and Write Zeroes commands shall not impact this value.
3620 * A value of %0h in this field indicates that the number
3621 * of Data Units Written is not reported.
3622 * @host_reads: Host Read Commands: Contains the number of read commands
3623 * completed by the controller. For the NVM command set,
3624 * this value is the sum of the number of Compare commands
3625 * and the number of Read commands.
3626 * @host_writes: Host Write Commands: Contains the number of write
3627 * commands completed by the controller. For the NVM
3628 * command set, this is the number of Write commands.
3629 * @ctrl_busy_time: Controller Busy Time: Contains the amount of time the
3630 * controller is busy with I/O commands. The controller
3631 * is busy when there is a command outstanding to an I/O
3632 * Queue (specifically, a command was issued via an I/O
3633 * Submission Queue Tail doorbell write and the corresponding
3634 * completion queue entry has not been posted yet to the
3635 * associated I/O Completion Queue). This value is
3636 * reported in minutes.
3637 * @power_cycles: Power Cycles: Contains the number of power cycles.
3638 * @power_on_hours: Power On Hours: Contains the number of power-on hours.
3639 * This may not include time that the controller was
3640 * powered and in a non-operational power state.
3641 * @unsafe_shutdowns: Unsafe Shutdowns: Contains the number of unsafe
3642 * shutdowns. This count is incremented when a Shutdown
3643 * Notification (CC.SHN) is not received prior to loss of power.
3644 * @media_errors: Media and Data Integrity Errors: Contains the number
3645 * of occurrences where the controller detected an
3646 * unrecovered data integrity error. Errors such as
3647 * uncorrectable ECC, CRC checksum failure, or LBA tag
3648 * mismatch are included in this field. Errors introduced
3649 * as a result of a Write Uncorrectable command may or
3650 * may not be included in this field.
3651 * @num_err_log_entries: Number of Error Information Log Entries: Contains the
3652 * number of Error Information log entries over the life
3653 * of the controller.
3654 * @warning_temp_time: Warning Composite Temperature Time: Contains the amount
3655 * of time in minutes that the controller is operational
3656 * and the Composite Temperature is greater than or equal
3657 * to the Warning Composite Temperature Threshold (WCTEMP)
3658 * field and less than the Critical Composite Temperature
3659 * Threshold (CCTEMP) field in the Identify Controller
3660 * data structure. If the value of the WCTEMP or CCTEMP
3661 * field is %0h, then this field is always cleared to %0h
3662 * regardless of the Composite Temperature value.
3663 * @critical_comp_time: Critical Composite Temperature Time: Contains the amount
3664 * of time in minutes that the controller is operational
3665 * and the Composite Temperature is greater than or equal
3666 * to the Critical Composite Temperature Threshold (CCTEMP)
3667 * field in the Identify Controller data structure. If
3668 * the value of the CCTEMP field is %0h, then this field
3669 * is always cleared to 0h regardless of the Composite
3670 * Temperature value.
3671 * @temp_sensor: Temperature Sensor 1-8: Contains the current temperature
3672 * in degrees Kelvin reported by temperature sensors 1-8.
3673 * The physical point in the NVM subsystem whose temperature
3674 * is reported by the temperature sensor and the temperature
3675 * accuracy is implementation specific. An implementation
3676 * that does not implement the temperature sensor reports
3677 * a value of %0h.
3678 * @thm_temp1_trans_count: Thermal Management Temperature 1 Transition Count:
3679 * Contains the number of times the controller transitioned
3680 * to lower power active power states or performed vendor
3681 * specific thermal management actions while minimizing
3682 * the impact on performance in order to attempt to reduce
3683 * the Composite Temperature because of the host controlled
3684 * thermal management feature (i.e., the Composite
3685 * Temperature rose above the Thermal Management
3686 * Temperature 1). This counter shall not wrap once the
3687 * value %FFFFFFFFh is reached. A value of %0h, indicates
3688 * that this transition has never occurred or this field
3689 * is not implemented.
3690 * @thm_temp2_trans_count: Thermal Management Temperature 2 Transition Count
3691 * @thm_temp1_total_time: Total Time For Thermal Management Temperature 1:
3692 * Contains the number of seconds that the controller
3693 * had transitioned to lower power active power states or
3694 * performed vendor specific thermal management actions
3695 * while minimizing the impact on performance in order to
3696 * attempt to reduce the Composite Temperature because of
3697 * the host controlled thermal management feature. This
3698 * counter shall not wrap once the value %FFFFFFFFh is
3699 * reached. A value of %0h, indicates that this transition
3700 * has never occurred or this field is not implemented.
3701 * @thm_temp2_total_time: Total Time For Thermal Management Temperature 2
3702 * @rsvd232: Reserved
3703 */
3704 struct nvme_smart_log {
3705 __u8 critical_warning;
3706 __u8 temperature[2];
3707 __u8 avail_spare;
3708 __u8 spare_thresh;
3709 __u8 percent_used;
3710 __u8 endu_grp_crit_warn_sumry;
3711 __u8 rsvd7[25];
3712 __u8 data_units_read[16];
3713 __u8 data_units_written[16];
3714 __u8 host_reads[16];
3715 __u8 host_writes[16];
3716 __u8 ctrl_busy_time[16];
3717 __u8 power_cycles[16];
3718 __u8 power_on_hours[16];
3719 __u8 unsafe_shutdowns[16];
3720 __u8 media_errors[16];
3721 __u8 num_err_log_entries[16];
3722 __le32 warning_temp_time;
3723 __le32 critical_comp_time;
3724 __le16 temp_sensor[8];
3725 __le32 thm_temp1_trans_count;
3726 __le32 thm_temp2_trans_count;
3727 __le32 thm_temp1_total_time;
3728 __le32 thm_temp2_total_time;
3729 __u8 rsvd232[280];
3730 };
3731
3732 /**
3733 * enum nvme_smart_crit - Critical Warning
3734 * @NVME_SMART_CW_ASCBT_SHIFT: Shift amount to get the available spare capacity has fallen
3735 * below the threshold.
3736 * @NVME_SMART_CW_TTC_SHIFT: Shift amount to get the temperature is either greater
3737 * than or equal to an over temperature threshold; or
3738 * less than or equal to an under temperature threshold.
3739 * @NVME_SMART_CW_NDR_SHIFT: Shift amount to get the NVM subsystem reliability has
3740 * been degraded due to significant media related errors
3741 * or any internal error that degrades NVM subsystem
3742 * reliability.
3743 * @NVME_SMART_CW_AMRO_SHIFT: Shift amount to get the all of the media has been placed in read
3744 * only mode. The controller shall not set this bit if
3745 * the read-only condition on the media is a result of
3746 * a change in the write protection state of a namespace.
3747 * @NVME_SMART_CW_VMBF_SHIFT: Shift amount to get the volatile memory backup
3748 * device has failed. This field is only valid if the
3749 * controller has a volatile memory backup solution.
3750 * @NVME_SMART_CW_PMRRO_SHIFT: Shift amount to get the Persistent Memory Region has become
3751 * read-only or unreliable.
3752 * @NVME_SMART_CW_ASCBT_MASK: If set, then the available spare capacity has fallen
3753 * below the threshold.
3754 * @NVME_SMART_CW_TTC_MASK: Mask to get the temperature is either greater
3755 * than or equal to an over temperature threshold; or
3756 * less than or equal to an under temperature threshold.
3757 * @NVME_SMART_CW_NDR_MASK: Mask to get the NVM subsystem reliability has
3758 * been degraded due to significant media related errors
3759 * or any internal error that degrades NVM subsystem
3760 * reliability.
3761 * @NVME_SMART_CW_AMRO_MASK: Mask to get the all of the media has been placed in read
3762 * only mode. The controller shall not set this bit if
3763 * the read-only condition on the media is a result of
3764 * a change in the write protection state of a namespace.
3765 * @NVME_SMART_CW_VMBF_MASK: Mask to get the volatile memory backup
3766 * device has failed. This field is only valid if the
3767 * controller has a volatile memory backup solution.
3768 * @NVME_SMART_CW_PMRRO_MASK: Mask to get the Persistent Memory Region has become
3769 * read-only or unreliable.
3770 * @NVME_SMART_CRIT_SPARE: If set, then the available spare capacity has fallen
3771 * below the threshold.
3772 * @NVME_SMART_CRIT_TEMPERATURE: If set, then a temperature is either greater
3773 * than or equal to an over temperature threshold; or
3774 * less than or equal to an under temperature threshold.
3775 * @NVME_SMART_CRIT_DEGRADED: If set, then the NVM subsystem reliability has
3776 * been degraded due to significant media related errors
3777 * or any internal error that degrades NVM subsystem
3778 * reliability.
3779 * @NVME_SMART_CRIT_MEDIA: If set, then all of the media has been placed in read
3780 * only mode. The controller shall not set this bit if
3781 * the read-only condition on the media is a result of
3782 * a change in the write protection state of a namespace.
3783 * @NVME_SMART_CRIT_VOLATILE_MEMORY: If set, then the volatile memory backup
3784 * device has failed. This field is only valid if the
3785 * controller has a volatile memory backup solution.
3786 * @NVME_SMART_CRIT_PMR_RO: If set, then the Persistent Memory Region has become
3787 * read-only or unreliable.
3788 */
3789 enum nvme_smart_crit {
3790 NVME_SMART_CW_ASCBT_SHIFT = 0,
3791 NVME_SMART_CW_TTC_SHIFT = 1,
3792 NVME_SMART_CW_NDR_SHIFT = 2,
3793 NVME_SMART_CW_AMRO_SHIFT = 3,
3794 NVME_SMART_CW_VMBF_SHIFT = 4,
3795 NVME_SMART_CW_PMRRO_SHIFT = 5,
3796 NVME_SMART_CW_ASCBT_MASK = 0x1,
3797 NVME_SMART_CW_TTC_MASK = 0x1,
3798 NVME_SMART_CW_NDR_MASK = 0x1,
3799 NVME_SMART_CW_AMRO_MASK = 0x1,
3800 NVME_SMART_CW_VMBF_MASK = 0x1,
3801 NVME_SMART_CW_PMRRO_MASK = 0x1,
3802 NVME_SMART_CRIT_SPARE = NVME_VAL(SMART_CW_ASCBT),
3803 NVME_SMART_CRIT_TEMPERATURE = NVME_VAL(SMART_CW_TTC),
3804 NVME_SMART_CRIT_DEGRADED = NVME_VAL(SMART_CW_NDR),
3805 NVME_SMART_CRIT_MEDIA = NVME_VAL(SMART_CW_AMRO),
3806 NVME_SMART_CRIT_VOLATILE_MEMORY = NVME_VAL(SMART_CW_VMBF),
3807 NVME_SMART_CRIT_PMR_RO = NVME_VAL(SMART_CW_PMRRO),
3808 };
3809
3810 #define NVME_SMART_CW_ASCBT(cw) NVME_GET(cw, SMART_CW_ASCBT),
3811 #define NVME_SMART_CW_TTC(cw) NVME_GET(cw, SMART_CW_TTC),
3812 #define NVME_SMART_CW_NDR(cw) NVME_GET(cw, SMART_CW_NDR),
3813 #define NVME_SMART_CW_AMRO(cw) NVME_GET(cw, SMART_CW_AMRO),
3814 #define NVME_SMART_CW_VMBF(cw) NVME_GET(cw, SMART_CW_VMBF),
3815 #define NVME_SMART_CW_PMRRO(cw) NVME_GET(cw, SMART_CW_PMRRO),
3816
3817 /**
3818 * enum nvme_smart_egcw - Endurance Group Critical Warning Summary
3819 * @NVME_SMART_EGCW_SPARE: If set, then the available spare capacity of one or
3820 * more Endurance Groups has fallen below the threshold.
3821 * @NVME_SMART_EGCW_DEGRADED: If set, then the reliability of one or more
3822 * Endurance Groups has been degraded due to significant
3823 * media related errors or any internal error that
3824 * degrades NVM subsystem reliability.
3825 * @NVME_SMART_EGCW_RO: If set, then the namespaces in one or more Endurance
3826 * Groups have been placed in read only mode not as
3827 * a result of a change in the write protection state
3828 * of a namespace.
3829 */
3830 enum nvme_smart_egcw {
3831 NVME_SMART_EGCW_SPARE = 1 << 0,
3832 NVME_SMART_EGCW_DEGRADED = 1 << 2,
3833 NVME_SMART_EGCW_RO = 1 << 3,
3834 };
3835
3836 /**
3837 * struct nvme_firmware_slot - Firmware Slot Information Log
3838 * @afi: Active Firmware Info
3839 * @rsvd1: Reserved
3840 * @frs: Firmware Revision for Slot
3841 * @rsvd2: Reserved
3842 */
3843 struct nvme_firmware_slot {
3844 __u8 afi;
3845 __u8 rsvd1[7];
3846 char frs[7][8];
3847 __u8 rsvd2[448];
3848 };
3849
3850 /**
3851 * struct nvme_cmd_effects_log - Commands Supported and Effects Log
3852 * @acs: Admin Command Supported
3853 * @iocs: I/O Command Supported
3854 * @rsvd: Reserved
3855 */
3856 struct nvme_cmd_effects_log {
3857 __le32 acs[256];
3858 __le32 iocs[256];
3859 __u8 rsvd[2048];
3860 };
3861
3862 /**
3863 * enum nvme_cmd_effects - Commands Supported and Effects
3864 * @NVME_CMD_EFFECTS_CSUPP: Command Supported
3865 * @NVME_CMD_EFFECTS_LBCC: Logical Block Content Change
3866 * @NVME_CMD_EFFECTS_NCC: Namespace Capability Change
3867 * @NVME_CMD_EFFECTS_NIC: Namespace Inventory Change
3868 * @NVME_CMD_EFFECTS_CCC: Controller Capability Change
3869 * @NVME_CMD_EFFECTS_CSER_MASK: Command Submission and Execution Relaxations
3870 * @NVME_CMD_EFFECTS_CSE_MASK: Command Submission and Execution
3871 * @NVME_CMD_EFFECTS_UUID_SEL: UUID Selection Supported
3872 */
3873 enum nvme_cmd_effects {
3874 NVME_CMD_EFFECTS_CSUPP = 1 << 0,
3875 NVME_CMD_EFFECTS_LBCC = 1 << 1,
3876 NVME_CMD_EFFECTS_NCC = 1 << 2,
3877 NVME_CMD_EFFECTS_NIC = 1 << 3,
3878 NVME_CMD_EFFECTS_CCC = 1 << 4,
3879 NVME_CMD_EFFECTS_CSER_MASK = 3 << 14,
3880 NVME_CMD_EFFECTS_CSE_MASK = 7 << 16,
3881 NVME_CMD_EFFECTS_UUID_SEL = 1 << 19,
3882 };
3883
3884 /**
3885 * struct nvme_st_result - Self-test Result
3886 * @dsts: Device Self-test Status: Indicates the device self-test code and the
3887 * status of the operation (see &enum nvme_status_result and &enum nvme_st_code).
3888 * @seg: Segment Number: Iindicates the segment number where the first self-test
3889 * failure occurred. If Device Self-test Status (@dsts) is not set to
3890 * #NVME_ST_RESULT_KNOWN_SEG_FAIL, then this field should be ignored.
3891 * @vdi: Valid Diagnostic Information: Indicates the diagnostic failure
3892 * information that is reported. See &enum nvme_st_valid_diag_info.
3893 * @rsvd: Reserved
3894 * @poh: Power On Hours (POH): Indicates the number of power-on hours at the
3895 * time the device self-test operation was completed or aborted. This
3896 * does not include time that the controller was powered and in a low
3897 * power state condition.
3898 * @nsid: Namespace Identifier (NSID): Indicates the namespace that the Failing
3899 * LBA occurred on. Valid only when the NSID Valid bit
3900 * (#NVME_ST_VALID_DIAG_INFO_NSID) is set in the Valid Diagnostic
3901 * Information (@vdi) field.
3902 * @flba: Failing LBA: indicates the LBA of the logical block that caused the
3903 * test to fail. If the device encountered more than one failed logical
3904 * block during the test, then this field only indicates one of those
3905 * failed logical blocks. Valid only when the NSID Valid bit
3906 * (#NVME_ST_VALID_DIAG_INFO_FLBA) is set in the Valid Diagnostic
3907 * Information (@vdi) field.
3908 * @sct: Status Code Type: This field may contain additional information related
3909 * to errors or conditions. Bits 2:0 may contain additional information
3910 * relating to errors or conditions that occurred during the device
3911 * self-test operation represented in the same format used in the Status
3912 * Code Type field of the completion queue entry (refer to &enum nvme_status_field).
3913 * Valid only when the NSID Valid bit (#NVME_ST_VALID_DIAG_INFO_SCT) is
3914 * set in the Valid Diagnostic Information (@vdi) field.
3915 * @sc: Status Code: This field may contain additional information relating
3916 * to errors or conditions that occurred during the device self-test
3917 * operation represented in the same format used in the Status Code field
3918 * of the completion queue entry. Valid only when the SCT Valid bit
3919 * (#NVME_ST_VALID_DIAG_INFO_SC) is set in the Valid Diagnostic
3920 * Information (@vdi) field.
3921 * @vs: Vendor Specific.
3922 */
3923 struct nvme_st_result {
3924 __u8 dsts;
3925 __u8 seg;
3926 __u8 vdi;
3927 __u8 rsvd;
3928 __le64 poh;
3929 __le32 nsid;
3930 __le64 flba;
3931 __u8 sct;
3932 __u8 sc;
3933 __u8 vs[2];
3934 } __attribute__((packed));
3935
3936 /**
3937 * enum nvme_status_result - Result of the device self-test operation
3938 * @NVME_ST_RESULT_NO_ERR: Operation completed without error.
3939 * @NVME_ST_RESULT_ABORTED: Operation was aborted by a Device Self-test command.
3940 * @NVME_ST_RESULT_CLR: Operation was aborted by a Controller Level Reset.
3941 * @NVME_ST_RESULT_NS_REMOVED: Operation was aborted due to a removal of
3942 * a namespace from the namespace inventory.
3943 * @NVME_ST_RESULT_ABORTED_FORMAT: Operation was aborted due to the processing
3944 * of a Format NVM command.
3945 * @NVME_ST_RESULT_FATAL_ERR: A fatal error or unknown test error occurred
3946 * while the controller was executing the device
3947 * self-test operation and the operation did
3948 * not complete.
3949 * @NVME_ST_RESULT_UNKNOWN_SEG_FAIL: Operation completed with a segment that failed
3950 * and the segment that failed is not known.
3951 * @NVME_ST_RESULT_KNOWN_SEG_FAIL: Operation completed with one or more failed
3952 * segments and the first segment that failed
3953 * is indicated in the Segment Number field.
3954 * @NVME_ST_RESULT_ABORTED_UNKNOWN: Operation was aborted for unknown reason.
3955 * @NVME_ST_RESULT_ABORTED_SANITIZE: Operation was aborted due to a sanitize operation.
3956 * @NVME_ST_RESULT_NOT_USED: Entry not used (does not contain a test result).
3957 * @NVME_ST_RESULT_MASK: Mask to get the status result value from
3958 * the &struct nvme_st_result.dsts field.
3959 */
3960 enum nvme_status_result {
3961 NVME_ST_RESULT_NO_ERR = 0x0,
3962 NVME_ST_RESULT_ABORTED = 0x1,
3963 NVME_ST_RESULT_CLR = 0x2,
3964 NVME_ST_RESULT_NS_REMOVED = 0x3,
3965 NVME_ST_RESULT_ABORTED_FORMAT = 0x4,
3966 NVME_ST_RESULT_FATAL_ERR = 0x5,
3967 NVME_ST_RESULT_UNKNOWN_SEG_FAIL = 0x6,
3968 NVME_ST_RESULT_KNOWN_SEG_FAIL = 0x7,
3969 NVME_ST_RESULT_ABORTED_UNKNOWN = 0x8,
3970 NVME_ST_RESULT_ABORTED_SANITIZE = 0x9,
3971 NVME_ST_RESULT_NOT_USED = 0xf,
3972 NVME_ST_RESULT_MASK = 0xf,
3973 };
3974
3975 /**
3976 * enum nvme_st_code - Self-test Code value
3977 * @NVME_ST_CODE_RESERVED: Reserved.
3978 * @NVME_ST_CODE_SHORT: Short device self-test operation.
3979 * @NVME_ST_CODE_EXTENDED: Extended device self-test operation.
3980 * @NVME_ST_CODE_HOST_INIT:Host-Initiated Refresh operation.
3981 * @NVME_ST_CODE_VS: Vendor specific.
3982 * @NVME_ST_CODE_ABORT: Abort device self-test operation.
3983 * @NVME_ST_CODE_SHIFT: Shift amount to get the code value from the
3984 * &struct nvme_st_result.dsts field.
3985 */
3986 enum nvme_st_code {
3987 NVME_ST_CODE_RESERVED = 0x0,
3988 NVME_ST_CODE_SHORT = 0x1,
3989 NVME_ST_CODE_EXTENDED = 0x2,
3990 NVME_ST_CODE_HOST_INIT = 0x3,
3991 NVME_ST_CODE_VS = 0xe,
3992 NVME_ST_CODE_ABORT = 0xf,
3993 NVME_ST_CODE_SHIFT = 4,
3994 };
3995
3996 /**
3997 * enum nvme_st_curr_op - Current Device Self-Test Operation
3998 * @NVME_ST_CURR_OP_NOT_RUNNING: No device self-test operation in progress.
3999 * @NVME_ST_CURR_OP_SHORT: Short device self-test operation in progress.
4000 * @NVME_ST_CURR_OP_EXTENDED: Extended device self-test operation in progress.
4001 * @NVME_ST_CURR_OP_VS: Vendor specific.
4002 * @NVME_ST_CURR_OP_RESERVED: Reserved.
4003 * @NVME_ST_CURR_OP_MASK: Mask to get the current operation value from the
4004 * &struct nvme_self_test_log.current_operation field.
4005 * @NVME_ST_CURR_OP_CMPL_MASK: Mask to get the current operation completion value
4006 * from the &struct nvme_self_test_log.completion field.
4007 */
4008 enum nvme_st_curr_op {
4009 NVME_ST_CURR_OP_NOT_RUNNING = 0x0,
4010 NVME_ST_CURR_OP_SHORT = 0x1,
4011 NVME_ST_CURR_OP_EXTENDED = 0x2,
4012 NVME_ST_CURR_OP_VS = 0xe,
4013 NVME_ST_CURR_OP_RESERVED = 0xf,
4014 NVME_ST_CURR_OP_MASK = 0xf,
4015 NVME_ST_CURR_OP_CMPL_MASK = 0x7f,
4016 };
4017
4018 /**
4019 * enum nvme_st_valid_diag_info - Valid Diagnostic Information
4020 * @NVME_ST_VALID_DIAG_INFO_NSID: NSID Valid: if set, then the contents of
4021 * the Namespace Identifier field are valid.
4022 * @NVME_ST_VALID_DIAG_INFO_FLBA: FLBA Valid: if set, then the contents of
4023 * the Failing LBA field are valid.
4024 * @NVME_ST_VALID_DIAG_INFO_SCT: SCT Valid: if set, then the contents of
4025 * the Status Code Type field are valid.
4026 * @NVME_ST_VALID_DIAG_INFO_SC: SC Valid: if set, then the contents of
4027 * the Status Code field are valid.
4028 */
4029 enum nvme_st_valid_diag_info {
4030 NVME_ST_VALID_DIAG_INFO_NSID = 1 << 0,
4031 NVME_ST_VALID_DIAG_INFO_FLBA = 1 << 1,
4032 NVME_ST_VALID_DIAG_INFO_SCT = 1 << 2,
4033 NVME_ST_VALID_DIAG_INFO_SC = 1 << 3,
4034 };
4035
4036 /**
4037 * struct nvme_self_test_log - Device Self-test (Log Identifier 06h)
4038 * @current_operation: Current Device Self-Test Operation: indicates the status
4039 * of the current device self-test operation. If a device
4040 * self-test operation is in process (i.e., this field is set
4041 * to #NVME_ST_CURR_OP_SHORT or #NVME_ST_CURR_OP_EXTENDED),
4042 * then the controller shall not set this field to
4043 * #NVME_ST_CURR_OP_NOT_RUNNING until a new Self-test Result
4044 * Data Structure is created (i.e., if a device self-test
4045 * operation completes or is aborted, then the controller
4046 * shall create a Self-test Result Data Structure prior to
4047 * setting this field to #NVME_ST_CURR_OP_NOT_RUNNING).
4048 * See &enum nvme_st_curr_op.
4049 * @completion: Current Device Self-Test Completion: indicates the percentage
4050 * of the device self-test operation that is complete (e.g.,
4051 * a value of 25 indicates that 25% of the device self-test
4052 * operation is complete and 75% remains to be tested).
4053 * If the @current_operation field is cleared to
4054 * #NVME_ST_CURR_OP_NOT_RUNNING (indicating there is no device
4055 * self-test operation in progress), then this field is ignored.
4056 * @rsvd: Reserved
4057 * @result: Self-test Result Data Structures, see &struct nvme_st_result.
4058 */
4059 struct nvme_self_test_log {
4060 __u8 current_operation;
4061 __u8 completion;
4062 __u8 rsvd[2];
4063 struct nvme_st_result result[NVME_LOG_ST_MAX_RESULTS];
4064 } __attribute__((packed));
4065
4066 /**
4067 * enum nvme_cmd_get_log_telemetry_host_lsp - Telemetry Host-Initiated log specific field
4068 * @NVME_LOG_TELEM_HOST_LSP_RETAIN: Get Telemetry Data Blocks
4069 * @NVME_LOG_TELEM_HOST_LSP_CREATE: Create Telemetry Data Blocks
4070 */
4071 enum nvme_cmd_get_log_telemetry_host_lsp {
4072 NVME_LOG_TELEM_HOST_LSP_RETAIN = 0,
4073 NVME_LOG_TELEM_HOST_LSP_CREATE = 1,
4074 };
4075
4076 /**
4077 * enum nvme_telemetry_da - Telemetry Log Data Area
4078 * @NVME_TELEMETRY_DA_CTRL_DETERMINE: The controller determines the data areas to be created
4079 * @NVME_TELEMETRY_DA_1: Data Area 1
4080 * @NVME_TELEMETRY_DA_2: Data Area 2
4081 * @NVME_TELEMETRY_DA_3: Data Area 3
4082 * @NVME_TELEMETRY_DA_4: Data Area 4
4083 */
4084 enum nvme_telemetry_da {
4085 NVME_TELEMETRY_DA_CTRL_DETERMINE = 0,
4086 NVME_TELEMETRY_DA_1 = 1,
4087 NVME_TELEMETRY_DA_2 = 2,
4088 NVME_TELEMETRY_DA_3 = 3,
4089 NVME_TELEMETRY_DA_4 = 4,
4090 };
4091
4092 /**
4093 * struct nvme_telemetry_log - Retrieve internal data specific to the
4094 * manufacturer.
4095 * @lpi: Log Identifier, either %NVME_LOG_LID_TELEMETRY_HOST or
4096 * %NVME_LOG_LID_TELEMETRY_CTRL
4097 * @rsvd1: Reserved
4098 * @ieee: IEEE OUI Identifier is the Organization Unique Identifier (OUI)
4099 * for the controller vendor that is able to interpret the data.
4100 * @dalb1: Telemetry Host/Controller Initiated Data Area 1 Last Block is
4101 * the value of the last block in this area.
4102 * @dalb2: Telemetry Host/Controller Initiated Data Area 1 Last Block is
4103 * the value of the last block in this area.
4104 * @dalb3: Telemetry Host/ControllerInitiated Data Area 1 Last Block is
4105 * the value of the last block in this area.
4106 * @rsvd14: Reserved
4107 * @dalb4: Telemetry Host/Controller Initiated Data Area 4 Last Block is
4108 * the value of the last block in this area.
4109 * @rsvd20: Reserved
4110 * @ths: Telemetry Host-Initiated Scope
4111 * @hostdgn: Telemetry Host-Initiated Data Generation Number is a
4112 * value that is incremented each time the host initiates a
4113 * capture of its internal controller state in the controller.
4114 * @tcs: Telemetry Controller-Initiated Scope
4115 * @ctrlavail: Telemetry Controller-Initiated Data Available, if cleared,
4116 * then the controller telemetry log does not contain saved
4117 * internal controller state. If this field is set to 1h, the
4118 * controller log contains saved internal controller state. If
4119 * this field is set to 1h, the data will be latched until the
4120 * host releases it by reading the log with RAE cleared.
4121 * @ctrldgn: Telemetry Controller-Initiated Data Generation Number is
4122 * a value that is incremented each time the controller initiates a
4123 * capture of its internal controller state in the controller .
4124 * @rsnident: Reason Identifiers a vendor specific identifier that describes
4125 * the operating conditions of the controller at the time of
4126 * capture.
4127 * @data_area: Telemetry data blocks, vendor specific information data.
4128 *
4129 * This log consists of a header describing the log and zero or more Telemetry
4130 * Data Blocks. All Telemetry Data Blocks are %NVME_LOG_TELEM_BLOCK_SIZE, 512
4131 * bytes, in size. This log captures the controller’s internal state.
4132 */
4133 struct nvme_telemetry_log {
4134 __u8 lpi;
4135 __u8 rsvd1[4];
4136 __u8 ieee[3];
4137 __le16 dalb1;
4138 __le16 dalb2;
4139 __le16 dalb3;
4140 __u8 rsvd14[2];
4141 __le32 dalb4;
4142 __u8 rsvd20[360];
4143 __u8 ths;
4144 union { // [381]
4145 __u8 hostdgn;
4146 __u8 tcs;
4147 };
4148 __u8 ctrlavail;
4149 __u8 ctrldgn;
4150 __u8 rsnident[128];
4151 __u8 data_area[];
4152 };
4153
4154 /**
4155 * struct nvme_endurance_group_log - Endurance Group Information Log
4156 * @critical_warning: Critical Warning
4157 * @endurance_group_features: Endurance Group Features
4158 * @rsvd2: Reserved
4159 * @avl_spare: Available Spare
4160 * @avl_spare_threshold: Available Spare Threshold
4161 * @percent_used: Percentage Used
4162 * @domain_identifier: Domain Identifier
4163 * @rsvd8: Reserved
4164 * @endurance_estimate: Endurance Estimate
4165 * @data_units_read: Data Units Read
4166 * @data_units_written: Data Units Written
4167 * @media_units_written: Media Units Written
4168 * @host_read_cmds: Host Read Commands
4169 * @host_write_cmds: Host Write Commands
4170 * @media_data_integrity_err: Media and Data Integrity Errors
4171 * @num_err_info_log_entries: Number of Error Information Log Entries
4172 * @total_end_grp_cap: Total Endurance Group Capacity
4173 * @unalloc_end_grp_cap: Unallocated Endurance Group Capacity
4174 * @rsvd192: Reserved
4175 */
4176 struct nvme_endurance_group_log {
4177 __u8 critical_warning;
4178 __u8 endurance_group_features;
4179 __u8 rsvd2;
4180 __u8 avl_spare;
4181 __u8 avl_spare_threshold;
4182 __u8 percent_used;
4183 __le16 domain_identifier;
4184 __u8 rsvd8[24];
4185 __u8 endurance_estimate[16];
4186 __u8 data_units_read[16];
4187 __u8 data_units_written[16];
4188 __u8 media_units_written[16];
4189 __u8 host_read_cmds[16];
4190 __u8 host_write_cmds[16];
4191 __u8 media_data_integrity_err[16];
4192 __u8 num_err_info_log_entries[16];
4193 __u8 total_end_grp_cap[16];
4194 __u8 unalloc_end_grp_cap[16];
4195 __u8 rsvd192[320];
4196 };
4197
4198 /**
4199 * enum nvme_eg_critical_warning_flags - Endurance Group Information Log - Critical Warning
4200 * @NVME_EG_CRITICAL_WARNING_SPARE: Available spare capacity of the Endurance Group
4201 * has fallen below the threshold
4202 * @NVME_EG_CRITICAL_WARNING_DEGRADED: Endurance Group reliability has been degraded
4203 * @NVME_EG_CRITICAL_WARNING_READ_ONLY: Endurance Group have been placed in read only
4204 * mode
4205 */
4206 enum nvme_eg_critical_warning_flags {
4207 NVME_EG_CRITICAL_WARNING_SPARE = 1 << 0,
4208 NVME_EG_CRITICAL_WARNING_DEGRADED = 1 << 2,
4209 NVME_EG_CRITICAL_WARNING_READ_ONLY = 1 << 3,
4210 };
4211
4212 /**
4213 * struct nvme_aggregate_endurance_group_event - Endurance Group Event Aggregate
4214 * @num_entries: Number or entries
4215 * @entries: List of entries
4216 */
4217 struct nvme_aggregate_endurance_group_event {
4218 __le64 num_entries;
4219 __le16 entries[];
4220 };
4221
4222 /**
4223 * struct nvme_nvmset_predictable_lat_log - Predictable Latency Mode - Deterministic Threshold Configuration Data
4224 * @status: Status
4225 * @rsvd1: Reserved
4226 * @event_type: Event Type
4227 * @rsvd4: Reserved
4228 * @dtwin_rt: DTWIN Reads Typical
4229 * @dtwin_wt: DTWIN Writes Typical
4230 * @dtwin_tmax: DTWIN Time Maximum
4231 * @ndwin_tmin_hi: NDWIN Time Minimum High
4232 * @ndwin_tmin_lo: NDWIN Time Minimum Low
4233 * @rsvd72: Reserved
4234 * @dtwin_re: DTWIN Reads Estimate
4235 * @dtwin_we: DTWIN Writes Estimate
4236 * @dtwin_te: DTWIN Time Estimate
4237 * @rsvd152: Reserved
4238 */
4239 struct nvme_nvmset_predictable_lat_log {
4240 __u8 status;
4241 __u8 rsvd1;
4242 __le16 event_type;
4243 __u8 rsvd4[28];
4244 __le64 dtwin_rt;
4245 __le64 dtwin_wt;
4246 __le64 dtwin_tmax;
4247 __le64 ndwin_tmin_hi;
4248 __le64 ndwin_tmin_lo;
4249 __u8 rsvd72[56];
4250 __le64 dtwin_re;
4251 __le64 dtwin_we;
4252 __le64 dtwin_te;
4253 __u8 rsvd152[360];
4254 };
4255
4256 /**
4257 * enum nvme_nvmeset_pl_status - Predictable Latency Per NVM Set Log - Status
4258 * @NVME_NVMSET_PL_STATUS_DISABLED: Not used (Predictable Latency Mode not enabled)
4259 * @NVME_NVMSET_PL_STATUS_DTWIN: Deterministic Window (DTWIN)
4260 * @NVME_NVMSET_PL_STATUS_NDWIN: Non-Deterministic Window (NDWIN)
4261 */
4262 enum nvme_nvmeset_pl_status {
4263 NVME_NVMSET_PL_STATUS_DISABLED = 0,
4264 NVME_NVMSET_PL_STATUS_DTWIN = 1,
4265 NVME_NVMSET_PL_STATUS_NDWIN = 2,
4266 };
4267
4268 /**
4269 * enum nvme_nvmset_pl_events - Predictable Latency Per NVM Set Log - Event Type
4270 * @NVME_NVMSET_PL_EVENT_DTWIN_READ_WARN: DTWIN Reads Warning
4271 * @NVME_NVMSET_PL_EVENT_DTWIN_WRITE_WARN: DTWIN Writes Warning
4272 * @NVME_NVMSET_PL_EVENT_DTWIN_TIME_WARN: DTWIN Time Warning
4273 * @NVME_NVMSET_PL_EVENT_DTWIN_EXCEEDED: Autonomous transition from DTWIN
4274 * to NDWIN due to typical or
4275 * maximum value exceeded
4276 * @NVME_NVMSET_PL_EVENT_DTWIN_EXCURSION: Autonomous transition from DTWIN
4277 * to NDWIN due to Deterministic
4278 * Excursion
4279 */
4280 enum nvme_nvmset_pl_events {
4281 NVME_NVMSET_PL_EVENT_DTWIN_READ_WARN = 1 << 0,
4282 NVME_NVMSET_PL_EVENT_DTWIN_WRITE_WARN = 1 << 1,
4283 NVME_NVMSET_PL_EVENT_DTWIN_TIME_WARN = 1 << 2,
4284 NVME_NVMSET_PL_EVENT_DTWIN_EXCEEDED = 1 << 14,
4285 NVME_NVMSET_PL_EVENT_DTWIN_EXCURSION = 1 << 15,
4286 };
4287
4288 /**
4289 * struct nvme_aggregate_predictable_lat_event - Predictable Latency Event Aggregate Log Page
4290 * @num_entries: Number of entries
4291 * @entries: Entry list
4292 */
4293 struct nvme_aggregate_predictable_lat_event {
4294 __le64 num_entries;
4295 __le16 entries[];
4296 };
4297
4298 /**
4299 * struct nvme_ana_group_desc - ANA Group Descriptor
4300 * @grpid: ANA group id
4301 * @nnsids: Number of namespaces in @nsids
4302 * @chgcnt: Change counter
4303 * @state: ANA state
4304 * @rsvd17: Reserved
4305 * @nsids: List of namespaces
4306 */
4307 struct nvme_ana_group_desc {
4308 __le32 grpid;
4309 __le32 nnsids;
4310 __le64 chgcnt;
4311 __u8 state;
4312 __u8 rsvd17[15];
4313 __le32 nsids[];
4314 };
4315
4316 /**
4317 * enum nvme_ana_state - ANA Group Descriptor - Asymmetric Namespace Access State
4318 * @NVME_ANA_STATE_OPTIMIZED: ANA Optimized state
4319 * @NVME_ANA_STATE_NONOPTIMIZED: ANA Non-Optimized state
4320 * @NVME_ANA_STATE_INACCESSIBLE: ANA Inaccessible state
4321 * @NVME_ANA_STATE_PERSISTENT_LOSS: ANA Persistent Loss state
4322 * @NVME_ANA_STATE_CHANGE: ANA Change state
4323 */
4324 enum nvme_ana_state {
4325 NVME_ANA_STATE_OPTIMIZED = 0x1,
4326 NVME_ANA_STATE_NONOPTIMIZED = 0x2,
4327 NVME_ANA_STATE_INACCESSIBLE = 0x3,
4328 NVME_ANA_STATE_PERSISTENT_LOSS = 0x4,
4329 NVME_ANA_STATE_CHANGE = 0xf,
4330 };
4331
4332 /**
4333 * struct nvme_ana_log - Asymmetric Namespace Access Log
4334 * @chgcnt: Change Count
4335 * @ngrps: Number of ANA Group Descriptors
4336 * @rsvd10: Reserved
4337 * @descs: ANA Group Descriptor
4338 */
4339 struct nvme_ana_log {
4340 __le64 chgcnt;
4341 __le16 ngrps;
4342 __u8 rsvd10[6];
4343 struct nvme_ana_group_desc descs[];
4344 };
4345
4346 /**
4347 * struct nvme_persistent_event_log - Persistent Event Log
4348 * @lid: Log Identifier
4349 * @rsvd1: Reserved
4350 * @tnev: Total Number of Events
4351 * @tll: Total Log Length
4352 * @rv: Log Revision
4353 * @rsvd17: Reserved
4354 * @lhl: Log Header Length
4355 * @ts: Timestamp
4356 * @poh: Power on Hours
4357 * @pcc: Power Cycle Count
4358 * @vid: PCI Vendor ID
4359 * @ssvid: PCI Subsystem Vendor ID
4360 * @sn: Serial Number
4361 * @mn: Model Number
4362 * @subnqn: NVM Subsystem NVMe Qualified Name
4363 * @gen_number: Generation Number
4364 * @rci: Reporting Context Information
4365 * @rsvd378: Reserved
4366 * @seb: Supported Events Bitmap
4367 */
4368 struct nvme_persistent_event_log {
4369 __u8 lid;
4370 __u8 rsvd1[3];
4371 __le32 tnev;
4372 __le64 tll;
4373 __u8 rv;
4374 __u8 rsvd17;
4375 __le16 lhl;
4376 __le64 ts;
4377 __u8 poh[16];
4378 __le64 pcc;
4379 __le16 vid;
4380 __le16 ssvid;
4381 char sn[20];
4382 char mn[40];
4383 char subnqn[NVME_NQN_LENGTH];
4384 __le16 gen_number;
4385 __le32 rci;
4386 __u8 rsvd378[102];
4387 __u8 seb[32];
4388 } __attribute__((packed));
4389
4390 /**
4391 * enum nvme_pel_rci - This field indicates the persistent event log reporting context
4392 * @NVME_PEL_RCI_RCPID_SHIFT: Shift amount to get the reporting context port identifier
4393 * from the &struct nvme_persistent_event_log.rci field.
4394 * @NVME_PEL_RCI_RCPIT_SHIFT: Shift amount to get the reporting context port identifier
4395 * type from the &struct nvme_persistent_event_log.rci field.
4396 * @NVME_PEL_RCI_RCE_SHIFT: Shift amount to get the reporting context exists
4397 * from the &struct nvme_persistent_event_log.rci field.
4398 * @NVME_PEL_RCI_RSVD_SHIFT: Shift amount to get the reserved reporting context
4399 * from the &struct nvme_persistent_event_log.rci field.
4400 * @NVME_PEL_RCI_RCPID_MASK: Mask to get the reporting context port identifier from
4401 * the &struct nvme_persistent_event_log.rci field.
4402 * @NVME_PEL_RCI_RCPIT_MASK: Mask to get the reporting context port identifier type from
4403 * the &struct nvme_persistent_event_log.rci field.
4404 * @NVME_PEL_RCI_RCE_MASK: Mask to get the reporting context exists from
4405 * the &struct nvme_persistent_event_log.rci field.
4406 * @NVME_PEL_RCI_RSVD_MASK: Mask to get the reserved reporting context from
4407 * the &struct nvme_persistent_event_log.rci field.
4408 */
4409 enum nvme_pel_rci {
4410 NVME_PEL_RCI_RCPID_SHIFT = 0,
4411 NVME_PEL_RCI_RCPIT_SHIFT = 16,
4412 NVME_PEL_RCI_RCE_SHIFT = 18,
4413 NVME_PEL_RCI_RSVD_SHIFT = 19,
4414 NVME_PEL_RCI_RCPID_MASK = 0xffff,
4415 NVME_PEL_RCI_RCPIT_MASK = 0x3,
4416 NVME_PEL_RCI_RCE_MASK = 0x1,
4417 NVME_PEL_RCI_RSVD_MASK = 0x1fff,
4418 };
4419
4420 #define NVME_PEL_RCI_RCPID(rci) NVME_GET(rci, PEL_RCI_RCPID)
4421 #define NVME_PEL_RCI_RCPIT(rci) NVME_GET(rci, PEL_RCI_RCPIT)
4422 #define NVME_PEL_RCI_RCE(rci) NVME_GET(rci, PEL_RCI_RCE)
4423 #define NVME_PEL_RCI_RSVD(rci) NVME_GET(rci, PEL_RCI_RSVD)
4424
4425 /**
4426 * enum nvme_pel_rci_rcpit - Persistent Event Log Reporting Context - Port Identifier Type
4427 * @NVME_PEL_RCI_RCPIT_NOT_EXIST: Does not already exist
4428 * @NVME_PEL_RCI_RCPIT_EST_PORT: Established by an NVM subsystem port
4429 * @NVME_PEL_RCI_RCPIT_EST_ME: Established by a Management Endpoint
4430 */
4431 enum nvme_pel_rci_rcpit {
4432 NVME_PEL_RCI_RCPIT_NOT_EXIST = 0,
4433 NVME_PEL_RCI_RCPIT_EST_PORT = 1,
4434 NVME_PEL_RCI_RCPIT_EST_ME = 2,
4435 };
4436
4437 /**
4438 * struct nvme_persistent_event_entry - Persistent Event
4439 * @etype: Event Type
4440 * @etype_rev: Event Type Revision
4441 * @ehl: Event Header Length
4442 * @ehai: Event Header Additional Info
4443 * @cntlid: Controller Identifier
4444 * @ets: Event Timestamp
4445 * @pelpid: Port Identifier
4446 * @rsvd16: Reserved
4447 * @vsil: Vendor Specific Information Length
4448 * @el: Event Length
4449 */
4450 struct nvme_persistent_event_entry {
4451 __u8 etype;
4452 __u8 etype_rev;
4453 __u8 ehl;
4454 __u8 ehai;
4455 __le16 cntlid;
4456 __le64 ets;
4457 __le16 pelpid;
4458 __u8 rsvd16[4];
4459 __le16 vsil;
4460 __le16 el;
4461 } __attribute__((packed));
4462
4463 /**
4464 * enum nvme_persistent_event_types - Persistent event log events
4465 * @NVME_PEL_SMART_HEALTH_EVENT: SMART / Health Log Snapshot Event
4466 * @NVME_PEL_FW_COMMIT_EVENT: Firmware Commit Event
4467 * @NVME_PEL_TIMESTAMP_EVENT: Timestamp Change Event
4468 * @NVME_PEL_POWER_ON_RESET_EVENT: Power-on or Reset Event
4469 * @NVME_PEL_NSS_HW_ERROR_EVENT: NVM Subsystem Hardware Error Event
4470 * @NVME_PEL_CHANGE_NS_EVENT: Change Namespace Event
4471 * @NVME_PEL_FORMAT_START_EVENT: Format NVM Start Event
4472 * @NVME_PEL_FORMAT_COMPLETION_EVENT: Format NVM Completion Event
4473 * @NVME_PEL_SANITIZE_START_EVENT: Sanitize Start Event
4474 * @NVME_PEL_SANITIZE_COMPLETION_EVENT: Sanitize Completion Event
4475 * @NVME_PEL_SET_FEATURE_EVENT: Set Feature Event
4476 * @NVME_PEL_TELEMETRY_CRT: Telemetry Log Create Event
4477 * @NVME_PEL_THERMAL_EXCURSION_EVENT: Thermal Excursion Event
4478 * @NVME_PEL_SANITIZE_MEDIA_VERIF_EVENT:Sanitize Media Verification Event
4479 * @NVME_PEL_VENDOR_SPECIFIC_EVENT: Vendor Specific Event
4480 * @NVME_PEL_TCG_DEFINED_EVENT: TCG Defined Event
4481 */
4482 enum nvme_persistent_event_types {
4483 NVME_PEL_SMART_HEALTH_EVENT = 0x01,
4484 NVME_PEL_FW_COMMIT_EVENT = 0x02,
4485 NVME_PEL_TIMESTAMP_EVENT = 0x03,
4486 NVME_PEL_POWER_ON_RESET_EVENT = 0x04,
4487 NVME_PEL_NSS_HW_ERROR_EVENT = 0x05,
4488 NVME_PEL_CHANGE_NS_EVENT = 0x06,
4489 NVME_PEL_FORMAT_START_EVENT = 0x07,
4490 NVME_PEL_FORMAT_COMPLETION_EVENT = 0x08,
4491 NVME_PEL_SANITIZE_START_EVENT = 0x09,
4492 NVME_PEL_SANITIZE_COMPLETION_EVENT = 0x0a,
4493 NVME_PEL_SET_FEATURE_EVENT = 0x0b,
4494 NVME_PEL_TELEMETRY_CRT = 0x0c,
4495 NVME_PEL_THERMAL_EXCURSION_EVENT = 0x0d,
4496 NVME_PEL_SANITIZE_MEDIA_VERIF_EVENT = 0x0e,
4497 NVME_PEL_VENDOR_SPECIFIC_EVENT = 0xde,
4498 NVME_PEL_TCG_DEFINED_EVENT = 0xdf,
4499 };
4500
4501 /**
4502 * enum nvme_pel_ehai - This field indicates the persistent event header additional information
4503 * @NVME_PEL_EHAI_PIT_SHIFT: Shift amount to get the reporting context port identifier
4504 * from the &struct nvme_persistent_event_log.rci field.
4505 * @NVME_PEL_EHAI_RSVD_SHIFT: Shift amount to get the reserved reporting context
4506 * from the &struct nvme_persistent_event_log.rci field.
4507 * @NVME_PEL_EHAI_PIT_MASK: Mask to get the reporting context port identifier from
4508 * the &struct nvme_st_result.dsts field.
4509 * @NVME_PEL_EHAI_RSVD_MASK: Mask to get the reserved reporting context from
4510 * the &struct nvme_st_result.dsts field.
4511 */
4512 enum nvme_pel_ehai {
4513 NVME_PEL_EHAI_PIT_SHIFT = 0,
4514 NVME_PEL_EHAI_RSVD_SHIFT = 2,
4515 NVME_PEL_EHAI_PIT_MASK = 0x3,
4516 NVME_PEL_EHAI_RSVD_MASK = 0x3f,
4517 };
4518
4519 #define NVME_PEL_EHAI_PIT(ehai) NVME_GET(ehai, PEL_EHAI_PIT)
4520 #define NVME_PEL_EHAI_RSVD(ehai) NVME_GET(ehai, PEL_EHAI_RSVD)
4521
4522 /**
4523 * enum nvme_pel_ehai_pit - Persistent Event Header Additional Information - Port Identifier Type
4524 * @NVME_PEL_EHAI_PIT_NOT_REPORTED: PIT not reported and PELPID does not apply
4525 * @NVME_PEL_EHAI_PIT_NSS_PORT: NVM subsystem port
4526 * @NVME_PEL_EHAI_PIT_NMI_PORT: NVMe-MI port
4527 * @NVME_PEL_EHAI_PIT_NOT_ASSOCIATED: Event not associated with any port and PELPID does not apply
4528 */
4529 enum nvme_pel_ehai_pit {
4530 NVME_PEL_EHAI_PIT_NOT_REPORTED = 0,
4531 NVME_PEL_EHAI_PIT_NSS_PORT = 1,
4532 NVME_PEL_EHAI_PIT_NMI_PORT = 2,
4533 NVME_PEL_EHAI_PIT_NOT_ASSOCIATED = 3,
4534 };
4535
4536 /**
4537 * struct nvme_fw_commit_event - Firmware Commit Event Data
4538 * @old_fw_rev: Old Firmware Revision
4539 * @new_fw_rev: New Firmware Revision
4540 * @fw_commit_action: Firmware Commit Action
4541 * @fw_slot: Firmware Slot
4542 * @sct_fw: Status Code Type for Firmware Commit Command
4543 * @sc_fw: Status Returned for Firmware Commit Command
4544 * @vndr_assign_fw_commit_rc: Vendor Assigned Firmware Commit Result Code
4545 */
4546 struct nvme_fw_commit_event {
4547 __le64 old_fw_rev;
4548 __le64 new_fw_rev;
4549 __u8 fw_commit_action;
4550 __u8 fw_slot;
4551 __u8 sct_fw;
4552 __u8 sc_fw;
4553 __le16 vndr_assign_fw_commit_rc;
4554 } __attribute__((packed));
4555
4556 /**
4557 * struct nvme_timestamp - Timestamp - Data Structure for Get Features
4558 * @timestamp: Timestamp value based on origin and synch field
4559 * @attr: Attribute
4560 * @rsvd: Reserved
4561 */
4562 struct nvme_timestamp {
4563 __u8 timestamp[6];
4564 __u8 attr;
4565 __u8 rsvd;
4566 };
4567
4568 /**
4569 * struct nvme_time_stamp_change_event - Timestamp Change Event
4570 * @previous_timestamp: Previous Timestamp
4571 * @ml_secs_since_reset: Milliseconds Since Reset
4572 */
4573 struct nvme_time_stamp_change_event {
4574 __le64 previous_timestamp;
4575 __le64 ml_secs_since_reset;
4576 };
4577
4578 /**
4579 * struct nvme_power_on_reset_info_list - Controller Reset Information
4580 * @cid: Controller ID
4581 * @fw_act: Firmware Activation
4582 * @op_in_prog: Operation in Progress
4583 * @rsvd4: Reserved
4584 * @ctrl_power_cycle: Controller Power Cycle
4585 * @power_on_ml_seconds: Power on milliseconds
4586 * @ctrl_time_stamp: Controller Timestamp
4587 */
4588 struct nvme_power_on_reset_info_list {
4589 __le16 cid;
4590 __u8 fw_act;
4591 __u8 op_in_prog;
4592 __u8 rsvd4[12];
4593 __le32 ctrl_power_cycle;
4594 __le64 power_on_ml_seconds;
4595 __le64 ctrl_time_stamp;
4596 } __attribute__((packed));
4597
4598 /**
4599 * struct nvme_nss_hw_err_event - NVM Subsystem Hardware Error Event
4600 * @nss_hw_err_event_code: NVM Subsystem Hardware Error Event Code
4601 * @rsvd2: Reserved
4602 * @add_hw_err_info: Additional Hardware Error Information
4603 */
4604 struct nvme_nss_hw_err_event {
4605 __le16 nss_hw_err_event_code;
4606 __u8 rsvd2[2];
4607 __u8 *add_hw_err_info;
4608 };
4609
4610 /**
4611 * struct nvme_change_ns_event - Change Namespace Event Data
4612 * @nsmgt_cdw10: Namespace Management CDW10
4613 * @rsvd4: Reserved
4614 * @nsze: Namespace Size
4615 * @rsvd16: Reserved
4616 * @nscap: Namespace Capacity
4617 * @flbas: Formatted LBA Size
4618 * @dps: End-to-end Data Protection Type Settings
4619 * @nmic: Namespace Multi-path I/O and Namespace Sharing Capabilities
4620 * @rsvd35: Reserved
4621 * @ana_grp_id: ANA Group Identifier
4622 * @nvmset_id: NVM Set Identifier
4623 * @rsvd42: Reserved
4624 * @nsid: Namespace ID
4625 */
4626 struct nvme_change_ns_event {
4627 __le32 nsmgt_cdw10;
4628 __u8 rsvd4[4];
4629 __le64 nsze;
4630 __u8 rsvd16[8];
4631 __le64 nscap;
4632 __u8 flbas;
4633 __u8 dps;
4634 __u8 nmic;
4635 __u8 rsvd35;
4636 __le32 ana_grp_id;
4637 __le16 nvmset_id;
4638 __le16 rsvd42;
4639 __le32 nsid;
4640 };
4641
4642 /**
4643 * struct nvme_format_nvm_start_event - Format NVM Start Event Data
4644 * @nsid: Namespace Identifier
4645 * @fna: Format NVM Attributes
4646 * @rsvd5: Reserved
4647 * @format_nvm_cdw10: Format NVM CDW10
4648 */
4649 struct nvme_format_nvm_start_event {
4650 __le32 nsid;
4651 __u8 fna;
4652 __u8 rsvd5[3];
4653 __le32 format_nvm_cdw10;
4654 };
4655
4656 /**
4657 * struct nvme_format_nvm_compln_event - Format NVM Completion Event Data
4658 * @nsid: Namespace Identifier
4659 * @smallest_fpi: Smallest Format Progress Indicator
4660 * @format_nvm_status: Format NVM Status
4661 * @compln_info: Completion Information
4662 * @status_field: Status Field
4663 */
4664 struct nvme_format_nvm_compln_event {
4665 __le32 nsid;
4666 __u8 smallest_fpi;
4667 __u8 format_nvm_status;
4668 __le16 compln_info;
4669 __le32 status_field;
4670 };
4671
4672 /**
4673 * struct nvme_sanitize_start_event - Sanitize Start Event Data
4674 * @sani_cap: SANICAP
4675 * @sani_cdw10: Sanitize CDW10
4676 * @sani_cdw11: Sanitize CDW11
4677 */
4678 struct nvme_sanitize_start_event {
4679 __le32 sani_cap;
4680 __le32 sani_cdw10;
4681 __le32 sani_cdw11;
4682 };
4683
4684 /**
4685 * struct nvme_sanitize_compln_event - Sanitize Completion Event Data
4686 * @sani_prog: Sanitize Progress
4687 * @sani_status: Sanitize Status
4688 * @cmpln_info: Completion Information
4689 * @rsvd6: Reserved
4690 */
4691 struct nvme_sanitize_compln_event {
4692 __le16 sani_prog;
4693 __le16 sani_status;
4694 __le16 cmpln_info;
4695 __u8 rsvd6[2];
4696 };
4697
4698 /**
4699 * struct nvme_set_feature_event - Set Feature Event Data
4700 * @layout: Set Feature Event Layout
4701 * @cdw_mem: Command Dwords Memory buffer
4702 */
4703 struct nvme_set_feature_event {
4704 __le32 layout;
4705 __le32 cdw_mem[0];
4706 };
4707
4708 /**
4709 * enum nvme_set_feat_event_layout - This field indicates the set feature event layout
4710 * @NVME_SET_FEAT_EVENT_DW_COUNT_SHIFT: Shift amount to get the Dword count from the
4711 * &struct nvme_set_feature_event.layout field.
4712 * @NVME_SET_FEAT_EVENT_CC_DW0_SHIFT: Shift amount to get the logged command completion Dword 0
4713 * from the &struct nvme_set_feature_event.layout field.
4714 * @NVME_SET_FEAT_EVENT_MB_COUNT_SHIFT: Shift amount to get the memory buffer count from
4715 * the &struct nvme_set_feature_event.layout field.
4716 * @NVME_SET_FEAT_EVENT_DW_COUNT_MASK: Mask to get the Dword count from the &struct
4717 * nvme_set_feature_event.layout field.
4718 * @NVME_SET_FEAT_EVENT_CC_DW0_MASK: Mask to get the logged command completion Dword 0 from
4719 * the &struct nvme_set_feature_event.layout field.
4720 * @NVME_SET_FEAT_EVENT_MB_COUNT_MASK: Mask to get the memory buffer count from the &struct
4721 * nvme_set_feature_event.layout field.
4722 */
4723 enum nvme_set_feat_event_layout {
4724 NVME_SET_FEAT_EVENT_DW_COUNT_SHIFT = 0,
4725 NVME_SET_FEAT_EVENT_CC_DW0_SHIFT = 3,
4726 NVME_SET_FEAT_EVENT_MB_COUNT_SHIFT = 16,
4727 NVME_SET_FEAT_EVENT_DW_COUNT_MASK = 0x7,
4728 NVME_SET_FEAT_EVENT_CC_DW0_MASK = 0x1,
4729 NVME_SET_FEAT_EVENT_MB_COUNT_MASK = 0xffff,
4730 };
4731
4732 #define NVME_SET_FEAT_EVENT_DW_COUNT(layout) NVME_GET(layout, SET_FEAT_EVENT_DW_COUNT)
4733 #define NVME_SET_FEAT_EVENT_CC_DW0(layout) NVME_GET(layout, SET_FEAT_EVENT_CC_DW0)
4734 #define NVME_SET_FEAT_EVENT_MB_COUNT(layout) NVME_GET(layout, SET_FEAT_EVENT_MB_COUNT)
4735
4736 /**
4737 * struct nvme_thermal_exc_event - Thermal Excursion Event Data
4738 * @over_temp: Over Temperature
4739 * @threshold: temperature threshold
4740 */
4741 struct nvme_thermal_exc_event {
4742 __u8 over_temp;
4743 __u8 threshold;
4744 };
4745
4746 /**
4747 * struct nvme_lba_rd - LBA Range Descriptor
4748 * @rslba: Range Starting LBA
4749 * @rnlb: Range Number of Logical Blocks
4750 * @rsvd12: Reserved
4751 */
4752 struct nvme_lba_rd {
4753 __le64 rslba;
4754 __le32 rnlb;
4755 __u8 rsvd12[4];
4756 };
4757
4758 /**
4759 * struct nvme_lbas_ns_element - LBA Status Log Namespace Element
4760 * @neid: Namespace Element Identifier
4761 * @nlrd: Number of LBA Range Descriptors
4762 * @ratype: Recommended Action Type. see @enum nvme_lba_status_atype
4763 * @rsvd8: Reserved
4764 * @lba_rd: LBA Range Descriptor
4765 */
4766 struct nvme_lbas_ns_element {
4767 __le32 neid;
4768 __le32 nlrd;
4769 __u8 ratype;
4770 __u8 rsvd8[7];
4771 struct nvme_lba_rd lba_rd[];
4772 };
4773
4774 /**
4775 * enum nvme_lba_status_atype - Action type the controller uses to return LBA status
4776 * @NVME_LBA_STATUS_ATYPE_ALLOCATED: Return tracked allocated LBAs status
4777 * @NVME_LBA_STATUS_ATYPE_SCAN_UNTRACKED: Perform scan and return Untracked and
4778 * Tracked Potentially Unrecoverable LBAs
4779 * status
4780 * @NVME_LBA_STATUS_ATYPE_TRACKED: Return Tracked Potentially Unrecoverable
4781 * LBAs associated with physical storage
4782 */
4783 enum nvme_lba_status_atype {
4784 NVME_LBA_STATUS_ATYPE_ALLOCATED = 0x2,
4785 NVME_LBA_STATUS_ATYPE_SCAN_UNTRACKED = 0x10,
4786 NVME_LBA_STATUS_ATYPE_TRACKED = 0x11,
4787 };
4788
4789 /**
4790 * struct nvme_lba_status_log - LBA Status Information Log
4791 * @lslplen: LBA Status Log Page Length
4792 * @nlslne: Number of LBA Status Log Namespace Elements
4793 * @estulb: Estimate of Unrecoverable Logical Blocks
4794 * @rsvd12: Reserved
4795 * @lsgc: LBA Status Generation Counter
4796 * @elements: LBA Status Log Namespace Element List
4797 */
4798 struct nvme_lba_status_log {
4799 __le32 lslplen;
4800 __le32 nlslne;
4801 __le32 estulb;
4802 __u8 rsvd12[2];
4803 __le16 lsgc;
4804 struct nvme_lbas_ns_element elements[];
4805 };
4806
4807 /**
4808 * struct nvme_eg_event_aggregate_log - Endurance Group Event Aggregate
4809 * @nr_entries: Number of Entries
4810 * @egids: Endurance Group Identifier
4811 */
4812 struct nvme_eg_event_aggregate_log {
4813 __le64 nr_entries;
4814 __le16 egids[];
4815 };
4816
4817 /**
4818 * enum nvme_fid_supported_effects - FID Supported and Effects Data Structure definitions
4819 * @NVME_FID_SUPPORTED_EFFECTS_FSUPP: FID Supported
4820 * @NVME_FID_SUPPORTED_EFFECTS_UDCC: User Data Content Change
4821 * @NVME_FID_SUPPORTED_EFFECTS_NCC: Namespace Capability Change
4822 * @NVME_FID_SUPPORTED_EFFECTS_NIC: Namespace Inventory Change
4823 * @NVME_FID_SUPPORTED_EFFECTS_CCC: Controller Capability Change
4824 * @NVME_FID_SUPPORTED_EFFECTS_UUID_SEL: UUID Selection Supported
4825 * @NVME_FID_SUPPORTED_EFFECTS_SCOPE_SHIFT: FID Scope Shift
4826 * @NVME_FID_SUPPORTED_EFFECTS_SCOPE_MASK: FID Scope Mask
4827 * @NVME_FID_SUPPORTED_EFFECTS_SCOPE_NS: Namespace Scope
4828 * @NVME_FID_SUPPORTED_EFFECTS_SCOPE_CTRL: Controller Scope
4829 * @NVME_FID_SUPPORTED_EFFECTS_SCOPE_NVM_SET: NVM Set Scope
4830 * @NVME_FID_SUPPORTED_EFFECTS_SCOPE_ENDGRP: Endurance Group Scope
4831 * @NVME_FID_SUPPORTED_EFFECTS_SCOPE_DOMAIN: Domain Scope
4832 * @NVME_FID_SUPPORTED_EFFECTS_SCOPE_NSS: NVM Subsystem Scope
4833 * @NVME_FID_SUPPORTED_EFFECTS_CDQSCP: Controller Data Queue
4834 */
4835 enum nvme_fid_supported_effects {
4836 NVME_FID_SUPPORTED_EFFECTS_FSUPP = 1 << 0,
4837 NVME_FID_SUPPORTED_EFFECTS_UDCC = 1 << 1,
4838 NVME_FID_SUPPORTED_EFFECTS_NCC = 1 << 2,
4839 NVME_FID_SUPPORTED_EFFECTS_NIC = 1 << 3,
4840 NVME_FID_SUPPORTED_EFFECTS_CCC = 1 << 4,
4841 NVME_FID_SUPPORTED_EFFECTS_UUID_SEL = 1 << 19,
4842 NVME_FID_SUPPORTED_EFFECTS_SCOPE_SHIFT = 20,
4843 NVME_FID_SUPPORTED_EFFECTS_SCOPE_MASK = 0xfff,
4844 NVME_FID_SUPPORTED_EFFECTS_SCOPE_NS = 1 << 0,
4845 NVME_FID_SUPPORTED_EFFECTS_SCOPE_CTRL = 1 << 1,
4846 NVME_FID_SUPPORTED_EFFECTS_SCOPE_NVM_SET= 1 << 2,
4847 NVME_FID_SUPPORTED_EFFECTS_SCOPE_ENDGRP = 1 << 3,
4848 NVME_FID_SUPPORTED_EFFECTS_SCOPE_DOMAIN = 1 << 4,
4849 NVME_FID_SUPPORTED_EFFECTS_SCOPE_NSS = 1 << 5,
4850 NVME_FID_SUPPORTED_EFFECTS_CDQSCP = 1 << 6,
4851 };
4852
4853 /**
4854 * struct nvme_fid_supported_effects_log - Feature Identifiers Supported and Effects
4855 * @fid_support: Feature Identifier Supported
4856 *
4857 */
4858 struct nvme_fid_supported_effects_log {
4859 __le32 fid_support[NVME_LOG_FID_SUPPORTED_EFFECTS_MAX];
4860 };
4861
4862 /**
4863 * enum nvme_mi_cmd_supported_effects - MI Command Supported and Effects Data Structure
4864 * @NVME_MI_CMD_SUPPORTED_EFFECTS_CSUPP: Command Supported
4865 * @NVME_MI_CMD_SUPPORTED_EFFECTS_UDCC: User Data Content Change
4866 * @NVME_MI_CMD_SUPPORTED_EFFECTS_NCC: Namespace Capability Change
4867 * @NVME_MI_CMD_SUPPORTED_EFFECTS_NIC: Namespace Inventory Change
4868 * @NVME_MI_CMD_SUPPORTED_EFFECTS_CCC: Controller Capability Change
4869 * @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_SHIFT: 20 bit shift
4870 * @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_MASK: 12 bit mask - 0xfff
4871 * @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NS: Namespace Scope
4872 * @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_CTRL: Controller Scope
4873 * @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NVM_SET: NVM Set Scope
4874 * @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_ENDGRP: Endurance Group Scope
4875 * @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_DOMAIN: Domain Scope
4876 * @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NSS: NVM Subsystem Scope
4877 */
4878 enum nvme_mi_cmd_supported_effects {
4879 NVME_MI_CMD_SUPPORTED_EFFECTS_CSUPP = 1 << 0,
4880 NVME_MI_CMD_SUPPORTED_EFFECTS_UDCC = 1 << 1,
4881 NVME_MI_CMD_SUPPORTED_EFFECTS_NCC = 1 << 2,
4882 NVME_MI_CMD_SUPPORTED_EFFECTS_NIC = 1 << 3,
4883 NVME_MI_CMD_SUPPORTED_EFFECTS_CCC = 1 << 4,
4884 NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_SHIFT = 20,
4885 NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_MASK = 0xfff,
4886 NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NS = 1 << 0,
4887 NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_CTRL = 1 << 1,
4888 NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NVM_SET = 1 << 2,
4889 NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_ENDGRP = 1 << 3,
4890 NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_DOMAIN = 1 << 4,
4891 NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NSS = 1 << 5,
4892 };
4893
4894 /**
4895 * struct nvme_mi_cmd_supported_effects_log - NVMe-MI Commands Supported and Effects Log
4896 * @mi_cmd_support: NVMe-MI Commands Supported
4897 * @reserved1: Reserved
4898 */
4899 struct nvme_mi_cmd_supported_effects_log {
4900 __le32 mi_cmd_support[NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_MAX];
4901 __le32 reserved1[NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_RESERVED];
4902 };
4903
4904 /**
4905 * struct nvme_boot_partition - Boot Partition Log
4906 * @lid: Boot Partition Identifier
4907 * @rsvd1: Reserved
4908 * @bpinfo: Boot Partition Information
4909 * @rsvd8: Reserved
4910 * @boot_partition_data: Contains the contents of the
4911 * specified Boot Partition
4912 */
4913 struct nvme_boot_partition {
4914 __u8 lid;
4915 __u8 rsvd1[3];
4916 __le32 bpinfo;
4917 __u8 rsvd8[8];
4918 __u8 boot_partition_data[];
4919 };
4920
4921 /**
4922 * enum nvme_boot_partition_info - This field indicates the boot partition information
4923 * @NVME_BOOT_PARTITION_INFO_BPSZ_SHIFT: Shift amount to get the boot partition size from
4924 * the &struct nvme_boot_partition.bpinfo field.
4925 * @NVME_BOOT_PARTITION_INFO_ABPID_SHIFT: Shift amount to get the active boot partition ID
4926 * from the &struct nvme_boot_partition.bpinfo field.
4927 * @NVME_BOOT_PARTITION_INFO_BPSZ_MASK: Mask to get the boot partition size from the
4928 * &struct nvme_boot_partition.bpinfo field.
4929 * @NVME_BOOT_PARTITION_INFO_ABPID_MASK: Mask to get the active boot partition ID from the
4930 * &struct nvme_boot_partition.bpinfo field.
4931 */
4932 enum nvme_boot_partition_info {
4933 NVME_BOOT_PARTITION_INFO_BPSZ_SHIFT = 0,
4934 NVME_BOOT_PARTITION_INFO_ABPID_SHIFT = 31,
4935 NVME_BOOT_PARTITION_INFO_BPSZ_MASK = 0x7fff,
4936 NVME_BOOT_PARTITION_INFO_ABPID_MASK = 0x1,
4937 };
4938
4939 #define NVME_BOOT_PARTITION_INFO_BPSZ(bpinfo) NVME_GET(bpinfo, BOOT_PARTITION_INFO_BPSZ)
4940 #define NVME_BOOT_PARTITION_INFO_ABPID(bpinfo) NVME_GET(bpinfo, BOOT_PARTITION_INFO_ABPID)
4941
4942 /**
4943 * struct nvme_rotational_media_info_log - Rotational Media Information Log
4944 * @endgid: Endurance Group Identifier
4945 * @numa: Number of Actuators
4946 * @nrs: Nominal Rotational Speed
4947 * @rsvd6: Reserved
4948 * @spinc: Spinup Count
4949 * @fspinc: Failed Spinup Count
4950 * @ldc: Load Count
4951 * @fldc: Failed Load Count
4952 * @rsvd24: Reserved
4953 */
4954 struct nvme_rotational_media_info_log {
4955 __le16 endgid;
4956 __le16 numa;
4957 __le16 nrs;
4958 __u8 rsvd6[2];
4959 __le32 spinc;
4960 __le32 fspinc;
4961 __le32 ldc;
4962 __le32 fldc;
4963 __u8 rsvd24[488];
4964 };
4965
4966 /**
4967 * struct nvme_dispersed_ns_participating_nss_log - Dispersed Namespace Participating NVM Subsystems
4968 * Log
4969 * @genctr: Generation Counter
4970 * @numpsub: Number of Participating NVM Subsystems
4971 * @rsvd16: Reserved
4972 * @participating_nss: Participating NVM Subsystem Entry
4973 */
4974 struct nvme_dispersed_ns_participating_nss_log {
4975 __le64 genctr;
4976 __le64 numpsub;
4977 __u8 rsvd16[240];
4978 __u8 participating_nss[];
4979 };
4980
4981 /**
4982 * struct nvme_mgmt_addr_desc - Management Address Descriptor
4983 * @mat: Management Address Type
4984 * @rsvd1: Reserved
4985 * @madrs: Management Address
4986 */
4987 struct nvme_mgmt_addr_desc {
4988 __u8 mat;
4989 __u8 rsvd1[3];
4990 __u8 madrs[508];
4991 };
4992
4993 /**
4994 * struct nvme_mgmt_addr_list_log - Management Address List Log
4995 * @mad: Management Address Descriptor
4996 */
4997 struct nvme_mgmt_addr_list_log {
4998 struct nvme_mgmt_addr_desc mad[8];
4999 };
5000
5001 /**
5002 * struct nvme_eom_lane_desc - EOM Lane Descriptor
5003 * @rsvd0: Reserved
5004 * @mstatus: Measurement Status
5005 * @lane: Lane number
5006 * @eye: Eye number
5007 * @top: Absolute number of rows from center to top edge of eye
5008 * @bottom: Absolute number of rows from center to bottom edge of eye
5009 * @left: Absolute number of rows from center to left edge of eye
5010 * @right: Absolute number of rows from center to right edge of eye
5011 * @nrows: Number of Rows
5012 * @ncols: Number of Columns
5013 * @edlen: Eye Data Length
5014 * @rsvd18: Reserved
5015 * @eye_desc: Printable Eye, Eye Data, and any Padding
5016 */
5017 struct nvme_eom_lane_desc {
5018 __u8 rsvd0;
5019 __u8 mstatus;
5020 __u8 lane;
5021 __u8 eye;
5022 __le16 top;
5023 __le16 bottom;
5024 __le16 left;
5025 __le16 right;
5026 __le16 nrows;
5027 __le16 ncols;
5028 __le16 edlen;
5029 __u8 rsvd18[14];
5030 __u8 eye_desc[];
5031 };
5032
5033 /**
5034 * struct nvme_phy_rx_eom_log - Physical Interface Receiver Eye Opening Measurement Log
5035 * @lid: Log Identifier
5036 * @eomip: EOM In Progress
5037 * @hsize: Header Size
5038 * @rsize: Result Size
5039 * @eomdgn: EOM Data Generation Number
5040 * @lr: Log Revision
5041 * @odp: Optional Data Present
5042 * @lanes: Number of lanes configured for this port
5043 * @epl: Eyes Per Lane
5044 * @lspfc: Log Specific Parameter Field Copy
5045 * @li: Link Information
5046 * @rsvd15: Reserved
5047 * @lsic: Log Specific Identifier Copy
5048 * @dsize: Descriptor Size
5049 * @nd: Number of Descriptors
5050 * @maxtb: Maximum Top Bottom
5051 * @maxlr: Maximum Left Right
5052 * @etgood: Estimated Time for Good Quality
5053 * @etbetter: Estimated Time for Better Quality
5054 * @etbest: Estimated Time for Best Quality
5055 * @rsvd36: Reserved
5056 * @descs: EOM Lane Descriptors
5057 */
5058 struct nvme_phy_rx_eom_log {
5059 __u8 lid;
5060 __u8 eomip;
5061 __le16 hsize;
5062 __le32 rsize;
5063 __u8 eomdgn;
5064 __u8 lr;
5065 __u8 odp;
5066 __u8 lanes;
5067 __u8 epl;
5068 __u8 lspfc;
5069 __u8 li;
5070 __u8 rsvd15[3];
5071 __le16 lsic;
5072 __le32 dsize;
5073 __le16 nd;
5074 __le16 maxtb;
5075 __le16 maxlr;
5076 __le16 etgood;
5077 __le16 etbetter;
5078 __le16 etbest;
5079 __u8 rsvd36[28];
5080 struct nvme_eom_lane_desc descs[];
5081 };
5082
5083 /**
5084 * enum nvme_eom_optional_data_present - EOM Optional Data Present Fields
5085 * @NVME_EOM_ODP_PEFP_SHIFT: Shift amount to get the printable eye field present
5086 * from the &struct nvme_phy_rx_eom_log.odp field.
5087 * @NVME_EOM_ODP_EDFP_SHIFT: Shift amount to get the eye data field present
5088 * from the &struct nvme_phy_rx_eom_log.odp field.
5089 * @NVME_EOM_ODP_RSVD_SHIFT: Shift amount to get the reserved optional data present
5090 * from the &struct nvme_phy_rx_eom_log.odp field.
5091 * @NVME_EOM_ODP_PEFP_MASK: Mask to get the printable eye field present
5092 * from the &struct nvme_phy_rx_eom_log.odp field.
5093 * @NVME_EOM_ODP_EDFP_MASK: Mask to get the eye data field present
5094 * from the &struct nvme_phy_rx_eom_log.odp field.
5095 * @NVME_EOM_ODP_RSVD_MASK: Mask to get the reserved data present
5096 * from the &struct nvme_phy_rx_eom_log.odp field.
5097 */
5098 enum nvme_eom_optional_data_present {
5099 NVME_EOM_ODP_PEFP_SHIFT = 0,
5100 NVME_EOM_ODP_EDFP_SHIFT = 1,
5101 NVME_EOM_ODP_RSVD_SHIFT = 2,
5102 NVME_EOM_ODP_PEFP_MASK = 0x1,
5103 NVME_EOM_ODP_EDFP_MASK = 0x1,
5104 NVME_EOM_ODP_RSVD_MASK = 0x3f,
5105 };
5106
5107 #define NVME_EOM_ODP_PEFP(odp) NVME_GET(odp, EOM_ODP_PEFP)
5108 #define NVME_EOM_ODP_EDFP(odp) NVME_GET(odp, EOM_ODP_EDFP)
5109 #define NVME_EOM_ODP_RSVD(odp) NVME_GET(odp, EOM_ODP_RSVD)
5110
5111 /**
5112 * enum nvme_eom_optional_data - EOM Optional Data Present Fields (Deprecated)
5113 * @NVME_EOM_PRINTABLE_EYE_PRESENT: Printable Eye Present
5114 * @NVME_EOM_EYE_DATA_PRESENT: Eye Data Present
5115 */
5116 enum nvme_eom_optional_data {
5117 NVME_EOM_PRINTABLE_EYE_PRESENT = NVME_EOM_ODP_PEFP_MASK << NVME_EOM_ODP_PEFP_SHIFT,
5118 NVME_EOM_EYE_DATA_PRESENT = NVME_EOM_ODP_EDFP_MASK << NVME_EOM_ODP_EDFP_SHIFT,
5119 };
5120
5121 /**
5122 * enum nvme_phy_rx_eom_progress - EOM In Progress Values
5123 * @NVME_PHY_RX_EOM_NOT_STARTED: EOM Not Started
5124 * @NVME_PHY_RX_EOM_IN_PROGRESS: EOM In Progress
5125 * @NVME_PHY_RX_EOM_COMPLETED: EOM Completed
5126 */
5127 enum nvme_phy_rx_eom_progress {
5128 NVME_PHY_RX_EOM_NOT_STARTED = 0,
5129 NVME_PHY_RX_EOM_IN_PROGRESS = 1,
5130 NVME_PHY_RX_EOM_COMPLETED = 2,
5131 };
5132
5133 /**
5134 * struct nvme_reachability_group_desc - Reachability Group Descriptor
5135 * @rgid: Reachability Group ID
5136 * @nnid: Number of NSID Values
5137 * @chngc: Change Count
5138 * @rsvd16: Reserved
5139 * @nsid: Namespace Identifier List
5140 */
5141 struct nvme_reachability_group_desc {
5142 __le32 rgid;
5143 __le32 nnid;
5144 __le64 chngc;
5145 __u8 rsvd16[16];
5146 __le32 nsid[];
5147 };
5148
5149 /**
5150 * struct nvme_reachability_groups_log - Reachability Groups Log
5151 * @chngc: Change Count
5152 * @nrgd: Number of Reachability Group Descriptors
5153 * @rsvd10: Reserved
5154 * @rgd: Reachability Group Descriptor List
5155 */
5156 struct nvme_reachability_groups_log {
5157 __le64 chngc;
5158 __le16 nrgd;
5159 __u8 rsvd10[6];
5160 struct nvme_reachability_group_desc rgd[];
5161 };
5162
5163 /**
5164 * struct nvme_reachability_association_desc - Reachability Association Descriptor
5165 * @rasid: Reachability Association ID
5166 * @nrid: Number of RGID Values
5167 * @chngc: Change Count
5168 * @rac: Reachability Association Characteristics
5169 * @rsvd17: Reserved
5170 * @rgid: Reachability Group Identifier List
5171 */
5172 struct nvme_reachability_association_desc {
5173 __le32 rasid;
5174 __le32 nrid;
5175 __le64 chngc;
5176 __u8 rac;
5177 __u8 rsvd17[15];
5178 __le32 rgid[];
5179 };
5180
5181 /**
5182 * struct nvme_reachability_associations_log - Reachability Associations Log
5183 * @chngc: Change Count
5184 * @nrad: Number of Reachability Association Descriptors
5185 * @rsvd10: Reserved
5186 * @rad: Reachability Association Descriptor List
5187 */
5188 struct nvme_reachability_associations_log {
5189 __le64 chngc;
5190 __le16 nrad;
5191 __u8 rsvd10[6];
5192 struct nvme_reachability_association_desc rad[];
5193 };
5194
5195 /**
5196 * struct nvme_media_unit_stat_desc - Media Unit Status Descriptor
5197 * @muid: Media Unit Identifier
5198 * @domainid: Domain Identifier
5199 * @endgid: Endurance Group Identifier
5200 * @nvmsetid: NVM Set Identifier
5201 * @cap_adj_fctr: Capacity Adjustment Factor
5202 * @avl_spare: Available Spare
5203 * @percent_used: Percentage Used
5204 * @mucs: Number of Channels attached to media units
5205 * @cio: Channel Identifiers Offset
5206 */
5207 struct nvme_media_unit_stat_desc {
5208 __le16 muid;
5209 __le16 domainid;
5210 __le16 endgid;
5211 __le16 nvmsetid;
5212 __le16 cap_adj_fctr;
5213 __u8 avl_spare;
5214 __u8 percent_used;
5215 __u8 mucs;
5216 __u8 cio;
5217 };
5218
5219 /**
5220 * struct nvme_media_unit_stat_log - Media Unit Status
5221 * @nmu: Number unit status descriptor
5222 * @cchans: Number of Channels
5223 * @sel_config: Selected Configuration
5224 * @rsvd6: Reserved
5225 * @mus_desc: Media unit statistic descriptors
5226 */
5227 struct nvme_media_unit_stat_log {
5228 __le16 nmu;
5229 __le16 cchans;
5230 __le16 sel_config;
5231 __u8 rsvd6[10];
5232 struct nvme_media_unit_stat_desc mus_desc[];
5233 };
5234
5235 /**
5236 * struct nvme_media_unit_config_desc - Media Unit Configuration Descriptor
5237 * @muid: Media Unit Identifier
5238 * @rsvd2: Reserved
5239 * @mudl: Media Unit Descriptor Length
5240 */
5241 struct nvme_media_unit_config_desc {
5242 __le16 muid;
5243 __u8 rsvd2[4];
5244 __le16 mudl;
5245 };
5246
5247 /**
5248 * struct nvme_channel_config_desc - Channel Configuration Descriptor
5249 * @chanid: Channel Identifier
5250 * @chmus: Number Channel Media Units
5251 * @mu_config_desc: Channel Unit config descriptors.
5252 * See @struct nvme_media_unit_config_desc
5253 */
5254 struct nvme_channel_config_desc {
5255 __le16 chanid;
5256 __le16 chmus;
5257 struct nvme_media_unit_config_desc mu_config_desc[];
5258 };
5259
5260 /**
5261 * struct nvme_end_grp_chan_desc - Endurance Group Channel Configuration Descriptor
5262 * @egchans: Number of Channels
5263 * @chan_config_desc: Channel config descriptors.
5264 * See @struct nvme_channel_config_desc
5265 */
5266 struct nvme_end_grp_chan_desc {
5267 __le16 egchans;
5268 struct nvme_channel_config_desc chan_config_desc[];
5269 };
5270
5271 /**
5272 * struct nvme_end_grp_config_desc - Endurance Group Configuration Descriptor
5273 * @endgid: Endurance Group Identifier
5274 * @cap_adj_factor: Capacity Adjustment Factor
5275 * @rsvd4: Reserved
5276 * @tegcap: Total Endurance Group Capacity
5277 * @segcap: Spare Endurance Group Capacity
5278 * @end_est: Endurance Estimate
5279 * @egsets: Number of NVM Sets
5280 * @rsvd64: Reserved
5281 * @nvmsetid: NVM Set Identifier
5282 */
5283 struct nvme_end_grp_config_desc {
5284 __le16 endgid;
5285 __le16 cap_adj_factor;
5286 __u8 rsvd4[12];
5287 __u8 tegcap[16];
5288 __u8 segcap[16];
5289 __u8 end_est[16];
5290 __u8 rsvd64[16];
5291 __le16 egsets;
5292 __le16 nvmsetid[];
5293 };
5294
5295 /**
5296 * struct nvme_capacity_config_desc - Capacity Configuration structure definitions
5297 * @cap_config_id: Capacity Configuration Identifier
5298 * @domainid: Domain Identifier
5299 * @egcn: Number Endurance Group Configuration
5300 * Descriptors
5301 * @rsvd6: Reserved
5302 * @egcd: Endurance Group Config descriptors.
5303 * See @struct nvme_end_grp_config_desc
5304 */
5305 struct nvme_capacity_config_desc {
5306 __le16 cap_config_id;
5307 __le16 domainid;
5308 __le16 egcn;
5309 __u8 rsvd6[26];
5310 struct nvme_end_grp_config_desc egcd[];
5311 };
5312
5313 /**
5314 * struct nvme_supported_cap_config_list_log - Supported Capacity Configuration list log page
5315 * @sccn: Number of capacity configuration
5316 * @rsvd1: Reserved
5317 * @cap_config_desc: Capacity configuration descriptor.
5318 * See @struct nvme_capacity_config_desc
5319 */
5320 struct nvme_supported_cap_config_list_log {
5321 __u8 sccn;
5322 __u8 rsvd1[15];
5323 struct nvme_capacity_config_desc cap_config_desc[];
5324 };
5325
5326 /**
5327 * struct nvme_lockdown_log - Command and Feature Lockdown Log
5328 * @cfila: Contents of the Command and Feature Identifier List field in the log page.
5329 * @rsvd1: Reserved
5330 * @lngth: Length of Command and Feature Identifier List field
5331 * @cfil: Command and Feature Identifier List
5332 */
5333 struct nvme_lockdown_log {
5334 __u8 cfila;
5335 __u8 rsvd1[2];
5336 __u8 lngth;
5337 __u8 cfil[508];
5338 };
5339
5340 /**
5341 * struct nvme_resv_notification_log - Reservation Notification Log
5342 * @lpc: Log Page Count
5343 * @rnlpt: See &enum nvme_resv_notify_rnlpt.
5344 * @nalp: Number of Available Log Pages
5345 * @rsvd9: Reserved
5346 * @nsid: Namespace ID
5347 * @rsvd16: Reserved
5348 */
5349 struct nvme_resv_notification_log {
5350 __le64 lpc;
5351 __u8 rnlpt;
5352 __u8 nalp;
5353 __u8 rsvd9[2];
5354 __le32 nsid;
5355 __u8 rsvd16[48];
5356 };
5357
5358 /**
5359 * enum nvme_resv_notify_rnlpt - Reservation Notification Log - Reservation Notification Log Page Type
5360 * @NVME_RESV_NOTIFY_RNLPT_EMPTY: Empty Log Page
5361 * @NVME_RESV_NOTIFY_RNLPT_REGISTRATION_PREEMPTED: Registration Preempted
5362 * @NVME_RESV_NOTIFY_RNLPT_RESERVATION_RELEASED: Reservation Released
5363 * @NVME_RESV_NOTIFY_RNLPT_RESERVATION_PREEMPTED: Reservation Preempted
5364 */
5365 enum nvme_resv_notify_rnlpt {
5366 NVME_RESV_NOTIFY_RNLPT_EMPTY = 0,
5367 NVME_RESV_NOTIFY_RNLPT_REGISTRATION_PREEMPTED = 1,
5368 NVME_RESV_NOTIFY_RNLPT_RESERVATION_RELEASED = 2,
5369 NVME_RESV_NOTIFY_RNLPT_RESERVATION_PREEMPTED = 3,
5370 };
5371
5372 /**
5373 * struct nvme_sanitize_log_page - Sanitize Status (Log Identifier 81h)
5374 * @sprog: Sanitize Progress (SPROG): indicates the fraction complete of the
5375 * sanitize operation. The value is a numerator of the fraction
5376 * complete that has 65,536 (10000h) as its denominator. This value
5377 * shall be set to FFFFh if the @sstat field is not set to
5378 * %NVME_SANITIZE_SSTAT_STATUS_IN_PROGESS.
5379 * @sstat: Sanitize Status (SSTAT): indicates the status associated with
5380 * the most recent sanitize operation. See &enum nvme_sanitize_sstat.
5381 * @scdw10: Sanitize Command Dword 10 Information (SCDW10): contains the value
5382 * of the Command Dword 10 field of the Sanitize command that started
5383 * the sanitize operation.
5384 * @eto: Estimated Time For Overwrite: indicates the number of seconds required
5385 * to complete an Overwrite sanitize operation with 16 passes in
5386 * the background when the No-Deallocate Modifies Media After Sanitize
5387 * field is not set to 10b. A value of 0h indicates that the sanitize
5388 * operation is expected to be completed in the background when the
5389 * Sanitize command that started that operation is completed. A value
5390 * of FFFFFFFFh indicates that no time period is reported.
5391 * @etbe: Estimated Time For Block Erase: indicates the number of seconds
5392 * required to complete a Block Erase sanitize operation in the
5393 * background when the No-Deallocate Modifies Media After Sanitize
5394 * field is not set to 10b. A value of 0h indicates that the sanitize
5395 * operation is expected to be completed in the background when the
5396 * Sanitize command that started that operation is completed.
5397 * A value of FFFFFFFFh indicates that no time period is reported.
5398 * @etce: Estimated Time For Crypto Erase: indicates the number of seconds
5399 * required to complete a Crypto Erase sanitize operation in the
5400 * background when the No-Deallocate Modifies Media After Sanitize
5401 * field is not set to 10b. A value of 0h indicates that the sanitize
5402 * operation is expected to be completed in the background when the
5403 * Sanitize command that started that operation is completed.
5404 * A value of FFFFFFFFh indicates that no time period is reported.
5405 * @etond: Estimated Time For Overwrite With No-Deallocate Media Modification:
5406 * indicates the number of seconds required to complete an Overwrite
5407 * sanitize operation and the associated additional media modification
5408 * after the Overwrite sanitize operation in the background when
5409 * the No-Deallocate After Sanitize bit was set to 1 in the Sanitize
5410 * command that requested the Overwrite sanitize operation; and
5411 * the No-Deallocate Modifies Media After Sanitize field is set to 10b.
5412 * A value of 0h indicates that the sanitize operation is expected
5413 * to be completed in the background when the Sanitize command that
5414 * started that operation is completed. A value of FFFFFFFFh indicates
5415 * that no time period is reported.
5416 * @etbend: Estimated Time For Block Erase With No-Deallocate Media Modification:
5417 * indicates the number of seconds required to complete a Block Erase
5418 * sanitize operation and the associated additional media modification
5419 * after the Block Erase sanitize operation in the background when
5420 * the No-Deallocate After Sanitize bit was set to 1 in the Sanitize
5421 * command that requested the Overwrite sanitize operation; and
5422 * the No-Deallocate Modifies Media After Sanitize field is set to 10b.
5423 * A value of 0h indicates that the sanitize operation is expected
5424 * to be completed in the background when the Sanitize command that
5425 * started that operation is completed. A value of FFFFFFFFh indicates
5426 * that no time period is reported.
5427 * @etcend: Estimated Time For Crypto Erase With No-Deallocate Media Modification:
5428 * indicates the number of seconds required to complete a Crypto Erase
5429 * sanitize operation and the associated additional media modification
5430 * after the Crypto Erase sanitize operation in the background when
5431 * the No-Deallocate After Sanitize bit was set to 1 in the Sanitize
5432 * command that requested the Overwrite sanitize operation; and
5433 * the No-Deallocate Modifies Media After Sanitize field is set to 10b.
5434 * A value of 0h indicates that the sanitize operation is expected
5435 * to be completed in the background when the Sanitize command that
5436 * started that operation is completed. A value of FFFFFFFFh indicates
5437 * that no time period is reported.
5438 * @etpvds: Estimated Time For Post-Verification Deallocation State: indicates the
5439 * number of seconds required to deallocate all media allocated for user data
5440 * after exiting the Media Verification state (i.e., the time difference between
5441 * entering and exiting the Post-Verification Deallocation state), if that state
5442 * is entered as part of the sanitize operation. A value of FFFFFFFFh indicates
5443 * that no time period is reported.
5444 * @ssi: Sanitize State Information: indicate the state of the Sanitize Operation
5445 * State Machine.
5446 * @rsvd37: Reserved
5447 */
5448 struct nvme_sanitize_log_page {
5449 __le16 sprog;
5450 __le16 sstat;
5451 __le32 scdw10;
5452 __le32 eto;
5453 __le32 etbe;
5454 __le32 etce;
5455 __le32 etond;
5456 __le32 etbend;
5457 __le32 etcend;
5458 __le32 etpvds;
5459 __u8 ssi;
5460 __u8 rsvd37[475];
5461 };
5462
5463 /**
5464 * enum nvme_sanitize_sstat - Sanitize Status (SSTAT)
5465 * @NVME_SANITIZE_SSTAT_STATUS_SHIFT: Shift amount to get the status value of
5466 * the most recent sanitize operation from
5467 * the &struct nvme_sanitize_log_page.sstat
5468 * field.
5469 * @NVME_SANITIZE_SSTAT_STATUS_MASK: Mask to get the status value of the most
5470 * recent sanitize operation.
5471 * @NVME_SANITIZE_SSTAT_STATUS_NEVER_SANITIZED: The NVM subsystem has never been
5472 * sanitized.
5473 * @NVME_SANITIZE_SSTAT_STATUS_COMPLETE_SUCCESS: The most recent sanitize operation
5474 * completed successfully including any
5475 * additional media modification.
5476 * @NVME_SANITIZE_SSTAT_STATUS_IN_PROGESS: A sanitize operation is currently in progress.
5477 * @NVME_SANITIZE_SSTAT_STATUS_COMPLETED_FAILED: The most recent sanitize operation
5478 * failed.
5479 * @NVME_SANITIZE_SSTAT_STATUS_ND_COMPLETE_SUCCESS: The most recent sanitize operation
5480 * for which No-Deallocate After Sanitize was
5481 * requested has completed successfully with
5482 * deallocation of all user data.
5483 * @NVME_SANITIZE_SSTAT_COMPLETED_PASSES_SHIFT: Shift amount to get the number
5484 * of completed passes if the most recent
5485 * sanitize operation was an Overwrite. This
5486 * value shall be cleared to 0h if the most
5487 * recent sanitize operation was not
5488 * an Overwrite.
5489 * @NVME_SANITIZE_SSTAT_COMPLETED_PASSES_MASK: Mask to get the number of completed
5490 * passes.
5491 * @NVME_SANITIZE_SSTAT_GLOBAL_DATA_ERASED_SHIFT: Shift amount to get the Global
5492 * Data Erased value from the
5493 * &struct nvme_sanitize_log_page.sstat field.
5494 * @NVME_SANITIZE_SSTAT_GLOBAL_DATA_ERASED_MASK: Mask to get the Global Data Erased
5495 * value.
5496 * @NVME_SANITIZE_SSTAT_GLOBAL_DATA_ERASED: Global Data Erased: if set, then no
5497 * namespace user data in the NVM subsystem
5498 * has been written to and no Persistent
5499 * Memory Region in the NVM subsystem has
5500 * been enabled since being manufactured and
5501 * the NVM subsystem has never been sanitized;
5502 * or since the most recent successful sanitize
5503 * operation.
5504 * @NVME_SANITIZE_SSTAT_MVCNCLD_SHIFT: Shift amount to get the value of Media Verification
5505 * Canceled bit of Sanitize status field.
5506 * @NVME_SANITIZE_SSTAT_MVCNCLD_MASK: Mask to get the value of Media Verification Canceled
5507 * bit of Sanitize status field.
5508 */
5509 enum nvme_sanitize_sstat {
5510 NVME_SANITIZE_SSTAT_STATUS_SHIFT = 0,
5511 NVME_SANITIZE_SSTAT_STATUS_MASK = 0x7,
5512 NVME_SANITIZE_SSTAT_STATUS_NEVER_SANITIZED = 0,
5513 NVME_SANITIZE_SSTAT_STATUS_COMPLETE_SUCCESS = 1,
5514 NVME_SANITIZE_SSTAT_STATUS_IN_PROGESS = 2,
5515 NVME_SANITIZE_SSTAT_STATUS_COMPLETED_FAILED = 3,
5516 NVME_SANITIZE_SSTAT_STATUS_ND_COMPLETE_SUCCESS = 4,
5517 NVME_SANITIZE_SSTAT_COMPLETED_PASSES_SHIFT = 3,
5518 NVME_SANITIZE_SSTAT_COMPLETED_PASSES_MASK = 0x1f,
5519 NVME_SANITIZE_SSTAT_GLOBAL_DATA_ERASED_SHIFT = 8,
5520 NVME_SANITIZE_SSTAT_GLOBAL_DATA_ERASED_MASK = 0x1,
5521 NVME_SANITIZE_SSTAT_GLOBAL_DATA_ERASED = 1 << NVME_SANITIZE_SSTAT_GLOBAL_DATA_ERASED_SHIFT,
5522 NVME_SANITIZE_SSTAT_MVCNCLD_SHIFT = 9,
5523 NVME_SANITIZE_SSTAT_MVCNCLD_MASK = 0x1,
5524 };
5525
5526 /**
5527 * enum nvme_sanitize_ssi - Sanitize State Information (SSI)
5528 * @NVME_SANITIZE_SSI_SANS_SHIFT: Shift amount to get the value of Sanitize State
5529 * from Sanitize State Information (SSI) field.
5530 * @NVME_SANITIZE_SSI_SANS_MASK: Mask to get the value of Sanitize State from
5531 * Sanitize State Information (SSI) field.
5532 * @NVME_SANITIZE_SSI_FAILS_SHIFT: Shift amount to get the value of Failure State
5533 * from Sanitize State Information (SSI) field.
5534 * @NVME_SANITIZE_SSI_FAILS_MASK: Mask to get the value of Failure State from
5535 * Sanitize State Information (SSI) field.
5536 * @NVME_SANITIZE_SSI_IDLE: No sanitize operation is in process.
5537 * @NVME_SANITIZE_SSI_RESTRICT_PROCESSING: The Sanitize operation is in Restricted Processing
5538 * State.
5539 * @NVME_SANITIZE_SSI_RESTRICT_FAILURE: The Sanitize operation is in Restricted Failure
5540 * State. This state is entered if sanitize processing
5541 * was performed in the Restricted Processing state and
5542 * sanitize processing failed or a failure occurred
5543 * during deallocation of media allocated for user data
5544 * in the Post-Verification Deallocation state.
5545 * @NVME_SANITIZE_SSI_UNRESTRICT_PROCESSING: The Sanitize operation is in Unrestricted Processing
5546 * State.
5547 * @NVME_SANITIZE_SSI_UNRESTRICT_FAILURE: The Sanitize operation is in Unrestricted Failure
5548 * State. This state is entered if sanitize processing
5549 * was performed in the Unrestricted Processing state
5550 * and sanitize processing failed or a failure occurred
5551 * during deallocation of media allocated for user data
5552 * in the Post-Verification.
5553 * @NVME_SANITIZE_SSI_MEDIA_VERIFICATION: The Sanitize operation is in Media Verification
5554 * State. In this state, the sanitize processing
5555 * completed successfully, and all media allocated for
5556 * user data in the sanitization target is readable by
5557 * the host for purposes of verifying sanitization.
5558 * @NVME_SANITIZE_SSI_POST_VERIF_DEALLOC: The Sanitize operation is in Post-Verification
5559 * Deallocation State. In this state, the controller
5560 * shall deallocate all media allocated for user data
5561 * in the sanitization target.
5562 */
5563 enum nvme_sanitize_ssi {
5564 NVME_SANITIZE_SSI_SANS_SHIFT = 0,
5565 NVME_SANITIZE_SSI_SANS_MASK = 0xf,
5566 NVME_SANITIZE_SSI_FAILS_SHIFT = 4,
5567 NVME_SANITIZE_SSI_FAILS_MASK = 0xf,
5568 NVME_SANITIZE_SSI_IDLE = 0,
5569 NVME_SANITIZE_SSI_RESTRICT_PROCESSING = 1,
5570 NVME_SANITIZE_SSI_RESTRICT_FAILURE = 2,
5571 NVME_SANITIZE_SSI_UNRESTRICT_PROCESSING = 3,
5572 NVME_SANITIZE_SSI_UNRESTRICT_FAILURE = 4,
5573 NVME_SANITIZE_SSI_MEDIA_VERIFICATION = 5,
5574 NVME_SANITIZE_SSI_POST_VERIF_DEALLOC = 6,
5575 };
5576
5577 /**
5578 * struct nvme_zns_changed_zone_log - ZNS Changed Zone List log
5579 * @nrzid: Number of Zone Identifiers
5580 * @rsvd2: Reserved
5581 * @zid: Zone Identifier
5582 */
5583 struct nvme_zns_changed_zone_log {
5584 __le16 nrzid;
5585 __u8 rsvd2[6];
5586 __le64 zid[NVME_ZNS_CHANGED_ZONES_MAX];
5587 };
5588
5589 /**
5590 * enum nvme_zns_zt - Zone Descriptor Data Structure - Zone Type
5591 * @NVME_ZONE_TYPE_SEQWRITE_REQ: Sequential Write Required
5592 */
5593 enum nvme_zns_zt {
5594 NVME_ZONE_TYPE_SEQWRITE_REQ = 0x2,
5595 };
5596
5597 /**
5598 * enum nvme_zns_za - Zone Descriptor Data Structure
5599 * @NVME_ZNS_ZA_ZFC: Zone Finished by Controller
5600 * @NVME_ZNS_ZA_FZR: Finish Zone Recommended
5601 * @NVME_ZNS_ZA_RZR: Reset Zone Recommended
5602 * @NVME_ZNS_ZA_ZRWAV:
5603 * @NVME_ZNS_ZA_ZDEV: Zone Descriptor Extension Valid
5604 */
5605 enum nvme_zns_za {
5606 NVME_ZNS_ZA_ZFC = 1 << 0,
5607 NVME_ZNS_ZA_FZR = 1 << 1,
5608 NVME_ZNS_ZA_RZR = 1 << 2,
5609 NVME_ZNS_ZA_ZRWAV = 1 << 3,
5610 NVME_ZNS_ZA_ZDEV = 1 << 7,
5611 };
5612
5613 /**
5614 * enum nvme_zns_zs - Zone Descriptor Data Structure - Zone State
5615 * @NVME_ZNS_ZS_EMPTY: Empty state
5616 * @NVME_ZNS_ZS_IMPL_OPEN: Implicitly open state
5617 * @NVME_ZNS_ZS_EXPL_OPEN: Explicitly open state
5618 * @NVME_ZNS_ZS_CLOSED: Closed state
5619 * @NVME_ZNS_ZS_READ_ONLY: Read only state
5620 * @NVME_ZNS_ZS_FULL: Full state
5621 * @NVME_ZNS_ZS_OFFLINE: Offline state
5622 */
5623 enum nvme_zns_zs {
5624 NVME_ZNS_ZS_EMPTY = 0x1,
5625 NVME_ZNS_ZS_IMPL_OPEN = 0x2,
5626 NVME_ZNS_ZS_EXPL_OPEN = 0x3,
5627 NVME_ZNS_ZS_CLOSED = 0x4,
5628 NVME_ZNS_ZS_READ_ONLY = 0xd,
5629 NVME_ZNS_ZS_FULL = 0xe,
5630 NVME_ZNS_ZS_OFFLINE = 0xf,
5631 };
5632
5633 /**
5634 * struct nvme_zns_desc - Zone Descriptor Data Structure
5635 * @zt: Zone Type
5636 * @zs: Zone State
5637 * @za: Zone Attributes
5638 * @zai: Zone Attributes Information
5639 * @rsvd4: Reserved
5640 * @zcap: Zone Capacity
5641 * @zslba: Zone Start Logical Block Address
5642 * @wp: Write Pointer
5643 * @rsvd32: Reserved
5644 */
5645 struct nvme_zns_desc {
5646 __u8 zt;
5647 __u8 zs;
5648 __u8 za;
5649 __u8 zai;
5650 __u8 rsvd4[4];
5651 __le64 zcap;
5652 __le64 zslba;
5653 __le64 wp;
5654 __u8 rsvd32[32];
5655 };
5656
5657 /**
5658 * struct nvme_zone_report - Report Zones Data Structure
5659 * @nr_zones: Number of descriptors in @entries
5660 * @rsvd8: Reserved
5661 * @entries: Zoned namespace descriptors
5662 */
5663 struct nvme_zone_report {
5664 __le64 nr_zones;
5665 __u8 rsvd8[56];
5666 struct nvme_zns_desc entries[];
5667 };
5668
5669 /**
5670 * enum nvme_fdp_ruh_type - Reclaim Unit Handle Type
5671 * @NVME_FDP_RUHT_INITIALLY_ISOLATED: Initially Isolated
5672 * @NVME_FDP_RUHT_PERSISTENTLY_ISOLATED: Persistently Isolated
5673 */
5674 enum nvme_fdp_ruh_type {
5675 NVME_FDP_RUHT_INITIALLY_ISOLATED = 1,
5676 NVME_FDP_RUHT_PERSISTENTLY_ISOLATED = 2,
5677 };
5678
5679 /**
5680 * struct nvme_fdp_ruh_desc - Reclaim Unit Handle Descriptor
5681 * @ruht: Reclaim Unit Handle Type
5682 * @rsvd1: Reserved
5683 */
5684 struct nvme_fdp_ruh_desc {
5685 __u8 ruht;
5686 __u8 rsvd1[3];
5687 };
5688
5689 /**
5690 * enum nvme_fdp_config_fdpa - FDP Attributes
5691 * @NVME_FDP_CONFIG_FDPA_RGIF_SHIFT: Reclaim Group Identifier Format Shift
5692 * @NVME_FDP_CONFIG_FDPA_RGIF_MASK: Reclaim Group Identifier Format Mask
5693 * @NVME_FDP_CONFIG_FDPA_FDPVWC_SHIFT: FDP Volatile Write Cache Shift
5694 * @NVME_FDP_CONFIG_FDPA_FDPVWC_MASK: FDP Volatile Write Cache Mask
5695 * @NVME_FDP_CONFIG_FDPA_VALID_SHIFT: FDP Configuration Valid Shift
5696 * @NVME_FDP_CONFIG_FDPA_VALID_MASK: FDP Configuration Valid Mask
5697 */
5698 enum nvme_fdp_config_fdpa {
5699 NVME_FDP_CONFIG_FDPA_RGIF_SHIFT = 0,
5700 NVME_FDP_CONFIG_FDPA_RGIF_MASK = 0xf,
5701 NVME_FDP_CONFIG_FDPA_FDPVWC_SHIFT = 4,
5702 NVME_FDP_CONFIG_FDPA_FDPVWC_MASK = 0x1,
5703 NVME_FDP_CONFIG_FDPA_VALID_SHIFT = 7,
5704 NVME_FDP_CONFIG_FDPA_VALID_MASK = 0x1,
5705 };
5706
5707 /**
5708 * enum nvme_lockdown_log_scope - lockdown log page scope attributes
5709 * @NVME_LOCKDOWN_ADMIN_CMD: Scope value for Admin commandS
5710 * @NVME_LOCKDOWN_FEATURE_ID: Scope value for Feature ID
5711 * @NVME_LOCKDOWN_MI_CMD_SET: Scope value for Management Interface commands
5712 * @NVME_LOCKDOWN_PCI_CMD_SET: Scope value for PCI commands
5713 */
5714 enum nvme_lockdown_log_scope {
5715 NVME_LOCKDOWN_ADMIN_CMD = 0x0,
5716 NVME_LOCKDOWN_FEATURE_ID = 0x2,
5717 NVME_LOCKDOWN_MI_CMD_SET = 0x3,
5718 NVME_LOCKDOWN_PCI_CMD_SET = 0x4,
5719 };
5720
5721 /**
5722 * enum nvme_lockdown_log_contents - lockdown log page content attributes
5723 * @NVME_LOCKDOWN_SUPPORTED_CMD: Content value for Supported commands
5724 * @NVME_LOCKDOWN_PROHIBITED_CMD: Content value for prohibited commands
5725 * @NVME_LOCKDOWN_PROHIBITED_OUTOFBAND_CMD: Content value for prohibited side band commands
5726 */
5727 enum nvme_lockdown_log_contents {
5728 NVME_LOCKDOWN_SUPPORTED_CMD = 0x0,
5729 NVME_LOCKDOWN_PROHIBITED_CMD = 0x1,
5730 NVME_LOCKDOWN_PROHIBITED_OUTOFBAND_CMD = 0x2,
5731 };
5732
5733 /**
5734 * enum nvme_lockdown_scope_contents - Lockdown Log shift and mask
5735 * @NVME_LOCKDOWN_SS_SHIFT: Lockdown log scope select Shift
5736 * @NVME_LOCKDOWN_SS_MASK: Lockdown log scope select Mask
5737 * @NVME_LOCKDOWN_CS_SHIFT: Lockdown log contents Shift
5738 * @NVME_LOCKDOWN_CS_MASK: Lockdown log contents Mask
5739 */
5740 enum nvme_lockdown_scope_contents {
5741 NVME_LOCKDOWN_SS_SHIFT = 0,
5742 NVME_LOCKDOWN_SS_MASK = 0xf,
5743 NVME_LOCKDOWN_CS_SHIFT = 4,
5744 NVME_LOCKDOWN_CS_MASK = 0x3,
5745 };
5746
5747 /**
5748 * struct nvme_fdp_config_desc - FDP Configuration Descriptor
5749 * @size: Descriptor size
5750 * @fdpa: FDP Attributes (&enum nvme_fdp_config_fdpa)
5751 * @vss: Vendor Specific Size
5752 * @nrg: Number of Reclaim Groups
5753 * @nruh: Number of Reclaim Unit Handles
5754 * @maxpids: Max Placement Identifiers
5755 * @nnss: Number of Namespaces Supported
5756 * @runs: Reclaim Unit Nominal Size
5757 * @erutl: Estimated Reclaim Unit Time Limit
5758 * @rsvd28: Reserved
5759 * @ruhs: Reclaim Unit Handle descriptors (&struct nvme_fdp_ruh_desc)
5760 */
5761 struct nvme_fdp_config_desc {
5762 __le16 size;
5763 __u8 fdpa;
5764 __u8 vss;
5765 __le32 nrg;
5766 __le16 nruh;
5767 __le16 maxpids;
5768 __le32 nnss;
5769 __le64 runs;
5770 __le32 erutl;
5771 __u8 rsvd28[36];
5772 struct nvme_fdp_ruh_desc ruhs[];
5773 };
5774
5775 /**
5776 * struct nvme_fdp_config_log - FDP Configurations Log Page
5777 * @n: Number of FDP Configurations
5778 * @version: Log page version
5779 * @rsvd3: Reserved
5780 * @size: Log page size in bytes
5781 * @rsvd8: Reserved
5782 * @configs: FDP Configuration descriptors (&struct nvme_fdp_config_desc)
5783 */
5784 struct nvme_fdp_config_log {
5785 __le16 n;
5786 __u8 version;
5787 __u8 rsvd3;
5788 __le32 size;
5789 __u8 rsvd8[8];
5790 struct nvme_fdp_config_desc configs[];
5791 };
5792
5793 /**
5794 * enum nvme_fdp_ruha - Reclaim Unit Handle Attributes
5795 * @NVME_FDP_RUHA_HOST_SHIFT: Host Specified Reclaim Unit Handle Shift
5796 * @NVME_FDP_RUHA_HOST_MASK: Host Specified Reclaim Unit Handle Mask
5797 * @NVME_FDP_RUHA_CTRL_SHIFT: Controller Specified Reclaim Unit Handle Shift
5798 * @NVME_FDP_RUHA_CTRL_MASK: Controller Specified Reclaim Unit Handle Mask
5799 */
5800 enum nvme_fdp_ruha {
5801 NVME_FDP_RUHA_HOST_SHIFT = 0,
5802 NVME_FDP_RUHA_HOST_MASK = 0x1,
5803 NVME_FDP_RUHA_CTRL_SHIFT = 1,
5804 NVME_FDP_RUHA_CTRL_MASK = 0x1,
5805 };
5806
5807 /**
5808 * struct nvme_fdp_ruhu_desc - Reclaim Unit Handle Usage Descriptor
5809 * @ruha: Reclaim Unit Handle Attributes (&enum nvme_fdp_ruha)
5810 * @rsvd1: Reserved
5811 */
5812 struct nvme_fdp_ruhu_desc {
5813 __u8 ruha;
5814 __u8 rsvd1[7];
5815 };
5816
5817 /**
5818 * struct nvme_fdp_ruhu_log - Reclaim Unit Handle Usage Log Page
5819 * @nruh: Number of Reclaim Unit Handles
5820 * @rsvd2: Reserved
5821 * @ruhus: Reclaim Unit Handle Usage descriptors
5822 */
5823 struct nvme_fdp_ruhu_log {
5824 __le16 nruh;
5825 __u8 rsvd2[6];
5826 struct nvme_fdp_ruhu_desc ruhus[];
5827 };
5828
5829 /**
5830 * struct nvme_fdp_stats_log - FDP Statistics Log Page
5831 * @hbmw: Host Bytes with Metadata Written
5832 * @mbmw: Media Bytes with Metadata Written
5833 * @mbe: Media Bytes Erased
5834 * @rsvd48: Reserved
5835 */
5836 struct nvme_fdp_stats_log {
5837 __u8 hbmw[16];
5838 __u8 mbmw[16];
5839 __u8 mbe[16];
5840 __u8 rsvd48[16];
5841 };
5842
5843 /**
5844 * enum nvme_fdp_event_type - FDP Event Types
5845 * @NVME_FDP_EVENT_RUNFW: Reclaim Unit Not Fully Written
5846 * @NVME_FDP_EVENT_RUTLE: Reclaim Unit Time Limit Exceeded
5847 * @NVME_FDP_EVENT_RESET: Controller Level Reset Modified Reclaim Unit Handles
5848 * @NVME_FDP_EVENT_PID: Invalid Placement Identifier
5849 * @NVME_FDP_EVENT_REALLOC: Media Reallocated
5850 * @NVME_FDP_EVENT_MODIFY: Implicitly Modified Reclaim Unit Handle
5851 */
5852 enum nvme_fdp_event_type {
5853 /* Host Events */
5854 NVME_FDP_EVENT_RUNFW = 0x0,
5855 NVME_FDP_EVENT_RUTLE = 0x1,
5856 NVME_FDP_EVENT_RESET = 0x2,
5857 NVME_FDP_EVENT_PID = 0x3,
5858
5859 /* Controller Events */
5860 NVME_FDP_EVENT_REALLOC = 0x80,
5861 NVME_FDP_EVENT_MODIFY = 0x81,
5862 };
5863
5864 /**
5865 * enum nvme_fdp_event_realloc_flags - Media Reallocated Event Type Specific Flags
5866 * @NVME_FDP_EVENT_REALLOC_F_LBAV: LBA Valid
5867 */
5868 enum nvme_fdp_event_realloc_flags {
5869 NVME_FDP_EVENT_REALLOC_F_LBAV = 1 << 0,
5870 };
5871
5872 /**
5873 * struct nvme_fdp_event_realloc - Media Reallocated Event Type Specific Information
5874 * @flags: Event Type Specific flags (&enum nvme_fdp_event_realloc_flags)
5875 * @rsvd1: Reserved
5876 * @nlbam: Number of LBAs Moved
5877 * @lba: Logical Block Address
5878 * @rsvd12: Reserved
5879 */
5880 struct nvme_fdp_event_realloc {
5881 __u8 flags;
5882 __u8 rsvd1;
5883 __le16 nlbam;
5884 __le64 lba;
5885 __u8 rsvd12[4];
5886 };
5887
5888 /**
5889 * enum nvme_fdp_event_flags - FDP Event Flags
5890 * @NVME_FDP_EVENT_F_PIV: Placement Identifier Valid
5891 * @NVME_FDP_EVENT_F_NSIDV: Namespace Identifier Valid
5892 * @NVME_FDP_EVENT_F_LV: Location Valid
5893 */
5894 enum nvme_fdp_event_flags {
5895 NVME_FDP_EVENT_F_PIV = 1 << 0,
5896 NVME_FDP_EVENT_F_NSIDV = 1 << 1,
5897 NVME_FDP_EVENT_F_LV = 1 << 2,
5898 };
5899
5900 /**
5901 * struct nvme_fdp_event - FDP Event
5902 * @type: Event Type (&enum nvme_fdp_event_type)
5903 * @flags: Event Flags (&enum nvme_fdp_event_flags)
5904 * @pid: Placement Identifier
5905 * @ts: Timestamp
5906 * @nsid: Namespace Identifier
5907 * @type_specific: Event Type Specific Information
5908 * @rgid: Reclaim Group Identifier
5909 * @ruhid: Reclaim Unit Handle Identifier
5910 * @rsvd35: Reserved
5911 * @vs: Vendor Specific
5912 */
5913 struct nvme_fdp_event {
5914 __u8 type;
5915 __u8 flags;
5916 __le16 pid;
5917 struct nvme_timestamp ts;
5918 __le32 nsid;
5919 __u8 type_specific[16];
5920 __le16 rgid;
5921 __u8 ruhid;
5922 __u8 rsvd35[5];
5923 __u8 vs[24];
5924 };
5925
5926 /**
5927 * struct nvme_fdp_events_log - FDP Events Log Page
5928 * @n: Number of FDP Events
5929 * @rsvd4: Reserved
5930 * @events: FDP Events (&struct nvme_fdp_event)
5931 */
5932 struct nvme_fdp_events_log {
5933 __le32 n;
5934 __u8 rsvd4[60];
5935 struct nvme_fdp_event events[63];
5936 };
5937
5938 /**
5939 * struct nvme_feat_fdp_events_cdw11 - FDP Events Feature Command Dword 11
5940 * Deprecated: doesn't support this struct.
5941 * Use NVME_FEAT_FDPE_*** definitions instead.
5942 * @phndl: Placement Handle
5943 * @noet: Number of FDP Event Types
5944 * @rsvd24: Reserved
5945 */
5946 struct nvme_feat_fdp_events_cdw11 {
5947 __le16 phndl;
5948 __u8 noet;
5949 __u8 rsvd24;
5950 } __attribute__((deprecated));
5951
5952 /**
5953 * enum nvme_fdp_supported_event_attributes - Supported FDP Event Attributes
5954 * @NVME_FDP_SUPP_EVENT_ENABLED_SHIFT: FDP Event Enable Shift
5955 * @NVME_FDP_SUPP_EVENT_ENABLED_MASK: FDP Event Enable Mask
5956 */
5957 enum nvme_fdp_supported_event_attributes {
5958 NVME_FDP_SUPP_EVENT_ENABLED_SHIFT = 0,
5959 NVME_FDP_SUPP_EVENT_ENABLED_MASK = 0x1,
5960 };
5961
5962 /**
5963 * struct nvme_fdp_supported_event_desc - Supported FDP Event Descriptor
5964 * @evt: FDP Event Type
5965 * @evta: FDP Event Type Attributes (&enum nvme_fdp_supported_event_attributes)
5966 */
5967 struct nvme_fdp_supported_event_desc {
5968 __u8 evt;
5969 __u8 evta;
5970 };
5971
5972 /**
5973 * struct nvme_fdp_ruh_status_desc - Reclaim Unit Handle Status Descriptor
5974 * @pid: Placement Identifier
5975 * @ruhid: Reclaim Unit Handle Identifier
5976 * @earutr: Estimated Active Reclaim Unit Time Remaining
5977 * @ruamw: Reclaim Unit Available Media Writes
5978 * @rsvd16: Reserved
5979 */
5980 struct nvme_fdp_ruh_status_desc {
5981 __le16 pid;
5982 __le16 ruhid;
5983 __le32 earutr;
5984 __le64 ruamw;
5985 __u8 rsvd16[16];
5986 };
5987
5988 /**
5989 * struct nvme_fdp_ruh_status - Reclaim Unit Handle Status
5990 * @rsvd0: Reserved
5991 * @nruhsd: Number of Reclaim Unit Handle Status Descriptors
5992 * @ruhss: Reclaim Unit Handle Status descriptors
5993 */
5994 struct nvme_fdp_ruh_status {
5995 __u8 rsvd0[14];
5996 __le16 nruhsd;
5997 struct nvme_fdp_ruh_status_desc ruhss[];
5998 };
5999
6000 /**
6001 * struct nvme_lba_status_desc - LBA Status Descriptor Entry
6002 * @dslba: Descriptor Starting LBA
6003 * @nlb: Number of Logical Blocks
6004 * @rsvd12: Reserved
6005 * @status: Additional status about this LBA range
6006 * @rsvd14: Reserved
6007 */
6008 struct nvme_lba_status_desc {
6009 __le64 dslba;
6010 __le32 nlb;
6011 __u8 rsvd12;
6012 __u8 status;
6013 __u8 rsvd14[2];
6014 };
6015
6016 /**
6017 * struct nvme_lba_status - LBA Status Descriptor List
6018 * @nlsd: Number of LBA Status Descriptors
6019 * @cmpc: Completion Condition
6020 * @rsvd5: Reserved
6021 * @descs: LBA status descriptor Entry
6022 */
6023 struct nvme_lba_status {
6024 __le32 nlsd;
6025 __u8 cmpc;
6026 __u8 rsvd5[3];
6027 struct nvme_lba_status_desc descs[];
6028 };
6029
6030 /**
6031 * enum nvme_lba_status_cmpc - Get LBA Status Command Completion Condition
6032 * @NVME_LBA_STATUS_CMPC_NO_CMPC: No indication of the completion condition
6033 * @NVME_LBA_STATUS_CMPC_INCOMPLETE: Command completed, but additional LBA Status
6034 * Descriptor Entries are available to transfer
6035 * or scan did not complete (if ATYPE = 10h)
6036 * @NVME_LBA_STATUS_CMPC_COMPLETE: Completed the specified action over the number
6037 * of LBAs specified in the Range Length field and
6038 * transferred all available LBA Status Descriptors
6039 */
6040 enum nvme_lba_status_cmpc {
6041 NVME_LBA_STATUS_CMPC_NO_CMPC = 0x0,
6042 NVME_LBA_STATUS_CMPC_INCOMPLETE = 0x1,
6043 NVME_LBA_STATUS_CMPC_COMPLETE = 0x2,
6044 };
6045
6046 /**
6047 * struct nvme_feat_auto_pst - Autonomous Power State Transition
6048 * @apst_entry: See &enum nvme_apst_entry
6049 */
6050 struct nvme_feat_auto_pst {
6051 __le64 apst_entry[32];
6052 };
6053
6054 /**
6055 * enum nvme_apst_entry - Autonomous Power State Transition
6056 * @NVME_APST_ENTRY_ITPS_SHIFT: Idle Transition Power State Shift
6057 * @NVME_APST_ENTRY_ITPT_SHIFT: Idle Time Prior to Transition Shift
6058 * @NVME_APST_ENTRY_ITPS_MASK: Idle Transition Power State Mask
6059 * @NVME_APST_ENTRY_ITPT_MASK: Idle Time Prior to Transition Mask
6060 */
6061 enum nvme_apst_entry {
6062 NVME_APST_ENTRY_ITPS_SHIFT = 3,
6063 NVME_APST_ENTRY_ITPT_SHIFT = 8,
6064 NVME_APST_ENTRY_ITPS_MASK = 0x1f,
6065 NVME_APST_ENTRY_ITPT_MASK = 0xffffff,
6066 };
6067
6068 /**
6069 * struct nvme_std_perf_attr - Standard performance attribute structure
6070 * @rsvd0: Reserved
6071 * @r4karl: Random 4 KiB average read latency
6072 * @rsvd5: Reserved
6073 */
6074 struct nvme_std_perf_attr {
6075 __u8 rsvd0[4];
6076 __u8 r4karl;
6077 __u8 rsvd5[4091];
6078 };
6079
6080 /**
6081 * struct nvme_perf_attr_id - Performance attribute identifier structure
6082 * @id: Performance attribute identifier
6083 */
6084 struct nvme_perf_attr_id {
6085 __u8 id[NVME_UUID_LEN];
6086 };
6087
6088 /**
6089 * struct nvme_perf_attr_id_list - Performance attribute identifier list structure
6090 * @attrtyp: Bits 7-3: Reserved
6091 * Bits 2-0: Attribute type
6092 * @msvspa: Maximum saveable vendor specific performance attributes
6093 * @usvspa: Unused saveable vendor specific performance attributes
6094 * @rsvd3: Reserved
6095 * @id_list: Performance attribute identifier list
6096 * @rsvd1024: Reserved
6097 */
6098 struct nvme_perf_attr_id_list {
6099 __u8 attrtyp;
6100 __u8 msvspa;
6101 __u8 usvspa;
6102 __u8 rsvd3[13];
6103 struct nvme_perf_attr_id id_list[63];
6104 __u8 rsvd1024[3072];
6105 };
6106
6107 /**
6108 * struct nvme_vs_perf_attr - Vendor specific performance attribute structure
6109 * @paid: Performance attribute identifier
6110 * @rsvd16: Reserved
6111 * @attrl: Attribute Length
6112 * @vs: Vendor specific
6113 */
6114 struct nvme_vs_perf_attr {
6115 __u8 paid[16];
6116 __u8 rsvd16[14];
6117 __le16 attrl;
6118 __u8 vs[4064];
6119 };
6120
6121 /**
6122 * struct nvme_perf_characteristics - Performance attribute structure
6123 * @std_perf: Standard performance attribute
6124 * @id_list: Performance attribute identifier list
6125 * @vs_perf: Vendor specific performance attribute
6126 * @attr_buf: Attribute buffer
6127 */
6128 struct nvme_perf_characteristics {
6129 union {
6130 struct nvme_std_perf_attr std_perf[0];
6131 struct nvme_perf_attr_id_list id_list[0];
6132 struct nvme_vs_perf_attr vs_perf[0];
6133 __u8 attr_buf[4096];
6134 };
6135 };
6136
6137 /**
6138 * struct nvme_metadata_element_desc - Metadata Element Descriptor
6139 * @type: Element Type (ET)
6140 * @rev: Element Revision (ER)
6141 * @len: Element Length (ELEN)
6142 * @val: Element Value (EVAL), UTF-8 string
6143 */
6144 struct nvme_metadata_element_desc {
6145 __u8 type;
6146 __u8 rev;
6147 __le16 len;
6148 __u8 val[0];
6149 };
6150
6151 /**
6152 * struct nvme_host_metadata - Host Metadata Data Structure
6153 * @ndesc: Number of metadata element descriptors
6154 * @rsvd1: Reserved
6155 * @descs: Metadata element descriptors
6156 * @descs_buf: Metadata element descriptor buffer
6157 */
6158 struct nvme_host_metadata {
6159 __u8 ndesc;
6160 __u8 rsvd1;
6161 union {
6162 struct nvme_metadata_element_desc descs[0];
6163 __u8 descs_buf[4094];
6164 };
6165 };
6166
6167 /**
6168 * enum nvme_ctrl_metadata_type - Controller Metadata Element Types
6169 * @NVME_CTRL_METADATA_OS_CTRL_NAME: Name of the controller in
6170 * the operating system.
6171 * @NVME_CTRL_METADATA_OS_DRIVER_NAME: Name of the driver in the
6172 * operating system.
6173 * @NVME_CTRL_METADATA_OS_DRIVER_VER: Version of the driver in
6174 * the operating system.
6175 * @NVME_CTRL_METADATA_PRE_BOOT_CTRL_NAME: Name of the controller in
6176 * the pre-boot environment.
6177 * @NVME_CTRL_METADATA_PRE_BOOT_DRIVER_NAME: Name of the driver in the
6178 * pre-boot environment.
6179 * @NVME_CTRL_METADATA_PRE_BOOT_DRIVER_VER: Version of the driver in the
6180 * pre-boot environment.
6181 * @NVME_CTRL_METADATA_SYS_PROC_MODEL: Model of the processor.
6182 * @NVME_CTRL_METADATA_CHIPSET_DRV_NAME: Chipset driver name.
6183 * @NVME_CTRL_METADATA_CHIPSET_DRV_VERSION: Chipset driver version.
6184 * @NVME_CTRL_METADATA_OS_NAME_AND_BUILD: Operating system name and build.
6185 * @NVME_CTRL_METADATA_SYS_PROD_NAME: System product name.
6186 * @NVME_CTRL_METADATA_FIRMWARE_VERSION: Host firmware (e.g UEFI) version.
6187 * @NVME_CTRL_METADATA_OS_DRIVER_FILENAME: Operating system driver filename.
6188 * @NVME_CTRL_METADATA_DISPLAY_DRV_NAME: Display driver name.
6189 * @NVME_CTRL_METADATA_DISPLAY_DRV_VERSION: Display driver version.
6190 * @NVME_CTRL_METADATA_HOST_DET_FAIL_REC: Failure record.
6191 */
6192 enum nvme_ctrl_metadata_type {
6193 NVME_CTRL_METADATA_OS_CTRL_NAME = 0x01,
6194 NVME_CTRL_METADATA_OS_DRIVER_NAME = 0x02,
6195 NVME_CTRL_METADATA_OS_DRIVER_VER = 0x03,
6196 NVME_CTRL_METADATA_PRE_BOOT_CTRL_NAME = 0x04,
6197 NVME_CTRL_METADATA_PRE_BOOT_DRIVER_NAME = 0x05,
6198 NVME_CTRL_METADATA_PRE_BOOT_DRIVER_VER = 0x06,
6199 NVME_CTRL_METADATA_SYS_PROC_MODEL = 0x07,
6200 NVME_CTRL_METADATA_CHIPSET_DRV_NAME = 0x08,
6201 NVME_CTRL_METADATA_CHIPSET_DRV_VERSION = 0x09,
6202 NVME_CTRL_METADATA_OS_NAME_AND_BUILD = 0x0a,
6203 NVME_CTRL_METADATA_SYS_PROD_NAME = 0x0b,
6204 NVME_CTRL_METADATA_FIRMWARE_VERSION = 0x0c,
6205 NVME_CTRL_METADATA_OS_DRIVER_FILENAME = 0x0d,
6206 NVME_CTRL_METADATA_DISPLAY_DRV_NAME = 0x0e,
6207 NVME_CTRL_METADATA_DISPLAY_DRV_VERSION = 0x0f,
6208 NVME_CTRL_METADATA_HOST_DET_FAIL_REC = 0x10,
6209 };
6210
6211 /**
6212 * enum nvme_ns_metadata_type - Namespace Metadata Element Types
6213 * @NVME_NS_METADATA_OS_NS_NAME: Name of the namespace in the
6214 * operating system
6215 * @NVME_NS_METADATA_PRE_BOOT_NS_NAME: Name of the namespace in the pre-boot
6216 * environment.
6217 * @NVME_NS_METADATA_OS_NS_QUAL_1: First qualifier of the Operating System
6218 * Namespace Name.
6219 * @NVME_NS_METADATA_OS_NS_QUAL_2: Second qualifier of the Operating System
6220 * Namespace Name.
6221 */
6222 enum nvme_ns_metadata_type {
6223 NVME_NS_METADATA_OS_NS_NAME = 0x01,
6224 NVME_NS_METADATA_PRE_BOOT_NS_NAME = 0x02,
6225 NVME_NS_METADATA_OS_NS_QUAL_1 = 0x03,
6226 NVME_NS_METADATA_OS_NS_QUAL_2 = 0x04,
6227 };
6228
6229 /**
6230 * struct nvme_lba_range_type_entry - LBA Range Type - Data Structure Entry
6231 * @type: Specifies the Type of the LBA range
6232 * @attributes: Specifies attributes of the LBA range
6233 * @rsvd2: Reserved
6234 * @slba: Starting LBA
6235 * @nlb: Number of Logical Blocks
6236 * @guid: Unique Identifier
6237 * @rsvd48: Reserved
6238 */
6239 struct nvme_lba_range_type_entry {
6240 __u8 type;
6241 __u8 attributes;
6242 __u8 rsvd2[14];
6243 __le64 slba;
6244 __le64 nlb;
6245 __u8 guid[16];
6246 __u8 rsvd48[16];
6247 };
6248
6249 /**
6250 * enum nvme_lbart - LBA Range Type - Data Structure Entry
6251 * @NVME_LBART_TYPE_GP: General Purpose
6252 * @NVME_LBART_TYPE_FS: Filesystem
6253 * @NVME_LBART_TYPE_RAID: RAID
6254 * @NVME_LBART_TYPE_CACHE: Cache
6255 * @NVME_LBART_TYPE_SWAP: Page / swap file
6256 * @NVME_LBART_ATTRIB_TEMP: Temp
6257 * @NVME_LBART_ATTRIB_HIDE: Hidden
6258 */
6259 enum nvme_lbart {
6260 NVME_LBART_TYPE_GP = 0,
6261 NVME_LBART_TYPE_FS = 1,
6262 NVME_LBART_TYPE_RAID = 2,
6263 NVME_LBART_TYPE_CACHE = 3,
6264 NVME_LBART_TYPE_SWAP = 4,
6265 NVME_LBART_ATTRIB_TEMP = 1 << 0,
6266 NVME_LBART_ATTRIB_HIDE = 1 << 1,
6267 };
6268
6269 /**
6270 * struct nvme_lba_range_type - LBA Range Type
6271 * @entry: LBA range type entry. See @struct nvme_lba_range_type_entry
6272 */
6273 struct nvme_lba_range_type {
6274 struct nvme_lba_range_type_entry entry[NVME_FEAT_LBA_RANGE_MAX];
6275 };
6276
6277 /**
6278 * struct nvme_plm_config - Predictable Latency Mode - Deterministic Threshold Configuration Data Structure
6279 * @ee: Enable Event
6280 * @rsvd2: Reserved
6281 * @dtwinrt: DTWIN Reads Threshold
6282 * @dtwinwt: DTWIN Writes Threshold
6283 * @dtwintt: DTWIN Time Threshold
6284 * @rsvd56: Reserved
6285 */
6286 struct nvme_plm_config {
6287 __le16 ee;
6288 __u8 rsvd2[30];
6289 __le64 dtwinrt;
6290 __le64 dtwinwt;
6291 __le64 dtwintt;
6292 __u8 rsvd56[456];
6293 };
6294
6295 /**
6296 * struct nvme_feat_host_behavior - Host Behavior Support - Data Structure
6297 * @acre: Advanced Command Retry Enable
6298 * @etdas: Extended Telemetry Data Area 4 Supported
6299 * @lbafee: LBA Format Extension Enable
6300 * @hdisns: Host Dispersed Namespace Support
6301 * @cdfe: Copy Descriptor Formats Enable
6302 * @rsvd6: Reserved
6303 */
6304 struct nvme_feat_host_behavior {
6305 __u8 acre;
6306 __u8 etdas;
6307 __u8 lbafee;
6308 __u8 hdisns;
6309 __le16 cdfe;
6310 __u8 rsvd6[506];
6311 };
6312
6313 /**
6314 * enum nvme_host_behavior_support - Enable Advanced Command
6315 * @NVME_ENABLE_ACRE: Enable Advanced Command Retry Enable
6316 */
6317 enum nvme_host_behavior_support {
6318 NVME_ENABLE_ACRE = 1 << 0,
6319 };
6320
6321 /**
6322 * struct nvme_dsm_range - Dataset Management - Range Definition
6323 * @cattr: Context Attributes
6324 * @nlb: Length in logical blocks
6325 * @slba: Starting LBA
6326 */
6327 struct nvme_dsm_range {
6328 __le32 cattr;
6329 __le32 nlb;
6330 __le64 slba;
6331 };
6332
6333 /**
6334 * struct nvme_copy_range - Copy - Source Range Entries Descriptor Format
6335 * @rsvd0: Reserved
6336 * @slba: Starting LBA
6337 * @nlb: Number of Logical Blocks
6338 * @rsvd18: Reserved
6339 * @eilbrt: Expected Initial Logical Block Reference Tag /
6340 * Expected Logical Block Storage Tag
6341 * @elbatm: Expected Logical Block Application Tag Mask
6342 * @elbat: Expected Logical Block Application Tag
6343 */
6344 struct nvme_copy_range {
6345 __u8 rsvd0[8];
6346 __le64 slba;
6347 __le16 nlb;
6348 __u8 rsvd18[6];
6349 __le32 eilbrt;
6350 __le16 elbat;
6351 __le16 elbatm;
6352 };
6353
6354 /**
6355 * struct nvme_copy_range_f1 - Copy - Source Range Entries Descriptor Format 1h
6356 * @rsvd0: Reserved
6357 * @slba: Starting LBA
6358 * @nlb: Number of Logical Blocks
6359 * @rsvd18: Reserved
6360 * @elbt: Expected Initial Logical Block Reference Tag /
6361 * Expected Logical Block Storage Tag
6362 * @elbatm: Expected Logical Block Application Tag Mask
6363 * @elbat: Expected Logical Block Application Tag
6364 */
6365 struct nvme_copy_range_f1 {
6366 __u8 rsvd0[8];
6367 __le64 slba;
6368 __le16 nlb;
6369 __u8 rsvd18[8];
6370 __u8 elbt[10];
6371 __le16 elbat;
6372 __le16 elbatm;
6373 };
6374
6375 /**
6376 * enum nvme_copy_range_sopt - NVMe Copy Range Source Options
6377 * @NVME_COPY_SOPT_FCO: NVMe Copy Source Option Fast Copy Only
6378 */
6379 enum nvme_copy_range_sopt {
6380 NVME_COPY_SOPT_FCO = 1 << 15,
6381 };
6382
6383 /**
6384 * struct nvme_copy_range_f2 - Copy - Source Range Entries Descriptor Format 2h
6385 * @snsid: Source Namespace Identifier
6386 * @rsvd4: Reserved
6387 * @slba: Starting LBA
6388 * @nlb: Number of Logical Blocks
6389 * @rsvd18: Reserved
6390 * @sopt: Source Options
6391 * @eilbrt: Expected Initial Logical Block Reference Tag /
6392 * Expected Logical Block Storage Tag
6393 * @elbatm: Expected Logical Block Application Tag Mask
6394 * @elbat: Expected Logical Block Application Tag
6395 */
6396 struct nvme_copy_range_f2 {
6397 __le32 snsid;
6398 __u8 rsvd4[4];
6399 __le64 slba;
6400 __le16 nlb;
6401 __u8 rsvd18[4];
6402 __le16 sopt;
6403 __le32 eilbrt;
6404 __le16 elbat;
6405 __le16 elbatm;
6406 };
6407
6408 /**
6409 * struct nvme_copy_range_f3 - Copy - Source Range Entries Descriptor Format 3h
6410 * @snsid: Source Namespace Identifier
6411 * @rsvd4: Reserved
6412 * @slba: Starting LBA
6413 * @nlb: Number of Logical Blocks
6414 * @rsvd18: Reserved
6415 * @sopt: Source Options
6416 * @rsvd24: Reserved
6417 * @elbt: Expected Initial Logical Block Reference Tag /
6418 * Expected Logical Block Storage Tag
6419 * @elbatm: Expected Logical Block Application Tag Mask
6420 * @elbat: Expected Logical Block Application Tag
6421 */
6422 struct nvme_copy_range_f3 {
6423 __le32 snsid;
6424 __u8 rsvd4[4];
6425 __le64 slba;
6426 __le16 nlb;
6427 __u8 rsvd18[4];
6428 __le16 sopt;
6429 __u8 rsvd24[2];
6430 __u8 elbt[10];
6431 __le16 elbat;
6432 __le16 elbatm;
6433 };
6434
6435 /**
6436 * struct nvme_registered_ctrl - Registered Controller Data Structure
6437 * @cntlid: Controller ID
6438 * @rcsts: Reservation Status
6439 * @rsvd3: Reserved
6440 * @hostid: Host Identifier
6441 * @rkey: Reservation Key
6442 */
6443 struct nvme_registered_ctrl {
6444 __le16 cntlid;
6445 __u8 rcsts;
6446 __u8 rsvd3[5];
6447 __le64 hostid;
6448 __le64 rkey;
6449 };
6450
6451 /**
6452 * struct nvme_registered_ctrl_ext - Registered Controller Extended Data Structure
6453 * @cntlid: Controller ID
6454 * @rcsts: Reservation Status
6455 * @rsvd3: Reserved
6456 * @rkey: Reservation Key
6457 * @hostid: Host Identifier
6458 * @rsvd32: Reserved
6459 */
6460 struct nvme_registered_ctrl_ext {
6461 __le16 cntlid;
6462 __u8 rcsts;
6463 __u8 rsvd3[5];
6464 __le64 rkey;
6465 __u8 hostid[16];
6466 __u8 rsvd32[32];
6467 };
6468
6469 /**
6470 * struct nvme_resv_status - Reservation Status Data Structure
6471 * @gen: Generation
6472 * @rtype: Reservation Type
6473 * @regctl: Number of Registered Controllers
6474 * @rsvd7: Reserved
6475 * @ptpls: Persist Through Power Loss State
6476 * @rsvd10: Reserved
6477 * @rsvd24: Reserved
6478 * @regctl_eds: Registered Controller Extended Data Structure
6479 * @regctl_ds: Registered Controller Data Structure
6480 */
6481 struct nvme_resv_status {
6482 __le32 gen;
6483 __u8 rtype;
6484 __u8 regctl[2];
6485 __u8 rsvd7[2];
6486 __u8 ptpls;
6487 __u8 rsvd10[14];
6488 union {
6489 struct {
6490 __u8 rsvd24[40];
6491 struct nvme_registered_ctrl_ext regctl_eds[0];
6492 };
6493 struct nvme_registered_ctrl regctl_ds[0];
6494 };
6495 };
6496
6497 /**
6498 * struct nvme_streams_directive_params - Streams Directive - Return Parameters Data Structure
6499 * @msl: Max Streams Limit
6500 * @nssa: NVM Subsystem Streams Available
6501 * @nsso: NVM Subsystem Streams Open
6502 * @nssc: NVM Subsystem Stream Capability
6503 * @rsvd: Reserved
6504 * @sws: Stream Write Size
6505 * @sgs: Stream Granularity Size
6506 * @nsa: Namespace Streams Allocated
6507 * @nso: Namespace Streams Open
6508 * @rsvd2: Reserved
6509 */
6510 struct nvme_streams_directive_params {
6511 __le16 msl;
6512 __le16 nssa;
6513 __le16 nsso;
6514 __u8 nssc;
6515 __u8 rsvd[9];
6516 __le32 sws;
6517 __le16 sgs;
6518 __le16 nsa;
6519 __le16 nso;
6520 __u8 rsvd2[6];
6521 };
6522
6523 /**
6524 * struct nvme_streams_directive_status - Streams Directive - Get Status Data Structure
6525 * @osc: Open Stream Count
6526 * @sid: Stream Identifier
6527 */
6528 struct nvme_streams_directive_status {
6529 __le16 osc;
6530 __le16 sid[];
6531 };
6532
6533 /**
6534 * struct nvme_id_directives - Identify Directive - Return Parameters Data Structure
6535 * @supported: Identify directive is supported
6536 * @enabled: Identify directive is Enabled
6537 * @rsvd64: Reserved
6538 */
6539 struct nvme_id_directives {
6540 __u8 supported[32];
6541 __u8 enabled[32];
6542 __u8 rsvd64[4032];
6543 };
6544
6545 /**
6546 * enum nvme_directive_types - Directives Supported or Enabled
6547 * @NVME_ID_DIR_ID_BIT: Identify directive is supported
6548 * @NVME_ID_DIR_SD_BIT: Streams directive is supported
6549 * @NVME_ID_DIR_DP_BIT: Direct Placement directive is supported
6550 */
6551 enum nvme_directive_types {
6552 NVME_ID_DIR_ID_BIT = 0,
6553 NVME_ID_DIR_SD_BIT = 1,
6554 NVME_ID_DIR_DP_BIT = 2,
6555 };
6556
6557 /**
6558 * struct nvme_host_mem_buf_attrs - Host Memory Buffer - Attributes Data Structure
6559 * @hsize: Host Memory Buffer Size
6560 * @hmdlal: Host Memory Descriptor List Lower Address
6561 * @hmdlau: Host Memory Descriptor List Upper Address
6562 * @hmdlec: Host Memory Descriptor List Entry Count
6563 * @rsvd16: Reserved
6564 */
6565 struct nvme_host_mem_buf_attrs {
6566 __le32 hsize;
6567 __le32 hmdlal;
6568 __le32 hmdlau;
6569 __le32 hmdlec;
6570 __u8 rsvd16[4080];
6571
6572 };
6573
6574 /**
6575 * enum nvme_ae_type - Asynchronous Event Type
6576 * @NVME_AER_ERROR: Error event
6577 * @NVME_AER_SMART: SMART / Health Status event
6578 * @NVME_AER_NOTICE: Notice event
6579 * @NVME_AER_IMMEDIATE: Immediate
6580 * @NVME_AER_ONESHOT: One-Shot
6581 * @NVME_AER_CSS: NVM Command Set Specific events
6582 * @NVME_AER_VS: Vendor Specific event
6583 */
6584 enum nvme_ae_type {
6585 NVME_AER_ERROR = 0,
6586 NVME_AER_SMART = 1,
6587 NVME_AER_NOTICE = 2,
6588 NVME_AER_IMMEDIATE = 3,
6589 NVME_AER_ONESHOT = 4,
6590 NVME_AER_CSS = 6,
6591 NVME_AER_VS = 7,
6592 };
6593
6594 /**
6595 * enum nvme_ae_info_error - Asynchronous Event Information - Error Status
6596 * @NVME_AER_ERROR_INVALID_DB_REG: Write to Invalid Doorbell Register
6597 * @NVME_AER_ERROR_INVALID_DB_VAL: Invalid Doorbell Write Value
6598 * @NVME_AER_ERROR_DIAG_FAILURE: Diagnostic Failure
6599 * @NVME_AER_ERROR_PERSISTENT_INTERNAL_ERROR: Persistent Internal Error
6600 * @NVME_AER_ERROR_TRANSIENT_INTERNAL_ERROR: Transient Internal Error
6601 * @NVME_AER_ERROR_FW_IMAGE_LOAD_ERROR: Firmware Image Load Error
6602 */
6603 enum nvme_ae_info_error {
6604 NVME_AER_ERROR_INVALID_DB_REG = 0x00,
6605 NVME_AER_ERROR_INVALID_DB_VAL = 0x01,
6606 NVME_AER_ERROR_DIAG_FAILURE = 0x02,
6607 NVME_AER_ERROR_PERSISTENT_INTERNAL_ERROR = 0x03,
6608 NVME_AER_ERROR_TRANSIENT_INTERNAL_ERROR = 0x04,
6609 NVME_AER_ERROR_FW_IMAGE_LOAD_ERROR = 0x05,
6610 };
6611
6612 /**
6613 * enum nvme_ae_info_smart - Asynchronous Event Information - SMART / Health Status
6614 * @NVME_AER_SMART_SUBSYSTEM_RELIABILITY: NVM subsystem Reliability
6615 * @NVME_AER_SMART_TEMPERATURE_THRESHOLD: Temperature Threshold
6616 * @NVME_AER_SMART_SPARE_THRESHOLD: Spare Below Threshold
6617 */
6618 enum nvme_ae_info_smart {
6619 NVME_AER_SMART_SUBSYSTEM_RELIABILITY = 0x00,
6620 NVME_AER_SMART_TEMPERATURE_THRESHOLD = 0x01,
6621 NVME_AER_SMART_SPARE_THRESHOLD = 0x02,
6622 };
6623
6624 /**
6625 * enum nvme_ae_info_css_nvm - Asynchronous Event Information - I/O Command Specific Status
6626 * @NVME_AER_CSS_NVM_RESERVATION: Reservation Log Page Available
6627 * @NVME_AER_CSS_NVM_SANITIZE_COMPLETED: Sanitize Operation Completed
6628 * @NVME_AER_CSS_NVM_UNEXPECTED_SANITIZE_DEALLOC: Sanitize Operation Completed
6629 * With Unexpected Deallocation
6630 */
6631 enum nvme_ae_info_css_nvm {
6632 NVME_AER_CSS_NVM_RESERVATION = 0x00,
6633 NVME_AER_CSS_NVM_SANITIZE_COMPLETED = 0x01,
6634 NVME_AER_CSS_NVM_UNEXPECTED_SANITIZE_DEALLOC = 0x02,
6635 };
6636
6637 /**
6638 * enum nvme_ae_info_notice - Asynchronous Event Information - Notice
6639 * @NVME_AER_NOTICE_NS_CHANGED: Namespace Attribute Changed
6640 * @NVME_AER_NOTICE_FW_ACT_STARTING: Firmware Activation Starting
6641 * @NVME_AER_NOTICE_TELEMETRY: Telemetry Log Changed
6642 * @NVME_AER_NOTICE_ANA: Asymmetric Namespace Access Change
6643 * @NVME_AER_NOTICE_PL_EVENT: Predictable Latency Event Aggregate Log Change
6644 * @NVME_AER_NOTICE_LBA_STATUS_ALERT: LBA Status Information Alert
6645 * @NVME_AER_NOTICE_EG_EVENT: Endurance Group Event Aggregate Log Page Change
6646 * @NVME_AER_NOTICE_DISC_CHANGED: Discovery Log Page Change
6647 */
6648 enum nvme_ae_info_notice {
6649 NVME_AER_NOTICE_NS_CHANGED = 0x00,
6650 NVME_AER_NOTICE_FW_ACT_STARTING = 0x01,
6651 NVME_AER_NOTICE_TELEMETRY = 0x02,
6652 NVME_AER_NOTICE_ANA = 0x03,
6653 NVME_AER_NOTICE_PL_EVENT = 0x04,
6654 NVME_AER_NOTICE_LBA_STATUS_ALERT = 0x05,
6655 NVME_AER_NOTICE_EG_EVENT = 0x06,
6656 NVME_AER_NOTICE_DISC_CHANGED = 0xf0,
6657 };
6658
6659 /**
6660 * enum nvme_subsys_type - Type of the NVM subsystem.
6661 * @NVME_NQN_DISC: Discovery type target subsystem. Describes a referral to another
6662 * Discovery Service composed of Discovery controllers that provide
6663 * additional discovery records. Multiple Referral entries may
6664 * be reported for each Discovery Service (if that Discovery Service
6665 * has multiple NVM subsystem ports or supports multiple protocols).
6666 * @NVME_NQN_NVME: NVME type target subsystem. Describes an NVM subsystem whose
6667 * controllers may have attached namespaces (an NVM subsystem
6668 * that is not composed of Discovery controllers). Multiple NVM
6669 * Subsystem entries may be reported for each NVM subsystem if
6670 * that NVM subsystem has multiple NVM subsystem ports.
6671 * @NVME_NQN_CURR: Current Discovery type target subsystem. Describes this Discovery
6672 * subsystem (the Discovery Service that contains the controller
6673 * processing the Get Log Page command). Multiple Current Discovery
6674 * Subsystem entries may be reported for this Discovery subsystem
6675 * if the current Discovery subsystem has multiple NVM subsystem
6676 * ports.
6677 */
6678 enum nvme_subsys_type {
6679 NVME_NQN_DISC = 1,
6680 NVME_NQN_NVME = 2,
6681 NVME_NQN_CURR = 3,
6682 };
6683
6684 #define NVME_DISC_SUBSYS_NAME "nqn.2014-08.org.nvmexpress.discovery"
6685 #define NVME_RDMA_IP_PORT 4420
6686 #define NVME_DISC_IP_PORT 8009
6687
6688 /* However the max length of a qualified name is another size */
6689 #define NVMF_NQN_SIZE 223
6690 #define NVMF_TRSVCID_SIZE 32
6691
6692 /**
6693 * enum nvmf_disc_eflags - Discovery Log Page entry flags.
6694 * @NVMF_DISC_EFLAGS_NONE: Indicates that none of the DUPRETINFO or EPCSD
6695 * features are supported.
6696 * @NVMF_DISC_EFLAGS_DUPRETINFO: Duplicate Returned Information (DUPRETINFO):
6697 * Indicates that using the content of this entry
6698 * to access this Discovery Service returns the same
6699 * information that is returned by using the content
6700 * of other entries in this log page that also have
6701 * this flag set.
6702 * @NVMF_DISC_EFLAGS_EPCSD: Explicit Persistent Connection Support for Discovery (EPCSD):
6703 * Indicates that Explicit Persistent Connections are
6704 * supported for the Discovery controller.
6705 * @NVMF_DISC_EFLAGS_NCC: No CDC Connectivity (NCC): If set to
6706 * '1', then no DDC that describes this entry
6707 * is currently connected to the CDC. If
6708 * cleared to '0', then at least one DDC that
6709 * describes this entry is currently
6710 * connected to the CDC. If the Discovery
6711 * controller returning this log page is not
6712 * a CDC, then this bit shall be cleared to
6713 * '0' and should be ignored by the host.
6714 */
6715 enum nvmf_disc_eflags {
6716 NVMF_DISC_EFLAGS_NONE = 0,
6717 NVMF_DISC_EFLAGS_DUPRETINFO = 1 << 0,
6718 NVMF_DISC_EFLAGS_EPCSD = 1 << 1,
6719 NVMF_DISC_EFLAGS_NCC = 1 << 2,
6720 };
6721
6722 /* Backwards compatibility. Will be removed with next major release */
6723 #define NVMF_DISC_EFLAGS_BOTH (NVMF_DISC_EFLAGS_DUPRETINFO | NVMF_DISC_EFLAGS_EPCSD)
6724
6725 /**
6726 * union nvmf_tsas - Transport Specific Address Subtype
6727 * @common: Common transport specific attributes
6728 * @rdma: RDMA transport specific attribute settings
6729 * @qptype: RDMA QP Service Type (RDMA_QPTYPE): Specifies the type of RDMA
6730 * Queue Pair. See &enum nvmf_rdma_qptype.
6731 * @prtype: RDMA Provider Type (RDMA_PRTYPE): Specifies the type of RDMA
6732 * provider. See &enum nvmf_rdma_prtype.
6733 * @cms: RDMA Connection Management Service (RDMA_CMS): Specifies the type
6734 * of RDMA IP Connection Management Service. See &enum nvmf_rdma_cms.
6735 * @pkey: RDMA_PKEY: Specifies the Partition Key when AF_IB (InfiniBand)
6736 * address family type is used.
6737 * @tcp: TCP transport specific attribute settings
6738 * @sectype: Security Type (SECTYPE): Specifies the type of security used by the
6739 * NVMe/TCP port. If SECTYPE is a value of 0h (No Security), then the
6740 * host shall set up a normal TCP connection. See &enum nvmf_tcp_sectype.
6741 */
6742 union nvmf_tsas {
6743 char common[NVMF_TSAS_SIZE];
6744 struct rdma {
6745 __u8 qptype;
6746 __u8 prtype;
6747 __u8 cms;
6748 __u8 rsvd3[5];
6749 __le16 pkey;
6750 __u8 rsvd10[246];
6751 } rdma;
6752 struct tcp {
6753 __u8 sectype;
6754 } tcp;
6755 };
6756
6757 /**
6758 * struct nvmf_disc_log_entry - Discovery Log Page entry
6759 * @trtype: Transport Type (TRTYPE): Specifies the NVMe Transport type.
6760 * See &enum nvmf_trtype.
6761 * @adrfam: Address Family (ADRFAM): Specifies the address family.
6762 * See &enum nvmf_addr_family.
6763 * @subtype: Subsystem Type (SUBTYPE): Specifies the type of the NVM subsystem
6764 * that is indicated in this entry. See &enum nvme_subsys_type.
6765 * @treq: Transport Requirements (TREQ): Indicates requirements for the NVMe
6766 * Transport. See &enum nvmf_treq.
6767 * @portid: Port ID (PORTID): Specifies a particular NVM subsystem port.
6768 * Different NVMe Transports or address families may utilize the same
6769 * Port ID value (e.g. a Port ID may support both iWARP and RoCE).
6770 * @cntlid: Controller ID (CNTLID): Specifies the controller ID. If the NVM
6771 * subsystem uses a dynamic controller model, then this field shall
6772 * be set to FFFFh. If the NVM subsystem uses a static controller model,
6773 * then this field may be set to a specific controller ID (values 0h
6774 * to FFEFh are valid). If the NVM subsystem uses a static controller
6775 * model and the value indicated is FFFEh, then the host should remember
6776 * the Controller ID returned as part of the Fabrics Connect command
6777 * in order to re-establish an association in the future with the same
6778 * controller.
6779 * @asqsz: Admin Max SQ Size (ASQSZ): Specifies the maximum size of an Admin
6780 * Submission Queue. This applies to all controllers in the NVM
6781 * subsystem. The value shall be a minimum of 32 entries.
6782 * @eflags: Entry Flags (EFLAGS): Indicates additional information related to
6783 * the current entry. See &enum nvmf_disc_eflags.
6784 * @rsvd12: Reserved
6785 * @trsvcid: Transport Service Identifier (TRSVCID): Specifies the NVMe Transport
6786 * service identifier as an ASCII string. The NVMe Transport service
6787 * identifier is specified by the associated NVMe Transport binding
6788 * specification.
6789 * @rsvd64: Reserved
6790 * @subnqn: NVM Subsystem Qualified Name (SUBNQN): NVMe Qualified Name (NQN)
6791 * that uniquely identifies the NVM subsystem. For a subsystem, if that
6792 * Discovery subsystem has a unique NQN (i.e., the NVM Subsystem NVMe
6793 * Qualified Name (SUBNQN) field in that Discovery subsystem's Identify
6794 * Controller data structure contains a unique NQN value), then the
6795 * value returned shall be that unique NQN. If the Discovery subsystem
6796 * does not have a unique NQN, then the value returned shall be the
6797 * well-known Discovery Service NQN (nqn.2014-08.org.nvmexpress.discovery).
6798 * @traddr: Transport Address (TRADDR): Specifies the address of the NVM subsystem
6799 * that may be used for a Connect command as an ASCII string. The
6800 * Address Family field describes the reference for parsing this field.
6801 * @tsas: Transport specific attribute settings
6802 */
6803 struct nvmf_disc_log_entry {
6804 __u8 trtype;
6805 __u8 adrfam;
6806 __u8 subtype;
6807 __u8 treq;
6808 __le16 portid;
6809 __le16 cntlid;
6810 __le16 asqsz;
6811 __le16 eflags;
6812 __u8 rsvd12[20];
6813 char trsvcid[NVMF_TRSVCID_SIZE];
6814 __u8 rsvd64[192];
6815 char subnqn[NVME_NQN_LENGTH];
6816 char traddr[NVMF_TRADDR_SIZE];
6817 union nvmf_tsas tsas;
6818 };
6819
6820 /**
6821 * enum nvmf_trtype - Transport Type codes for Discovery Log Page entry TRTYPE field
6822 * @NVMF_TRTYPE_UNSPECIFIED: Not indicated
6823 * @NVMF_TRTYPE_RDMA: RDMA
6824 * @NVMF_TRTYPE_FC: Fibre Channel
6825 * @NVMF_TRTYPE_TCP: TCP
6826 * @NVMF_TRTYPE_LOOP: Intra-host Transport (i.e., loopback), reserved
6827 * for host usage.
6828 * @NVMF_TRTYPE_MAX: Maximum value for &enum nvmf_trtype
6829 */
6830 enum nvmf_trtype {
6831 NVMF_TRTYPE_UNSPECIFIED = 0,
6832 NVMF_TRTYPE_RDMA = 1,
6833 NVMF_TRTYPE_FC = 2,
6834 NVMF_TRTYPE_TCP = 3,
6835 NVMF_TRTYPE_LOOP = 254,
6836 NVMF_TRTYPE_MAX,
6837 };
6838
6839 /**
6840 * enum nvmf_addr_family - Address Family codes for Discovery Log Page entry ADRFAM field
6841 * @NVMF_ADDR_FAMILY_PCI: PCIe
6842 * @NVMF_ADDR_FAMILY_IP4: AF_INET: IPv4 address family.
6843 * @NVMF_ADDR_FAMILY_IP6: AF_INET6: IPv6 address family.
6844 * @NVMF_ADDR_FAMILY_IB: AF_IB: InfiniBand address family.
6845 * @NVMF_ADDR_FAMILY_FC: Fibre Channel address family.
6846 * @NVMF_ADDR_FAMILY_LOOP: Intra-host Transport (i.e., loopback), reserved
6847 * for host usage.
6848 */
6849 enum nvmf_addr_family {
6850 NVMF_ADDR_FAMILY_PCI = 0,
6851 NVMF_ADDR_FAMILY_IP4 = 1,
6852 NVMF_ADDR_FAMILY_IP6 = 2,
6853 NVMF_ADDR_FAMILY_IB = 3,
6854 NVMF_ADDR_FAMILY_FC = 4,
6855 NVMF_ADDR_FAMILY_LOOP = 254,
6856 };
6857
6858 /**
6859 * enum nvmf_treq - Transport Requirements codes for Discovery Log Page entry TREQ field
6860 * @NVMF_TREQ_NOT_SPECIFIED: Not specified
6861 * @NVMF_TREQ_REQUIRED: Required
6862 * @NVMF_TREQ_NOT_REQUIRED: Not Required
6863 * @NVMF_TREQ_DISABLE_SQFLOW: SQ flow control disable supported
6864 */
6865 enum nvmf_treq {
6866 NVMF_TREQ_NOT_SPECIFIED = 0,
6867 NVMF_TREQ_REQUIRED = 1,
6868 NVMF_TREQ_NOT_REQUIRED = 2,
6869 NVMF_TREQ_DISABLE_SQFLOW = 4,
6870 };
6871
6872 /**
6873 * enum nvmf_rdma_qptype - RDMA QP Service Type codes for Discovery Log Page
6874 * entry TSAS RDMA_QPTYPE field
6875 * @NVMF_RDMA_QPTYPE_CONNECTED: Reliable Connected
6876 * @NVMF_RDMA_QPTYPE_DATAGRAM: Reliable Datagram
6877 */
6878 enum nvmf_rdma_qptype {
6879 NVMF_RDMA_QPTYPE_CONNECTED = 1,
6880 NVMF_RDMA_QPTYPE_DATAGRAM = 2,
6881 };
6882
6883 /**
6884 * enum nvmf_rdma_prtype - RDMA Provider Type codes for Discovery Log Page
6885 * entry TSAS RDMA_PRTYPE field
6886 * @NVMF_RDMA_PRTYPE_NOT_SPECIFIED: No Provider Specified
6887 * @NVMF_RDMA_PRTYPE_IB: InfiniBand
6888 * @NVMF_RDMA_PRTYPE_ROCE: InfiniBand RoCE
6889 * @NVMF_RDMA_PRTYPE_ROCEV2: InfiniBand RoCEV2
6890 * @NVMF_RDMA_PRTYPE_IWARP: iWARP
6891 */
6892 enum nvmf_rdma_prtype {
6893 NVMF_RDMA_PRTYPE_NOT_SPECIFIED = 1,
6894 NVMF_RDMA_PRTYPE_IB = 2,
6895 NVMF_RDMA_PRTYPE_ROCE = 3,
6896 NVMF_RDMA_PRTYPE_ROCEV2 = 4,
6897 NVMF_RDMA_PRTYPE_IWARP = 5,
6898 };
6899
6900 /**
6901 * enum nvmf_rdma_cms - RDMA Connection Management Service Type codes for
6902 * Discovery Log Page entry TSAS RDMA_CMS field
6903 * @NVMF_RDMA_CMS_RDMA_CM: Sockets based endpoint addressing
6904 *
6905 */
6906 enum nvmf_rdma_cms {
6907 NVMF_RDMA_CMS_RDMA_CM = 1,
6908 };
6909
6910 /**
6911 * enum nvmf_tcp_sectype - Transport Specific Address Subtype Definition for
6912 * NVMe/TCP Transport
6913 * @NVMF_TCP_SECTYPE_NONE: No Security
6914 * @NVMF_TCP_SECTYPE_TLS: Transport Layer Security version 1.2
6915 * @NVMF_TCP_SECTYPE_TLS13: Transport Layer Security version 1.3 or a subsequent
6916 * version. The TLS protocol negotiates the version and
6917 * cipher suite for each TCP connection.
6918 */
6919 enum nvmf_tcp_sectype {
6920 NVMF_TCP_SECTYPE_NONE = 0,
6921 NVMF_TCP_SECTYPE_TLS = 1,
6922 NVMF_TCP_SECTYPE_TLS13 = 2,
6923 };
6924
6925 /**
6926 * enum nvmf_log_discovery_lid_support - Discovery log specific support
6927 * @NVMF_LOG_DISC_LID_NONE: None
6928 * @NVMF_LOG_DISC_LID_EXTDLPES: Extended Discovery Log Page Entries Supported
6929 * @NVMF_LOG_DISC_LID_PLEOS: Port Local Entries Only Supported
6930 * @NVMF_LOG_DISC_LID_ALLSUBES: All NVM Subsystem Entries Supported
6931 */
6932 enum nvmf_log_discovery_lid_support {
6933 NVMF_LOG_DISC_LID_NONE = 0,
6934 NVMF_LOG_DISC_LID_EXTDLPES = (1 << 0),
6935 NVMF_LOG_DISC_LID_PLEOS = (1 << 1),
6936 NVMF_LOG_DISC_LID_ALLSUBES = (1 << 2),
6937 };
6938
6939 /**
6940 * enum nvmf_log_discovery_lsp - Discovery log specific field
6941 * @NVMF_LOG_DISC_LSP_NONE: None
6942 * @NVMF_LOG_DISC_LSP_EXTDLPE: Extended Discovery Log Page Entries
6943 * @NVMF_LOG_DISC_LSP_PLEO: Port Local Entries Only
6944 * @NVMF_LOG_DISC_LSP_ALLSUBE: All NVM Subsystem Entries
6945 */
6946 enum nvmf_log_discovery_lsp {
6947 NVMF_LOG_DISC_LSP_NONE = 0,
6948 NVMF_LOG_DISC_LSP_EXTDLPE = (1 << 0),
6949 NVMF_LOG_DISC_LSP_PLEO = (1 << 1),
6950 NVMF_LOG_DISC_LSP_ALLSUBE = (1 << 2),
6951 };
6952
6953 /**
6954 * struct nvmf_discovery_log - Discovery Log Page (Log Identifier 70h)
6955 * @genctr: Generation Counter (GENCTR): Indicates the version of the discovery
6956 * information, starting at a value of 0h. For each change in the
6957 * Discovery Log Page, this counter is incremented by one. If the value
6958 * of this field is FFFFFFFF_FFFFFFFFh, then the field shall be cleared
6959 * to 0h when incremented (i.e., rolls over to 0h).
6960 * @numrec: Number of Records (NUMREC): Indicates the number of records
6961 * contained in the log.
6962 * @recfmt: Record Format (RECFMT): Specifies the format of the Discovery Log
6963 * Page. If a new format is defined, this value is incremented by one.
6964 * The format of the record specified in this definition shall be 0h.
6965 * @rsvd14: Reserved
6966 * @entries: Discovery Log Page Entries - see &struct nvmf_disc_log_entry.
6967 */
6968 struct nvmf_discovery_log {
6969 __le64 genctr;
6970 __le64 numrec;
6971 __le16 recfmt;
6972 __u8 rsvd14[1006];
6973 struct nvmf_disc_log_entry entries[];
6974 };
6975
6976 /*
6977 * Discovery Information Management (DIM) command. This is sent by a
6978 * host to a Discovery Controller (DC) to perform explicit registration.
6979 */
6980 #define NVMF_ENAME_LEN 256
6981 #define NVMF_EVER_LEN 64
6982
6983 /**
6984 * enum nvmf_dim_tas - Discovery Information Management Task
6985 * @NVMF_DIM_TAS_REGISTER: Register
6986 * @NVMF_DIM_TAS_DEREGISTER: Deregister
6987 * @NVMF_DIM_TAS_UPDATE: Update
6988 */
6989 enum nvmf_dim_tas {
6990 NVMF_DIM_TAS_REGISTER = 0x00,
6991 NVMF_DIM_TAS_DEREGISTER = 0x01,
6992 NVMF_DIM_TAS_UPDATE = 0x02,
6993 };
6994
6995 /**
6996 * enum nvmf_dim_entfmt - Discovery Information Management Entry Format
6997 * @NVMF_DIM_ENTFMT_BASIC: Basic discovery information entry
6998 * @NVMF_DIM_ENTFMT_EXTENDED: Extended discovery information entry
6999 */
7000 enum nvmf_dim_entfmt {
7001 NVMF_DIM_ENTFMT_BASIC = 0x01,
7002 NVMF_DIM_ENTFMT_EXTENDED = 0x02,
7003 };
7004
7005 /**
7006 * enum nvmf_dim_etype -Discovery Information Management Entity Type
7007 * @NVMF_DIM_ETYPE_HOST: Host
7008 * @NVMF_DIM_ETYPE_DDC: Direct Discovery controller
7009 * @NVMF_DIM_ETYPE_CDC: Centralized Discovery controller
7010 */
7011 enum nvmf_dim_etype {
7012 NVMF_DIM_ETYPE_HOST = 0x01,
7013 NVMF_DIM_ETYPE_DDC = 0x02,
7014 NVMF_DIM_ETYPE_CDC = 0x03,
7015 };
7016
7017 /**
7018 * enum nvmf_exattype - Extended Attribute Type
7019 * @NVMF_EXATTYPE_HOSTID: Host Identifier
7020 * @NVMF_EXATTYPE_SYMNAME: Symblic Name
7021 */
7022 enum nvmf_exattype {
7023 NVMF_EXATTYPE_HOSTID = 0x01,
7024 NVMF_EXATTYPE_SYMNAME = 0x02,
7025 };
7026
7027 /**
7028 * struct nvmf_ext_attr - Extended Attribute (EXAT)
7029 * @exattype: Extended Attribute Type (EXATTYPE) - see @enum nvmf_exattype
7030 * @exatlen: Extended Attribute Length (EXATLEN)
7031 * @exatval: Extended Attribute Value (EXATVAL) - size allocated for array
7032 * must be a multiple of 4 bytes
7033 */
7034 struct nvmf_ext_attr {
7035 __le16 exattype;
7036 __le16 exatlen;
7037 __u8 exatval[];
7038 };
7039
7040 /**
7041 * struct nvmf_ext_die - Extended Discovery Information Entry (DIE)
7042 * @trtype: Transport Type (&enum nvmf_trtype)
7043 * @adrfam: Address Family (&enum nvmf_addr_family)
7044 * @subtype: Subsystem Type (&enum nvme_subsys_type)
7045 * @treq: Transport Requirements (&enum nvmf_treq)
7046 * @portid: Port ID
7047 * @cntlid: Controller ID
7048 * @asqsz: Admin Max SQ Size
7049 * @rsvd10: Reserved
7050 * @trsvcid: Transport Service Identifier
7051 * @resv64: Reserved
7052 * @nqn: NVM Qualified Name
7053 * @traddr: Transport Address
7054 * @tsas: Transport Specific Address Subtype (&union nvmf_tsas)
7055 * @tel: Total Entry Length
7056 * @numexat: Number of Extended Attributes
7057 * @resv1030: Reserved
7058 * @exat: Extended Attributes 0 (&struct nvmf_ext_attr)
7059 */
7060 struct nvmf_ext_die {
7061 __u8 trtype;
7062 __u8 adrfam;
7063 __u8 subtype;
7064 __u8 treq;
7065 __le16 portid;
7066 __le16 cntlid;
7067 __le16 asqsz;
7068 __u8 rsvd10[22];
7069 char trsvcid[NVMF_TRSVCID_SIZE];
7070 __u8 resv64[192];
7071 char nqn[NVME_NQN_LENGTH];
7072 char traddr[NVMF_TRADDR_SIZE];
7073 union nvmf_tsas tsas;
7074 __le32 tel;
7075 __le16 numexat;
7076 __u8 resv1030[2];
7077 struct nvmf_ext_attr exat[];
7078 };
7079
7080 /**
7081 * union nvmf_die - Discovery Information Entry (DIE)
7082 * @basic: Basic format (&struct nvmf_disc_log_entry)
7083 * @extended: Extended format (&struct nvmf_ext_die)
7084 *
7085 * Depending on the ENTFMT specified in the DIM, DIEs can be entered
7086 * with the Basic or Extended formats. For Basic format, each entry
7087 * has a fixed length. Therefore, the "basic" field defined below can
7088 * be accessed as a C array. For the Extended format, however, each
7089 * entry is of variable length (TEL). Therefore, the "extended" field
7090 * defined below cannot be accessed as a C array. Instead, the
7091 * "extended" field is akin to a linked-list, where one can "walk"
7092 * through the list. To move to the next entry, one simply adds the
7093 * current entry's length (TEL) to the "walk" pointer. The number of
7094 * entries in the list is specified by NUMENT. Although extended
7095 * entries are of a variable lengths (TEL), TEL is always a multiple of
7096 * 4 bytes.
7097 */
7098 union nvmf_die {
7099 struct nvmf_disc_log_entry basic[0];
7100 struct nvmf_ext_die extended;
7101 };
7102
7103 /**
7104 * struct nvmf_dim_data - Discovery Information Management (DIM) - Data
7105 * @tdl: Total Data Length
7106 * @rsvd4: Reserved
7107 * @nument: Number of entries
7108 * @entfmt: Entry Format (&enum nvmf_dim_entfmt)
7109 * @etype: Entity Type (&enum nvmf_dim_etype)
7110 * @portlcl: Port Local
7111 * @rsvd21: Reserved
7112 * @ektype: Entry Key Type
7113 * @eid: Entity Identifier (e.g. Host NQN)
7114 * @ename: Entity Name (e.g. hostname)
7115 * @ever: Entity Version (e.g. OS Name/Version)
7116 * @rsvd600: Reserved
7117 * @die: Discovery Information Entry (see @nument above)
7118 */
7119 struct nvmf_dim_data {
7120 __le32 tdl;
7121 __u8 rsvd4[4];
7122 __le64 nument;
7123 __le16 entfmt;
7124 __le16 etype;
7125 __u8 portlcl;
7126 __u8 rsvd21;
7127 __le16 ektype;
7128 char eid[NVME_NQN_LENGTH];
7129 char ename[NVMF_ENAME_LEN];
7130 char ever[NVMF_EVER_LEN];
7131 __u8 rsvd600[424];
7132 union nvmf_die die[];
7133 };
7134
7135 /**
7136 * struct nvmf_connect_data - Data payload for the 'connect' command
7137 * @hostid: Host ID of the connecting host
7138 * @cntlid: Requested controller ID
7139 * @rsvd4: Reserved
7140 * @subsysnqn: Subsystem NQN to connect to
7141 * @hostnqn: Host NQN of the connecting host
7142 * @rsvd5: Reserved
7143 */
7144 struct nvmf_connect_data {
7145 __u8 hostid[16];
7146 __le16 cntlid;
7147 char rsvd4[238];
7148 char subsysnqn[NVME_NQN_LENGTH];
7149 char hostnqn[NVME_NQN_LENGTH];
7150 char rsvd5[256];
7151 };
7152
7153 /**
7154 * struct nvme_host_ext_discover_log - Host Extended Discovery Log
7155 * @trtype: Transport Type
7156 * @adrfam: Address Family
7157 * @rsvd2: Reserved
7158 * @eflags: Entry Flags
7159 * @rsvd12: Reserved
7160 * @hostnqn: Host NVMe Qualified Name
7161 * @traddr: Transport Address
7162 * @tsas: Transport Specific Address Subtype
7163 * @tel: Total Entry Length
7164 * @numexat: Number of Extended Attributes
7165 * @rsvd1030: Reserved
7166 * @exat: Extended Attributes List
7167 */
7168 struct nvme_host_ext_discover_log {
7169 __u8 trtype;
7170 __u8 adrfam;
7171 __u8 rsvd2[8];
7172 __le16 eflags;
7173 __u8 rsvd12[244];
7174 char hostnqn[NVME_NQN_LENGTH];
7175 char traddr[NVMF_TRADDR_SIZE];
7176 union nvmf_tsas tsas;
7177 __le32 tel;
7178 __le16 numexat;
7179 __u8 rsvd1030[2];
7180 struct nvmf_ext_attr exat[];
7181 };
7182
7183 /**
7184 * struct nvme_host_discover_log - Host Discovery Log
7185 * @genctr: Generation Counter
7186 * @numrec: Number of Records
7187 * @recfmt: Record Format
7188 * @hdlpf: Host Discovery Log Page Flags
7189 * @rsvd19: Reserved
7190 * @thdlpl: Total Host Discovery Log Page Length
7191 * @rsvd24: Reserved
7192 * @hedlpe: Host Extended Discovery Log Page Entry List
7193 */
7194 struct nvme_host_discover_log {
7195 __le64 genctr;
7196 __le64 numrec;
7197 __le16 recfmt;
7198 __u8 hdlpf;
7199 __u8 rsvd19;
7200 __le32 thdlpl;
7201 __u8 rsvd24[1000];
7202 struct nvme_host_ext_discover_log hedlpe[];
7203 };
7204
7205 /**
7206 * struct nvme_ave_tr_record - AVE Transport Record
7207 * @aveadrfam: AVE Address Family
7208 * @rsvd1: Reserved
7209 * @avetrsvcid: AVE Transport Service Identifier
7210 * @avetraddr: AVE Transport Address
7211 */
7212 struct nvme_ave_tr_record {
7213 __u8 aveadrfam;
7214 __u8 rsvd1;
7215 __le16 avetrsvcid;
7216 __u8 avetraddr[16];
7217 };
7218
7219 /**
7220 * struct nvme_ave_discover_log_entry - AVE Discovery Log Entry
7221 * @tel: Total Entry Length
7222 * @avenqn: AVE NQN
7223 * @numatr: Number of AVE Transport Records
7224 * @rsvd229: Reserved
7225 * @atr: AVE Transport Record List
7226 */
7227 struct nvme_ave_discover_log_entry {
7228 __le32 tel;
7229 char avenqn[224];
7230 __u8 numatr;
7231 __u8 rsvd229[3];
7232 struct nvme_ave_tr_record atr[];
7233 };
7234
7235 /**
7236 * struct nvme_ave_discover_log - AVE Discovery Log
7237 * @genctr: Generation Counter
7238 * @numrec: Number of Records
7239 * @recfmt: Record Format
7240 * @rsvd18: Reserved
7241 * @tadlpl: Total AVE Discovery Log Page Length
7242 * @rsvd24: Reserved
7243 * @adlpe: AVE Discovery Log Page Entry List
7244 */
7245 struct nvme_ave_discover_log {
7246 __le64 genctr;
7247 __le64 numrec;
7248 __le16 recfmt;
7249 __u8 rsvd18[2];
7250 __le32 tadlpl;
7251 __u8 rsvd24[1000];
7252 struct nvme_ave_discover_log_entry adlpe[];
7253 };
7254
7255 /**
7256 * struct nvme_pull_model_ddc_req_log - Pull Model DDC Request Log
7257 * @ori: Operation Request Identifier
7258 * @rsvd1: Reserved
7259 * @tpdrpl: Total Pull Model DDC Request Log Page Length
7260 * @osp: Operation Specific Parameters
7261 */
7262 struct nvme_pull_model_ddc_req_log {
7263 __u8 ori;
7264 __u8 rsvd1[3];
7265 __le32 tpdrpl;
7266 __u8 osp[];
7267 };
7268
7269 /**
7270 * struct nvme_mi_read_nvm_ss_info - NVM Subsystem Information Data Structure
7271 * @nump: Number of Ports
7272 * @mjr: NVMe-MI Major Version Number
7273 * @mnr: NVMe-MI Minor Version Number
7274 * @rsvd3: Reserved
7275 */
7276 struct nvme_mi_read_nvm_ss_info {
7277 __u8 nump;
7278 __u8 mjr;
7279 __u8 mnr;
7280 __u8 rsvd3[29];
7281 };
7282
7283 /**
7284 * struct nvme_mi_port_pcie - PCIe Port Specific Data
7285 * @mps: PCIe Maximum Payload Size
7286 * @sls: PCIe Supported Link Speeds Vector
7287 * @cls: PCIe Current Link Speed
7288 * @mlw: PCIe Maximum Link Width
7289 * @nlw: PCIe Negotiated Link Width
7290 * @pn: PCIe Port Number
7291 * @rsvd14: Reserved
7292 */
7293 struct nvme_mi_port_pcie {
7294 __u8 mps;
7295 __u8 sls;
7296 __u8 cls;
7297 __u8 mlw;
7298 __u8 nlw;
7299 __u8 pn;
7300 __u8 rsvd14[18];
7301 };
7302
7303 /**
7304 * struct nvme_mi_port_smb - SMBus Port Specific Data
7305 * @vpd_addr: Current VPD SMBus/I2C Address
7306 * @mvpd_freq: Maximum VPD Access SMBus/I2C Frequency
7307 * @mme_addr: Current Management Endpoint SMBus/I2C Address
7308 * @mme_freq: Maximum Management Endpoint SMBus/I2C Frequency
7309 * @nvmebm: NVMe Basic Management
7310 * @rsvd13: Reserved
7311 */
7312 struct nvme_mi_port_smb {
7313 __u8 vpd_addr;
7314 __u8 mvpd_freq;
7315 __u8 mme_addr;
7316 __u8 mme_freq;
7317 __u8 nvmebm;
7318 __u8 rsvd13[19];
7319 };
7320
7321 /**
7322 * struct nvme_mi_read_port_info - Port Information Data Structure
7323 * @portt: Port Type
7324 * @rsvd1: Reserved
7325 * @mmctptus: Maximum MCTP Transmission Unit Size
7326 * @meb: Management Endpoint Buffer Size
7327 * @pcie: PCIe Port Specific Data
7328 * @smb: SMBus Port Specific Data
7329 */
7330 struct nvme_mi_read_port_info {
7331 __u8 portt;
7332 __u8 rsvd1;
7333 __le16 mmctptus;
7334 __le32 meb;
7335 union {
7336 struct nvme_mi_port_pcie pcie;
7337 struct nvme_mi_port_smb smb;
7338 };
7339 };
7340
7341 /**
7342 * struct nvme_mi_read_ctrl_info - Controller Information Data Structure
7343 * @portid: Port Identifier
7344 * @rsvd1: Reserved
7345 * @prii: PCIe Routing ID Information
7346 * @pri: PCIe Routing ID
7347 * @vid: PCI Vendor ID
7348 * @did: PCI Device ID
7349 * @ssvid: PCI Subsystem Vendor ID
7350 * @ssid: PCI Subsystem Device ID
7351 * @rsvd16: Reserved
7352 */
7353 struct nvme_mi_read_ctrl_info {
7354 __u8 portid;
7355 __u8 rsvd1[4];
7356 __u8 prii;
7357 __le16 pri;
7358 __le16 vid;
7359 __le16 did;
7360 __le16 ssvid;
7361 __le16 ssid;
7362 __u8 rsvd16[16];
7363 };
7364
7365 /**
7366 * struct nvme_mi_osc - Optionally Supported Command Data Structure
7367 * @type: Command Type
7368 * @opc: Opcode
7369 */
7370 struct nvme_mi_osc {
7371 __u8 type;
7372 __u8 opc;
7373 };
7374
7375 /**
7376 * struct nvme_mi_read_sc_list - Management Endpoint Buffer Supported Command List Data Structure
7377 * @numcmd: Number of Commands
7378 * @cmds: MEB supported Command Data Structure.
7379 * See @struct nvme_mi_osc
7380 */
7381 struct nvme_mi_read_sc_list {
7382 __le16 numcmd;
7383 struct nvme_mi_osc cmds[];
7384 };
7385
7386 /**
7387 * struct nvme_mi_nvm_ss_health_status - Subsystem Management Data Structure
7388 * @nss: NVM Subsystem Status
7389 * @sw: Smart Warnings
7390 * @ctemp: Composite Temperature
7391 * @pdlu: Percentage Drive Life Used
7392 * @ccs: Composite Controller Status
7393 * @rsvd8: Reserved
7394 */
7395 struct nvme_mi_nvm_ss_health_status {
7396 __u8 nss;
7397 __u8 sw;
7398 __u8 ctemp;
7399 __u8 pdlu;
7400 __le16 ccs;
7401 __u8 rsvd8[2];
7402 };
7403
7404 /**
7405 * enum nvme_mi_ccs - Get State Control Primitive Success Response Fields - Control Primitive Specific Response
7406 * @NVME_MI_CCS_RDY: Ready
7407 * @NVME_MI_CCS_CFS: Controller Fatal Status
7408 * @NVME_MI_CCS_SHST: Shutdown Status
7409 * @NVME_MI_CCS_NSSRO: NVM Subsystem Reset Occurred
7410 * @NVME_MI_CCS_CECO: Controller Enable Change Occurred
7411 * @NVME_MI_CCS_NAC: Namespace Attribute Changed
7412 * @NVME_MI_CCS_FA: Firmware Activated
7413 * @NVME_MI_CCS_CSTS: Controller Status Change
7414 * @NVME_MI_CCS_CTEMP: Composite Temperature Change
7415 * @NVME_MI_CCS_PDLU: Percentage Used
7416 * @NVME_MI_CCS_SPARE: Available Spare
7417 * @NVME_MI_CCS_CCWARN: Critical Warning
7418 */
7419 enum nvme_mi_ccs {
7420 NVME_MI_CCS_RDY = 1 << 0,
7421 NVME_MI_CCS_CFS = 1 << 1,
7422 NVME_MI_CCS_SHST = 1 << 2,
7423 NVME_MI_CCS_NSSRO = 1 << 4,
7424 NVME_MI_CCS_CECO = 1 << 5,
7425 NVME_MI_CCS_NAC = 1 << 6,
7426 NVME_MI_CCS_FA = 1 << 7,
7427 NVME_MI_CCS_CSTS = 1 << 8,
7428 NVME_MI_CCS_CTEMP = 1 << 9,
7429 NVME_MI_CCS_PDLU = 1 << 10,
7430 NVME_MI_CCS_SPARE = 1 << 11,
7431 NVME_MI_CCS_CCWARN = 1 << 12,
7432 };
7433
7434 /* backwards compat for old "CCS" definitions */
7435 #define nvme_mi_css nvme_mi_ccs
7436 #define NVME_MI_CSS_CFS NVME_MI_CCS_CFS
7437 #define NVME_MI_CSS_SHST NVME_MI_CCS_SHST
7438 #define NVME_MI_CSS_NSSRO NVME_MI_CCS_NSSRO
7439 #define NVME_MI_CSS_CECO NVME_MI_CCS_CECO
7440 #define NVME_MI_CSS_NAC NVME_MI_CCS_NAC
7441 #define NVME_MI_CSS_FA NVME_MI_CCS_FA
7442 #define NVME_MI_CSS_CSTS NVME_MI_CCS_CSTS
7443 #define NVME_MI_CSS_CTEMP NVME_MI_CCS_CTEMP
7444 #define NVME_MI_CSS_PDLU NVME_MI_CCS_PDLU
7445 #define NVME_MI_CSS_SPARE NVME_MI_CCS_SPARE
7446 #define NVME_MI_CSS_CCWARN NVME_MI_CCS_CCWARN
7447
7448 /**
7449 * struct nvme_mi_ctrl_health_status - Controller Health Data Structure (CHDS)
7450 * @ctlid: Controller Identifier
7451 * @csts: Controller Status
7452 * @ctemp: Composite Temperature
7453 * @pdlu: Percentage Used
7454 * @spare: Available Spare
7455 * @cwarn: Critical Warning
7456 * @rsvd9: Reserved
7457 */
7458 struct nvme_mi_ctrl_health_status {
7459 __le16 ctlid;
7460 __le16 csts;
7461 __le16 ctemp;
7462 __u8 pdlu;
7463 __u8 spare;
7464 __u8 cwarn;
7465 __u8 rsvd9[7];
7466 };
7467
7468 /**
7469 * enum nvme_mi_csts - Controller Health Data Structure (CHDS) - Controller Status (CSTS)
7470 * @NVME_MI_CSTS_RDY: Ready
7471 * @NVME_MI_CSTS_CFS: Controller Fatal Status
7472 * @NVME_MI_CSTS_SHST: Shutdown Status
7473 * @NVME_MI_CSTS_NSSRO: NVM Subsystem Reset Occurred
7474 * @NVME_MI_CSTS_CECO: Controller Enable Change Occurred
7475 * @NVME_MI_CSTS_NAC: Namespace Attribute Changed
7476 * @NVME_MI_CSTS_FA: Firmware Activated
7477 */
7478 enum nvme_mi_csts {
7479 NVME_MI_CSTS_RDY = 1 << 0,
7480 NVME_MI_CSTS_CFS = 1 << 1,
7481 NVME_MI_CSTS_SHST = 1 << 2,
7482 NVME_MI_CSTS_NSSRO = 1 << 4,
7483 NVME_MI_CSTS_CECO = 1 << 5,
7484 NVME_MI_CSTS_NAC = 1 << 6,
7485 NVME_MI_CSTS_FA = 1 << 7,
7486 };
7487
7488 /**
7489 * enum nvme_mi_cwarn - Controller Health Data Structure (CHDS) - Critical Warning (CWARN)
7490 * @NVME_MI_CWARN_ST: Spare Threshold
7491 * @NVME_MI_CWARN_TAUT: Temperature Above or Under Threshold
7492 * @NVME_MI_CWARN_RD: Reliability Degraded
7493 * @NVME_MI_CWARN_RO: Read Only
7494 * @NVME_MI_CWARN_VMBF: Volatile Memory Backup Failed
7495 */
7496 enum nvme_mi_cwarn {
7497 NVME_MI_CWARN_ST = 1 << 0,
7498 NVME_MI_CWARN_TAUT = 1 << 1,
7499 NVME_MI_CWARN_RD = 1 << 2,
7500 NVME_MI_CWARN_RO = 1 << 3,
7501 NVME_MI_CWARN_VMBF = 1 << 4,
7502 };
7503
7504 /**
7505 * struct nvme_mi_vpd_mra - NVMe MultiRecord Area
7506 * @nmravn: NVMe MultiRecord Area Version Number
7507 * @ff: Form Factor
7508 * @rsvd7: Reserved
7509 * @i18vpwr: Initial 1.8 V Power Supply Requirements
7510 * @m18vpwr: Maximum 1.8 V Power Supply Requirements
7511 * @i33vpwr: Initial 3.3 V Power Supply Requirements
7512 * @m33vpwr: Maximum 3.3 V Power Supply Requirements
7513 * @rsvd17: Reserved
7514 * @m33vapsr: Maximum 3.3 Vi aux Power Supply Requirements
7515 * @i5vapsr: Initial 5 V Power Supply Requirements
7516 * @m5vapsr: Maximum 5 V Power Supply Requirements
7517 * @i12vapsr: Initial 12 V Power Supply Requirements
7518 * @m12vapsr: Maximum 12 V Power Supply Requirements
7519 * @mtl: Maximum Thermal Load
7520 * @tnvmcap: Total NVM Capacity
7521 * @rsvd37: Reserved
7522 */
7523 struct nvme_mi_vpd_mra {
7524 __u8 nmravn;
7525 __u8 ff;
7526 __u8 rsvd7[6];
7527 __u8 i18vpwr;
7528 __u8 m18vpwr;
7529 __u8 i33vpwr;
7530 __u8 m33vpwr;
7531 __u8 rsvd17;
7532 __u8 m33vapsr;
7533 __u8 i5vapsr;
7534 __u8 m5vapsr;
7535 __u8 i12vapsr;
7536 __u8 m12vapsr;
7537 __u8 mtl;
7538 __u8 tnvmcap[16];
7539 __u8 rsvd37[27];
7540 };
7541
7542 /**
7543 * struct nvme_mi_vpd_ppmra - NVMe PCIe Port MultiRecord Area
7544 * @nppmravn: NVMe PCIe Port MultiRecord Area Version Number
7545 * @pn: PCIe Port Number
7546 * @ppi: Port Information
7547 * @ls: PCIe Link Speed
7548 * @mlw: PCIe Maximum Link Width
7549 * @mctp: MCTP Support
7550 * @refccap: Ref Clk Capability
7551 * @pi: Port Identifier
7552 * @rsvd13: Reserved
7553 */
7554 struct nvme_mi_vpd_ppmra {
7555 __u8 nppmravn;
7556 __u8 pn;
7557 __u8 ppi;
7558 __u8 ls;
7559 __u8 mlw;
7560 __u8 mctp;
7561 __u8 refccap;
7562 __u8 pi;
7563 __u8 rsvd13[3];
7564 };
7565
7566 /**
7567 * struct nvme_mi_vpd_telem - Vital Product Data Element Descriptor
7568 * @type: Type of the Element Descriptor
7569 * @rev: Revision of the Element Descriptor
7570 * @len: Number of bytes in the Element Descriptor
7571 * @data: Type-specific information associated with
7572 * the Element Descriptor
7573 */
7574 struct nvme_mi_vpd_telem {
7575 __u8 type;
7576 __u8 rev;
7577 __u8 len;
7578 __u8 data[0];
7579 };
7580
7581 /**
7582 * enum nvme_mi_elem - Element Descriptor Types
7583 * @NVME_MI_ELEM_EED: Extended Element Descriptor
7584 * @NVME_MI_ELEM_USCE: Upstream Connector Element Descriptor
7585 * @NVME_MI_ELEM_ECED: Expansion Connector Element Descriptor
7586 * @NVME_MI_ELEM_LED: Label Element Descriptor
7587 * @NVME_MI_ELEM_SMBMED: SMBus/I2C Mux Element Descriptor
7588 * @NVME_MI_ELEM_PCIESED: PCIe Switch Element Descriptor
7589 * @NVME_MI_ELEM_NVMED: NVM Subsystem Element Descriptor
7590 */
7591 enum nvme_mi_elem {
7592 NVME_MI_ELEM_EED = 1,
7593 NVME_MI_ELEM_USCE = 2,
7594 NVME_MI_ELEM_ECED = 3,
7595 NVME_MI_ELEM_LED = 4,
7596 NVME_MI_ELEM_SMBMED = 5,
7597 NVME_MI_ELEM_PCIESED = 6,
7598 NVME_MI_ELEM_NVMED = 7,
7599 };
7600
7601 /**
7602 * struct nvme_mi_vpd_tra - Vital Product Data Topology MultiRecord
7603 * @vn: Version Number
7604 * @rsvd6: Reserved
7605 * @ec: Element Count
7606 * @elems: Element Descriptor
7607 */
7608 struct nvme_mi_vpd_tra {
7609 __u8 vn;
7610 __u8 rsvd6;
7611 __u8 ec;
7612 struct nvme_mi_vpd_telem elems[0];
7613 };
7614
7615 /**
7616 * struct nvme_mi_vpd_mr_common - NVMe MultiRecord Area
7617 * @type: NVMe Record Type ID
7618 * @rf: Record Format
7619 * @rlen: Record Length
7620 * @rchksum: Record Checksum
7621 * @hchksum: Header Checksum
7622 * @nmra: NVMe MultiRecord Area
7623 * @ppmra: NVMe PCIe Port MultiRecord Area
7624 * @tmra: Topology MultiRecord Area
7625 */
7626 struct nvme_mi_vpd_mr_common {
7627 __u8 type;
7628 __u8 rf;
7629 __u8 rlen;
7630 __u8 rchksum;
7631 __u8 hchksum;
7632
7633 union {
7634 struct nvme_mi_vpd_mra nmra;
7635 struct nvme_mi_vpd_ppmra ppmra;
7636 struct nvme_mi_vpd_tra tmra;
7637 };
7638 };
7639
7640 /**
7641 * struct nvme_mi_vpd_hdr - Vital Product Data Common Header
7642 * @ipmiver: IPMI Format Version Number
7643 * @iuaoff: Internal Use Area Starting Offset
7644 * @ciaoff: Chassis Info Area Starting Offset
7645 * @biaoff: Board Info Area Starting Offset
7646 * @piaoff: Product Info Area Starting Offset
7647 * @mrioff: MultiRecord Info Area Starting Offset
7648 * @rsvd6: Reserved
7649 * @chchk: Common Header Checksum
7650 * @vpd: Vital Product Data
7651 */
7652 struct nvme_mi_vpd_hdr {
7653 __u8 ipmiver;
7654 __u8 iuaoff;
7655 __u8 ciaoff;
7656 __u8 biaoff;
7657 __u8 piaoff;
7658 __u8 mrioff;
7659 __u8 rsvd6;
7660 __u8 chchk;
7661 __u8 vpd[];
7662 };
7663
7664 /**
7665 * enum nvme_status_field - Defines all parts of the nvme status field: status
7666 * code, status code type, and additional flags.
7667 * @NVME_SCT_GENERIC: Generic errors applicable to multiple opcodes
7668 * @NVME_SCT_CMD_SPECIFIC: Errors associated to a specific opcode
7669 * @NVME_SCT_MEDIA: Errors associated with media and data integrity
7670 * @NVME_SCT_PATH: Errors associated with the paths connection
7671 * @NVME_SCT_VS: Vendor specific errors
7672 * @NVME_SCT_MASK: Mask to get the value of the Status Code Type
7673 * @NVME_SCT_SHIFT: Shift value to get the value of the Status
7674 * Code Type
7675 * @NVME_SC_MASK: Mask to get the value of the status code.
7676 * @NVME_SC_SHIFT: Shift value to get the value of the status
7677 * code.
7678 * @NVME_SC_SUCCESS: Successful Completion: The command
7679 * completed without error.
7680 * @NVME_SC_INVALID_OPCODE: Invalid Command Opcode: A reserved coded
7681 * value or an unsupported value in the
7682 * command opcode field.
7683 * @NVME_SC_INVALID_FIELD: Invalid Field in Command: A reserved
7684 * coded value or an unsupported value in a
7685 * defined field.
7686 * @NVME_SC_CMDID_CONFLICT: Command ID Conflict: The command
7687 * identifier is already in use.
7688 * @NVME_SC_DATA_XFER_ERROR: Data Transfer Error: Transferring the
7689 * data or metadata associated with a
7690 * command experienced an error.
7691 * @NVME_SC_POWER_LOSS: Commands Aborted due to Power Loss
7692 * Notification: Indicates that the command
7693 * was aborted due to a power loss
7694 * notification.
7695 * @NVME_SC_INTERNAL: Internal Error: The command was not
7696 * completed successfully due to an internal error.
7697 * @NVME_SC_ABORT_REQ: Command Abort Requested: The command was
7698 * aborted due to an Abort command being
7699 * received that specified the Submission
7700 * Queue Identifier and Command Identifier
7701 * of this command.
7702 * @NVME_SC_ABORT_QUEUE: Command Aborted due to SQ Deletion: The
7703 * command was aborted due to a Delete I/O
7704 * Submission Queue request received for the
7705 * Submission Queue to which the command was
7706 * submitted.
7707 * @NVME_SC_FUSED_FAIL: Command Aborted due to Failed Fused Command:
7708 * The command was aborted due to the other
7709 * command in a fused operation failing.
7710 * @NVME_SC_FUSED_MISSING: Aborted due to Missing Fused Command: The
7711 * fused command was aborted due to the
7712 * adjacent submission queue entry not
7713 * containing a fused command that is the
7714 * other command.
7715 * @NVME_SC_INVALID_NS: Invalid Namespace or Format: The
7716 * namespace or the format of that namespace
7717 * is invalid.
7718 * @NVME_SC_CMD_SEQ_ERROR: Command Sequence Error: The command was
7719 * aborted due to a protocol violation in a
7720 * multi-command sequence.
7721 * @NVME_SC_SGL_INVALID_LAST: Invalid SGL Segment Descriptor: The
7722 * command includes an invalid SGL Last
7723 * Segment or SGL Segment descriptor.
7724 * @NVME_SC_SGL_INVALID_COUNT: Invalid Number of SGL Descriptors: There
7725 * is an SGL Last Segment descriptor or an
7726 * SGL Segment descriptor in a location
7727 * other than the last descriptor of a
7728 * segment based on the length indicated.
7729 * @NVME_SC_SGL_INVALID_DATA: Data SGL Length Invalid: This may occur
7730 * if the length of a Data SGL is too short.
7731 * This may occur if the length of a Data
7732 * SGL is too long and the controller does
7733 * not support SGL transfers longer than the
7734 * amount of data to be transferred as
7735 * indicated in the SGL Support field of the
7736 * Identify Controller data structure.
7737 * @NVME_SC_SGL_INVALID_METADATA: Metadata SGL Length Invalid: This may
7738 * occur if the length of a Metadata SGL is
7739 * too short. This may occur if the length
7740 * of a Metadata SGL is too long and the
7741 * controller does not support SGL transfers
7742 * longer than the amount of data to be
7743 * transferred as indicated in the SGL
7744 * Support field of the Identify Controller
7745 * data structure.
7746 * @NVME_SC_SGL_INVALID_TYPE: SGL Descriptor Type Invalid: The type of
7747 * an SGL Descriptor is a type that is not
7748 * supported by the controller.
7749 * @NVME_SC_CMB_INVALID_USE: Invalid Use of Controller Memory Buffer:
7750 * The attempted use of the Controller
7751 * Memory Buffer is not supported by the
7752 * controller.
7753 * @NVME_SC_PRP_INVALID_OFFSET: PRP Offset Invalid: The Offset field for
7754 * a PRP entry is invalid.
7755 * @NVME_SC_AWU_EXCEEDED: Atomic Write Unit Exceeded: The length
7756 * specified exceeds the atomic write unit size.
7757 * @NVME_SC_OP_DENIED: Operation Denied: The command was denied
7758 * due to lack of access rights. Refer to
7759 * the appropriate security specification.
7760 * @NVME_SC_SGL_INVALID_OFFSET: SGL Offset Invalid: The offset specified
7761 * in a descriptor is invalid. This may
7762 * occur when using capsules for data
7763 * transfers in NVMe over Fabrics
7764 * implementations and an invalid offset in
7765 * the capsule is specified.
7766 * @NVME_SC_HOSTID_FORMAT: Host Identifier Inconsistent Format: The
7767 * NVM subsystem detected the simultaneous
7768 * use of 64- bit and 128-bit Host
7769 * Identifier values on different
7770 * controllers.
7771 * @NVME_SC_KAT_EXPIRED: Keep Alive Timer Expired: The Keep Alive
7772 * Timer expired.
7773 * @NVME_SC_KAT_INVALID: Keep Alive Timeout Invalid: The Keep
7774 * Alive Timeout value specified is invalid.
7775 * @NVME_SC_CMD_ABORTED_PREMEPT: Command Aborted due to Preempt and Abort:
7776 * The command was aborted due to a
7777 * Reservation Acquire command.
7778 * @NVME_SC_SANITIZE_FAILED: Sanitize Failed: The most recent sanitize
7779 * operation failed and no recovery action
7780 * has been successfully completed.
7781 * @NVME_SC_SANITIZE_IN_PROGRESS: Sanitize In Progress: The requested
7782 * function (e.g., command) is prohibited
7783 * while a sanitize operation is in
7784 * progress.
7785 * @NVME_SC_SGL_INVALID_GRANULARITY: SGL Data Block Granularity Invalid: The
7786 * Address alignment or Length granularity
7787 * for an SGL Data Block descriptor is
7788 * invalid.
7789 * @NVME_SC_CMD_IN_CMBQ_NOT_SUPP: Command Not Supported for Queue in CMB:
7790 * The implementation does not support
7791 * submission of the command to a Submission
7792 * Queue in the Controller Memory Buffer or
7793 * command completion to a Completion Queue
7794 * in the Controller Memory Buffer.
7795 * @NVME_SC_NS_WRITE_PROTECTED: Namespace is Write Protected: The command
7796 * is prohibited while the namespace is
7797 * write protected as a result of a change
7798 * in the namespace write protection state
7799 * as defined by the Namespace Write
7800 * Protection State Machine.
7801 * @NVME_SC_CMD_INTERRUPTED: Command Interrupted: Command processing
7802 * was interrupted and the controller is
7803 * unable to successfully complete the
7804 * command. The host should retry the
7805 * command.
7806 * @NVME_SC_TRAN_TPORT_ERROR: Transient Transport Error: A transient
7807 * transport error was detected. If the
7808 * command is retried on the same
7809 * controller, the command is likely to
7810 * succeed. A command that fails with a
7811 * transient transport error four or more
7812 * times should be treated as a persistent
7813 * transport error that is not likely to
7814 * succeed if retried on the same
7815 * controller.
7816 * @NVME_SC_PROHIBITED_BY_CMD_AND_FEAT: Command Prohibited by Command and Feature
7817 * Lockdown: The command was aborted due to
7818 * command execution being prohibited by
7819 * the Command and Feature Lockdown.
7820 * @NVME_SC_ADMIN_CMD_MEDIA_NOT_READY: Admin Command Media Not Ready: The Admin
7821 * command requires access to media and
7822 * the media is not ready.
7823 * @NVME_SC_INVALID_KEY_TAG: The command was aborted due to an invalid KEYTAG
7824 * field value.
7825 * @NVME_SC_HOST_DISPERSED_NS_NOT_ENABLED: The command is prohibited while the
7826 * Host Disperesed Namespace Support (HDISNS) field is not
7827 * set to 1h in the Host Behavior Support feature.
7828 * @NVME_SC_HOST_ID_NOT_INITIALIZED: Host Identifier Not Initialized.
7829 * @NVME_SC_INCORRECT_KEY: The command was aborted due to the key associated
7830 * with the KEYTAG field being incorrect.
7831 * @NVME_SC_FDP_DISABLED: Command is not allowed when
7832 * Flexible Data Placement is disabled.
7833 * @NVME_SC_INVALID_PLACEMENT_HANDLE_LIST: The Placement Handle List is invalid
7834 * due to invalid Reclaim Unit Handle Identifier or
7835 * valid Reclaim Unit Handle Identifier but restricted or
7836 * the Placement Handle List number of entries exceeded the
7837 * maximum number allowed.
7838 * @NVME_SC_LBA_RANGE: LBA Out of Range: The command references
7839 * an LBA that exceeds the size of the namespace.
7840 * @NVME_SC_CAP_EXCEEDED: Capacity Exceeded: Execution of the
7841 * command has caused the capacity of the
7842 * namespace to be exceeded.
7843 * @NVME_SC_NS_NOT_READY: Namespace Not Ready: The namespace is not
7844 * ready to be accessed as a result of a
7845 * condition other than a condition that is
7846 * reported as an Asymmetric Namespace
7847 * Access condition.
7848 * @NVME_SC_RESERVATION_CONFLICT: Reservation Conflict: The command was
7849 * aborted due to a conflict with a
7850 * reservation held on the accessed
7851 * namespace.
7852 * @NVME_SC_FORMAT_IN_PROGRESS: Format In Progress: A Format NVM command
7853 * is in progress on the namespace.
7854 * @NVME_SC_INVALID_VALUE_SIZE: The value size is not valid.
7855 * @NVME_SC_INVALID_KEY_SIZE: The KV key size is not valid.
7856 * @NVME_SC_KV_KEY_NOT_EXISTS: The Store If Key Exists (SIKE) bit is set to
7857 * '1' in the Store Option field and the KV key does not
7858 * exists.
7859 * @NVME_SC_UNRECOVERED_ERROR: There was an unrecovered error when reading
7860 * from the meidum.
7861 * @NVME_SC_KEY_EXISTS: The Store If No Key Exists (SINKE) bit is set to '1'
7862 * in the Store Option field and the KV key exists.
7863 * @NVME_SC_CQ_INVALID: Completion Queue Invalid: The Completion
7864 * Queue identifier specified in the command
7865 * does not exist.
7866 * @NVME_SC_QID_INVALID: Invalid Queue Identifier: The creation of
7867 * the I/O Completion Queue failed due to an
7868 * invalid queue identifier specified as
7869 * part of the command. An invalid queue
7870 * identifier is one that is currently in
7871 * use or one that is outside the range
7872 * supported by the controller.
7873 * @NVME_SC_QUEUE_SIZE: Invalid Queue Size: The host attempted to
7874 * create an I/O Completion Queue with an
7875 * invalid number of entries.
7876 * @NVME_SC_ABORT_LIMIT: Abort Command Limit Exceeded: The number
7877 * of concurrently outstanding Abort commands
7878 * has exceeded the limit indicated in the
7879 * Identify Controller data structure.
7880 * @NVME_SC_ABORT_MISSING: Abort Command is missing: The abort
7881 * command is missing.
7882 * @NVME_SC_ASYNC_LIMIT: Asynchronous Event Request Limit
7883 * Exceeded: The number of concurrently
7884 * outstanding Asynchronous Event Request
7885 * commands has been exceeded.
7886 * @NVME_SC_FIRMWARE_SLOT: Invalid Firmware Slot: The firmware slot
7887 * indicated is invalid or read only. This
7888 * error is indicated if the firmware slot
7889 * exceeds the number supported.
7890 * @NVME_SC_FIRMWARE_IMAGE: Invalid Firmware Image: The firmware
7891 * image specified for activation is invalid
7892 * and not loaded by the controller.
7893 * @NVME_SC_INVALID_VECTOR: Invalid Interrupt Vector: The creation of
7894 * the I/O Completion Queue failed due to an
7895 * invalid interrupt vector specified as
7896 * part of the command.
7897 * @NVME_SC_INVALID_LOG_PAGE: Invalid Log Page: The log page indicated
7898 * is invalid. This error condition is also
7899 * returned if a reserved log page is
7900 * requested.
7901 * @NVME_SC_INVALID_FORMAT: Invalid Format: The LBA Format specified
7902 * is not supported.
7903 * @NVME_SC_FW_NEEDS_CONV_RESET: Firmware Activation Requires Conventional Reset:
7904 * The firmware commit was successful,
7905 * however, activation of the firmware image
7906 * requires a conventional reset.
7907 * @NVME_SC_INVALID_QUEUE: Invalid Queue Deletion: Invalid I/O
7908 * Completion Queue specified to delete.
7909 * @NVME_SC_FEATURE_NOT_SAVEABLE: Feature Identifier Not Saveable: The
7910 * Feature Identifier specified does not
7911 * support a saveable value.
7912 * @NVME_SC_FEATURE_NOT_CHANGEABLE: Feature Not Changeable: The Feature
7913 * Identifier is not able to be changed.
7914 * @NVME_SC_FEATURE_NOT_PER_NS: Feature Not Namespace Specific: The
7915 * Feature Identifier specified is not
7916 * namespace specific. The Feature
7917 * Identifier settings apply across all
7918 * namespaces.
7919 * @NVME_SC_FW_NEEDS_SUBSYS_RESET: Firmware Activation Requires NVM
7920 * Subsystem Reset: The firmware commit was
7921 * successful, however, activation of the
7922 * firmware image requires an NVM Subsystem.
7923 * @NVME_SC_FW_NEEDS_RESET: Firmware Activation Requires Controller
7924 * Level Reset: The firmware commit was
7925 * successful; however, the image specified
7926 * does not support being activated without
7927 * a reset.
7928 * @NVME_SC_FW_NEEDS_MAX_TIME: Firmware Activation Requires Maximum Time
7929 * Violation: The image specified if
7930 * activated immediately would exceed the
7931 * Maximum Time for Firmware Activation
7932 * (MTFA) value reported in Identify
7933 * Controller.
7934 * @NVME_SC_FW_ACTIVATE_PROHIBITED: Firmware Activation Prohibited: The image
7935 * specified is being prohibited from
7936 * activation by the controller for vendor
7937 * specific reasons.
7938 * @NVME_SC_OVERLAPPING_RANGE: Overlapping Range: The downloaded
7939 * firmware image has overlapping ranges.
7940 * @NVME_SC_NS_INSUFFICIENT_CAP: Namespace Insufficient Capacity: Creating
7941 * the namespace requires more free space
7942 * than is currently available.
7943 * @NVME_SC_NS_ID_UNAVAILABLE: Namespace Identifier Unavailable: The
7944 * number of namespaces supported has been
7945 * exceeded.
7946 * @NVME_SC_NS_ALREADY_ATTACHED: Namespace Already Attached: The
7947 * controller is already attached to the
7948 * namespace specified.
7949 * @NVME_SC_NS_IS_PRIVATE: Namespace Is Private: The namespace is
7950 * private and is already attached to one
7951 * controller.
7952 * @NVME_SC_NS_NOT_ATTACHED: Namespace Not Attached: The request to
7953 * detach the controller could not be
7954 * completed because the controller is not
7955 * attached to the namespace.
7956 * @NVME_SC_THIN_PROV_NOT_SUPP: Thin Provisioning Not Supported: Thin
7957 * provisioning is not supported by the
7958 * controller.
7959 * @NVME_SC_CTRL_LIST_INVALID: Controller List Invalid: The controller
7960 * list provided contains invalid controller
7961 * ids.
7962 * @NVME_SC_SELF_TEST_IN_PROGRESS: Device Self-test In Progress: The controller
7963 * or NVM subsystem already has a device
7964 * self-test operation in process.
7965 * @NVME_SC_BP_WRITE_PROHIBITED: Boot Partition Write Prohibited: The
7966 * command is trying to modify a locked Boot
7967 * Partition.
7968 * @NVME_SC_INVALID_CTRL_ID: Invalid Controller Identifier:
7969 * @NVME_SC_INVALID_SEC_CTRL_STATE: Invalid Secondary Controller State
7970 * @NVME_SC_INVALID_CTRL_RESOURCES: Invalid Number of Controller Resources
7971 * @NVME_SC_INVALID_RESOURCE_ID: Invalid Resource Identifier
7972 * @NVME_SC_PMR_SAN_PROHIBITED: Sanitize Prohibited While Persistent
7973 * Memory Region is Enabled
7974 * @NVME_SC_ANA_GROUP_ID_INVALID: ANA Group Identifier Invalid: The specified
7975 * ANA Group Identifier (ANAGRPID) is not
7976 * supported in the submitted command.
7977 * @NVME_SC_ANA_ATTACH_FAILED: ANA Attach Failed: The controller is not
7978 * attached to the namespace as a result
7979 * of an ANA condition.
7980 * @NVME_SC_INSUFFICIENT_CAP: Insufficient Capacity: Requested operation
7981 * requires more free space than is currently
7982 * available.
7983 * @NVME_SC_NS_ATTACHMENT_LIMIT_EXCEEDED: Namespace Attachment Limit Exceeded:
7984 * Attaching the ns to a controller causes
7985 * max number of ns attachments allowed
7986 * to be exceeded.
7987 * @NVME_SC_PROHIBIT_CMD_EXEC_NOT_SUPPORTED: Prohibition of Command Execution
7988 * Not Supported
7989 * @NVME_SC_IOCS_NOT_SUPPORTED: I/O Command Set Not Supported
7990 * @NVME_SC_IOCS_NOT_ENABLED: I/O Command Set Not Enabled
7991 * @NVME_SC_IOCS_COMBINATION_REJECTED: I/O Command Set Combination Rejected
7992 * @NVME_SC_INVALID_IOCS: Invalid I/O Command Set
7993 * @NVME_SC_ID_UNAVAILABLE: Identifier Unavailable
7994 * @NVME_SC_INVALID_DISCOVERY_INFO: The discovery information provided in
7995 * one or more extended discovery
7996 * information entries is not applicable
7997 * for the type of entity selected in
7998 * the Entity Type (ETYPE) field of the
7999 * Discovery Information Management
8000 * command data portion’s header.
8001 * @NVME_SC_ZONING_DATA_STRUCT_LOCKED:The requested Zoning data structure
8002 * is locked on the CDC.
8003 * @NVME_SC_ZONING_DATA_STRUCT_NOTFND:The requested Zoning data structure
8004 * does not exist on the CDC.
8005 * @NVME_SC_INSUFFICIENT_DISC_RES: The number of discover information
8006 * entries provided in the data portion
8007 * of the Discovery Information
8008 * Management command for a registration
8009 * task (i.e., TAS field cleared to 0h)
8010 * exceeds the available capacity for
8011 * new discovery information entries on
8012 * the CDC or DDC. This may be a
8013 * transient condition.
8014 * @NVME_SC_REQSTD_FUNCTION_DISABLED: Fabric Zoning is not enabled on the
8015 * CDC
8016 * @NVME_SC_ZONEGRP_ORIGINATOR_INVLD: The NQN contained in the ZoneGroup
8017 * Originator field does not match the
8018 * Host NQN used by the DDC to connect
8019 * to the CDC.
8020 * @NVME_SC_INVALID_CONTROLER_DATA_QUEUE: This error indicates that the
8021 * specified Controller Data Queue
8022 * Identifier is invalid for the controller
8023 * processing the command.
8024 * @NVME_SC_NOT_ENOUGH_RESOURCES: This error indicates that there is not
8025 * enough resources in the controller to
8026 * process the command.
8027 * @NVME_SC_CONTROLLER_SUSPENDED: The operation requested is not allowed if
8028 * the specified controller is suspended.
8029 * @NVME_SC_CONTROLLER_NOT_SUSPENDED: The operation requested is not allowed if
8030 * the specified controller is not
8031 * suspended.
8032 * @NVME_SC_CONTROLLER_DATA_QUEUE_FULL: The controller detected that a
8033 * Controller Data Queue became full.
8034 * @NVME_SC_BAD_ATTRIBUTES: Conflicting Dataset Management Attributes
8035 * @NVME_SC_INVALID_PI: Invalid Protection Information
8036 * @NVME_SC_READ_ONLY: Attempted Write to Read Only Range
8037 * @NVME_SC_CMD_SIZE_LIMIT_EXCEEDED: Command Size Limit Exceeded
8038 * @NVME_SC_INCOMPATIBLE_NS: Incompatible Namespace or Format: At
8039 * least one source namespace and the
8040 * destination namespace have incompatible
8041 * formats.
8042 * @NVME_SC_FAST_COPY_NOT_POSSIBLE: Fast Copy Not Possible: The Fast Copy
8043 * Only (FCO) bit was set to ‘1’ in a Source
8044 * Range entry and the controller was not
8045 * able to use fast copy operations to copy
8046 * the specified data.
8047 * @NVME_SC_OVERLAPPING_IO_RANGE: Overlapping I/O Range: A source logical
8048 * block range overlaps the destination
8049 * logical block range.
8050 * @NVME_SC_INSUFFICIENT_RESOURCES: Insufficient Resources: A resource
8051 * shortage prevented the controller from
8052 * performing the requested copy.
8053 * @NVME_SC_CONNECT_FORMAT: Incompatible Format: The NVM subsystem
8054 * does not support the record format
8055 * specified by the host.
8056 * @NVME_SC_CONNECT_CTRL_BUSY: Controller Busy: The controller is
8057 * already associated with a host.
8058 * @NVME_SC_CONNECT_INVALID_PARAM: Connect Invalid Parameters: One or more
8059 * of the command parameters.
8060 * @NVME_SC_CONNECT_RESTART_DISC: Connect Restart Discovery: The NVM
8061 * subsystem requested is not available.
8062 * @NVME_SC_CONNECT_INVALID_HOST: Connect Invalid Host: The host is either
8063 * not allowed to establish an association
8064 * to any controller in the NVM subsystem or
8065 * the host is not allowed to establish an
8066 * association to the specified controller
8067 * @NVME_SC_DISCONNECT_INVALID_QTYPE: Invalid Queue Type: The command was sent
8068 * on the wrong queue type.
8069 * @NVME_SC_DISCOVERY_RESTART: Discover Restart: The snapshot of the
8070 * records is now invalid or out of date.
8071 * @NVME_SC_AUTH_REQUIRED: Authentication Required: NVMe in-band
8072 * authentication is required and the queue
8073 * has not yet been authenticated.
8074 * @NVME_SC_WRITE_FAULT: Write Fault: The write data could not be
8075 * committed to the media.
8076 * @NVME_SC_READ_ERROR: Unrecovered Read Error: The read data
8077 * could not be recovered from the media.
8078 * @NVME_SC_GUARD_CHECK: End-to-end Guard Check Error: The command
8079 * was aborted due to an end-to-end guard
8080 * check failure.
8081 * @NVME_SC_APPTAG_CHECK: End-to-end Application Tag Check Error:
8082 * The command was aborted due to an
8083 * end-to-end application tag check failure.
8084 * @NVME_SC_REFTAG_CHECK: End-to-end Reference Tag Check Error: The
8085 * command was aborted due to an end-to-end
8086 * reference tag check failure.
8087 * @NVME_SC_COMPARE_FAILED: Compare Failure: The command failed due
8088 * to a miscompare during a Compare command.
8089 * @NVME_SC_ACCESS_DENIED: Access Denied: Access to the namespace
8090 * and/or LBA range is denied due to lack of
8091 * access rights.
8092 * @NVME_SC_UNWRITTEN_BLOCK: Deallocated or Unwritten Logical Block:
8093 * The command failed due to an attempt to
8094 * read from or verify an LBA range
8095 * containing a deallocated or unwritten
8096 * logical block.
8097 * @NVME_SC_STORAGE_TAG_CHECK: End-to-End Storage Tag Check Error: The
8098 * command was aborted due to an end-to-end
8099 * storage tag check failure.
8100 * @NVME_SC_ANA_INTERNAL_PATH_ERROR: Internal Path Error: The command was not
8101 * completed as the result of a controller
8102 * internal error that is specific to the
8103 * controller processing the command.
8104 * @NVME_SC_ANA_PERSISTENT_LOSS: Asymmetric Access Persistent Loss: The
8105 * requested function (e.g., command) is not
8106 * able to be performed as a result of the
8107 * relationship between the controller and
8108 * the namespace being in the ANA Persistent
8109 * Loss state.
8110 * @NVME_SC_ANA_INACCESSIBLE: Asymmetric Access Inaccessible: The
8111 * requested function (e.g., command) is not
8112 * able to be performed as a result of the
8113 * relationship between the controller and
8114 * the namespace being in the ANA
8115 * Inaccessible state.
8116 * @NVME_SC_ANA_TRANSITION: Asymmetric Access Transition: The
8117 * requested function (e.g., command) is not
8118 * able to be performed as a result of the
8119 * relationship between the controller and
8120 * the namespace transitioning between
8121 * Asymmetric Namespace Access states.
8122 * @NVME_SC_CTRL_PATH_ERROR: Controller Pathing Error: A pathing error
8123 * was detected by the controller.
8124 * @NVME_SC_HOST_PATH_ERROR: Host Pathing Error: A pathing error was
8125 * detected by the host.
8126 * @NVME_SC_CMD_ABORTED_BY_HOST: Command Aborted By Host: The command was
8127 * aborted as a result of host action.
8128 * @NVME_SC_CRD: Mask to get value of Command Retry Delay
8129 * index
8130 * @NVME_SC_MORE: More bit. If set, more status information
8131 * for this command as part of the Error
8132 * Information log that may be retrieved with
8133 * the Get Log Page command.
8134 * @NVME_SC_DNR: Do Not Retry bit. If set, if the same
8135 * command is re-submitted to any controller
8136 * in the NVM subsystem, then that
8137 * re-submitted command is expected to fail.
8138 * @NVME_SC_ZNS_INVALID_OP_REQUEST: Invalid Zone Operation Request:
8139 * The operation requested is invalid. This may be due to
8140 * various conditions, including: attempting to allocate a
8141 * ZRWA when a zone is not in the ZSE:Empty state; or
8142 * invalid Flush Explicit ZRWA Range Send Zone Action
8143 * operation.
8144 * @NVME_SC_ZNS_ZRWA_RESOURCES_UNAVAILABLE: ZRWA Resources Unavailable:
8145 * No ZRWAs are available.
8146 * @NVME_SC_ZNS_BOUNDARY_ERROR: Zone Boundary Error: The command specifies
8147 * logical blocks in more than one zone.
8148 * @NVME_SC_ZNS_FULL: Zone Is Full: The accessed zone is in the
8149 * ZSF:Full state.
8150 * @NVME_SC_ZNS_READ_ONLY: Zone Is Read Only: The accessed zone is
8151 * in the ZSRO:Read Only state.
8152 * @NVME_SC_ZNS_OFFLINE: Zone Is Offline: The accessed zone is
8153 * in the ZSO:Offline state.
8154 * @NVME_SC_ZNS_INVALID_WRITE: Zone Invalid Write: The write to a zone
8155 * was not at the write pointer.
8156 * @NVME_SC_ZNS_TOO_MANY_ACTIVE: Too Many Active Zones: The controller
8157 * does not allow additional active zones.
8158 * @NVME_SC_ZNS_TOO_MANY_OPENS: Too Many Open Zones: The controller does
8159 * not allow additional open zones.
8160 * @NVME_SC_ZNS_INVAL_TRANSITION: Invalid Zone State Transition: The request
8161 * is not a valid zone state transition.
8162 */
8163 enum nvme_status_field {
8164 /*
8165 * Status Code Type indicators
8166 */
8167 NVME_SCT_GENERIC = 0x0,
8168 NVME_SCT_CMD_SPECIFIC = 0x1,
8169 NVME_SCT_MEDIA = 0x2,
8170 NVME_SCT_PATH = 0x3,
8171 NVME_SCT_VS = 0x7,
8172 NVME_SCT_MASK = 0x7,
8173 NVME_SCT_SHIFT = 0x8,
8174
8175 /*
8176 * Status Code inidicators
8177 */
8178 NVME_SC_MASK = 0xff,
8179 NVME_SC_SHIFT = 0x0,
8180
8181 /*
8182 * Generic Command Status Codes:
8183 */
8184 NVME_SC_SUCCESS = 0x0,
8185 NVME_SC_INVALID_OPCODE = 0x1,
8186 NVME_SC_INVALID_FIELD = 0x2,
8187 NVME_SC_CMDID_CONFLICT = 0x3,
8188 NVME_SC_DATA_XFER_ERROR = 0x4,
8189 NVME_SC_POWER_LOSS = 0x5,
8190 NVME_SC_INTERNAL = 0x6,
8191 NVME_SC_ABORT_REQ = 0x7,
8192 NVME_SC_ABORT_QUEUE = 0x8,
8193 NVME_SC_FUSED_FAIL = 0x9,
8194 NVME_SC_FUSED_MISSING = 0xa,
8195 NVME_SC_INVALID_NS = 0xb,
8196 NVME_SC_CMD_SEQ_ERROR = 0xc,
8197 NVME_SC_SGL_INVALID_LAST = 0xd,
8198 NVME_SC_SGL_INVALID_COUNT = 0xe,
8199 NVME_SC_SGL_INVALID_DATA = 0xf,
8200 NVME_SC_SGL_INVALID_METADATA = 0x10,
8201 NVME_SC_SGL_INVALID_TYPE = 0x11,
8202 NVME_SC_CMB_INVALID_USE = 0x12,
8203 NVME_SC_PRP_INVALID_OFFSET = 0x13,
8204 NVME_SC_AWU_EXCEEDED = 0x14,
8205 NVME_SC_OP_DENIED = 0x15,
8206 NVME_SC_SGL_INVALID_OFFSET = 0x16,
8207 NVME_SC_HOSTID_FORMAT = 0x18,
8208 NVME_SC_KAT_EXPIRED = 0x19,
8209 NVME_SC_KAT_INVALID = 0x1a,
8210 NVME_SC_CMD_ABORTED_PREMEPT = 0x1b,
8211 NVME_SC_SANITIZE_FAILED = 0x1c,
8212 NVME_SC_SANITIZE_IN_PROGRESS = 0x1d,
8213 NVME_SC_SGL_INVALID_GRANULARITY = 0x1e,
8214 NVME_SC_CMD_IN_CMBQ_NOT_SUPP = 0x1f,
8215 NVME_SC_NS_WRITE_PROTECTED = 0x20,
8216 NVME_SC_CMD_INTERRUPTED = 0x21,
8217 NVME_SC_TRAN_TPORT_ERROR = 0x22,
8218 NVME_SC_PROHIBITED_BY_CMD_AND_FEAT = 0x23,
8219 NVME_SC_ADMIN_CMD_MEDIA_NOT_READY = 0x24,
8220 NVME_SC_INVALID_KEY_TAG = 0x25,
8221 NVME_SC_HOST_DISPERSED_NS_NOT_ENABLED = 0x26,
8222 NVME_SC_HOST_ID_NOT_INITIALIZED = 0x27,
8223 NVME_SC_INCORRECT_KEY = 0x28,
8224 NVME_SC_FDP_DISABLED = 0x29,
8225 NVME_SC_INVALID_PLACEMENT_HANDLE_LIST = 0x2A,
8226 NVME_SC_LBA_RANGE = 0x80,
8227 NVME_SC_CAP_EXCEEDED = 0x81,
8228 NVME_SC_NS_NOT_READY = 0x82,
8229 NVME_SC_RESERVATION_CONFLICT = 0x83,
8230 NVME_SC_FORMAT_IN_PROGRESS = 0x84,
8231 NVME_SC_INVALID_VALUE_SIZE = 0x85,
8232 NVME_SC_INVALID_KEY_SIZE = 0x86,
8233 NVME_SC_KV_KEY_NOT_EXISTS = 0x87,
8234 NVME_SC_UNRECOVERED_ERROR = 0x88,
8235 NVME_SC_KEY_EXISTS = 0x89,
8236
8237 /*
8238 * Command Specific Status Codes:
8239 */
8240 NVME_SC_CQ_INVALID = 0x00,
8241 NVME_SC_QID_INVALID = 0x01,
8242 NVME_SC_QUEUE_SIZE = 0x02,
8243 NVME_SC_ABORT_LIMIT = 0x03,
8244 NVME_SC_ABORT_MISSING = 0x04,
8245 NVME_SC_ASYNC_LIMIT = 0x05,
8246 NVME_SC_FIRMWARE_SLOT = 0x06,
8247 NVME_SC_FIRMWARE_IMAGE = 0x07,
8248 NVME_SC_INVALID_VECTOR = 0x08,
8249 NVME_SC_INVALID_LOG_PAGE = 0x09,
8250 NVME_SC_INVALID_FORMAT = 0x0a,
8251 NVME_SC_FW_NEEDS_CONV_RESET = 0x0b,
8252 NVME_SC_INVALID_QUEUE = 0x0c,
8253 NVME_SC_FEATURE_NOT_SAVEABLE = 0x0d,
8254 NVME_SC_FEATURE_NOT_CHANGEABLE = 0x0e,
8255 NVME_SC_FEATURE_NOT_PER_NS = 0x0f,
8256 NVME_SC_FW_NEEDS_SUBSYS_RESET = 0x10,
8257 NVME_SC_FW_NEEDS_RESET = 0x11,
8258 NVME_SC_FW_NEEDS_MAX_TIME = 0x12,
8259 NVME_SC_FW_ACTIVATE_PROHIBITED = 0x13,
8260 NVME_SC_OVERLAPPING_RANGE = 0x14,
8261 NVME_SC_NS_INSUFFICIENT_CAP = 0x15,
8262 NVME_SC_NS_ID_UNAVAILABLE = 0x16,
8263 NVME_SC_NS_ALREADY_ATTACHED = 0x18,
8264 NVME_SC_NS_IS_PRIVATE = 0x19,
8265 NVME_SC_NS_NOT_ATTACHED = 0x1a,
8266 NVME_SC_THIN_PROV_NOT_SUPP = 0x1b,
8267 NVME_SC_CTRL_LIST_INVALID = 0x1c,
8268 NVME_SC_SELF_TEST_IN_PROGRESS = 0x1d,
8269 NVME_SC_BP_WRITE_PROHIBITED = 0x1e,
8270 NVME_SC_INVALID_CTRL_ID = 0x1f,
8271 NVME_SC_INVALID_SEC_CTRL_STATE = 0x20,
8272 NVME_SC_INVALID_CTRL_RESOURCES = 0x21,
8273 NVME_SC_INVALID_RESOURCE_ID = 0x22,
8274 NVME_SC_PMR_SAN_PROHIBITED = 0x23,
8275 NVME_SC_ANA_GROUP_ID_INVALID = 0x24,
8276 NVME_SC_ANA_ATTACH_FAILED = 0x25,
8277 NVME_SC_INSUFFICIENT_CAP = 0x26,
8278 NVME_SC_NS_ATTACHMENT_LIMIT_EXCEEDED = 0x27,
8279 NVME_SC_PROHIBIT_CMD_EXEC_NOT_SUPPORTED = 0x28,
8280
8281 /*
8282 * Command Set Specific - Namespace Types commands:
8283 */
8284 NVME_SC_IOCS_NOT_SUPPORTED = 0x29,
8285 NVME_SC_IOCS_NOT_ENABLED = 0x2a,
8286 NVME_SC_IOCS_COMBINATION_REJECTED = 0x2b,
8287 NVME_SC_INVALID_IOCS = 0x2c,
8288 NVME_SC_ID_UNAVAILABLE = 0x2d,
8289
8290 /*
8291 * Discovery Information Management
8292 */
8293 NVME_SC_INVALID_DISCOVERY_INFO = 0x2f,
8294 NVME_SC_ZONING_DATA_STRUCT_LOCKED = 0x30,
8295 NVME_SC_ZONING_DATA_STRUCT_NOTFND = 0x31,
8296 NVME_SC_INSUFFICIENT_DISC_RES = 0x32,
8297 NVME_SC_REQSTD_FUNCTION_DISABLED = 0x33,
8298 NVME_SC_ZONEGRP_ORIGINATOR_INVLD = 0x34,
8299
8300 /*
8301 * Command Set Specific - Live Migration
8302 */
8303 NVME_SC_INVALID_CONTROLER_DATA_QUEUE = 0x37,
8304 NVME_SC_NOT_ENOUGH_RESOURCES = 0x38,
8305 NVME_SC_CONTROLLER_SUSPENDED = 0x39,
8306 NVME_SC_CONTROLLER_NOT_SUSPENDED = 0x3A,
8307 NVME_SC_CONTROLLER_DATA_QUEUE_FULL = 0x3B,
8308
8309 /*
8310 * I/O Command Set Specific - NVM commands:
8311 */
8312 NVME_SC_BAD_ATTRIBUTES = 0x80,
8313 NVME_SC_INVALID_PI = 0x81,
8314 NVME_SC_READ_ONLY = 0x82,
8315 NVME_SC_CMD_SIZE_LIMIT_EXCEEDED = 0x83,
8316 NVME_SC_INCOMPATIBLE_NS = 0x85,
8317 NVME_SC_FAST_COPY_NOT_POSSIBLE = 0x86,
8318 NVME_SC_OVERLAPPING_IO_RANGE = 0x87,
8319 NVME_SC_INSUFFICIENT_RESOURCES = 0x89,
8320
8321 /*
8322 * I/O Command Set Specific - Fabrics commands:
8323 */
8324 NVME_SC_CONNECT_FORMAT = 0x80,
8325 NVME_SC_CONNECT_CTRL_BUSY = 0x81,
8326 NVME_SC_CONNECT_INVALID_PARAM = 0x82,
8327 NVME_SC_CONNECT_RESTART_DISC = 0x83,
8328 NVME_SC_CONNECT_INVALID_HOST = 0x84,
8329 NVME_SC_DISCONNECT_INVALID_QTYPE= 0x85,
8330 NVME_SC_DISCOVERY_RESTART = 0x90,
8331 NVME_SC_AUTH_REQUIRED = 0x91,
8332
8333 /*
8334 * I/O Command Set Specific - ZNS commands:
8335 */
8336 NVME_SC_ZNS_INVALID_OP_REQUEST = 0xb6,
8337 NVME_SC_ZNS_ZRWA_RESOURCES_UNAVAILABLE = 0xb7,
8338 NVME_SC_ZNS_BOUNDARY_ERROR = 0xb8,
8339 NVME_SC_ZNS_FULL = 0xb9,
8340 NVME_SC_ZNS_READ_ONLY = 0xba,
8341 NVME_SC_ZNS_OFFLINE = 0xbb,
8342 NVME_SC_ZNS_INVALID_WRITE = 0xbc,
8343 NVME_SC_ZNS_TOO_MANY_ACTIVE = 0xbd,
8344 NVME_SC_ZNS_TOO_MANY_OPENS = 0xbe,
8345 NVME_SC_ZNS_INVAL_TRANSITION = 0xbf,
8346
8347 /*
8348 * Media and Data Integrity Errors:
8349 */
8350 NVME_SC_WRITE_FAULT = 0x80,
8351 NVME_SC_READ_ERROR = 0x81,
8352 NVME_SC_GUARD_CHECK = 0x82,
8353 NVME_SC_APPTAG_CHECK = 0x83,
8354 NVME_SC_REFTAG_CHECK = 0x84,
8355 NVME_SC_COMPARE_FAILED = 0x85,
8356 NVME_SC_ACCESS_DENIED = 0x86,
8357 NVME_SC_UNWRITTEN_BLOCK = 0x87,
8358 NVME_SC_STORAGE_TAG_CHECK = 0x88,
8359
8360 /*
8361 * Path-related Errors:
8362 */
8363 NVME_SC_ANA_INTERNAL_PATH_ERROR = 0x00,
8364 NVME_SC_ANA_PERSISTENT_LOSS = 0x01,
8365 NVME_SC_ANA_INACCESSIBLE = 0x02,
8366 NVME_SC_ANA_TRANSITION = 0x03,
8367 NVME_SC_CTRL_PATH_ERROR = 0x60,
8368 NVME_SC_HOST_PATH_ERROR = 0x70,
8369 NVME_SC_CMD_ABORTED_BY_HOST = 0x71,
8370
8371 /*
8372 * Additional status field flags
8373 */
8374 NVME_SC_CRD = 0x1800,
8375 NVME_SC_MORE = 0x2000,
8376 NVME_SC_DNR = 0x4000,
8377 };
8378
8379 /**
8380 * nvme_status_code_type() - Returns the NVMe Status Code Type
8381 * @status_field: The NVMe Completion Queue Entry's Status Field
8382 * See &enum nvme_status_field
8383 *
8384 * Returns: status code type
8385 */
8386 static inline __u16 nvme_status_code_type(__u16 status_field)
8387 {
8388 return NVME_GET(status_field, SCT);
8389 }
8390
8391 /**
8392 * nvme_status_code() - Returns the NVMe Status Code
8393 * @status_field: The NVMe Completion Queue Entry's Status Field
8394 * See &enum nvme_status_field
8395 *
8396 * Returns: status code
8397 */
8398 static inline __u16 nvme_status_code(__u16 status_field)
8399 {
8400 return NVME_GET(status_field, SC);
8401 }
8402
8403 /**
8404 * enum nvme_status_type - type encoding for NVMe return values, when
8405 * represented as an int.
8406 *
8407 * The nvme_* api returns an int, with negative values indicating an internal
8408 * or syscall error, zero signifying success, positive values representing
8409 * the NVMe status.
8410 *
8411 * That latter case (the NVMe status) may represent status values from
8412 * different parts of the transport/controller/etc, and are at most 16 bits of
8413 * data. So, we use the most-significant 3 bits of the signed int to indicate
8414 * which type of status this is.
8415 *
8416 * @NVME_STATUS_TYPE_SHIFT: shift value for status bits
8417 * @NVME_STATUS_TYPE_MASK: mask value for status bits
8418 *
8419 * @NVME_STATUS_TYPE_NVME: NVMe command status value, typically from CDW3
8420 * @NVME_STATUS_TYPE_MI: NVMe-MI header status
8421 */
8422 enum nvme_status_type {
8423 NVME_STATUS_TYPE_SHIFT = 27,
8424 NVME_STATUS_TYPE_MASK = 0x7,
8425
8426 NVME_STATUS_TYPE_NVME = 0,
8427 NVME_STATUS_TYPE_MI = 1,
8428 };
8429
8430 /**
8431 * nvme_status_get_type() - extract the type from a nvme_* return value
8432 * @status: the (non-negative) return value from the NVMe API
8433 *
8434 * Returns: the type component of the status.
8435 */
8436 static inline __u32 nvme_status_get_type(int status)
8437 {
8438 return NVME_GET(status, STATUS_TYPE);
8439 }
8440
8441 /**
8442 * nvme_status_get_value() - extract the status value from a nvme_* return
8443 * value
8444 * @status: the (non-negative) return value from the NVMe API
8445 *
8446 * Returns: the value component of the status; the set of values will depend
8447 * on the status type.
8448 */
8449 static inline __u32 nvme_status_get_value(int status)
8450 {
8451 return status & ~NVME_SET(NVME_STATUS_TYPE_MASK, STATUS_TYPE);
8452 }
8453
8454 /**
8455 * nvme_status_equals() - helper to check a status against a type and value
8456 * @status: the (non-negative) return value from the NVMe API
8457 * @type: the status type
8458 * @value: the status value
8459 *
8460 * Returns: true if @status is of the specified type and value
8461 */
8462 static inline __u32 nvme_status_equals(int status, enum nvme_status_type type,
8463 unsigned int value)
8464 {
8465 if (status < 0)
8466 return false;
8467
8468 return nvme_status_get_type(status) == type &&
8469 nvme_status_get_value(status) == value;
8470 }
8471
8472 /**
8473 * enum nvme_admin_opcode - Known NVMe admin opcodes
8474 * @nvme_admin_delete_sq: Delete I/O Submission Queue
8475 * @nvme_admin_create_sq: Create I/O Submission Queue
8476 * @nvme_admin_get_log_page: Get Log Page
8477 * @nvme_admin_delete_cq: Delete I/O Completion Queue
8478 * @nvme_admin_create_cq: Create I/O Completion Queue
8479 * @nvme_admin_identify: Identify
8480 * @nvme_admin_abort_cmd: Abort
8481 * @nvme_admin_set_features: Set Features
8482 * @nvme_admin_get_features: Get Features
8483 * @nvme_admin_async_event: Asynchronous Event Request
8484 * @nvme_admin_ns_mgmt: Namespace Management
8485 * @nvme_admin_fw_activate: Firmware Commit
8486 * @nvme_admin_fw_commit: Firmware Commit
8487 * @nvme_admin_fw_download: Firmware Image Download
8488 * @nvme_admin_dev_self_test: Device Self-test
8489 * @nvme_admin_ns_attach: Namespace Attachment
8490 * @nvme_admin_keep_alive: Keep Alive
8491 * @nvme_admin_directive_send: Directive Send
8492 * @nvme_admin_directive_recv: Directive Receive
8493 * @nvme_admin_virtual_mgmt: Virtualization Management
8494 * @nvme_admin_nvme_mi_send: NVMe-MI Send
8495 * @nvme_admin_nvme_mi_recv: NVMe-MI Receive
8496 * @nvme_admin_capacity_mgmt: Capacity Management
8497 * @nvme_admin_discovery_info_mgmt: Discovery Information Management (DIM)
8498 * @nvme_admin_fabric_zoning_recv: Fabric Zoning Receive
8499 * @nvme_admin_lockdown: Lockdown
8500 * @nvme_admin_fabric_zoning_lookup: Fabric Zoning Lookup
8501 * @nvme_admin_clear_export_nvm_res: Clear Exported NVM Resource Configuration
8502 * @nvme_admin_fabric_zoning_send: Fabric Zoning Send
8503 * @nvme_admin_create_export_nvms: Create Exported NVM Subsystem
8504 * @nvme_admin_manage_export_nvms: Manage Exported NVM Subsystem
8505 * @nvme_admin_manage_export_ns: Manage Exported Namespace
8506 * @nvme_admin_manage_export_port: Manage Exported Port
8507 * @nvme_admin_send_disc_log_page: Send Discovery Log Page
8508 * @nvme_admin_track_send: Track Send
8509 * @nvme_admin_track_receive: Track Receive
8510 * @nvme_admin_migration_send: Migration Send
8511 * @nvme_admin_migration_receive: Migration Receive
8512 * @nvme_admin_ctrl_data_queue: Controller Data Queue
8513 * @nvme_admin_dbbuf: Doorbell Buffer Config
8514 * @nvme_admin_fabrics: Fabrics Commands
8515 * @nvme_admin_format_nvm: Format NVM
8516 * @nvme_admin_security_send: Security Send
8517 * @nvme_admin_security_recv: Security Receive
8518 * @nvme_admin_sanitize_nvm: Sanitize
8519 * @nvme_admin_load_program: Load Program
8520 * @nvme_admin_get_lba_status: Get LBA Status
8521 * @nvme_admin_program_act_mgmt: Program Activation Management
8522 * @nvme_admin_mem_range_set_mgmt: Memory Range Set Management
8523 */
8524 enum nvme_admin_opcode {
8525 nvme_admin_delete_sq = 0x00,
8526 nvme_admin_create_sq = 0x01,
8527 nvme_admin_get_log_page = 0x02,
8528 nvme_admin_delete_cq = 0x04,
8529 nvme_admin_create_cq = 0x05,
8530 nvme_admin_identify = 0x06,
8531 nvme_admin_abort_cmd = 0x08,
8532 nvme_admin_set_features = 0x09,
8533 nvme_admin_get_features = 0x0a,
8534 nvme_admin_async_event = 0x0c,
8535 nvme_admin_ns_mgmt = 0x0d,
8536 nvme_admin_fw_commit = 0x10,
8537 nvme_admin_fw_activate = nvme_admin_fw_commit,
8538 nvme_admin_fw_download = 0x11,
8539 nvme_admin_dev_self_test = 0x14,
8540 nvme_admin_ns_attach = 0x15,
8541 nvme_admin_keep_alive = 0x18,
8542 nvme_admin_directive_send = 0x19,
8543 nvme_admin_directive_recv = 0x1a,
8544 nvme_admin_virtual_mgmt = 0x1c,
8545 nvme_admin_nvme_mi_send = 0x1d,
8546 nvme_admin_nvme_mi_recv = 0x1e,
8547 nvme_admin_capacity_mgmt = 0x20,
8548 nvme_admin_discovery_info_mgmt = 0x21,
8549 nvme_admin_fabric_zoning_recv = 0x22,
8550 nvme_admin_lockdown = 0x24,
8551 nvme_admin_fabric_zoning_lookup = 0x25,
8552 nvme_admin_clear_export_nvm_res = 0x28,
8553 nvme_admin_fabric_zoning_send = 0x29,
8554 nvme_admin_create_export_nvms = 0x2a,
8555 nvme_admin_manage_export_nvms = 0x2d,
8556 nvme_admin_manage_export_ns = 0x31,
8557 nvme_admin_manage_export_port = 0x35,
8558 nvme_admin_send_disc_log_page = 0x39,
8559 nvme_admin_track_send = 0x3d,
8560 nvme_admin_track_receive = 0x3e,
8561 nvme_admin_migration_send = 0x41,
8562 nvme_admin_migration_receive = 0x42,
8563 nvme_admin_ctrl_data_queue = 0x45,
8564 nvme_admin_dbbuf = 0x7c,
8565 nvme_admin_fabrics = 0x7f,
8566 nvme_admin_format_nvm = 0x80,
8567 nvme_admin_security_send = 0x81,
8568 nvme_admin_security_recv = 0x82,
8569 nvme_admin_sanitize_nvm = 0x84,
8570 nvme_admin_load_program = 0x85,
8571 nvme_admin_get_lba_status = 0x86,
8572 nvme_admin_program_act_mgmt = 0x88,
8573 nvme_admin_mem_range_set_mgmt = 0x89,
8574 };
8575
8576 /**
8577 * enum nvme_identify_cns - Identify - CNS Values
8578 * @NVME_IDENTIFY_CNS_NS: Identify Namespace data structure
8579 * @NVME_IDENTIFY_CNS_CTRL: Identify Controller data structure
8580 * @NVME_IDENTIFY_CNS_NS_ACTIVE_LIST: Active Namespace ID list
8581 * @NVME_IDENTIFY_CNS_NS_DESC_LIST: Namespace Identification Descriptor list
8582 * @NVME_IDENTIFY_CNS_NVMSET_LIST: NVM Set List
8583 * @NVME_IDENTIFY_CNS_CSI_NS: I/O Command Set specific Identify
8584 * Namespace data structure
8585 * @NVME_IDENTIFY_CNS_CSI_CTRL: I/O Command Set specific Identify
8586 * Controller data structure
8587 * @NVME_IDENTIFY_CNS_CSI_NS_ACTIVE_LIST: Active Namespace ID list associated
8588 * with the specified I/O Command Set
8589 * @NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS: I/O Command Set Independent Identify
8590 * @NVME_IDENTIFY_CNS_NS_USER_DATA_FORMAT: Namespace user data format
8591 * @NVME_IDENTIFY_CNS_CSI_NS_USER_DATA_FORMAT: I/O Command Set specific user data
8592 * format
8593 * Namespace data structure
8594 * @NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST: Allocated Namespace ID list
8595 * @NVME_IDENTIFY_CNS_ALLOCATED_NS: Identify Namespace data structure for
8596 * the specified allocated NSID
8597 * @NVME_IDENTIFY_CNS_NS_CTRL_LIST: Controller List of controllers attached
8598 * to the specified NSID
8599 * @NVME_IDENTIFY_CNS_CTRL_LIST: Controller List of controllers that exist
8600 * in the NVM subsystem
8601 * @NVME_IDENTIFY_CNS_PRIMARY_CTRL_CAP: Primary Controller Capabilities data
8602 * structure for the specified primary controller
8603 * @NVME_IDENTIFY_CNS_SECONDARY_CTRL_LIST: Secondary Controller list of controllers
8604 * associated with the primary controller
8605 * processing the command
8606 * @NVME_IDENTIFY_CNS_NS_GRANULARITY: A Namespace Granularity List
8607 * @NVME_IDENTIFY_CNS_UUID_LIST: A UUID List
8608 * @NVME_IDENTIFY_CNS_DOMAIN_LIST: Domain List
8609 * @NVME_IDENTIFY_CNS_ENDURANCE_GROUP_ID: Endurance Group List
8610 * @NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS_LIST: I/O Command Set specific Allocated Namespace
8611 * ID list
8612 * @NVME_IDENTIFY_CNS_CSI_ID_NS_DATA_STRUCTURE: I/O Command Set specific ID Namespace
8613 * Data Structure for Allocated Namespace ID
8614 * @NVME_IDENTIFY_CNS_COMMAND_SET_STRUCTURE: I/O Command Set data structure
8615 * @NVME_IDENTIFY_CNS_UNDERLYING_NS_LIST: Get Underlying Namespace List
8616 * @NVME_IDENTIFY_CNS_PORTS_LIST: Get Ports List
8617 * @NVME_IDENTIFY_CNS_IOCS_IND_ID_ALLOC_NS: I/O Command Set Independent Identify Namespace data
8618 * structure for the specified allocated NSID
8619 * @NVME_IDENTIFY_CNS_SUPPORTED_CTRL_STATE_FORMATS: Supported Controller State Formats
8620 * identifying the supported NVMe Controller
8621 * State data structures
8622 */
8623 enum nvme_identify_cns {
8624 NVME_IDENTIFY_CNS_NS = 0x00,
8625 NVME_IDENTIFY_CNS_CTRL = 0x01,
8626 NVME_IDENTIFY_CNS_NS_ACTIVE_LIST = 0x02,
8627 NVME_IDENTIFY_CNS_NS_DESC_LIST = 0x03,
8628 NVME_IDENTIFY_CNS_NVMSET_LIST = 0x04,
8629 NVME_IDENTIFY_CNS_CSI_NS = 0x05,
8630 NVME_IDENTIFY_CNS_CSI_CTRL = 0x06,
8631 NVME_IDENTIFY_CNS_CSI_NS_ACTIVE_LIST = 0x07,
8632 NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS = 0x08,
8633 NVME_IDENTIFY_CNS_NS_USER_DATA_FORMAT = 0x09,
8634 NVME_IDENTIFY_CNS_CSI_NS_USER_DATA_FORMAT = 0x0A,
8635 NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST = 0x10,
8636 NVME_IDENTIFY_CNS_ALLOCATED_NS = 0x11,
8637 NVME_IDENTIFY_CNS_NS_CTRL_LIST = 0x12,
8638 NVME_IDENTIFY_CNS_CTRL_LIST = 0x13,
8639 NVME_IDENTIFY_CNS_PRIMARY_CTRL_CAP = 0x14,
8640 NVME_IDENTIFY_CNS_SECONDARY_CTRL_LIST = 0x15,
8641 NVME_IDENTIFY_CNS_NS_GRANULARITY = 0x16,
8642 NVME_IDENTIFY_CNS_UUID_LIST = 0x17,
8643 NVME_IDENTIFY_CNS_DOMAIN_LIST = 0x18,
8644 NVME_IDENTIFY_CNS_ENDURANCE_GROUP_ID = 0x19,
8645 NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS_LIST = 0x1A,
8646 NVME_IDENTIFY_CNS_CSI_ID_NS_DATA_STRUCTURE = 0x1B,
8647 NVME_IDENTIFY_CNS_COMMAND_SET_STRUCTURE = 0x1C,
8648 NVME_IDENTIFY_CNS_UNDERLYING_NS_LIST = 0x1D,
8649 NVME_IDENTIFY_CNS_PORTS_LIST = 0x1E,
8650 NVME_IDENTIFY_CNS_IOCS_IND_ID_ALLOC_NS = 0x1F,
8651 NVME_IDENTIFY_CNS_SUPPORTED_CTRL_STATE_FORMATS = 0x20,
8652 };
8653
8654 /**
8655 * enum nvme_cmd_get_log_lid - Get Log Page -Log Page Identifiers
8656 * @NVME_LOG_LID_SUPPORTED_LOG_PAGES: Supported Log Pages
8657 * @NVME_LOG_LID_ERROR: Error Information
8658 * @NVME_LOG_LID_SMART: SMART / Health Information
8659 * @NVME_LOG_LID_FW_SLOT: Firmware Slot Information
8660 * @NVME_LOG_LID_CHANGED_NS: Changed Namespace List
8661 * @NVME_LOG_LID_CMD_EFFECTS: Commands Supported and Effects
8662 * @NVME_LOG_LID_DEVICE_SELF_TEST: Device Self-test
8663 * @NVME_LOG_LID_TELEMETRY_HOST: Telemetry Host-Initiated
8664 * @NVME_LOG_LID_TELEMETRY_CTRL: Telemetry Controller-Initiated
8665 * @NVME_LOG_LID_ENDURANCE_GROUP: Endurance Group Information
8666 * @NVME_LOG_LID_PREDICTABLE_LAT_NVMSET: Predictable Latency Per NVM Set
8667 * @NVME_LOG_LID_PREDICTABLE_LAT_AGG: Predictable Latency Event Aggregate
8668 * @NVME_LOG_LID_ANA: Asymmetric Namespace Access
8669 * @NVME_LOG_LID_PERSISTENT_EVENT: Persistent Event Log
8670 * @NVME_LOG_LID_LBA_STATUS: LBA Status Information
8671 * @NVME_LOG_LID_ENDURANCE_GRP_EVT: Endurance Group Event Aggregate
8672 * @NVME_LOG_LID_MEDIA_UNIT_STATUS: Media Unit Status
8673 * @NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST: Supported Capacity Configuration Lis
8674 * @NVME_LOG_LID_FID_SUPPORTED_EFFECTS: Feature Identifiers Supported and Effects
8675 * @NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS: NVMe-MI Commands Supported and Effects
8676 * @NVME_LOG_LID_CMD_AND_FEAT_LOCKDOWN: Command and Feature Lockdown
8677 * @NVME_LOG_LID_BOOT_PARTITION: Boot Partition
8678 * @NVME_LOG_LID_ROTATIONAL_MEDIA_INFO: Rotational Media Information
8679 * @NVME_LOG_LID_DISPERSED_NS_PARTICIPATING_NSS:Dispersed Namespace Participating NVM Subsystems
8680 * @NVME_LOG_LID_MGMT_ADDR_LIST: Management Address List
8681 * @NVME_LOG_LID_PHY_RX_EOM: Physical Interface Receiver Eye Opening Measurement
8682 * @NVME_LOG_LID_REACHABILITY_GROUPS: Reachability Groups
8683 * @NVME_LOG_LID_REACHABILITY_ASSOCIATIONS: Reachability Associations
8684 * @NVME_LOG_LID_CHANGED_ALLOC_NS_LIST: Changed Allocated Namespace List
8685 * @NVME_LOG_LID_FDP_CONFIGS: FDP Configurations
8686 * @NVME_LOG_LID_FDP_RUH_USAGE: Reclaim Unit Handle Usage
8687 * @NVME_LOG_LID_FDP_STATS: FDP Statistics
8688 * @NVME_LOG_LID_FDP_EVENTS: FDP Events
8689 * @NVME_LOG_LID_DISCOVER: Discovery
8690 * @NVME_LOG_LID_HOST_DISCOVER: Host Discovery
8691 * @NVME_LOG_LID_AVE_DISCOVER: AVE Discovery
8692 * @NVME_LOG_LID_PULL_MODEL_DDC_REQ: Pull Model DDC Request
8693 * @NVME_LOG_LID_RESERVATION: Reservation Notification
8694 * @NVME_LOG_LID_SANITIZE: Sanitize Status
8695 * @NVME_LOG_LID_ZNS_CHANGED_ZONES: Changed Zone List
8696 */
8697 enum nvme_cmd_get_log_lid {
8698 NVME_LOG_LID_SUPPORTED_LOG_PAGES = 0x00,
8699 NVME_LOG_LID_ERROR = 0x01,
8700 NVME_LOG_LID_SMART = 0x02,
8701 NVME_LOG_LID_FW_SLOT = 0x03,
8702 NVME_LOG_LID_CHANGED_NS = 0x04,
8703 NVME_LOG_LID_CMD_EFFECTS = 0x05,
8704 NVME_LOG_LID_DEVICE_SELF_TEST = 0x06,
8705 NVME_LOG_LID_TELEMETRY_HOST = 0x07,
8706 NVME_LOG_LID_TELEMETRY_CTRL = 0x08,
8707 NVME_LOG_LID_ENDURANCE_GROUP = 0x09,
8708 NVME_LOG_LID_PREDICTABLE_LAT_NVMSET = 0x0a,
8709 NVME_LOG_LID_PREDICTABLE_LAT_AGG = 0x0b,
8710 NVME_LOG_LID_ANA = 0x0c,
8711 NVME_LOG_LID_PERSISTENT_EVENT = 0x0d,
8712 NVME_LOG_LID_LBA_STATUS = 0x0e,
8713 NVME_LOG_LID_ENDURANCE_GRP_EVT = 0x0f,
8714 NVME_LOG_LID_MEDIA_UNIT_STATUS = 0x10,
8715 NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST = 0x11,
8716 NVME_LOG_LID_FID_SUPPORTED_EFFECTS = 0x12,
8717 NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS = 0x13,
8718 NVME_LOG_LID_CMD_AND_FEAT_LOCKDOWN = 0x14,
8719 NVME_LOG_LID_BOOT_PARTITION = 0x15,
8720 NVME_LOG_LID_ROTATIONAL_MEDIA_INFO = 0x16,
8721 NVME_LOG_LID_DISPERSED_NS_PARTICIPATING_NSS = 0x17,
8722 NVME_LOG_LID_MGMT_ADDR_LIST = 0x18,
8723 NVME_LOG_LID_PHY_RX_EOM = 0x19,
8724 NVME_LOG_LID_REACHABILITY_GROUPS = 0x1a,
8725 NVME_LOG_LID_REACHABILITY_ASSOCIATIONS = 0x1b,
8726 NVME_LOG_LID_CHANGED_ALLOC_NS_LIST = 0x1c,
8727 NVME_LOG_LID_FDP_CONFIGS = 0x20,
8728 NVME_LOG_LID_FDP_RUH_USAGE = 0x21,
8729 NVME_LOG_LID_FDP_STATS = 0x22,
8730 NVME_LOG_LID_FDP_EVENTS = 0x23,
8731 NVME_LOG_LID_DISCOVER = 0x70,
8732 NVME_LOG_LID_HOST_DISCOVER = 0x71,
8733 NVME_LOG_LID_AVE_DISCOVER = 0x72,
8734 NVME_LOG_LID_PULL_MODEL_DDC_REQ = 0x73,
8735 NVME_LOG_LID_RESERVATION = 0x80,
8736 NVME_LOG_LID_SANITIZE = 0x81,
8737 NVME_LOG_LID_ZNS_CHANGED_ZONES = 0xbf,
8738 };
8739
8740 /**
8741 * enum nvme_features_id - Features - Feature Identifiers
8742 * @NVME_FEAT_FID_ARBITRATION: Arbitration
8743 * @NVME_FEAT_FID_POWER_MGMT: Power Management
8744 * @NVME_FEAT_FID_LBA_RANGE: LBA Range Type
8745 * @NVME_FEAT_FID_TEMP_THRESH: Temperature Threshold
8746 * @NVME_FEAT_FID_ERR_RECOVERY: Error Recovery
8747 * @NVME_FEAT_FID_VOLATILE_WC: Volatile Write Cache
8748 * @NVME_FEAT_FID_NUM_QUEUES: Number of Queues
8749 * @NVME_FEAT_FID_IRQ_COALESCE: Interrupt Coalescing
8750 * @NVME_FEAT_FID_IRQ_CONFIG: Interrupt Vector Configuration
8751 * @NVME_FEAT_FID_WRITE_ATOMIC: Write Atomicity Normal
8752 * @NVME_FEAT_FID_ASYNC_EVENT: Asynchronous Event Configuration
8753 * @NVME_FEAT_FID_AUTO_PST: Autonomous Power State Transition
8754 * @NVME_FEAT_FID_HOST_MEM_BUF: Host Memory Buffer
8755 * @NVME_FEAT_FID_TIMESTAMP: Timestamp
8756 * @NVME_FEAT_FID_KATO: Keep Alive Timer
8757 * @NVME_FEAT_FID_HCTM: Host Controlled Thermal Management
8758 * @NVME_FEAT_FID_NOPSC: Non-Operational Power State Config
8759 * @NVME_FEAT_FID_RRL: Read Recovery Level Config
8760 * @NVME_FEAT_FID_PLM_CONFIG: Predictable Latency Mode Config
8761 * @NVME_FEAT_FID_PLM_WINDOW: Predictable Latency Mode Window
8762 * @NVME_FEAT_FID_LBA_STS_INTERVAL: LBA Status Information Report Interval
8763 * @NVME_FEAT_FID_HOST_BEHAVIOR: Host Behavior Support
8764 * @NVME_FEAT_FID_SANITIZE: Sanitize Config
8765 * @NVME_FEAT_FID_ENDURANCE_EVT_CFG: Endurance Group Event Configuration
8766 * @NVME_FEAT_FID_IOCS_PROFILE: I/O Command Set Profile
8767 * @NVME_FEAT_FID_SPINUP_CONTROL: Spinup Control
8768 * @NVME_FEAT_FID_POWER_LOSS_SIGNAL: Power Loss Signaling Config
8769 * @NVME_FEAT_FID_PERF_CHARACTERISTICS: Performance Characteristics
8770 * @NVME_FEAT_FID_FDP: Flexible Data Placement
8771 * @NVME_FEAT_FID_FDP_EVENTS: FDP Events
8772 * @NVME_FEAT_FID_NS_ADMIN_LABEL: Namespace Admin Label
8773 * @NVME_FEAT_FID_KEY_VALUE: Key Value Configuration
8774 * @NVME_FEAT_FID_CTRL_DATA_QUEUE: Controller Data Queue
8775 * @NVME_FEAT_FID_EMB_MGMT_CTRL_ADDR: Embedded Management Controller Address
8776 * @NVME_FEAT_FID_HOST_MGMT_AGENT_ADDR: Host Management Agent Address
8777 * @NVME_FEAT_FID_ENH_CTRL_METADATA: Enhanced Controller Metadata
8778 * @NVME_FEAT_FID_CTRL_METADATA: Controller Metadata
8779 * @NVME_FEAT_FID_NS_METADATA: Namespace Metadata
8780 * @NVME_FEAT_FID_SW_PROGRESS: Software Progress Marker
8781 * @NVME_FEAT_FID_HOST_ID: Host Identifier
8782 * @NVME_FEAT_FID_RESV_MASK: Reservation Notification Mask
8783 * @NVME_FEAT_FID_RESV_PERSIST: Reservation Persistence
8784 * @NVME_FEAT_FID_WRITE_PROTECT: Namespace Write Protection Config
8785 * @NVME_FEAT_FID_BP_WRITE_PROTECT: Boot Partition Write Protection Config
8786 */
8787 enum nvme_features_id {
8788 NVME_FEAT_FID_ARBITRATION = 0x01,
8789 NVME_FEAT_FID_POWER_MGMT = 0x02,
8790 NVME_FEAT_FID_LBA_RANGE = 0x03,
8791 NVME_FEAT_FID_TEMP_THRESH = 0x04,
8792 NVME_FEAT_FID_ERR_RECOVERY = 0x05,
8793 NVME_FEAT_FID_VOLATILE_WC = 0x06,
8794 NVME_FEAT_FID_NUM_QUEUES = 0x07,
8795 NVME_FEAT_FID_IRQ_COALESCE = 0x08,
8796 NVME_FEAT_FID_IRQ_CONFIG = 0x09,
8797 NVME_FEAT_FID_WRITE_ATOMIC = 0x0a,
8798 NVME_FEAT_FID_ASYNC_EVENT = 0x0b,
8799 NVME_FEAT_FID_AUTO_PST = 0x0c,
8800 NVME_FEAT_FID_HOST_MEM_BUF = 0x0d,
8801 NVME_FEAT_FID_TIMESTAMP = 0x0e,
8802 NVME_FEAT_FID_KATO = 0x0f,
8803 NVME_FEAT_FID_HCTM = 0x10,
8804 NVME_FEAT_FID_NOPSC = 0x11,
8805 NVME_FEAT_FID_RRL = 0x12,
8806 NVME_FEAT_FID_PLM_CONFIG = 0x13,
8807 NVME_FEAT_FID_PLM_WINDOW = 0x14,
8808 NVME_FEAT_FID_LBA_STS_INTERVAL = 0x15,
8809 NVME_FEAT_FID_HOST_BEHAVIOR = 0x16,
8810 NVME_FEAT_FID_SANITIZE = 0x17,
8811 NVME_FEAT_FID_ENDURANCE_EVT_CFG = 0x18,
8812 NVME_FEAT_FID_IOCS_PROFILE = 0x19,
8813 NVME_FEAT_FID_SPINUP_CONTROL = 0x1a,
8814 NVME_FEAT_FID_POWER_LOSS_SIGNAL = 0x1b,
8815 NVME_FEAT_FID_PERF_CHARACTERISTICS = 0x1c,
8816 NVME_FEAT_FID_FDP = 0x1d,
8817 NVME_FEAT_FID_FDP_EVENTS = 0x1e,
8818 NVME_FEAT_FID_NS_ADMIN_LABEL = 0x1f,
8819 NVME_FEAT_FID_KEY_VALUE = 0x20,
8820 NVME_FEAT_FID_CTRL_DATA_QUEUE = 0x21,
8821 NVME_FEAT_FID_EMB_MGMT_CTRL_ADDR = 0x78,
8822 NVME_FEAT_FID_HOST_MGMT_AGENT_ADDR = 0x79,
8823 NVME_FEAT_FID_ENH_CTRL_METADATA = 0x7d,
8824 NVME_FEAT_FID_CTRL_METADATA = 0x7e,
8825 NVME_FEAT_FID_NS_METADATA = 0x7f,
8826 NVME_FEAT_FID_SW_PROGRESS = 0x80,
8827 NVME_FEAT_FID_HOST_ID = 0x81,
8828 NVME_FEAT_FID_RESV_MASK = 0x82,
8829 NVME_FEAT_FID_RESV_PERSIST = 0x83,
8830 NVME_FEAT_FID_WRITE_PROTECT = 0x84,
8831 NVME_FEAT_FID_BP_WRITE_PROTECT = 0x85,
8832 };
8833
8834 /**
8835 * enum nvme_feat - Features Access Shifts/Masks values
8836 * @NVME_FEAT_ARBITRATION_BURST_SHIFT:
8837 * @NVME_FEAT_ARBITRATION_BURST_MASK:
8838 * @NVME_FEAT_ARBITRATION_LPW_SHIFT:
8839 * @NVME_FEAT_ARBITRATION_LPW_MASK:
8840 * @NVME_FEAT_ARBITRATION_MPW_SHIFT:
8841 * @NVME_FEAT_ARBITRATION_MPW_MASK:
8842 * @NVME_FEAT_ARBITRATION_HPW_SHIFT:
8843 * @NVME_FEAT_ARBITRATION_HPW_MASK:
8844 * @NVME_FEAT_PWRMGMT_PS_SHIFT:
8845 * @NVME_FEAT_PWRMGMT_PS_MASK:
8846 * @NVME_FEAT_PWRMGMT_WH_SHIFT:
8847 * @NVME_FEAT_PWRMGMT_WH_MASK:
8848 * @NVME_FEAT_LBAR_NR_SHIFT:
8849 * @NVME_FEAT_LBAR_NR_MASK:
8850 * @NVME_FEAT_TT_TMPTH_SHIFT:
8851 * @NVME_FEAT_TT_TMPTH_MASK:
8852 * @NVME_FEAT_TT_TMPSEL_SHIFT:
8853 * @NVME_FEAT_TT_TMPSEL_MASK:
8854 * @NVME_FEAT_TT_THSEL_SHIFT:
8855 * @NVME_FEAT_TT_THSEL_MASK:
8856 * @NVME_FEAT_TT_TMPTHH_SHIFT:
8857 * @NVME_FEAT_TT_TMPTHH_MASK:
8858 * @NVME_FEAT_ERROR_RECOVERY_TLER_SHIFT:
8859 * @NVME_FEAT_ERROR_RECOVERY_TLER_MASK:
8860 * @NVME_FEAT_ERROR_RECOVERY_DULBE_SHIFT:
8861 * @NVME_FEAT_ERROR_RECOVERY_DULBE_MASK:
8862 * @NVME_FEAT_VWC_WCE_SHIFT:
8863 * @NVME_FEAT_VWC_WCE_MASK:
8864 * @NVME_FEAT_NRQS_NSQR_SHIFT:
8865 * @NVME_FEAT_NRQS_NSQR_MASK:
8866 * @NVME_FEAT_NRQS_NCQR_SHIFT:
8867 * @NVME_FEAT_NRQS_NCQR_MASK:
8868 * @NVME_FEAT_IRQC_THR_SHIFT:
8869 * @NVME_FEAT_IRQC_THR_MASK:
8870 * @NVME_FEAT_IRQC_TIME_SHIFT:
8871 * @NVME_FEAT_IRQC_TIME_MASK:
8872 * @NVME_FEAT_ICFG_IV_SHIFT:
8873 * @NVME_FEAT_ICFG_IV_MASK:
8874 * @NVME_FEAT_ICFG_CD_SHIFT:
8875 * @NVME_FEAT_ICFG_CD_MASK:
8876 * @NVME_FEAT_WA_DN_SHIFT:
8877 * @NVME_FEAT_WA_DN_MASK:
8878 * @NVME_FEAT_AE_SMART_SHIFT:
8879 * @NVME_FEAT_AE_SMART_MASK:
8880 * @NVME_FEAT_AE_NAN_SHIFT:
8881 * @NVME_FEAT_AE_NAN_MASK:
8882 * @NVME_FEAT_AE_FW_SHIFT:
8883 * @NVME_FEAT_AE_FW_MASK:
8884 * @NVME_FEAT_AE_TELEM_SHIFT:
8885 * @NVME_FEAT_AE_TELEM_MASK:
8886 * @NVME_FEAT_AE_ANA_SHIFT:
8887 * @NVME_FEAT_AE_ANA_MASK:
8888 * @NVME_FEAT_AE_PLA_SHIFT:
8889 * @NVME_FEAT_AE_PLA_MASK:
8890 * @NVME_FEAT_AE_LBAS_SHIFT:
8891 * @NVME_FEAT_AE_LBAS_MASK:
8892 * @NVME_FEAT_AE_EGA_SHIFT:
8893 * @NVME_FEAT_AE_EGA_MASK:
8894 * @NVME_FEAT_AE_NNSSHDN_SHIFT:
8895 * @NVME_FEAT_AE_NNSSHDN_MASK:
8896 * @NVME_FEAT_AE_TTHRY_SHIFT:
8897 * @NVME_FEAT_AE_TTHRY_MASK:
8898 * @NVME_FEAT_AE_RASSN_SHIFT:
8899 * @NVME_FEAT_AE_RASSN_MASK:
8900 * @NVME_FEAT_AE_RGRP0_SHIFT:
8901 * @NVME_FEAT_AE_RGRP0_MASK:
8902 * @NVME_FEAT_AE_ANSAN_SHIFT:
8903 * @NVME_FEAT_AE_ANSAN_MASK:
8904 * @NVME_FEAT_AE_ZDCN_SHIFT:
8905 * @NVME_FEAT_AE_ZDCN_MASK:
8906 * @NVME_FEAT_AE_PMDRLPCN_SHIFT:
8907 * @NVME_FEAT_AE_PMDRLPCN_MASK:
8908 * @NVME_FEAT_AE_ADLPCN_SHIFT:
8909 * @NVME_FEAT_AE_ADLPCN_MASK:
8910 * @NVME_FEAT_AE_HDLPCN_SHIFT:
8911 * @NVME_FEAT_AE_HDLPCN_MASK:
8912 * @NVME_FEAT_AE_DLPCN_SHIFT:
8913 * @NVME_FEAT_AE_DLPCN_MASK:
8914 * @NVME_FEAT_APST_APSTE_SHIFT:
8915 * @NVME_FEAT_APST_APSTE_MASK:
8916 * @NVME_FEAT_HMEM_EHM_SHIFT:
8917 * @NVME_FEAT_HMEM_EHM_MASK:
8918 * @NVME_FEAT_HCTM_TMT2_SHIFT:
8919 * @NVME_FEAT_HCTM_TMT2_MASK:
8920 * @NVME_FEAT_HCTM_TMT1_SHIFT:
8921 * @NVME_FEAT_HCTM_TMT1_MASK:
8922 * @NVME_FEAT_NOPS_NOPPME_SHIFT:
8923 * @NVME_FEAT_NOPS_NOPPME_MASK:
8924 * @NVME_FEAT_RRL_RRL_SHIFT:
8925 * @NVME_FEAT_RRL_RRL_MASK:
8926 * @NVME_FEAT_PLM_PLME_SHIFT:
8927 * @NVME_FEAT_PLM_PLME_MASK:
8928 * @NVME_FEAT_PLMW_WS_SHIFT:
8929 * @NVME_FEAT_PLMW_WS_MASK:
8930 * @NVME_FEAT_LBAS_LSIRI_SHIFT:
8931 * @NVME_FEAT_LBAS_LSIRI_MASK:
8932 * @NVME_FEAT_LBAS_LSIPI_SHIFT:
8933 * @NVME_FEAT_LBAS_LSIPI_MASK:
8934 * @NVME_FEAT_SC_NODRM_SHIFT:
8935 * @NVME_FEAT_SC_NODRM_MASK:
8936 * @NVME_FEAT_EG_ENDGID_SHIFT:
8937 * @NVME_FEAT_EG_ENDGID_MASK:
8938 * @NVME_FEAT_EG_EGCW_SHIFT:
8939 * @NVME_FEAT_EG_EGCW_MASK:
8940 * @NVME_FEAT_FDPE_PHNDL_SHIFT:
8941 * @NVME_FEAT_FDPE_PHNDL_MASK:
8942 * @NVME_FEAT_FDPE_NOET_SHIFT:
8943 * @NVME_FEAT_FDPE_NOET_MASK:
8944 * @NVME_FEAT_SPM_PBSLC_SHIFT:
8945 * @NVME_FEAT_SPM_PBSLC_MASK:
8946 * @NVME_FEAT_HOSTID_EXHID_SHIFT:
8947 * @NVME_FEAT_HOSTID_EXHID_MASK:
8948 * @NVME_FEAT_RM_REGPRE_SHIFT:
8949 * @NVME_FEAT_RM_REGPRE_MASK:
8950 * @NVME_FEAT_RM_RESREL_SHIFT:
8951 * @NVME_FEAT_RM_RESREL_MASK:
8952 * @NVME_FEAT_RM_RESPRE_SHIFT:
8953 * @NVME_FEAT_RM_RESPRE_MASK:
8954 * @NVME_FEAT_RP_PTPL_SHIFT:
8955 * @NVME_FEAT_RP_PTPL_MASK:
8956 * @NVME_FEAT_WP_WPS_SHIFT:
8957 * @NVME_FEAT_WP_WPS_MASK:
8958 * @NVME_FEAT_IOCSP_IOCSCI_SHIFT:
8959 * @NVME_FEAT_IOCSP_IOCSCI_MASK:
8960 * @NVME_FEAT_SPINUP_CONTROL_SHIFT:
8961 * @NVME_FEAT_SPINUP_CONTROL_MASK:
8962 * @NVME_FEAT_PLS_MODE_SHIFT:
8963 * @NVME_FEAT_PLS_MODE_MASK:
8964 * @NVME_FEAT_PERFC_ATTRI_SHIFT:
8965 * @NVME_FEAT_PERFC_ATTRI_MASK:
8966 * @NVME_FEAT_PERFC_RVSPA_SHIFT:
8967 * @NVME_FEAT_PERFC_RVSPA_MASK:
8968 * @NVME_FEAT_PERFC_ATTRTYP_SHIFT:
8969 * @NVME_FEAT_PERFC_ATTRTYP_MASK:
8970 * @NVME_FEAT_FDP_ENABLED_SHIFT:
8971 * @NVME_FEAT_FDP_ENABLED_MASK:
8972 * @NVME_FEAT_FDP_INDEX_SHIFT:
8973 * @NVME_FEAT_FDP_INDEX_MASK:
8974 * @NVME_FEAT_FDP_EVENTS_ENABLE_SHIFT:
8975 * @NVME_FEAT_FDP_EVENTS_ENABLE_MASK:
8976 * @NVME_FEAT_BPWPC_BP0WPS_SHIFT:
8977 * @NVME_FEAT_BPWPC_BP0WPS_MASK:
8978 * @NVME_FEAT_BPWPC_BP1WPS_SHIFT:
8979 * @NVME_FEAT_BPWPC_BP1WPS_MASK:
8980 */
8981 enum nvme_feat {
8982 NVME_FEAT_ARBITRATION_BURST_SHIFT = 0,
8983 NVME_FEAT_ARBITRATION_BURST_MASK = 0x7,
8984 NVME_FEAT_ARBITRATION_LPW_SHIFT = 8,
8985 NVME_FEAT_ARBITRATION_LPW_MASK = 0xff,
8986 NVME_FEAT_ARBITRATION_MPW_SHIFT = 16,
8987 NVME_FEAT_ARBITRATION_MPW_MASK = 0xff,
8988 NVME_FEAT_ARBITRATION_HPW_SHIFT = 24,
8989 NVME_FEAT_ARBITRATION_HPW_MASK = 0xff,
8990 NVME_FEAT_PWRMGMT_PS_SHIFT = 0,
8991 NVME_FEAT_PWRMGMT_PS_MASK = 0x1f,
8992 NVME_FEAT_PWRMGMT_WH_SHIFT = 5,
8993 NVME_FEAT_PWRMGMT_WH_MASK = 0x7,
8994 NVME_FEAT_LBAR_NR_SHIFT = 0,
8995 NVME_FEAT_LBAR_NR_MASK = 0x3f,
8996 NVME_FEAT_TT_TMPTH_SHIFT = 0,
8997 NVME_FEAT_TT_TMPTH_MASK = 0xffff,
8998 NVME_FEAT_TT_TMPSEL_SHIFT = 16,
8999 NVME_FEAT_TT_TMPSEL_MASK = 0xf,
9000 NVME_FEAT_TT_THSEL_SHIFT = 20,
9001 NVME_FEAT_TT_THSEL_MASK = 0x3,
9002 NVME_FEAT_TT_TMPTHH_SHIFT = 22,
9003 NVME_FEAT_TT_TMPTHH_MASK = 0x7,
9004 NVME_FEAT_ERROR_RECOVERY_TLER_SHIFT = 0,
9005 NVME_FEAT_ERROR_RECOVERY_TLER_MASK = 0xffff,
9006 NVME_FEAT_ERROR_RECOVERY_DULBE_SHIFT = 16,
9007 NVME_FEAT_ERROR_RECOVERY_DULBE_MASK = 0x1,
9008 NVME_FEAT_VWC_WCE_SHIFT = 0,
9009 NVME_FEAT_VWC_WCE_MASK = 0x1,
9010 NVME_FEAT_NRQS_NSQR_SHIFT = 0,
9011 NVME_FEAT_NRQS_NSQR_MASK = 0xffff,
9012 NVME_FEAT_NRQS_NCQR_SHIFT = 16,
9013 NVME_FEAT_NRQS_NCQR_MASK = 0xffff,
9014 NVME_FEAT_IRQC_THR_SHIFT = 0,
9015 NVME_FEAT_IRQC_THR_MASK = 0xff,
9016 NVME_FEAT_IRQC_TIME_SHIFT = 8,
9017 NVME_FEAT_IRQC_TIME_MASK = 0xff,
9018 NVME_FEAT_ICFG_IV_SHIFT = 0,
9019 NVME_FEAT_ICFG_IV_MASK = 0xffff,
9020 NVME_FEAT_ICFG_CD_SHIFT = 16,
9021 NVME_FEAT_ICFG_CD_MASK = 0x1,
9022 NVME_FEAT_WA_DN_SHIFT = 0,
9023 NVME_FEAT_WA_DN_MASK = 0x1,
9024 NVME_FEAT_AE_SMART_SHIFT = 0,
9025 NVME_FEAT_AE_SMART_MASK = 0xff,
9026 NVME_FEAT_AE_NAN_SHIFT = 8,
9027 NVME_FEAT_AE_NAN_MASK = 0x1,
9028 NVME_FEAT_AE_FW_SHIFT = 9,
9029 NVME_FEAT_AE_FW_MASK = 0x1,
9030 NVME_FEAT_AE_TELEM_SHIFT = 10,
9031 NVME_FEAT_AE_TELEM_MASK = 0x1,
9032 NVME_FEAT_AE_ANA_SHIFT = 11,
9033 NVME_FEAT_AE_ANA_MASK = 0x1,
9034 NVME_FEAT_AE_PLA_SHIFT = 12,
9035 NVME_FEAT_AE_PLA_MASK = 0x1,
9036 NVME_FEAT_AE_LBAS_SHIFT = 13,
9037 NVME_FEAT_AE_LBAS_MASK = 0x1,
9038 NVME_FEAT_AE_EGA_SHIFT = 14,
9039 NVME_FEAT_AE_EGA_MASK = 0x1,
9040 NVME_FEAT_AE_NNSSHDN_SHIFT = 15,
9041 NVME_FEAT_AE_NNSSHDN_MASK = 0x1,
9042 NVME_FEAT_AE_TTHRY_SHIFT = 16,
9043 NVME_FEAT_AE_TTHRY_MASK = 0x1,
9044 NVME_FEAT_AE_RASSN_SHIFT = 17,
9045 NVME_FEAT_AE_RASSN_MASK = 0x1,
9046 NVME_FEAT_AE_RGRP0_SHIFT = 18,
9047 NVME_FEAT_AE_RGRP0_MASK = 0x1,
9048 NVME_FEAT_AE_ANSAN_SHIFT = 19,
9049 NVME_FEAT_AE_ANSAN_MASK = 0x1,
9050 NVME_FEAT_AE_ZDCN_SHIFT = 27,
9051 NVME_FEAT_AE_ZDCN_MASK = 0x1,
9052 NVME_FEAT_AE_PMDRLPCN_SHIFT = 28,
9053 NVME_FEAT_AE_PMDRLPCN_MASK = 0x1,
9054 NVME_FEAT_AE_ADLPCN_SHIFT = 29,
9055 NVME_FEAT_AE_ADLPCN_MASK = 0x1,
9056 NVME_FEAT_AE_HDLPCN_SHIFT = 30,
9057 NVME_FEAT_AE_HDLPCN_MASK = 0x1,
9058 NVME_FEAT_AE_DLPCN_SHIFT = 31,
9059 NVME_FEAT_AE_DLPCN_MASK = 0x1,
9060 NVME_FEAT_APST_APSTE_SHIFT = 0,
9061 NVME_FEAT_APST_APSTE_MASK = 0x1,
9062 NVME_FEAT_HMEM_EHM_SHIFT = 0,
9063 NVME_FEAT_HMEM_EHM_MASK = 0x1,
9064 NVME_FEAT_HCTM_TMT2_SHIFT = 0,
9065 NVME_FEAT_HCTM_TMT2_MASK = 0xffff,
9066 NVME_FEAT_HCTM_TMT1_SHIFT = 16,
9067 NVME_FEAT_HCTM_TMT1_MASK = 0xffff,
9068 NVME_FEAT_NOPS_NOPPME_SHIFT = 0,
9069 NVME_FEAT_NOPS_NOPPME_MASK = 0x1,
9070 NVME_FEAT_RRL_RRL_SHIFT = 0,
9071 NVME_FEAT_RRL_RRL_MASK = 0xff,
9072 NVME_FEAT_PLM_PLME_SHIFT = 0,
9073 NVME_FEAT_PLM_PLME_MASK = 0x1,
9074 NVME_FEAT_PLMW_WS_SHIFT = 0,
9075 NVME_FEAT_PLMW_WS_MASK = 0x7,
9076 NVME_FEAT_LBAS_LSIRI_SHIFT = 0,
9077 NVME_FEAT_LBAS_LSIRI_MASK = 0xffff,
9078 NVME_FEAT_LBAS_LSIPI_SHIFT = 16,
9079 NVME_FEAT_LBAS_LSIPI_MASK = 0xffff,
9080 NVME_FEAT_SC_NODRM_SHIFT = 0,
9081 NVME_FEAT_SC_NODRM_MASK = 0x1,
9082 NVME_FEAT_EG_ENDGID_SHIFT = 0,
9083 NVME_FEAT_EG_ENDGID_MASK = 0xffff,
9084 NVME_FEAT_EG_EGCW_SHIFT = 16,
9085 NVME_FEAT_EG_EGCW_MASK = 0xff,
9086 NVME_FEAT_FDPE_PHNDL_SHIFT = 0,
9087 NVME_FEAT_FDPE_PHNDL_MASK = 0xffff,
9088 NVME_FEAT_FDPE_NOET_SHIFT = 16,
9089 NVME_FEAT_FDPE_NOET_MASK = 0xff,
9090 NVME_FEAT_SPM_PBSLC_SHIFT = 0,
9091 NVME_FEAT_SPM_PBSLC_MASK = 0xff,
9092 NVME_FEAT_HOSTID_EXHID_SHIFT = 0,
9093 NVME_FEAT_HOSTID_EXHID_MASK = 0x1,
9094 NVME_FEAT_RM_REGPRE_SHIFT = 1,
9095 NVME_FEAT_RM_REGPRE_MASK = 0x1,
9096 NVME_FEAT_RM_RESREL_SHIFT = 2,
9097 NVME_FEAT_RM_RESREL_MASK = 0x1,
9098 NVME_FEAT_RM_RESPRE_SHIFT = 0x3,
9099 NVME_FEAT_RM_RESPRE_MASK = 0x1,
9100 NVME_FEAT_RP_PTPL_SHIFT = 0,
9101 NVME_FEAT_RP_PTPL_MASK = 0x1,
9102 NVME_FEAT_WP_WPS_SHIFT = 0,
9103 NVME_FEAT_WP_WPS_MASK = 0x7,
9104 NVME_FEAT_IOCSP_IOCSCI_SHIFT = 0,
9105 NVME_FEAT_IOCSP_IOCSCI_MASK = 0x1ff,
9106 NVME_FEAT_SPINUP_CONTROL_SHIFT = 0,
9107 NVME_FEAT_SPINUP_CONTROL_MASK = 0x1,
9108 NVME_FEAT_PLS_MODE_SHIFT = 0,
9109 NVME_FEAT_PLS_MODE_MASK = 0x3,
9110 NVME_FEAT_PERFC_ATTRI_SHIFT = 0,
9111 NVME_FEAT_PERFC_ATTRI_MASK = 0xff,
9112 NVME_FEAT_PERFC_RVSPA_SHIFT = 8,
9113 NVME_FEAT_PERFC_RVSPA_MASK = 0x1,
9114 NVME_FEAT_PERFC_ATTRTYP_SHIFT = 0,
9115 NVME_FEAT_PERFC_ATTRTYP_MASK = 0x3,
9116 NVME_FEAT_FDP_ENABLED_SHIFT = 0,
9117 NVME_FEAT_FDP_ENABLED_MASK = 0x1,
9118 NVME_FEAT_FDP_INDEX_SHIFT = 8,
9119 NVME_FEAT_FDP_INDEX_MASK = 0xf,
9120 NVME_FEAT_FDP_EVENTS_ENABLE_SHIFT = 0,
9121 NVME_FEAT_FDP_EVENTS_ENABLE_MASK = 0x1,
9122 NVME_FEAT_BPWPC_BP0WPS_SHIFT = 0,
9123 NVME_FEAT_BPWPC_BP0WPS_MASK = 0x7,
9124 NVME_FEAT_BPWPC_BP1WPS_SHIFT = 3,
9125 NVME_FEAT_BPWPC_BP1WPS_MASK = 0x7,
9126 };
9127
9128 /**
9129 * enum nvme_get_features_sel - Get Features - Select
9130 * @NVME_GET_FEATURES_SEL_CURRENT: Current value
9131 * @NVME_GET_FEATURES_SEL_DEFAULT: Default value
9132 * @NVME_GET_FEATURES_SEL_SAVED: Saved value
9133 * @NVME_GET_FEATURES_SEL_SUPPORTED: Supported capabilities
9134 */
9135 enum nvme_get_features_sel {
9136 NVME_GET_FEATURES_SEL_CURRENT = 0,
9137 NVME_GET_FEATURES_SEL_DEFAULT = 1,
9138 NVME_GET_FEATURES_SEL_SAVED = 2,
9139 NVME_GET_FEATURES_SEL_SUPPORTED = 3,
9140 };
9141
9142 /**
9143 * enum nvme_cmd_format_mset - Format NVM - Metadata Settings
9144 * @NVME_FORMAT_MSET_SEPARATE: indicates that the metadata is transferred
9145 * as part of a separate buffer.
9146 * @NVME_FORMAT_MSET_EXTENDED: indicates that the metadata is transferred
9147 * as part of an extended data LBA.
9148 */
9149 enum nvme_cmd_format_mset {
9150 NVME_FORMAT_MSET_SEPARATE = 0,
9151 NVME_FORMAT_MSET_EXTENDED = 1,
9152 };
9153
9154 /**
9155 * enum nvme_cmd_format_pi - Format NVM - Protection Information
9156 * @NVME_FORMAT_PI_DISABLE: Protection information is not enabled.
9157 * @NVME_FORMAT_PI_TYPE1: Protection information is enabled, Type 1.
9158 * @NVME_FORMAT_PI_TYPE2: Protection information is enabled, Type 2.
9159 * @NVME_FORMAT_PI_TYPE3: Protection information is enabled, Type 3.
9160 */
9161 enum nvme_cmd_format_pi {
9162 NVME_FORMAT_PI_DISABLE = 0,
9163 NVME_FORMAT_PI_TYPE1 = 1,
9164 NVME_FORMAT_PI_TYPE2 = 2,
9165 NVME_FORMAT_PI_TYPE3 = 3,
9166 };
9167
9168 /**
9169 * enum nvme_cmd_format_pil - Format NVM - Protection Information Location
9170 * @NVME_FORMAT_PIL_LAST: Protection information is transferred as the last
9171 * bytes of metadata.
9172 * @NVME_FORMAT_PIL_FIRST: Protection information is transferred as the first
9173 * bytes of metadata.
9174 */
9175 enum nvme_cmd_format_pil {
9176 NVME_FORMAT_PIL_LAST = 0,
9177 NVME_FORMAT_PIL_FIRST = 1,
9178 };
9179
9180 /**
9181 * enum nvme_cmd_format_ses - Format NVM - Secure Erase Settings
9182 * @NVME_FORMAT_SES_NONE: No secure erase operation requested.
9183 * @NVME_FORMAT_SES_USER_DATA_ERASE: User Data Erase: All user data shall be erased,
9184 * contents of the user data after the erase is
9185 * indeterminate (e.g. the user data may be zero
9186 * filled, one filled, etc.). If a User Data Erase
9187 * is requested and all affected user data is
9188 * encrypted, then the controller is allowed
9189 * to use a cryptographic erase to perform
9190 * the requested User Data Erase.
9191 * @NVME_FORMAT_SES_CRYPTO_ERASE: Cryptographic Erase: All user data shall
9192 * be erased cryptographically. This is
9193 * accomplished by deleting the encryption key.
9194 */
9195 enum nvme_cmd_format_ses {
9196 NVME_FORMAT_SES_NONE = 0,
9197 NVME_FORMAT_SES_USER_DATA_ERASE = 1,
9198 NVME_FORMAT_SES_CRYPTO_ERASE = 2,
9199 };
9200
9201 /**
9202 * enum nvme_ns_mgmt_sel - Namespace Management - Select
9203 * @NVME_NS_MGMT_SEL_CREATE: Namespace Create selection
9204 * @NVME_NS_MGMT_SEL_DELETE: Namespace Delete selection
9205 */
9206 enum nvme_ns_mgmt_sel {
9207 NVME_NS_MGMT_SEL_CREATE = 0,
9208 NVME_NS_MGMT_SEL_DELETE = 1,
9209 };
9210
9211 /**
9212 * enum nvme_ns_attach_sel - Namespace Attachment - Select
9213 * @NVME_NS_ATTACH_SEL_CTRL_ATTACH: Namespace attach selection
9214 * @NVME_NS_ATTACH_SEL_CTRL_DEATTACH: Namespace detach selection
9215 */
9216 enum nvme_ns_attach_sel {
9217 NVME_NS_ATTACH_SEL_CTRL_ATTACH = 0,
9218 NVME_NS_ATTACH_SEL_CTRL_DEATTACH = 1,
9219 };
9220
9221 /**
9222 * enum nvme_fw_commit_ca - Firmware Commit - Commit Action
9223 * @NVME_FW_COMMIT_CA_REPLACE: Downloaded image replaces the existing
9224 * image, if any, in the specified Firmware
9225 * Slot. The newly placed image is not
9226 * activated.
9227 * @NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE: Downloaded image replaces the existing
9228 * image, if any, in the specified Firmware
9229 * Slot. The newly placed image is activated
9230 * at the next Controller Level Reset.
9231 * @NVME_FW_COMMIT_CA_SET_ACTIVE: The existing image in the specified
9232 * Firmware Slot is activated at the
9233 * next Controller Level Reset.
9234 * @NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE_IMMEDIATE: Downloaded image replaces the existing
9235 * image, if any, in the specified Firmware
9236 * Slot and is then activated immediately.
9237 * If there is not a newly downloaded image,
9238 * then the existing image in the specified
9239 * firmware slot is activated immediately.
9240 * @NVME_FW_COMMIT_CA_REPLACE_BOOT_PARTITION: Downloaded image replaces the Boot
9241 * Partition specified by the Boot
9242 * Partition ID field.
9243 * @NVME_FW_COMMIT_CA_ACTIVATE_BOOT_PARTITION: Mark the Boot Partition specified in
9244 * the BPID field as active and update
9245 * BPINFO.ABPID.
9246 */
9247 enum nvme_fw_commit_ca {
9248 NVME_FW_COMMIT_CA_REPLACE = 0,
9249 NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE = 1,
9250 NVME_FW_COMMIT_CA_SET_ACTIVE = 2,
9251 NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE_IMMEDIATE = 3,
9252 NVME_FW_COMMIT_CA_REPLACE_BOOT_PARTITION = 6,
9253 NVME_FW_COMMIT_CA_ACTIVATE_BOOT_PARTITION = 7,
9254 };
9255
9256 /**
9257 * enum nvme_directive_dtype - Directive Types
9258 * @NVME_DIRECTIVE_DTYPE_IDENTIFY: Identify directive type
9259 * @NVME_DIRECTIVE_DTYPE_STREAMS: Streams directive type
9260 */
9261 enum nvme_directive_dtype {
9262 NVME_DIRECTIVE_DTYPE_IDENTIFY = 0,
9263 NVME_DIRECTIVE_DTYPE_STREAMS = 1,
9264 };
9265
9266 /**
9267 * enum nvme_directive_receive_doper - Directive Receive Directive Operation
9268 * @NVME_DIRECTIVE_RECEIVE_IDENTIFY_DOPER_PARAM:
9269 * @NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_PARAM:
9270 * @NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_STATUS:
9271 * @NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_RESOURCE:
9272 */
9273 enum nvme_directive_receive_doper {
9274 NVME_DIRECTIVE_RECEIVE_IDENTIFY_DOPER_PARAM = 0x01,
9275 NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_PARAM = 0x01,
9276 NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_STATUS = 0x02,
9277 NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_RESOURCE = 0x03,
9278 };
9279
9280 /**
9281 * enum nvme_directive_send_doper - Directive Send Directive Operation
9282 * @NVME_DIRECTIVE_SEND_IDENTIFY_DOPER_ENDIR:
9283 * @NVME_DIRECTIVE_SEND_STREAMS_DOPER_RELEASE_IDENTIFIER:
9284 * @NVME_DIRECTIVE_SEND_STREAMS_DOPER_RELEASE_RESOURCE:
9285 */
9286 enum nvme_directive_send_doper {
9287 NVME_DIRECTIVE_SEND_IDENTIFY_DOPER_ENDIR = 0x01,
9288 NVME_DIRECTIVE_SEND_STREAMS_DOPER_RELEASE_IDENTIFIER = 0x01,
9289 NVME_DIRECTIVE_SEND_STREAMS_DOPER_RELEASE_RESOURCE = 0x02,
9290 };
9291
9292 /**
9293 * enum nvme_directive_send_identify_endir - Enable Directive
9294 * @NVME_DIRECTIVE_SEND_IDENTIFY_ENDIR_DISABLE:
9295 * @NVME_DIRECTIVE_SEND_IDENTIFY_ENDIR_ENABLE:
9296 */
9297 enum nvme_directive_send_identify_endir {
9298 NVME_DIRECTIVE_SEND_IDENTIFY_ENDIR_DISABLE = 0,
9299 NVME_DIRECTIVE_SEND_IDENTIFY_ENDIR_ENABLE = 1,
9300 };
9301
9302 /**
9303 * enum nvme_sanitize_sanact - Sanitize Action
9304 * @NVME_SANITIZE_SANACT_EXIT_FAILURE: Exit Failure Mode.
9305 * @NVME_SANITIZE_SANACT_START_BLOCK_ERASE: Start a Block Erase sanitize operation.
9306 * @NVME_SANITIZE_SANACT_START_OVERWRITE: Start an Overwrite sanitize operation.
9307 * @NVME_SANITIZE_SANACT_START_CRYPTO_ERASE: Start a Crypto Erase sanitize operation.
9308 * @NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF: Exit Media Verification State
9309 */
9310 enum nvme_sanitize_sanact {
9311 NVME_SANITIZE_SANACT_EXIT_FAILURE = 1,
9312 NVME_SANITIZE_SANACT_START_BLOCK_ERASE = 2,
9313 NVME_SANITIZE_SANACT_START_OVERWRITE = 3,
9314 NVME_SANITIZE_SANACT_START_CRYPTO_ERASE = 4,
9315 NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF = 5,
9316 };
9317
9318 /**
9319 * enum nvme_dst_stc - Action taken by the Device Self-test command
9320 * @NVME_DST_STC_SHORT: Start a short device self-test operation
9321 * @NVME_DST_STC_LONG: Start an extended device self-test operation
9322 * @NVME_DST_STC_HOST_INIT:Start a Host-Initiated Refresh operation
9323 * @NVME_DST_STC_VS: Start a vendor specific device self-test operation
9324 * @NVME_DST_STC_ABORT: Abort device self-test operation
9325 */
9326 enum nvme_dst_stc {
9327 NVME_DST_STC_SHORT = 0x1,
9328 NVME_DST_STC_LONG = 0x2,
9329 NVME_DST_STC_HOST_INIT = 0x3,
9330 NVME_DST_STC_VS = 0xe,
9331 NVME_DST_STC_ABORT = 0xf,
9332 };
9333
9334 /**
9335 * enum nvme_virt_mgmt_act - Virtualization Management - Action
9336 * @NVME_VIRT_MGMT_ACT_PRIM_CTRL_FLEX_ALLOC: Primary Controller Flexible
9337 * Allocation
9338 * @NVME_VIRT_MGMT_ACT_OFFLINE_SEC_CTRL: Secondary Controller Offline
9339 * @NVME_VIRT_MGMT_ACT_ASSIGN_SEC_CTRL: Secondary Controller Assign
9340 * @NVME_VIRT_MGMT_ACT_ONLINE_SEC_CTRL: Secondary Controller Online
9341 */
9342 enum nvme_virt_mgmt_act {
9343 NVME_VIRT_MGMT_ACT_PRIM_CTRL_FLEX_ALLOC = 1,
9344 NVME_VIRT_MGMT_ACT_OFFLINE_SEC_CTRL = 7,
9345 NVME_VIRT_MGMT_ACT_ASSIGN_SEC_CTRL = 8,
9346 NVME_VIRT_MGMT_ACT_ONLINE_SEC_CTRL = 9,
9347 };
9348
9349 /**
9350 * enum nvme_virt_mgmt_rt - Virtualization Management - Resource Type
9351 * @NVME_VIRT_MGMT_RT_VQ_RESOURCE: VQ Resources
9352 * @NVME_VIRT_MGMT_RT_VI_RESOURCE: VI Resources
9353 */
9354 enum nvme_virt_mgmt_rt {
9355 NVME_VIRT_MGMT_RT_VQ_RESOURCE = 0,
9356 NVME_VIRT_MGMT_RT_VI_RESOURCE = 1,
9357 };
9358
9359 /**
9360 * enum nvme_ns_write_protect_cfg - Write Protection - Write Protection State
9361 * @NVME_NS_WP_CFG_NONE: No Write Protect
9362 * @NVME_NS_WP_CFG_PROTECT: Write Protect
9363 * @NVME_NS_WP_CFG_PROTECT_POWER_CYCLE: Write Protect Until Power Cycle
9364 * @NVME_NS_WP_CFG_PROTECT_PERMANENT: Permanent Write Protect
9365 */
9366 enum nvme_ns_write_protect_cfg {
9367 NVME_NS_WP_CFG_NONE = 0,
9368 NVME_NS_WP_CFG_PROTECT = 1,
9369 NVME_NS_WP_CFG_PROTECT_POWER_CYCLE = 2,
9370 NVME_NS_WP_CFG_PROTECT_PERMANENT = 3,
9371 };
9372
9373 /**
9374 * enum nvme_log_ana_lsp - Asymmetric Namespace Access - Return Groups Only
9375 * @NVME_LOG_ANA_LSP_RGO_NAMESPACES:
9376 * @NVME_LOG_ANA_LSP_RGO_GROUPS_ONLY:
9377 */
9378 enum nvme_log_ana_lsp {
9379 NVME_LOG_ANA_LSP_RGO_NAMESPACES = 0,
9380 NVME_LOG_ANA_LSP_RGO_GROUPS_ONLY = 1,
9381 };
9382
9383 /**
9384 * enum nvme_log_phy_rx_eom_action - Physical Interface Receiver Eye Opening Measurement Action
9385 * @NVME_LOG_PHY_RX_EOM_READ: Read Log Data
9386 * @NVME_LOG_PHY_RX_EOM_START_READ: Start Measurement and Read Log Data
9387 * @NVME_LOG_PHY_RX_EOM_ABORT_CLEAR: Abort Measurement and Clear Log Data
9388 */
9389 enum nvme_log_phy_rx_eom_action {
9390 NVME_LOG_PHY_RX_EOM_READ = 0,
9391 NVME_LOG_PHY_RX_EOM_START_READ = 1,
9392 NVME_LOG_PHY_RX_EOM_ABORT_CLEAR = 2,
9393 };
9394
9395 /**
9396 * enum nvme_log_phy_rx_eom_quality - Physical Interface Receiver Eye Opening Measurement Quality
9397 * @NVME_LOG_PHY_RX_EOM_GOOD: <= Better Quality
9398 * @NVME_LOG_PHY_RX_EOM_BETTER: <= Best Quality, >= Good Quality
9399 * @NVME_LOG_PHY_RX_EOM_BEST: >= Better Quality
9400 */
9401 enum nvme_log_phy_rx_eom_quality {
9402 NVME_LOG_PHY_RX_EOM_GOOD = 0,
9403 NVME_LOG_PHY_RX_EOM_BETTER = 1,
9404 NVME_LOG_PHY_RX_EOM_BEST = 2,
9405 };
9406
9407 /**
9408 * enum nvme_pevent_log_action - Persistent Event Log - Action
9409 * @NVME_PEVENT_LOG_READ: Read Log Data
9410 * @NVME_PEVENT_LOG_EST_CTX_AND_READ: Establish Context and Read Log Data
9411 * @NVME_PEVENT_LOG_RELEASE_CTX: Release Context
9412 */
9413 enum nvme_pevent_log_action {
9414 NVME_PEVENT_LOG_READ = 0x0,
9415 NVME_PEVENT_LOG_EST_CTX_AND_READ = 0x1,
9416 NVME_PEVENT_LOG_RELEASE_CTX = 0x2,
9417 };
9418
9419 /**
9420 * enum nvme_feat_tmpthresh_thsel - Temperature Threshold - Threshold Type Select
9421 * @NVME_FEATURE_TEMPTHRESH_THSEL_OVER: Over temperature threshold select
9422 * @NVME_FEATURE_TEMPTHRESH_THSEL_UNDER: Under temperature threshold select
9423 */
9424 enum nvme_feat_tmpthresh_thsel {
9425 NVME_FEATURE_TEMPTHRESH_THSEL_OVER = 0,
9426 NVME_FEATURE_TEMPTHRESH_THSEL_UNDER = 1,
9427 };
9428
9429 /**
9430 * enum nvme_features_async_event_config_flags - Asynchronous Event Configuration configuration flags
9431 * @NVME_FEATURE_AENCFG_SMART_CRIT_SPARE:
9432 * @NVME_FEATURE_AENCFG_SMART_CRIT_TEMPERATURE:
9433 * @NVME_FEATURE_AENCFG_SMART_CRIT_DEGRADED:
9434 * @NVME_FEATURE_AENCFG_SMART_CRIT_READ_ONLY:
9435 * @NVME_FEATURE_AENCFG_SMART_CRIT_VOLATILE_BACKUP:
9436 * @NVME_FEATURE_AENCFG_SMART_CRIT_READ_ONLY_PMR:
9437 * @NVME_FEATURE_AENCFG_NOTICE_NAMESPACE_ATTRIBUTES:
9438 * @NVME_FEATURE_AENCFG_NOTICE_FIRMWARE_ACTIVATION:
9439 * @NVME_FEATURE_AENCFG_NOTICE_TELEMETRY_LOG:
9440 * @NVME_FEATURE_AENCFG_NOTICE_ANA_CHANGE:
9441 * @NVME_FEATURE_AENCFG_NOTICE_PL_EVENT:
9442 * @NVME_FEATURE_AENCFG_NOTICE_LBA_STATUS:
9443 * @NVME_FEATURE_AENCFG_NOTICE_EG_EVENT:
9444 * @NVME_FEATURE_AENCFG_NOTICE_DISCOVERY_CHANGE:
9445 */
9446 enum nvme_features_async_event_config_flags {
9447 NVME_FEATURE_AENCFG_SMART_CRIT_SPARE = NVME_SMART_CRIT_SPARE,
9448 NVME_FEATURE_AENCFG_SMART_CRIT_TEMPERATURE = NVME_SMART_CRIT_TEMPERATURE,
9449 NVME_FEATURE_AENCFG_SMART_CRIT_DEGRADED = NVME_SMART_CRIT_DEGRADED,
9450 NVME_FEATURE_AENCFG_SMART_CRIT_READ_ONLY = NVME_SMART_CRIT_MEDIA,
9451 NVME_FEATURE_AENCFG_SMART_CRIT_VOLATILE_BACKUP = NVME_SMART_CRIT_VOLATILE_MEMORY,
9452 NVME_FEATURE_AENCFG_SMART_CRIT_READ_ONLY_PMR = NVME_SMART_CRIT_PMR_RO,
9453 NVME_FEATURE_AENCFG_NOTICE_NAMESPACE_ATTRIBUTES = 1 << 8,
9454 NVME_FEATURE_AENCFG_NOTICE_FIRMWARE_ACTIVATION = 1 << 9,
9455 NVME_FEATURE_AENCFG_NOTICE_TELEMETRY_LOG = 1 << 10,
9456 NVME_FEATURE_AENCFG_NOTICE_ANA_CHANGE = 1 << 11,
9457 NVME_FEATURE_AENCFG_NOTICE_PL_EVENT = 1 << 12,
9458 NVME_FEATURE_AENCFG_NOTICE_LBA_STATUS = 1 << 13,
9459 NVME_FEATURE_AENCFG_NOTICE_EG_EVENT = 1 << 14,
9460 NVME_FEATURE_AENCFG_NOTICE_DISCOVERY_CHANGE = 1 << 31,
9461 };
9462
9463 /**
9464 * enum nvme_feat_plm_window_select - Predictable Latency Per NVM Set Log
9465 * @NVME_FEATURE_PLM_DTWIN: Deterministic Window select
9466 * @NVME_FEATURE_PLM_NDWIN: Non-Deterministic Window select
9467 */
9468 enum nvme_feat_plm_window_select {
9469 NVME_FEATURE_PLM_DTWIN = 1,
9470 NVME_FEATURE_PLM_NDWIN = 2,
9471 };
9472
9473 /**
9474 * enum nvme_feat_resv_notify_flags - Reservation Notification Configuration
9475 * @NVME_FEAT_RESV_NOTIFY_REGPRE: Mask Registration Preempted Notification
9476 * @NVME_FEAT_RESV_NOTIFY_RESREL: Mask Reservation Released Notification
9477 * @NVME_FEAT_RESV_NOTIFY_RESPRE: Mask Reservation Preempted Notification
9478 */
9479 enum nvme_feat_resv_notify_flags {
9480 NVME_FEAT_RESV_NOTIFY_REGPRE = 1 << 1,
9481 NVME_FEAT_RESV_NOTIFY_RESREL = 1 << 2,
9482 NVME_FEAT_RESV_NOTIFY_RESPRE = 1 << 3,
9483 };
9484
9485 /**
9486 * enum nvme_feat_nswpcfg_state - Write Protection - Write Protection State
9487 * @NVME_FEAT_NS_NO_WRITE_PROTECT: No Write Protect
9488 * @NVME_FEAT_NS_WRITE_PROTECT: Write Protect
9489 * @NVME_FEAT_NS_WRITE_PROTECT_PWR_CYCLE: Write Protect Until Power Cycle
9490 * @NVME_FEAT_NS_WRITE_PROTECT_PERMANENT: Permanent Write Protect
9491 */
9492 enum nvme_feat_nswpcfg_state {
9493 NVME_FEAT_NS_NO_WRITE_PROTECT = 0,
9494 NVME_FEAT_NS_WRITE_PROTECT = 1,
9495 NVME_FEAT_NS_WRITE_PROTECT_PWR_CYCLE = 2,
9496 NVME_FEAT_NS_WRITE_PROTECT_PERMANENT = 3,
9497 };
9498
9499 /**
9500 * enum nvme_feat_perfc_attri - performance characteristics attribute index
9501 * @NVME_FEAT_PERFC_ATTRI_STD: standard performance attribute
9502 * @NVME_FEAT_PERFC_ATTRI_ID_LIST: performance attribute identifier list
9503 * @NVME_FEAT_PERFC_ATTRI_VS_MIN: vendor specific performance attribute minimum index
9504 * @NVME_FEAT_PERFC_ATTRI_VS_MAX: vendor specific performance attribute maximum index
9505 */
9506 enum nvme_feat_perfc_attri {
9507 NVME_FEAT_PERFC_ATTRI_STD = 0,
9508 NVME_FEAT_PERFC_ATTRI_ID_LIST = 0xc0,
9509 NVME_FEAT_PERFC_ATTRI_VS_MIN = 0xc1,
9510 NVME_FEAT_PERFC_ATTRI_VS_MAX = 0xff,
9511 };
9512
9513 /**
9514 * enum nvme_feat_perfc_r4karl - standard performance attribute random 4 kib average latency
9515 * @NVME_FEAT_PERFC_R4KARL_NO_REPORT: not reported
9516 * @NVME_FEAT_PERFC_R4KARL_GE_100_SEC: greater than or equal to 100 secs
9517 * @NVME_FEAT_PERFC_R4KARL_GE_50_SEC: greater than or equal to 50 secs and less than 100 secs
9518 * @NVME_FEAT_PERFC_R4KARL_GE_10_SEC: greater than or equal to 10 secs and less than 50 secs
9519 * @NVME_FEAT_PERFC_R4KARL_GE_5_SEC: greater than or equal to 5 secs and less than 10 secs
9520 * @NVME_FEAT_PERFC_R4KARL_GE_1_SEC: greater than or equal to 1 sec and less than 5 secs
9521 * @NVME_FEAT_PERFC_R4KARL_GE_500_MS: greater than or equal to 500 msecs and less than 1 sec
9522 * @NVME_FEAT_PERFC_R4KARL_GE_100_MS: greater than or equal to 100 msecs and less than 500 msecs
9523 * @NVME_FEAT_PERFC_R4KARL_GE_50_MS: greater than or equal to 50 msecs and less than 100 msecs
9524 * @NVME_FEAT_PERFC_R4KARL_GE_10_MS: greater than or equal to 10 msecs and less than 50 msecs
9525 * @NVME_FEAT_PERFC_R4KARL_GE_5_MS: greater than or equal to 5 msecs and less than 10 msecs
9526 * @NVME_FEAT_PERFC_R4KARL_GE_1_MS: greater than or equal to 1 msec and less than 5 msecs
9527 * @NVME_FEAT_PERFC_R4KARL_GE_500_US: greater than or equal to 500 usecs and less than 1 msec
9528 * @NVME_FEAT_PERFC_R4KARL_GE_100_US: greater than or equal to 100 usecs and less than 500 usecs
9529 * @NVME_FEAT_PERFC_R4KARL_GE_50_US: greater than or equal to 50 usecs and less than 100 usecs
9530 * @NVME_FEAT_PERFC_R4KARL_GE_10_US: greater than or equal to 10 usecs and less than 50 usecs
9531 * @NVME_FEAT_PERFC_R4KARL_GE_5_US: greater than or equal to 5 usecs and less than 10 usecs
9532 * @NVME_FEAT_PERFC_R4KARL_GE_1_US: greater than or equal to 1 usec and less than 5 usecs
9533 * @NVME_FEAT_PERFC_R4KARL_GE_500_NS: greater than or equal to 500 nsecs and less than 1 usec
9534 * @NVME_FEAT_PERFC_R4KARL_GE_100_NS: greater than or equal to 100 nsecs and less than 500 nsecs
9535 * @NVME_FEAT_PERFC_R4KARL_GE_50_NS: greater than or equal to 50 nsecs and less than 100 nsecs
9536 * @NVME_FEAT_PERFC_R4KARL_GE_10_NS: greater than or equal to 10 nsecs and less than 50 nsecs
9537 * @NVME_FEAT_PERFC_R4KARL_GE_5_NS: greater than or equal to 5 nsecs and less than 10 nsecs
9538 * @NVME_FEAT_PERFC_R4KARL_GE_1_NS: greater than or equal to 1 nsec and less than 5 nsecs
9539 */
9540 enum nvme_feat_perfc_r4karl {
9541 NVME_FEAT_PERFC_R4KARL_NO_REPORT = 0x0,
9542 NVME_FEAT_PERFC_R4KARL_GE_100_SEC = 0x1,
9543 NVME_FEAT_PERFC_R4KARL_GE_50_SEC = 0x2,
9544 NVME_FEAT_PERFC_R4KARL_GE_10_SEC = 0x3,
9545 NVME_FEAT_PERFC_R4KARL_GE_5_SEC = 0x4,
9546 NVME_FEAT_PERFC_R4KARL_GE_1_SEC = 0x5,
9547 NVME_FEAT_PERFC_R4KARL_GE_500_MS = 0x6,
9548 NVME_FEAT_PERFC_R4KARL_GE_100_MS = 0x7,
9549 NVME_FEAT_PERFC_R4KARL_GE_50_MS = 0x8,
9550 NVME_FEAT_PERFC_R4KARL_GE_10_MS = 0x9,
9551 NVME_FEAT_PERFC_R4KARL_GE_5_MS = 0xa,
9552 NVME_FEAT_PERFC_R4KARL_GE_1_MS = 0xb,
9553 NVME_FEAT_PERFC_R4KARL_GE_500_US = 0xc,
9554 NVME_FEAT_PERFC_R4KARL_GE_100_US = 0xd,
9555 NVME_FEAT_PERFC_R4KARL_GE_50_US = 0xe,
9556 NVME_FEAT_PERFC_R4KARL_GE_10_US = 0xf,
9557 NVME_FEAT_PERFC_R4KARL_GE_5_US = 0x10,
9558 NVME_FEAT_PERFC_R4KARL_GE_1_US = 0x11,
9559 NVME_FEAT_PERFC_R4KARL_GE_500_NS = 0x12,
9560 NVME_FEAT_PERFC_R4KARL_GE_100_NS = 0x13,
9561 NVME_FEAT_PERFC_R4KARL_GE_50_NS = 0x14,
9562 NVME_FEAT_PERFC_R4KARL_GE_10_NS = 0x15,
9563 NVME_FEAT_PERFC_R4KARL_GE_5_NS = 0x16,
9564 NVME_FEAT_PERFC_R4KARL_GE_1_NS = 0x17,
9565 };
9566
9567 /**
9568 * enum nvme_feat_bpwp_state - Boot Partition Write Protection State
9569 * @NVME_FEAT_BPWPS_CHANGE_NOT_REQUESTED: Change in state not requested
9570 * @NVME_FEAT_BPWPS_WRITE_UNLOCKED: Write Unlocked
9571 * @NVME_FEAT_BPWPS_WRITE_LOCKED: Write Locked
9572 * @NVME_FEAT_BPWPS_WRITE_LOCKED_PWR_CYCLE: Write Locked Until Power Cycle
9573 * @NVME_FEAT_BPWPS_WRITE_PROTECTION_RPMB: Write Protection controlled by RPMB
9574 */
9575 enum nvme_feat_bpwp_state {
9576 NVME_FEAT_BPWPS_CHANGE_NOT_REQUESTED = 0,
9577 NVME_FEAT_BPWPS_WRITE_UNLOCKED = 1,
9578 NVME_FEAT_BPWPS_WRITE_LOCKED = 2,
9579 NVME_FEAT_BPWPS_WRITE_LOCKED_PWR_CYCLE = 3,
9580 NVME_FEAT_BPWPS_WRITE_PROTECTION_RPMB = 4,
9581 };
9582
9583 /**
9584 * enum nvme_fctype - Fabrics Command Types
9585 * @nvme_fabrics_type_property_set: Property set
9586 * @nvme_fabrics_type_connect: Connect
9587 * @nvme_fabrics_type_property_get: Property Get
9588 * @nvme_fabrics_type_auth_send: Authentication Send
9589 * @nvme_fabrics_type_auth_receive: Authentication Receive
9590 * @nvme_fabrics_type_disconnect: Disconnect
9591 */
9592 enum nvme_fctype {
9593 nvme_fabrics_type_property_set = 0x00,
9594 nvme_fabrics_type_connect = 0x01,
9595 nvme_fabrics_type_property_get = 0x04,
9596 nvme_fabrics_type_auth_send = 0x05,
9597 nvme_fabrics_type_auth_receive = 0x06,
9598 nvme_fabrics_type_disconnect = 0x08,
9599 };
9600
9601 /**
9602 * enum nvme_data_tfr - Data transfer direction of the command
9603 * @NVME_DATA_TFR_NO_DATA_TFR: No data transfer
9604 * @NVME_DATA_TFR_HOST_TO_CTRL: Host to controller
9605 * @NVME_DATA_TFR_CTRL_TO_HOST: Controller to host
9606 * @NVME_DATA_TFR_BIDIRECTIONAL: Bidirectional
9607 */
9608 enum nvme_data_tfr {
9609 NVME_DATA_TFR_NO_DATA_TFR = 0x0,
9610 NVME_DATA_TFR_HOST_TO_CTRL = 0x1,
9611 NVME_DATA_TFR_CTRL_TO_HOST = 0x2,
9612 NVME_DATA_TFR_BIDIRECTIONAL = 0x3,
9613 };
9614
9615 /**
9616 * enum nvme_io_opcode - Opcodes for I/O Commands
9617 * @nvme_cmd_flush: Flush
9618 * @nvme_cmd_write: Write
9619 * @nvme_cmd_read: Read
9620 * @nvme_cmd_write_uncor: Write Uncorrectable
9621 * @nvme_cmd_compare: Compare
9622 * @nvme_cmd_write_zeroes: write Zeros
9623 * @nvme_cmd_dsm: Dataset Management
9624 * @nvme_cmd_verify: Verify
9625 * @nvme_cmd_resv_register: Reservation Register
9626 * @nvme_cmd_resv_report: Reservation Report
9627 * @nvme_cmd_resv_acquire: Reservation Acquire
9628 * @nvme_cmd_io_mgmt_recv: I/O Management Receive
9629 * @nvme_cmd_resv_release: Reservation Release
9630 * @nvme_cmd_cancel: Cancel
9631 * @nvme_cmd_copy: Copy
9632 * @nvme_cmd_io_mgmt_send: I/O Management Send
9633 * @nvme_zns_cmd_mgmt_send: Zone Management Send
9634 * @nvme_zns_cmd_mgmt_recv: Zone Management Receive
9635 * @nvme_zns_cmd_append: Zone Append
9636 * @nvme_cmd_fabric: Fabric Commands
9637 */
9638 enum nvme_io_opcode {
9639 nvme_cmd_flush = 0x00,
9640 nvme_cmd_write = 0x01,
9641 nvme_cmd_read = 0x02,
9642 nvme_cmd_write_uncor = 0x04,
9643 nvme_cmd_compare = 0x05,
9644 nvme_cmd_write_zeroes = 0x08,
9645 nvme_cmd_dsm = 0x09,
9646 nvme_cmd_verify = 0x0c,
9647 nvme_cmd_resv_register = 0x0d,
9648 nvme_cmd_resv_report = 0x0e,
9649 nvme_cmd_resv_acquire = 0x11,
9650 nvme_cmd_io_mgmt_recv = 0x12,
9651 nvme_cmd_resv_release = 0x15,
9652 nvme_cmd_cancel = 0x18,
9653 nvme_cmd_copy = 0x19,
9654 nvme_cmd_io_mgmt_send = 0x1d,
9655 nvme_zns_cmd_mgmt_send = 0x79,
9656 nvme_zns_cmd_mgmt_recv = 0x7a,
9657 nvme_zns_cmd_append = 0x7d,
9658 nvme_cmd_fabric = 0x7f,
9659 };
9660
9661 /**
9662 * enum nvme_kv_opcode - Opcodes for KV Commands
9663 * @nvme_kv_cmd_flush: Flush
9664 * @nvme_kv_cmd_store: Store
9665 * @nvme_kv_cmd_retrieve: Retrieve
9666 * @nvme_kv_cmd_list: List
9667 * @nvme_kv_cmd_resv_register: Reservation Register
9668 * @nvme_kv_cmd_resv_report: Reservation Report
9669 * @nvme_kv_cmd_delete: Delete
9670 * @nvme_kv_cmd_resv_acquire: Reservation Acquire
9671 * @nvme_kv_cmd_exist: Exist
9672 * @nvme_kv_cmd_resv_release: Reservation Release
9673 */
9674 enum nvme_kv_opcode {
9675 nvme_kv_cmd_flush = 0x00,
9676 nvme_kv_cmd_store = 0x01,
9677 nvme_kv_cmd_retrieve = 0x02,
9678 nvme_kv_cmd_list = 0x06,
9679 nvme_kv_cmd_resv_register = 0x0d,
9680 nvme_kv_cmd_resv_report = 0x0e,
9681 nvme_kv_cmd_delete = 0x10,
9682 nvme_kv_cmd_resv_acquire = 0x11,
9683 nvme_kv_cmd_exist = 0x14,
9684 nvme_kv_cmd_resv_release = 0x15,
9685 };
9686
9687 /**
9688 * enum nvme_io_control_flags - I/O control flags
9689 * @NVME_IO_DTYPE_STREAMS: Directive Type Streams
9690 * @NVME_IO_NSZ: Namespace Zeroes
9691 * @NVME_IO_STC: Storage Tag Check
9692 * @NVME_IO_DEAC: Deallocate
9693 * @NVME_IO_ZNS_APPEND_PIREMAP: Protection Information Remap
9694 * @NVME_IO_PRINFO_PRCHK_REF: Protection Information Check Reference Tag
9695 * @NVME_IO_PRINFO_PRCHK_APP: Protection Information Check Application Tag
9696 * @NVME_IO_PRINFO_PRCHK_GUARD: Protection Information Check Guard field
9697 * @NVME_IO_PRINFO_PRACT: Protection Information Action
9698 * @NVME_IO_FUA: Force Unit Access
9699 * @NVME_IO_LR: Limited Retry
9700 */
9701 enum nvme_io_control_flags {
9702 NVME_IO_DTYPE_STREAMS = 1 << 4,
9703 NVME_IO_NSZ = 1 << 7,
9704 NVME_IO_STC = 1 << 8,
9705 NVME_IO_DEAC = 1 << 9,
9706 NVME_IO_ZNS_APPEND_PIREMAP = 1 << 9,
9707 NVME_IO_PRINFO_PRCHK_REF = 1 << 10,
9708 NVME_IO_PRINFO_PRCHK_APP = 1 << 11,
9709 NVME_IO_PRINFO_PRCHK_GUARD = 1 << 12,
9710 NVME_IO_PRINFO_PRACT = 1 << 13,
9711 NVME_IO_FUA = 1 << 14,
9712 NVME_IO_LR = 1 << 15,
9713 };
9714
9715 /**
9716 * enum nvme_io_dsm_flags - Dataset Management flags
9717 * @NVME_IO_DSM_FREQ_UNSPEC: No frequency information provided
9718 * @NVME_IO_DSM_FREQ_TYPICAL: Typical number of reads and writes
9719 * expected for this LBA range
9720 * @NVME_IO_DSM_FREQ_RARE: Infrequent writes and infrequent
9721 * reads to the LBA range indicated
9722 * @NVME_IO_DSM_FREQ_READS: Infrequent writes and frequent
9723 * reads to the LBA range indicated
9724 * @NVME_IO_DSM_FREQ_WRITES: Frequent writes and infrequent
9725 * reads to the LBA range indicated
9726 * @NVME_IO_DSM_FREQ_RW: Frequent writes and frequent reads
9727 * to the LBA range indicated
9728 * @NVME_IO_DSM_FREQ_ONCE:
9729 * @NVME_IO_DSM_FREQ_PREFETCH:
9730 * @NVME_IO_DSM_FREQ_TEMP:
9731 * @NVME_IO_DSM_LATENCY_NONE: No latency information provided
9732 * @NVME_IO_DSM_LATENCY_IDLE: Longer latency acceptable
9733 * @NVME_IO_DSM_LATENCY_NORM: Typical latency
9734 * @NVME_IO_DSM_LATENCY_LOW: Smallest possible latency
9735 * @NVME_IO_DSM_SEQ_REQ:
9736 * @NVME_IO_DSM_COMPRESSED:
9737 */
9738 enum nvme_io_dsm_flags {
9739 NVME_IO_DSM_FREQ_UNSPEC = 0,
9740 NVME_IO_DSM_FREQ_TYPICAL = 1,
9741 NVME_IO_DSM_FREQ_RARE = 2,
9742 NVME_IO_DSM_FREQ_READS = 3,
9743 NVME_IO_DSM_FREQ_WRITES = 4,
9744 NVME_IO_DSM_FREQ_RW = 5,
9745 NVME_IO_DSM_FREQ_ONCE = 6,
9746 NVME_IO_DSM_FREQ_PREFETCH = 7,
9747 NVME_IO_DSM_FREQ_TEMP = 8,
9748 NVME_IO_DSM_LATENCY_NONE = 0 << 4,
9749 NVME_IO_DSM_LATENCY_IDLE = 1 << 4,
9750 NVME_IO_DSM_LATENCY_NORM = 2 << 4,
9751 NVME_IO_DSM_LATENCY_LOW = 3 << 4,
9752 NVME_IO_DSM_SEQ_REQ = 1 << 6,
9753 NVME_IO_DSM_COMPRESSED = 1 << 7,
9754 };
9755
9756 /**
9757 * enum nvme_dsm_attributes - Dataset Management attributes
9758 * @NVME_DSMGMT_IDR: Attribute -Integral Dataset for Read
9759 * @NVME_DSMGMT_IDW: Attribute - Integral Dataset for Write
9760 * @NVME_DSMGMT_AD: Attribute - Deallocate
9761 */
9762 enum nvme_dsm_attributes {
9763 NVME_DSMGMT_IDR = 1 << 0,
9764 NVME_DSMGMT_IDW = 1 << 1,
9765 NVME_DSMGMT_AD = 1 << 2,
9766 };
9767
9768 /**
9769 * enum nvme_resv_rtype - Reservation Type Encoding
9770 * @NVME_RESERVATION_RTYPE_WE: Write Exclusive Reservation
9771 * @NVME_RESERVATION_RTYPE_EA: Exclusive Access Reservation
9772 * @NVME_RESERVATION_RTYPE_WERO: Write Exclusive - Registrants Only Reservation
9773 * @NVME_RESERVATION_RTYPE_EARO: Exclusive Access - Registrants Only Reservation
9774 * @NVME_RESERVATION_RTYPE_WEAR: Write Exclusive - All Registrants Reservation
9775 * @NVME_RESERVATION_RTYPE_EAAR: Exclusive Access - All Registrants Reservation
9776 */
9777 enum nvme_resv_rtype {
9778 NVME_RESERVATION_RTYPE_WE = 1,
9779 NVME_RESERVATION_RTYPE_EA = 2,
9780 NVME_RESERVATION_RTYPE_WERO = 3,
9781 NVME_RESERVATION_RTYPE_EARO = 4,
9782 NVME_RESERVATION_RTYPE_WEAR = 5,
9783 NVME_RESERVATION_RTYPE_EAAR = 6,
9784 };
9785
9786 /**
9787 * enum nvme_resv_racqa - Reservation Acquire - Reservation Acquire Action
9788 * @NVME_RESERVATION_RACQA_ACQUIRE: Acquire
9789 * @NVME_RESERVATION_RACQA_PREEMPT: Preempt
9790 * @NVME_RESERVATION_RACQA_PREEMPT_AND_ABORT: Preempt and Abort
9791 */
9792 enum nvme_resv_racqa {
9793 NVME_RESERVATION_RACQA_ACQUIRE = 0,
9794 NVME_RESERVATION_RACQA_PREEMPT = 1,
9795 NVME_RESERVATION_RACQA_PREEMPT_AND_ABORT = 2,
9796 };
9797
9798 /**
9799 * enum nvme_resv_rrega - Reservation Register - Reservation Register Action
9800 * @NVME_RESERVATION_RREGA_REGISTER_KEY: Register Reservation Key
9801 * @NVME_RESERVATION_RREGA_UNREGISTER_KEY: Unregister Reservation Key
9802 * @NVME_RESERVATION_RREGA_REPLACE_KEY: Replace Reservation Key
9803 */
9804 enum nvme_resv_rrega {
9805 NVME_RESERVATION_RREGA_REGISTER_KEY = 0,
9806 NVME_RESERVATION_RREGA_UNREGISTER_KEY = 1,
9807 NVME_RESERVATION_RREGA_REPLACE_KEY = 2,
9808 };
9809
9810 /**
9811 * enum nvme_resv_cptpl - Reservation Register - Change Persist Through Power Loss State
9812 * @NVME_RESERVATION_CPTPL_NO_CHANGE: No change to PTPL state
9813 * @NVME_RESERVATION_CPTPL_CLEAR: Reservations are released and
9814 * registrants are cleared on a power on
9815 * @NVME_RESERVATION_CPTPL_PERSIST: Reservations and registrants persist
9816 * across a power loss
9817 */
9818 enum nvme_resv_cptpl {
9819 NVME_RESERVATION_CPTPL_NO_CHANGE = 0,
9820 NVME_RESERVATION_CPTPL_CLEAR = 2,
9821 NVME_RESERVATION_CPTPL_PERSIST = 3,
9822 };
9823
9824 /**
9825 * enum nvme_resv_rrela - Reservation Release - Reservation Release Action
9826 * @NVME_RESERVATION_RRELA_RELEASE: Release
9827 * @NVME_RESERVATION_RRELA_CLEAR: Clear
9828 */
9829 enum nvme_resv_rrela {
9830 NVME_RESERVATION_RRELA_RELEASE = 0,
9831 NVME_RESERVATION_RRELA_CLEAR = 1
9832 };
9833
9834 /**
9835 * enum nvme_zns_send_action - Zone Management Send - Zone Send Action
9836 * @NVME_ZNS_ZSA_CLOSE: Close Zone
9837 * @NVME_ZNS_ZSA_FINISH: Finish Zone
9838 * @NVME_ZNS_ZSA_OPEN: Open Zone
9839 * @NVME_ZNS_ZSA_RESET: Reset Zone
9840 * @NVME_ZNS_ZSA_OFFLINE: Offline Zone
9841 * @NVME_ZNS_ZSA_SET_DESC_EXT: Set Zone Descriptor Extension
9842 * @NVME_ZNS_ZSA_ZRWA_FLUSH: Flush
9843 */
9844 enum nvme_zns_send_action {
9845 NVME_ZNS_ZSA_CLOSE = 0x1,
9846 NVME_ZNS_ZSA_FINISH = 0x2,
9847 NVME_ZNS_ZSA_OPEN = 0x3,
9848 NVME_ZNS_ZSA_RESET = 0x4,
9849 NVME_ZNS_ZSA_OFFLINE = 0x5,
9850 NVME_ZNS_ZSA_SET_DESC_EXT = 0x10,
9851 NVME_ZNS_ZSA_ZRWA_FLUSH = 0x11,
9852 };
9853
9854 /**
9855 * enum nvme_zns_recv_action - Zone Management Receive - Zone Receive Action Specific Features
9856 * @NVME_ZNS_ZRA_REPORT_ZONES: Report Zones
9857 * @NVME_ZNS_ZRA_EXTENDED_REPORT_ZONES: Extended Report Zones
9858 */
9859 enum nvme_zns_recv_action {
9860 NVME_ZNS_ZRA_REPORT_ZONES = 0x0,
9861 NVME_ZNS_ZRA_EXTENDED_REPORT_ZONES = 0x1,
9862 };
9863
9864 /**
9865 * enum nvme_zns_report_options - Zone Management Receive - Zone Receive Action Specific Field
9866 * @NVME_ZNS_ZRAS_REPORT_ALL: List all zones
9867 * @NVME_ZNS_ZRAS_REPORT_EMPTY: List the zones in the ZSE:Empty state
9868 * @NVME_ZNS_ZRAS_REPORT_IMPL_OPENED: List the zones in the ZSIO:Implicitly Opened state
9869 * @NVME_ZNS_ZRAS_REPORT_EXPL_OPENED: List the zones in the ZSEO:Explicitly Opened state
9870 * @NVME_ZNS_ZRAS_REPORT_CLOSED: List the zones in the ZSC:Closed state
9871 * @NVME_ZNS_ZRAS_REPORT_FULL: List the zones in the ZSF:Full state
9872 * @NVME_ZNS_ZRAS_REPORT_READ_ONLY: List the zones in the ZSRO:Read Only state
9873 * @NVME_ZNS_ZRAS_REPORT_OFFLINE: List the zones in the ZSO:Offline state
9874 */
9875 enum nvme_zns_report_options {
9876 NVME_ZNS_ZRAS_REPORT_ALL = 0x0,
9877 NVME_ZNS_ZRAS_REPORT_EMPTY = 0x1,
9878 NVME_ZNS_ZRAS_REPORT_IMPL_OPENED = 0x2,
9879 NVME_ZNS_ZRAS_REPORT_EXPL_OPENED = 0x3,
9880 NVME_ZNS_ZRAS_REPORT_CLOSED = 0x4,
9881 NVME_ZNS_ZRAS_REPORT_FULL = 0x5,
9882 NVME_ZNS_ZRAS_REPORT_READ_ONLY = 0x6,
9883 NVME_ZNS_ZRAS_REPORT_OFFLINE = 0x7,
9884 };
9885
9886 /**
9887 * enum nvme_io_mgmt_recv_mo - I/O Management Receive - Management Operation
9888 * @NVME_IO_MGMT_RECV_RUH_STATUS: Reclaim Unit Handle Status
9889 */
9890 enum nvme_io_mgmt_recv_mo {
9891 NVME_IO_MGMT_RECV_RUH_STATUS = 0x1,
9892 };
9893
9894 /**
9895 * enum nvme_io_mgmt_send_mo - I/O Management Send - Management Operation
9896 * @NVME_IO_MGMT_SEND_RUH_UPDATE: Reclaim Unit Handle Update
9897 */
9898 enum nvme_io_mgmt_send_mo {
9899 NVME_IO_MGMT_SEND_RUH_UPDATE = 0x1,
9900 };
9901
9902 #ifndef SWIG
9903 /**
9904 * struct nvme_ns_mgmt_host_sw_specified - Namespace management Host Software
9905 * Specified Fields.
9906 * @nsze: Namespace Size indicates the total size of the namespace in
9907 * logical blocks. The number of logical blocks is based on the
9908 * formatted LBA size.
9909 * @ncap: Namespace Capacity indicates the maximum number of logical blocks
9910 * that may be allocated in the namespace at any point in time. The
9911 * number of logical blocks is based on the formatted LBA size.
9912 * @rsvd16: Reserved
9913 * @flbas: Formatted LBA Size, see &enum nvme_id_ns_flbas.
9914 * @rsvd27: Reserved
9915 * @dps: End-to-end Data Protection Type Settings, see
9916 * &enum nvme_id_ns_dps.
9917 * @nmic: Namespace Multi-path I/O and Namespace Sharing Capabilities, see
9918 * &enum nvme_id_ns_nmic.
9919 * @rsvd31: Reserved
9920 * @anagrpid: ANA Group Identifier indicates the ANA Group Identifier of the
9921 * ANA group of which the namespace is a member.
9922 * @rsvd96: Reserved
9923 * @nvmsetid: NVM Set Identifier indicates the NVM Set with which this
9924 * namespace is associated.
9925 * @endgid: Endurance Group Identifier indicates the Endurance Group with
9926 * which this namespace is associated.
9927 * @rsvd104: Reserved
9928 * @lbstm: Logical Block Storage Tag Mask Identifies the mask for the
9929 * Storage Tag field for the protection information
9930 * @nphndls: Number of Placement Handles specifies the number of Placement
9931 * Handles included in the Placement Handle List
9932 * @rsvd394: Reserved
9933 * @rsvd499: Reserved for I/O Command Sets that extend this specification.
9934 * @zns: rsvd499( Zoned Namespace Command Set specific field )
9935 * @znsco: Zoned Namespace Create Options
9936 * Bits 7-1: Reserved.
9937 * Bits 0: Allocate ZRWA Resources (AZR): If set to ‘1’, then the
9938 * namespace is to be created with the number of ZRWA resource specified
9939 * in the RNUMZRWA field of this data structure. If cleared to ‘0’, then
9940 * no ZRWA resources are allocated to the namespace to be created. If
9941 * the ZRWASUP bit is cleared to ‘0’, then this field shall be ignored
9942 * by the controller.
9943 * @rar: Requested Active Resources specifies the number of active
9944 * resources to be allocated to the created namespace.
9945 * @ror: Requested Open Resources specifies the number of open resources
9946 * to be allocated to the created namespace.
9947 * @rnumzrwa: Requested Number of ZRWA Resources specifies the number of ZRWA
9948 * resources to be allocated to the created namespace.
9949 * see &struct nvme_ns_mgmt_host_sw_specified_zns.
9950 * @phndl: Placement Handle Associated RUH : This field specifies the Reclaim
9951 * Unit Handle Identifier to be associated with the Placement Handle
9952 * value. If the Flexible Data Placement capability is not supported or
9953 * not enabled in specified Endurance Group, then the controller shall
9954 * ignore this field.
9955 * @rsvd768: Reserved
9956 */
9957 struct nvme_ns_mgmt_host_sw_specified {
9958 __le64 nsze;
9959 __le64 ncap;
9960 __u8 rsvd16[10];
9961 __u8 flbas;
9962 __u8 rsvd27[2];
9963 __u8 dps;
9964 __u8 nmic;
9965 __u8 rsvd31[61];
9966 __le32 anagrpid;
9967 __u8 rsvd96[4];
9968 __le16 nvmsetid;
9969 __le16 endgid;
9970 __u8 rsvd104[280];
9971 __le64 lbstm;
9972 __le16 nphndls;
9973 __u8 rsvd394[105];
9974 union {
9975 __u8 rsvd499[13];
9976 struct {
9977 __u8 znsco;
9978 __le32 rar;
9979 __le32 ror;
9980 __le32 rnumzrwa;
9981 } __attribute__((packed)) zns;
9982 };
9983 __le16 phndl[128];
9984 __u8 rsvd768[3328];
9985 };
9986 #endif /* SWIG */
9987
9988 /**
9989 * enum nvme_lm_cdq_fields - Controller Data Queue command fields
9990 *
9991 * @NVME_LM_CDQ_MOS_SHIFT: Shift to set Management Operation Specific (MOS) field
9992 * @NVME_LM_CDQ_MOS_MASK: Mask to set MOS field
9993 * @NVME_LM_CDQ_SEL_SHIFT: Shift to set Select (SEL) field
9994 * @NVME_LM_CDQ_SEL_MASK: Mask to set SEL field
9995 * @NVME_LM_SEL_CREATE_CDQ: Create CDQ select option
9996 * @NVME_LM_SEL_DELETE_CDQ: Delete CDQ select option
9997 * @NVME_LM_QT_SHIFT: Shift amount to set Queue Type (QT) field relative to MOS
9998 * @NVME_LM_QT_MASK: Mask to set QT field relative to MOS
9999 * @NVME_LM_QT_USER_DATA_MIGRATION_QUEUE: User Data Migration Queue type
10000 * @NVME_LM_CQS_SHIFT: Shift amount for Create Queue Specific (CQS) field
10001 * @NVME_LM_CQS_MASK: Mask to set CQS field
10002 * @NVME_LM_CREATE_CDQ_PC: Physically Contiguous (PC)
10003 * @NVME_LM_CREATE_CDQ_CNTLID_SHIFT: Shift amount to set CNTLID field relative to MOS
10004 * @NVME_LM_CREATE_CDQ_CNTLID_MASK: Mask to set CNTLID field relative to MOS
10005 * @NVME_LM_DELETE_CDQ_CDQID_SHIFT: Shift amount to set CDQID field for deletion
10006 * @NVME_LM_DELETE_CDQ_CDQID_MASK: Mask to set CDQID field for deletion
10007 * @NVME_LM_CREATE_CDQ_CDQID_SHIFT: Shift amount to get CDQID field from Create response in
10008 * completion dword0
10009 * @NVME_LM_CREATE_CDQ_CDQID_MASK: Mask to get CNTLID field from Create response in
10010 * completion dword0
10011 */
10012 enum nvme_lm_cdq_fields {
10013 NVME_LM_CDQ_MOS_SHIFT = 16,
10014 NVME_LM_CDQ_MOS_MASK = 0xffff,
10015 NVME_LM_CDQ_SEL_SHIFT = 0,
10016 NVME_LM_CDQ_SEL_MASK = 0xff,
10017 NVME_LM_SEL_CREATE_CDQ = 0,
10018 NVME_LM_SEL_DELETE_CDQ = 1,
10019
10020 /* Controller Data Queue - Create CDQ */
10021 NVME_LM_QT_SHIFT = 0,
10022 NVME_LM_QT_MASK = 0xff,
10023 NVME_LM_CQS_SHIFT = 16,
10024 NVME_LM_CQS_MASK = 0xffff,
10025 NVME_LM_QT_USER_DATA_MIGRATION_QUEUE = 0,
10026 NVME_LM_CREATE_CDQ_PC = 1,
10027 NVME_LM_CREATE_CDQ_CNTLID_SHIFT = 0,
10028 NVME_LM_CREATE_CDQ_CNTLID_MASK = 0xffff,
10029
10030 /* Controller Data Queue - Delete CDQ */
10031 NVME_LM_DELETE_CDQ_CDQID_SHIFT = 0,
10032 NVME_LM_DELETE_CDQ_CDQID_MASK = 0xffff,
10033
10034 /* Controller Data Queue - Create CDQ - Completion Queue Entry Dword 0 */
10035 NVME_LM_CREATE_CDQ_CDQID_SHIFT = 0,
10036 NVME_LM_CREATE_CDQ_CDQID_MASK = 0xffff,
10037 };
10038
10039 /**
10040 * enum nvme_lm_track_send_fields - Track Send command fields
10041 *
10042 * @NVME_LM_TRACK_SEND_MOS_SHIFT: Shift to set Management Operation Specific (MOS) field
10043 * @NVME_LM_TRACK_SEND_MOS_MASK: Mask to set MOS field
10044 * @NVME_LM_TRACK_SEND_SEL_SHIFT: Shift to set Select (SEL) field
10045 * @NVME_LM_TRACK_SEND_SEL_MASK: Mask to set SEL field
10046 * @NVME_LM_SEL_LOG_USER_DATA_CHANGES: Log User Data Changes select option
10047 * @NVME_LM_SEL_TRACK_MEMORY_CHANGES: Track Memory Changes select option
10048 * @NVME_LM_LACT_SHIFT: Shift to set Logging Action (LACT) relative to MOS
10049 * @NVME_LM_LACT_MASK: Mask to set LACT relative to MOS
10050 * @NVME_LM_LACT_STOP_LOGGING: The controller shall stop logging user data changes to
10051 * namespaces attached to the controller associated with the
10052 * User Data Migration Queue specified in the CDQ ID.
10053 * @NVME_LM_LACT_START_LOGGING: The controller shall start logging user data changes to
10054 * namespaces attached to the controller associated with the
10055 * User Data Migration Queue into that User Data Migration
10056 * Queue where those user data changes are caused by the
10057 * controller associated with that User Data Migration Queue
10058 * processing commands.
10059 */
10060 enum nvme_lm_track_send_fields {
10061 NVME_LM_TRACK_SEND_MOS_SHIFT = 16,
10062 NVME_LM_TRACK_SEND_MOS_MASK = 0xffff,
10063 NVME_LM_TRACK_SEND_SEL_SHIFT = 0,
10064 NVME_LM_TRACK_SEND_SEL_MASK = 0xff,
10065 NVME_LM_SEL_LOG_USER_DATA_CHANGES = 0,
10066 NVME_LM_SEL_TRACK_MEMORY_CHANGES = 1,
10067
10068 /* Track Send - Log User Data Changes */
10069 NVME_LM_LACT_SHIFT = 0,
10070 NVME_LM_LACT_MASK = 0xf,
10071 NVME_LM_LACT_STOP_LOGGING = 0,
10072 NVME_LM_LACT_START_LOGGING = 1,
10073 };
10074
10075 /**
10076 * enum nvme_lm_migration_send_fields - Migration Send command fields
10077 *
10078 * @NVME_LM_MIGRATION_SEND_MOS_SHIFT: Shift to set Management Operation Specific (MOS)
10079 * field
10080 * @NVME_LM_MIGRATION_SEND_MOS_MASK: Mask to set MOS field
10081 * @NVME_LM_MIGRATION_SEND_SEL_SHIFT: Shift amount to set Select (SEL) field
10082 * @NVME_LM_MIGRATION_SEND_SEL_MASK: Mask to set SEL field
10083 * @NVME_LM_SEL_SUSPEND: Migration Send - Suspend
10084 * @NVME_LM_SEL_RESUME: Migration Send - Resume
10085 * @NVME_LM_SEL_SET_CONTROLLER_STATE: Migration Send - Set Controller State
10086 * @NVME_LM_MIGRATION_SEND_UIDX_SHIFT: Shift to set UUID Index (UIDX)
10087 * @NVME_LM_MIGRATION_SEND_UIDX_MASK: Mask to set UIDX
10088 * @NVME_LM_DUDMQ: Delete User Data Migration Queue
10089 * @NVME_LM_STYPE_SHIFT: Shift amount to set Suspend Type (STYPE)
10090 * @NVME_LM_STYPE_MASK: Mask to set STYPE
10091 * @NVME_LM_STYPE_SUSPEND_NOTIFICATION: Suspend Notification - The specified controller is
10092 * going to be suspended in the future with a
10093 * subsequent Migration Send command
10094 * @NVME_LM_STYPE_SUSPEND: Suspend - Suspend the controller
10095 * @NVME_LM_SUSPEND_CNTLID_SHIFT: Shift amount to set Controller ID (CNTLID) when SEL
10096 * is Suspend
10097 * @NVME_LM_SUSPEND_CNTLID_MASK: Mask to set CNTLID with SEL Suspend
10098 * @NVME_LM_RESUME_CNTLID_SHIFT: Shift amount to set Controller ID (CNTLID) when SEL
10099 * is Resume
10100 * @NVME_LM_RESUME_CNTLID_MASK: Mask to set CNTLID when SEL is Resume
10101 * @NVME_LM_SEQIND_SHIFT: Shift amount to set Sequence Indicator (SEQIND)
10102 * field relative to MOS
10103 * @NVME_LM_SEQIND_MASK: Mask to set SEQIND field relative to MOS
10104 * @NVME_LM_SEQIND_NOT_FIRST_NOT_LAST: This command is not the first or last of a sequence
10105 * of two or more Migration Send commands with this
10106 * management operation used to transfer the controller
10107 * state from host to controller
10108 * @NVME_LM_SEQIND_FIRST: This command is the first of a sequence of two or
10109 * more Migration Send commands
10110 * @NVME_LM_SEQIND_LAST: This command is the last command of a sequence of
10111 * two or more Migration Send commands
10112 * @NVME_LM_SEQIND_ENTIRE: This Migration Send command is the only command and
10113 * contains the entire controller state for this
10114 * management operation
10115 * @NVME_LM_SET_CONTROLLER_STATE_CSUUIDI_SHIFT: Shift amount to set Controller State UUID Index
10116 * (CSUUIDI)
10117 * @NVME_LM_SET_CONTROLLER_STATE_CSUUIDI_MASK: Mask to set CSUUIDI
10118 * @NVME_LM_SET_CONTROLLER_STATE_CSVI_SHIFT: Shift amount to set Controller State Version Index
10119 * (CSVI)
10120 * @NVME_LM_SET_CONTROLLER_STATE_CSVI_MASK: Mask to set CSVI
10121 * @NVME_LM_SET_CONTROLLER_STATE_CNTLID_SHIFT: Shift amount to set Controller ID (CNTLID) when SEL
10122 * is Set Controller State
10123 * @NVME_LM_SET_CONTROLLER_STATE_CNTLID_MASK: Mask to set CNTLID when SEL is Set Controller State
10124 */
10125 enum nvme_lm_migration_send_fields {
10126 NVME_LM_MIGRATION_SEND_MOS_SHIFT = 16,
10127 NVME_LM_MIGRATION_SEND_MOS_MASK = 0xffff,
10128 NVME_LM_MIGRATION_SEND_SEL_SHIFT = 0,
10129 NVME_LM_MIGRATION_SEND_SEL_MASK = 0xff,
10130 NVME_LM_SEL_SUSPEND = 0,
10131 NVME_LM_SEL_RESUME = 1,
10132 NVME_LM_SEL_SET_CONTROLLER_STATE = 2,
10133 NVME_LM_MIGRATION_SEND_UIDX_SHIFT = 0,
10134 NVME_LM_MIGRATION_SEND_UIDX_MASK = 0x7f,
10135
10136 /* Migration Send - Suspend */
10137 NVME_LM_DUDMQ = 1 << 31,
10138 NVME_LM_STYPE_SHIFT = 16,
10139 NVME_LM_STYPE_MASK = 0xff,
10140 NVME_LM_STYPE_SUSPEND_NOTIFICATION = 0,
10141 NVME_LM_STYPE_SUSPEND = 1,
10142 NVME_LM_SUSPEND_CNTLID_SHIFT = 0,
10143 NVME_LM_SUSPEND_CNTLID_MASK = 0Xffff,
10144
10145 /* Migration Send - Resume */
10146 NVME_LM_RESUME_CNTLID_SHIFT = 0,
10147 NVME_LM_RESUME_CNTLID_MASK = 0xffff,
10148
10149 /* Migration Send - Set Controller State */
10150 NVME_LM_SEQIND_SHIFT = 0,
10151 NVME_LM_SEQIND_MASK = 0x3,
10152 NVME_LM_SEQIND_NOT_FIRST_NOT_LAST = 0,
10153 NVME_LM_SEQIND_FIRST = 1,
10154 NVME_LM_SEQIND_LAST = 2,
10155 NVME_LM_SEQIND_ENTIRE = 3,
10156 NVME_LM_SET_CONTROLLER_STATE_CSUUIDI_SHIFT = 24,
10157 NVME_LM_SET_CONTROLLER_STATE_CSUUIDI_MASK = 0xff,
10158 NVME_LM_SET_CONTROLLER_STATE_CSVI_SHIFT = 16,
10159 NVME_LM_SET_CONTROLLER_STATE_CSVI_MASK = 0xff,
10160 NVME_LM_SET_CONTROLLER_STATE_CNTLID_SHIFT = 0,
10161 NVME_LM_SET_CONTROLLER_STATE_CNTLID_MASK = 0xffff,
10162 };
10163
10164 /**
10165 * enum nvme_lm_migration_recv_fields - Migration Receive command fields
10166 *
10167 * @NVME_LM_MIGRATION_RECV_MOS_SHIFT: Shift amount to set Management Specific Operation
10168 * (MOS) field
10169 * @NVME_LM_MIGRATION_RECV_MOS_MASK: Mask to set MOS field
10170 * @NVME_LM_MIGRATION_RECV_SEL_SHIFT: Shift amount to set Select (SEL) field
10171 * @NVME_LM_MIGRATION_RECV_SEL_MASK: Mask to set SEL field
10172 * @NVME_LM_SEL_GET_CONTROLLER_STATE: Get Controller State select option
10173 * @NVME_LM_MIGRATION_RECV_UIDX_SHIFT: Shift to set UUID Index (UIDX)
10174 * @NVME_LM_MIGRATION_RECV_UIDX_MASK: Mask to set UIDX
10175 * @NVME_LM_GET_CONTROLLER_STATE_CSVI_SHIFT: Shift amount to set Controller State Version Index
10176 * (CSVI) relative to MOS
10177 * @NVME_LM_GET_CONTROLLER_STATE_CSVI_MASK: Mask to set CSVI relative to MOS
10178 * @NVME_LM_GET_CONTROLLER_STATE_CSUIDXP_SHIFT: Shift amount to set Controller State UUID Index
10179 * Parameter (CSUIDXP)
10180 * @NVME_LM_GET_CONTROLLER_STATE_CSUIDXP_MASK: Mask to set CSUIDXP
10181 * @NVME_LM_GET_CONTROLLER_STATE_CSUUIDI_SHIFT: Shift amount to set Controller State UUID Index
10182 * (CSUUIDI)
10183 * @NVME_LM_GET_CONTROLLER_STATE_CSUUIDI_MASK: Mask to set CSUUIDI
10184 * @NVME_LM_GET_CONTROLLER_STATE_CNTLID_SHIFT: Shift amount to set Controller ID (CNTLID)
10185 * @NVME_LM_GET_CONTROLLER_STATE_CNTLID_MASK: Mask to set CNTLID
10186 * @NVME_LM_GET_CONTROLLER_STATE_CSUP: Controller Suspended
10187 */
10188 enum nvme_lm_migration_recv_fields {
10189 NVME_LM_MIGRATION_RECV_MOS_SHIFT = 16,
10190 NVME_LM_MIGRATION_RECV_MOS_MASK = 0xffff,
10191 NVME_LM_MIGRATION_RECV_SEL_SHIFT = 0,
10192 NVME_LM_MIGRATION_RECV_SEL_MASK = 0xff,
10193 NVME_LM_SEL_GET_CONTROLLER_STATE = 0,
10194 NVME_LM_MIGRATION_RECV_UIDX_SHIFT = 0,
10195 NVME_LM_MIGRATION_RECV_UIDX_MASK = 0x7f,
10196
10197 /* Migration Receive - Get Controller State */
10198 NVME_LM_GET_CONTROLLER_STATE_CSVI_SHIFT = 0,
10199 NVME_LM_GET_CONTROLLER_STATE_CSVI_MASK = 0xff,
10200 NVME_LM_GET_CONTROLLER_STATE_CSUIDXP_SHIFT = 24,
10201 NVME_LM_GET_CONTROLLER_STATE_CSUIDXP_MASK = 0xff,
10202 NVME_LM_GET_CONTROLLER_STATE_CSUUIDI_SHIFT = 16,
10203 NVME_LM_GET_CONTROLLER_STATE_CSUUIDI_MASK = 0xff,
10204 NVME_LM_GET_CONTROLLER_STATE_CNTLID_SHIFT = 0,
10205 NVME_LM_GET_CONTROLLER_STATE_CNTLID_MASK = 0xffff,
10206
10207 /* Migration Receive - Get Controller State - Completion Queue Entry Dword 0 */
10208 NVME_LM_GET_CONTROLLER_STATE_CSUP = 1 << 0,
10209 };
10210
10211 /**
10212 * struct nvme_lm_io_submission_queue_data - I/O Submission Queue data structure. Fields related to
10213 * the contents of Create I/O Submission Queue command that created an I/O Submission Queue.
10214 *
10215 * @iosqprp1: I/O Submission PRP Entry 1 (IOSQPRP1)
10216 * @iosqqsize: I/O Submission Queue Size (IOSQQSIZE)
10217 * @iosqqid: I/O Submission Queue Identifier (IOSQQID)
10218 * @iosqcqid: I/O Completion Queue Identifier (IOSQCQID)
10219 * @iosqa: I/O Submission Queue Attributes (IOSQA)
10220 * @iosqhp: I/O Submission Queue Head Pointer (IOSQHP)
10221 * @iosqtp: I/O Submission Queue Tail Pointer (IOSQTP)
10222 * @rsvd20: Reserved
10223 */
10224 struct nvme_lm_io_submission_queue_data {
10225 __le64 iosqprp1;
10226 __le16 iosqqsize;
10227 __le16 iosqqid;
10228 __le16 iosqcqid;
10229 __le16 iosqa;
10230 __le16 iosqhp;
10231 __le16 iosqtp;
10232 __u8 rsvd20[4];
10233 };
10234
10235 /**
10236 * struct nvme_lm_io_completion_queue_data - I/O Completion Queue data structure. Fields related to
10237 * the contents of Create I/O Completion Queue command that created an I/O Completion Queue.
10238 *
10239 * @iocqprp1: I/O Completion Queue PRP Entry 1 (IOCQPRP1)
10240 * @iocqqsize: I/O Completion Queue Size (IOCQQSIZE)
10241 * @iocqqid: I/O Completion Queue Identifier (IOCQQID)
10242 * @iocqhp: I/O Completion Queue Head Pointer (IOCQHP)
10243 * @iocqtp: I/O Completion Queue Tail Pointer (IOCQTP)
10244 * @iocqa: I/O Completion Queue Attributes (IOCQA)
10245 * @rsvd20: Reserved
10246 */
10247 struct nvme_lm_io_completion_queue_data {
10248 __le64 iocqprp1;
10249 __le16 iocqqsize;
10250 __le16 iocqqid;
10251 __le16 iocqhp;
10252 __le16 iocqtp;
10253 __le32 iocqa;
10254 __u8 rsvd20[4];
10255 };
10256
10257 /**
10258 * struct nvme_lm_nvme_controller_state_data_header - Controller State data structure header
10259 *
10260 * @ver: The version of this data structure.
10261 * @niosq: The number of I/O Submission Queues contained in this data structure.
10262 * @niocq: The number of I/O Completion Queues contained in this data structure.
10263 * @rsvd6: Reserved
10264 */
10265 struct nvme_lm_nvme_controller_state_data_header {
10266 __le16 ver;
10267 __le16 niosq;
10268 __le16 niocq;
10269 __le16 rsvd6;
10270 };
10271
10272 /**
10273 * struct nvme_lm_nvme_controller_state_data - NVMe Controller State data structure describes the
10274 * state of a NVMe Controller's I/O Submission and I/O Completion queues
10275 *
10276 * @hdr: Header
10277 * @sqs: I/O Submission Queue list
10278 * @cqs: I/O Completion Queue list
10279 */
10280 struct nvme_lm_nvme_controller_state_data {
10281 struct nvme_lm_nvme_controller_state_data_header hdr;
10282 union {
10283 struct nvme_lm_io_submission_queue_data sqs[0];
10284 struct nvme_lm_io_completion_queue_data cqs[0];
10285 };
10286 };
10287
10288 /**
10289 * struct nvme_lm_controller_state_data_header - Controller State data header structure describes
10290 * the contents of the Controller State data
10291 *
10292 * @ver: Version of this data structure
10293 * @csattr: Controller state attributes
10294 * @rsvd3: Reserved
10295 * @nvmecss: NVMe Controller state size in dwords
10296 * @vss: Vendor specific size in dowrds
10297 */
10298 struct nvme_lm_controller_state_data_header {
10299 __le16 ver;
10300 __u8 csattr;
10301 __u8 rsvd3[13];
10302 __u8 nvmecss[16];
10303 __u8 vss[16];
10304 };
10305
10306 /**
10307 * struct nvme_lm_controller_state_data - Controller State data structure contains data on the
10308 * controller's state.
10309 *
10310 * @hdr: Header
10311 * @data: Data
10312 */
10313 struct nvme_lm_controller_state_data {
10314 struct nvme_lm_controller_state_data_header hdr;
10315 struct nvme_lm_nvme_controller_state_data data;
10316 };
10317
10318 /**
10319 * enum nvme_lm_queue_attributes - I/O Submission and I/O Completion Queue Attributes
10320 *
10321 * @NVME_LM_IOSQPC_MASK: Mask to get the Physically Contiguous (PC) bit for this I/O
10322 * submission queue.
10323 * @NVME_LM_IOSQPC_SHIFT: Shift to get the PC bit for this I/O submission queue
10324 * @NVME_LM_IOSQPRIO_MASK: Mask to get the Priority for this I/O submission queue.
10325 * @NVME_LM_IOSQPRIO_SHIFT: Shift to get the Priority for this I/O submission queue.
10326 * @NVME_LM_IOCQPC_MASK: Mask to get the Physicaly Contiguous (PC) bit for this I/O
10327 * completion queue.
10328 * @NVME_LM_IOCQPC_SHIFT: Shift to get the PC bit for this I/O completion queue.
10329 * @NVME_LM_IOCQIEN_MASK: Mask to get the Interrupts Enabled bit for this I/O completion
10330 * queue
10331 * @NVME_LM_IOCQIEN_SHIFT: Shift to get the Interrupts Enabled bit for this I/O completion
10332 * @NVME_LM_S0PT_MASK: Mask to get the value of the Phase Tag bit for Slot 0 of this I/O
10333 * completion queue.
10334 * @NVME_LM_S0PT_SHIFT: Shift to get the value of the Phase Tag bit for Slot 0 of this I/O
10335 * completion queue.
10336 * @NVME_LM_IOCQIV_MASK: Mask to get the Interrupt Vector (IV) for this I/O completion
10337 * queue.
10338 * @NVME_LM_IOCQIV_SHIFT: Shift to get the IV for this I/O completion queue.
10339 */
10340 enum nvme_lm_queue_attributes {
10341 /* I/O Submission Queue */
10342 NVME_LM_IOSQPC_MASK = 0x1,
10343 NVME_LM_IOSQPC_SHIFT = 0,
10344 NVME_LM_IOSQPRIO_MASK = 0x3,
10345 NVME_LM_IOSQPRIO_SHIFT = 1,
10346 /* I/O Completion Queue */
10347 NVME_LM_IOCQPC_MASK = 0x1,
10348 NVME_LM_IOCQPC_SHIFT = 0,
10349 NVME_LM_IOCQIEN_MASK = 0x1,
10350 NVME_LM_IOCQIEN_SHIFT = 1,
10351 NVME_LM_S0PT_MASK = 0x1,
10352 NVME_LM_S0PT_SHIFT = 2,
10353 NVME_LM_IOCQIV_MASK = 0xffff,
10354 NVME_LM_IOCQIV_SHIFT = 16,
10355 };
10356
10357 /**
10358 * enum nvme_lm_ctrl_data_queue_fid - Controller Data Queue - Set Feature
10359 *
10360 * @NVME_LM_CTRL_DATA_QUEUE_ETPT_MASK: Mask to set Enable Tail Pointer Trigger (ETPT)
10361 * @NVME_LM_CTRL_DATA_QUEUE_ETPT_SHIFT: Shift to set ETPT
10362 */
10363 enum nvme_lm_ctrl_data_queue_fid {
10364 NVME_LM_CTRL_DATA_QUEUE_ETPT_MASK = 0x1,
10365 NVME_LM_CTRL_DATA_QUEUE_ETPT_SHIFT = 31,
10366 };
10367
10368 /**
10369 * struct nvme_lm_ctrl_data_queue_fid_data - Get Controller Data Queue feature data
10370 *
10371 * @hp: Head Pointer
10372 * @tpt: Tail Pointer Trigger
10373 */
10374 struct nvme_lm_ctrl_data_queue_fid_data {
10375 __le32 hp;
10376 __le32 tpt;
10377 };
10378 #endif /* _LIBNVME_TYPES_H */