|
15 | 15 | #define NVME_MAJOR(r) (((r) >> 16) & 0xffff)
|
16 | 16 | #define NVME_MINOR(r) (((r) >> 8) & 0xff)
|
17 | 17 |
|
| 18 | +/* |
| 19 | + * Use to mark a command to apply to all namespaces, or to retrieve global |
| 20 | + * log pages. |
| 21 | + */ |
| 22 | +#define NVME_GLOBAL_NAMESPACE_TAG ((uint32_t)0xFFFFFFFF) |
| 23 | + |
18 | 24 | /* Many items are expressed in terms of power of two times MPS */
|
19 | 25 | #define NVME_MPS_SHIFT 12
|
20 | 26 |
|
|
342 | 348 | #define NVME_CTRLR_DATA_VWC_ALL_NO (2)
|
343 | 349 | #define NVME_CTRLR_DATA_VWC_ALL_YES (3)
|
344 | 350 |
|
| 351 | +/** namespace features */ |
| 352 | +/* thin provisioning */ |
| 353 | +#define NVME_NS_DATA_NSFEAT_THIN_PROV_SHIFT (0) |
| 354 | +#define NVME_NS_DATA_NSFEAT_THIN_PROV_MASK (0x1) |
| 355 | +/* NAWUN, NAWUPF, and NACWU fields are valid */ |
| 356 | +#define NVME_NS_DATA_NSFEAT_NA_FIELDS_SHIFT (1) |
| 357 | +#define NVME_NS_DATA_NSFEAT_NA_FIELDS_MASK (0x1) |
| 358 | +/* Deallocated or Unwritten Logical Block errors supported */ |
| 359 | +#define NVME_NS_DATA_NSFEAT_DEALLOC_SHIFT (2) |
| 360 | +#define NVME_NS_DATA_NSFEAT_DEALLOC_MASK (0x1) |
| 361 | +/* NGUID and EUI64 fields are not reusable */ |
| 362 | +#define NVME_NS_DATA_NSFEAT_NO_ID_REUSE_SHIFT (3) |
| 363 | +#define NVME_NS_DATA_NSFEAT_NO_ID_REUSE_MASK (0x1) |
| 364 | +/* NPWG, NPWA, NPDG, NPDA, and NOWS are valid */ |
| 365 | +#define NVME_NS_DATA_NSFEAT_NPVALID_SHIFT (4) |
| 366 | +#define NVME_NS_DATA_NSFEAT_NPVALID_MASK (0x1) |
| 367 | + |
| 368 | +/** formatted lba size */ |
| 369 | +#define NVME_NS_DATA_FLBAS_FORMAT_SHIFT (0) |
| 370 | +#define NVME_NS_DATA_FLBAS_FORMAT_MASK (0xF) |
| 371 | +#define NVME_NS_DATA_FLBAS_EXTENDED_SHIFT (4) |
| 372 | +#define NVME_NS_DATA_FLBAS_EXTENDED_MASK (0x1) |
| 373 | + |
| 374 | +/** metadata capabilities */ |
| 375 | +/* metadata can be transferred as part of data prp list */ |
| 376 | +#define NVME_NS_DATA_MC_EXTENDED_SHIFT (0) |
| 377 | +#define NVME_NS_DATA_MC_EXTENDED_MASK (0x1) |
| 378 | +/* metadata can be transferred with separate metadata pointer */ |
| 379 | +#define NVME_NS_DATA_MC_POINTER_SHIFT (1) |
| 380 | +#define NVME_NS_DATA_MC_POINTER_MASK (0x1) |
| 381 | + |
| 382 | +/** end-to-end data protection capabilities */ |
| 383 | +/* protection information type 1 */ |
| 384 | +#define NVME_NS_DATA_DPC_PIT1_SHIFT (0) |
| 385 | +#define NVME_NS_DATA_DPC_PIT1_MASK (0x1) |
| 386 | +/* protection information type 2 */ |
| 387 | +#define NVME_NS_DATA_DPC_PIT2_SHIFT (1) |
| 388 | +#define NVME_NS_DATA_DPC_PIT2_MASK (0x1) |
| 389 | +/* protection information type 3 */ |
| 390 | +#define NVME_NS_DATA_DPC_PIT3_SHIFT (2) |
| 391 | +#define NVME_NS_DATA_DPC_PIT3_MASK (0x1) |
| 392 | +/* first eight bytes of metadata */ |
| 393 | +#define NVME_NS_DATA_DPC_MD_START_SHIFT (3) |
| 394 | +#define NVME_NS_DATA_DPC_MD_START_MASK (0x1) |
| 395 | +/* last eight bytes of metadata */ |
| 396 | +#define NVME_NS_DATA_DPC_MD_END_SHIFT (4) |
| 397 | +#define NVME_NS_DATA_DPC_MD_END_MASK (0x1) |
| 398 | + |
| 399 | +/** end-to-end data protection type settings */ |
| 400 | +/* protection information type */ |
| 401 | +#define NVME_NS_DATA_DPS_PIT_SHIFT (0) |
| 402 | +#define NVME_NS_DATA_DPS_PIT_MASK (0x7) |
| 403 | +/* 1 == protection info transferred at start of metadata */ |
| 404 | +/* 0 == protection info transferred at end of metadata */ |
| 405 | +#define NVME_NS_DATA_DPS_MD_START_SHIFT (3) |
| 406 | +#define NVME_NS_DATA_DPS_MD_START_MASK (0x1) |
| 407 | + |
| 408 | +/** Namespace Multi-path I/O and Namespace Sharing Capabilities */ |
| 409 | +/* the namespace may be attached to two or more controllers */ |
| 410 | +#define NVME_NS_DATA_NMIC_MAY_BE_SHARED_SHIFT (0) |
| 411 | +#define NVME_NS_DATA_NMIC_MAY_BE_SHARED_MASK (0x1) |
| 412 | + |
| 413 | +/** Reservation Capabilities */ |
| 414 | +/* Persist Through Power Loss */ |
| 415 | +#define NVME_NS_DATA_RESCAP_PTPL_SHIFT (0) |
| 416 | +#define NVME_NS_DATA_RESCAP_PTPL_MASK (0x1) |
| 417 | +/* supports the Write Exclusive */ |
| 418 | +#define NVME_NS_DATA_RESCAP_WR_EX_SHIFT (1) |
| 419 | +#define NVME_NS_DATA_RESCAP_WR_EX_MASK (0x1) |
| 420 | +/* supports the Exclusive Access */ |
| 421 | +#define NVME_NS_DATA_RESCAP_EX_AC_SHIFT (2) |
| 422 | +#define NVME_NS_DATA_RESCAP_EX_AC_MASK (0x1) |
| 423 | +/* supports the Write Exclusive – Registrants Only */ |
| 424 | +#define NVME_NS_DATA_RESCAP_WR_EX_RO_SHIFT (3) |
| 425 | +#define NVME_NS_DATA_RESCAP_WR_EX_RO_MASK (0x1) |
| 426 | +/* supports the Exclusive Access - Registrants Only */ |
| 427 | +#define NVME_NS_DATA_RESCAP_EX_AC_RO_SHIFT (4) |
| 428 | +#define NVME_NS_DATA_RESCAP_EX_AC_RO_MASK (0x1) |
| 429 | +/* supports the Write Exclusive – All Registrants */ |
| 430 | +#define NVME_NS_DATA_RESCAP_WR_EX_AR_SHIFT (5) |
| 431 | +#define NVME_NS_DATA_RESCAP_WR_EX_AR_MASK (0x1) |
| 432 | +/* supports the Exclusive Access - All Registrants */ |
| 433 | +#define NVME_NS_DATA_RESCAP_EX_AC_AR_SHIFT (6) |
| 434 | +#define NVME_NS_DATA_RESCAP_EX_AC_AR_MASK (0x1) |
| 435 | +/* Ignore Existing Key is used as defined in revision 1.3 or later */ |
| 436 | +#define NVME_NS_DATA_RESCAP_IEKEY13_SHIFT (7) |
| 437 | +#define NVME_NS_DATA_RESCAP_IEKEY13_MASK (0x1) |
| 438 | + |
| 439 | +/** Format Progress Indicator */ |
| 440 | +/* percentage of the Format NVM command that remains to be completed */ |
| 441 | +#define NVME_NS_DATA_FPI_PERC_SHIFT (0) |
| 442 | +#define NVME_NS_DATA_FPI_PERC_MASK (0x7f) |
| 443 | +/* namespace supports the Format Progress Indicator */ |
| 444 | +#define NVME_NS_DATA_FPI_SUPP_SHIFT (7) |
| 445 | +#define NVME_NS_DATA_FPI_SUPP_MASK (0x1) |
| 446 | + |
| 447 | +/** Deallocate Logical Block Features */ |
| 448 | +/* deallocated logical block read behavior */ |
| 449 | +#define NVME_NS_DATA_DLFEAT_READ_SHIFT (0) |
| 450 | +#define NVME_NS_DATA_DLFEAT_READ_MASK (0x07) |
| 451 | +#define NVME_NS_DATA_DLFEAT_READ_NR (0x00) |
| 452 | +#define NVME_NS_DATA_DLFEAT_READ_00 (0x01) |
| 453 | +#define NVME_NS_DATA_DLFEAT_READ_FF (0x02) |
| 454 | +/* supports the Deallocate bit in the Write Zeroes */ |
| 455 | +#define NVME_NS_DATA_DLFEAT_DWZ_SHIFT (3) |
| 456 | +#define NVME_NS_DATA_DLFEAT_DWZ_MASK (0x01) |
| 457 | +/* Guard field for deallocated logical blocks is set to the CRC */ |
| 458 | +#define NVME_NS_DATA_DLFEAT_GCRC_SHIFT (4) |
| 459 | +#define NVME_NS_DATA_DLFEAT_GCRC_MASK (0x01) |
| 460 | + |
| 461 | +/** lba format support */ |
| 462 | +/* metadata size */ |
| 463 | +#define NVME_NS_DATA_LBAF_MS_SHIFT (0) |
| 464 | +#define NVME_NS_DATA_LBAF_MS_MASK (0xFFFF) |
| 465 | +/* lba data size */ |
| 466 | +#define NVME_NS_DATA_LBAF_LBADS_SHIFT (16) |
| 467 | +#define NVME_NS_DATA_LBAF_LBADS_MASK (0xFF) |
| 468 | +/* relative performance */ |
| 469 | +#define NVME_NS_DATA_LBAF_RP_SHIFT (24) |
| 470 | +#define NVME_NS_DATA_LBAF_RP_MASK (0x3) |
| 471 | + |
345 | 472 | enum nvme_critical_warning_state {
|
346 | 473 | NVME_CRIT_WARN_ST_AVAILABLE_SPARE = 0x1,
|
347 | 474 | NVME_CRIT_WARN_ST_TEMPERATURE = 0x2,
|
|
0 commit comments