diff --git a/libnvme/src/meson.build b/libnvme/src/meson.build index 31003cdd6c..4fc9aa7a22 100644 --- a/libnvme/src/meson.build +++ b/libnvme/src/meson.build @@ -56,6 +56,8 @@ headers = [ 'nvme/nvme-cmds-zns.h', 'nvme/nvme-cmds.h', 'nvme/nvme-types-base.h', + 'nvme/nvme-types-base-common.h', + 'nvme/nvme-types-base-id.h', 'nvme/nvme-types-fabrics.h', 'nvme/nvme-types-mi.h', 'nvme/nvme-types-nvm.h', diff --git a/libnvme/src/nvme/nvme-cmds-base.h b/libnvme/src/nvme/nvme-cmds-base.h index 2515d894d2..89075e51bc 100644 --- a/libnvme/src/nvme/nvme-cmds-base.h +++ b/libnvme/src/nvme/nvme-cmds-base.h @@ -47,7 +47,6 @@ enum { NVME_LOG_CDW14_OT_MASK = 0x1, NVME_LOG_CDW14_UUID_MASK = 0x7f, - /* Identify - Admin Opcode 0x06 */ NVME_IDENTIFY_CDW10_CNS_SHIFT = 0, NVME_IDENTIFY_CDW10_CNTID_SHIFT = 16, @@ -66,14 +65,12 @@ enum { NVME_IDENTIFY_CDW11_FIDX_MASK = 0xffff, NVME_IDENTIFY_CDW14_UUID_MASK = 0x7f, - /* Abort - Admin Opcode 0x08 */ NVME_ABORT_CDW10_SQID_SHIFT = 0, NVME_ABORT_CDW10_CID_SHIFT = 16, NVME_ABORT_CDW10_SQID_MASK = 0xffff, NVME_ABORT_CDW10_CID_MASK = 0xffff, - /* Set Features - Admin Opcode 0x09 */ NVME_SET_FEATURES_CDW10_FID_SHIFT = 0, NVME_SET_FEATURES_CDW10_SV_SHIFT = 31, @@ -84,7 +81,6 @@ enum { NVME_SET_FEATURES_CDW11_NUM_MASK = 0x3f, NVME_SET_FEATURES_CDW14_UUID_MASK = 0x7f, - /* Get Features - Admin Opcode 0x0a */ NVME_GET_FEATURES_CDW10_FID_SHIFT = 0, NVME_GET_FEATURES_CDW10_SEL_SHIFT = 8, @@ -93,14 +89,12 @@ enum { NVME_GET_FEATURES_CDW10_SEL_MASK = 0x7, NVME_GET_FEATURES_CDW14_UUID_MASK = 0x7f, - /* Namespace Management - Admin Opcode 0x0d */ NVME_NAMESPACE_MGMT_CDW10_SEL_SHIFT = 0, NVME_NAMESPACE_MGMT_CDW11_CSI_SHIFT = 24, NVME_NAMESPACE_MGMT_CDW10_SEL_MASK = 0xf, NVME_NAMESPACE_MGMT_CDW11_CSI_MASK = 0xff, - /* Firmware Commit - Admin Opcode 0x10 */ NVME_FW_COMMIT_CDW10_BPID_SHIFT = 31, NVME_FW_COMMIT_CDW10_CA_SHIFT = 3, @@ -109,12 +103,10 @@ enum { NVME_FW_COMMIT_CDW10_CA_MASK = 0x7, NVME_FW_COMMIT_CDW10_FS_MASK = 0x7, - /* Namespace Attachment - Admin Opcode 0x15 */ NVME_NAMESPACE_ATTACH_CDW10_SEL_SHIFT = 0, NVME_NAMESPACE_ATTACH_CDW10_SEL_MASK = 0xf, - /* Directive Send/Receive - Admin Opcode 0x19/0x1a */ NVME_DIRECTIVE_CDW11_DOPER_SHIFT = 0, NVME_DIRECTIVE_CDW11_DPSEC_SHIFT = 16, @@ -129,12 +121,10 @@ enum { NVME_DIRECTIVE_SEND_IDENTIFY_CDW12_DTYPE_MASK = 0x1, NVME_DIRECTIVE_SEND_IDENTIFY_CDW12_ENDIR_MASK = 0x1, - /* Device Self-test - Admin Opcode 0x1c */ NVME_DEVICE_SELF_TEST_CDW10_STC_SHIFT = 0, NVME_DEVICE_SELF_TEST_CDW10_STC_MASK = 0xf, - /* Virtualization Management - Admin Opcode 0x1d */ NVME_VIRT_MGMT_CDW10_ACT_SHIFT = 0, NVME_VIRT_MGMT_CDW10_CNTLID_SHIFT = 16, @@ -145,7 +135,6 @@ enum { NVME_VIRT_MGMT_CDW10_RT_MASK = 0x7, NVME_VIRT_MGMT_CDW11_NR_MASK = 0xffff, - /* Capacity Management - Admin Opcode 0x20 */ NVME_CAPACITY_MGMT_CDW10_ELID_SHIFT = 16, NVME_CAPACITY_MGMT_CDW10_OPER_SHIFT = 0, @@ -156,7 +145,6 @@ enum { NVME_CAPACITY_MGMT_CDW11_CAPL_MASK = 0xffffffff, NVME_CAPACITY_MGMT_CDW12_CAPU_MASK = 0xffffffff, - /* Lockdown - Admin Opcode 0x24 */ NVME_LOCKDOWN_CDW10_IFC_SHIFT = 5, NVME_LOCKDOWN_CDW10_OFI_SHIFT = 8, @@ -173,7 +161,6 @@ enum { NVME_LOCKDOWN_CDW14_UIDX_MASK = 0x7f, NVME_LOCKDOWN_CDW14_CSS_MASK = 0xffff, - /* Format NVM - Admin Opcode 0x80 */ NVME_FORMAT_CDW10_LBAFL_SHIFT = 0, NVME_FORMAT_CDW10_LBAFU_SHIFT = 12, @@ -188,7 +175,6 @@ enum { NVME_FORMAT_CDW10_PI_MASK = 0x7, NVME_FORMAT_CDW10_SES_MASK = 0x7, - /* Security Send/Receive - Admin Opcode 0x81/0x82 */ NVME_SECURITY_NSSF_SHIFT = 0, NVME_SECURITY_SECP_SHIFT = 24, @@ -199,7 +185,6 @@ enum { NVME_SECURITY_SPSP0_MASK = 0xff, NVME_SECURITY_SPSP1_MASK = 0xff, - /* Sanitize - Admin Opcode 0x84 */ NVME_SANITIZE_CDW10_AUSE_SHIFT = 3, NVME_SANITIZE_CDW10_EMVS_SHIFT = 10, @@ -220,7 +205,6 @@ enum { NVME_SANITIZE_NS_CDW10_PREQ_SHIFT = 4, NVME_SANITIZE_NS_CDW10_PREQ_MASK = 0x1, - /* Get LBA Status - Admin Opcode 0x86 */ NVME_GET_LBA_STATUS_CDW13_ATYPE_SHIFT = 24, NVME_GET_LBA_STATUS_CDW13_RL_SHIFT = 0, @@ -312,7 +296,6 @@ enum { NVME_DSM_CDW11_IDR_MASK = 0x1, NVME_DSM_CDW11_IDW_MASK = 0x1, - /* Reservation Register - I/O Opcode 0x0d */ NVME_RESV_REGISTER_CDW10_CPTPL_SHIFT = 30, NVME_RESV_REGISTER_CDW10_DISNSRS_SHIFT = 4, @@ -323,14 +306,12 @@ enum { NVME_RESV_REGISTER_CDW10_IEKEY_MASK = 0x1, NVME_RESV_REGISTER_CDW10_RREGA_MASK = 0x7, - /* Reservation Report - I/O Opcode 0x0e */ NVME_RESV_REPORT_CDW11_DISNSRS_SHIFT = 1, NVME_RESV_REPORT_CDW11_EDS_SHIFT = 0, NVME_RESV_REPORT_CDW11_DISNSRS_MASK = 0x1, NVME_RESV_REPORT_CDW11_EDS_MASK = 0x1, - /* Reservation Acquire - I/O Opcode 0x11 */ NVME_RESV_ACQUIRE_CDW10_DISNSRS_SHIFT = 4, NVME_RESV_ACQUIRE_CDW10_IEKEY_SHIFT = 3, @@ -341,14 +322,12 @@ enum { NVME_RESV_ACQUIRE_CDW10_RACQA_MASK = 0x7, NVME_RESV_ACQUIRE_CDW10_RTYPE_MASK = 0xff, - /* I/O Management Receive - I/O Opcode 0x12 */ NVME_IO_MGMT_RECV_CDW10_MOS_SHIFT = 16, NVME_IO_MGMT_RECV_CDW10_MO_SHIFT = 0, NVME_IO_MGMT_RECV_CDW10_MOS_MASK = 0xffff, NVME_IO_MGMT_RECV_CDW10_MO_MASK = 0xff, - /* Reservation Release - I/O Opcode 0x15 */ NVME_RESV_RELEASE_CDW10_DISNSRS_SHIFT = 4, NVME_RESV_RELEASE_CDW10_IEKEY_SHIFT = 3, @@ -359,7 +338,6 @@ enum { NVME_RESV_RELEASE_CDW10_RRELA_MASK = 0x7, NVME_RESV_RELEASE_CDW10_RTYPE_MASK = 0xff, - /* Cancel - I/O Opcode 0x18 */ NVME_CANCEL_CDW10_SQID_SHIFT = 0, NVME_CANCEL_CDW10_SQID_MASK = 0xffff, @@ -368,7 +346,6 @@ enum { NVME_CANCEL_CDW11_ACODE_SHIFT = 0, NVME_CANCEL_CDW11_ACODE_MASK = 0x3, - /* Copy - I/O Opcode 0x19 */ NVME_COPY_CDW10_SDLBAL_SHIFT = 0, NVME_COPY_CDW11_SDLBAU_SHIFT = 0, @@ -403,7 +380,6 @@ enum { NVME_COPY_CDW15_LBAT_MASK = 0xffff, NVME_COPY_CDW3_LBTU_MASK = 0xffffffff, - /* I/O Management Send - I/O Opcode 0x1d */ NVME_IO_MGMT_SEND_CDW10_MOS_SHIFT = 16, NVME_IO_MGMT_SEND_CDW10_MO_SHIFT = 0, @@ -423,7 +399,6 @@ enum { NVME_ZNS_MGMT_SEND_ZSASO_MASK = 0x1, NVME_ZNS_MGMT_SEND_ZSA_MASK = 0xff, - /* Zone Management Receive - I/O Opcode 0x7a */ NVME_ZNS_MGMT_RECV_ZRASPF_SHIFT = 16, NVME_ZNS_MGMT_RECV_ZRAS_SHIFT = 8, @@ -5544,4 +5519,3 @@ nvme_init_ctrl_list(struct nvme_ctrl_list *cntlist, __u16 num_ctrls, for (i = 0; i < num_ctrls; i++) cntlist->identifier[i] = htole16(ctrlist[i]); } - diff --git a/libnvme/src/nvme/nvme-types-base-common.h b/libnvme/src/nvme/nvme-types-base-common.h new file mode 100644 index 0000000000..1393ac2181 --- /dev/null +++ b/libnvme/src/nvme/nvme-types-base-common.h @@ -0,0 +1,179 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * This file is part of libnvme. + * Copyright (c) 2020 Western Digital Corporation or its affiliates. + * + * Authors: Keith Busch + * Chaitanya Kulkarni + * Daniel Wagner + * + * NVMe Base Specification type definitions + */ +#pragma once + +/** + * DOC: nvme-types-base-common.h + * + * NVMe Base Specification type common definitions + * + * Based on NVM Express Base Specification, + * Revision 2.4, July 31, 2026 (Ratified) + * + * This file contains core NVMe types organized by functional area: + * - Helper Macros: NVME_GET, NVME_SET, NVME_CHECK, NVME_VAL + */ + +#ifdef __cplusplus +#define NVME_STATIC_CHECK_ZERO(cond, msg) \ + ((int)(sizeof(char[((cond) && (msg)) ? 1 : -1]) - 1)) +#else /* __cplusplus */ +#define NVME_STATIC_CHECK_ZERO(cond, msg) \ + ((int)(sizeof(struct { _Static_assert(cond, msg); char c_; }) - 1)) +#endif /* __cplusplus */ + +#define NVME_MASK(name) NVME_##name##_MASK +#define NVME_SHIFT(name) NVME_##name##_SHIFT + +#define NVME_MASK_CHECK(name) \ + (NVME_STATIC_CHECK_ZERO(NVME_MASK(name), #name ": MASK is 0") + \ + NVME_STATIC_CHECK_ZERO(!(NVME_MASK(name) & (NVME_MASK(name) + 1ULL)), \ + #name ": MASK is not contiguous low bits")) + +#define NVME_FIELD_CHECK(value, name) (NVME_MASK_CHECK(name) + \ + NVME_STATIC_CHECK_ZERO(NVME_SHIFT(name) < sizeof(value) * CHAR_BIT, \ + #name ": SHIFT exceeds value width")) + +/** + * NVME_GET() - extract field from complex value + * @value: The original value of a complex field + * @name: The name of the sub-field within an nvme value + * + * By convention, this library defines _SHIFT and _MASK such that mask can be + * applied after the shift to isolate a specific set of bits that decode to a + * sub-field. + * + * Return: The 'name' field from 'value' + */ +#define NVME_GET(value, name) (NVME_FIELD_CHECK(value, name) + \ + (((value) >> NVME_SHIFT(name)) & NVME_MASK(name))) + +/** + * NVME_SET() - set field into complex value + * @value: The value to be set in its completed position + * @name: The name of the sub-field within an nvme value + * + * Return: The 'name' field from 'value' + */ +#define NVME_SET(value, name) (NVME_MASK_CHECK(name) + \ + (((__u32)(value) & NVME_MASK(name)) << NVME_SHIFT(name))) + +/** + * NVME_CHECK() - check value to compare field value + * @value: The value to be checked + * @name: The name of the sub-field within an nvme value + * @check: The sub-field value to check + * + * Return: The result of compare the value and the sub-field value + */ +#define NVME_CHECK(value, name, check) ((value) == NVME_##name##_##check) + +/** + * NVME_VAL() - get mask value shifted + * @name: The name of the sub-field within an nvme value + * + * Return: The mask value shifted + */ +#define NVME_VAL(name) ((__u32)NVME_MASK(name) << NVME_SHIFT(name)) + +/** + * enum nvme_constants - A place to stash various constant nvme values + * @NVME_NSID_ALL: A broadcast value that is used to specify all + * namespaces + * @NVME_NSID_NONE: The invalid namespace id, for when the nsid + * parameter is not used in a command + * @NVME_UUID_NONE: Use to omit a uuid command parameter + * @NVME_CNTLID_NONE: Use to omit a cntlid command parameter + * @NVME_CNSSPECID_NONE: Use to omit a cns_specific_id command parameter + * @NVME_LOG_LSP_NONE: Use to omit a log lsp command parameter + * @NVME_LOG_LSI_NONE: Use to omit a log lsi command parameter + * @NVME_LOG_LPO_NONE: Use to omit a log lpo command parameter + * @NVME_IDENTIFY_DATA_SIZE: The transfer size for nvme identify commands + * @NVME_LOG_SUPPORTED_LOG_PAGES_MAX: The largest possible index in the + * supporte log pages log. + * @NVME_ID_NVMSET_LIST_MAX: The largest possible nvmset index in identify + * nvmeset + * @NVME_ID_UUID_LIST_MAX: The largest possible uuid index in identify + * uuid list + * @NVME_ID_CTRL_LIST_MAX: The largest possible controller index in + * identify controller list + * @NVME_ID_NS_LIST_MAX: The largest possible namespace index in + * identify namespace list + * @NVME_ID_SECONDARY_CTRL_MAX: The largest possible secondary controller index + * in identify secondary controller + * @NVME_ID_DOMAIN_LIST_MAX: The largest possible domain index in the + * in domain list + * @NVME_ID_ENDURANCE_GROUP_LIST_MAX: The largest possible endurance group + * index in the endurance group list + * @NVME_ID_ND_DESCRIPTOR_MAX: The largest possible namespace granularity + * index in the namespace granularity descriptor + * list (i.e. with the LBA Format Extension + * Enable field set to 1h in the Host Behavior + * Support feature) + * @NVME_FEAT_LBA_RANGE_MAX: The largest possible LBA range index in feature + * lba range type + * @NVME_LOG_ST_MAX_RESULTS: The largest possible self test result index in + * the device self test log + * @NVME_LOG_FID_SUPPORTED_EFFECTS_MAX: The largest possible FID index in the + * feature identifiers effects log. + * @NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_MAX: The largest possible MI Command + * index in the MI Command effects log. + * @NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_RESERVED: The reserved space in the MI + * Command effects log. + * @NVME_LOG_TELEM_BLOCK_SIZE: Specification defined size of Telemetry Data + * Blocks + * @NVME_DSM_MAX_RANGES: The largest possible range index in a data-set + * management command + * @NVME_NQN_LENGTH: Max length for NVMe Qualified Name + * @NVMF_TRADDR_SIZE: Max Transport Address size + * @NVMF_TSAS_SIZE: Max Transport Specific Address Subtype size + * @NVME_ZNS_CHANGED_ZONES_MAX: Max number of zones in the changed zones log + * page + * @NVME_STREAM_ID_MAX: Max number of stream IDs + * @NVME_UNDERLYING_NS_LIST_MAX: The maximum number of Underlying Namespace + * Entry data structures reportable in the Get + * Underlying Namespace List Identify data + * structure + */ +enum nvme_constants { + NVME_NSID_ALL = 0xffffffff, + NVME_NSID_NONE = 0, + NVME_UUID_NONE = 0, + NVME_CNTLID_NONE = 0, + NVME_CNSSPECID_NONE = 0, + NVME_LOG_LSP_NONE = 0, + NVME_LOG_LSI_NONE = 0, + NVME_LOG_LPO_NONE = 0, + NVME_IDENTIFY_DATA_SIZE = 4096, + NVME_LOG_SUPPORTED_LOG_PAGES_MAX = 256, + NVME_ID_NVMSET_LIST_MAX = 31, + NVME_ID_UUID_LIST_MAX = 127, + NVME_ID_CTRL_LIST_MAX = 2047, + NVME_ID_NS_LIST_MAX = 1024, + NVME_ID_SECONDARY_CTRL_MAX = 127, + NVME_ID_DOMAIN_LIST_MAX = 31, + NVME_ID_ENDURANCE_GROUP_LIST_MAX = 2047, + NVME_ID_ND_DESCRIPTOR_MAX = 64, + NVME_FEAT_LBA_RANGE_MAX = 64, + NVME_LOG_ST_MAX_RESULTS = 20, + NVME_LOG_TELEM_BLOCK_SIZE = 512, + NVME_LOG_FID_SUPPORTED_EFFECTS_MAX = 256, + NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_MAX = 256, + NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_RESERVED = 768, + NVME_DSM_MAX_RANGES = 256, + NVME_NQN_LENGTH = 256, + NVMF_TRADDR_SIZE = 256, + NVMF_TSAS_SIZE = 256, + NVME_ZNS_CHANGED_ZONES_MAX = 511, + NVME_STREAM_ID_MAX = 0xffff, + NVME_UNDERLYING_NS_LIST_MAX = 12, +}; diff --git a/libnvme/src/nvme/nvme-types-base-id.h b/libnvme/src/nvme/nvme-types-base-id.h new file mode 100644 index 0000000000..d54530108e --- /dev/null +++ b/libnvme/src/nvme/nvme-types-base-id.h @@ -0,0 +1,4272 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * This file is part of libnvme. + * Copyright (c) 2020 Western Digital Corporation or its affiliates. + * + * Authors: Keith Busch + * Chaitanya Kulkarni + * Daniel Wagner + * + * NVMe Base Specification type definitions + */ +#pragma once + +#include + +/** + * DOC: nvme-types-base-id.h + * + * NVMe Base Specification type identify definitions + * + * Based on NVM Express Base Specification, + * Revision 2.4, July 31, 2026 (Ratified) + * + * This file contains core NVMe types organized by functional area: + * - Identify Structures: Controller, Namespace, and related data + */ + +/** + * enum nvme_flbas - This field indicates the formatted LBA size + * @NVME_FLBAS_LOWER_SHIFT: Shift amount to get the format index least + * significant 4 bits + * @NVME_FLBAS_META_EXT_SHIFT: Shift amount to get the metadata transferred + * @NVME_FLBAS_HIGHER_SHIFT: Shift amount to get the format index most + * significant 2 bits + * @NVME_FLBAS_RSVD7_SHIFT: Shift amount to get the Reserved + * @NVME_FLBAS_LOWER_MASK: Mask to get the format index least significant + * 4 bits + * @NVME_FLBAS_META_EXT_MASK: Mask to get the metadata transferred + * @NVME_FLBAS_HIGHER_MASK: Mask to get the format index most significant + * 2 bits + * @NVME_FLBAS_RSVD7_MASK: Mask to get the Reserved + */ +enum nvme_flbas { + NVME_FLBAS_LOWER_SHIFT = 0, + NVME_FLBAS_META_EXT_SHIFT = 4, + NVME_FLBAS_HIGHER_SHIFT = 5, + NVME_FLBAS_RSVD7_SHIFT = 7, + NVME_FLBAS_LOWER_MASK = 0xf, + NVME_FLBAS_META_EXT_MASK = 0x1, + NVME_FLBAS_HIGHER_MASK = 0x3, + NVME_FLBAS_RSVD7_MASK = 0x1, +}; + +#define NVME_FLBAS_LOWER(flbas) NVME_GET(flbas, FLBAS_LOWER) +#define NVME_FLBAS_META_EXT(flbas) NVME_GET(flbas, FLBAS_META_EXT) +#define NVME_FLBAS_HIGHER(flbas) NVME_GET(flbas, FLBAS_HIGHER) +#define NVME_FLBAS_RSVD7(flbas) NVME_GET(flbas, FLBAS_RSVD7) + +/** + * enum nvme_mc - This field indicates the Metadata capabilities + * @NVME_MC_MTELBAS_SHIFT: MTELBAS shift + * @NVME_MC_MTSBS_SHIFT: MTSBS shift + * @NVME_MC_RSVD2_SHIFT: Reserved shift + * @NVME_MC_MTELBAS_MASK: MTELBAS mask + * @NVME_MC_MTSBS_MASK: MTSBS mask + * @NVME_MC_RSVD2_MASK: Reserved mask + */ +enum nvme_mc { + NVME_MC_MTELBAS_SHIFT = 0, + NVME_MC_MTSBS_SHIFT = 1, + NVME_MC_RSVD2_SHIFT = 2, + NVME_MC_MTELBAS_MASK = 0x1, + NVME_MC_MTSBS_MASK = 0x1, + NVME_MC_RSVD2_MASK = 0x3f, +}; + +#define NVME_MC_MTELBAS(mc) NVME_GET(mc, MC_MTELBAS) +#define NVME_MC_MTSBS(mc) NVME_GET(mc, MC_MTSBS) +#define NVME_MC_RSVD2(mc) NVME_GET(mc, MC_RSVD2) + +/** + * enum nvme_psd_flags - Possible flag values in nvme power state descriptor + * @NVME_PSD_FLAGS_MXPS_SHIFT: MXPS shift + * @NVME_PSD_FLAGS_NOPS_SHIFT: NOPS shift + * @NVME_PSD_FLAGS_RSVD2_SHIFT: Reserved shift + * @NVME_PSD_FLAGS_MXPS_MASK: MXPS mask + * @NVME_PSD_FLAGS_NOPS_MASK: NOPS mask + * @NVME_PSD_FLAGS_RSVD2_MASK: Reserved mask + * @NVME_PSD_FLAGS_MXPS: Indicates the scale for the Maximum Power + * field. If this bit is cleared, then the scale of the + * Maximum Power field is in 0.01 Watts. If this bit is + * set, then the scale of the Maximum Power field is in + * 0.0001 Watts. + * @NVME_PSD_FLAGS_NOPS: Indicates whether the controller processes I/O + * commands in this power state. If this bit is cleared, + * then the controller processes I/O commands in this + * power state. If this bit is set, then the controller + * does not process I/O commands in this power state. + */ +enum nvme_psd_flags { + NVME_PSD_FLAGS_MXPS_SHIFT = 0, + NVME_PSD_FLAGS_NOPS_SHIFT = 1, + NVME_PSD_FLAGS_RSVD2_SHIFT = 2, + NVME_PSD_FLAGS_MXPS_MASK = 0x1, + NVME_PSD_FLAGS_NOPS_MASK = 0x1, + NVME_PSD_FLAGS_RSVD2_MASK = 0x3f, + NVME_PSD_FLAGS_MXPS = NVME_VAL(PSD_FLAGS_MXPS), + NVME_PSD_FLAGS_NOPS = NVME_VAL(PSD_FLAGS_NOPS), +}; + +#define NVME_PSD_FLAGS_MXPS(flags) NVME_GET(flags, PSD_FLAGS_MXPS) +#define NVME_PSD_FLAGS_NOPS(flags) NVME_GET(flags, PSD_FLAGS_NOPS) +#define NVME_PSD_FLAGS_RSVD2(flags) NVME_GET(flags, PSD_FLAGS_RSVD2) + +/** + * enum nvme_psd_ps - Known values for &struct nvme_psd %ips and %aps. Use with + * nvme_psd_power_scale() to extract the power scale field + * to match this enum. + * @NVME_PSD_PS_NOT_REPORTED: Not reported + * @NVME_PSD_PS_100_MICRO_WATT: 0.0001 watt scale + * @NVME_PSD_PS_10_MILLI_WATT: 0.01 watt scale + */ +enum nvme_psd_ps { + NVME_PSD_PS_NOT_REPORTED = 0, + NVME_PSD_PS_100_MICRO_WATT = 1, + NVME_PSD_PS_10_MILLI_WATT = 2, +}; + +/** + * enum nvme_psd_mbws - Known values for &struct nvme_id_psd %mbws, the scale + * for &struct nvme_id_psd.mbw. + * @NVME_PSD_MBWS_1_MIB_S: 1 MiB/second scale + * @NVME_PSD_MBWS_10_MIB_S: 10 MiB/second scale + * @NVME_PSD_MBWS_100_MIB_S: 100 MiB/second scale + * @NVME_PSD_MBWS_1_GIB_S: 1 GiB/second scale + * @NVME_PSD_MBWS_10_GIB_S: 10 GiB/second scale + * @NVME_PSD_MBWS_100_GIB_S: 100 GiB/second scale + * @NVME_PSD_MBWS_SHIFT: MBWS shift + * @NVME_PSD_MBWS_MASK: MBWS mask + */ +enum nvme_psd_mbws { + NVME_PSD_MBWS_1_MIB_S = 0, + NVME_PSD_MBWS_10_MIB_S = 1, + NVME_PSD_MBWS_100_MIB_S = 2, + NVME_PSD_MBWS_1_GIB_S = 3, + NVME_PSD_MBWS_10_GIB_S = 4, + NVME_PSD_MBWS_100_GIB_S = 5, + NVME_PSD_MBWS_SHIFT = 0, + NVME_PSD_MBWS_MASK = 0x7, +}; + +#define NVME_PSD_MBWS(mbws) NVME_GET(mbws, PSD_MBWS) + +/** + * enum nvme_power_measurement_type - Power measurement types. + * @NVME_PMT_NSS_TOTAL_POWER: NVM subsystem total power + * @NVME_PMT_RSVD_MIN: Reserved minimum value + * @NVME_PMT_RSVD_MAX: Reserved maximum value + * @NVME_PMT_VS_MIN: Vendor Specific minimum value + * @NVME_PMT_VS_MAX: Vendor Specific maximum value + */ +enum nvme_power_measurement_type { + NVME_PMT_NSS_TOTAL_POWER = 0x0, + NVME_PMT_RSVD_MIN = 0x1, + NVME_PMT_RSVD_MAX = 0xb, + NVME_PMT_VS_MIN = 0xc, + NVME_PMT_VS_MAX = 0xf, +}; + +/** + * enum nvme_power_measurement_action - Power measurement actions. + * @NVME_PMA_STOP: Stop power measurement + * @NVME_PMA_START: Start power measurement + */ +enum nvme_power_measurement_action { + NVME_PMA_STOP = 0x0, + NVME_PMA_START = 0x1, +}; + +/** + * enum nvme_psd_apws - Specifies APW and APS + * @NVME_PSD_APW_SHIFT: APW shift + * @NVME_PSD_APS_SHIFT: APS shift + * @NVME_PSD_APW_MASK: APW mask + * @NVME_PSD_APS_MASK: APS mask + */ +enum nvme_psd_apws { + NVME_PSD_APW_SHIFT = 0, + NVME_PSD_APS_SHIFT = 6, + NVME_PSD_APW_MASK = 0x7, + NVME_PSD_APS_MASK = 0x3, +}; + +#define NVME_PSD_APW(apws) NVME_GET(apws, PSD_APW) +#define NVME_PSD_APS(apws) NVME_GET(apws, PSD_APS) + +/** + * nvme_psd_power_scale() - power scale occupies the upper 3 bits + * @ps: power scale value + * + * Return: power scale value + */ +static inline unsigned int nvme_psd_power_scale(__u8 ps) +{ + return NVME_PSD_APS(ps); +} + +/** + * enum nvme_psd_workload - Specifies a workload hint in the Power Management + * Feature (see &struct nvme_psd.apw) to inform the + * NVM subsystem or indicate the conditions for the + * active power level. + * @NVME_PSD_WORKLOAD_NP: The workload is unknown or not provided. + * @NVME_PSD_WORKLOAD_1: Extended Idle Period with a Burst of Random Write + * consists of five minutes of idle followed by + * thirty-two random write commands of size 1 MiB + * submitted to a single controller while all other + * controllers in the NVM subsystem are idle, and then + * thirty (30) seconds of idle. + * @NVME_PSD_WORKLOAD_2: Heavy Sequential Writes consists of 80,000 + * sequential write commands of size 128 KiB submitted to + * a single controller while all other controllers in the + * NVM subsystem are idle. The submission queue(s) + * should be sufficiently large allowing the host to + * ensure there are multiple commands pending at all + * times during the workload. + */ +enum nvme_psd_workload { + NVME_PSD_WORKLOAD_NP = 0, + NVME_PSD_WORKLOAD_1 = 1, + NVME_PSD_WORKLOAD_2 = 2, +}; + +/** + * enum nvme_psd_epfr_fqv_ts - Specifies EPFRTS and FQVTS + * @NVME_PSD_EPFRTS_SHIFT: EPFRTS shift + * @NVME_PSD_FQVTS_SHIFT: FQVTS shift + * @NVME_PSD_EPFRTS_MASK: EPFRTS mask + * @NVME_PSD_FQVTS_MASK: FQVTS mask + */ +enum nvme_psd_epfr_fqv_ts { + NVME_PSD_EPFRTS_SHIFT = 0, + NVME_PSD_FQVTS_SHIFT = 4, + NVME_PSD_EPFRTS_MASK = 0xf, + NVME_PSD_FQVTS_MASK = 0xf, +}; + +#define NVME_PSD_EPFRTS(epfr_fqv_ts) NVME_GET(epfr_fqv_ts, PSD_EPFRTS) +#define NVME_PSD_FQVTS(epfr_fqv_ts) NVME_GET(epfr_fqv_ts, PSD_FQVTS) + +/** + * enum nvme_psd_epfvts - Specifies EPFVTS + * @NVME_PSD_EPFVTS_SHIFT: EPFVTS shift + * @NVME_PSD_RSVD4_SHIFT: Reserved shift + * @NVME_PSD_EPFVTS_MASK: EPFVTS mask + * @NVME_PSD_RSVD4_MASK: Reserved mask + */ +enum nvme_psd_epfvts { + NVME_PSD_EPFVTS_SHIFT = 0, + NVME_PSD_RSVD4_SHIFT = 4, + NVME_PSD_EPFVTS_MASK = 0xf, + NVME_PSD_RSVD4_MASK = 0xf, +}; + +#define NVME_PSD_EPFVTS(epfvts) NVME_GET(epfvts, PSD_EPFVTS) +#define NVME_PSD_RSVD4(epfvts) NVME_GET(epfvts, PSD_RSVD4) + +/** + * struct nvme_id_psd - Power Management data structure + * @mp: Maximum Power indicates the sustained maximum power consumed by the + * NVM subsystem in this power state. The power in Watts is equal to + * the value in this field multiplied by the scale specified in the Max + * Power Scale bit (see &enum nvme_psd_flags). A value of 0 indicates + * Maximum Power is not reported. + * @rsvd2: Reserved + * @flags: Additional decoding flags, see &enum nvme_psd_flags. + * @enlat: Entry Latency indicates the maximum latency in microseconds + * associated with entering this power state. A value of 0 indicates + * Entry Latency is not reported. + * @exlat: Exit Latency indicates the maximum latency in microseconds + * associated with exiting this power state. A value of 0 indicates + * Exit Latency is not reported. + * @rrt: Relative Read Throughput indicates the read throughput rank + * associated with this power state relative to others. The value in + * this is less than the number of supported power states. + * @rrl: Relative Read Latency indicates the read latency rank associated + * with this power state relative to others. The value in this field is + * less than the number of supported power states. + * @rwt: Relative Write Throughput indicates write throughput rank associated + * with this power state relative to others. The value in this field is + * less than the number of supported power states + * @rwl: Relative Write Latency indicates the write latency rank associated + * with this power state relative to others. The value in this field is + * less than the number of supported power states + * @idlp: Idle Power indicates the typical power consumed by the NVM + * subsystem over 30 seconds in this power state when idle. + * @ips: Idle Power Scale indicates the scale for &struct nvme_id_psd.idlp, + * see &enum nvme_psd_ps for decoding this field. + * @rsvd19: Reserved + * @actp: Active Power indicates the largest average power consumed by the + * NVM subsystem over a 10 second period in this power state with + * the workload indicated in the Active Power Workload field. + * @apws: Bits 7-6: Active Power Scale(APS) indicates the scale for the &struct + * nvme_id_psd.actp, see &enum nvme_psd_ps for decoding this value. + * Bits 2-0: Active Power Workload(APW) indicates the workload + * used to calculate maximum power for this power state. + * See &enum nvme_psd_workload for decoding this field. + * @epfrt: Emergency power fail recovery time + * @fqvt: Forced quiescence vault time + * @epfvt: Emergency power fail vault time + * @epfr_fqv_ts: Bits 7-4: Forced quiescence vault time scale + * Bits 3-0: Emergency power fail recovery time scale + * @epfvts: Bits 3-0: Emergency power fail vault time scale + * @mbw: Max Bandwidth indicates the maximum bandwidth attainable in this + * power state when submitting MDTS-length sequential read commands + * at a queue depth of the Optimal Aggregated Queue Depth field. The + * bandwidth is equal to the value in this field multiplied by the + * scale indicated in the Max Bandwidth Scale field. A value of 0 + * indicates no maximum bandwidth is reported. + * @mbws: Bits 2-0: Max Bandwidth Scale (MBWS) indicates the scale for + * &struct nvme_id_psd.mbw, see &enum nvme_psd_mbws for decoding + * this field. + * @miiell: Minimum Idle I/O Exit Latency Limit: if the Idle I/O Exit Latency + * Limit capability is supported (see &enum + * nvme_id_ctrl_ctratt.NVME_CTRL_CTRATT_IIELLSS) for this operational + * power state, a non-zero value indicates the minimum supported + * Idle I/O Exit Latency Limit in units of 100 microseconds, and a + * value of 0h indicates there is no minimum. Cleared to 0h for a + * non-operational power state or if the capability is not + * supported. + */ +struct nvme_id_psd { + __le16 mp; + __u8 rsvd2; + __u8 flags; + __le32 enlat; + __le32 exlat; + __u8 rrt; + __u8 rrl; + __u8 rwt; + __u8 rwl; + __le16 idlp; + __u8 ips; + __u8 rsvd19; + __le16 actp; + __u8 apws; + __u8 epfrt; + __u8 fqvt; + __u8 epfvt; + __u8 epfr_fqv_ts; + __u8 epfvts; + __u8 mbw; + __u8 mbws; + __le16 miiell; +} __attribute__((packed)); + +/** + * struct nvme_id_ctrl - Identify Controller data structure + * @vid: PCI Vendor ID, the company vendor identifier that is assigned by + * the PCI SIG. + * @ssvid: PCI Subsystem Vendor ID, the company vendor identifier that is + * assigned by the PCI SIG for the subsystem. + * @sn: Serial Number in ASCII + * @mn: Model Number in ASCII + * @fr: Firmware Revision in ASCII, the currently active firmware + * revision for the NVM subsystem + * @rab: Recommended Arbitration Burst, reported as a power of two + * @ieee: IEEE assigned Organization Unique Identifier + * @cmic: Controller Multipath IO and Namespace Sharing Capabilities of + * the controller and NVM subsystem. See &enum nvme_id_ctrl_cmic. + * @mdts: Max Data Transfer Size is the largest data transfer size. The + * host should not submit a command that exceeds this maximum data + * transfer size. The value is in units of the minimum memory page + * size (CAP.MPSMIN) and is reported as a power of two + * @cntlid: Controller ID, the NVM subsystem unique controller identifier + * associated with the controller. + * @ver: Version, this field contains the value reported in the Version + * register, or property (see &enum nvme_registers %NVME_REG_VS). + * @rtd3r: RTD3 Resume Latency, the expected latency in microseconds to + * resume from Runtime D3 + * @rtd3e: RTD3 Exit Latency, the typical latency in microseconds to enter + * Runtime D3. + * @oaes: Optional Async Events Supported, see @enum nvme_id_ctrl_oaes. + * @ctratt: Controller Attributes, see @enum nvme_id_ctrl_ctratt. + * @rrls: Read Recovery Levels. If a bit is set, then the corresponding + * Read Recovery Level is supported. If a bit is cleared, then the + * corresponding Read Recovery Level is not supported. + * @bpcap: Boot Partition Capabilities, see &enum nvme_id_ctrl_bpcap. + * @chsi: CXL HDM Support Information, see &enum nvme_id_ctrl_chsi. + * @nssl: NVM Subsystem Shutdown Latency (NSSL). This field indicates the + * typical latency in microseconds for an NVM Subsystem Shutdown to + * complete. + * @rsvd108: Reserved + * @plsi: Power Loss Signaling Information (PLSI), + * see &enum nvme_id_ctrl_plsi + * @cntrltype: Controller Type, see &enum nvme_id_ctrl_cntrltype + * @fguid: FRU GUID, a 128-bit value that is globally unique for a given + * Field Replaceable Unit + * @crdt1: Controller Retry Delay time in 100 millisecond units if CQE CRD + * field is 1 + * @crdt2: Controller Retry Delay time in 100 millisecond units if CQE CRD + * field is 2 + * @crdt3: Controller Retry Delay time in 100 millisecond units if CQE CRD + * field is 3 + * @crcap: Controller Reachability Capabilities (CRCAP), see + * &enum nvme_id_ctrl_crcap + * @ciu: Controller Instance Uniquifier (CIU) + * @cirn: Controller Instance Random Number (CIRN) + * @rsvd144: Reserved + * @rsvd240: Reserved for the NVMe Management Interface specification + * @nvmsr: NVM Subsystem Report, see &enum nvme_id_ctrl_nvmsr + * @vwci: VPD Write Cycle Information, see &enum nvme_id_ctrl_vwci + * @mec: Management Endpoint Capabilities, see &enum nvme_id_ctrl_mec + * @oacs: Optional Admin Command Support,the optional Admin commands and + * features supported by the controller, + * see &enum nvme_id_ctrl_oacs. + * @acl: Abort Command Limit, the maximum number of concurrently + * executing Abort commands supported by the controller. This is a + * 0's based value. + * @aerl: Async Event Request Limit, the maximum number of concurrently + * outstanding Asynchronous Event Request commands supported by the + * controller This is a 0's based value. + * @frmw: Firmware Updates indicates capabilities regarding firmware + * updates. See &enum nvme_id_ctrl_frmw. + * @lpa: Log Page Attributes, see &enum nvme_id_ctrl_lpa. + * @elpe: Error Log Page Entries, the maximum number of Error Information + * log entries that are stored by the controller. This field is a + * 0's based value. + * @npss: Number of Power States Supported, the number of NVM Express + * power states supported by the controller, indicating the number + * of valid entries in &struct nvme_id_ctrl.psd. This is a 0's + * based value. + * @avscc: Admin Vendor Specific Command Configuration, see + * &enum nvme_id_ctrl_avscc. + * @apsta: Autonomous Power State Transition Attributes, see + * &enum nvme_id_ctrl_apsta. + * @wctemp: Warning Composite Temperature Threshold indicates + * the minimum Composite Temperature field value (see &struct + * nvme_smart_log.critical_comp_time) that indicates an overheating + * condition during which controller operation continues. + * @cctemp: Critical Composite Temperature Threshold, field indicates the + * minimum Composite Temperature field value (see &struct + * nvme_smart_log.critical_comp_time) that indicates a critical + * overheating condition. + * @mtfa: Maximum Time for Firmware Activation indicates the maximum time + * the controller temporarily stops processing commands to activate + * the firmware image, specified in 100 millisecond units. This + * field is always valid if the controller supports firmware + * activation without a reset. + * @hmpre: Host Memory Buffer Preferred Size indicates the preferred size + * that the host is requested to allocate for the Host Memory + * Buffer feature in 4 KiB units. + * @hmmin: Host Memory Buffer Minimum Size indicates the minimum size that + * the host is requested to allocate for the Host Memory Buffer + * feature in 4 KiB units. + * @tnvmcap: Total NVM Capacity, the total NVM capacity in the NVM subsystem. + * The value is in bytes. + * @unvmcap: Unallocated NVM Capacity, the unallocated NVM capacity in the + * NVM subsystem. The value is in bytes. + * @rpmbs: Replay Protected Memory Block Support, see + * &enum nvme_id_ctrl_rpmbs. + * @edstt: Extended Device Self-test Time, if Device Self-test command is + * supported (see &struct nvme_id_ctrl.oacs, %NVME_CTRL_OACS_DSTS), + * then this field indicates the nominal amount of time in one + * minute units that the controller takes to complete an extended + * device self-test operation when in power state 0. + * @dsto: Device Self-test Options, see &enum nvme_id_ctrl_dsto. + * @fwug: Firmware Update Granularity indicates the granularity and + * alignment requirement of the firmware image being updated by the + * Firmware Image Download command. The value is reported in 4 KiB + * units. A value of 0h indicates no information on granularity is + * provided. A value of FFh indicates no restriction + * @kas: Keep Alive Support indicates the granularity of the Keep Alive + * Timer in 100 millisecond units. + * @hctma: Host Controlled Thermal Management Attributes, see + * &enum nvme_id_ctrl_hctm. + * @mntmt: Minimum Thermal Management Temperature indicates the minimum + * temperature, in degrees Kelvin, that the host may request in the + * Thermal Management Temperature 1 field and Thermal Management + * Temperature 2 field of a Set Features command with the Feature + * Identifier field set to %NVME_FEAT_FID_HCTM. + * @mxtmt: Maximum Thermal Management Temperature indicates the maximum + * temperature, in degrees Kelvin, that the host may request in the + * Thermal Management Temperature 1 field and Thermal Management + * Temperature 2 field of the Set Features command with the Feature + * Identifier set to %NVME_FEAT_FID_HCTM. + * @sanicap: Sanitize Capabilities, see &enum nvme_id_ctrl_sanicap + * @hmminds: Host Memory Buffer Minimum Descriptor Entry Size indicates the + * minimum usable size of a Host Memory Buffer Descriptor Entry in + * 4 KiB units. + * @hmmaxd: Host Memory Maximum Descriptors Entries indicates the number of + * usable Host Memory Buffer Descriptor Entries. + * @nsetidmax: NVM Set Identifier Maximum, defines the maximum value of a valid + * NVM Set Identifier for any controller in the NVM subsystem. + * @endgidmax: Endurance Group Identifier Maximum, defines the maximum value of + * a valid Endurance Group Identifier for any controller in the NVM + * subsystem. + * @anatt: ANA Transition Time indicates the maximum amount of time, in + * seconds, for a transition between ANA states or the maximum + * amount of time, in seconds, that the controller reports the ANA + * change state. + * @anacap: Asymmetric Namespace Access Capabilities, see + * &enum nvme_id_ctrl_anacap. + * @anagrpmax: ANA Group Identifier Maximum indicates the maximum value of a + * valid ANA Group Identifier for any controller in the NVM + * subsystem. + * @nanagrpid: Number of ANA Group Identifiers indicates the number of ANA + * groups supported by this controller. + * @pels: Persistent Event Log Size indicates the maximum reportable size + * for the Persistent Event Log. + * @domainid: Domain Identifier indicates the identifier of the domain + * that contains this controller. + * @kpioc: Key Per I/O Capabilities (KPIOC), see &enum nvme_id_ctrl_kpioc + * @rsvd359: Reserved + * @mptfawr: Maximum Processing Time for Firmware Activation Without Reset + * (MPTFAWR). This field shall indicate the estimated maximum time + * in 100 ms units required by the controller to process a Firmware + * Commit command that specifies a value of 011b in the Commit + * Action field + * @rmdca: Restore Manufacturing Configuration Attributes, see &enum + * nvme_id_ctrl_rmdca + * @rsvd363: Reserved + * @megcap: Max Endurance Group Capacity indicates the maximum capacity + * of a single Endurance Group. + * @tmpthha: Temperature Threshold Hysteresis Attributes + * @mupa: Maximum Unlimited Power Attributes + * @cqt: Command Quiesce Time (CQT). This field indicates the expected + * worst-case time in 1 millisecond units for the controller to + * quiesce all outstanding commands after a Keep Alive Timeout or + * other communication loss. + * @cdpa: Configurable Device Personality Attributes: This field + * indicates the Configurable Device Personality feature attributes + * the controller supports. + * @mup: Maximum Unlimited Power: This field specifies the maximum + * power for power state 0 that results from removal of a power + * limit (i.e., the maximum power is not limited). + * @ipmsr: Interval Power Measurement Sample Rate: This field + * indicates the maximum interval between power measurement + * samples used to collect interval power measurements. + * @msmt: Maximum Stop Measurement Time: This field indicates the + * maximum stop measurement time allowed to be specified in the + * SMT field for a Set Features command specifying the Power + * Measurement feature. + * @mnens: Maximum Number of Exported NVM Subsystems + * @mnecpens: Maximum Number of Exported Controllers per Exported NVM + * Subsystem + * @mensnn: Maximum Exported NVM Subsystem Number of Namespaces + * @ensa: Exported NVM Subsystem Attributes + * @endsfs: Exported Namespace Data Structure Formats Supported + * @vsen1: Voltage Sensor 1: indicates the characteristics of Voltage + * Sensor 1, see &struct nvme_id_ctrl_vsds. A value of 0h indicates + * Voltage Sensor 1 is not supported. + * @vsen2: Voltage Sensor 2, see &struct nvme_id_ctrl_vsds. A value of + * 0h indicates Voltage Sensor 2 is not supported. + * @vsen3: Voltage Sensor 3, see &struct nvme_id_ctrl_vsds. A value of + * 0h indicates Voltage Sensor 3 is not supported. + * @vsen4: Voltage Sensor 4, see &struct nvme_id_ctrl_vsds. A value of + * 0h indicates Voltage Sensor 4 is not supported. + * @msvmt: Maximum Stop Voltage Measurement Time: This field indicates + * the maximum stop measurement time in minutes allowed to be + * specified in the SVMT field for a Set Features command + * specifying the Voltage Measurement feature. A value of 0h + * indicates that a maximum stop measurement time is not reported. + * @rsvd424: Reserved + * @sqes: Submission Queue Entry Size, see &enum nvme_id_ctrl_sqes. + * @cqes: Completion Queue Entry Size, see &enum nvme_id_ctrl_cqes. + * @maxcmd: Maximum Outstanding Commands indicates the maximum number of + * commands that the controller processes at one time for a + * particular queue. + * @nn: Number of Namespaces indicates the maximum value of a valid + * nsid for the NVM subsystem. If the MNAN + * (&struct nvme_id_ctrl.mnan) field is cleared to 0h, then this + * field also indicates the + * maximum number of namespaces supported by the NVM subsystem. + * @oncs: Optional NVM Command Support, see &enum nvme_id_ctrl_oncs. + * @fuses: Fused Operation Support, see &enum nvme_id_ctrl_fuses. + * @fna: Format NVM Attributes, see &enum nvme_id_ctrl_fna. + * @vwc: Volatile Write Cache, see &enum nvme_id_ctrl_vwc. + * @awun: Atomic Write Unit Normal indicates the size of the write + * operation guaranteed to be written atomically to the NVM across + * all namespaces with any supported namespace format during normal + * operation. This field is specified in logical blocks and is a + * 0's based value. + * @awupf: Atomic Write Unit Power Fail indicates the size of the write + * operation guaranteed to be written atomically to the NVM across + * all namespaces with any supported namespace format during a + * power fail or error condition. This field is specified in + * logical blocks and is a 0’s based value. + * @icsvscc: NVM Vendor Specific Command Configuration, see + * &enum nvme_id_ctrl_nvscc. + * @nwpc: Namespace Write Protection Capabilities, see + * &enum nvme_id_ctrl_nwpc. + * @acwu: Atomic Compare & Write Unit indicates the size of the write + * operation guaranteed to be written atomically to the NVM across + * all namespaces with any supported namespace format for a Compare + * and Write fused operation. This field is specified in logical + * blocks and is a 0’s based value. + * @cdfs: Copy Descriptor Formats Supported, each bit n means + * controller supports Copy Descriptor Format n. + * @sgls: SGL Support, see &enum nvme_id_ctrl_sgls + * @mnan: Maximum Number of Allowed Namespaces indicates the maximum + * number of namespaces supported by the NVM subsystem. + * @maxdna: Maximum Domain Namespace Attachments indicates the maximum + * of the sum of the number of namespaces attached to each I/O + * controller in the Domain. + * @maxcna: Maximum I/O Controller Namespace Attachments indicates the + * maximum number of namespaces that are allowed to be attached to + * this I/O controller. + * @oaqd: Optimal Aggregated Queue Depth indicates the recommended maximum + * total number of outstanding I/O commands across all I/O queues + * on the controller for optimal operation. + * @rhiri: Recommended Host-Initiated Refresh Interval (RHIRI). If the + * Host-Initiated Refresh capability is supported, then this field + * indicates the recommended time interval in days from last power + * down to the time at which the host should initiate the + * Host-Initiated Refresh operation. If this field is cleared to + * 0h, then this field is not reported. + * @hirt: Host-Initiated Refresh Time (HIRT). If the Host-Initiated + * Refresh capability is supported, then this field indicates the + * nominal amount of time in minutes that the controller takes to + * complete the Host-Initiated Refresh operation. If this field is + * cleared to 0h, then this field is not reported. + * @cmmrtd: Controller Maximum Memory Range Tracking Descriptors indicates + * the maximum number of Memory Range Tracking Descriptors the + * controller supports. + * @nmmrtd: NVM Subsystem Maximum Memory Range Tracking Descriptors + * indicates the maximum number of Memory Range Tracking Descriptors + * the NVM subsystem supports. + * @minmrtg: Minimum Memory Range Tracking Granularity indicates the minimum + * value supported in the Requested Memory Range Tracking + * Granularity (RMRTG) field of the Track Memory Ranges data + * structure. + * @maxmrtg: Maximum Memory Range Tracking Granularity indicates the maximum + * value supported in the Requested Memory Range Tracking + * Granularity (RMRTG) field of the Track Memory Ranges data + * structure. + * @trattr: Tracking Attributes indicates supported attributes for the Track + * Send command and Track Receive command. + * see &enum nvme_id_ctrl_trattr + * @rsvd577: Reserved + * @mcudmq: Maximum Controller User Data Migration Queues indicates the + * maximum number of User Data Migration Queues supported by the + * controller. + * @mnsudmq: Maximum NVM Subsystem User Data Migration Queues indicates the + * maximum number of User Data Migration Queues supported by the NVM + * subsystem. + * @mcmr: Maximum CDQ Memory Ranges indicates the maximum number of + * memory ranges allowed to be specified by the PRP1 field of a + * Controller Data Queue command. + * @nmcmr: NVM Subsystem Maximum CDQ Memory Ranges indicates the maximum + * number of memory ranges for all Controller Data Queues in the + * NVM subsystem. + * @mcdqpc: Maximum Controller Data Queue PRP Count indicates the maximum + * number of PRPs allowed to be specified in the PRP list in the + * Controller Data Queue command. + * @rsvd588: Reserved + * @subnqn: NVM Subsystem NVMe Qualified Name, UTF-8 null terminated string + * @rsvd1024: Reserved + * @ioccsz: I/O Queue Command Capsule Supported Size, defines the maximum + * I/O command capsule size in 16 byte units. + * @iorcsz: I/O Queue Response Capsule Supported Size, defines the maximum + * I/O response capsule size in 16 byte units. + * @icdoff: In Capsule Data Offset, defines the offset where data starts + * within a capsule. This value is applicable to I/O Queues only. + * @fcatt: Fabrics Controller Attributes, see &enum nvme_id_ctrl_fcatt. + * @msdbd: Maximum SGL Data Block Descriptors indicates the maximum + * number of SGL Data Block or Keyed SGL Data Block descriptors + * that a host is allowed to place in a capsule. A value of 0h + * indicates no limit. + * @ofcs: Optional Fabric Commands Support, see &enum nvme_id_ctrl_ofcs. + * @dctype: Discovery Controller Type (DCTYPE). This field indicates what + * type of Discovery controller the controller is (see enum + * nvme_id_ctrl_dctype) + * @ccrl: Cross-Controller Reset Limit: This field indicates the limit + * on the number of simultaneous in-progress Cross-Controller Reset + * operations this controller is able to cause to be initiated that + * are supported. + * @rsvd1808: Reserved + * @psd: Power State Descriptors, see &struct nvme_id_psd. + * @vs: Vendor Specific + */ +struct nvme_id_ctrl { + __le16 vid; + __le16 ssvid; + char sn[20]; + char mn[40]; + char fr[8]; + __u8 rab; + __u8 ieee[3]; + __u8 cmic; + __u8 mdts; + __le16 cntlid; + __le32 ver; + __le32 rtd3r; + __le32 rtd3e; + __le32 oaes; + __le32 ctratt; + __le16 rrls; + __u8 bpcap; + __u8 chsi; + __le32 nssl; + __u8 rsvd108[2]; + __u8 plsi; + __u8 cntrltype; + __u8 fguid[16]; + __le16 crdt1; + __le16 crdt2; + __le16 crdt3; + __u8 crcap; + __u8 ciu; + __u8 cirn[8]; + __u8 rsvd144[96]; + __u8 rsvd240[13]; + __u8 nvmsr; + __u8 vwci; + __u8 mec; + __le16 oacs; + __u8 acl; + __u8 aerl; + __u8 frmw; + __u8 lpa; + __u8 elpe; + __u8 npss; + __u8 avscc; + __u8 apsta; + __le16 wctemp; + __le16 cctemp; + __le16 mtfa; + __le32 hmpre; + __le32 hmmin; + __u8 tnvmcap[16]; + __u8 unvmcap[16]; + __le32 rpmbs; + __le16 edstt; + __u8 dsto; + __u8 fwug; + __le16 kas; + __le16 hctma; + __le16 mntmt; + __le16 mxtmt; + __le32 sanicap; + __le32 hmminds; + __le16 hmmaxd; + __le16 nsetidmax; + __le16 endgidmax; + __u8 anatt; + __u8 anacap; + __le32 anagrpmax; + __le32 nanagrpid; + __le32 pels; + __le16 domainid; + __u8 kpioc; + __u8 rsvd359; + __le16 mptfawr; + __u8 rmdca; + __u8 rsvd363[5]; + __u8 megcap[16]; + __u8 tmpthha; + __u8 mupa; + __le16 cqt; + __le16 cdpa; + __le16 mup; + __le16 ipmsr; + __le16 msmt; + __le16 mnens; + __le16 mnecpens; + __le32 mensnn; + __u8 ensa; + __u8 endsfs; + __le32 vsen1; + __le32 vsen2; + __le32 vsen3; + __le32 vsen4; + __le16 msvmt; + __u8 rsvd424[88]; + __u8 sqes; + __u8 cqes; + __le16 maxcmd; + __le32 nn; + __le16 oncs; + __le16 fuses; + __u8 fna; + __u8 vwc; + __le16 awun; + __le16 awupf; + __u8 icsvscc; + __u8 nwpc; + __le16 acwu; + __le16 cdfs; + __le32 sgls; + __le32 mnan; + __u8 maxdna[16]; + __le32 maxcna; + __le32 oaqd; + __u8 rhiri; + __u8 hirt; + __le16 cmmrtd; + __le16 nmmrtd; + __u8 minmrtg; + __u8 maxmrtg; + __u8 trattr; + __u8 rsvd577; + __le16 mcudmq; + __le16 mnsudmq; + __le16 mcmr; + __le16 nmcmr; + __le16 mcdqpc; + __u8 rsvd588[180]; + char subnqn[NVME_NQN_LENGTH]; + __u8 rsvd1024[768]; + + /* Fabrics Only */ + __le32 ioccsz; + __le32 iorcsz; + __le16 icdoff; + __u8 fcatt; + __u8 msdbd; + __le16 ofcs; + __u8 dctype; + __u8 ccrl; + __u8 rsvd1808[240]; + + struct nvme_id_psd psd[32]; + __u8 vs[1024]; +} __attribute__((packed)); + +/** + * enum nvme_cmic - This field indicates the controller multi-path I/O and NS + * sharing capabilities + * @NVME_CMIC_MULTI_PORT_SHIFT: Shift amount to get the NVM subsystem + * port + * @NVME_CMIC_MULTI_CTRL_SHIFT: Shift amount to get the controllers + * @NVME_CMIC_MULTI_SRIOV_SHIFT: Shift amount to get the SR-IOV virtual + * function + * @NVME_CMIC_MULTI_ANA_SHIFT: Shift amount to get the asymmetric + * namespace access reporting + * @NVME_CMIC_MULTI_RSVD_SHIFT: Shift amount to get the reserved + * @NVME_CMIC_MULTI_PORT_MASK: Mask to get the NVM subsystem port + * @NVME_CMIC_MULTI_CTRL_MASK: Mask to get the controllers + * @NVME_CMIC_MULTI_SRIOV_MASK: Mask to get the SR-IOV virtual function + * @NVME_CMIC_MULTI_ANA_MASK: Mask to get the asymmetric namespace + * access reporting + * @NVME_CMIC_MULTI_RSVD_MASK: Mask to get the reserved + */ +enum nvme_cmic { + NVME_CMIC_MULTI_PORT_SHIFT = 0, + NVME_CMIC_MULTI_CTRL_SHIFT = 1, + NVME_CMIC_MULTI_SRIOV_SHIFT = 2, + NVME_CMIC_MULTI_ANA_SHIFT = 3, + NVME_CMIC_MULTI_RSVD_SHIFT = 4, + NVME_CMIC_MULTI_PORT_MASK = 0x1, + NVME_CMIC_MULTI_CTRL_MASK = 0x1, + NVME_CMIC_MULTI_SRIOV_MASK = 0x1, + NVME_CMIC_MULTI_ANA_MASK = 0x1, + NVME_CMIC_MULTI_RSVD_MASK = 0xf, +}; + +#define NVME_CMIC_MULTI_PORT(cmic) NVME_GET(cmic, CMIC_MULTI_PORT) +#define NVME_CMIC_MULTI_CTRL(cmic) NVME_GET(cmic, CMIC_MULTI_CTRL) +#define NVME_CMIC_MULTI_SRIOV(cmic) NVME_GET(cmic, CMIC_MULTI_SRIOV) +#define NVME_CMIC_MULTI_ANA(cmic) NVME_GET(cmic, CMIC_MULTI_ANA) +#define NVME_CMIC_MULTI_RSVD(cmic) NVME_GET(cmic, CMIC_MULTI_RSVD) + +/** + * enum nvme_id_ctrl_cmic - Controller Multipath IO and Namespace Sharing + * Capabilities of the controller and NVM subsystem. + * @NVME_CTRL_CMIC_MULTI_PORT: If set, then the NVM subsystem may + * contain more than one NVM subsystem + * port, otherwise the NVM subsystem + * contains only a single NVM subsystem + * port. + * @NVME_CTRL_CMIC_MULTI_CTRL: If set, then the NVM subsystem may + * contain two or more controllers, + * otherwise the NVM subsystem contains + * only a single controller. An NVM + * subsystem that contains multiple + * controllers may be used by multiple + * hosts, or may provide multiple paths + * for a single host. + * @NVME_CTRL_CMIC_MULTI_SRIOV: If set, then the controller is + * associated with an SR-IOV Virtual + * Function, otherwise it is associated + * with a PCI Function or a Fabrics + * connection. + * @NVME_CTRL_CMIC_MULTI_ANA_REPORTING: If set, then the NVM subsystem supports + * Asymmetric Namespace Access Reporting. + */ +enum nvme_id_ctrl_cmic { + NVME_CTRL_CMIC_MULTI_PORT = 1 << 0, + NVME_CTRL_CMIC_MULTI_CTRL = 1 << 1, + NVME_CTRL_CMIC_MULTI_SRIOV = 1 << 2, + NVME_CTRL_CMIC_MULTI_ANA_REPORTING = 1 << 3, +}; + +/** + * enum nvme_id_ctrl_oaes - Optional Asynchronous Events Supported + * @NVME_CTRL_OAES_RSVD0_SHIFT: Shift amount to get Reserved + * @NVME_CTRL_OAES_NSAN_SHIFT: Shift amount to get the Attached Namespace + * Attribute Notices event supported bit + * @NVME_CTRL_OAES_FAN_SHIFT: Shift amount to get the Firmware Activation + * Notices event supported bit + * @NVME_CTRL_OAES_RSVD10_SHIFT:Shift amount to get Reserved + * @NVME_CTRL_OAES_ANACN_SHIFT: Shift amount to get the Asymmetric Namespace + * Access Change Notices event supported bit + * @NVME_CTRL_OAES_PLEAN_SHIFT: Shift amount to get the Predictable Latency + * Event Aggregate Log Change Notices event + * supported bit + * @NVME_CTRL_OAES_LSIAN_SHIFT: Shift amount to get the LBA Status Information + * Alert Notices event supported bit + * @NVME_CTRL_OAES_EGEAN_SHIFT: Shift amount to get the Endurance Group Event + * Aggregate Log Page Change Notices event + * supported bit + * @NVME_CTRL_OAES_NNSS_SHIFT: Shift amount to get the Normal NVM Subsystem + * Shutdown event supported bit + * @NVME_CTRL_OAES_TTHR_SHIFT: Shift amount to get the Temperature Threshold + * Hysteresis Recovery event supported bit + * @NVME_CTRL_OAES_RGCNS_SHIFT: Shift amount to get the Reachability Groups + * Change Notices event supported bit + * @NVME_CTRL_OAES_RSVD18_SHIFT:Shift amount to get Reserved + * @NVME_CTRL_OAES_ANSAN_SHIFT: Shift amount to get the Allocated Namespace + * Attribute Notices event supported bit + * @NVME_CTRL_OAES_CCRCN_SHIFT: Shift amount to get the Cross-Controller Reset + * Completed Notices event supported bit + * @NVME_CTRL_OAES_LHCN_SHIFT: Shift amount to get the Lost Host Communication + * Notices event supported bit + * @NVME_CTRL_OAES_RLCC_SHIFT: Shift amount to get the Rate Limiting + * Configuration Change event supported bit + * @NVME_CTRL_OAES_RSVD23_SHIFT:Shift amount to get Reserved + * @NVME_CTRL_OAES_ZDCN_SHIFT: Shift amount to get the Zone Descriptor Changed + * Notices event supported bit + * @NVME_CTRL_OAES_RSVD28_SHIFT:Shift amount to get Reserved + * @NVME_CTRL_OAES_DLPCN_SHIFT: Shift amount to get the Discovery Log Page + * Change Notification event supported bit + * @NVME_CTRL_OAES_RSVD0_MASK: Mask to get Reserved + * @NVME_CTRL_OAES_NSAN_MASK: Mask to get the Attached Namespace Attribute + * Notices event supported bit + * @NVME_CTRL_OAES_FAN_MASK: Mask to get the Firmware Activation Notices + * event supported bit + * @NVME_CTRL_OAES_RSVD10_MASK: Mask to get Reserved + * @NVME_CTRL_OAES_ANACN_MASK: Mask to get the Asymmetric Namespace Access + * Change Notices event supported bit + * @NVME_CTRL_OAES_PLEAN_MASK: Mask to get the Predictable Latency Event + * Aggregate Log Change Notices event supported bit + * @NVME_CTRL_OAES_LSIAN_MASK: Mask to get the LBA Status Information Alert + * Notices event supported bit + * @NVME_CTRL_OAES_EGEAN_MASK: Mask to get the Endurance Group Event Aggregate + * Log Page Change Notices event supported bit + * @NVME_CTRL_OAES_NNSS_MASK: Mask to get the Normal NVM Subsystem Shutdown + * event supported bit + * @NVME_CTRL_OAES_TTHR_MASK: Mask to get the Temperature Threshold Hysteresis + * Recovery event supported bit + * @NVME_CTRL_OAES_RGCNS_MASK: Mask to get the Reachability Groups Change + * Notices event supported bit + * @NVME_CTRL_OAES_RSVD18_MASK: Mask to get Reserved + * @NVME_CTRL_OAES_ANSAN_MASK: Mask to get the Allocated Namespace Attribute + * Notices event supported bit + * @NVME_CTRL_OAES_CCRCN_MASK: Mask to get the Cross-Controller Reset Completed + * Notices event supported bit + * @NVME_CTRL_OAES_LHCN_MASK: Mask to get the Lost Host Communication Notices + * event supported bit + * @NVME_CTRL_OAES_RLCC_MASK: Mask to get the Rate Limiting Configuration + * Change event supported bit + * @NVME_CTRL_OAES_RSVD23_MASK: Mask to get Reserved + * @NVME_CTRL_OAES_ZDCN_MASK: Mask to get the Zone Descriptor Changed Notices + * event supported bit + * @NVME_CTRL_OAES_RSVD28_MASK: Mask to get Reserved + * @NVME_CTRL_OAES_DLPCN_MASK: Mask to get the Discovery Log Page Change + * Notification event supported bit + * @NVME_CTRL_OAES_NSAN: If set, the controller supports the Attached + * Namespace Attribute Notices event. + * @NVME_CTRL_OAES_FAN: If set, the controller supports the Firmware + * Activation Notices event. + * @NVME_CTRL_OAES_ANACN: If set, the controller supports the Asymmetric + * Namespace Access Change Notices event. + * @NVME_CTRL_OAES_PLEAN: If set, the controller supports the Predictable + * Latency Event Aggregate Log Change Notices + * event. + * @NVME_CTRL_OAES_LSIAN: If set, the controller supports the LBA Status + * Information Alert Notices event. + * @NVME_CTRL_OAES_EGEAN: If set, the controller supports the Endurance + * Group Event Aggregate Log Page Change Notices + * event. + * @NVME_CTRL_OAES_NNSS: If set, the controller supports the Normal NVM + * Subsystem Shutdown event. + * @NVME_CTRL_OAES_TTHR: If set, the controller supports the Temperature + * Threshold Hysteresis Recovery event. + * @NVME_CTRL_OAES_RGCNS: If set, the controller supports the Reachability + * Groups Change Notices event. + * @NVME_CTRL_OAES_ANSAN: If set, the controller supports the Allocated + * Namespace Attribute Notices event. + * @NVME_CTRL_OAES_CCRCN: If set, the controller supports the + * Cross-Controller Reset Completed Notices event. + * @NVME_CTRL_OAES_LHCN: If set, the controller supports the Lost Host + * Communication Notices event. + * @NVME_CTRL_OAES_RLCC: If set, the controller supports the Rate + * Limiting Configuration Change event. + * @NVME_CTRL_OAES_ZDCN: If set, the controller supports the Zone + * Descriptor Changed Notices event. + * @NVME_CTRL_OAES_DLPCN: If set, the controller supports the Discovery + * Log Page Change Notification event. + */ +enum nvme_id_ctrl_oaes { + NVME_CTRL_OAES_RSVD0_SHIFT = 0, + NVME_CTRL_OAES_NSAN_SHIFT = 8, + NVME_CTRL_OAES_FAN_SHIFT = 9, + NVME_CTRL_OAES_RSVD10_SHIFT = 10, + NVME_CTRL_OAES_ANACN_SHIFT = 11, + NVME_CTRL_OAES_PLEAN_SHIFT = 12, + NVME_CTRL_OAES_LSIAN_SHIFT = 13, + NVME_CTRL_OAES_EGEAN_SHIFT = 14, + NVME_CTRL_OAES_NNSS_SHIFT = 15, + NVME_CTRL_OAES_TTHR_SHIFT = 16, + NVME_CTRL_OAES_RGCNS_SHIFT = 17, + NVME_CTRL_OAES_RSVD18_SHIFT = 18, + NVME_CTRL_OAES_ANSAN_SHIFT = 19, + NVME_CTRL_OAES_CCRCN_SHIFT = 20, + NVME_CTRL_OAES_LHCN_SHIFT = 21, + NVME_CTRL_OAES_RLCC_SHIFT = 22, + NVME_CTRL_OAES_RSVD23_SHIFT = 23, + NVME_CTRL_OAES_ZDCN_SHIFT = 27, + NVME_CTRL_OAES_RSVD28_SHIFT = 28, + NVME_CTRL_OAES_DLPCN_SHIFT = 31, + NVME_CTRL_OAES_RSVD0_MASK = 0xff, + NVME_CTRL_OAES_NSAN_MASK = 0x1, + NVME_CTRL_OAES_FAN_MASK = 0x1, + NVME_CTRL_OAES_RSVD10_MASK = 0x1, + NVME_CTRL_OAES_ANACN_MASK = 0x1, + NVME_CTRL_OAES_PLEAN_MASK = 0x1, + NVME_CTRL_OAES_LSIAN_MASK = 0x1, + NVME_CTRL_OAES_EGEAN_MASK = 0x1, + NVME_CTRL_OAES_NNSS_MASK = 0x1, + NVME_CTRL_OAES_TTHR_MASK = 0x1, + NVME_CTRL_OAES_RGCNS_MASK = 0x1, + NVME_CTRL_OAES_RSVD18_MASK = 0x1, + NVME_CTRL_OAES_ANSAN_MASK = 0x1, + NVME_CTRL_OAES_CCRCN_MASK = 0x1, + NVME_CTRL_OAES_LHCN_MASK = 0x1, + NVME_CTRL_OAES_RLCC_MASK = 0x1, + NVME_CTRL_OAES_RSVD23_MASK = 0xf, + NVME_CTRL_OAES_ZDCN_MASK = 0x1, + NVME_CTRL_OAES_RSVD28_MASK = 0x7, + NVME_CTRL_OAES_DLPCN_MASK = 0x1, + NVME_CTRL_OAES_NSAN = NVME_VAL(CTRL_OAES_NSAN), + NVME_CTRL_OAES_FAN = NVME_VAL(CTRL_OAES_FAN), + NVME_CTRL_OAES_ANACN = NVME_VAL(CTRL_OAES_ANACN), + NVME_CTRL_OAES_PLEAN = NVME_VAL(CTRL_OAES_PLEAN), + NVME_CTRL_OAES_LSIAN = NVME_VAL(CTRL_OAES_LSIAN), + NVME_CTRL_OAES_EGEAN = NVME_VAL(CTRL_OAES_EGEAN), + NVME_CTRL_OAES_NNSS = NVME_VAL(CTRL_OAES_NNSS), + NVME_CTRL_OAES_TTHR = NVME_VAL(CTRL_OAES_TTHR), + NVME_CTRL_OAES_RGCNS = NVME_VAL(CTRL_OAES_RGCNS), + NVME_CTRL_OAES_ANSAN = NVME_VAL(CTRL_OAES_ANSAN), + NVME_CTRL_OAES_CCRCN = NVME_VAL(CTRL_OAES_CCRCN), + NVME_CTRL_OAES_LHCN = NVME_VAL(CTRL_OAES_LHCN), + NVME_CTRL_OAES_RLCC = NVME_VAL(CTRL_OAES_RLCC), + NVME_CTRL_OAES_ZDCN = NVME_VAL(CTRL_OAES_ZDCN), + NVME_CTRL_OAES_DLPCN = NVME_VAL(CTRL_OAES_DLPCN), +}; + +#define NVME_CTRL_OAES_RSVD0(oaes) NVME_GET(oaes, CTRL_OAES_RSVD0) +#define NVME_CTRL_OAES_NSAN(oaes) NVME_GET(oaes, CTRL_OAES_NSAN) +#define NVME_CTRL_OAES_FAN(oaes) NVME_GET(oaes, CTRL_OAES_FAN) +#define NVME_CTRL_OAES_RSVD10(oaes) NVME_GET(oaes, CTRL_OAES_RSVD10) +#define NVME_CTRL_OAES_ANACN(oaes) NVME_GET(oaes, CTRL_OAES_ANACN) +#define NVME_CTRL_OAES_PLEAN(oaes) NVME_GET(oaes, CTRL_OAES_PLEAN) +#define NVME_CTRL_OAES_LSIAN(oaes) NVME_GET(oaes, CTRL_OAES_LSIAN) +#define NVME_CTRL_OAES_EGEAN(oaes) NVME_GET(oaes, CTRL_OAES_EGEAN) +#define NVME_CTRL_OAES_NNSS(oaes) NVME_GET(oaes, CTRL_OAES_NNSS) +#define NVME_CTRL_OAES_TTHR(oaes) NVME_GET(oaes, CTRL_OAES_TTHR) +#define NVME_CTRL_OAES_RGCNS(oaes) NVME_GET(oaes, CTRL_OAES_RGCNS) +#define NVME_CTRL_OAES_RSVD18(oaes) NVME_GET(oaes, CTRL_OAES_RSVD18) +#define NVME_CTRL_OAES_ANSAN(oaes) NVME_GET(oaes, CTRL_OAES_ANSAN) +#define NVME_CTRL_OAES_CCRCN(oaes) NVME_GET(oaes, CTRL_OAES_CCRCN) +#define NVME_CTRL_OAES_LHCN(oaes) NVME_GET(oaes, CTRL_OAES_LHCN) +#define NVME_CTRL_OAES_RLCC(oaes) NVME_GET(oaes, CTRL_OAES_RLCC) +#define NVME_CTRL_OAES_RSVD23(oaes) NVME_GET(oaes, CTRL_OAES_RSVD23) +#define NVME_CTRL_OAES_ZDCN(oaes) NVME_GET(oaes, CTRL_OAES_ZDCN) +#define NVME_CTRL_OAES_RSVD28(oaes) NVME_GET(oaes, CTRL_OAES_RSVD28) +#define NVME_CTRL_OAES_DLPCN(oaes) NVME_GET(oaes, CTRL_OAES_DLPCN) + +/** + * enum nvme_id_ctrl_ctratt - Controller attributes + * @NVME_CTRL_CTRATT_HIDS_SHIFT: HIDS shift + * @NVME_CTRL_CTRATT_NOPSPM_SHIFT: NOPSPM shift + * @NVME_CTRL_CTRATT_NSETS_SHIFT: NSETS shift + * @NVME_CTRL_CTRATT_RRLVLS_SHIFT: RRLVLS shift + * @NVME_CTRL_CTRATT_EGS_SHIFT: EGS shift + * @NVME_CTRL_CTRATT_PLM_SHIFT: PLM shift + * @NVME_CTRL_CTRATT_TBKAS_SHIFT: TBKAS shift + * @NVME_CTRL_CTRATT_NG_SHIFT: NG shift + * @NVME_CTRL_CTRATT_SQA_SHIFT: SQA shift + * @NVME_CTRL_CTRATT_ULIST_SHIFT: ULIST shift + * @NVME_CTRL_CTRATT_MDS_SHIFT: MDS shift + * @NVME_CTRL_CTRATT_FCM_SHIFT: FCM shift + * @NVME_CTRL_CTRATT_VCM_SHIFT: VCM shift + * @NVME_CTRL_CTRATT_DEG_SHIFT: DEG shift + * @NVME_CTRL_CTRATT_DNVMS_SHIFT: DNVMS shift + * @NVME_CTRL_CTRATT_ELBAS_SHIFT: ELBAS shift + * @NVME_CTRL_CTRATT_MEM_SHIFT: MEM shift + * @NVME_CTRL_CTRATT_HMBR_SHIFT: HMBR shift + * @NVME_CTRL_CTRATT_RHII_SHIFT: RHII shift + * @NVME_CTRL_CTRATT_FDPS_SHIFT: FDPS shift + * @NVME_CTRL_CTRATT_PLS_SHIFT: PLS shift + * @NVME_CTRL_CTRATT_PMS_SHIFT: PMS shift + * @NVME_CTRL_CTRATT_VMS_SHIFT: VMS shift + * @NVME_CTRL_CTRATT_IIELLSS_SHIFT: IIELLSS shift + * @NVME_CTRL_CTRATT_RSVD25_SHIFT: Reserved shift + * @NVME_CTRL_CTRATT_HIDS_MASK: HIDS mask + * @NVME_CTRL_CTRATT_NOPSPM_MASK: NOPSPM mask + * @NVME_CTRL_CTRATT_NSETS_MASK: NSETS mask + * @NVME_CTRL_CTRATT_RRLVLS_MASK: RRLVLS mask + * @NVME_CTRL_CTRATT_EGS_MASK: EGS mask + * @NVME_CTRL_CTRATT_PLM_MASK: PLM mask + * @NVME_CTRL_CTRATT_TBKAS_MASK: TBKAS mask + * @NVME_CTRL_CTRATT_NG_MASK: NG mask + * @NVME_CTRL_CTRATT_SQA_MASK: SQA mask + * @NVME_CTRL_CTRATT_ULIST_MASK: ULIST mask + * @NVME_CTRL_CTRATT_MDS_MASK: MDS mask + * @NVME_CTRL_CTRATT_FCM_MASK: FCM mask + * @NVME_CTRL_CTRATT_VCM_MASK: VCM mask + * @NVME_CTRL_CTRATT_DEG_MASK: DEG mask + * @NVME_CTRL_CTRATT_DNVMS_MASK: DNVMS mask + * @NVME_CTRL_CTRATT_ELBAS_MASK: ELBAS mask + * @NVME_CTRL_CTRATT_MEM_MASK: MEM mask + * @NVME_CTRL_CTRATT_HMBR_MASK: HMBR mask + * @NVME_CTRL_CTRATT_RHII_MASK: RHII mask + * @NVME_CTRL_CTRATT_FDPS_MASK: FDPS mask + * @NVME_CTRL_CTRATT_PLS_MASK: PLS mask + * @NVME_CTRL_CTRATT_PMS_MASK: PMS mask + * @NVME_CTRL_CTRATT_VMS_MASK: VMS mask + * @NVME_CTRL_CTRATT_IIELLSS_MASK: IIELLSS mask + * @NVME_CTRL_CTRATT_RSVD25_MASK: Reserved mask + * @NVME_CTRL_CTRATT_128_ID: 128-bit Host Identifier supported + * @NVME_CTRL_CTRATT_NON_OP_PSP: Non-Operational Poser State Permissive Mode + * supported + * @NVME_CTRL_CTRATT_NVM_SETS: NVM Sets supported + * @NVME_CTRL_CTRATT_READ_RECV_LVLS: Read Recovery Levels supported + * @NVME_CTRL_CTRATT_ENDURANCE_GROUPS: Endurance Groups supported + * @NVME_CTRL_CTRATT_PREDICTABLE_LAT: Predictable Latency Mode supported + * @NVME_CTRL_CTRATT_TBKAS: Traffic Based Keep Alive Support + * @NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY: Namespace Granularity reporting + * supported + * @NVME_CTRL_CTRATT_SQ_ASSOCIATIONS: SQ Associations supported + * @NVME_CTRL_CTRATT_UUID_LIST: UUID List reporting supported + * @NVME_CTRL_CTRATT_MDS: Multi-Domain Subsystem supported + * @NVME_CTRL_CTRATT_FIXED_CAP: Fixed Capacity Management supported + * @NVME_CTRL_CTRATT_VARIABLE_CAP: Variable Capacity Management supported + * @NVME_CTRL_CTRATT_DEL_ENDURANCE_GROUPS: Delete Endurance Groups supported + * @NVME_CTRL_CTRATT_DEL_NVM_SETS: Delete NVM Sets supported + * @NVME_CTRL_CTRATT_ELBAS: Extended LBA Formats supported + * @NVME_CTRL_CTRATT_MEM: MDTS and Size Limits Exclude Metadata supported + * @NVME_CTRL_CTRATT_HMBR: HMB Restrict Non-Operational Power State Access + * @NVME_CTRL_CTRATT_RHII: Reservations and Host Identifier Interaction + * @NVME_CTRL_CTRATT_FDPS: Flexible Data Placement supported + * @NVME_CTRL_CTRATT_PLS: Power Limit Support + * @NVME_CTRL_CTRATT_PMS: Power Measurement Support + * @NVME_CTRL_CTRATT_VMS: Voltage Measurement Support + * @NVME_CTRL_CTRATT_IIELLSS: Idle I/O Exit Latency Limit Support and Scope + * @NVME_CTRL_CTRATT_IIELLSS_POWER_STATE: Each operational power state scope + * @NVME_CTRL_CTRATT_IIELLSS_GLOBAL: All operational power states scope + */ +enum nvme_id_ctrl_ctratt { + NVME_CTRL_CTRATT_HIDS_SHIFT = 0, + NVME_CTRL_CTRATT_NOPSPM_SHIFT = 1, + NVME_CTRL_CTRATT_NSETS_SHIFT = 2, + NVME_CTRL_CTRATT_RRLVLS_SHIFT = 3, + NVME_CTRL_CTRATT_EGS_SHIFT = 4, + NVME_CTRL_CTRATT_PLM_SHIFT = 5, + NVME_CTRL_CTRATT_TBKAS_SHIFT = 6, + NVME_CTRL_CTRATT_NG_SHIFT = 7, + NVME_CTRL_CTRATT_SQA_SHIFT = 8, + NVME_CTRL_CTRATT_ULIST_SHIFT = 9, + NVME_CTRL_CTRATT_MDS_SHIFT = 10, + NVME_CTRL_CTRATT_FCM_SHIFT = 11, + NVME_CTRL_CTRATT_VCM_SHIFT = 12, + NVME_CTRL_CTRATT_DEG_SHIFT = 13, + NVME_CTRL_CTRATT_DNVMS_SHIFT = 14, + NVME_CTRL_CTRATT_ELBAS_SHIFT = 15, + NVME_CTRL_CTRATT_MEM_SHIFT = 16, + NVME_CTRL_CTRATT_HMBR_SHIFT = 17, + NVME_CTRL_CTRATT_RHII_SHIFT = 18, + NVME_CTRL_CTRATT_FDPS_SHIFT = 19, + NVME_CTRL_CTRATT_PLS_SHIFT = 20, + NVME_CTRL_CTRATT_PMS_SHIFT = 21, + NVME_CTRL_CTRATT_VMS_SHIFT = 22, + NVME_CTRL_CTRATT_IIELLSS_SHIFT = 23, + NVME_CTRL_CTRATT_RSVD25_SHIFT = 25, + NVME_CTRL_CTRATT_HIDS_MASK = 0x1, + NVME_CTRL_CTRATT_NOPSPM_MASK = 0x1, + NVME_CTRL_CTRATT_NSETS_MASK = 0x1, + NVME_CTRL_CTRATT_RRLVLS_MASK = 0x1, + NVME_CTRL_CTRATT_EGS_MASK = 0x1, + NVME_CTRL_CTRATT_PLM_MASK = 0x1, + NVME_CTRL_CTRATT_TBKAS_MASK = 0x1, + NVME_CTRL_CTRATT_NG_MASK = 0x1, + NVME_CTRL_CTRATT_SQA_MASK = 0x1, + NVME_CTRL_CTRATT_ULIST_MASK = 0x1, + NVME_CTRL_CTRATT_MDS_MASK = 0x1, + NVME_CTRL_CTRATT_FCM_MASK = 0x1, + NVME_CTRL_CTRATT_VCM_MASK = 0x1, + NVME_CTRL_CTRATT_DEG_MASK = 0x1, + NVME_CTRL_CTRATT_DNVMS_MASK = 0x1, + NVME_CTRL_CTRATT_ELBAS_MASK = 0x1, + NVME_CTRL_CTRATT_MEM_MASK = 0x1, + NVME_CTRL_CTRATT_HMBR_MASK = 0x1, + NVME_CTRL_CTRATT_RHII_MASK = 0x1, + NVME_CTRL_CTRATT_FDPS_MASK = 0x1, + NVME_CTRL_CTRATT_PLS_MASK = 0x1, + NVME_CTRL_CTRATT_PMS_MASK = 0x1, + NVME_CTRL_CTRATT_VMS_MASK = 0x1, + NVME_CTRL_CTRATT_IIELLSS_MASK = 0x3, + NVME_CTRL_CTRATT_RSVD25_MASK = 0x7f, + NVME_CTRL_CTRATT_128_ID = NVME_VAL(CTRL_CTRATT_HIDS), + NVME_CTRL_CTRATT_NON_OP_PSP = NVME_VAL(CTRL_CTRATT_NOPSPM), + NVME_CTRL_CTRATT_NVM_SETS = NVME_VAL(CTRL_CTRATT_NSETS), + NVME_CTRL_CTRATT_READ_RECV_LVLS = NVME_VAL(CTRL_CTRATT_RRLVLS), + NVME_CTRL_CTRATT_ENDURANCE_GROUPS = NVME_VAL(CTRL_CTRATT_EGS), + NVME_CTRL_CTRATT_PREDICTABLE_LAT = NVME_VAL(CTRL_CTRATT_PLM), + NVME_CTRL_CTRATT_TBKAS = NVME_VAL(CTRL_CTRATT_TBKAS), + NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY = NVME_VAL(CTRL_CTRATT_NG), + NVME_CTRL_CTRATT_SQ_ASSOCIATIONS = NVME_VAL(CTRL_CTRATT_SQA), + NVME_CTRL_CTRATT_UUID_LIST = NVME_VAL(CTRL_CTRATT_ULIST), + NVME_CTRL_CTRATT_MDS = NVME_VAL(CTRL_CTRATT_MDS), + NVME_CTRL_CTRATT_FIXED_CAP = NVME_VAL(CTRL_CTRATT_FCM), + NVME_CTRL_CTRATT_VARIABLE_CAP = NVME_VAL(CTRL_CTRATT_VCM), + NVME_CTRL_CTRATT_DEL_ENDURANCE_GROUPS = NVME_VAL(CTRL_CTRATT_DEG), + NVME_CTRL_CTRATT_DEL_NVM_SETS = NVME_VAL(CTRL_CTRATT_DNVMS), + NVME_CTRL_CTRATT_ELBAS = NVME_VAL(CTRL_CTRATT_ELBAS), + NVME_CTRL_CTRATT_MEM = NVME_VAL(CTRL_CTRATT_MEM), + NVME_CTRL_CTRATT_HMBR = NVME_VAL(CTRL_CTRATT_HMBR), + NVME_CTRL_CTRATT_RHII = NVME_VAL(CTRL_CTRATT_RHII), + NVME_CTRL_CTRATT_FDPS = NVME_VAL(CTRL_CTRATT_FDPS), + NVME_CTRL_CTRATT_PLS = NVME_VAL(CTRL_CTRATT_PLS), + NVME_CTRL_CTRATT_PMS = NVME_VAL(CTRL_CTRATT_PMS), + NVME_CTRL_CTRATT_VMS = NVME_VAL(CTRL_CTRATT_VMS), + NVME_CTRL_CTRATT_IIELLSS = NVME_VAL(CTRL_CTRATT_IIELLSS), + NVME_CTRL_CTRATT_IIELLSS_POWER_STATE = 1, + NVME_CTRL_CTRATT_IIELLSS_GLOBAL = 2, +}; + +#define NVME_CTRL_CTRATT_HIDS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_HIDS) +#define NVME_CTRL_CTRATT_NOPSPM(ctratt) NVME_GET(ctratt, CTRL_CTRATT_NOPSPM) +#define NVME_CTRL_CTRATT_NSETS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_NSETS) +#define NVME_CTRL_CTRATT_RRLVLS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_RRLVLS) +#define NVME_CTRL_CTRATT_EGS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_EGS) +#define NVME_CTRL_CTRATT_PLM(ctratt) NVME_GET(ctratt, CTRL_CTRATT_PLM) +#define NVME_CTRL_CTRATT_TBKAS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_TBKAS) +#define NVME_CTRL_CTRATT_NG(ctratt) NVME_GET(ctratt, CTRL_CTRATT_NG) +#define NVME_CTRL_CTRATT_SQA(ctratt) NVME_GET(ctratt, CTRL_CTRATT_SQA) +#define NVME_CTRL_CTRATT_ULIST(ctratt) NVME_GET(ctratt, CTRL_CTRATT_ULIST) +#define NVME_CTRL_CTRATT_MDS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_MDS) +#define NVME_CTRL_CTRATT_FCM(ctratt) NVME_GET(ctratt, CTRL_CTRATT_FCM) +#define NVME_CTRL_CTRATT_VCM(ctratt) NVME_GET(ctratt, CTRL_CTRATT_VCM) +#define NVME_CTRL_CTRATT_DEG(ctratt) NVME_GET(ctratt, CTRL_CTRATT_DEG) +#define NVME_CTRL_CTRATT_DNVMS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_DNVMS) +#define NVME_CTRL_CTRATT_ELBAS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_ELBAS) +#define NVME_CTRL_CTRATT_MEM(ctratt) NVME_GET(ctratt, CTRL_CTRATT_MEM) +#define NVME_CTRL_CTRATT_HMBR(ctratt) NVME_GET(ctratt, CTRL_CTRATT_HMBR) +#define NVME_CTRL_CTRATT_RHII(ctratt) NVME_GET(ctratt, CTRL_CTRATT_RHII) +#define NVME_CTRL_CTRATT_FDPS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_FDPS) +#define NVME_CTRL_CTRATT_PLS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_PLS) +#define NVME_CTRL_CTRATT_PMS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_PMS) +#define NVME_CTRL_CTRATT_VMS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_VMS) +#define NVME_CTRL_CTRATT_IIELLSS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_IIELLSS) +#define NVME_CTRL_CTRATT_RSVD25(ctratt) NVME_GET(ctratt, CTRL_CTRATT_RSVD25) + +/** + * enum nvme_id_ctrl_bpcap - Boot Partition Capabilities + * @NVME_CTRL_BPCAP_RPMBBPWPS_SHIFT: Shift amount to get the RPMB + * Boot Partition Write Protection + * Support from the &struct + * nvme_id_ctrl.bpcap field. + * @NVME_CTRL_BPCAP_SFBPWPS_SHIFT: Shift amount to get the Set + * Features Boot Partition Write + * Protection Support from the + * &struct nvme_id_ctrl.bpcap + * field. + * @NVME_CTRL_BPCAP_RSVD3_SHIFT: Shift amount to get the Reserved + * @NVME_CTRL_BPCAP_RPMBBPWPS_MASK: Mask to get the RPMB Boot + * Partition Write Protection + * Support from the &struct + * nvme_id_ctrl.bpcap field. + * @NVME_CTRL_BPCAP_SFBPWPS_MASK: Mask to get the Set Features + * Boot Partition Write Protection + * Support from the &struct + * nvme_id_ctrl.bpcap field. + * @NVME_CTRL_BPCAP_RSVD3_MASK: Mask to get the Reserved + * @NVME_CTRL_BPCAP_RPMBBPWPS_NOT_SPECIFIED: Support for RPMB Boot Partition + * Write Protection is not + * specified. + * @NVME_CTRL_BPCAP_RPMBBPWPS_NOT_SUPPORTED: RPMB Boot Partition Write + * Protection is not supported by + * this controller. + * @NVME_CTRL_BPCAP_RPMBBPWPS_SUPPORTED: RPMB Boot Partition Write + * Protection is supported by this + * controller. + */ +enum nvme_id_ctrl_bpcap { + NVME_CTRL_BPCAP_RPMBBPWPS_SHIFT = 0, + NVME_CTRL_BPCAP_SFBPWPS_SHIFT = 2, + NVME_CTRL_BPCAP_RSVD3_SHIFT = 3, + NVME_CTRL_BPCAP_RPMBBPWPS_MASK = 0x3, + NVME_CTRL_BPCAP_SFBPWPS_MASK = 0x1, + NVME_CTRL_BPCAP_RSVD3_MASK = 0x1f, + NVME_CTRL_BPCAP_RPMBBPWPS_NOT_SPECIFIED = 0, + NVME_CTRL_BPCAP_RPMBBPWPS_NOT_SUPPORTED = 1, + NVME_CTRL_BPCAP_RPMBBPWPS_SUPPORTED = 2, +}; + +#define NVME_CTRL_BPCAP_RPMBBPWPS(bpcap) NVME_GET(bpcap, CTRL_BPCAP_RPMBBPWPS) +#define NVME_CTRL_BPCAP_SFBPWPS(bpcap) NVME_GET(bpcap, CTRL_BPCAP_SFBPWPS) +#define NVME_CTRL_BPCAP_RSVD3(bpcap) NVME_GET(bpcap, CTRL_BPCAP_RSVD3) + +/** + * enum nvme_id_ctrl_chsi - CXL HDM Support Information + * @NVME_CTRL_CHSI_CHS_SHIFT: Shift amount to get the CXL HDM Support (CHS) + * from the &struct nvme_id_ctrl.chsi field. + * @NVME_CTRL_CHSI_RSVD1_SHIFT: Shift amount to get the Reserved + * @NVME_CTRL_CHSI_CHS_MASK: Mask to get CHS + * @NVME_CTRL_CHSI_RSVD1_MASK: Mask to get Reserved + */ +enum nvme_id_ctrl_chsi { + NVME_CTRL_CHSI_CHS_SHIFT = 0, + NVME_CTRL_CHSI_RSVD1_SHIFT = 1, + NVME_CTRL_CHSI_CHS_MASK = 0x1, + NVME_CTRL_CHSI_RSVD1_MASK = 0x7f, +}; + +#define NVME_CTRL_CHSI_CHS(chsi) NVME_GET(chsi, CTRL_CHSI_CHS) +#define NVME_CTRL_CHSI_RSVD1(chsi) NVME_GET(chsi, CTRL_CHSI_RSVD1) + +/** + * enum nvme_id_ctrl_rmdca - Restore Manufacturing Configuration Attributes + * @NVME_CTRL_RMDCA_RDSCS_SHIFT: Shift amount to get the Restore Default + * NVM Subsystem Configuration Supported + * (RDSCS) from the &struct + * nvme_id_ctrl.rmdca field. + * @NVME_CTRL_RMDCA_RDSCS_MASK: Mask to get RDSCS + * @NVME_CTRL_RMDCA_RDNCS_SHIFT: Shift amount to get the Restore Default + * Namespace Configuration Supported + * (RDNCS) + * @NVME_CTRL_RMDCA_RDNCS_MASK: Mask to get RDNCS + * @NVME_CTRL_RMDCA_RDCCS_SHIFT: Shift amount to get the Restore Default + * Capacity Management Configuration + * Supported (RDCCS) + * @NVME_CTRL_RMDCA_RDCCS_MASK: Mask to get RDCCS + * @NVME_CTRL_RMDCA_RSVD3_SHIFT: Shift amount to get the Reserved + * @NVME_CTRL_RMDCA_RSVD3_MASK: Mask to get Reserved + */ +enum nvme_id_ctrl_rmdca { + NVME_CTRL_RMDCA_RDSCS_SHIFT = 0, + NVME_CTRL_RMDCA_RDSCS_MASK = 0x1, + NVME_CTRL_RMDCA_RDNCS_SHIFT = 1, + NVME_CTRL_RMDCA_RDNCS_MASK = 0x1, + NVME_CTRL_RMDCA_RDCCS_SHIFT = 2, + NVME_CTRL_RMDCA_RDCCS_MASK = 0x1, + NVME_CTRL_RMDCA_RSVD3_SHIFT = 3, + NVME_CTRL_RMDCA_RSVD3_MASK = 0x1fff, +}; + +#define NVME_CTRL_RMDCA_RDSCS(rmdca) NVME_GET(rmdca, CTRL_RMDCA_RDSCS) +#define NVME_CTRL_RMDCA_RDNCS(rmdca) NVME_GET(rmdca, CTRL_RMDCA_RDNCS) +#define NVME_CTRL_RMDCA_RDCCS(rmdca) NVME_GET(rmdca, CTRL_RMDCA_RDCCS) +#define NVME_CTRL_RMDCA_RSVD3(rmdca) NVME_GET(rmdca, CTRL_RMDCA_RSVD3) + +/** + * enum nvme_id_ctrl_plsi - Power Loss Signaling Information + * @NVME_CTRL_PLSI_PLSEPF_SHIFT: Shift amount to get the PLS Emergency + * Power Fail from the + * &struct nvme_id_ctrl.plsi field. + * @NVME_CTRL_PLSI_PLSFQ_SHIFT: Shift amount to get the PLS Forced + * Quiescence from the + * &struct nvme_id_ctrl.plsi field. + * @NVME_CTRL_PLSI_RSVD2_SHIFT: Shift amount to get the Reserved + * @NVME_CTRL_PLSI_PLSEPF_MASK: Mask to get the PLS Emergency Power Fail + * from the &struct nvme_id_ctrl.plsi + * field. + * @NVME_CTRL_PLSI_PLSFQ_MASK: Mask to get the PLS Forced Quiescence + * from the &struct nvme_id_ctrl.plsi + * field. + * @NVME_CTRL_PLSI_RSVD2_MASK: Mask to get the Reserved + */ +enum nvme_id_ctrl_plsi { + NVME_CTRL_PLSI_PLSEPF_SHIFT = 0, + NVME_CTRL_PLSI_PLSFQ_SHIFT = 1, + NVME_CTRL_PLSI_RSVD2_SHIFT = 2, + NVME_CTRL_PLSI_PLSEPF_MASK = 0x1, + NVME_CTRL_PLSI_PLSFQ_MASK = 0x1, + NVME_CTRL_PLSI_RSVD2_MASK = 0x3f, +}; + +#define NVME_CTRL_PLSI_PLSEPF(plsi) NVME_GET(plsi, CTRL_PLSI_PLSEPF) +#define NVME_CTRL_PLSI_PLSFQ(plsi) NVME_GET(plsi, CTRL_PLSI_PLSFQ) +#define NVME_CTRL_PLSI_RSVD2(plsi) NVME_GET(plsi, CTRL_PLSI_RSVD2) + +/** + * enum nvme_id_ctrl_crcap - Power Loss Signaling Information + * @NVME_CTRL_CRCAP_RRSUP_SHIFT: Shift amount to get the Reachability + * Reporting Supported from the + * &struct nvme_id_ctrl.crcap field. + * @NVME_CTRL_CRCAP_RGIDC_SHIFT: Shift amount to get the Reachability + * Group ID Changeable from the + * &struct nvme_id_ctrl.crcap field. + * @NVME_CTRL_CRCAP_RSVD2_SHIFT: Shift amount to get the Reserved + * @NVME_CTRL_CRCAP_RRSUP_MASK: Mask to get the Reachability Reporting + * Supported from the + * &struct nvme_id_ctrl.crcap field. + * @NVME_CTRL_CRCAP_RGIDC_MASK: Mask to get the Reachability Group ID + * Changeable from the + * &struct nvme_id_ctrl.crcap field. + * @NVME_CTRL_CRCAP_RSVD2_MASK: Mask to get the Reserved + */ +enum nvme_id_ctrl_crcap { + NVME_CTRL_CRCAP_RRSUP_SHIFT = 0, + NVME_CTRL_CRCAP_RGIDC_SHIFT = 1, + NVME_CTRL_CRCAP_RSVD2_SHIFT = 2, + NVME_CTRL_CRCAP_RRSUP_MASK = 0x1, + NVME_CTRL_CRCAP_RGIDC_MASK = 0x1, + NVME_CTRL_CRCAP_RSVD2_MASK = 0x3f, +}; + +#define NVME_CTRL_CRCAP_RRSUP(crcap) NVME_GET(crcap, CTRL_CRCAP_RRSUP) +#define NVME_CTRL_CRCAP_RGIDC(crcap) NVME_GET(crcap, CTRL_CRCAP_RGIDC) +#define NVME_CTRL_CRCAP_RSVD2(crcap) NVME_GET(crcap, CTRL_CRCAP_RSVD2) + +/** + * enum nvme_id_ctrl_cntrltype - Controller types + * @NVME_CTRL_CNTRLTYPE_IO: NVM I/O controller + * @NVME_CTRL_CNTRLTYPE_DISCOVERY: Discovery controller + * @NVME_CTRL_CNTRLTYPE_ADMIN: Admin controller + */ +enum nvme_id_ctrl_cntrltype { + NVME_CTRL_CNTRLTYPE_IO = 1, + NVME_CTRL_CNTRLTYPE_DISCOVERY = 2, + NVME_CTRL_CNTRLTYPE_ADMIN = 3, +}; + +/** + * enum nvme_id_ctrl_dctype - Discovery Controller types + * @NVME_CTRL_DCTYPE_NOT_REPORTED: Not reported (I/O, Admin, and pre-TP8010) + * @NVME_CTRL_DCTYPE_DDC: Direct Discovery controller + * @NVME_CTRL_DCTYPE_CDC: Central Discovery controller + */ +enum nvme_id_ctrl_dctype { + NVME_CTRL_DCTYPE_NOT_REPORTED = 0, + NVME_CTRL_DCTYPE_DDC = 1, + NVME_CTRL_DCTYPE_CDC = 2, +}; + +/** + * enum nvme_id_ctrl_nvmsr - This field reports information associated with the + * NVM Subsystem, see &struct nvme_id_ctrl.nvmsr. + * @NVME_CTRL_NVMSR_NVMESD_SHIFT: NVMESD shift + * @NVME_CTRL_NVMSR_NVMEE_SHIFT: NVMEE shift + * @NVME_CTRL_NVMSR_RSVD2_SHIFT: Reserved shift + * @NVME_CTRL_NVMSR_NVMESD_MASK: NVMESD mask + * @NVME_CTRL_NVMSR_NVMEE_MASK: NVMEE mask + * @NVME_CTRL_NVMSR_RSVD2_MASK: Reserved mask + * @NVME_CTRL_NVMSR_NVMESD: If set, then the NVM Subsystem is part of an NVMe + * Storage Device; if cleared, then the NVM Subsystem + * is not part of an NVMe Storage Device. + * @NVME_CTRL_NVMSR_NVMEE: If set, then the NVM Subsystem is part of an NVMe + * Enclosure; if cleared, then the NVM Subsystem is + * not part of an NVMe Enclosure. + */ +enum nvme_id_ctrl_nvmsr { + NVME_CTRL_NVMSR_NVMESD_SHIFT = 0, + NVME_CTRL_NVMSR_NVMEE_SHIFT = 1, + NVME_CTRL_NVMSR_RSVD2_SHIFT = 2, + NVME_CTRL_NVMSR_NVMESD_MASK = 0x1, + NVME_CTRL_NVMSR_NVMEE_MASK = 0x1, + NVME_CTRL_NVMSR_RSVD2_MASK = 0x3f, + NVME_CTRL_NVMSR_NVMESD = NVME_VAL(CTRL_NVMSR_NVMESD), + NVME_CTRL_NVMSR_NVMEE = NVME_VAL(CTRL_NVMSR_NVMEE), +}; + +#define NVME_CTRL_NVMSR_NVMESD(nvmsr) NVME_GET(nvmsr, CTRL_NVMSR_NVMESD) +#define NVME_CTRL_NVMSR_NVMEE(nvmsr) NVME_GET(nvmsr, CTRL_NVMSR_NVMEE) +#define NVME_CTRL_NVMSR_RSVD2(nvmsr) NVME_GET(nvmsr, CTRL_NVMSR_RSVD2) + +/** + * enum nvme_id_ctrl_vwci - This field indicates information about remaining + * number of times that VPD contents are able to be + * updated using the VPD Write command, see &struct + * nvme_id_ctrl.vwci. + * @NVME_CTRL_VWCI_VWCR_SHIFT: VWCR shift + * @NVME_CTRL_VWCI_VWCRV_SHIFT: VWCRV shift + * @NVME_CTRL_VWCI_VWCR_MASK: VWCR mask + * @NVME_CTRL_VWCI_VWCRV_MASK: VWCRV mask + * @NVME_CTRL_VWCI_VWCR: Mask to get value of VPD Write Cycles Remaining. If + * the VPD Write Cycle Remaining Valid bit is set, then + * this field contains a value indicating the remaining + * number of times that VPD contents are able to be + * updated using the VPD Write command. If this field is + * set to 7Fh, then the remaining number of times that + * VPD contents are able to be updated using the VPD + * Write command is greater than or equal to 7Fh. + * @NVME_CTRL_VWCI_VWCRV: VPD Write Cycle Remaining Valid. If this bit is set, + * then the VPD Write Cycle Remaining field is valid. If + * this bit is cleared, then the VPD Write Cycles + * Remaining field is invalid and cleared to 0h. + */ +enum nvme_id_ctrl_vwci { + NVME_CTRL_VWCI_VWCR_SHIFT = 0, + NVME_CTRL_VWCI_VWCRV_SHIFT = 7, + NVME_CTRL_VWCI_VWCR_MASK = 0x7f, + NVME_CTRL_VWCI_VWCRV_MASK = 0x1, + NVME_CTRL_VWCI_VWCR = NVME_VAL(CTRL_VWCI_VWCR), + NVME_CTRL_VWCI_VWCRV = NVME_VAL(CTRL_VWCI_VWCRV), +}; + +#define NVME_CTRL_VWCI_VWCR(vwci) NVME_GET(vwci, CTRL_VWCI_VWCR) +#define NVME_CTRL_VWCI_VWCRV(vwci) NVME_GET(vwci, CTRL_VWCI_VWCRV) + +/** + * enum nvme_id_ctrl_mec - Flags indicating the capabilities of the Management + * Endpoint in the Controller, &struct nvme_id_ctrl.mec. + * @NVME_CTRL_MEC_TWPME_SHIFT: TWPME shift + * @NVME_CTRL_MEC_PCIEME_SHIFT: PCIEME shift + * @NVME_CTRL_MEC_RSVD2_SHIFT: Reserved shift + * @NVME_CTRL_MEC_TWPME_MASK: TWPME mask + * @NVME_CTRL_MEC_PCIEME_MASK: PCIEME mask + * @NVME_CTRL_MEC_RSVD2_MASK: Reserved mask + * @NVME_CTRL_MEC_TWPME: If set, then the NVM Subsystem contains one or more + * Management Endpoints on the 2-Wire port. + * @NVME_CTRL_MEC_PCIEME: If set, then the NVM Subsystem contains one or more + * Management Endpoints on one or more PCIe ports. + */ +enum nvme_id_ctrl_mec { + NVME_CTRL_MEC_TWPME_SHIFT = 0, + NVME_CTRL_MEC_PCIEME_SHIFT = 1, + NVME_CTRL_MEC_RSVD2_SHIFT = 2, + NVME_CTRL_MEC_TWPME_MASK = 0x1, + NVME_CTRL_MEC_PCIEME_MASK = 0x1, + NVME_CTRL_MEC_RSVD2_MASK = 0x3f, + NVME_CTRL_MEC_TWPME = NVME_VAL(CTRL_MEC_TWPME), + NVME_CTRL_MEC_PCIEME = NVME_VAL(CTRL_MEC_PCIEME), +}; + +#define NVME_CTRL_MEC_TWPME(mec) NVME_GET(mec, CTRL_MEC_TWPME) +#define NVME_CTRL_MEC_PCIEME(mec) NVME_GET(mec, CTRL_MEC_PCIEME) +#define NVME_CTRL_MEC_RSVD2(mec) NVME_GET(mec, CTRL_MEC_RSVD2) + +/** + * enum nvme_id_ctrl_oacs - Flags indicating the optional Admin commands and + * features supported by the controller, see + * &struct nvme_id_ctrl.oacs. + * @NVME_CTRL_OACS_SSRS_SHIFT: Shift amount to get the Security Send Receive + * supported + * @NVME_CTRL_OACS_FNVMS_SHIFT:Shift amount to get the Format NVM supported + * @NVME_CTRL_OACS_FWDS_SHIFT: Shift amount to get the Firmware Download + * supported + * @NVME_CTRL_OACS_NMS_SHIFT: Shift amount to get the Namespace Management + * supported + * @NVME_CTRL_OACS_DSTS_SHIFT: Shift amount to get the Device Self-test + * supported + * @NVME_CTRL_OACS_DIRS_SHIFT: Shift amount to get the Directives supported + * @NVME_CTRL_OACS_NSRS_SHIFT: Shift amount to get the NVMe-MI Send Receive + * supported + * @NVME_CTRL_OACS_VMS_SHIFT: Shift amount to get the Virtualization Management + * supported + * @NVME_CTRL_OACS_DBCS_SHIFT: Shift amount to get the Doorbell Buffer Config + * supported + * @NVME_CTRL_OACS_GLSS_SHIFT: Shift amount to get the Get LBA Status supported + * @NVME_CTRL_OACS_CFLS_SHIFT: Shift amount to get the Command and Feature + * Lockdown supported + * @NVME_CTRL_OACS_HMLMS_SHIFT:Shift amount to get the Host Managed Live + * Migration support + * @NVME_CTRL_OACS_ENSS_SHIFT: Shift amount to get the Exported NVM Subsystem + * Support + * @NVME_CTRL_OACS_CCFLS_SHIFT: Shift amount to get the Controller-scoped + * Command and Feature Lockdown supported + * @NVME_CTRL_OACS_RSVD14_SHIFT:Shift amount to get the Reserved + * @NVME_CTRL_OACS_SSRS_MASK: Mask to get the Security Send Receive supported + * @NVME_CTRL_OACS_FNVMS_MASK: Mask to get the Format NVM supported + * @NVME_CTRL_OACS_FWDS_MASK: Mask to get the Firmware Download supported + * @NVME_CTRL_OACS_NMS_MASK: Mask to get the Namespace Management supported + * @NVME_CTRL_OACS_DSTS_MASK: Mask to get the Device Self-test supported + * @NVME_CTRL_OACS_DIRS_MASK: Mask to get the Directives supported + * @NVME_CTRL_OACS_NSRS_MASK: Mask to get the NVMe-MI Send Receive supported + * @NVME_CTRL_OACS_VMS_MASK: Mask to get the Virtualization Management + * supported + * @NVME_CTRL_OACS_DBCS_MASK: Mask to get the Doorbell Buffer Config supported + * @NVME_CTRL_OACS_GLSS_MASK: Mask to get the Get LBA Status supported + * @NVME_CTRL_OACS_CFLS_MASK: Mask to get the Command and Feature Lockdown + * supported + * @NVME_CTRL_OACS_HMLMS_MASK: Mask to get the Host Managed Live Migration + * support + * @NVME_CTRL_OACS_ENSS_MASK: Mask to get the Exported NVM Subsystem Support + * @NVME_CTRL_OACS_CCFLS_MASK: Mask to get the Controller-scoped Command and + * Feature Lockdown supported + * @NVME_CTRL_OACS_RSVD14_MASK:Mask to get the Reserved + * @NVME_CTRL_OACS_SSRS: If set, then the controller supports the + * Security Send and Security Receive commands. + * @NVME_CTRL_OACS_FNVMS: If set then the controller supports the Format + * NVM command. + * @NVME_CTRL_OACS_FWDS: If set, then the controller supports the + * Firmware Commit and Firmware Image Download + * commands. + * @NVME_CTRL_OACS_NMS: If set, then the controller supports the + * Namespace Management capability + * @NVME_CTRL_OACS_DSTS: If set, then the controller supports the Device + * Self-test command. + * @NVME_CTRL_OACS_DIRS: If set, then the controller supports Directives + * and the Directive Send and Directive Receive + * commands. + * @NVME_CTRL_OACS_NSRS: If set, then the controller supports the NVMe-MI + * Send and NVMe-MI Receive commands. + * @NVME_CTRL_OACS_VMS: If set, then the controller supports the + * Virtualization Management command. + * @NVME_CTRL_OACS_DBCS: If set, then the controller supports the + * Doorbell Buffer Config command. + * @NVME_CTRL_OACS_GLSS: If set, then the controller supports the Get LBA + * Status capability. + * @NVME_CTRL_OACS_CFLS: If set, then the controller supports the command + * and feature lockdown capability. + * @NVME_CTRL_OACS_HMLMS: If set, then the controller supports the + * Host Managed Live Migration capability. + * @NVME_CTRL_OACS_ENSS: If set, then the controller supports the + * Exported Resource Management capability. + * @NVME_CTRL_OACS_CCFLS: If set, then the controller supports the + * Controller-scoped Command and Feature Lockdown + * capability. Cleared to '0' if the Command and + * Feature Lockdown Supported (CFLS) bit is cleared + * to '0'. + */ +enum nvme_id_ctrl_oacs { + NVME_CTRL_OACS_SSRS_SHIFT = 0, + NVME_CTRL_OACS_FNVMS_SHIFT = 1, + NVME_CTRL_OACS_FWDS_SHIFT = 2, + NVME_CTRL_OACS_NMS_SHIFT = 3, + NVME_CTRL_OACS_DSTS_SHIFT = 4, + NVME_CTRL_OACS_DIRS_SHIFT = 5, + NVME_CTRL_OACS_NSRS_SHIFT = 6, + NVME_CTRL_OACS_VMS_SHIFT = 7, + NVME_CTRL_OACS_DBCS_SHIFT = 8, + NVME_CTRL_OACS_GLSS_SHIFT = 9, + NVME_CTRL_OACS_CFLS_SHIFT = 10, + NVME_CTRL_OACS_HMLMS_SHIFT = 11, + NVME_CTRL_OACS_ENSS_SHIFT = 12, + NVME_CTRL_OACS_CCFLS_SHIFT = 13, + NVME_CTRL_OACS_RSVD14_SHIFT = 14, + NVME_CTRL_OACS_SSRS_MASK = 1, + NVME_CTRL_OACS_FNVMS_MASK = 1, + NVME_CTRL_OACS_FWDS_MASK = 1, + NVME_CTRL_OACS_NMS_MASK = 1, + NVME_CTRL_OACS_DSTS_MASK = 1, + NVME_CTRL_OACS_DIRS_MASK = 1, + NVME_CTRL_OACS_NSRS_MASK = 1, + NVME_CTRL_OACS_VMS_MASK = 1, + NVME_CTRL_OACS_DBCS_MASK = 1, + NVME_CTRL_OACS_GLSS_MASK = 1, + NVME_CTRL_OACS_CFLS_MASK = 1, + NVME_CTRL_OACS_HMLMS_MASK = 1, + NVME_CTRL_OACS_ENSS_MASK = 1, + NVME_CTRL_OACS_CCFLS_MASK = 1, + NVME_CTRL_OACS_RSVD14_MASK = 3, + NVME_CTRL_OACS_SSRS = NVME_VAL(CTRL_OACS_SSRS), + NVME_CTRL_OACS_FNVMS = NVME_VAL(CTRL_OACS_FNVMS), + NVME_CTRL_OACS_FWDS = NVME_VAL(CTRL_OACS_FWDS), + NVME_CTRL_OACS_NMS = NVME_VAL(CTRL_OACS_NMS), + NVME_CTRL_OACS_DSTS = NVME_VAL(CTRL_OACS_DSTS), + NVME_CTRL_OACS_DIRS = NVME_VAL(CTRL_OACS_DIRS), + NVME_CTRL_OACS_NSRS = NVME_VAL(CTRL_OACS_NSRS), + NVME_CTRL_OACS_VMS = NVME_VAL(CTRL_OACS_VMS), + NVME_CTRL_OACS_DBCS = NVME_VAL(CTRL_OACS_DBCS), + NVME_CTRL_OACS_GLSS = NVME_VAL(CTRL_OACS_GLSS), + NVME_CTRL_OACS_CFLS = NVME_VAL(CTRL_OACS_CFLS), + NVME_CTRL_OACS_HMLMS = NVME_VAL(CTRL_OACS_HMLMS), + NVME_CTRL_OACS_ENSS = NVME_VAL(CTRL_OACS_ENSS), + NVME_CTRL_OACS_CCFLS = NVME_VAL(CTRL_OACS_CCFLS), +}; + +#define NVME_CTRL_OACS_SSRS(oacs) NVME_GET(oacs, CTRL_OACS_SSRS) +#define NVME_CTRL_OACS_FNVMS(oacs) NVME_GET(oacs, CTRL_OACS_FNVMS) +#define NVME_CTRL_OACS_FWDS(oacs) NVME_GET(oacs, CTRL_OACS_FWDS) +#define NVME_CTRL_OACS_NMS(oacs) NVME_GET(oacs, CTRL_OACS_NMS) +#define NVME_CTRL_OACS_DSTS(oacs) NVME_GET(oacs, CTRL_OACS_DSTS) +#define NVME_CTRL_OACS_DIRS(oacs) NVME_GET(oacs, CTRL_OACS_DIRS) +#define NVME_CTRL_OACS_NSRS(oacs) NVME_GET(oacs, CTRL_OACS_NSRS) +#define NVME_CTRL_OACS_VMS(oacs) NVME_GET(oacs, CTRL_OACS_VMS) +#define NVME_CTRL_OACS_DBCS(oacs) NVME_GET(oacs, CTRL_OACS_DBCS) +#define NVME_CTRL_OACS_GLSS(oacs) NVME_GET(oacs, CTRL_OACS_GLSS) +#define NVME_CTRL_OACS_CFLS(oacs) NVME_GET(oacs, CTRL_OACS_CFLS) +#define NVME_CTRL_OACS_HMLMS(oacs) NVME_GET(oacs, CTRL_OACS_HMLMS) +#define NVME_CTRL_OACS_ENSS(oacs) NVME_GET(oacs, CTRL_OACS_ENSS) +#define NVME_CTRL_OACS_CCFLS(oacs) NVME_GET(oacs, CTRL_OACS_CCFLS) +#define NVME_CTRL_OACS_RSVD14(oacs) NVME_GET(oacs, CTRL_OACS_RSVD14) + +/** + * enum nvme_id_ctrl_frmw - Flags and values indicates capabilities regarding + * firmware updates from &struct nvme_id_ctrl.frmw. + * @NVME_CTRL_FRMW_FFSRO_SHIFT: FFSRO shift + * @NVME_CTRL_FRMW_NOFS_SHIFT: NOFS shift + * @NVME_CTRL_FRMW_FAWR_SHIFT: FAWR shift + * @NVME_CTRL_FRMW_SMUD_SHIFT: SMUD shift + * @NVME_CTRL_FRMW_RSVD6_SHIFT: Reserved shift + * @NVME_CTRL_FRMW_FFSRO_MASK: FFSRO mask + * @NVME_CTRL_FRMW_NOFS_MASK: NOFS mask + * @NVME_CTRL_FRMW_FAWR_MASK: FAWR mask + * @NVME_CTRL_FRMW_SMUD_MASK: SMUD mask + * @NVME_CTRL_FRMW_RSVD6_MASK: Reserved mask + * @NVME_CTRL_FRMW_FFSRO: If set, the first firmware slot is readonly + * @NVME_CTRL_FRMW_NOFS: Mask to get the value of the number of + * firmware slots that the controller supports. + * @NVME_CTRL_FRMW_FAWR: If set, the controller supports firmware + * activation without a reset. + * @NVME_CTRL_FRMW_SMUD: If set, the controller is able to detect + * overlapping firmware/boot partition + * image update. + */ +enum nvme_id_ctrl_frmw { + NVME_CTRL_FRMW_FFSRO_SHIFT = 0, + NVME_CTRL_FRMW_NOFS_SHIFT = 1, + NVME_CTRL_FRMW_FAWR_SHIFT = 4, + NVME_CTRL_FRMW_SMUD_SHIFT = 5, + NVME_CTRL_FRMW_RSVD6_SHIFT = 6, + NVME_CTRL_FRMW_FFSRO_MASK = 0x1, + NVME_CTRL_FRMW_NOFS_MASK = 0x7, + NVME_CTRL_FRMW_FAWR_MASK = 0x1, + NVME_CTRL_FRMW_SMUD_MASK = 0x1, + NVME_CTRL_FRMW_RSVD6_MASK = 0x3, + NVME_CTRL_FRMW_FFSRO = NVME_VAL(CTRL_FRMW_FFSRO), + NVME_CTRL_FRMW_NOFS = NVME_VAL(CTRL_FRMW_NOFS), + NVME_CTRL_FRMW_FAWR = NVME_VAL(CTRL_FRMW_FAWR), + NVME_CTRL_FRMW_SMUD = NVME_VAL(CTRL_FRMW_SMUD), +}; + +#define NVME_CTRL_FRMW_FFSRO(frmw) NVME_GET(frmw, CTRL_FRMW_FFSRO) +#define NVME_CTRL_FRMW_NOFS(frmw) NVME_GET(frmw, CTRL_FRMW_NOFS) +#define NVME_CTRL_FRMW_FAWR(frmw) NVME_GET(frmw, CTRL_FRMW_FAWR) +#define NVME_CTRL_FRMW_SMUD(frmw) NVME_GET(frmw, CTRL_FRMW_SMUD) +#define NVME_CTRL_FRMW_RSVD6(frmw) NVME_GET(frmw, CTRL_FRMW_RSVD6) + +/** + * enum nvme_id_ctrl_lpa - Flags indicating optional attributes for log pages + * that are accessed via the Get Log Page command. + * @NVME_CTRL_LPA_SMARTS_SHIFT: SMARTS shift + * @NVME_CTRL_LPA_CSES_SHIFT: CSES shift + * @NVME_CTRL_LPA_LPEDS_SHIFT: LPEDS shift + * @NVME_CTRL_LPA_TS_SHIFT: TS shift + * @NVME_CTRL_LPA_PES_SHIFT: PES shift + * @NVME_CTRL_LPA_MLPS_SHIFT: MLPS shift + * @NVME_CTRL_LPA_DA4S_SHIFT: DA4S shift + * @NVME_CTRL_LPA_RSVD7_SHIFT: Reserved shift + * @NVME_CTRL_LPA_SMARTS_MASK: SMARTS mask + * @NVME_CTRL_LPA_CSES_MASK: CSES mask + * @NVME_CTRL_LPA_LPEDS_MASK: LPEDS mask + * @NVME_CTRL_LPA_TS_MASK: TS mask + * @NVME_CTRL_LPA_PES_MASK: PES mask + * @NVME_CTRL_LPA_MLPS_MASK: MLPS mask + * @NVME_CTRL_LPA_DA4S_MASK: DA4S mask + * @NVME_CTRL_LPA_RSVD7_MASK: Reserved mask + * @NVME_CTRL_LPA_SMARTS: If set, controller supports SMART/Health log + * page on a per namespace basis. + * @NVME_CTRL_LPA_CSES: If Set, the controller supports the commands + * supported and effects log page. + * @NVME_CTRL_LPA_LPEDS: If set, the controller supports extended data + * for log page command including extended number + * of dwords and log page offset fields. + * @NVME_CTRL_LPA_TS: If set, the controller supports the telemetry + * host-initiated and telemetry + * controller-initiated log pages and sending + * telemetry log notices. + * @NVME_CTRL_LPA_PES: If set, the controller supports + * persistent event log. + * @NVME_CTRL_LPA_MLPS: If set, the controller supports + * the log pages log page, the scope of + * each command in the commands + * supported and effects log page, the + * feature identifiers supported and + * effects log page, and the NVMe-MI + * commands supported and effects log + * page. + * @NVME_CTRL_LPA_DA4S: If set, the controller supports data + * area 4 for telemetry host-initiated and + * telemetry. + */ +enum nvme_id_ctrl_lpa { + NVME_CTRL_LPA_SMARTS_SHIFT = 0, + NVME_CTRL_LPA_CSES_SHIFT = 1, + NVME_CTRL_LPA_LPEDS_SHIFT = 2, + NVME_CTRL_LPA_TS_SHIFT = 3, + NVME_CTRL_LPA_PES_SHIFT = 4, + NVME_CTRL_LPA_MLPS_SHIFT = 5, + NVME_CTRL_LPA_DA4S_SHIFT = 6, + NVME_CTRL_LPA_RSVD7_SHIFT = 7, + NVME_CTRL_LPA_SMARTS_MASK = 0x1, + NVME_CTRL_LPA_CSES_MASK = 0x1, + NVME_CTRL_LPA_LPEDS_MASK = 0x1, + NVME_CTRL_LPA_TS_MASK = 0x1, + NVME_CTRL_LPA_PES_MASK = 0x1, + NVME_CTRL_LPA_MLPS_MASK = 0x1, + NVME_CTRL_LPA_DA4S_MASK = 0x1, + NVME_CTRL_LPA_RSVD7_MASK = 0x1, + NVME_CTRL_LPA_SMARTS = NVME_VAL(CTRL_LPA_SMARTS), + NVME_CTRL_LPA_CSES = NVME_VAL(CTRL_LPA_CSES), + NVME_CTRL_LPA_LPEDS = NVME_VAL(CTRL_LPA_LPEDS), + NVME_CTRL_LPA_TS = NVME_VAL(CTRL_LPA_TS), + NVME_CTRL_LPA_PES = NVME_VAL(CTRL_LPA_PES), + NVME_CTRL_LPA_MLPS = NVME_VAL(CTRL_LPA_MLPS), + NVME_CTRL_LPA_DA4S = NVME_VAL(CTRL_LPA_DA4S), +}; + +#define NVME_CTRL_LPA_SMARTS(lpa) NVME_GET(lpa, CTRL_LPA_SMARTS) +#define NVME_CTRL_LPA_CSES(lpa) NVME_GET(lpa, CTRL_LPA_CSES) +#define NVME_CTRL_LPA_LPEDS(lpa) NVME_GET(lpa, CTRL_LPA_LPEDS) +#define NVME_CTRL_LPA_TS(lpa) NVME_GET(lpa, CTRL_LPA_TS) +#define NVME_CTRL_LPA_PES(lpa) NVME_GET(lpa, CTRL_LPA_PES) +#define NVME_CTRL_LPA_MLPS(lpa) NVME_GET(lpa, CTRL_LPA_MLPS) +#define NVME_CTRL_LPA_DA4S(lpa) NVME_GET(lpa, CTRL_LPA_DA4S) +#define NVME_CTRL_LPA_RSVD7(lpa) NVME_GET(lpa, CTRL_LPA_RSVD7) + +/** + * enum nvme_id_ctrl_avscc - Flags indicating the configuration settings for + * Admin Vendor Specific command handling. + * @NVME_CTRL_AVSCC_VSCF_SHIFT: VSCF shift + * @NVME_CTRL_AVSCC_RSVD1_SHIFT:Reserved shift + * @NVME_CTRL_AVSCC_VSCF_MASK: VSCF mask + * @NVME_CTRL_AVSCC_RSVD1_MASK: Reserved mask + * @NVME_CTRL_AVSCC_VSCF: If set, all Admin Vendor Specific Commands use + * the optional vendor specific command format with + * NDT and NDM fields. + */ +enum nvme_id_ctrl_avscc { + NVME_CTRL_AVSCC_VSCF_SHIFT = 0, + NVME_CTRL_AVSCC_RSVD1_SHIFT = 1, + NVME_CTRL_AVSCC_VSCF_MASK = 0x1, + NVME_CTRL_AVSCC_RSVD1_MASK = 0x7f, + NVME_CTRL_AVSCC_VSCF = NVME_VAL(CTRL_AVSCC_VSCF), +}; + +#define NVME_CTRL_AVSCC_VSCF(avscc) NVME_GET(avscc, CTRL_AVSCC_VSCF) +#define NVME_CTRL_AVSCC_RSVD1(avscc) NVME_GET(avscc, CTRL_AVSCC_RSVD1) + +/** + * enum nvme_id_ctrl_apsta - Flags indicating the attributes of the autonomous + * power state transition feature. + * @NVME_CTRL_APSTA_APTS_SHIFT: APTS shift + * @NVME_CTRL_APSTA_RSVD1_SHIFT: Reserved shift + * @NVME_CTRL_APSTA_APTS_MASK: APTS mask + * @NVME_CTRL_APSTA_RSVD1_MASK: Reserved mask + * @NVME_CTRL_APSTA_APST: If set, then the controller supports autonomous power + * state transitions. + */ +enum nvme_id_ctrl_apsta { + NVME_CTRL_APSTA_APTS_SHIFT = 0, + NVME_CTRL_APSTA_RSVD1_SHIFT = 1, + NVME_CTRL_APSTA_APTS_MASK = 0x1, + NVME_CTRL_APSTA_RSVD1_MASK = 0x7f, + NVME_CTRL_APSTA_APST = NVME_VAL(CTRL_APSTA_APTS), +}; + +#define NVME_CTRL_APSTA_APTS(apsta) NVME_GET(apsta, CTRL_APSTA_APTS) +#define NVME_CTRL_APSTA_RSVD1(apsta) NVME_GET(apsta, CTRL_APSTA_RSVD1) + +/** + * enum nvme_id_ctrl_rpmbs - This field indicates if the controller supports + * one or more Replay Protected Memory Blocks, from + * &struct nvme_id_ctrl.rpmbs. + * @NVME_CTRL_RPMBS_NRPMBU_SHIFT:NRPMBU shift + * @NVME_CTRL_RPMBS_AUTHM_SHIFT: AUTHM shift + * @NVME_CTRL_RPMBS_RSVD6_SHIFT: Reserved shift + * @NVME_CTRL_RPMBS_TSZE_SHIFT: TSZE shift + * @NVME_CTRL_RPMBS_ASZE_SHIFT: ASZE shift + * @NVME_CTRL_RPMBS_NRPMBU_MASK: NRPMBU mask + * @NVME_CTRL_RPMBS_AUTHM_MASK: AUTHM mask + * @NVME_CTRL_RPMBS_RSVD6_MASK: Reserved mask + * @NVME_CTRL_RPMBS_TSZE_MASK: TSZE mask + * @NVME_CTRL_RPMBS_ASZE_MASK: ASZE mask + * @NVME_CTRL_RPMBS_NR_UNITS: Mask to get the value of the Number of RPMB + * Units + * @NVME_CTRL_RPMBS_AUTH_METHOD: Mask to get the value of the Authentication + * Method + * @NVME_CTRL_RPMBS_TOTAL_SIZE: Mask to get the value of Total Size + * @NVME_CTRL_RPMBS_ACCESS_SIZE: Mask to get the value of Access Size + */ +enum nvme_id_ctrl_rpmbs { + NVME_CTRL_RPMBS_NRPMBU_SHIFT = 0, + NVME_CTRL_RPMBS_AUTHM_SHIFT = 3, + NVME_CTRL_RPMBS_RSVD6_SHIFT = 6, + NVME_CTRL_RPMBS_TSZE_SHIFT = 16, + NVME_CTRL_RPMBS_ASZE_SHIFT = 24, + NVME_CTRL_RPMBS_NRPMBU_MASK = 0x7, + NVME_CTRL_RPMBS_AUTHM_MASK = 0x7, + NVME_CTRL_RPMBS_RSVD6_MASK = 0x3ff, + NVME_CTRL_RPMBS_TSZE_MASK = 0xff, + NVME_CTRL_RPMBS_ASZE_MASK = 0xff, + NVME_CTRL_RPMBS_NR_UNITS = NVME_VAL(CTRL_RPMBS_NRPMBU), + NVME_CTRL_RPMBS_AUTH_METHOD = NVME_VAL(CTRL_RPMBS_AUTHM), + NVME_CTRL_RPMBS_TOTAL_SIZE = NVME_VAL(CTRL_RPMBS_TSZE), + NVME_CTRL_RPMBS_ACCESS_SIZE = NVME_VAL(CTRL_RPMBS_ASZE), +}; + +#define NVME_CTRL_RPMBS_NRPMBU(rpmbs) NVME_GET(rpmbs, CTRL_RPMBS_NRPMBU) +#define NVME_CTRL_RPMBS_AUTHM(rpmbs) NVME_GET(rpmbs, CTRL_RPMBS_AUTHM) +#define NVME_CTRL_RPMBS_RSVD6(rpmbs) NVME_GET(rpmbs, CTRL_RPMBS_RSVD6) +#define NVME_CTRL_RPMBS_TSZE(rpmbs) NVME_GET(rpmbs, CTRL_RPMBS_TSZE) +#define NVME_CTRL_RPMBS_ASZE(rpmbs) NVME_GET(rpmbs, CTRL_RPMBS_ASZE) + +/** + * enum nvme_id_ctrl_dsto - Flags indicating the optional Device Self-test + * command or operation behaviors supported by the + * controller or NVM subsystem. + * @NVME_CTRL_DSTO_SDSO_SHIFT: Shift amount to get the value of Single Device + * Self-test Operation from Device Self-test + * Options field. + * @NVME_CTRL_DSTO_HIRS_SHIFT: Shift amount to get the value of Host-Initiated + * Refresh Support from Device Self-test Options + * field. + * @NVME_CTRL_DSTO_RSVD2_SHIFT: Shift amount to get the Reserved + * @NVME_CTRL_DSTO_SDSO_MASK: Mask to get the value of Single Device Self-test + * Operation + * @NVME_CTRL_DSTO_HIRS_MASK: Mask to get the value of Host-Initiated Refresh + * Support + * @NVME_CTRL_DSTO_RSVD2_MASK: Mask to get the value of Reserved + * @NVME_CTRL_DSTO_ONE_DST: If set, then the NVM subsystem supports only one + * device self-test operation in progress at a + * time. If cleared, then the NVM subsystem + * supports one device self-test operation per + * controller at a time. + * @NVME_CTRL_DSTO_HIRS: If set, then the controller supports the + * Host-Initiated Refresh capability. + */ +enum nvme_id_ctrl_dsto { + NVME_CTRL_DSTO_SDSO_SHIFT = 0, + NVME_CTRL_DSTO_HIRS_SHIFT = 1, + NVME_CTRL_DSTO_RSVD2_SHIFT = 2, + NVME_CTRL_DSTO_SDSO_MASK = 0x1, + NVME_CTRL_DSTO_HIRS_MASK = 0x1, + NVME_CTRL_DSTO_RSVD2_MASK = 0x3f, + NVME_CTRL_DSTO_ONE_DST = NVME_VAL(CTRL_DSTO_SDSO), + NVME_CTRL_DSTO_HIRS = NVME_VAL(CTRL_DSTO_HIRS), +}; + +#define NVME_CTRL_DSTO_SDSO(dsto) NVME_GET(dsto, CTRL_DSTO_SDSO) +#define NVME_CTRL_DSTO_HIRS(dsto) NVME_GET(dsto, CTRL_DSTO_HIRS) +#define NVME_CTRL_DSTO_RSVD2(dsto) NVME_GET(dsto, CTRL_DSTO_RSVD2) + +/** + * enum nvme_id_ctrl_hctm - Flags indicate the attributes of the host + * controlled thermal management feature + * @NVME_CTRL_HCTMA_HCTMS_SHIFT: HCTMS shift + * @NVME_CTRL_HCTMA_RSVD1_SHIFT: Reserved shift + * @NVME_CTRL_HCTMA_HCTMS_MASK: HCTMS mask + * @NVME_CTRL_HCTMA_RSVD1_MASK: Reserved mask + * @NVME_CTRL_HCTMA_HCTM: then the controller supports host controlled thermal + * management, and the Set Features command and Get + * Features command with the Feature Identifier field + * set to %NVME_FEAT_FID_HCTM. + */ +enum nvme_id_ctrl_hctm { + NVME_CTRL_HCTMA_HCTMS_SHIFT = 0, + NVME_CTRL_HCTMA_RSVD1_SHIFT = 1, + NVME_CTRL_HCTMA_HCTMS_MASK = 0x1, + NVME_CTRL_HCTMA_RSVD1_MASK = 0x7fff, + NVME_CTRL_HCTMA_HCTM = NVME_VAL(CTRL_HCTMA_HCTMS), +}; + +#define NVME_CTRL_HCTMA_HCTMS(hctma) NVME_GET(hctma, CTRL_HCTMA_HCTMS) +#define NVME_CTRL_HCTMA_RSVD1(hctma) NVME_GET(hctma, CTRL_HCTMA_RSVD1) + +/** + * enum nvme_id_ctrl_sanicap - Indicates attributes for sanitize operations. + * @NVME_CTRL_SANICAP_CES_SHIFT: Crypto erase support shift + * @NVME_CTRL_SANICAP_BES_SHIFT: Block erase support shift + * @NVME_CTRL_SANICAP_OWS_SHIFT: Overwrite support shift + * @NVME_CTRL_SANICAP_VERS_SHIFT: Verification support shift + * @NVME_CTRL_SANICAP_NVERS_SHIFT: Namespace verification support shift + * @NVME_CTRL_SANICAP_NDI_SHIFT: No-deallocate inhibited shift + * @NVME_CTRL_SANICAP_NODMMAS_SHIFT: No-deallocate modifies media after sanitize + * shift + * @NVME_CTRL_SANICAP_SPRRS_SHIFT: Sanitize purge request and reporting + * supported shift + * @NVME_CTRL_SANICAP_RSVD6_SHIFT: Reserved shift + * @NVME_CTRL_SANICAP_CES_MASK: Crypto erase support mask + * @NVME_CTRL_SANICAP_BES_MASK: Block erase support mask + * @NVME_CTRL_SANICAP_OWS_MASK: Overwrite support mask + * @NVME_CTRL_SANICAP_VERS_MASK: Verification support mask + * @NVME_CTRL_SANICAP_NVERS_MASK: Namespace verification support mask + * @NVME_CTRL_SANICAP_NDI_MASK: No-deallocate inhibited mask + * @NVME_CTRL_SANICAP_NODMMAS_MASK: No-deallocate modifies media after sanitize + * mask + * @NVME_CTRL_SANICAP_SPRRS_MASK: Sanitize purge request and reporting + * supported mask + * @NVME_CTRL_SANICAP_RSVD6_MASK: Reserved mask + * @NVME_CTRL_SANICAP_CES: Crypto Erase Support. If set, then the controller + * supports the Crypto Erase sanitize operation. + * @NVME_CTRL_SANICAP_BES: Block Erase Support. If set, then the controller + * supports the Block Erase sanitize operation. + * @NVME_CTRL_SANICAP_OWS: Overwrite Support. If set, then the controller + * supports the Overwrite sanitize operation. + * @NVME_CTRL_SANICAP_VERS: Verification support + * @NVME_CTRL_SANICAP_NVERS: Namespace verification support + * @NVME_CTRL_SANICAP_NDI: No-Deallocate Inhibited. If set and the No- + * Deallocate Response Mode bit is set, then the + * controller deallocates after the sanitize + * operation even if the No-Deallocate After + * Sanitize bit is set in a Sanitize command. + * @NVME_CTRL_SANICAP_NODMMAS: No-Deallocate Modifies Media After Sanitize, + * mask to extract value. + * @NVME_CTRL_SANICAP_SPRRS: Sanitize Purge Request and Reporting + * Supported. If set, then the controller supports + * the Purged (PRGD) field in the Sanitize Status + * log page and the Purge Required (PREQ) bit in + * the Sanitize command and the Sanitize Namespace + * command. + */ +enum nvme_id_ctrl_sanicap { + NVME_CTRL_SANICAP_CES_SHIFT = 0, + NVME_CTRL_SANICAP_BES_SHIFT = 1, + NVME_CTRL_SANICAP_OWS_SHIFT = 2, + NVME_CTRL_SANICAP_VERS_SHIFT = 3, + NVME_CTRL_SANICAP_NVERS_SHIFT = 4, + NVME_CTRL_SANICAP_SPRRS_SHIFT = 5, + NVME_CTRL_SANICAP_RSVD6_SHIFT = 6, + NVME_CTRL_SANICAP_NDI_SHIFT = 29, + NVME_CTRL_SANICAP_NODMMAS_SHIFT = 30, + NVME_CTRL_SANICAP_CES_MASK = 0x1, + NVME_CTRL_SANICAP_BES_MASK = 0x1, + NVME_CTRL_SANICAP_OWS_MASK = 0x1, + NVME_CTRL_SANICAP_VERS_MASK = 0x1, + NVME_CTRL_SANICAP_NVERS_MASK = 0x1, + NVME_CTRL_SANICAP_SPRRS_MASK = 0x1, + NVME_CTRL_SANICAP_RSVD6_MASK = 0x7fffff, + NVME_CTRL_SANICAP_NDI_MASK = 0x1, + NVME_CTRL_SANICAP_NODMMAS_MASK = 0x3, + NVME_CTRL_SANICAP_CES = NVME_VAL(CTRL_SANICAP_CES), + NVME_CTRL_SANICAP_BES = NVME_VAL(CTRL_SANICAP_BES), + NVME_CTRL_SANICAP_OWS = NVME_VAL(CTRL_SANICAP_OWS), + NVME_CTRL_SANICAP_VERS = NVME_VAL(CTRL_SANICAP_VERS), + NVME_CTRL_SANICAP_NVERS = NVME_VAL(CTRL_SANICAP_NVERS), + NVME_CTRL_SANICAP_SPRRS = NVME_VAL(CTRL_SANICAP_SPRRS), + NVME_CTRL_SANICAP_NDI = NVME_VAL(CTRL_SANICAP_NDI), + NVME_CTRL_SANICAP_NODMMAS = NVME_VAL(CTRL_SANICAP_NODMMAS), +}; + +#define NVME_CTRL_SANICAP_CES(sanicap) NVME_GET(sanicap, CTRL_SANICAP_CES) +#define NVME_CTRL_SANICAP_BES(sanicap) NVME_GET(sanicap, CTRL_SANICAP_BES) +#define NVME_CTRL_SANICAP_OWS(sanicap) NVME_GET(sanicap, CTRL_SANICAP_OWS) +#define NVME_CTRL_SANICAP_VERS(sanicap) NVME_GET(sanicap, CTRL_SANICAP_VERS) +#define NVME_CTRL_SANICAP_NVERS(sanicap) NVME_GET(sanicap, CTRL_SANICAP_NVERS) +#define NVME_CTRL_SANICAP_SPRRS(sanicap) NVME_GET(sanicap, CTRL_SANICAP_SPRRS) +#define NVME_CTRL_SANICAP_RSVD6(sanicap) NVME_GET(sanicap, CTRL_SANICAP_RSVD6) +#define NVME_CTRL_SANICAP_NDI(sanicap) NVME_GET(sanicap, CTRL_SANICAP_NDI) +#define NVME_CTRL_SANICAP_NODMMAS(sanicap) \ + NVME_GET(sanicap, CTRL_SANICAP_NODMMAS) + +/** + * enum nvme_id_ctrl_anacap - This field indicates the capabilities associated + * with Asymmetric Namespace Access Reporting. + * @NVME_CTRL_ANACAP_RANAOS_SHIFT: RANAOS shift + * @NVME_CTRL_ANACAP_RANANOS_SHIFT: RANANOS shift + * @NVME_CTRL_ANACAP_RANAIS_SHIFT: RANAIS shift + * @NVME_CTRL_ANACAP_RANAPLS_SHIFT: RANPLOS shift + * @NVME_CTRL_ANACAP_RANACS_SHIFT: RANACS shift + * @NVME_CTRL_ANACAP_RSVD5_SHIFT: Reserved shift + * @NVME_CTRL_ANACAP_ANAGIDLWAS_SHIFT:RANAGIDLWAS shift + * @NVME_CTRL_ANACAP_ANAGIDS_SHIFT: RANAGIDS shift + * @NVME_CTRL_ANACAP_RANAOS_MASK: RANAOS mask + * @NVME_CTRL_ANACAP_RANANOS_MASK: RANANOS shift + * @NVME_CTRL_ANACAP_RANAIS_MASK: RANAIS shift + * @NVME_CTRL_ANACAP_RANAPLS_MASK: RANAPLS shift + * @NVME_CTRL_ANACAP_RANACS_MASK: RANACS shift + * @NVME_CTRL_ANACAP_RSVD5_MASK: Reserved shift + * @NVME_CTRL_ANACAP_ANAGIDLWAS_MASK: RANAGIDLWAS shift + * @NVME_CTRL_ANACAP_ANAGIDS_MASK: RANAGIDS shift + * @NVME_CTRL_ANACAP_OPT: If set, then the controller is able to + * report ANA Optimized state. + * @NVME_CTRL_ANACAP_NON_OPT: If set, then the controller is able to + * report ANA Non-Optimized state. + * @NVME_CTRL_ANACAP_INACCESSIBLE: If set, then the controller is able to + * report ANA Inaccessible state. + * @NVME_CTRL_ANACAP_PERSISTENT_LOSS: If set, then the controller is able to + * report ANA Persistent Loss state. + * @NVME_CTRL_ANACAP_CHANGE: If set, then the controller is able to + * report ANA Change state. + * @NVME_CTRL_ANACAP_GRPID_NO_CHG: If set, then the ANAGRPID field in the + * Identify Namespace data structure + * (&struct nvme_id_ns.anagrpid), does not + * change while the namespace is attached to + * any controller. + * @NVME_CTRL_ANACAP_GRPID_MGMT: If set, then the controller supports a + * non-zero value in the ANAGRPID field of + * the Namespace Management command. + */ +enum nvme_id_ctrl_anacap { + NVME_CTRL_ANACAP_RANAOS_SHIFT = 0, + NVME_CTRL_ANACAP_RANANOS_SHIFT = 1, + NVME_CTRL_ANACAP_RANAIS_SHIFT = 2, + NVME_CTRL_ANACAP_RANAPLS_SHIFT = 3, + NVME_CTRL_ANACAP_RANACS_SHIFT = 4, + NVME_CTRL_ANACAP_RSVD5_SHIFT = 5, + NVME_CTRL_ANACAP_ANAGIDLWAS_SHIFT = 6, + NVME_CTRL_ANACAP_ANAGIDS_SHIFT = 7, + NVME_CTRL_ANACAP_RANAOS_MASK = 0x1, + NVME_CTRL_ANACAP_RANANOS_MASK = 0x1, + NVME_CTRL_ANACAP_RANAIS_MASK = 0x1, + NVME_CTRL_ANACAP_RANAPLS_MASK = 0x1, + NVME_CTRL_ANACAP_RANACS_MASK = 0x1, + NVME_CTRL_ANACAP_RSVD5_MASK = 0x1, + NVME_CTRL_ANACAP_ANAGIDLWAS_MASK = 0x1, + NVME_CTRL_ANACAP_ANAGIDS_MASK = 0x1, + NVME_CTRL_ANACAP_OPT = NVME_VAL(CTRL_ANACAP_RANAOS), + NVME_CTRL_ANACAP_NON_OPT = NVME_VAL(CTRL_ANACAP_RANANOS), + NVME_CTRL_ANACAP_INACCESSIBLE = NVME_VAL(CTRL_ANACAP_RANAIS), + NVME_CTRL_ANACAP_PERSISTENT_LOSS = NVME_VAL(CTRL_ANACAP_RANAPLS), + NVME_CTRL_ANACAP_CHANGE = NVME_VAL(CTRL_ANACAP_RANACS), + NVME_CTRL_ANACAP_GRPID_NO_CHG = NVME_VAL(CTRL_ANACAP_ANAGIDLWAS), + NVME_CTRL_ANACAP_GRPID_MGMT = NVME_VAL(CTRL_ANACAP_ANAGIDS), +}; + +#define NVME_CTRL_ANACAP_RANAOS(anacap) NVME_GET(anacap, CTRL_ANACAP_RANAOS) +#define NVME_CTRL_ANACAP_RANANOS(anacap) NVME_GET(anacap, CTRL_ANACAP_RANANOS) +#define NVME_CTRL_ANACAP_RANAIS(anacap) NVME_GET(anacap, CTRL_ANACAP_RANAIS) +#define NVME_CTRL_ANACAP_RANAPLS(anacap) NVME_GET(anacap, CTRL_ANACAP_RANAPLS) +#define NVME_CTRL_ANACAP_RANACS(anacap) NVME_GET(anacap, CTRL_ANACAP_RANACS) +#define NVME_CTRL_ANACAP_RSVD5(anacap) NVME_GET(anacap, CTRL_ANACAP_RSVD5) +#define NVME_CTRL_ANACAP_ANAGIDLWAS(anacap) \ + NVME_GET(anacap, CTRL_ANACAP_ANAGIDLWAS) +#define NVME_CTRL_ANACAP_ANAGIDS(anacap) NVME_GET(anacap, CTRL_ANACAP_ANAGIDS) + +/** + * enum nvme_id_ctrl_kpioc - Key Per I/O Capabilities + * @NVME_CTRL_KPIOC_KPIOS_SHIFT: Shift amount to get the Key Per I/O + * Supported from the + * &struct nvme_id_ctrl.kpioc field. + * @NVME_CTRL_KPIOC_KPIOSC_SHIFT: Shift amount to get the Key Per I/O + * Scope from the + * &struct nvme_id_ctrl.kpioc field. + * @NVME_CTRL_KPIOC_RSVD2_SHIFT: Shift amount to get the Reserved + * @NVME_CTRL_KPIOC_KPIOS_MASK: Mask to get the Key Per I/O Supported + * from the &struct nvme_id_ctrl.kpioc + * field. + * @NVME_CTRL_KPIOC_KPIOSC_MASK: Mask to get the Key Per I/O Scope from + * the &struct nvme_id_ctrl.kpioc field. + * @NVME_CTRL_KPIOC_RSVD2_MASK: Mask to get the Reserved + */ +enum nvme_id_ctrl_kpioc { + NVME_CTRL_KPIOC_KPIOS_SHIFT = 0, + NVME_CTRL_KPIOC_KPIOSC_SHIFT = 1, + NVME_CTRL_KPIOC_RSVD2_SHIFT = 2, + NVME_CTRL_KPIOC_KPIOS_MASK = 0x1, + NVME_CTRL_KPIOC_KPIOSC_MASK = 0x1, + NVME_CTRL_KPIOC_RSVD2_MASK = 0x3f, +}; + +#define NVME_CTRL_KPIOC_KPIOS(kpioc) NVME_GET(kpioc, CTRL_KPIOC_KPIOS) +#define NVME_CTRL_KPIOC_KPIOSC(kpioc) NVME_GET(kpioc, CTRL_KPIOC_KPIOSC) +#define NVME_CTRL_KPIOC_RSVD2(kpioc) NVME_GET(kpioc, CTRL_KPIOC_RSVD2) + +/** + * enum nvme_id_ctrl_tmpthha - Temperature Threshold Hysteresis Attributes + * @NVME_CTRL_TMPTHHA_TMPTHMH_SHIFT: TMPTHMH shift + * @NVME_CTRL_TMPTHHA_RSVD3_SHIFT: Reserved shift + * @NVME_CTRL_TMPTHHA_TMPTHMH_MASK: TMPTHMH mask + * @NVME_CTRL_TMPTHHA_RSVD3_MASK: Reserved mask + */ +enum nvme_id_ctrl_tmpthha { + NVME_CTRL_TMPTHHA_TMPTHMH_SHIFT = 0, + NVME_CTRL_TMPTHHA_RSVD3_SHIFT = 3, + NVME_CTRL_TMPTHHA_TMPTHMH_MASK = 0x7, + NVME_CTRL_TMPTHHA_RSVD3_MASK = 0x1f, +}; + +#define NVME_CTRL_TMPTHHA_TMPTHMH(tmpthha) \ + NVME_GET(tmpthha, CTRL_TMPTHHA_TMPTHMH) +#define NVME_CTRL_TMPTHHA_RSVD3(tmpthha) NVME_GET(tmpthha, CTRL_TMPTHHA_RSVD3) +/** + * enum nvme_id_ctrl_mupa - Maximum Unlimited Power Attributes + * @NVME_CTRL_MUPA_MUPS_SHIFT: Shift amount to get the Maximum Unlimited Power + * Scale + * @NVME_CTRL_MUPA_MUPS_MASK: Mask to get the Maximum Unlimited Power Scale + */ +enum nvme_id_ctrl_mupa { + NVME_CTRL_MUPA_MUPS_SHIFT = 0, + NVME_CTRL_MUPA_MUPS_MASK = 0x3, +}; + +#define NVME_CTRL_MUPA_MUPS(MUPA) NVME_GET(MUPA, CTRL_MUPA_MUPS) + +/** + * enum nvme_id_ctrl_cdpa - Configurable Device Personality Attributes + * @NVME_CTRL_CDPA_CDPALG_SHIFT: CDPALG shift + * @NVME_CTRL_CDPA_RSVD8_SHIFT: RSVD8 shift + * @NVME_CTRL_CDPA_CDPALG_HS3_SHIFT: CDPALG.HS3 shift + * @NVME_CTRL_CDPA_CDPALG_RSVD1_SHIFT: CDPALG.RSVD1 shift + * @NVME_CTRL_CDPA_CDPALG_MASK: CDPALG mask + * @NVME_CTRL_CDPA_RSVD8_MASK: RSVD8 mask + * @NVME_CTRL_CDPA_CDPALG_HS3_MASK: CDPALG.HS3 mask + * @NVME_CTRL_CDPA_CDPALG_RSVD1_MASK: CDPALG.RSVD1 mask + * @NVME_CTRL_CDPA_HMAC_SHA_384: If set, then the controller supports + * the HMAC-SHA-384 standard. + */ +enum nvme_id_ctrl_cdpa { + NVME_CTRL_CDPA_CDPALG_SHIFT = 0, + NVME_CTRL_CDPA_RSVD8_SHIFT = 8, + NVME_CTRL_CDPA_CDPALG_HS3_SHIFT = 0, + NVME_CTRL_CDPA_CDPALG_RSVD1_SHIFT = 1, + NVME_CTRL_CDPA_CDPALG_MASK = 0xff, + NVME_CTRL_CDPA_RSVD8_MASK = 0xff, + NVME_CTRL_CDPA_CDPALG_HS3_MASK = 0x1, + NVME_CTRL_CDPA_CDPALG_RSVD1_MASK = 0x7f, + NVME_CTRL_CDPA_HMAC_SHA_384 = NVME_VAL(CTRL_CDPA_CDPALG_HS3), +}; + +#define NVME_CTRL_CDPA_CDPALG(cdpa) NVME_GET(cdpa, CTRL_CDPA_CDPALG) +#define NVME_CTRL_CDPA_RSVD8(cdpa) NVME_GET(cdpa, CTRL_CDPA_RSVD8) +#define NVME_CTRL_CDPA_CDPALG_HS3(cdpa) NVME_GET(cdpa, CTRL_CDPA_CDPALG_HS3) +#define NVME_CTRL_CDPA_CDPALG_RSVD1(cdpa) NVME_GET(cdpa, CTRL_CDPA_CDPALG_RSVD1) + +/** + * enum nvme_id_ctrl_ipmsr - Interval Power Measurement Sample Rate + * @NVME_CTRL_IPMSR_SRS_SHIFT: Shift amount to get the Sample Rate + * Scale from the &struct nvme_id_ctrl.ipmsr field. + * @NVME_CTRL_IPMSR_SRV_SHIFT: Shift amount to get the Sample Rate + * Value from the &struct nvme_id_ctrl.ipmsr field. + * @NVME_CTRL_IPMSR_SRS_MASK: Mask to get the Sample Rate Scale + * from the &struct nvme_id_ctrl.ipmsr field. + * @NVME_CTRL_IPMSR_SRV_MASK: Mask to get the Sample Rate Value + * from the &struct nvme_id_ctrl.ipmsr field. + */ +enum nvme_id_ctrl_ipmsr { + NVME_CTRL_IPMSR_SRS_SHIFT = 8, + NVME_CTRL_IPMSR_SRV_SHIFT = 0, + NVME_CTRL_IPMSR_SRS_MASK = 0x00FF, + NVME_CTRL_IPMSR_SRV_MASK = 0x00FF, +}; + +#define NVME_CTRL_IPMSR_SRS(ipmsr) NVME_GET(ipmsr, CTRL_IPMSR_SRS) +#define NVME_CTRL_IPMSR_SRV(ipmsr) NVME_GET(ipmsr, CTRL_IPMSR_SRV) + +/** + * enum nvme_id_ctrl_ensa - Exported NVM Subsystem Attributes + * @NVME_CTRL_ENSA_ENSMS_SHIFT: Shift amount to get the Exported NVM Subsystem + * Support Migration Support + * @NVME_CTRL_ENSA_ENSTS_SHIFT: Shift amount to get the Exported NVM Subsystem + * Template Support + * @NVME_CTRL_ENSA_ENSMS_MASK: Mask to get the Exported NVM Subsystem Support + * Migration Support + * @NVME_CTRL_ENSA_ENSTS_MASK: Mask to get the Exported NVM Subsystem Template + * Support + */ +enum nvme_id_ctrl_ensa { + NVME_CTRL_ENSA_ENSMS_SHIFT = 1, + NVME_CTRL_ENSA_ENSTS_SHIFT = 0, + NVME_CTRL_ENSA_ENSMS_MASK = 0x1, + NVME_CTRL_ENSA_ENSTS_MASK = 0x1, +}; + +#define NVME_CTRL_ENSA_ENSMS(ensa) NVME_GET(ensa, CTRL_ENSA_ENSMS) +#define NVME_CTRL_ENSA_ENSTS(ensa) NVME_GET(ensa, CTRL_ENSA_ENSTS) + +/** + * enum nvme_id_ctrl_endsfs - Exported Namespace Data Structure Formats + * Supported + * @NVME_CTRL_ENDSFS_ENF1_SHIFT:Shift amount to get the Exported Namespace + * Format 1 + * @NVME_CTRL_ENDSFS_ENF0_SHIFT:Shift amount to get the Exported Namespace + * Format 0 + * Template Support + * @NVME_CTRL_ENDSFS_ENF1_MASK: Mask to get the Exported Namespace Format 1 + * @NVME_CTRL_ENDSFS_ENF0_MASK: Mask to get the Exported Namespace Format 0 + */ +enum nvme_id_ctrl_endsfs { + NVME_CTRL_ENDSFS_ENF1_SHIFT = 1, + NVME_CTRL_ENDSFS_ENF0_SHIFT = 0, + NVME_CTRL_ENDSFS_ENF1_MASK = 0x1, + NVME_CTRL_ENDSFS_ENF0_MASK = 0x1, +}; + +#define NVME_CTRL_ENDSFS_ENF1(endsfs) NVME_GET(endsfs, CTRL_ENDSFS_ENF1) +#define NVME_CTRL_ENDSFS_ENF0(endsfs) NVME_GET(endsfs, CTRL_ENDSFS_ENF0) + +/** + * enum nvme_id_ctrl_sqes - Defines the required and maximum Submission Queue + * entry size when using the NVM Command Set. + * @NVME_CTRL_SQES_MINSQES_SHIFT: MINSQES shift + * @NVME_CTRL_SQES_MAXSQES_SHIFT: MAXSQES shift + * @NVME_CTRL_SQES_MINSQES_MASK: MINSQES mask + * @NVME_CTRL_SQES_MAXSQES_MASK: MAXSQES mask + * @NVME_CTRL_SQES_MIN: Mask to get the value of the required Submission Queue + * Entry size when using the NVM Command Set. + * @NVME_CTRL_SQES_MAX: Mask to get the value of the maximum Submission Queue + * entry size when using the NVM Command Set. + */ +enum nvme_id_ctrl_sqes { + NVME_CTRL_SQES_MINSQES_SHIFT = 0, + NVME_CTRL_SQES_MAXSQES_SHIFT = 4, + NVME_CTRL_SQES_MINSQES_MASK = 0xf, + NVME_CTRL_SQES_MAXSQES_MASK = 0xf, + NVME_CTRL_SQES_MIN = NVME_VAL(CTRL_SQES_MINSQES), + NVME_CTRL_SQES_MAX = NVME_VAL(CTRL_SQES_MAXSQES), +}; + +#define NVME_CTRL_SQES_MINSQES(sqes) NVME_GET(sqes, CTRL_SQES_MINSQES) +#define NVME_CTRL_SQES_MAXSQES(sqes) NVME_GET(sqes, CTRL_SQES_MAXSQES) + +/** + * enum nvme_id_ctrl_cqes - Defines the required and maximum Completion Queue + * entry size when using the NVM Command Set. + * @NVME_CTRL_CQES_MINCQES_SHIFT: MINCQES shift + * @NVME_CTRL_CQES_MAXCQES_SHIFT: MAXCQES shift + * @NVME_CTRL_CQES_MINCQES_MASK: MINCQES mask + * @NVME_CTRL_CQES_MAXCQES_MASK: MAXCQES mask + * @NVME_CTRL_CQES_MIN: Mask to get the value of the required Completion Queue + * Entry size when using the NVM Command Set. + * @NVME_CTRL_CQES_MAX: Mask to get the value of the maximum Completion Queue + * entry size when using the NVM Command Set. + */ +enum nvme_id_ctrl_cqes { + NVME_CTRL_CQES_MINCQES_SHIFT = 0, + NVME_CTRL_CQES_MAXCQES_SHIFT = 4, + NVME_CTRL_CQES_MINCQES_MASK = 0xf, + NVME_CTRL_CQES_MAXCQES_MASK = 0xf, + NVME_CTRL_CQES_MIN = NVME_VAL(CTRL_CQES_MINCQES), + NVME_CTRL_CQES_MAX = NVME_VAL(CTRL_CQES_MAXCQES), +}; + +#define NVME_CTRL_CQES_MINCQES(cqes) NVME_GET(cqes, CTRL_CQES_MINCQES) +#define NVME_CTRL_CQES_MAXCQES(cqes) NVME_GET(cqes, CTRL_CQES_MAXCQES) + +/** + * enum nvme_id_ctrl_oncs - This field indicates the optional NVM commands and + * features supported by the controller. + * @NVME_CTRL_ONCS_NVMCMPS_SHIFT: NVMCMPS shift + * @NVME_CTRL_ONCS_NVMWUSV_SHIFT: NVMWUSV shift + * @NVME_CTRL_ONCS_NVMDSMSV_SHIFT: NVMDSMSV shift + * @NVME_CTRL_ONCS_NVMWZSV_SHIFT: NVMWZSV shift + * @NVME_CTRL_ONCS_SSFS_SHIFT: SSFS shift + * @NVME_CTRL_ONCS_RESERVS_SHIFT: RESERVS shift + * @NVME_CTRL_ONCS_TSS_SHIFT: TSS shift + * @NVME_CTRL_ONCS_NVMVFYS_SHIFT: NVMVFYS shift + * @NVME_CTRL_ONCS_NVMCPYS_SHIFT: NVMCPYS shift + * @NVME_CTRL_ONCS_NVMCSA_SHIFT: NVMCSA shift + * @NVME_CTRL_ONCS_NVMAFC_SHIFT: NVMAFC shift + * @NVME_CTRL_ONCS_MAXWZD_SHIFT: MAXWZD shift + * @NVME_CTRL_ONCS_NSZS_SHIFT: NSZS shift + * @NVME_CTRL_ONCS_RSVD13_SHIFT: RSVD13 shift + * @NVME_CTRL_ONCS_NVMCMPS_MASK: NVMCMPS mask + * @NVME_CTRL_ONCS_NVMWUSV_MASK: NVMWUSV mask + * @NVME_CTRL_ONCS_NVMDSMSV_MASK: NVMDSMSV mask + * @NVME_CTRL_ONCS_NVMWZSV_MASK: NVMWASV mask + * @NVME_CTRL_ONCS_SSFS_MASK: SSFS mask + * @NVME_CTRL_ONCS_RESERVS_MASK: RESERVS mask + * @NVME_CTRL_ONCS_TSS_MASK: TSS mask + * @NVME_CTRL_ONCS_NVMVFYS_MASK: NVMVFYS mask + * @NVME_CTRL_ONCS_NVMCPYS_MASK: NVMCPYS mask + * @NVME_CTRL_ONCS_NVMCSA_MASK: NVMCSA mask + * @NVME_CTRL_ONCS_NVMAFC_MASK: NVMAFC mask + * @NVME_CTRL_ONCS_MAXWZD_MASK: MAXWZD mask + * @NVME_CTRL_ONCS_NSZS_MASK: NSZS mask + * @NVME_CTRL_ONCS_RSVD13_MASK: Reserved mask + * @NVME_CTRL_ONCS_COMPARE: If set, then the controller supports + * the Compare command. + * @NVME_CTRL_ONCS_WRITE_UNCORRECTABLE: If set, then the controller supports + * the Write Uncorrectable command. + * @NVME_CTRL_ONCS_DSM: If set, then the controller supports + * the Dataset Management command. + * @NVME_CTRL_ONCS_WRITE_ZEROES: If set, then the controller supports + * the Write Zeroes command. + * @NVME_CTRL_ONCS_SAVE_FEATURES: If set, then the controller supports + * the Save field set to a non-zero value + * in the Set Features command and the + * Select field set to a non-zero value in + * the Get Features command. + * @NVME_CTRL_ONCS_RESERVATIONS: If set, then the controller supports + * reservations. + * @NVME_CTRL_ONCS_TIMESTAMP: If set, then the controller supports + * the Timestamp feature. + * @NVME_CTRL_ONCS_VERIFY: If set, then the controller supports + * the Verify command. + * @NVME_CTRL_ONCS_COPY: If set, then the controller supports + * the copy command. + * @NVME_CTRL_ONCS_COPY_SINGLE_ATOMICITY: If set, then the write portion of a + * Copy command is performed as a single + * write command to which the same + * atomicity requirements that apply to + * a write command apply. + * @NVME_CTRL_ONCS_ALL_FAST_COPY: If set, then all copy operations for + * the Copy command are fast copy + * operations. + * @NVME_CTRL_ONCS_WRITE_ZEROES_DEALLOCATE: If MAXWZD bit set, then the maximum + * data size for Write Zeroes command + * depends on the value of the Deallocate + * bit in the Write Zeroes command and the + * value in the WZDSL field in the I/O + * Command Set specific Identify Controller + * data structure. + * @NVME_CTRL_ONCS_NAMESPACE_ZEROES: If NSZS bit set, then the controller + * supports the Namespace Zeroes (NSZ) bit + * in the NVM Command Set Write Zeroes + * command. + */ +enum nvme_id_ctrl_oncs { + NVME_CTRL_ONCS_NVMCMPS_SHIFT = 0, + NVME_CTRL_ONCS_NVMWUSV_SHIFT = 1, + NVME_CTRL_ONCS_NVMDSMSV_SHIFT = 2, + NVME_CTRL_ONCS_NVMWZSV_SHIFT = 3, + NVME_CTRL_ONCS_SSFS_SHIFT = 4, + NVME_CTRL_ONCS_RESERVS_SHIFT = 5, + NVME_CTRL_ONCS_TSS_SHIFT = 6, + NVME_CTRL_ONCS_NVMVFYS_SHIFT = 7, + NVME_CTRL_ONCS_NVMCPYS_SHIFT = 8, + NVME_CTRL_ONCS_NVMCSA_SHIFT = 9, + NVME_CTRL_ONCS_NVMAFC_SHIFT = 10, + NVME_CTRL_ONCS_MAXWZD_SHIFT = 11, + NVME_CTRL_ONCS_NSZS_SHIFT = 12, + NVME_CTRL_ONCS_RSVD13_SHIFT = 13, + NVME_CTRL_ONCS_NVMCMPS_MASK = 0x1, + NVME_CTRL_ONCS_NVMWUSV_MASK = 0x1, + NVME_CTRL_ONCS_NVMDSMSV_MASK = 0x1, + NVME_CTRL_ONCS_NVMWZSV_MASK = 0x1, + NVME_CTRL_ONCS_SSFS_MASK = 0x1, + NVME_CTRL_ONCS_RESERVS_MASK = 0x1, + NVME_CTRL_ONCS_TSS_MASK = 0x1, + NVME_CTRL_ONCS_NVMVFYS_MASK = 0x1, + NVME_CTRL_ONCS_NVMCPYS_MASK = 0x1, + NVME_CTRL_ONCS_NVMCSA_MASK = 0x1, + NVME_CTRL_ONCS_NVMAFC_MASK = 0x1, + NVME_CTRL_ONCS_MAXWZD_MASK = 0x1, + NVME_CTRL_ONCS_NSZS_MASK = 0x1, + NVME_CTRL_ONCS_RSVD13_MASK = 0x7, + NVME_CTRL_ONCS_COMPARE = NVME_VAL(CTRL_ONCS_NVMCMPS), + NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = NVME_VAL(CTRL_ONCS_NVMWUSV), + NVME_CTRL_ONCS_DSM = NVME_VAL(CTRL_ONCS_NVMDSMSV), + NVME_CTRL_ONCS_WRITE_ZEROES = NVME_VAL(CTRL_ONCS_NVMWZSV), + NVME_CTRL_ONCS_SAVE_FEATURES = NVME_VAL(CTRL_ONCS_SSFS), + NVME_CTRL_ONCS_RESERVATIONS = NVME_VAL(CTRL_ONCS_RESERVS), + NVME_CTRL_ONCS_TIMESTAMP = NVME_VAL(CTRL_ONCS_TSS), + NVME_CTRL_ONCS_VERIFY = NVME_VAL(CTRL_ONCS_NVMVFYS), + NVME_CTRL_ONCS_COPY = NVME_VAL(CTRL_ONCS_NVMCPYS), + NVME_CTRL_ONCS_COPY_SINGLE_ATOMICITY = NVME_VAL(CTRL_ONCS_NVMCSA), + NVME_CTRL_ONCS_ALL_FAST_COPY = NVME_VAL(CTRL_ONCS_NVMAFC), + NVME_CTRL_ONCS_WRITE_ZEROES_DEALLOCATE = NVME_VAL(CTRL_ONCS_MAXWZD), + NVME_CTRL_ONCS_NAMESPACE_ZEROES = NVME_VAL(CTRL_ONCS_NSZS), +}; + +#define NVME_CTRL_ONCS_NVMCMPS(oncs) NVME_GET(oncs, CTRL_ONCS_NVMCMPS) +#define NVME_CTRL_ONCS_NVMWUSV(oncs) NVME_GET(oncs, CTRL_ONCS_NVMWUSV) +#define NVME_CTRL_ONCS_NVMDSMSV(oncs) NVME_GET(oncs, CTRL_ONCS_NVMDSMSV) +#define NVME_CTRL_ONCS_NVMWZSV(oncs) NVME_GET(oncs, CTRL_ONCS_NVMWZSV) +#define NVME_CTRL_ONCS_SSFS(oncs) NVME_GET(oncs, CTRL_ONCS_SSFS) +#define NVME_CTRL_ONCS_RESERVS(oncs) NVME_GET(oncs, CTRL_ONCS_RESERVS) +#define NVME_CTRL_ONCS_TSS(oncs) NVME_GET(oncs, CTRL_ONCS_TSS) +#define NVME_CTRL_ONCS_NVMVFYS(oncs) NVME_GET(oncs, CTRL_ONCS_NVMVFYS) +#define NVME_CTRL_ONCS_NVMCPYS(oncs) NVME_GET(oncs, CTRL_ONCS_NVMCPYS) +#define NVME_CTRL_ONCS_NVMCSA(oncs) NVME_GET(oncs, CTRL_ONCS_NVMCSA) +#define NVME_CTRL_ONCS_NVMAFC(oncs) NVME_GET(oncs, CTRL_ONCS_NVMAFC) +#define NVME_CTRL_ONCS_MAXWZD(oncs) NVME_GET(oncs, CTRL_ONCS_MAXWZD) +#define NVME_CTRL_ONCS_NSZS(oncs) NVME_GET(oncs, CTRL_ONCS_NSZS) +#define NVME_CTRL_ONCS_RSVD13(oncs) NVME_GET(oncs, CTRL_ONCS_RSVD13) + +/** + * enum nvme_id_ctrl_fuses - This field indicates the fused operations that the + * controller supports. + * @NVME_CTRL_FUSES_FCWS_SHIFT: FCWS shift + * @NVME_CTRL_FUSES_RSVD1_SHIFT: Reserved shift + * @NVME_CTRL_FUSES_FCWS_MASK: FCWS mask + * @NVME_CTRL_FUSES_RSVD1_MASK: Reserved mask + * @NVME_CTRL_FUSES_COMPARE_AND_WRITE: If set, then the controller supports the + * Compare and Write fused operation. + */ +enum nvme_id_ctrl_fuses { + NVME_CTRL_FUSES_FCWS_SHIFT = 0, + NVME_CTRL_FUSES_RSVD1_SHIFT = 1, + NVME_CTRL_FUSES_FCWS_MASK = 0x1, + NVME_CTRL_FUSES_RSVD1_MASK = 0x7fff, + NVME_CTRL_FUSES_COMPARE_AND_WRITE = NVME_VAL(CTRL_FUSES_FCWS), +}; + +#define NVME_CTRL_FUSES_FCWS(fuses) NVME_GET(fuses, CTRL_FUSES_FCWS) +#define NVME_CTRL_FUSES_RSVD1(fuses) NVME_GET(fuses, CTRL_FUSES_RSVD1) + +/** + * enum nvme_id_ctrl_fna - This field indicates attributes for the Format NVM + * command. + * @NVME_CTRL_FNA_FMT_ALL_NS_SHIFT: Shift amount to get the format applied to + * all namespaces + * @NVME_CTRL_FNA_SEC_ALL_NS_SHIFT: Shift amount to get the secure erase + * applied to all namespaces + * @NVME_CTRL_FNA_CES_SHIFT: Shift amount to get the cryptographic + * erase supported + * @NVME_CTRL_FNA_NSID_ALL_F_SHIFT: Shift amount to get the format supported + * an NSID FFFFFFFFh + * @NVME_CTRL_FNA_RSVD4_SHIFT: Shift amount to get the Reserved + * @NVME_CTRL_FNA_FMT_ALL_NS_MASK: Mask to get the format applied to all + * namespaces + * @NVME_CTRL_FNA_SEC_ALL_NS_MASK: Mask to get the secure erase applied to + * all namespaces + * @NVME_CTRL_FNA_CES_MASK: Mask to get the cryptographic erase + * supported + * @NVME_CTRL_FNA_NSID_ALL_F_MASK: Mask to get the format supported an NSID + * FFFFFFFFh + * @NVME_CTRL_FNA_RSVD4_MASK: Mask to get the Reserved + * @NVME_CTRL_FNA_FMT_ALL_NAMESPACES: If set, then all namespaces in an NVM + * subsystem shall be configured with the + * same attributes and a format (excluding + * secure erase) of any namespace results in + * a format of all namespaces in an NVM + * subsystem. If cleared, then the + * controller supports format on a per + * namespace basis. + * @NVME_CTRL_FNA_SEC_ALL_NAMESPACES: If set, then any secure erase performed + * as part of a format operation results in + * a secure erase of all namespaces in the + * NVM subsystem. If cleared, then any + * secure erase performed as part of a + * format results in a secure erase of the + * particular namespace specified. + * @NVME_CTRL_FNA_CRYPTO_ERASE: If set, then cryptographic erase is + * supported. If cleared, then cryptographic + * erase is not supported. + * @NVME_CTRL_FNA_NSID_FFFFFFFF: If set, then format does not support + * nsid value set to FFFFFFFFh. If cleared, + * format supports nsid value set to + * FFFFFFFFh. + */ +enum nvme_id_ctrl_fna { + NVME_CTRL_FNA_FMT_ALL_NS_SHIFT = 0, + NVME_CTRL_FNA_SEC_ALL_NS_SHIFT = 1, + NVME_CTRL_FNA_CES_SHIFT = 2, + NVME_CTRL_FNA_NSID_ALL_F_SHIFT = 3, + NVME_CTRL_FNA_RSVD4_SHIFT = 4, + NVME_CTRL_FNA_FMT_ALL_NS_MASK = 0x1, + NVME_CTRL_FNA_SEC_ALL_NS_MASK = 0x1, + NVME_CTRL_FNA_CES_MASK = 0x1, + NVME_CTRL_FNA_NSID_ALL_F_MASK = 0x1, + NVME_CTRL_FNA_RSVD4_MASK = 0xf, + NVME_CTRL_FNA_FMT_ALL_NAMESPACES = NVME_VAL(CTRL_FNA_FMT_ALL_NS), + NVME_CTRL_FNA_SEC_ALL_NAMESPACES = NVME_VAL(CTRL_FNA_SEC_ALL_NS), + NVME_CTRL_FNA_CRYPTO_ERASE = NVME_VAL(CTRL_FNA_CES), + NVME_CTRL_FNA_NSID_FFFFFFFF = NVME_VAL(CTRL_FNA_NSID_ALL_F), +}; + +#define NVME_CTRL_FNA_FMT_ALL_NS(fna) NVME_GET(fna, CTRL_FNA_FMT_ALL_NS) +#define NVME_CTRL_FNA_SEC_ALL_NS(fna) NVME_GET(fna, CTRL_FNA_SEC_ALL_NS) +#define NVME_CTRL_FNA_CES(fna) NVME_GET(fna, CTRL_FNA_CES) +#define NVME_CTRL_FNA_NSID_ALL_F(fna) NVME_GET(fna, CTRL_FNA_NSID_ALL_F) +#define NVME_CTRL_FNA_RSVD4(fna) NVME_GET(fna, CTRL_FNA_RSVD4) + +/** + * enum nvme_id_ctrl_vwc - Volatile write cache + * @NVME_CTRL_VWC_VWCP_SHIFT: VWCP shift + * @NVME_CTRL_VWC_FB_SHIFT: FB shift + * @NVME_CTRL_VWC_RSVD3_SHIFT: Reserved shiftt + * @NVME_CTRL_VWC_VWCP_MASK: VWCP mask + * @NVME_CTRL_VWC_FB_MASK: FB mask + * @NVME_CTRL_VWC_RSVD3_MASK: Reserved mask + * @NVME_CTRL_VWC_PRESENT: If set, indicates a volatile write cache is present. + * If a volatile write cache is present, then the host + * controls whether the volatile write cache is enabled + * with a Set Features command specifying the value + * %NVME_FEAT_FID_VOLATILE_WC. + * @NVME_CTRL_VWC_FLUSH: Mask to get the value of the flush command behavior. + */ +enum nvme_id_ctrl_vwc { + NVME_CTRL_VWC_VWCP_SHIFT = 0, + NVME_CTRL_VWC_FB_SHIFT = 1, + NVME_CTRL_VWC_RSVD3_SHIFT = 3, + NVME_CTRL_VWC_VWCP_MASK = 0x1, + NVME_CTRL_VWC_FB_MASK = 0x3, + NVME_CTRL_VWC_RSVD3_MASK = 0x1f, + NVME_CTRL_VWC_PRESENT = NVME_VAL(CTRL_VWC_VWCP), + NVME_CTRL_VWC_FLUSH = NVME_VAL(CTRL_VWC_FB), +}; + +#define NVME_CTRL_VWC_VWCP(vwc) NVME_GET(vwc, CTRL_VWC_VWCP) +#define NVME_CTRL_VWC_FB(vwc) NVME_GET(vwc, CTRL_VWC_FB) +#define NVME_CTRL_VWC_RSVD3(vwc) NVME_GET(vwc, CTRL_VWC_RSVD3) + +/** + * enum nvme_id_ctrl_nvscc - This field indicates the configuration settings + * for NVM Vendor Specific command handling. + * @NVME_CTRL_ICSVSCC_SNVSCF_SHIFT: SNVSCF shift + * @NVME_CTRL_ICSVSCC_RSVD1_SHIFT: Reserved shift + * @NVME_CTRL_ICSVSCC_SNVSCF_MASK: SNVSCF mask + * @NVME_CTRL_ICSVSCC_RSVD1_MASK: Reserved mask + * @NVME_CTRL_NVSCC_FMT: If set, all NVM Vendor Specific Commands use the + * format with NDT and NDM fields. + */ +enum nvme_id_ctrl_nvscc { + NVME_CTRL_ICSVSCC_SNVSCF_SHIFT = 0, + NVME_CTRL_ICSVSCC_RSVD1_SHIFT = 1, + NVME_CTRL_ICSVSCC_SNVSCF_MASK = 0x1, + NVME_CTRL_ICSVSCC_RSVD1_MASK = 0x7f, + NVME_CTRL_NVSCC_FMT = NVME_VAL(CTRL_ICSVSCC_SNVSCF), +}; + +#define NVME_CTRL_ICSVSCC_SNVSCF(icsvscc) NVME_GET(icsvscc, CTRL_ICSVSCC_SNVSCF) +#define NVME_CTRL_ICSVSCC_RSVD1(icsvscc) NVME_GET(icsvscc, CTRL_ICSVSCC_RSVD1) + +/** + * enum nvme_id_ctrl_nwpc - This field indicates the optional namespace write + * protection capabilities supported by the + * controller. + * @NVME_CTRL_NWPC_NWPWPS_SHIFT: NWPWPS shift + * @NVME_CTRL_NWPC_WPUPCS_SHIFT: WPUPCS shift + * @NVME_CTRL_NWPC_PWPS_SHIFT: PWPS shift + * @NVME_CTRL_NWPC_RSVD3_SHIFT: Reserved shift + * @NVME_CTRL_NWPC_NWPWPS_MASK: NWPWPS mask + * @NVME_CTRL_NWPC_WPUPCS_MASK: WPUPCS mask + * @NVME_CTRL_NWPC_PWPS_MASK: PWPS mask + * @NVME_CTRL_NWPC_RSVD3_MASK: Reserved mask + * @NVME_CTRL_NWPC_WRITE_PROTECT: If set, then the controller shall + * support the No Write Protect and + * Write Protect namespace write + * protection states and may support + * the Write Protect Until Power + * Cycle state and Permanent Write + * Protect namespace write + * protection states. + * @NVME_CTRL_NWPC_WRITE_PROTECT_POWER_CYCLE: If set, then the controller + * supports the Write Protect Until + * Power Cycle state. + * @NVME_CTRL_NWPC_WRITE_PROTECT_PERMANENT: If set, then the controller + * supports the Permanent Write + * Protect state. + */ +enum nvme_id_ctrl_nwpc { + NVME_CTRL_NWPC_NWPWPS_SHIFT = 0, + NVME_CTRL_NWPC_WPUPCS_SHIFT = 1, + NVME_CTRL_NWPC_PWPS_SHIFT = 2, + NVME_CTRL_NWPC_RSVD3_SHIFT = 3, + NVME_CTRL_NWPC_NWPWPS_MASK = 0x1, + NVME_CTRL_NWPC_WPUPCS_MASK = 0x1, + NVME_CTRL_NWPC_PWPS_MASK = 0x1, + NVME_CTRL_NWPC_RSVD3_MASK = 0x1f, + NVME_CTRL_NWPC_WRITE_PROTECT = NVME_VAL(CTRL_NWPC_NWPWPS), + NVME_CTRL_NWPC_WRITE_PROTECT_POWER_CYCLE = NVME_VAL(CTRL_NWPC_WPUPCS), + NVME_CTRL_NWPC_WRITE_PROTECT_PERMANENT = NVME_VAL(CTRL_NWPC_PWPS), +}; + +#define NVME_CTRL_NWPC_NWPWPS(nwpc) NVME_GET(nwpc, CTRL_NWPC_NWPWPS) +#define NVME_CTRL_NWPC_WPUPCS(nwpc) NVME_GET(nwpc, CTRL_NWPC_WPUPCS) +#define NVME_CTRL_NWPC_PWPS(nwpc) NVME_GET(nwpc, CTRL_NWPC_PWPS) +#define NVME_CTRL_NWPC_RSVD3(nwpc) NVME_GET(nwpc, CTRL_NWPC_RSVD3) + +/** + * enum nvme_id_ctrl_cdfs - Copy descriptor formats supported + * @NVME_CTRL_CDFS_CDF0S_SHIFT: CDF0S shift + * @NVME_CTRL_CDFS_CDF1S_SHIFT: CDF1S shift + * @NVME_CTRL_CDFS_CDF2S_SHIFT: CDF2S shift + * @NVME_CTRL_CDFS_CDF3S_SHIFT: CDF3S shift + * @NVME_CTRL_CDFS_CDF4S_SHIFT: CDF4S shift + * @NVME_CTRL_CDFS_RSVD5_SHIFT: Reserved shift + * @NVME_CTRL_CDFS_CDF0S_MASK: CDF0S mask + * @NVME_CTRL_CDFS_CDF1S_MASK: CDF1S mask + * @NVME_CTRL_CDFS_CDF2S_MASK: CDF2S mask + * @NVME_CTRL_CDFS_CDF3S_MASK: CDF3S mask + * @NVME_CTRL_CDFS_CDF4S_MASK: CDF4S mask + * @NVME_CTRL_CDFS_RSVD5_MASK: Reserved mask + */ +enum nvme_id_ctrl_cdfs { + NVME_CTRL_CDFS_CDF0S_SHIFT = 0, + NVME_CTRL_CDFS_CDF1S_SHIFT = 1, + NVME_CTRL_CDFS_CDF2S_SHIFT = 2, + NVME_CTRL_CDFS_CDF3S_SHIFT = 3, + NVME_CTRL_CDFS_CDF4S_SHIFT = 4, + NVME_CTRL_CDFS_RSVD5_SHIFT = 5, + NVME_CTRL_CDFS_CDF0S_MASK = 0x1, + NVME_CTRL_CDFS_CDF1S_MASK = 0x1, + NVME_CTRL_CDFS_CDF2S_MASK = 0x1, + NVME_CTRL_CDFS_CDF3S_MASK = 0x1, + NVME_CTRL_CDFS_CDF4S_MASK = 0x1, + NVME_CTRL_CDFS_RSVD5_MASK = 0x7ff, +}; + +#define NVME_CTRL_CDFS_CDF0S(cdfs) NVME_GET(cdfs, CTRL_CDFS_CDF0S) +#define NVME_CTRL_CDFS_CDF1S(cdfs) NVME_GET(cdfs, CTRL_CDFS_CDF1S) +#define NVME_CTRL_CDFS_CDF2S(cdfs) NVME_GET(cdfs, CTRL_CDFS_CDF2S) +#define NVME_CTRL_CDFS_CDF3S(cdfs) NVME_GET(cdfs, CTRL_CDFS_CDF3S) +#define NVME_CTRL_CDFS_CDF4S(cdfs) NVME_GET(cdfs, CTRL_CDFS_CDF4S) +#define NVME_CTRL_CDFS_RSVD5(cdfs) NVME_GET(cdfs, CTRL_CDFS_RSVD5) + +/** + * enum nvme_id_ctrl_sgls - This field indicates if SGLs are supported for the + * NVM Command Set and the particular SGL types + * supported. + * @NVME_CTRL_SGLS_SGLS_SHIFT: + * @NVME_CTRL_SGLS_KSDBDS_SHIFT: + * @NVME_CTRL_SGLS_RSVD3_SHIFT: + * @NVME_CTRL_SGLS_SDT_SHIFT: + * @NVME_CTRL_SGLS_SBBDS_SHIFT: + * @NVME_CTRL_SGLS_MBA_SHIFT: + * @NVME_CTRL_SGLS_LLDTS_SHIFT: + * @NVME_CTRL_SGLS_MSDS_SHIFT: + * @NVME_CTRL_SGLS_SAOS_SHIFT: + * @NVME_CTRL_SGLS_TSDBDS_SHIFT: + * @NVME_CTRL_SGLS_RSVD22_SHIFT: + * @NVME_CTRL_SGLS_SGLS_MASK: + * @NVME_CTRL_SGLS_KSDBDS_MASK: + * @NVME_CTRL_SGLS_RSVD3_MASK: + * @NVME_CTRL_SGLS_SDT_MASK: + * @NVME_CTRL_SGLS_SBBDS_MASK: + * @NVME_CTRL_SGLS_MBA_MASK: + * @NVME_CTRL_SGLS_LLDTS_MASK: + * @NVME_CTRL_SGLS_MSDS_MASK: + * @NVME_CTRL_SGLS_SAOS_MASK: + * @NVME_CTRL_SGLS_TSDBDS_MASK: + * @NVME_CTRL_SGLS_RSVD22_MASK: + * @NVME_CTRL_SGLS_SUPPORTED: + * @NVME_CTRL_SGLS_KEYED: + * @NVME_CTRL_SGLS_BIT_BUCKET: + * @NVME_CTRL_SGLS_MPTR_BYTE_ALIGNED: + * @NVME_CTRL_SGLS_OVERSIZE: + * @NVME_CTRL_SGLS_MPTR_SGL: + * @NVME_CTRL_SGLS_OFFSET: + * @NVME_CTRL_SGLS_TPORT: + */ +enum nvme_id_ctrl_sgls { + NVME_CTRL_SGLS_SGLS_SHIFT = 0, + NVME_CTRL_SGLS_KSDBDS_SHIFT = 2, + NVME_CTRL_SGLS_RSVD3_SHIFT = 3, + NVME_CTRL_SGLS_SDT_SHIFT = 8, + NVME_CTRL_SGLS_SBBDS_SHIFT = 16, + NVME_CTRL_SGLS_MBA_SHIFT = 17, + NVME_CTRL_SGLS_LLDTS_SHIFT = 18, + NVME_CTRL_SGLS_MSDS_SHIFT = 19, + NVME_CTRL_SGLS_SAOS_SHIFT = 20, + NVME_CTRL_SGLS_TSDBDS_SHIFT = 21, + NVME_CTRL_SGLS_RSVD22_SHIFT = 22, + NVME_CTRL_SGLS_SGLS_MASK = 0x3, + NVME_CTRL_SGLS_KSDBDS_MASK = 0x1, + NVME_CTRL_SGLS_RSVD3_MASK = 0x1f, + NVME_CTRL_SGLS_SDT_MASK = 0xff, + NVME_CTRL_SGLS_SBBDS_MASK = 0x1, + NVME_CTRL_SGLS_MBA_MASK = 0x1, + NVME_CTRL_SGLS_LLDTS_MASK = 0x1, + NVME_CTRL_SGLS_MSDS_MASK = 0x1, + NVME_CTRL_SGLS_SAOS_MASK = 0x1, + NVME_CTRL_SGLS_TSDBDS_MASK = 0x1, + NVME_CTRL_SGLS_RSVD22_MASK = 0x3ff, + NVME_CTRL_SGLS_SUPPORTED = NVME_VAL(CTRL_SGLS_SGLS), + NVME_CTRL_SGLS_KEYED = NVME_VAL(CTRL_SGLS_KSDBDS), + NVME_CTRL_SGLS_BIT_BUCKET = NVME_VAL(CTRL_SGLS_SBBDS), + NVME_CTRL_SGLS_MPTR_BYTE_ALIGNED = NVME_VAL(CTRL_SGLS_MBA), + NVME_CTRL_SGLS_OVERSIZE = NVME_VAL(CTRL_SGLS_LLDTS), + NVME_CTRL_SGLS_MPTR_SGL = NVME_VAL(CTRL_SGLS_MSDS), + NVME_CTRL_SGLS_OFFSET = NVME_VAL(CTRL_SGLS_SAOS), + NVME_CTRL_SGLS_TPORT = NVME_VAL(CTRL_SGLS_TSDBDS), +}; + +#define NVME_CTRL_SGLS_SGLS(sgls) NVME_GET(sgls, CTRL_SGLS_SGLS) +#define NVME_CTRL_SGLS_KSDBDS(sgls) NVME_GET(sgls, CTRL_SGLS_KSDBDS) +#define NVME_CTRL_SGLS_RSVD3(sgls) NVME_GET(sgls, CTRL_SGLS_RSVD3) +#define NVME_CTRL_SGLS_SDT(sgls) NVME_GET(sgls, CTRL_SGLS_SDT) +#define NVME_CTRL_SGLS_SBBDS(sgls) NVME_GET(sgls, CTRL_SGLS_SBBDS) +#define NVME_CTRL_SGLS_MBA(sgls) NVME_GET(sgls, CTRL_SGLS_MBA) +#define NVME_CTRL_SGLS_LLDTS(sgls) NVME_GET(sgls, CTRL_SGLS_LLDTS) +#define NVME_CTRL_SGLS_MSDS(sgls) NVME_GET(sgls, CTRL_SGLS_MSDS) +#define NVME_CTRL_SGLS_SAOS(sgls) NVME_GET(sgls, CTRL_SGLS_SAOS) +#define NVME_CTRL_SGLS_TSDBDS(sgls) NVME_GET(sgls, CTRL_SGLS_TSDBDS) +#define NVME_CTRL_SGLS_RSVD22(sgls) NVME_GET(sgls, CTRL_SGLS_RSVD22) + +/** + * enum nvme_id_ctrl_trattr - Tracking Attributes + * @NVME_CTRL_TRATTR_THMCS_SHIFT: Shift amount to get the Track Host + * Memory Changes Support from the + * &struct nvme_id_ctrl.trattr field. + * @NVME_CTRL_TRATTR_TUDCS_SHIFT: Shift amount to get the Track User Data + * Changes Support from the + * &struct nvme_id_ctrl.trattr field. + * @NVME_CTRL_TRATTR_MRTLL_SHIFT: Shift amount to get the Memory Range + * Tracking Length Limit from the + * &struct nvme_id_ctrl.trattr field. + * @NVME_CTRL_TRATTR_RSVD3_SHIFT: Shift amount to get the Reserved + * @NVME_CTRL_TRATTR_THMCS_MASK: Mask to get the Track Host Memory + * Changes Support from the + * &struct nvme_id_ctrl.trattr field. + * @NVME_CTRL_TRATTR_TUDCS_MASK: Mask to get the Track User Data Changes + * Support from the + * &struct nvme_id_ctrl.trattr field. + * @NVME_CTRL_TRATTR_MRTLL_MASK: Mask to get the Memory Range Tracking + * Length Limit from the + * &struct nvme_id_ctrl.trattr field. + * @NVME_CTRL_TRATTR_RSVD3_MASK: Mask to get the Reserved + */ +enum nvme_id_ctrl_trattr { + NVME_CTRL_TRATTR_THMCS_SHIFT = 0, + NVME_CTRL_TRATTR_TUDCS_SHIFT = 1, + NVME_CTRL_TRATTR_MRTLL_SHIFT = 2, + NVME_CTRL_TRATTR_RSVD3_SHIFT = 3, + NVME_CTRL_TRATTR_THMCS_MASK = 0x1, + NVME_CTRL_TRATTR_TUDCS_MASK = 0x1, + NVME_CTRL_TRATTR_MRTLL_MASK = 0x1, + NVME_CTRL_TRATTR_RSVD3_MASK = 0x1f, +}; + +#define NVME_CTRL_TRATTR_THMCS(trattr) NVME_GET(trattr, CTRL_TRATTR_THMCS) +#define NVME_CTRL_TRATTR_TUDCS(trattr) NVME_GET(trattr, CTRL_TRATTR_TUDCS) +#define NVME_CTRL_TRATTR_MRTLL(trattr) NVME_GET(trattr, CTRL_TRATTR_MRTLL) +#define NVME_CTRL_TRATTR_RSVD3(trattr) NVME_GET(trattr, CTRL_TRATTR_RSVD3) + +/** + * enum nvme_id_ctrl_fcatt - This field indicates attributes of the controller + * that are specific to NVMe over Fabrics. + * @NVME_CTRL_FCATT_DCMS_SHIFT: DCMS shift + * @NVME_CTRL_FCATT_NZNSETIDS_SHIFT: NZNSETIDS shift + * @NVME_CTRL_FCATT_RSVD2_SHIFT: Reserved shift + * @NVME_CTRL_FCATT_DCMS_MASK: DCMS mask + * @NVME_CTRL_FCATT_NZNSETIDS_MASK: NZNSETIDS mask + * @NVME_CTRL_FCATT_RSVD2_MASK: Reserved mask + * @NVME_CTRL_FCATT_DYNAMIC: If cleared, then the NVM subsystem uses a dynamic + * controller model. If set, then the NVM subsystem + * uses a static controller model. + */ +enum nvme_id_ctrl_fcatt { + NVME_CTRL_FCATT_DCMS_SHIFT = 0, + NVME_CTRL_FCATT_NZNSETIDS_SHIFT = 1, + NVME_CTRL_FCATT_RSVD2_SHIFT = 2, + NVME_CTRL_FCATT_DCMS_MASK = 0x1, + NVME_CTRL_FCATT_NZNSETIDS_MASK = 0x1, + NVME_CTRL_FCATT_RSVD2_MASK = 0x3f, + NVME_CTRL_FCATT_DYNAMIC = NVME_VAL(CTRL_FCATT_DCMS), +}; + +#define NVME_CTRL_FCATT_DCMS(fcatt) NVME_GET(fcatt, CTRL_FCATT_DCMS) +#define NVME_CTRL_FCATT_NZNSETIDS(fcatt) NVME_GET(fcatt, CTRL_FCATT_NZNSETIDS) +#define NVME_CTRL_FCATT_RSVD2(fcatt) NVME_GET(fcatt, CTRL_FCATT_RSVD2) + +/** + * enum nvme_id_ctrl_ofcs - Indicate whether the controller supports optional + * fabric commands. + * @NVME_CTRL_OFCS_DCS_SHIFT: DCS shift + * @NVME_CTRL_OFCS_RSVD1_SHIFT:Reserved shift + * @NVME_CTRL_OFCS_DCS_MASK: DCS mask + * @NVME_CTRL_OFCS_RSVD1_MASK: Reserved mask + * @NVME_CTRL_OFCS_DISCONNECT: If set, then the controller supports the + * Disconnect command and deletion of individual + * I/O Queues. + */ +enum nvme_id_ctrl_ofcs { + NVME_CTRL_OFCS_DCS_SHIFT = 0, + NVME_CTRL_OFCS_RSVD1_SHIFT = 1, + NVME_CTRL_OFCS_DCS_MASK = 0x1, + NVME_CTRL_OFCS_RSVD1_MASK = 0x7fff, + NVME_CTRL_OFCS_DISCONNECT = NVME_VAL(CTRL_OFCS_DCS), +}; + +#define NVME_CTRL_OFCS_DCS(ofcs) NVME_GET(ofcs, CTRL_OFCS_DCS) +#define NVME_CTRL_OFCS_RSVD1(ofcs) NVME_GET(ofcs, CTRL_OFCS_RSVD1) + +/** + * struct nvme_lbaf - LBA Format Data Structure + * @ms: Metadata Size indicates the number of metadata bytes provided per LBA + * based on the LBA Data Size indicated. + * @ds: LBA Data Size indicates the LBA data size supported, reported as a + * power of two. + * @rp: Relative Performance, see &enum nvme_lbaf_rp. + */ +struct nvme_lbaf { + __le16 ms; + __u8 ds; + __u8 rp; +}; + +/** + * enum nvme_lbaf_rp - This field indicates the relative performance of the LBA + * format indicated relative to other LBA formats supported + * by the controller. + * @NVME_LBAF_RP_BEST: Best performance + * @NVME_LBAF_RP_BETTER: Better performance + * @NVME_LBAF_RP_GOOD: Good performance + * @NVME_LBAF_RP_DEGRADED: Degraded performance + * @NVME_LBAF_RP_SHIFT: Relative performance shift + * @NVME_LBAF_RP_MASK: Mask to get the relative performance value from the + * field + */ +enum nvme_lbaf_rp { + NVME_LBAF_RP_BEST = 0, + NVME_LBAF_RP_BETTER = 1, + NVME_LBAF_RP_GOOD = 2, + NVME_LBAF_RP_DEGRADED = 3, + NVME_LBAF_RP_SHIFT = 0, + NVME_LBAF_RP_MASK = 3, +}; + +/** + * struct nvme_id_ns - Identify Namespace data structure + * @nsze: Namespace Size indicates the total size of the namespace in + * logical blocks. The number of logical blocks is based on the + * formatted LBA size. + * @ncap: Namespace Capacity indicates the maximum number of logical blocks + * that may be allocated in the namespace at any point in time. The + * number of logical blocks is based on the formatted LBA size. + * @nuse: Namespace Utilization indicates the current number of logical + * blocks allocated in the namespace. This field is smaller than or + * equal to the Namespace Capacity. The number of logical blocks is + * based on the formatted LBA size. + * @nsfeat: Namespace Features, see &enum nvme_id_nsfeat. + * @nlbaf: Number of LBA Formats defines the number of supported LBA data + * size and metadata size combinations supported by the namespace + * and the highest possible index to &struct nvme_id_ns.lbaf. + * @flbas: Formatted LBA Size, see &enum nvme_id_ns_flbas. + * @mc: Metadata Capabilities, see &enum nvme_id_ns_mc. + * @dpc: End-to-end Data Protection Capabilities, see + * &enum nvme_id_ns_dpc. + * @dps: End-to-end Data Protection Type Settings, see + * &enum nvme_id_ns_dps. + * @nmic: Namespace Multi-path I/O and Namespace Sharing Capabilities, see + * &enum nvme_id_ns_nmic. + * @rescap: Reservation Capabilities, see &enum nvme_id_ns_rescap. + * @fpi: Format Progress Indicator, see &enum nvme_nd_ns_fpi. + * @dlfeat: Deallocate Logical Block Features, see &enum nvme_id_ns_dlfeat. + * @nawun: Namespace Atomic Write Unit Normal indicates the + * namespace specific size of the write operation guaranteed to be + * written atomically to the NVM during normal operation. + * @nawupf: Namespace Atomic Write Unit Power Fail indicates the + * namespace specific size of the write operation guaranteed to be + * written atomically to the NVM during a power fail or error + * condition. + * @nacwu: Namespace Atomic Compare & Write Unit indicates the namespace + * specific size of the write operation guaranteed to be written + * atomically to the NVM for a Compare and Write fused command. + * @nabsn: Namespace Atomic Boundary Size Normal indicates the atomic + * boundary size for this namespace for the NAWUN value. This field + * is specified in logical blocks. + * @nabo: Namespace Atomic Boundary Offset indicates the LBA on this + * namespace where the first atomic boundary starts. + * @nabspf: Namespace Atomic Boundary Size Power Fail indicates the atomic + * boundary size for this namespace specific to the Namespace Atomic + * Write Unit Power Fail value. This field is specified in logical + * blocks. + * @noiob: Namespace Optimal I/O Boundary indicates the optimal I/O boundary + * for this namespace. This field is specified in logical blocks. + * The host should construct Read and Write commands that do not + * cross the I/O boundary to achieve optimal performance. + * @nvmcap: NVM Capacity indicates the total size of the NVM allocated to + * this namespace. The value is in bytes. + * @npwg: Namespace Preferred Write Granularity indicates the smallest + * recommended write granularity in logical blocks for this + * namespace. This is a 0's based value. + * @npwa: Namespace Preferred Write Alignment indicates the recommended + * write alignment in logical blocks for this namespace. This is a + * 0's based value. + * @npdg: Namespace Preferred Deallocate Granularity indicates the + * recommended granularity in logical blocks for the Dataset + * Management command with the Attribute - Deallocate bit. + * @npda: Namespace Preferred Deallocate Alignment indicates the + * recommended alignment in logical blocks for the Dataset + * Management command with the Attribute - Deallocate bit + * @nows: Namespace Optimal Write Size indicates the size in logical blocks + * for optimal write performance for this namespace. This is a 0's + * based value. + * @mssrl: Maximum Single Source Range Length indicates the maximum number + * of logical blocks that may be specified in each valid Source Range + * field of a Copy command. + * @mcl: Maximum Copy Length indicates the maximum number of logical + * blocks that may be specified in a Copy command. + * @msrc: Maximum Source Range Count indicates the maximum number of Source + * Range entries that may be used to specify source data in a Copy + * command. This is a 0’s based value. + * @kpios: Key Per I/O Status indicates namespace Key Per I/O capability + * status. + * @nulbaf: Number of Unique Capability LBA Formats defines the number of + * supported user data size and metadata size combinations supported + * by the namespace that may not share the same capabilities. LBA + * formats shall be allocated in order and packed sequentially. + * @rsvd83: Reserved + * @kpiodaag: Key Per I/O Data Access Alignment and Granularity indicates the + * alignment and granularity in logical blocks that is required + * for commands that support a KPIOTAG value in the CETYPE field. + * @rsvd88: Reserved + * @anagrpid: ANA Group Identifier indicates the ANA Group Identifier of the + * ANA group of which the namespace is a member. + * @rsvd96: Reserved + * @nsattr: Namespace Attributes, see &enum nvme_id_ns_attr. + * @nvmsetid: NVM Set Identifier indicates the NVM Set with which this + * namespace is associated. + * @endgid: Endurance Group Identifier indicates the Endurance Group with + * which this namespace is associated. + * @nguid: Namespace Globally Unique Identifier contains a 128-bit value + * that is globally unique and assigned to the namespace when the + * namespace is created. This field remains fixed throughout the + * life of the namespace and is preserved across namespace and + * controller operations + * @eui64: IEEE Extended Unique Identifier contains a 64-bit IEEE Extended + * Unique Identifier (EUI-64) that is globally unique and assigned + * to the namespace when the namespace is created. This field + * remains fixed throughout the life of the namespace and is + * preserved across namespace and controller operations + * @lbaf: LBA Format, see &struct nvme_lbaf. + * @vs: Vendor Specific + */ +struct nvme_id_ns { + __le64 nsze; + __le64 ncap; + __le64 nuse; + __u8 nsfeat; + __u8 nlbaf; + __u8 flbas; + __u8 mc; + __u8 dpc; + __u8 dps; + __u8 nmic; + __u8 rescap; + __u8 fpi; + __u8 dlfeat; + __le16 nawun; + __le16 nawupf; + __le16 nacwu; + __le16 nabsn; + __le16 nabo; + __le16 nabspf; + __le16 noiob; + __u8 nvmcap[16]; + __le16 npwg; + __le16 npwa; + __le16 npdg; + __le16 npda; + __le16 nows; + __le16 mssrl; + __le32 mcl; + __u8 msrc; + __u8 kpios; + __u8 nulbaf; + __u8 rsvd83; + __le32 kpiodaag; + __u8 rsvd88[4]; + __le32 anagrpid; + __u8 rsvd96[3]; + __u8 nsattr; + __le16 nvmsetid; + __le16 endgid; + __u8 nguid[16]; + __u8 eui64[8]; + struct nvme_lbaf lbaf[64]; + __u8 vs[3712]; +}; + +/** + * enum nvme_id_nsfeat - This field defines features of the namespace. + * @NVME_NS_NSFEAT_THINP_SHIFT: THINP shift + * @NVME_NS_NSFEAT_NSABP_SHIFT: NSABP shift + * @NVME_NS_NSFEAT_DAE_SHIFT: DAE shift + * @NVME_NS_NSFEAT_UIDREUSE_SHIFT: UIDREUSE shift + * @NVME_NS_NSFEAT_OPTPERF_SHIFT: OPTPERF shift + * @NVME_NS_NSFEAT_MAM_SHIFT: MAM shift + * @NVME_NS_NSFEAT_OPTRPERF_SHIFT: OPTRPERF shift + * @NVME_NS_NSFEAT_THINP_MASK: THINP mask + * @NVME_NS_NSFEAT_NSABP_MASK: NSABP mask + * @NVME_NS_NSFEAT_DAE_MASK: DAE mask + * @NVME_NS_NSFEAT_UIDREUSE_MASK: UIDREUSE mask + * @NVME_NS_NSFEAT_OPTPERF_MASK: OPTPERF mask + * @NVME_NS_NSFEAT_MAM_MASK: MAM mask + * @NVME_NS_NSFEAT_OPTRPERF_MASK: OPTRPERF mask + * @NVME_NS_FEAT_THIN: If set, indicates that the namespace supports thin + * provisioning. Specifically, the Namespace Capacity + * reported may be less than the Namespace Size. + * @NVME_NS_FEAT_NATOMIC: If set, indicates that the fields NAWUN, NAWUPF, and + * NACWU are defined for this namespace and should be + * used by the host for this namespace instead of the + * AWUN, AWUPF, and ACWU fields in the Identify + * Controller data structure. + * @NVME_NS_FEAT_DULBE: If set, indicates that the controller supports the + * Deallocated or Unwritten Logical Block error for + * this namespace. + * @NVME_NS_FEAT_ID_REUSE: If set, indicates that the value in the NGUID field + * for this namespace, if non- zero, is never reused by + * the controller and that the value in the EUI64 field + * for this namespace, if non-zero, is never reused by + * the controller. + * @NVME_NS_FEAT_IO_OPT: If set, indicates that the fields NPWG, NPWA, NPDG, + * NPDA, and NOWS are defined for this namespace and + * should be used by the host for I/O optimization + * @NVME_NS_FEAT_MAM: If set, indicates that Multiple Atomicity Mode + * applies to write operations to this namespace. If + * cleared, indicates that Single Atomicity Mode + * applies to write operations to this namespace. + * @NVME_NS_FEAT_OPTRPERF: If set, indicates that the NPRG, NPRA, and NORS + * fields are defined for this namespace and should be + * used by the host for I/O optimization. + * @NVME_NS_NSFEAT_OPTPERF_NPDG: If set NPDG supported + * @NVME_NS_NSFEAT_OPTPERF_LARGE: If set NPDGL and NPDAL supported + */ +enum nvme_id_nsfeat { + NVME_NS_NSFEAT_THINP_SHIFT = 0, + NVME_NS_NSFEAT_NSABP_SHIFT = 1, + NVME_NS_NSFEAT_DAE_SHIFT = 2, + NVME_NS_NSFEAT_UIDREUSE_SHIFT = 3, + NVME_NS_NSFEAT_OPTPERF_SHIFT = 4, + NVME_NS_NSFEAT_MAM_SHIFT = 6, + NVME_NS_NSFEAT_OPTRPERF_SHIFT = 7, + NVME_NS_NSFEAT_THINP_MASK = 0x1, + NVME_NS_NSFEAT_NSABP_MASK = 0x1, + NVME_NS_NSFEAT_DAE_MASK = 0x1, + NVME_NS_NSFEAT_UIDREUSE_MASK = 0x1, + NVME_NS_NSFEAT_OPTPERF_MASK = 0x3, + NVME_NS_NSFEAT_MAM_MASK = 0x1, + NVME_NS_NSFEAT_OPTRPERF_MASK = 0x1, + NVME_NS_FEAT_THIN = NVME_VAL(NS_NSFEAT_THINP), + NVME_NS_FEAT_NATOMIC = NVME_VAL(NS_NSFEAT_NSABP), + NVME_NS_FEAT_DULBE = NVME_VAL(NS_NSFEAT_DAE), + NVME_NS_FEAT_ID_REUSE = NVME_VAL(NS_NSFEAT_UIDREUSE), + NVME_NS_FEAT_IO_OPT = NVME_VAL(NS_NSFEAT_OPTPERF), + NVME_NS_FEAT_MAM = NVME_VAL(NS_NSFEAT_MAM), + NVME_NS_FEAT_OPTRPERF = NVME_VAL(NS_NSFEAT_OPTRPERF), + NVME_NS_NSFEAT_OPTPERF_NPDG = 0x1, + NVME_NS_NSFEAT_OPTPERF_LARGE = 0x2, +}; + +#define NVME_NS_NSFEAT_THINP(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_THINP) +#define NVME_NS_NSFEAT_NSABP(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_NSABP) +#define NVME_NS_NSFEAT_DAE(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_DAE) +#define NVME_NS_NSFEAT_UIDREUSE(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_UIDREUSE) +#define NVME_NS_NSFEAT_OPTPERF(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_OPTPERF) +#define NVME_NS_NSFEAT_MAM(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_MAM) +#define NVME_NS_NSFEAT_OPTRPERF(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_OPTRPERF) + +#define NVME_NS_NSFEAT_OPTPERF_NPDG(nsfeat) \ + (NVME_NS_NSFEAT_OPTRPERF(nsfeat) & NVME_NS_NSFEAT_OPTPERF_NPDG) +#define NVME_NS_NSFEAT_OPTPERF_LARGE(nsfeat) \ + (NVME_NS_NSFEAT_OPTRPERF(nsfeat) & NVME_NS_NSFEAT_OPTPERF_LARGE) + +/** + * enum nvme_id_ns_flbas - This field indicates the LBA data size & metadata + * size combination that the namespace has been + * formatted with + * @NVME_NS_FLBAS_LOWER_SHIFT: Shift to get the lower 4 bits of LBA format + * index + * @NVME_NS_FLBAS_LOWER_MASK: Mask to get the index of one of the supported + * LBA Formats's least significant + * 4bits indicated in + * :c:type:`struct nvme_id_ns `.lbaf. + * @NVME_NS_FLBAS_META_EXT: Applicable only if format contains metadata. If + * this bit is set, indicates that the metadata is + * transferred at the end of the data LBA, creating + * an extended data LBA. If cleared, indicates that + * all of the metadata for a command is transferred + * as a separate contiguous buffer of data. + * @NVME_NS_FLBAS_HIGHER_SHIFT: Shift to get the higher 2 bits of LBA format + * index + * @NVME_NS_FLBAS_HIGHER_MASK: Mask to get the index of one of + * the supported LBA Formats's most significant + * 2bits indicated in + * :c:type:`struct nvme_id_ns `.lbaf. + */ +enum nvme_id_ns_flbas { + NVME_NS_FLBAS_LOWER_SHIFT = 0, + NVME_NS_FLBAS_LOWER_MASK = 0xf, + NVME_NS_FLBAS_META_EXT = 1 << 4, + NVME_NS_FLBAS_HIGHER_SHIFT = 5, + NVME_NS_FLBAS_HIGHER_MASK = 0x3, +}; + +#define NVME_NS_FLBAS_LOWER(flbas) NVME_GET(flbas, NS_FLBAS_LOWER) +#define NVME_NS_FLBAS_HIGHER(flbas) NVME_GET(flbas, NS_FLBAS_HIGHER) + + +/** + * enum nvme_id_ns_mc - This field indicates the capabilities for metadata. + * @NVME_NS_MC_EXTENDED: If set, indicates that the namespace supports the + * metadata being transferred as part of an extended data + * LBA. + * @NVME_NS_MC_SEPARATE: If set, indicates the namespace supports the metadata + * being transferred as part of a separate buffer that is + * specified in the Metadata Pointer. + */ +enum nvme_id_ns_mc { + NVME_NS_MC_EXTENDED = 1 << 0, + NVME_NS_MC_SEPARATE = 1 << 1, +}; + +/** + * enum nvme_id_ns_dpc - This field indicates the capabilities for the + * end-to-end data protection feature. + * @NVME_NS_DPC_PIT1S_SHIFT: PIT1S shift + * @NVME_NS_DPC_PIT2S_SHIFT: PIT2S shift + * @NVME_NS_DPC_PIT3S_SHIFT: PIT3S shift + * @NVME_NS_DPC_PIIFB_SHIFT: PIIFB shift + * @NVME_NS_DPC_PIILB_SHIFT: PIILB shift + * @NVME_NS_DPC_RSVD5_SHIFT: Reserved shift + * @NVME_NS_DPC_PIT1S_MASK: PIT1S mask + * @NVME_NS_DPC_PIT2S_MASK: PIT2S mask + * @NVME_NS_DPC_PIT3S_MASK: PIT3S mask + * @NVME_NS_DPC_PIIFB_MASK: PIIFB mask + * @NVME_NS_DPC_PIILB_MASK: PIILB mask + * @NVME_NS_DPC_RSVD5_MASK: Reserved mask + * @NVME_NS_DPC_PI_TYPE1: If set, indicates that the namespace supports + * Protection Information Type 1. + * @NVME_NS_DPC_PI_TYPE2: If set, indicates that the namespace supports + * Protection Information Type 2. + * @NVME_NS_DPC_PI_TYPE3: If set, indicates that the namespace supports + * Protection Information Type 3. + * @NVME_NS_DPC_PI_FIRST: If set, indicates that the namespace supports + * protection information transferred as the first eight + * bytes of metadata. + * @NVME_NS_DPC_PI_LAST: If set, indicates that the namespace supports + * protection information transferred as the last eight + * bytes of metadata. + */ +enum nvme_id_ns_dpc { + NVME_NS_DPC_PIT1S_SHIFT = 0, + NVME_NS_DPC_PIT2S_SHIFT = 1, + NVME_NS_DPC_PIT3S_SHIFT = 2, + NVME_NS_DPC_PIIFB_SHIFT = 3, + NVME_NS_DPC_PIILB_SHIFT = 4, + NVME_NS_DPC_RSVD5_SHIFT = 5, + NVME_NS_DPC_PIT1S_MASK = 0x1, + NVME_NS_DPC_PIT2S_MASK = 0x1, + NVME_NS_DPC_PIT3S_MASK = 0x1, + NVME_NS_DPC_PIIFB_MASK = 0x1, + NVME_NS_DPC_PIILB_MASK = 0x1, + NVME_NS_DPC_RSVD5_MASK = 0x7, + NVME_NS_DPC_PI_TYPE1 = NVME_VAL(NS_DPC_PIT1S), + NVME_NS_DPC_PI_TYPE2 = NVME_VAL(NS_DPC_PIT2S), + NVME_NS_DPC_PI_TYPE3 = NVME_VAL(NS_DPC_PIT3S), + NVME_NS_DPC_PI_FIRST = NVME_VAL(NS_DPC_PIIFB), + NVME_NS_DPC_PI_LAST = NVME_VAL(NS_DPC_PIILB), +}; + +#define NVME_NS_DPC_PIT1S(dpc) NVME_GET(dpc, NS_DPC_PIT1S) +#define NVME_NS_DPC_PIT2S(dpc) NVME_GET(dpc, NS_DPC_PIT2S) +#define NVME_NS_DPC_PIT3S(dpc) NVME_GET(dpc, NS_DPC_PIT3S) +#define NVME_NS_DPC_PIIFB(dpc) NVME_GET(dpc, NS_DPC_PIIFB) +#define NVME_NS_DPC_PIILB(dpc) NVME_GET(dpc, NS_DPC_PIILB) +#define NVME_NS_DPC_RSVD5(dpc) NVME_GET(dpc, NS_DPC_RSVD5) + +/** + * enum nvme_id_ns_dps - This field indicates the Type settings for the + * end-to-end data protection feature. + * @NVME_NS_DPS_PI_NONE: Protection information is not enabled + * @NVME_NS_DPS_PI_TYPE1: Protection information is enabled, Type 1 + * @NVME_NS_DPS_PI_TYPE2: Protection information is enabled, Type 2 + * @NVME_NS_DPS_PI_TYPE3: Protection information is enabled, Type 3 + * @NVME_NS_DPS_PI_SHIFT: Protection information type shift + * @NVME_NS_DPS_PI_MASK: Mask to get the value of the PI type + * @NVME_NS_DPS_PI_FIRST_SHIFT: Protection information in first bytes shift + * @NVME_NS_DPS_PI_FIRST_MASK: Protection information in first bytes mask + * @NVME_NS_DPS_RSVD4_SHIFT: Reserved shift + * @NVME_NS_DPS_RSVD4_MASK: Reserved mask + * @NVME_NS_DPS_PI_FIRST: If set, indicates that the protection information, if + * enabled, is transferred as the first eight bytes of + * metadata. + */ +enum nvme_id_ns_dps { + NVME_NS_DPS_PI_NONE = 0, + NVME_NS_DPS_PI_TYPE1 = 1, + NVME_NS_DPS_PI_TYPE2 = 2, + NVME_NS_DPS_PI_TYPE3 = 3, + NVME_NS_DPS_PI_SHIFT = 0, + NVME_NS_DPS_PI_MASK = 0x7, + NVME_NS_DPS_PI_FIRST_SHIFT = 3, + NVME_NS_DPS_PI_FIRST_MASK = 0x1, + NVME_NS_DPS_RSVD4_SHIFT = 4, + NVME_NS_DPS_RSVD4_MASK = 0xf, + NVME_NS_DPS_PI_FIRST = NVME_VAL(NS_DPS_PI_FIRST), +}; + +#define NVME_NS_DPS_PI(dps) NVME_GET(dps, NS_DPS_PI) +#define NVME_NS_DPS_PI_FIRST(dps) NVME_GET(dps, NS_DPS_PI_FIRST) +#define NVME_NS_DPS_RSVD4(dps) NVME_GET(dps, NS_DPS_RSVD4) + +/** + * enum nvme_id_ns_nmic - This field specifies multi-path I/O and namespace + * sharing capabilities of the namespace. + * @NVME_NS_NMIC_SHRNS_SHIFT: SHRNS shift + * @NVME_NS_NMIC_DISNS_SHIFT: DISNS shift + * @NVME_NS_NMIC_RSVD2_SHIFT: Reserved shift + * @NVME_NS_NMIC_SHRNS_MASK: SHRNS mask + * @NVME_NS_NMIC_DISNS_MASK: DISNS mask + * @NVME_NS_NMIC_RSVD2_MASK: RSVD2 mask + * @NVME_NS_NMIC_SHARED: If set, then the namespace may be attached to two or + * more controllers in the NVM subsystem concurrently + */ +enum nvme_id_ns_nmic { + NVME_NS_NMIC_SHRNS_SHIFT = 0, + NVME_NS_NMIC_DISNS_SHIFT = 1, + NVME_NS_NMIC_RSVD2_SHIFT = 2, + NVME_NS_NMIC_SHRNS_MASK = 0x1, + NVME_NS_NMIC_DISNS_MASK = 0x1, + NVME_NS_NMIC_RSVD2_MASK = 0x3f, + NVME_NS_NMIC_SHARED = NVME_VAL(NS_NMIC_SHRNS), +}; + +#define NVME_NS_NMIC_SHRNS(nmic) NVME_GET(nmic, NS_NMIC_SHRNS) +#define NVME_NS_NMIC_DISNS(nmic) NVME_GET(nmic, NS_NMIC_DISNS) +#define NVME_NS_NMIC_RSVD2(nmic) NVME_GET(nmic, NS_NMIC_RSVD2) + +/** + * enum nvme_id_ns_rescap - This field indicates the reservation capabilities + * of the namespace. + * @NVME_NS_RESCAP_PTPLS_SHIFT: PTPLS shift + * @NVME_NS_RESCAP_WES_SHIFT: WES shift + * @NVME_NS_RESCAP_EAS_SHIFT: EAS shift + * @NVME_NS_RESCAP_WEROS_SHIFT: WEROS shift + * @NVME_NS_RESCAP_EAROS_SHIFT: EAROS shift + * @NVME_NS_RESCAP_WEARS_SHIFT: WEARS shift + * @NVME_NS_RESCAP_EAARS_SHIFT: EAARS shift + * @NVME_NS_RESCAP_IEKS_SHIFT: IEKS shift + * @NVME_NS_RESCAP_PTPLS_MASK: PTPLS mask + * @NVME_NS_RESCAP_WES_MASK: WES mask + * @NVME_NS_RESCAP_EAS_MASK: EAS mask + * @NVME_NS_RESCAP_WEROS_MASK: WEROS mask + * @NVME_NS_RESCAP_EAROS_MASK: EAROS mask + * @NVME_NS_RESCAP_WEARS_MASK: WEARS mask + * @NVME_NS_RESCAP_EAARS_MASK: EAARS mask + * @NVME_NS_RESCAP_IEKS_MASK: IEKS mask + * @NVME_NS_RESCAP_PTPL: If set, indicates that the namespace supports the + * Persist Through Power Loss capability. + * @NVME_NS_RESCAP_WE: If set, indicates that the namespace supports the + * Write Exclusive reservation type. + * @NVME_NS_RESCAP_EA: If set, indicates that the namespace supports the + * Exclusive Access reservation type. + * @NVME_NS_RESCAP_WERO: If set, indicates that the namespace supports the + * Write Exclusive - Registrants Only reservation type. + * @NVME_NS_RESCAP_EARO: If set, indicates that the namespace supports the + * Exclusive Access - Registrants Only reservation type. + * @NVME_NS_RESCAP_WEAR: If set, indicates that the namespace supports the + * Write Exclusive - All Registrants reservation type. + * @NVME_NS_RESCAP_EAAR: If set, indicates that the namespace supports the + * Exclusive Access - All Registrants reservation type. + * @NVME_NS_RESCAP_IEK_13: If set, indicates that Ignore Existing Key is used + * as defined in revision 1.3 or later of this + * specification. + */ +enum nvme_id_ns_rescap { + NVME_NS_RESCAP_PTPLS_SHIFT = 0, + NVME_NS_RESCAP_WES_SHIFT = 1, + NVME_NS_RESCAP_EAS_SHIFT = 2, + NVME_NS_RESCAP_WEROS_SHIFT = 3, + NVME_NS_RESCAP_EAROS_SHIFT = 4, + NVME_NS_RESCAP_WEARS_SHIFT = 5, + NVME_NS_RESCAP_EAARS_SHIFT = 6, + NVME_NS_RESCAP_IEKS_SHIFT = 7, + NVME_NS_RESCAP_PTPLS_MASK = 0x1, + NVME_NS_RESCAP_WES_MASK = 0x1, + NVME_NS_RESCAP_EAS_MASK = 0x1, + NVME_NS_RESCAP_WEROS_MASK = 0x1, + NVME_NS_RESCAP_EAROS_MASK = 0x1, + NVME_NS_RESCAP_WEARS_MASK = 0x1, + NVME_NS_RESCAP_EAARS_MASK = 0x1, + NVME_NS_RESCAP_IEKS_MASK = 0x1, + NVME_NS_RESCAP_PTPL = NVME_VAL(NS_RESCAP_PTPLS), + NVME_NS_RESCAP_WE = NVME_VAL(NS_RESCAP_WES), + NVME_NS_RESCAP_EA = NVME_VAL(NS_RESCAP_EAS), + NVME_NS_RESCAP_WERO = NVME_VAL(NS_RESCAP_WEROS), + NVME_NS_RESCAP_EARO = NVME_VAL(NS_RESCAP_EAROS), + NVME_NS_RESCAP_WEAR = NVME_VAL(NS_RESCAP_WEARS), + NVME_NS_RESCAP_EAAR = NVME_VAL(NS_RESCAP_EAARS), + NVME_NS_RESCAP_IEK_13 = NVME_VAL(NS_RESCAP_IEKS), +}; + +#define NVME_NS_RESCAP_PTPLS(rescap) NVME_GET(rescap, NS_RESCAP_PTPLS) +#define NVME_NS_RESCAP_WES(rescap) NVME_GET(rescap, NS_RESCAP_WES) +#define NVME_NS_RESCAP_EAS(rescap) NVME_GET(rescap, NS_RESCAP_EAS) +#define NVME_NS_RESCAP_WEROS(rescap) NVME_GET(rescap, NS_RESCAP_WEROS) +#define NVME_NS_RESCAP_EAROS(rescap) NVME_GET(rescap, NS_RESCAP_EAROS) +#define NVME_NS_RESCAP_WEARS(rescap) NVME_GET(rescap, NS_RESCAP_WEARS) +#define NVME_NS_RESCAP_EAARS(rescap) NVME_GET(rescap, NS_RESCAP_EAARS) +#define NVME_NS_RESCAP_IEKS(rescap) NVME_GET(rescap, NS_RESCAP_IEKS) + +/** + * enum nvme_nd_ns_fpi - If a format operation is in progress, this field + * indicates the percentage of the namespace that remains + * to be formatted. + * @NVME_NS_FPI_RFNVM_SHIFT: RFNVM shift + * @NVME_NS_FPI_FPIS_SHIFT: FPIS shift + * @NVME_NS_FPI_RFNVM_MASK: RFNVM mask + * @NVME_NS_FPI_FPIS_MASK: FPIS mask + * @NVME_NS_FPI_REMAINING: Mask to get the format percent remaining value + * @NVME_NS_FPI_SUPPORTED: If set, indicates that the namespace supports the + * Format Progress Indicator defined for the field. + */ +enum nvme_nd_ns_fpi { + NVME_NS_FPI_RFNVM_SHIFT = 0, + NVME_NS_FPI_FPIS_SHIFT = 7, + NVME_NS_FPI_RFNVM_MASK = 0x7f, + NVME_NS_FPI_FPIS_MASK = 0x1, + NVME_NS_FPI_REMAINING = NVME_VAL(NS_FPI_RFNVM), + NVME_NS_FPI_SUPPORTED = NVME_VAL(NS_FPI_FPIS), +}; + +#define NVME_NS_FPI_RFNVM(fpi) NVME_GET(fpi, NS_FPI_RFNVM) +#define NVME_NS_FPI_FPIS(fpi) NVME_GET(fpi, NS_FPI_FPIS) + +/** + * enum nvme_id_ns_dlfeat - This field indicates information about features + * that affect deallocating logical blocks for this + * namespace. + * @NVME_NS_DLFEAT_DRB_SHIFT: DRB shift + * @NVME_NS_DLFEAT_WZDS_SHIFT: WADS shift + * @NVME_NS_DLFEAT_GDS_SHIFT: GDS shift + * @NVME_NS_DLFEAT_RSVD5_SHIFT: Reserved shift + * @NVME_NS_DLFEAT_DRB_MASK: DRB mask + * @NVME_NS_DLFEAT_WZDS_MASK: WZDS mask, + * @NVME_NS_DLFEAT_GDS_MASK: GDS mask + * @NVME_NS_DLFEAT_RSVD5_MASK: Reserved mask + * @NVME_NS_DLFEAT_RB: Mask to get the value of the read behavior + * @NVME_NS_DLFEAT_RB_NR: Read behvaior is not reported + * @NVME_NS_DLFEAT_RB_ALL_0S: A deallocated logical block returns all bytes + * cleared to 0h. + * @NVME_NS_DLFEAT_RB_ALL_FS: A deallocated logical block returns all bytes + * set to FFh. + * @NVME_NS_DLFEAT_WRITE_ZEROES: If set, indicates that the controller supports + * the Deallocate bit in the Write Zeroes command + * for this namespace. + * @NVME_NS_DLFEAT_CRC_GUARD: If set, indicates that the Guard field for + * deallocated logical blocks that contain + * protection information is set to the CRC for + * the value read from the deallocated logical + * block and its metadata + */ +enum nvme_id_ns_dlfeat { + NVME_NS_DLFEAT_DRB_SHIFT = 0, + NVME_NS_DLFEAT_WZDS_SHIFT = 3, + NVME_NS_DLFEAT_GDS_SHIFT = 4, + NVME_NS_DLFEAT_RSVD5_SHIFT = 5, + NVME_NS_DLFEAT_DRB_MASK = 0x7, + NVME_NS_DLFEAT_WZDS_MASK = 0x1, + NVME_NS_DLFEAT_GDS_MASK = 0x1, + NVME_NS_DLFEAT_RSVD5_MASK = 0x7, + NVME_NS_DLFEAT_RB = NVME_VAL(NS_DLFEAT_DRB), + NVME_NS_DLFEAT_RB_NR = 0, + NVME_NS_DLFEAT_RB_ALL_0S = 1, + NVME_NS_DLFEAT_RB_ALL_FS = 2, + NVME_NS_DLFEAT_WRITE_ZEROES = NVME_VAL(NS_DLFEAT_WZDS), + NVME_NS_DLFEAT_CRC_GUARD = NVME_VAL(NS_DLFEAT_GDS), +}; + +#define NVME_NS_DLFEAT_DRB(dlfeat) NVME_GET(dlfeat, NS_DLFEAT_DRB) +#define NVME_NS_DLFEAT_WZDS(dlfeat) NVME_GET(dlfeat, NS_DLFEAT_WZDS) +#define NVME_NS_DLFEAT_GDS(dlfeat) NVME_GET(dlfeat, NS_DLFEAT_GDS) +#define NVME_NS_DLFEAT_RSVD5(dlfeat) NVME_GET(dlfeat, NS_DLFEAT_RSVD5) + +/** + * enum nvme_id_ns_nstat - Namespace Status + * @NVME_NS_NSTAT_NRDY_SHIFT: NRDY shift + * @NVME_NS_NSTAT_IOI_SHIFT: IOI shift + * @NVME_NS_NSTAT_RSVD3_SHIFT: Reserved shift + * @NVME_NS_NSTAT_NRDY_MASK: NRDY mask + * @NVME_NS_NSTAT_IOI_MASK: IOI mask + * @NVME_NS_NSTAT_RSVD3_MASK: Reserved mask + */ +enum nvme_id_ns_nstat { + NVME_NS_NSTAT_NRDY_SHIFT = 0, + NVME_NS_NSTAT_IOI_SHIFT = 1, + NVME_NS_NSTAT_RSVD3_SHIFT = 3, + NVME_NS_NSTAT_NRDY_MASK = 0x1, + NVME_NS_NSTAT_IOI_MASK = 0x3, + NVME_NS_NSTAT_RSVD3_MASK = 0x1f, +}; + +#define NVME_NS_NSTAT_NRDY(nstat) NVME_GET(nstat, NS_NSTAT_NRDY) +#define NVME_NS_NSTAT_IOI(nstat) NVME_GET(nstat, NS_NSTAT_IOI) +#define NVME_NS_NSTAT_RSVD3(nstat) NVME_GET(nstat, NS_NSTAT_RSVD3) + +/** + * enum nvme_id_ns_kpios - Key Per I/O Status + * @NVME_NS_KPIOS_KPIOENS_SHIFT: Shift amount to get Key Per I/O Enabled + * in Namespace from the + * &struct nvme_id_ns.kpios field. + * @NVME_NS_KPIOS_KPIOENS_MASK: Mask to get Key Per I/O Enabled in Namespace + * from the &struct nvme_id_ns.kpios field. + * @NVME_NS_KPIOS_KPIOSNS_SHIFT: Shift amount to get Key Per I/O + * Supported in Namespace from the + * &struct nvme_id_ns.kpios field. + * @NVME_NS_KPIOS_KPIOSNS_MASK: Mask to get Key Per I/O Supported in Namespace + * from the &struct nvme_id_ns.kpios field. + * @NVME_NS_KPIOS_RSVD2_SHIFT: Shift amount to get Reserved + * @NVME_NS_KPIOS_RSVD2_MASK: Mask to get Reserved + */ +enum nvme_id_ns_kpios { + NVME_NS_KPIOS_KPIOENS_SHIFT = 0, + NVME_NS_KPIOS_KPIOENS_MASK = 0x1, + NVME_NS_KPIOS_KPIOSNS_SHIFT = 1, + NVME_NS_KPIOS_KPIOSNS_MASK = 0x1, + NVME_NS_KPIOS_RSVD2_SHIFT = 2, + NVME_NS_KPIOS_RSVD2_MASK = 0x3f, +}; + +#define NVME_NS_KPIOS_KPIOENS(kpios) NVME_GET(kpios, NS_KPIOS_KPIOENS) +#define NVME_NS_KPIOS_KPIOSNS(kpios) NVME_GET(kpios, NS_KPIOS_KPIOSNS) +#define NVME_NS_KPIOS_RSVD2(kpios) NVME_GET(kpios, NS_KPIOS_RSVD2) + +/** + * enum nvme_id_ns_attr - Specifies attributes of the namespace. + * @NVME_NS_NSATTR_CWP_SHIFT: CWP shift + * @NVME_NS_NSATTR_RSVD1_SHIFT: Reserved shift + * @NVME_NS_NSATTR_CWP_MASK: CWP mask + * @NVME_NS_NSATTR_RSVD1_MASK: Reserved mask + * @NVME_NS_NSATTR_WRITE_PROTECTED: If set, then the namespace is currently + * write protected and all write access to the + * namespace shall fail. + */ +enum nvme_id_ns_attr { + NVME_NS_NSATTR_CWP_SHIFT = 0, + NVME_NS_NSATTR_RSVD1_SHIFT = 1, + NVME_NS_NSATTR_CWP_MASK = 0x1, + NVME_NS_NSATTR_RSVD1_MASK = 0x7f, + NVME_NS_NSATTR_WRITE_PROTECTED = NVME_VAL(NS_NSATTR_CWP), +}; + +#define NVME_NS_NSATTR_CWP(nsattr) NVME_GET(nsattr, NS_NSATTR_CWP) +#define NVME_NS_NSATTR_RSVD1(nsattr) NVME_GET(nsattr, NS_NSATTR_RSVD1) + +/** + * struct nvme_ns_id_desc - Namespace identifier type descriptor + * @nidt: Namespace Identifier Type, see &enum nvme_ns_id_desc_nidt + * @nidl: Namespace Identifier Length contains the length in bytes of the + * &struct nvme_id_ns.nid. + * @rsvd: Reserved + * @nid: Namespace Identifier contains a value that is globally unique and + * assigned to the namespace when the namespace is created. The length + * is defined in &struct nvme_id_ns.nidl. + */ +struct nvme_ns_id_desc { + __u8 nidt; + __u8 nidl; + __le16 rsvd; + __u8 nid[]; +} __attribute__((packed)); + +/** + * enum nvme_ns_id_desc_nidt - Known namespace identifier types + * @NVME_NIDT_EUI64: IEEE Extended Unique Identifier, the NID field contains a + * copy of the EUI64 field in the struct nvme_id_ns.eui64. + * @NVME_NIDT_NGUID: Namespace Globally Unique Identifier, the NID field + * contains a copy of the NGUID field in + * struct nvme_id_ns.nguid. + * @NVME_NIDT_UUID: The NID field contains a 128-bit Universally Unique + * Identifier (UUID) as specified in RFC 4122. + * @NVME_NIDT_CSI: The NID field contains the command set identifier. + */ +enum nvme_ns_id_desc_nidt { + NVME_NIDT_EUI64 = 1, + NVME_NIDT_NGUID = 2, + NVME_NIDT_UUID = 3, + NVME_NIDT_CSI = 4, +}; + +/** + * enum nvme_ns_id_desc_nidt_lens - Namespace Identifier Descriptor Type Lengths + * @NVME_NIDT_EUI64_LEN: IEEE Extended Unique Identifier length (8 bytes) + * @NVME_NIDT_NGUID_LEN: Namespace Globally Unique Identifier length + * (16 bytes) + * @NVME_NIDT_UUID_LEN: Universally Unique Identifier length (16 bytes) + * @NVME_NIDT_CSI_LEN: Command Set Identifier length (1 byte) + */ +enum nvme_ns_id_desc_nidt_lens { + NVME_NIDT_EUI64_LEN = 8, + NVME_NIDT_NGUID_LEN = 16, + NVME_NIDT_UUID_LEN = 16, + NVME_NIDT_CSI_LEN = 1, +}; + +/** + * struct nvme_nvmset_attr - NVM Set Attributes Entry + * @nvmsetid: NVM Set Identifier + * @endgid: Endurance Group Identifier + * @rsvd4: Reserved + * @rr4kt: Random 4 KiB Read Typical indicates the typical + * time to complete a 4 KiB random read in 100 nanosecond units + * when the NVM Set is in a Predictable Latency Mode Deterministic + * Window and there is 1 outstanding command per NVM Set. + * @ows: Optimal Write Size + * @tnvmsetcap: Total NVM Set Capacity + * @unvmsetcap: Unallocated NVM Set Capacity + * @rsvd48: Reserved + */ +struct nvme_nvmset_attr { + __le16 nvmsetid; + __le16 endgid; + __u8 rsvd4[4]; + __le32 rr4kt; + __le32 ows; + __u8 tnvmsetcap[16]; + __u8 unvmsetcap[16]; + __u8 rsvd48[80]; +}; + +/** + * struct nvme_id_nvmset_list - NVM set list + * @nid: Nvmset id + * @rsvd1: Reserved + * @ent: nvmset id list + */ +struct nvme_id_nvmset_list { + __u8 nid; + __u8 rsvd1[127]; + struct nvme_nvmset_attr ent[NVME_ID_NVMSET_LIST_MAX]; +}; + +/** + * struct nvme_id_independent_id_ns - Identify - I/O Command Set Independent + * Identify Namespace Data Structure + * @nsfeat: common namespace features + * @nmic: Namespace Multi-path I/O and Namespace + * Sharing Capabilities + * @rescap: Reservation Capabilities + * @fpi: Format Progress Indicator + * @anagrpid: ANA Group Identifier + * @nsattr: Namespace Attributes + * @rsvd9: reserved + * @nvmsetid: NVM Set Identifier + * @endgid: Endurance Group Identifier + * @nstat: Namespace Status + * @kpios: Key Per I/O Status + * @maxkt: Maximum Key Tag + * @rsvd18: Reserved + * @rgrpid: Reachability Group Identifier + * @rsvd24: Reserved + */ +struct nvme_id_independent_id_ns { + __u8 nsfeat; + __u8 nmic; + __u8 rescap; + __u8 fpi; + __le32 anagrpid; + __u8 nsattr; + __u8 rsvd9; + __le16 nvmsetid; + __le16 endgid; + __u8 nstat; + __u8 kpios; + __le16 maxkt; + __u8 rsvd18[2]; + __le32 rgrpid; + __u8 rsvd24[4072]; +}; + +/** + * enum nvme_id_ind_nsfeat - This field defines features of the namespace. + * @NVME_IND_NSFEAT_RSVD0_SHIFT: RSVD0 shift + * @NVME_IND_NSFEAT_UIDREUSE_SHIFT: UIDREUSE shift + * @NVME_IND_NSFEAT_RMEDIA_SHIFT: RMEDIA shift + * @NVME_IND_NSFEAT_VWCNP_SHIFT: VWCNP shift + * @NVME_IND_NSFEAT_RSVD6_SHIFT: RSVD6 shift + * @NVME_IND_NSFEAT_RSVD0_MASK: RSVD0 mask + * @NVME_IND_NSFEAT_UIDREUSE_MASK: UIDREUSE mask + * @NVME_IND_NSFEAT_RMEDIA_MASK: RMEDIA mask + * @NVME_IND_NSFEAT_VWCNP_MASK: VWCNP mask + * @NVME_IND_NSFEAT_RSVD6_MASK: RSVD6 mask + */ +enum nvme_id_ind_nsfeat { + NVME_IND_NSFEAT_RSVD0_SHIFT = 0, + NVME_IND_NSFEAT_UIDREUSE_SHIFT = 3, + NVME_IND_NSFEAT_RMEDIA_SHIFT = 4, + NVME_IND_NSFEAT_VWCNP_SHIFT = 5, + NVME_IND_NSFEAT_RSVD6_SHIFT = 6, + NVME_IND_NSFEAT_RSVD0_MASK = 0x7, + NVME_IND_NSFEAT_UIDREUSE_MASK = 0x1, + NVME_IND_NSFEAT_RMEDIA_MASK = 0x1, + NVME_IND_NSFEAT_VWCNP_MASK = 0x1, + NVME_IND_NSFEAT_RSVD6_MASK = 0x3, +}; + +#define NVME_IND_NSFEAT_RSVD0(nsfeat) NVME_GET(nsfeat, IND_NSFEAT_RSVD0) +#define NVME_IND_NSFEAT_UIDREUSE(nsfeat) NVME_GET(nsfeat, IND_NSFEAT_UIDREUSE) +#define NVME_IND_NSFEAT_RMEDIA(nsfeat) NVME_GET(nsfeat, IND_NSFEAT_RMEDIA) +#define NVME_IND_NSFEAT_VWCNP(nsfeat) NVME_GET(nsfeat, IND_NSFEAT_VWCNP) +#define NVME_IND_NSFEAT_RSVD6(nsfeat) NVME_GET(nsfeat, IND_NSFEAT_RSVD6) + +/** + * struct nvme_id_ns_granularity_desc - Namespace Granularity Descriptor + * @nszegran: Namespace Size Granularity + * @ncapgran: Namespace Capacity Granularity + */ +struct nvme_id_ns_granularity_desc { + __le64 nszegran; + __le64 ncapgran; +}; + +/** + * struct nvme_id_ns_granularity_list - Namespace Granularity List + * @attributes: Namespace Granularity Attributes + * @num_descriptors: Number of Descriptors + * @rsvd5: reserved + * @entry: Namespace Granularity Descriptor + * @rsvd1056: reserved + */ +struct nvme_id_ns_granularity_list { + __le32 attributes; + __u8 num_descriptors; + __u8 rsvd5[27]; + struct nvme_id_ns_granularity_desc entry[NVME_ID_ND_DESCRIPTOR_MAX]; + __u8 rsvd1056[3040]; +}; + +/** + * struct nvme_id_uuid_list_entry - UUID List Entry + * @header: UUID Lists Entry Header + * @rsvd1: reserved + * @uuid: 128-bit Universally Unique Identifier + */ +struct nvme_id_uuid_list_entry { + __u8 header; + __u8 rsvd1[15]; + __u8 uuid[16]; +}; + +/** + * enum nvme_id_uuid - Identifier Association + * @NVME_ID_UUID_HDR_ASSOCIATION_SHIFT: + * @NVME_ID_UUID_HDR_ASSOCIATION_MASK: + * @NVME_ID_UUID_ASSOCIATION_NONE: + * @NVME_ID_UUID_ASSOCIATION_VENDOR: + * @NVME_ID_UUID_ASSOCIATION_SUBSYSTEM_VENDOR: + */ +enum nvme_id_uuid { + NVME_ID_UUID_HDR_ASSOCIATION_SHIFT = 0, + NVME_ID_UUID_HDR_ASSOCIATION_MASK = 0x3, + NVME_ID_UUID_ASSOCIATION_NONE = 0, + NVME_ID_UUID_ASSOCIATION_VENDOR = 1, + NVME_ID_UUID_ASSOCIATION_SUBSYSTEM_VENDOR = 2, +}; + +#define NVME_ID_UUID_HDR_ASSOCIATION(uuid) \ + NVME_GET(uuid, ID_UUID_HDR_ASSOCIATION) + +/** + * struct nvme_id_uuid_list - UUID list + * @rsvd0: reserved + * @entry: UUID list entry + */ +struct nvme_id_uuid_list { + __u8 rsvd0[32]; + struct nvme_id_uuid_list_entry entry[NVME_ID_UUID_LIST_MAX]; +}; + +/** + * struct nvme_underlying_ns_entry - Underlying Namespace Entry Data + * Structure + * @unsnqn: Underlying NVM Subsystem NQN (UNSNQN) + * @nsid: Namespace Identifier (NSID) of the Underlying Namespace + * @cntlid: Controller ID (CNTLID) of a controller able to attach @nsid + * @rsvd58: Reserved + * @idx: Index (IDX) into the list of reportable Underlying Namespaces + */ +struct nvme_underlying_ns_entry { + __u8 unsnqn[NVME_NQN_LENGTH]; + __le32 nsid; + __le16 cntlid; + __u8 rsvd58[56]; + __le16 idx; +}; + +/** + * struct nvme_underlying_ns_list - Underlying Namespace List Data Structure + * (CNS 1Dh) + * @genctr: Generation Counter (GENCTR) + * @nument: Number Entries (NUMENT) + * @rsvd10: Reserved + * @entries: Underlying Namespace list, see &struct + * nvme_underlying_ns_entry. Reportable up to + * %NVME_UNDERLYING_NS_LIST_MAX entries. + */ +struct nvme_underlying_ns_list { + __le64 genctr; + __le16 nument; + __u8 rsvd10[6]; + struct nvme_underlying_ns_entry entries[NVME_UNDERLYING_NS_LIST_MAX]; +}; + +/** + * struct nvme_fabrics_transport_entry - Underlying Fabrics Transport Entry + * Data Structure + * @traddr: Transport Address (TRADDR) + * @tsas: Transport Specific Address Subtype (TSAS) + * @pidup: Port ID of the Underlying Port (PIDUP) + * @trtype: Transport Type (TRTYPE), see &enum nvmf_trtype + * @adrfam: Transport Address Family (ADRFAM), see &enum nvmf_addr_family + * @treq: Transport Requirements (TREQ), see &enum nvmf_treq + * @rsvd517: Reserved + */ +struct nvme_fabrics_transport_entry { + __u8 traddr[NVMF_TRADDR_SIZE]; + __u8 tsas[NVMF_TSAS_SIZE]; + __le16 pidup; + __u8 trtype; + __u8 adrfam; + __u8 treq; + __u8 rsvd517[59]; +}; + +/** + * struct nvme_ports_list - Ports List Data Structure (CNS 1Eh) + * @genctr: Generation Counter (GENCTR) + * @nument: Number Entries (NUMENT) + * @rsvd10: Reserved + * @entries: Underlying Fabrics Transport Entry list, see &struct + * nvme_fabrics_transport_entry + */ +struct nvme_ports_list { + __le64 genctr; + __le16 nument; + __u8 rsvd10[6]; + struct nvme_fabrics_transport_entry entries[]; +}; + +/** + * struct nvme_supported_ctrl_state_formats - Supported Controller State + * Formats Data Structure (CNS 20h) + * @nv: Number of Versions (NV) in the NVMe Controller State Version + * list at the start of @data + * @nuuid: Number of UUIDs (NUUID) in the Vendor Specific Controller + * State UUID Supported list, immediately following the NVMe + * Controller State Version list in @data + * @data: NVMe Controller State Version list (@nv &__le16 entries) + * immediately followed by the Vendor Specific Controller State + * UUID Supported list (@nuuid 128-bit UUID entries) + */ +struct nvme_supported_ctrl_state_formats { + __u8 nv; + __u8 nuuid; + __u8 data[4094]; +}; + +/** + * struct nvme_exported_nvm_subsys_template_uuid_list - Exported NVM + * Subsystem Template UUID List data structure (CNS 22h) + * @rsvd0: Reserved + * @enst: Exported NVM Subsystem Template UUID list, up to 255 entries, + * listed in ascending order. An entry that is not reserved and + * is cleared to 0h indicates the end of the list. + */ +struct nvme_exported_nvm_subsys_template_uuid_list { + __u8 rsvd0[16]; + __u8 enst[255][16]; +}; + +/** + * struct nvme_ctrl_list - Controller List + * @num: Number of Identifiers + * @identifier: NVM subsystem unique controller identifier + */ +struct nvme_ctrl_list { + __le16 num; + __le16 identifier[NVME_ID_CTRL_LIST_MAX]; +}; + +/** + * struct nvme_ns_list - Namespace List + * @ns: Namespace Identifier + */ +struct nvme_ns_list { + __le32 ns[NVME_ID_NS_LIST_MAX]; +}; + +/** + * enum nvme_id_ctrl_nvm_lbamqf - LBA Migration Queue Format + * @NVME_ID_CTRL_NVM_LBAMQF_TYPE_0: + * @NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MIN: + * @NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MAX: + */ +enum nvme_id_ctrl_nvm_lbamqf { + NVME_ID_CTRL_NVM_LBAMQF_TYPE_0 = 0x0, + NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MIN = 0xc0, + NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MAX = 0xff, +}; + +/** + * enum nvme_id_ctrl_nvm_rla - Rate Limiting Attributes + * @NVME_ID_CTRL_NVM_RLA_HLS_SHIFT: Shift amount to get Hard Limit Support + * (HLS) + * @NVME_ID_CTRL_NVM_RLA_HLS_MASK: Mask to get HLS + * @NVME_ID_CTRL_NVM_RLA_SLS_SHIFT: Shift amount to get Soft Limit Support + * (SLS) + * @NVME_ID_CTRL_NVM_RLA_SLS_MASK: Mask to get SLS + */ +enum nvme_id_ctrl_nvm_rla { + NVME_ID_CTRL_NVM_RLA_HLS_SHIFT = 0, + NVME_ID_CTRL_NVM_RLA_HLS_MASK = 0x1, + NVME_ID_CTRL_NVM_RLA_SLS_SHIFT = 1, + NVME_ID_CTRL_NVM_RLA_SLS_MASK = 0x1, +}; + +#define NVME_ID_CTRL_NVM_RLA_HLS(rla) NVME_GET(rla, ID_CTRL_NVM_RLA_HLS) +#define NVME_ID_CTRL_NVM_RLA_SLS(rla) NVME_GET(rla, ID_CTRL_NVM_RLA_SLS) + +/** + * enum nvme_id_ctrl_nvm_kpiocap - Key Per I/O Capabilities + * @NVME_ID_CTRL_NVM_KPIOCAP_KPIOS_SHIFT: Shift amount to get Key Per I/O + * Supported (KPIOS) + * @NVME_ID_CTRL_NVM_KPIOCAP_KPIOS_MASK: Mask to get KPIOS + * @NVME_ID_CTRL_NVM_KPIOCAP_KPIOSC_SHIFT: Shift amount to get Key Per I/O + * Scope (KPIOSC) + * @NVME_ID_CTRL_NVM_KPIOCAP_KPIOSC_MASK: Mask to get KPIOSC + */ +enum nvme_id_ctrl_nvm_kpiocap { + NVME_ID_CTRL_NVM_KPIOCAP_KPIOS_SHIFT = 0, + NVME_ID_CTRL_NVM_KPIOCAP_KPIOS_MASK = 0x1, + NVME_ID_CTRL_NVM_KPIOCAP_KPIOSC_SHIFT = 1, + NVME_ID_CTRL_NVM_KPIOCAP_KPIOSC_MASK = 0x1, +}; + +#define NVME_ID_CTRL_NVM_KPIOCAP_KPIOS(kpiocap) \ + NVME_GET(kpiocap, ID_CTRL_NVM_KPIOCAP_KPIOS) +#define NVME_ID_CTRL_NVM_KPIOCAP_KPIOSC(kpiocap) \ + NVME_GET(kpiocap, ID_CTRL_NVM_KPIOCAP_KPIOSC) + +/** + * enum nvme_id_ctrl_nvm_aocs - Admin Optional Command Support + * @NVME_ID_CTRL_NVM_AOCS_RALBAS_SHIFT: Shift amount to get Reporting + * Allocated LBA Supported (RALBAS) + * @NVME_ID_CTRL_NVM_AOCS_RSVD1_SHIFT: Shift amount to get Reserved + * @NVME_ID_CTRL_NVM_AOCS_RALBAS_MASK: Mask to get RALBAS + * @NVME_ID_CTRL_NVM_AOCS_RSVD1_MASK: Mask to get Reserved + */ +enum nvme_id_ctrl_nvm_aocs { + NVME_ID_CTRL_NVM_AOCS_RALBAS_SHIFT = 0, + NVME_ID_CTRL_NVM_AOCS_RSVD1_SHIFT = 1, + NVME_ID_CTRL_NVM_AOCS_RALBAS_MASK = 0x1, + NVME_ID_CTRL_NVM_AOCS_RSVD1_MASK = 0x7fff, +}; + +#define NVME_ID_CTRL_NVM_AOCS_RALBAS(aocs) \ + NVME_GET(aocs, ID_CTRL_NVM_AOCS_RALBAS) +#define NVME_ID_CTRL_NVM_AOCS_RSVD1(aocs) NVME_GET(aocs, ID_CTRL_NVM_AOCS_RSVD1) + +/** + * struct nvme_id_ctrl_nvm - I/O Command Set Specific Identify Controller data + * structure + * @vsl: Verify Size Limit + * @wzsl: Write Zeroes Size Limit + * @wusl: Write Uncorrectable Size Limit + * @dmrl: Dataset Management Ranges Limit + * @dmrsl: Dataset Management Range Size Limit + * @dmsl: Dataset Management Size Limit + * @kpiocap: Key Per I/O Capabilities + * @wzdsl: Write Zeroes With Deallocate Size Limit + * @aocs: Admin Optional Command Support + * @ver: Version + * @lbamqf: LBA Migration Queue Format + * @rla: Rate Limiting Attributes, see &enum nvme_id_ctrl_nvm_rla + * @slmc: Soft Limit Maximum Controllers (0's based), valid only if SLS is + * set + * @rsvd28: Reserved + */ +struct nvme_id_ctrl_nvm { + __u8 vsl; + __u8 wzsl; + __u8 wusl; + __u8 dmrl; + __le32 dmrsl; + __le64 dmsl; + __u8 kpiocap; + __u8 wzdsl; + __le16 aocs; + __le32 ver; + __u8 lbamqf; + __u8 rla; + __le16 slmc; + __u8 rsvd28[4068]; +}; + +/** + * enum nvme_primary_ctrl_cap_crt - Controller Resource Types + * @NVME_PRIMARY_CTRL_CAP_CRT_VQRS_SHIFT: Shift amount to get VQRS + * @NVME_PRIMARY_CTRL_CAP_CRT_VQRS_MASK: Mask to get VQRS + * @NVME_PRIMARY_CTRL_CAP_CRT_VIRS_SHIFT: Shift amount to get VIRS + * @NVME_PRIMARY_CTRL_CAP_CRT_VIRS_MASK: Mask to get VIRS + * @NVME_PRIMARY_CTRL_CAP_CRT_RSVD_SHIFT: Shift amount to get Reserved + * @NVME_PRIMARY_CTRL_CAP_CRT_RSVD_MASK: Mask to get Reserved + */ +enum nvme_primary_ctrl_cap_crt { + NVME_PRIMARY_CTRL_CAP_CRT_VQRS_SHIFT = 0, + NVME_PRIMARY_CTRL_CAP_CRT_VQRS_MASK = 0x1, + NVME_PRIMARY_CTRL_CAP_CRT_VIRS_SHIFT = 1, + NVME_PRIMARY_CTRL_CAP_CRT_VIRS_MASK = 0x1, + NVME_PRIMARY_CTRL_CAP_CRT_RSVD_SHIFT = 2, + NVME_PRIMARY_CTRL_CAP_CRT_RSVD_MASK = 0x3f, +}; + +#define NVME_PRIMARY_CTRL_CAP_CRT_VQRS(crt) \ + NVME_GET(crt, PRIMARY_CTRL_CAP_CRT_VQRS) +#define NVME_PRIMARY_CTRL_CAP_CRT_VIRS(crt) \ + NVME_GET(crt, PRIMARY_CTRL_CAP_CRT_VIRS) +#define NVME_PRIMARY_CTRL_CAP_CRT_RSVD(crt) \ + NVME_GET(crt, PRIMARY_CTRL_CAP_CRT_RSVD) + +/** + * struct nvme_primary_ctrl_cap - Identify - Controller Capabilities Structure + * @cntlid: Controller Identifier + * @portid: Port Identifier + * @crt: Controller Resource Types + * @rsvd5: reserved + * @vqfrt: VQ Resources Flexible Total + * @vqrfa: VQ Resources Flexible Assigned + * @vqrfap: VQ Resources Flexible Allocated to Primary + * @vqprt: VQ Resources Private Total + * @vqfrsm: VQ Resources Flexible Secondary Maximum + * @vqgran: VQ Flexible Resource Preferred Granularity + * @rsvd48: reserved + * @vifrt: VI Resources Flexible Total + * @virfa: VI Resources Flexible Assigned + * @virfap: VI Resources Flexible Allocated to Primary + * @viprt: VI Resources Private Total + * @vifrsm: VI Resources Flexible Secondary Maximum + * @vigran: VI Flexible Resource Preferred Granularity + * @rsvd80: reserved + */ +struct nvme_primary_ctrl_cap { + __le16 cntlid; + __le16 portid; + __u8 crt; + __u8 rsvd5[27]; + __le32 vqfrt; + __le32 vqrfa; + __le16 vqrfap; + __le16 vqprt; + __le16 vqfrsm; + __le16 vqgran; + __u8 rsvd48[16]; + __le32 vifrt; + __le32 virfa; + __le16 virfap; + __le16 viprt; + __le16 vifrsm; + __le16 vigran; + __u8 rsvd80[4016]; +}; + +/** + * enum nvme_secondary_ctrl_scs - Secondary Controller State + * @NVME_SECONDARY_CTRL_SCS_OLS_SHIFT: OLS shift + * @NVME_SECONDARY_CTRL_SCS_RSVD1_SHIFT: Reserved shift + * @NVME_SECONDARY_CTRL_SCS_OLS_MASK: OLS mask + * @NVME_SECONDARY_CTRL_SCS_RSVD1_MASK: Reserved mask + */ +enum nvme_secondary_ctrl_scs { + NVME_SECONDARY_CTRL_SCS_OLS_SHIFT = 0, + NVME_SECONDARY_CTRL_SCS_RSVD1_SHIFT = 1, + NVME_SECONDARY_CTRL_SCS_OLS_MASK = 0x1, + NVME_SECONDARY_CTRL_SCS_RSVD1_MASK = 0x7f, +}; + +#define NVME_SECONDARY_CTRL_SCS_OLS(scs) NVME_GET(scs, SECONDARY_CTRL_SCS_OLS) +#define NVME_SECONDARY_CTRL_SCS_RSVD1(scs) \ + NVME_GET(scs, SECONDARY_CTRL_SCS_RSVD1) + +/** + * struct nvme_secondary_ctrl - Secondary Controller Entry + * @scid: Secondary Controller Identifier + * @pcid: Primary Controller Identifier + * @scs: Secondary Controller State + * @rsvd5: Reserved + * @vfn: Virtual Function Number + * @nvq: Number of VQ Flexible Resources Assigned + * @nvi: Number of VI Flexible Resources Assigned + * @rsvd14: Reserved + */ +struct nvme_secondary_ctrl { + __le16 scid; + __le16 pcid; + __u8 scs; + __u8 rsvd5[3]; + __le16 vfn; + __le16 nvq; + __le16 nvi; + __u8 rsvd14[18]; +}; + +/** + * struct nvme_secondary_ctrl_list - Secondary Controller List + * @num: Number of Identifiers + * @rsvd: Reserved + * @sc_entry: Secondary Controller Entry + */ +struct nvme_secondary_ctrl_list { + __u8 num; + __u8 rsvd[31]; + struct nvme_secondary_ctrl sc_entry[NVME_ID_SECONDARY_CTRL_MAX]; +}; + +/** + * struct nvme_id_iocs - NVMe Identify IO Command Set data structure + * @iocsc: List of supported IO Command Set Combination vectors + */ +struct nvme_id_iocs { + __le64 iocsc[512]; +}; + +/** + * struct nvme_id_domain_attr - Domain Attributes Entry + * @dom_id: Domain Identifier + * @rsvd2: Reserved + * @dom_cap: Total Domain Capacity + * @unalloc_dom_cap: Unallocated Domain Capacity + * @max_egrp_dom_cap: Max Endurance Group Domain Capacity + * @rsvd64: Reserved + */ +struct nvme_id_domain_attr { + __le16 dom_id; + __u8 rsvd2[14]; + __u8 dom_cap[16]; + __u8 unalloc_dom_cap[16]; + __u8 max_egrp_dom_cap[16]; + __u8 rsvd64[64]; +}; + +/** + * struct nvme_id_domain_list - Domain List + * @num: Number of domain attributes + * @rsvd: Reserved + * @domain_attr: List of domain attributes + */ +struct nvme_id_domain_list { + __u8 num; + __u8 rsvd[127]; + struct nvme_id_domain_attr domain_attr[NVME_ID_DOMAIN_LIST_MAX]; +}; + +/** + * struct nvme_id_endurance_group_list - Endurance Group List + * @num: Number of Identifiers + * @identifier: Endurance Group Identifier + */ +struct nvme_id_endurance_group_list { + __le16 num; + __le16 identifier[NVME_ID_ENDURANCE_GROUP_LIST_MAX]; +}; + +/** + * enum nvme_id_ctrl_vsen - Identify Controller Voltage Sensor data + * structure (VSEN1-VSEN4) + * @NVME_CTRL_VSEN_VSRV_SHIFT: Shift amount to get the Voltage Sample Rate + * Value (VSRV) + * @NVME_CTRL_VSEN_VSRV_MASK: Mask to get VSRV + * @NVME_CTRL_VSEN_VSRS_SHIFT: Shift amount to get the Voltage Sample Rate + * Scale (VSRS) + * @NVME_CTRL_VSEN_VSRS_MASK: Mask to get VSRS + * @NVME_CTRL_VSEN_VOLSS_SHIFT: Shift amount to get the Voltage Sample Scale + * (VOLSS) + * @NVME_CTRL_VSEN_VOLSS_MASK: Mask to get VOLSS + * @NVME_CTRL_VSEN_PISL_SHIFT: Shift amount to get the Power Input Supply + * Label (PISL) + * @NVME_CTRL_VSEN_PISL_MASK: Mask to get PISL + * @NVME_CTRL_VSEN_PISV_SHIFT: Shift amount to get the Power Input Supply + * Value (PISV), in units of 0.05 V + * @NVME_CTRL_VSEN_PISV_MASK: Mask to get PISV + */ +enum nvme_id_ctrl_vsen { + NVME_CTRL_VSEN_VSRV_SHIFT = 16, + NVME_CTRL_VSEN_VSRV_MASK = 0xff, + NVME_CTRL_VSEN_VSRS_SHIFT = 24, + NVME_CTRL_VSEN_VSRS_MASK = 0xff, + NVME_CTRL_VSEN_VOLSS_SHIFT = 14, + NVME_CTRL_VSEN_VOLSS_MASK = 0x3, + NVME_CTRL_VSEN_PISL_SHIFT = 12, + NVME_CTRL_VSEN_PISL_MASK = 0x3, + NVME_CTRL_VSEN_PISV_SHIFT = 0, + NVME_CTRL_VSEN_PISV_MASK = 0xfff, +}; + +#define NVME_CTRL_VSEN_VSRV(vsen) NVME_GET(vsen, CTRL_VSEN_VSRV) +#define NVME_CTRL_VSEN_VSRS(vsen) NVME_GET(vsen, CTRL_VSEN_VSRS) +#define NVME_CTRL_VSEN_VOLSS(vsen) NVME_GET(vsen, CTRL_VSEN_VOLSS) +#define NVME_CTRL_VSEN_PISL(vsen) NVME_GET(vsen, CTRL_VSEN_PISL) +#define NVME_CTRL_VSEN_PISV(vsen) NVME_GET(vsen, CTRL_VSEN_PISV) + +/** + * struct nvme_id_directives - Identify Directive - Return Parameters Data + * Structure + * @supported: Identify directive is supported + * @enabled: Identify directive is Enabled + * @rsvd64: Reserved + */ +struct nvme_id_directives { + __u8 supported[32]; + __u8 enabled[32]; + __u8 rsvd64[4032]; +}; + +/** + * enum nvme_identify_cns - Identify - CNS Values + * @NVME_IDENTIFY_CNS_NS: Identify Namespace data + * structure + * @NVME_IDENTIFY_CNS_CTRL: Identify Controller data + * structure + * @NVME_IDENTIFY_CNS_NS_ACTIVE_LIST: Active Namespace ID list + * @NVME_IDENTIFY_CNS_NS_DESC_LIST: Namespace Identification + * Descriptor list + * @NVME_IDENTIFY_CNS_NVMSET_LIST: NVM Set List + * @NVME_IDENTIFY_CNS_CSI_NS: I/O Command Set specific + * Identify + * Namespace data structure + * @NVME_IDENTIFY_CNS_CSI_CTRL: I/O Command Set specific + * Identify Controller data + * structure + * @NVME_IDENTIFY_CNS_CSI_NS_ACTIVE_LIST: Active Namespace ID list + * associated with the specified + * I/O Command Set + * @NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS: I/O Command Set Independent + * Identify + * @NVME_IDENTIFY_CNS_NS_USER_DATA_FORMAT: Namespace user data format + * @NVME_IDENTIFY_CNS_CSI_NS_USER_DATA_FORMAT: I/O Command Set specific user + * data format Namespace data + * structure + * @NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST: Allocated Namespace ID list + * @NVME_IDENTIFY_CNS_ALLOCATED_NS: Identify Namespace data + * structure for the specified + * allocated NSID + * @NVME_IDENTIFY_CNS_NS_CTRL_LIST: Controller List of controllers + * attached to the specified NSID + * @NVME_IDENTIFY_CNS_CTRL_LIST: Controller List of controllers + * that exist in the NVM subsystem + * @NVME_IDENTIFY_CNS_PRIMARY_CTRL_CAP: Primary Controller Capabilities + * data structure for the specified + * primary controller + * @NVME_IDENTIFY_CNS_SECONDARY_CTRL_LIST: Secondary Controller list of + * controllers associated with the + * primary controller processing + * the command + * @NVME_IDENTIFY_CNS_NS_GRANULARITY: A Namespace Granularity List + * @NVME_IDENTIFY_CNS_UUID_LIST: A UUID List + * @NVME_IDENTIFY_CNS_DOMAIN_LIST: Domain List + * @NVME_IDENTIFY_CNS_ENDURANCE_GROUP_ID: Endurance Group List + * @NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS_LIST: I/O Command Set specific + * Allocated Namespace ID list + * @NVME_IDENTIFY_CNS_CSI_ID_NS_DATA_STRUCTURE: I/O Command Set specific ID + * Namespace Data Structure for + * Allocated Namespace ID + * @NVME_IDENTIFY_CNS_COMMAND_SET_STRUCTURE: I/O Command Set data structure + * @NVME_IDENTIFY_CNS_UNDERLYING_NS_LIST: Get Underlying Namespace List + * @NVME_IDENTIFY_CNS_PORTS_LIST: Get Ports List + * @NVME_IDENTIFY_CNS_IOCS_IND_ID_ALLOC_NS: I/O Command Set Independent + * Identify Namespace data + * structure for the specified + * allocated NSID + * @NVME_IDENTIFY_CNS_SUPPORTED_CTRL_STATE_FORMATS: Supported Controller + * State Formats + * identifying the + * supported NVMe + * Controller State data + * structures + * @NVME_IDENTIFY_CNS_UNDERLYING_CTRL_LIST: Get Underlying + * Controller List + * @NVME_IDENTIFY_CNS_EXPORTED_NVM_SUBSYS_TEMPLATE_UUID_LIST: Exported NVM + * Subsystem Template UUID + * List + */ +enum nvme_identify_cns { + NVME_IDENTIFY_CNS_NS = 0x00, + NVME_IDENTIFY_CNS_CTRL = 0x01, + NVME_IDENTIFY_CNS_NS_ACTIVE_LIST = 0x02, + NVME_IDENTIFY_CNS_NS_DESC_LIST = 0x03, + NVME_IDENTIFY_CNS_NVMSET_LIST = 0x04, + NVME_IDENTIFY_CNS_CSI_NS = 0x05, + NVME_IDENTIFY_CNS_CSI_CTRL = 0x06, + NVME_IDENTIFY_CNS_CSI_NS_ACTIVE_LIST = 0x07, + NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS = 0x08, + NVME_IDENTIFY_CNS_NS_USER_DATA_FORMAT = 0x09, + NVME_IDENTIFY_CNS_CSI_NS_USER_DATA_FORMAT = 0x0A, + NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST = 0x10, + NVME_IDENTIFY_CNS_ALLOCATED_NS = 0x11, + NVME_IDENTIFY_CNS_NS_CTRL_LIST = 0x12, + NVME_IDENTIFY_CNS_CTRL_LIST = 0x13, + NVME_IDENTIFY_CNS_PRIMARY_CTRL_CAP = 0x14, + NVME_IDENTIFY_CNS_SECONDARY_CTRL_LIST = 0x15, + NVME_IDENTIFY_CNS_NS_GRANULARITY = 0x16, + NVME_IDENTIFY_CNS_UUID_LIST = 0x17, + NVME_IDENTIFY_CNS_DOMAIN_LIST = 0x18, + NVME_IDENTIFY_CNS_ENDURANCE_GROUP_ID = 0x19, + NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS_LIST = 0x1A, + NVME_IDENTIFY_CNS_CSI_ID_NS_DATA_STRUCTURE = 0x1B, + NVME_IDENTIFY_CNS_COMMAND_SET_STRUCTURE = 0x1C, + NVME_IDENTIFY_CNS_UNDERLYING_NS_LIST = 0x1D, + NVME_IDENTIFY_CNS_PORTS_LIST = 0x1E, + NVME_IDENTIFY_CNS_IOCS_IND_ID_ALLOC_NS = 0x1F, + NVME_IDENTIFY_CNS_SUPPORTED_CTRL_STATE_FORMATS = 0x20, + NVME_IDENTIFY_CNS_UNDERLYING_CTRL_LIST = 0x21, + NVME_IDENTIFY_CNS_EXPORTED_NVM_SUBSYS_TEMPLATE_UUID_LIST = 0x22, +}; + +static inline void +nvme_id_ns_flbas_to_lbaf_inuse(__u8 flbas, __u8 *lbaf_inuse) +{ + *lbaf_inuse = ((NVME_FLBAS_HIGHER(flbas) << 4) | + NVME_FLBAS_LOWER(flbas)); +} diff --git a/libnvme/src/nvme/nvme-types-base.h b/libnvme/src/nvme/nvme-types-base.h index 69a1de1322..dca79a673d 100644 --- a/libnvme/src/nvme/nvme-types-base.h +++ b/libnvme/src/nvme/nvme-types-base.h @@ -11,11 +11,14 @@ */ #pragma once +#include #include #include #include #include +#include +#include /** * DOC: nvme-types-base.h @@ -26,9 +29,7 @@ * Revision 2.4, July 31, 2026 (Ratified) * * This file contains core NVMe types organized by functional area: - * - Helper Macros: NVME_GET, NVME_SET, NVME_CHECK, NVME_VAL * - Controller Registers: CAP, CC, CSTS, and other BAR0 registers - * - Identify Structures: Controller, Namespace, and related data * - Log Pages: SMART, Error, Firmware, and other log structures * - Features: Feature identifiers and feature-specific data * - Commands: Admin and I/O command structures @@ -36,168 +37,9 @@ * - Status & Errors: Status codes and error information */ - #define NVME_UUID_LEN 16 #define NVME_UUID_LEN_STRING 37 /* 1b4e28ba-2fa1-11d2-883f-0016d3cca427 + \0 */ -/** - * NVME_GET() - extract field from complex value - * @value: The original value of a complex field - * @name: The name of the sub-field within an nvme value - * - * By convention, this library defines _SHIFT and _MASK such that mask can be - * applied after the shift to isolate a specific set of bits that decode to a - * sub-field. - * - * Return: The 'name' field from 'value' - */ -#define NVME_GET(value, name) \ - (((value) >> NVME_##name##_SHIFT) & NVME_##name##_MASK) - -/** - * NVME_SET() - set field into complex value - * @value: The value to be set in its completed position - * @name: The name of the sub-field within an nvme value - * - * Return: The 'name' field from 'value' - */ -#define NVME_SET(value, name) \ - (((__u32)(value) & NVME_##name##_MASK) << NVME_##name##_SHIFT) - -/** - * NVMF_GET() - extract field from complex value - * @value: The original value of a complex field - * @name: The name of the sub-field within an nvme value - * - * By convention, this library defines _SHIFT and _MASK such that mask can be - * applied after the shift to isolate a specific set of bits that decode to a - * sub-field. - * - * Returns: The 'name' field from 'value' - */ -#define NVMF_GET(value, name) \ - (((value) >> NVMF_##name##_SHIFT) & NVMF_##name##_MASK) - -/** - * NVMF_SET() - set field into complex value - * @value: The value to be set in its completed position - * @name: The name of the sub-field within an nvme value - * - * Returns: The 'name' field from 'value' - */ -#define NVMF_SET(value, name) \ - (((__u32)(value) & NVMF_##name##_MASK) << NVMF_##name##_SHIFT) - -/** - * NVME_CHECK() - check value to compare field value - * @value: The value to be checked - * @name: The name of the sub-field within an nvme value - * @check: The sub-field value to check - * - * Return: The result of compare the value and the sub-field value - */ -#define NVME_CHECK(value, name, check) ((value) == NVME_##name##_##check) - -/** - * NVME_VAL() - get mask value shifted - * @name: The name of the sub-field within an nvme value - * - * Return: The mask value shifted - */ -#define NVME_VAL(name) ((__u32)NVME_##name##_MASK << NVME_##name##_SHIFT) - -/** - * enum nvme_constants - A place to stash various constant nvme values - * @NVME_NSID_ALL: A broadcast value that is used to specify all - * namespaces - * @NVME_NSID_NONE: The invalid namespace id, for when the nsid - * parameter is not used in a command - * @NVME_UUID_NONE: Use to omit a uuid command parameter - * @NVME_CNTLID_NONE: Use to omit a cntlid command parameter - * @NVME_CNSSPECID_NONE: Use to omit a cns_specific_id command parameter - * @NVME_LOG_LSP_NONE: Use to omit a log lsp command parameter - * @NVME_LOG_LSI_NONE: Use to omit a log lsi command parameter - * @NVME_LOG_LPO_NONE: Use to omit a log lpo command parameter - * @NVME_IDENTIFY_DATA_SIZE: The transfer size for nvme identify commands - * @NVME_LOG_SUPPORTED_LOG_PAGES_MAX: The largest possible index in the supported - * log pages log. - * @NVME_ID_NVMSET_LIST_MAX: The largest possible nvmset index in identify - * nvmeset - * @NVME_ID_UUID_LIST_MAX: The largest possible uuid index in identify - * uuid list - * @NVME_ID_CTRL_LIST_MAX: The largest possible controller index in - * identify controller list - * @NVME_ID_NS_LIST_MAX: The largest possible namespace index in - * identify namespace list - * @NVME_ID_SECONDARY_CTRL_MAX: The largest possible secondary controller index - * in identify secondary controller - * @NVME_ID_DOMAIN_LIST_MAX: The largest possible domain index in the - * in domain list - * @NVME_ID_ENDURANCE_GROUP_LIST_MAX: The largest possible endurance group - * index in the endurance group list - * @NVME_ID_ND_DESCRIPTOR_MAX: The largest possible namespace granularity - * index in the namespace granularity descriptor - * list (i.e. with the LBA Format Extension - * Enable field set to 1h in the Host Behavior - * Support feature) - * @NVME_FEAT_LBA_RANGE_MAX: The largest possible LBA range index in feature - * lba range type - * @NVME_LOG_ST_MAX_RESULTS: The largest possible self test result index in the - * device self test log - * @NVME_LOG_FID_SUPPORTED_EFFECTS_MAX: The largest possible FID index in the - * feature identifiers effects log. - * @NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_MAX: The largest possible MI Command index - * in the MI Command effects log. - * @NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_RESERVED: The reserved space in the MI Command - * effects log. - * @NVME_LOG_TELEM_BLOCK_SIZE: Specification defined size of Telemetry Data Blocks - * @NVME_DSM_MAX_RANGES: The largest possible range index in a data-set - * management command - * @NVME_NQN_LENGTH: Max length for NVMe Qualified Name - * @NVMF_TRADDR_SIZE: Max Transport Address size - * @NVMF_TSAS_SIZE: Max Transport Specific Address Subtype size - * @NVME_ZNS_CHANGED_ZONES_MAX: Max number of zones in the changed zones log - * page - * @NVME_STREAM_ID_MAX: Max number of stream IDs - * @NVME_UNDERLYING_NS_LIST_MAX: The maximum number of Underlying Namespace - * Entry data structures reportable in the Get - * Underlying Namespace List Identify data - * structure - */ -enum nvme_constants { - NVME_NSID_ALL = 0xffffffff, - NVME_NSID_NONE = 0, - NVME_UUID_NONE = 0, - NVME_CNTLID_NONE = 0, - NVME_CNSSPECID_NONE = 0, - NVME_LOG_LSP_NONE = 0, - NVME_LOG_LSI_NONE = 0, - NVME_LOG_LPO_NONE = 0, - NVME_IDENTIFY_DATA_SIZE = 4096, - NVME_LOG_SUPPORTED_LOG_PAGES_MAX = 256, - NVME_ID_NVMSET_LIST_MAX = 31, - NVME_ID_UUID_LIST_MAX = 127, - NVME_ID_CTRL_LIST_MAX = 2047, - NVME_ID_NS_LIST_MAX = 1024, - NVME_ID_SECONDARY_CTRL_MAX = 127, - NVME_ID_DOMAIN_LIST_MAX = 31, - NVME_ID_ENDURANCE_GROUP_LIST_MAX = 2047, - NVME_ID_ND_DESCRIPTOR_MAX = 64, - NVME_FEAT_LBA_RANGE_MAX = 64, - NVME_LOG_ST_MAX_RESULTS = 20, - NVME_LOG_TELEM_BLOCK_SIZE = 512, - NVME_LOG_FID_SUPPORTED_EFFECTS_MAX = 256, - NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_MAX = 256, - NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_RESERVED = 768, - NVME_DSM_MAX_RANGES = 256, - NVME_NQN_LENGTH = 256, - NVMF_TRADDR_SIZE = 256, - NVMF_TSAS_SIZE = 256, - NVME_ZNS_CHANGED_ZONES_MAX = 511, - NVME_STREAM_ID_MAX = 0xffff, - NVME_UNDERLYING_NS_LIST_MAX = 12, -}; - /** * enum nvme_csi - Defined command set indicators * @NVME_CSI_NVM: NVM Command Set Indicator @@ -591,7 +433,7 @@ enum nvme_aqa { enum nvme_asq { NVME_ASQ_ASQB_SHIFT = 12, }; -static const __u64 NVME_ASQ_ASQB_MASK = 0xfffffffffffffull; +#define NVME_ASQ_ASQB_MASK 0xfffffffffffffull #define NVME_ASQ_ASQB(asq) NVME_GET(asq, ASQ_ASQB) @@ -602,7 +444,7 @@ static const __u64 NVME_ASQ_ASQB_MASK = 0xfffffffffffffull; enum nvme_acq { NVME_ACQ_ACQB_SHIFT = 12, }; -static const __u64 NVME_ACQ_ACQB_MASK = 0xfffffffffffffull; +#define NVME_ACQ_ACQB_MASK 0xfffffffffffffull #define NVME_ACQ_ACQB(acq) NVME_GET(acq, ACQ_ACQB) @@ -780,7 +622,7 @@ enum nvme_bprsel { enum nvme_bpmbl { NVME_BPMBL_BMBBA_SHIFT = 12, }; -static const __u64 NVME_BPMBL_BMBBA_MASK = 0xfffffffffffffull; +#define NVME_BPMBL_BMBBA_MASK 0xfffffffffffffull #define NVME_BPMBL_BMBBA(bpmbl) NVME_GET(bpmbl, BPMBL_BMBBA) @@ -799,7 +641,7 @@ enum nvme_cmbmsc { NVME_CMBMSC_CRE_MASK = 0x1, NVME_CMBMSC_CMSE_MASK = 0x1, }; -static const __u64 NVME_CMBMSC_CBA_MASK = 0xfffffffffffffull; +#define NVME_CMBMSC_CBA_MASK 0xfffffffffffffull #define NVME_CMBMSC_CRE(cmbmsc) NVME_GET(cmbmsc, CMBMSC_CRE) #define NVME_CMBMSC_CMSE(cmbmsc) NVME_GET(cmbmsc, CMBMSC_CMSE) @@ -1084,4015 +926,11 @@ enum nvme_pmrmsc { NVME_PMRMSC_CBA_SHIFT = 12, NVME_PMRMSC_CMSE_MASK = 0x1, }; -static const __u64 NVME_PMRMSC_CBA_MASK = 0xfffffffffffffull; +#define NVME_PMRMSC_CBA_MASK 0xfffffffffffffULL #define NVME_PMRMSC_CMSE(pmrmsc) NVME_GET(pmrmsc, PMRMSC_CMSE) #define NVME_PMRMSC_CBA(pmrmsc) NVME_GET(pmrmsc, PMRMSC_CBA) -/** - * enum nvme_flbas - This field indicates the formatted LBA size - * @NVME_FLBAS_LOWER_SHIFT: Shift amount to get the format index least significant 4 bits - * @NVME_FLBAS_META_EXT_SHIFT: Shift amount to get the metadata transferred - * @NVME_FLBAS_HIGHER_SHIFT: Shift amount to get the format index most significant 2 bits - * @NVME_FLBAS_RSVD7_SHIFT: Shift amount to get the Reserved - * @NVME_FLBAS_LOWER_MASK: Mask to get the format index least significant 4 bits - * @NVME_FLBAS_META_EXT_MASK: Mask to get the metadata transferred - * @NVME_FLBAS_HIGHER_MASK: Mask to get the format index most significant 2 bits - * @NVME_FLBAS_RSVD7_MASK: Mask to get the Reserved - */ -enum nvme_flbas { - NVME_FLBAS_LOWER_SHIFT = 0, - NVME_FLBAS_META_EXT_SHIFT = 4, - NVME_FLBAS_HIGHER_SHIFT = 5, - NVME_FLBAS_RSVD7_SHIFT = 7, - NVME_FLBAS_LOWER_MASK = 0xf, - NVME_FLBAS_META_EXT_MASK = 0x1, - NVME_FLBAS_HIGHER_MASK = 0x3, - NVME_FLBAS_RSVD7_MASK = 0x1, -}; - -#define NVME_FLBAS_LOWER(flbas) NVME_GET(flbas, FLBAS_LOWER) -#define NVME_FLBAS_META_EXT(flbas) NVME_GET(flbas, FLBAS_META_EXT) -#define NVME_FLBAS_HIGHER(flbas) NVME_GET(flbas, FLBAS_HIGHER) -#define NVME_FLBAS_RSVD7(flbas) NVME_GET(flbas, FLBAS_RSVD7) - -/** - * enum nvme_mc - This field indicates the Metadata capabilities - * @NVME_MC_MTELBAS_SHIFT: MTELBAS shift - * @NVME_MC_MTSBS_SHIFT: MTSBS shift - * @NVME_MC_RSVD2_SHIFT: Reserved shift - * @NVME_MC_MTELBAS_MASK: MTELBAS mask - * @NVME_MC_MTSBS_MASK: MTSBS mask - * @NVME_MC_RSVD2_MASK: Reserved mask - */ -enum nvme_mc { - NVME_MC_MTELBAS_SHIFT = 0, - NVME_MC_MTSBS_SHIFT = 1, - NVME_MC_RSVD2_SHIFT = 2, - NVME_MC_MTELBAS_MASK = 0x1, - NVME_MC_MTSBS_MASK = 0x1, - NVME_MC_RSVD2_MASK = 0x3f, -}; - -#define NVME_MC_MTELBAS(mc) NVME_GET(mc, MC_MTELBAS) -#define NVME_MC_MTSBS(mc) NVME_GET(mc, MC_MTSBS) -#define NVME_MC_RSVD2(mc) NVME_GET(mc, MC_RSVD2) - -/** - * enum nvme_psd_flags - Possible flag values in nvme power state descriptor - * @NVME_PSD_FLAGS_MXPS_SHIFT: MXPS shift - * @NVME_PSD_FLAGS_NOPS_SHIFT: NOPS shift - * @NVME_PSD_FLAGS_RSVD2_SHIFT: Reserved shift - * @NVME_PSD_FLAGS_MXPS_MASK: MXPS mask - * @NVME_PSD_FLAGS_NOPS_MASK: NOPS mask - * @NVME_PSD_FLAGS_RSVD2_MASK: Reserved mask - * @NVME_PSD_FLAGS_MXPS: Indicates the scale for the Maximum Power - * field. If this bit is cleared, then the scale of the - * Maximum Power field is in 0.01 Watts. If this bit is - * set, then the scale of the Maximum Power field is in - * 0.0001 Watts. - * @NVME_PSD_FLAGS_NOPS: Indicates whether the controller processes I/O - * commands in this power state. If this bit is cleared, - * then the controller processes I/O commands in this - * power state. If this bit is set, then the controller - * does not process I/O commands in this power state. - */ -enum nvme_psd_flags { - NVME_PSD_FLAGS_MXPS_SHIFT = 0, - NVME_PSD_FLAGS_NOPS_SHIFT = 1, - NVME_PSD_FLAGS_RSVD2_SHIFT = 2, - NVME_PSD_FLAGS_MXPS_MASK = 0x1, - NVME_PSD_FLAGS_NOPS_MASK = 0x1, - NVME_PSD_FLAGS_RSVD2_MASK = 0x3f, - NVME_PSD_FLAGS_MXPS = NVME_VAL(PSD_FLAGS_MXPS), - NVME_PSD_FLAGS_NOPS = NVME_VAL(PSD_FLAGS_NOPS), -}; - -#define NVME_PSD_FLAGS_MXPS(flags) NVME_GET(flags, PSD_FLAGS_MXPS) -#define NVME_PSD_FLAGS_NOPS(flags) NVME_GET(flags, PSD_FLAGS_NOPS) -#define NVME_PSD_FLAGS_RSVD2(flags) NVME_GET(flags, PSD_FLAGS_RSVD2) - -/** - * enum nvme_psd_ps - Known values for &struct nvme_psd %ips and %aps. Use with - * nvme_psd_power_scale() to extract the power scale field - * to match this enum. - * @NVME_PSD_PS_NOT_REPORTED: Not reported - * @NVME_PSD_PS_100_MICRO_WATT: 0.0001 watt scale - * @NVME_PSD_PS_10_MILLI_WATT: 0.01 watt scale - */ -enum nvme_psd_ps { - NVME_PSD_PS_NOT_REPORTED = 0, - NVME_PSD_PS_100_MICRO_WATT = 1, - NVME_PSD_PS_10_MILLI_WATT = 2, -}; - -/** - * enum nvme_psd_mbws - Known values for &struct nvme_id_psd %mbws, the scale - * for &struct nvme_id_psd.mbw. - * @NVME_PSD_MBWS_1_MIB_S: 1 MiB/second scale - * @NVME_PSD_MBWS_10_MIB_S: 10 MiB/second scale - * @NVME_PSD_MBWS_100_MIB_S: 100 MiB/second scale - * @NVME_PSD_MBWS_1_GIB_S: 1 GiB/second scale - * @NVME_PSD_MBWS_10_GIB_S: 10 GiB/second scale - * @NVME_PSD_MBWS_100_GIB_S: 100 GiB/second scale - * @NVME_PSD_MBWS_SHIFT: MBWS shift - * @NVME_PSD_MBWS_MASK: MBWS mask - */ -enum nvme_psd_mbws { - NVME_PSD_MBWS_1_MIB_S = 0, - NVME_PSD_MBWS_10_MIB_S = 1, - NVME_PSD_MBWS_100_MIB_S = 2, - NVME_PSD_MBWS_1_GIB_S = 3, - NVME_PSD_MBWS_10_GIB_S = 4, - NVME_PSD_MBWS_100_GIB_S = 5, - NVME_PSD_MBWS_SHIFT = 0, - NVME_PSD_MBWS_MASK = 0x7, -}; - -#define NVME_PSD_MBWS(mbws) NVME_GET(mbws, PSD_MBWS) - -/** - * enum nvme_power_measurement_type - Power measurement types. - * @NVME_PMT_NSS_TOTAL_POWER: NVM subsystem total power - * @NVME_PMT_RSVD_MIN: Reserved minimum value - * @NVME_PMT_RSVD_MAX: Reserved maximum value - * @NVME_PMT_VS_MIN: Vendor Specific minimum value - * @NVME_PMT_VS_MAX: Vendor Specific maximum value - */ -enum nvme_power_measurement_type { - NVME_PMT_NSS_TOTAL_POWER = 0x0, - NVME_PMT_RSVD_MIN = 0x1, - NVME_PMT_RSVD_MAX = 0xb, - NVME_PMT_VS_MIN = 0xc, - NVME_PMT_VS_MAX = 0xf, -}; - -/** - * enum nvme_power_measurement_action - Power measurement actions. - * @NVME_PMA_STOP: Stop power measurement - * @NVME_PMA_START: Start power measurement - */ -enum nvme_power_measurement_action { - NVME_PMA_STOP = 0x0, - NVME_PMA_START = 0x1, -}; - -/** - * enum nvme_psd_apws - Specifies APW and APS - * @NVME_PSD_APW_SHIFT: APW shift - * @NVME_PSD_APS_SHIFT: APS shift - * @NVME_PSD_APW_MASK: APW mask - * @NVME_PSD_APS_MASK: APS mask - */ -enum nvme_psd_apws { - NVME_PSD_APW_SHIFT = 0, - NVME_PSD_APS_SHIFT = 6, - NVME_PSD_APW_MASK = 0x7, - NVME_PSD_APS_MASK = 0x3, -}; - -#define NVME_PSD_APW(apws) NVME_GET(apws, PSD_APW) -#define NVME_PSD_APS(apws) NVME_GET(apws, PSD_APS) - -/** - * nvme_psd_power_scale() - power scale occupies the upper 3 bits - * @ps: power scale value - * - * Return: power scale value - */ -static inline unsigned int nvme_psd_power_scale(__u8 ps) -{ - return NVME_PSD_APS(ps); -} - -/** - * enum nvme_psd_workload - Specifies a workload hint in the Power Management - * Feature (see &struct nvme_psd.apw) to inform the - * NVM subsystem or indicate the conditions for the - * active power level. - * @NVME_PSD_WORKLOAD_NP: The workload is unknown or not provided. - * @NVME_PSD_WORKLOAD_1: Extended Idle Period with a Burst of Random Write - * consists of five minutes of idle followed by - * thirty-two random write commands of size 1 MiB - * submitted to a single controller while all other - * controllers in the NVM subsystem are idle, and then - * thirty (30) seconds of idle. - * @NVME_PSD_WORKLOAD_2: Heavy Sequential Writes consists of 80,000 - * sequential write commands of size 128 KiB submitted to - * a single controller while all other controllers in the - * NVM subsystem are idle. The submission queue(s) - * should be sufficiently large allowing the host to - * ensure there are multiple commands pending at all - * times during the workload. - */ -enum nvme_psd_workload { - NVME_PSD_WORKLOAD_NP = 0, - NVME_PSD_WORKLOAD_1 = 1, - NVME_PSD_WORKLOAD_2 = 2, -}; - -/** - * enum nvme_psd_epfr_fqv_ts - Specifies EPFRTS and FQVTS - * @NVME_PSD_EPFRTS_SHIFT: EPFRTS shift - * @NVME_PSD_FQVTS_SHIFT: FQVTS shift - * @NVME_PSD_EPFRTS_MASK: EPFRTS mask - * @NVME_PSD_FQVTS_MASK: FQVTS mask - */ -enum nvme_psd_epfr_fqv_ts { - NVME_PSD_EPFRTS_SHIFT = 0, - NVME_PSD_FQVTS_SHIFT = 4, - NVME_PSD_EPFRTS_MASK = 0xf, - NVME_PSD_FQVTS_MASK = 0xf, -}; - -#define NVME_PSD_EPFRTS(epfr_fqv_ts) NVME_GET(epfr_fqv_ts, PSD_EPFRTS) -#define NVME_PSD_FQVTS(epfr_fqv_ts) NVME_GET(epfr_fqv_ts, PSD_FQVTS) - -/** - * enum nvme_psd_epfvts - Specifies EPFVTS - * @NVME_PSD_EPFVTS_SHIFT: EPFVTS shift - * @NVME_PSD_RSVD4_SHIFT: Reserved shift - * @NVME_PSD_EPFVTS_MASK: EPFVTS mask - * @NVME_PSD_RSVD4_MASK: Reserved mask - */ -enum nvme_psd_epfvts { - NVME_PSD_EPFVTS_SHIFT = 0, - NVME_PSD_RSVD4_SHIFT = 4, - NVME_PSD_EPFVTS_MASK = 0xf, - NVME_PSD_RSVD4_MASK = 0xf, -}; - -#define NVME_PSD_EPFVTS(epfvts) NVME_GET(epfvts, PSD_EPFVTS) -#define NVME_PSD_RSVD4(epfvts) NVME_GET(epfvts, PSD_RSVD4) - -/** - * struct nvme_id_psd - Power Management data structure - * @mp: Maximum Power indicates the sustained maximum power consumed by the - * NVM subsystem in this power state. The power in Watts is equal to - * the value in this field multiplied by the scale specified in the Max - * Power Scale bit (see &enum nvme_psd_flags). A value of 0 indicates - * Maximum Power is not reported. - * @rsvd2: Reserved - * @flags: Additional decoding flags, see &enum nvme_psd_flags. - * @enlat: Entry Latency indicates the maximum latency in microseconds - * associated with entering this power state. A value of 0 indicates - * Entry Latency is not reported. - * @exlat: Exit Latency indicates the maximum latency in microseconds - * associated with exiting this power state. A value of 0 indicates - * Exit Latency is not reported. - * @rrt: Relative Read Throughput indicates the read throughput rank - * associated with this power state relative to others. The value in - * this is less than the number of supported power states. - * @rrl: Relative Read Latency indicates the read latency rank associated - * with this power state relative to others. The value in this field is - * less than the number of supported power states. - * @rwt: Relative Write Throughput indicates write throughput rank associated - * with this power state relative to others. The value in this field is - * less than the number of supported power states - * @rwl: Relative Write Latency indicates the write latency rank associated - * with this power state relative to others. The value in this field is - * less than the number of supported power states - * @idlp: Idle Power indicates the typical power consumed by the NVM - * subsystem over 30 seconds in this power state when idle. - * @ips: Idle Power Scale indicates the scale for &struct nvme_id_psd.idlp, - * see &enum nvme_psd_ps for decoding this field. - * @rsvd19: Reserved - * @actp: Active Power indicates the largest average power consumed by the - * NVM subsystem over a 10 second period in this power state with - * the workload indicated in the Active Power Workload field. - * @apws: Bits 7-6: Active Power Scale(APS) indicates the scale for the &struct - * nvme_id_psd.actp, see &enum nvme_psd_ps for decoding this value. - * Bits 2-0: Active Power Workload(APW) indicates the workload - * used to calculate maximum power for this power state. - * See &enum nvme_psd_workload for decoding this field. - * @epfrt: Emergency power fail recovery time - * @fqvt: Forced quiescence vault time - * @epfvt: Emergency power fail vault time - * @epfr_fqv_ts: Bits 7-4: Forced quiescence vault time scale - * Bits 3-0: Emergency power fail recovery time scale - * @epfvts: Bits 3-0: Emergency power fail vault time scale - * @mbw: Max Bandwidth indicates the maximum bandwidth attainable in this - * power state when submitting MDTS-length sequential read commands - * at a queue depth of the Optimal Aggregated Queue Depth field. The - * bandwidth is equal to the value in this field multiplied by the - * scale indicated in the Max Bandwidth Scale field. A value of 0 - * indicates no maximum bandwidth is reported. - * @mbws: Bits 2-0: Max Bandwidth Scale (MBWS) indicates the scale for - * &struct nvme_id_psd.mbw, see &enum nvme_psd_mbws for decoding - * this field. - * @miiell: Minimum Idle I/O Exit Latency Limit: if the Idle I/O Exit Latency - * Limit capability is supported (see &enum - * nvme_id_ctrl_ctratt.NVME_CTRL_CTRATT_IIELLSS) for this operational - * power state, a non-zero value indicates the minimum supported - * Idle I/O Exit Latency Limit in units of 100 microseconds, and a - * value of 0h indicates there is no minimum. Cleared to 0h for a - * non-operational power state or if the capability is not - * supported. - */ -struct nvme_id_psd { - __le16 mp; - __u8 rsvd2; - __u8 flags; - __le32 enlat; - __le32 exlat; - __u8 rrt; - __u8 rrl; - __u8 rwt; - __u8 rwl; - __le16 idlp; - __u8 ips; - __u8 rsvd19; - __le16 actp; - __u8 apws; - __u8 epfrt; - __u8 fqvt; - __u8 epfvt; - __u8 epfr_fqv_ts; - __u8 epfvts; - __u8 mbw; - __u8 mbws; - __le16 miiell; -}; - -/** - * struct nvme_id_ctrl - Identify Controller data structure - * @vid: PCI Vendor ID, the company vendor identifier that is assigned by - * the PCI SIG. - * @ssvid: PCI Subsystem Vendor ID, the company vendor identifier that is - * assigned by the PCI SIG for the subsystem. - * @sn: Serial Number in ASCII - * @mn: Model Number in ASCII - * @fr: Firmware Revision in ASCII, the currently active firmware - * revision for the NVM subsystem - * @rab: Recommended Arbitration Burst, reported as a power of two - * @ieee: IEEE assigned Organization Unique Identifier - * @cmic: Controller Multipath IO and Namespace Sharing Capabilities of - * the controller and NVM subsystem. See &enum nvme_id_ctrl_cmic. - * @mdts: Max Data Transfer Size is the largest data transfer size. The - * host should not submit a command that exceeds this maximum data - * transfer size. The value is in units of the minimum memory page - * size (CAP.MPSMIN) and is reported as a power of two - * @cntlid: Controller ID, the NVM subsystem unique controller identifier - * associated with the controller. - * @ver: Version, this field contains the value reported in the Version - * register, or property (see &enum nvme_registers %NVME_REG_VS). - * @rtd3r: RTD3 Resume Latency, the expected latency in microseconds to resume - * from Runtime D3 - * @rtd3e: RTD3 Exit Latency, the typical latency in microseconds to enter - * Runtime D3. - * @oaes: Optional Async Events Supported, see @enum nvme_id_ctrl_oaes. - * @ctratt: Controller Attributes, see @enum nvme_id_ctrl_ctratt. - * @rrls: Read Recovery Levels. If a bit is set, then the corresponding - * Read Recovery Level is supported. If a bit is cleared, then the - * corresponding Read Recovery Level is not supported. - * @bpcap: Boot Partition Capabilities, see &enum nvme_id_ctrl_bpcap. - * @chsi: CXL HDM Support Information, see &enum nvme_id_ctrl_chsi. - * @nssl: NVM Subsystem Shutdown Latency (NSSL). This field indicates the - * typical latency in microseconds for an NVM Subsystem Shutdown to - * complete. - * @rsvd108: Reserved - * @plsi: Power Loss Signaling Information (PLSI), see &enum nvme_id_ctrl_plsi - * @cntrltype: Controller Type, see &enum nvme_id_ctrl_cntrltype - * @fguid: FRU GUID, a 128-bit value that is globally unique for a given - * Field Replaceable Unit - * @crdt1: Controller Retry Delay time in 100 millisecond units if CQE CRD - * field is 1 - * @crdt2: Controller Retry Delay time in 100 millisecond units if CQE CRD - * field is 2 - * @crdt3: Controller Retry Delay time in 100 millisecond units if CQE CRD - * field is 3 - * @crcap: Controller Reachability Capabilities (CRCAP), see - * &enum nvme_id_ctrl_crcap - * @ciu: Controller Instance Uniquifier (CIU) - * @cirn: Controller Instance Random Number (CIRN) - * @rsvd144: Reserved - * @rsvd240: Reserved for the NVMe Management Interface specification - * @nvmsr: NVM Subsystem Report, see &enum nvme_id_ctrl_nvmsr - * @vwci: VPD Write Cycle Information, see &enum nvme_id_ctrl_vwci - * @mec: Management Endpoint Capabilities, see &enum nvme_id_ctrl_mec - * @oacs: Optional Admin Command Support,the optional Admin commands and - * features supported by the controller, see &enum nvme_id_ctrl_oacs. - * @acl: Abort Command Limit, the maximum number of concurrently - * executing Abort commands supported by the controller. This is a - * 0's based value. - * @aerl: Async Event Request Limit, the maximum number of concurrently - * outstanding Asynchronous Event Request commands supported by the - * controller This is a 0's based value. - * @frmw: Firmware Updates indicates capabilities regarding firmware - * updates. See &enum nvme_id_ctrl_frmw. - * @lpa: Log Page Attributes, see &enum nvme_id_ctrl_lpa. - * @elpe: Error Log Page Entries, the maximum number of Error Information - * log entries that are stored by the controller. This field is a - * 0's based value. - * @npss: Number of Power States Supported, the number of NVM Express - * power states supported by the controller, indicating the number - * of valid entries in &struct nvme_id_ctrl.psd. This is a 0's - * based value. - * @avscc: Admin Vendor Specific Command Configuration, see - * &enum nvme_id_ctrl_avscc. - * @apsta: Autonomous Power State Transition Attributes, see - * &enum nvme_id_ctrl_apsta. - * @wctemp: Warning Composite Temperature Threshold indicates - * the minimum Composite Temperature field value (see &struct - * nvme_smart_log.critical_comp_time) that indicates an overheating - * condition during which controller operation continues. - * @cctemp: Critical Composite Temperature Threshold, field indicates the - * minimum Composite Temperature field value (see &struct - * nvme_smart_log.critical_comp_time) that indicates a critical - * overheating condition. - * @mtfa: Maximum Time for Firmware Activation indicates the maximum time - * the controller temporarily stops processing commands to activate - * the firmware image, specified in 100 millisecond units. This - * field is always valid if the controller supports firmware - * activation without a reset. - * @hmpre: Host Memory Buffer Preferred Size indicates the preferred size - * that the host is requested to allocate for the Host Memory - * Buffer feature in 4 KiB units. - * @hmmin: Host Memory Buffer Minimum Size indicates the minimum size that - * the host is requested to allocate for the Host Memory Buffer - * feature in 4 KiB units. - * @tnvmcap: Total NVM Capacity, the total NVM capacity in the NVM subsystem. - * The value is in bytes. - * @unvmcap: Unallocated NVM Capacity, the unallocated NVM capacity in the - * NVM subsystem. The value is in bytes. - * @rpmbs: Replay Protected Memory Block Support, see - * &enum nvme_id_ctrl_rpmbs. - * @edstt: Extended Device Self-test Time, if Device Self-test command is - * supported (see &struct nvme_id_ctrl.oacs, %NVME_CTRL_OACS_DSTS), - * then this field indicates the nominal amount of time in one - * minute units that the controller takes to complete an extended - * device self-test operation when in power state 0. - * @dsto: Device Self-test Options, see &enum nvme_id_ctrl_dsto. - * @fwug: Firmware Update Granularity indicates the granularity and - * alignment requirement of the firmware image being updated by the - * Firmware Image Download command. The value is reported in 4 KiB - * units. A value of 0h indicates no information on granularity is - * provided. A value of FFh indicates no restriction - * @kas: Keep Alive Support indicates the granularity of the Keep Alive - * Timer in 100 millisecond units. - * @hctma: Host Controlled Thermal Management Attributes, see - * &enum nvme_id_ctrl_hctm. - * @mntmt: Minimum Thermal Management Temperature indicates the minimum - * temperature, in degrees Kelvin, that the host may request in the - * Thermal Management Temperature 1 field and Thermal Management - * Temperature 2 field of a Set Features command with the Feature - * Identifier field set to %NVME_FEAT_FID_HCTM. - * @mxtmt: Maximum Thermal Management Temperature indicates the maximum - * temperature, in degrees Kelvin, that the host may request in the - * Thermal Management Temperature 1 field and Thermal Management - * Temperature 2 field of the Set Features command with the Feature - * Identifier set to %NVME_FEAT_FID_HCTM. - * @sanicap: Sanitize Capabilities, see &enum nvme_id_ctrl_sanicap - * @hmminds: Host Memory Buffer Minimum Descriptor Entry Size indicates the - * minimum usable size of a Host Memory Buffer Descriptor Entry in - * 4 KiB units. - * @hmmaxd: Host Memory Maximum Descriptors Entries indicates the number of - * usable Host Memory Buffer Descriptor Entries. - * @nsetidmax: NVM Set Identifier Maximum, defines the maximum value of a valid - * NVM Set Identifier for any controller in the NVM subsystem. - * @endgidmax: Endurance Group Identifier Maximum, defines the maximum value of - * a valid Endurance Group Identifier for any controller in the NVM - * subsystem. - * @anatt: ANA Transition Time indicates the maximum amount of time, in - * seconds, for a transition between ANA states or the maximum - * amount of time, in seconds, that the controller reports the ANA - * change state. - * @anacap: Asymmetric Namespace Access Capabilities, see - * &enum nvme_id_ctrl_anacap. - * @anagrpmax: ANA Group Identifier Maximum indicates the maximum value of a - * valid ANA Group Identifier for any controller in the NVM - * subsystem. - * @nanagrpid: Number of ANA Group Identifiers indicates the number of ANA - * groups supported by this controller. - * @pels: Persistent Event Log Size indicates the maximum reportable size - * for the Persistent Event Log. - * @domainid: Domain Identifier indicates the identifier of the domain - * that contains this controller. - * @kpioc: Key Per I/O Capabilities (KPIOC), see &enum nvme_id_ctrl_kpioc - * @rsvd359: Reserved - * @mptfawr: Maximum Processing Time for Firmware Activation Without Reset - * (MPTFAWR). This field shall indicate the estimated maximum time - * in 100 ms units required by the controller to process a Firmware - * Commit command that specifies a value of 011b in the Commit - * Action field - * @rmdca: Restore Manufacturing Configuration Attributes, see &enum - * nvme_id_ctrl_rmdca - * @rsvd363: Reserved - * @megcap: Max Endurance Group Capacity indicates the maximum capacity - * of a single Endurance Group. - * @tmpthha: Temperature Threshold Hysteresis Attributes - * @mupa: Maximum Unlimited Power Attributes - * @cqt: Command Quiesce Time (CQT). This field indicates the expected - * worst-case time in 1 millisecond units for the controller to - * quiesce all outstanding commands after a Keep Alive Timeout or - * other communication loss. - * @cdpa: Configurable Device Personality Attributes: This field - * indicates the Configurable Device Personality feature attributes - * the controller supports. - * @mup: Maximum Unlimited Power: This field specifies the maximum - * power for power state 0 that results from removal of a power - * limit (i.e., the maximum power is not limited). - * @ipmsr: Interval Power Measurement Sample Rate: This field - * indicates the maximum interval between power measurement - * samples used to collect interval power measurements. - * @msmt: Maximum Stop Measurement Time: This field indicates the - * maximum stop measurement time allowed to be specified in the - * SMT field for a Set Features command specifying the Power - * Measurement feature. - * @mnens: Maximum Number of Exported NVM Subsystems - * @mnecpens: Maximum Number of Exported Controllers per Exported NVM - * Subsystem - * @mensnn: Maximum Exported NVM Subsystem Number of Namespaces - * @ensa: Exported NVM Subsystem Attributes - * @endsfs: Exported Namespace Data Structure Formats Supported - * @vsen1: Voltage Sensor 1: indicates the characteristics of Voltage - * Sensor 1, see &struct nvme_id_ctrl_vsds. A value of 0h indicates - * Voltage Sensor 1 is not supported. - * @vsen2: Voltage Sensor 2, see &struct nvme_id_ctrl_vsds. A value of - * 0h indicates Voltage Sensor 2 is not supported. - * @vsen3: Voltage Sensor 3, see &struct nvme_id_ctrl_vsds. A value of - * 0h indicates Voltage Sensor 3 is not supported. - * @vsen4: Voltage Sensor 4, see &struct nvme_id_ctrl_vsds. A value of - * 0h indicates Voltage Sensor 4 is not supported. - * @msvmt: Maximum Stop Voltage Measurement Time: This field indicates - * the maximum stop measurement time in minutes allowed to be - * specified in the SVMT field for a Set Features command - * specifying the Voltage Measurement feature. A value of 0h - * indicates that a maximum stop measurement time is not reported. - * @rsvd424: Reserved - * @sqes: Submission Queue Entry Size, see &enum nvme_id_ctrl_sqes. - * @cqes: Completion Queue Entry Size, see &enum nvme_id_ctrl_cqes. - * @maxcmd: Maximum Outstanding Commands indicates the maximum number of - * commands that the controller processes at one time for a - * particular queue. - * @nn: Number of Namespaces indicates the maximum value of a valid - * nsid for the NVM subsystem. If the MNAN (&struct nvme_id_ctrl.mnan - * field is cleared to 0h, then this field also indicates the - * maximum number of namespaces supported by the NVM subsystem. - * @oncs: Optional NVM Command Support, see &enum nvme_id_ctrl_oncs. - * @fuses: Fused Operation Support, see &enum nvme_id_ctrl_fuses. - * @fna: Format NVM Attributes, see &enum nvme_id_ctrl_fna. - * @vwc: Volatile Write Cache, see &enum nvme_id_ctrl_vwc. - * @awun: Atomic Write Unit Normal indicates the size of the write - * operation guaranteed to be written atomically to the NVM across - * all namespaces with any supported namespace format during normal - * operation. This field is specified in logical blocks and is a - * 0's based value. - * @awupf: Atomic Write Unit Power Fail indicates the size of the write - * operation guaranteed to be written atomically to the NVM across - * all namespaces with any supported namespace format during a - * power fail or error condition. This field is specified in - * logical blocks and is a 0’s based value. - * @icsvscc: NVM Vendor Specific Command Configuration, see - * &enum nvme_id_ctrl_nvscc. - * @nwpc: Namespace Write Protection Capabilities, see - * &enum nvme_id_ctrl_nwpc. - * @acwu: Atomic Compare & Write Unit indicates the size of the write - * operation guaranteed to be written atomically to the NVM across - * all namespaces with any supported namespace format for a Compare - * and Write fused operation. This field is specified in logical - * blocks and is a 0’s based value. - * @cdfs: Copy Descriptor Formats Supported, each bit n means - * controller supports Copy Descriptor Format n. - * @sgls: SGL Support, see &enum nvme_id_ctrl_sgls - * @mnan: Maximum Number of Allowed Namespaces indicates the maximum - * number of namespaces supported by the NVM subsystem. - * @maxdna: Maximum Domain Namespace Attachments indicates the maximum - * of the sum of the number of namespaces attached to each I/O - * controller in the Domain. - * @maxcna: Maximum I/O Controller Namespace Attachments indicates the - * maximum number of namespaces that are allowed to be attached to - * this I/O controller. - * @oaqd: Optimal Aggregated Queue Depth indicates the recommended maximum - * total number of outstanding I/O commands across all I/O queues - * on the controller for optimal operation. - * @rhiri: Recommended Host-Initiated Refresh Interval (RHIRI). If the - * Host-Initiated Refresh capability is supported, then this field - * indicates the recommended time interval in days from last power - * down to the time at which the host should initiate the - * Host-Initiated Refresh operation. If this field is cleared to - * 0h, then this field is not reported. - * @hirt: Host-Initiated Refresh Time (HIRT). If the Host-Initiated - * Refresh capability is supported, then this field indicates the - * nominal amount of time in minutes that the controller takes to - * complete the Host-Initiated Refresh operation. If this field is - * cleared to 0h, then this field is not reported. - * @cmmrtd: Controller Maximum Memory Range Tracking Descriptors indicates - * the maximum number of Memory Range Tracking Descriptors the - * controller supports. - * @nmmrtd: NVM Subsystem Maximum Memory Range Tracking Descriptors - * indicates the maximum number of Memory Range Tracking Descriptors - * the NVM subsystem supports. - * @minmrtg: Minimum Memory Range Tracking Granularity indicates the minimum - * value supported in the Requested Memory Range Tracking - * Granularity (RMRTG) field of the Track Memory Ranges data - * structure. - * @maxmrtg: Maximum Memory Range Tracking Granularity indicates the maximum - * value supported in the Requested Memory Range Tracking - * Granularity (RMRTG) field of the Track Memory Ranges data - * structure. - * @trattr: Tracking Attributes indicates supported attributes for the Track Send - * command and Track Receive command. see &enum nvme_id_ctrl_trattr - * @rsvd577: Reserved - * @mcudmq: Maximum Controller User Data Migration Queues indicates the - * maximum number of User Data Migration Queues supported by the - * controller. - * @mnsudmq: Maximum NVM Subsystem User Data Migration Queues indicates the - * maximum number of User Data Migration Queues supported by the NVM - * subsystem. - * @mcmr: Maximum CDQ Memory Ranges indicates the maximum number of - * memory ranges allowed to be specified by the PRP1 field of a - * Controller Data Queue command. - * @nmcmr: NVM Subsystem Maximum CDQ Memory Ranges indicates the maximum - * number of memory ranges for all Controller Data Queues in the - * NVM subsystem. - * @mcdqpc: Maximum Controller Data Queue PRP Count indicates the maximum - * number of PRPs allowed to be specified in the PRP list in the - * Controller Data Queue command. - * @rsvd588: Reserved - * @subnqn: NVM Subsystem NVMe Qualified Name, UTF-8 null terminated string - * @rsvd1024: Reserved - * @ioccsz: I/O Queue Command Capsule Supported Size, defines the maximum - * I/O command capsule size in 16 byte units. - * @iorcsz: I/O Queue Response Capsule Supported Size, defines the maximum - * I/O response capsule size in 16 byte units. - * @icdoff: In Capsule Data Offset, defines the offset where data starts - * within a capsule. This value is applicable to I/O Queues only. - * @fcatt: Fabrics Controller Attributes, see &enum nvme_id_ctrl_fcatt. - * @msdbd: Maximum SGL Data Block Descriptors indicates the maximum - * number of SGL Data Block or Keyed SGL Data Block descriptors - * that a host is allowed to place in a capsule. A value of 0h - * indicates no limit. - * @ofcs: Optional Fabric Commands Support, see &enum nvme_id_ctrl_ofcs. - * @dctype: Discovery Controller Type (DCTYPE). This field indicates what - * type of Discovery controller the controller is (see enum - * nvme_id_ctrl_dctype) - * @ccrl: Cross-Controller Reset Limit: This field indicates the limit - * on the number of simultaneous in-progress Cross-Controller Reset - * operations this controller is able to cause to be initiated that - * are supported. - * @rsvd1808: Reserved - * @psd: Power State Descriptors, see &struct nvme_id_psd. - * @vs: Vendor Specific - */ -struct nvme_id_ctrl { - __le16 vid; - __le16 ssvid; - char sn[20]; - char mn[40]; - char fr[8]; - __u8 rab; - __u8 ieee[3]; - __u8 cmic; - __u8 mdts; - __le16 cntlid; - __le32 ver; - __le32 rtd3r; - __le32 rtd3e; - __le32 oaes; - __le32 ctratt; - __le16 rrls; - __u8 bpcap; - __u8 chsi; - __le32 nssl; - __u8 rsvd108[2]; - __u8 plsi; - __u8 cntrltype; - __u8 fguid[16]; - __le16 crdt1; - __le16 crdt2; - __le16 crdt3; - __u8 crcap; - __u8 ciu; - __u8 cirn[8]; - __u8 rsvd144[96]; - __u8 rsvd240[13]; - __u8 nvmsr; - __u8 vwci; - __u8 mec; - __le16 oacs; - __u8 acl; - __u8 aerl; - __u8 frmw; - __u8 lpa; - __u8 elpe; - __u8 npss; - __u8 avscc; - __u8 apsta; - __le16 wctemp; - __le16 cctemp; - __le16 mtfa; - __le32 hmpre; - __le32 hmmin; - __u8 tnvmcap[16]; - __u8 unvmcap[16]; - __le32 rpmbs; - __le16 edstt; - __u8 dsto; - __u8 fwug; - __le16 kas; - __le16 hctma; - __le16 mntmt; - __le16 mxtmt; - __le32 sanicap; - __le32 hmminds; - __le16 hmmaxd; - __le16 nsetidmax; - __le16 endgidmax; - __u8 anatt; - __u8 anacap; - __le32 anagrpmax; - __le32 nanagrpid; - __le32 pels; - __le16 domainid; - __u8 kpioc; - __u8 rsvd359; - __le16 mptfawr; - __u8 rmdca; - __u8 rsvd363[5]; - __u8 megcap[16]; - __u8 tmpthha; - __u8 mupa; - __le16 cqt; - __le16 cdpa; - __le16 mup; - __le16 ipmsr; - __le16 msmt; - __le16 mnens; - __le16 mnecpens; - __le32 mensnn; - __u8 ensa; - __u8 endsfs; - __le32 vsen1 __attribute__((packed)); - __le32 vsen2 __attribute__((packed)); - __le32 vsen3 __attribute__((packed)); - __le32 vsen4 __attribute__((packed)); - __le16 msvmt; - __u8 rsvd424[88]; - __u8 sqes; - __u8 cqes; - __le16 maxcmd; - __le32 nn; - __le16 oncs; - __le16 fuses; - __u8 fna; - __u8 vwc; - __le16 awun; - __le16 awupf; - __u8 icsvscc; - __u8 nwpc; - __le16 acwu; - __le16 cdfs; - __le32 sgls; - __le32 mnan; - __u8 maxdna[16]; - __le32 maxcna; - __le32 oaqd; - __u8 rhiri; - __u8 hirt; - __le16 cmmrtd; - __le16 nmmrtd; - __u8 minmrtg; - __u8 maxmrtg; - __u8 trattr; - __u8 rsvd577; - __le16 mcudmq; - __le16 mnsudmq; - __le16 mcmr; - __le16 nmcmr; - __le16 mcdqpc; - __u8 rsvd588[180]; - char subnqn[NVME_NQN_LENGTH]; - __u8 rsvd1024[768]; - - /* Fabrics Only */ - __le32 ioccsz; - __le32 iorcsz; - __le16 icdoff; - __u8 fcatt; - __u8 msdbd; - __le16 ofcs; - __u8 dctype; - __u8 ccrl; - __u8 rsvd1808[240]; - - struct nvme_id_psd psd[32]; - __u8 vs[1024]; -}; - -/** - * enum nvme_cmic - This field indicates the controller multi-path I/O and NS sharing capabilities - * @NVME_CMIC_MULTI_PORT_SHIFT: Shift amount to get the NVM subsystem port - * @NVME_CMIC_MULTI_CTRL_SHIFT: Shift amount to get the controllers - * @NVME_CMIC_MULTI_SRIOV_SHIFT: Shift amount to get the SR-IOV virtual function - * @NVME_CMIC_MULTI_ANA_SHIFT: Shift amount to get the asymmetric namespace access reporting - * @NVME_CMIC_MULTI_RSVD_SHIFT: Shift amount to get the reserved - * @NVME_CMIC_MULTI_PORT_MASK: Mask to get the NVM subsystem port - * @NVME_CMIC_MULTI_CTRL_MASK: Mask to get the controllers - * @NVME_CMIC_MULTI_SRIOV_MASK: Mask to get the SR-IOV virtual function - * @NVME_CMIC_MULTI_ANA_MASK: Mask to get the asymmetric namespace access reporting - * @NVME_CMIC_MULTI_RSVD_MASK: Mask to get the reserved - */ -enum nvme_cmic { - NVME_CMIC_MULTI_PORT_SHIFT = 0, - NVME_CMIC_MULTI_CTRL_SHIFT = 1, - NVME_CMIC_MULTI_SRIOV_SHIFT = 2, - NVME_CMIC_MULTI_ANA_SHIFT = 3, - NVME_CMIC_MULTI_RSVD_SHIFT = 4, - NVME_CMIC_MULTI_PORT_MASK = 0x1, - NVME_CMIC_MULTI_CTRL_MASK = 0x1, - NVME_CMIC_MULTI_SRIOV_MASK = 0x1, - NVME_CMIC_MULTI_ANA_MASK = 0x1, - NVME_CMIC_MULTI_RSVD_MASK = 0xf, -}; - -#define NVME_CMIC_MULTI_PORT(cmic) NVME_GET(cmic, CMIC_MULTI_PORT) -#define NVME_CMIC_MULTI_CTRL(cmic) NVME_GET(cmic, CMIC_MULTI_CTRL) -#define NVME_CMIC_MULTI_SRIOV(cmic) NVME_GET(cmic, CMIC_MULTI_SRIOV) -#define NVME_CMIC_MULTI_ANA(cmic) NVME_GET(cmic, CMIC_MULTI_ANA) -#define NVME_CMIC_MULTI_RSVD(cmic) NVME_GET(cmic, CMIC_MULTI_RSVD) - -/** - * enum nvme_id_ctrl_cmic - Controller Multipath IO and Namespace Sharing - * Capabilities of the controller and NVM subsystem. - * @NVME_CTRL_CMIC_MULTI_PORT: If set, then the NVM subsystem may contain - * more than one NVM subsystem port, otherwise - * the NVM subsystem contains only a single - * NVM subsystem port. - * @NVME_CTRL_CMIC_MULTI_CTRL: If set, then the NVM subsystem may contain - * two or more controllers, otherwise the - * NVM subsystem contains only a single - * controller. An NVM subsystem that contains - * multiple controllers may be used by - * multiple hosts, or may provide multiple - * paths for a single host. - * @NVME_CTRL_CMIC_MULTI_SRIOV: If set, then the controller is associated - * with an SR-IOV Virtual Function, otherwise - * it is associated with a PCI Function - * or a Fabrics connection. - * @NVME_CTRL_CMIC_MULTI_ANA_REPORTING: If set, then the NVM subsystem supports - * Asymmetric Namespace Access Reporting. - */ -enum nvme_id_ctrl_cmic { - NVME_CTRL_CMIC_MULTI_PORT = 1 << 0, - NVME_CTRL_CMIC_MULTI_CTRL = 1 << 1, - NVME_CTRL_CMIC_MULTI_SRIOV = 1 << 2, - NVME_CTRL_CMIC_MULTI_ANA_REPORTING = 1 << 3, -}; - -/** - * enum nvme_id_ctrl_oaes - Optional Asynchronous Events Supported - * @NVME_CTRL_OAES_RSVD0_SHIFT: Shift amount to get Reserved - * @NVME_CTRL_OAES_NSAN_SHIFT: Shift amount to get the Attached Namespace - * Attribute Notices event supported bit - * @NVME_CTRL_OAES_FAN_SHIFT: Shift amount to get the Firmware Activation - * Notices event supported bit - * @NVME_CTRL_OAES_RSVD10_SHIFT:Shift amount to get Reserved - * @NVME_CTRL_OAES_ANACN_SHIFT: Shift amount to get the Asymmetric Namespace - * Access Change Notices event supported bit - * @NVME_CTRL_OAES_PLEAN_SHIFT: Shift amount to get the Predictable Latency - * Event Aggregate Log Change Notices event - * supported bit - * @NVME_CTRL_OAES_LSIAN_SHIFT: Shift amount to get the LBA Status Information - * Alert Notices event supported bit - * @NVME_CTRL_OAES_EGEAN_SHIFT: Shift amount to get the Endurance Group Event - * Aggregate Log Page Change Notices event - * supported bit - * @NVME_CTRL_OAES_NNSS_SHIFT: Shift amount to get the Normal NVM Subsystem - * Shutdown event supported bit - * @NVME_CTRL_OAES_TTHR_SHIFT: Shift amount to get the Temperature Threshold - * Hysteresis Recovery event supported bit - * @NVME_CTRL_OAES_RGCNS_SHIFT: Shift amount to get the Reachability Groups - * Change Notices event supported bit - * @NVME_CTRL_OAES_RSVD18_SHIFT:Shift amount to get Reserved - * @NVME_CTRL_OAES_ANSAN_SHIFT: Shift amount to get the Allocated Namespace - * Attribute Notices event supported bit - * @NVME_CTRL_OAES_CCRCN_SHIFT: Shift amount to get the Cross-Controller Reset - * Completed Notices event supported bit - * @NVME_CTRL_OAES_LHCN_SHIFT: Shift amount to get the Lost Host Communication - * Notices event supported bit - * @NVME_CTRL_OAES_RLCC_SHIFT: Shift amount to get the Rate Limiting - * Configuration Change event supported bit - * @NVME_CTRL_OAES_RSVD23_SHIFT:Shift amount to get Reserved - * @NVME_CTRL_OAES_ZDCN_SHIFT: Shift amount to get the Zone Descriptor Changed - * Notices event supported bit - * @NVME_CTRL_OAES_RSVD28_SHIFT:Shift amount to get Reserved - * @NVME_CTRL_OAES_DLPCN_SHIFT: Shift amount to get the Discovery Log Page - * Change Notification event supported bit - * @NVME_CTRL_OAES_RSVD0_MASK: Mask to get Reserved - * @NVME_CTRL_OAES_NSAN_MASK: Mask to get the Attached Namespace Attribute - * Notices event supported bit - * @NVME_CTRL_OAES_FAN_MASK: Mask to get the Firmware Activation Notices - * event supported bit - * @NVME_CTRL_OAES_RSVD10_MASK: Mask to get Reserved - * @NVME_CTRL_OAES_ANACN_MASK: Mask to get the Asymmetric Namespace Access - * Change Notices event supported bit - * @NVME_CTRL_OAES_PLEAN_MASK: Mask to get the Predictable Latency Event - * Aggregate Log Change Notices event supported bit - * @NVME_CTRL_OAES_LSIAN_MASK: Mask to get the LBA Status Information Alert - * Notices event supported bit - * @NVME_CTRL_OAES_EGEAN_MASK: Mask to get the Endurance Group Event Aggregate - * Log Page Change Notices event supported bit - * @NVME_CTRL_OAES_NNSS_MASK: Mask to get the Normal NVM Subsystem Shutdown - * event supported bit - * @NVME_CTRL_OAES_TTHR_MASK: Mask to get the Temperature Threshold Hysteresis - * Recovery event supported bit - * @NVME_CTRL_OAES_RGCNS_MASK: Mask to get the Reachability Groups Change - * Notices event supported bit - * @NVME_CTRL_OAES_RSVD18_MASK: Mask to get Reserved - * @NVME_CTRL_OAES_ANSAN_MASK: Mask to get the Allocated Namespace Attribute - * Notices event supported bit - * @NVME_CTRL_OAES_CCRCN_MASK: Mask to get the Cross-Controller Reset Completed - * Notices event supported bit - * @NVME_CTRL_OAES_LHCN_MASK: Mask to get the Lost Host Communication Notices - * event supported bit - * @NVME_CTRL_OAES_RLCC_MASK: Mask to get the Rate Limiting Configuration - * Change event supported bit - * @NVME_CTRL_OAES_RSVD23_MASK: Mask to get Reserved - * @NVME_CTRL_OAES_ZDCN_MASK: Mask to get the Zone Descriptor Changed Notices - * event supported bit - * @NVME_CTRL_OAES_RSVD28_MASK: Mask to get Reserved - * @NVME_CTRL_OAES_DLPCN_MASK: Mask to get the Discovery Log Page Change - * Notification event supported bit - * @NVME_CTRL_OAES_NSAN: If set, the controller supports the Attached - * Namespace Attribute Notices event. - * @NVME_CTRL_OAES_FAN: If set, the controller supports the Firmware - * Activation Notices event. - * @NVME_CTRL_OAES_ANACN: If set, the controller supports the Asymmetric - * Namespace Access Change Notices event. - * @NVME_CTRL_OAES_PLEAN: If set, the controller supports the Predictable - * Latency Event Aggregate Log Change Notices - * event. - * @NVME_CTRL_OAES_LSIAN: If set, the controller supports the LBA Status - * Information Alert Notices event. - * @NVME_CTRL_OAES_EGEAN: If set, the controller supports the Endurance - * Group Event Aggregate Log Page Change Notices - * event. - * @NVME_CTRL_OAES_NNSS: If set, the controller supports the Normal NVM - * Subsystem Shutdown event. - * @NVME_CTRL_OAES_TTHR: If set, the controller supports the Temperature - * Threshold Hysteresis Recovery event. - * @NVME_CTRL_OAES_RGCNS: If set, the controller supports the Reachability - * Groups Change Notices event. - * @NVME_CTRL_OAES_ANSAN: If set, the controller supports the Allocated - * Namespace Attribute Notices event. - * @NVME_CTRL_OAES_CCRCN: If set, the controller supports the - * Cross-Controller Reset Completed Notices event. - * @NVME_CTRL_OAES_LHCN: If set, the controller supports the Lost Host - * Communication Notices event. - * @NVME_CTRL_OAES_RLCC: If set, the controller supports the Rate - * Limiting Configuration Change event. - * @NVME_CTRL_OAES_ZDCN: If set, the controller supports the Zone - * Descriptor Changed Notices event. - * @NVME_CTRL_OAES_DLPCN: If set, the controller supports the Discovery - * Log Page Change Notification event. - */ -enum nvme_id_ctrl_oaes { - NVME_CTRL_OAES_RSVD0_SHIFT = 0, - NVME_CTRL_OAES_NSAN_SHIFT = 8, - NVME_CTRL_OAES_FAN_SHIFT = 9, - NVME_CTRL_OAES_RSVD10_SHIFT = 10, - NVME_CTRL_OAES_ANACN_SHIFT = 11, - NVME_CTRL_OAES_PLEAN_SHIFT = 12, - NVME_CTRL_OAES_LSIAN_SHIFT = 13, - NVME_CTRL_OAES_EGEAN_SHIFT = 14, - NVME_CTRL_OAES_NNSS_SHIFT = 15, - NVME_CTRL_OAES_TTHR_SHIFT = 16, - NVME_CTRL_OAES_RGCNS_SHIFT = 17, - NVME_CTRL_OAES_RSVD18_SHIFT = 18, - NVME_CTRL_OAES_ANSAN_SHIFT = 19, - NVME_CTRL_OAES_CCRCN_SHIFT = 20, - NVME_CTRL_OAES_LHCN_SHIFT = 21, - NVME_CTRL_OAES_RLCC_SHIFT = 22, - NVME_CTRL_OAES_RSVD23_SHIFT = 23, - NVME_CTRL_OAES_ZDCN_SHIFT = 27, - NVME_CTRL_OAES_RSVD28_SHIFT = 28, - NVME_CTRL_OAES_DLPCN_SHIFT = 31, - NVME_CTRL_OAES_RSVD0_MASK = 0xff, - NVME_CTRL_OAES_NSAN_MASK = 0x1, - NVME_CTRL_OAES_FAN_MASK = 0x1, - NVME_CTRL_OAES_RSVD10_MASK = 0x1, - NVME_CTRL_OAES_ANACN_MASK = 0x1, - NVME_CTRL_OAES_PLEAN_MASK = 0x1, - NVME_CTRL_OAES_LSIAN_MASK = 0x1, - NVME_CTRL_OAES_EGEAN_MASK = 0x1, - NVME_CTRL_OAES_NNSS_MASK = 0x1, - NVME_CTRL_OAES_TTHR_MASK = 0x1, - NVME_CTRL_OAES_RGCNS_MASK = 0x1, - NVME_CTRL_OAES_RSVD18_MASK = 0x1, - NVME_CTRL_OAES_ANSAN_MASK = 0x1, - NVME_CTRL_OAES_CCRCN_MASK = 0x1, - NVME_CTRL_OAES_LHCN_MASK = 0x1, - NVME_CTRL_OAES_RLCC_MASK = 0x1, - NVME_CTRL_OAES_RSVD23_MASK = 0xf, - NVME_CTRL_OAES_ZDCN_MASK = 0x1, - NVME_CTRL_OAES_RSVD28_MASK = 0x7, - NVME_CTRL_OAES_DLPCN_MASK = 0x1, - NVME_CTRL_OAES_NSAN = NVME_VAL(CTRL_OAES_NSAN), - NVME_CTRL_OAES_FAN = NVME_VAL(CTRL_OAES_FAN), - NVME_CTRL_OAES_ANACN = NVME_VAL(CTRL_OAES_ANACN), - NVME_CTRL_OAES_PLEAN = NVME_VAL(CTRL_OAES_PLEAN), - NVME_CTRL_OAES_LSIAN = NVME_VAL(CTRL_OAES_LSIAN), - NVME_CTRL_OAES_EGEAN = NVME_VAL(CTRL_OAES_EGEAN), - NVME_CTRL_OAES_NNSS = NVME_VAL(CTRL_OAES_NNSS), - NVME_CTRL_OAES_TTHR = NVME_VAL(CTRL_OAES_TTHR), - NVME_CTRL_OAES_RGCNS = NVME_VAL(CTRL_OAES_RGCNS), - NVME_CTRL_OAES_ANSAN = NVME_VAL(CTRL_OAES_ANSAN), - NVME_CTRL_OAES_CCRCN = NVME_VAL(CTRL_OAES_CCRCN), - NVME_CTRL_OAES_LHCN = NVME_VAL(CTRL_OAES_LHCN), - NVME_CTRL_OAES_RLCC = NVME_VAL(CTRL_OAES_RLCC), - NVME_CTRL_OAES_ZDCN = NVME_VAL(CTRL_OAES_ZDCN), - NVME_CTRL_OAES_DLPCN = NVME_VAL(CTRL_OAES_DLPCN), -}; - -#define NVME_CTRL_OAES_RSVD0(oaes) NVME_GET(oaes, CTRL_OAES_RSVD0) -#define NVME_CTRL_OAES_NSAN(oaes) NVME_GET(oaes, CTRL_OAES_NSAN) -#define NVME_CTRL_OAES_FAN(oaes) NVME_GET(oaes, CTRL_OAES_FAN) -#define NVME_CTRL_OAES_RSVD10(oaes) NVME_GET(oaes, CTRL_OAES_RSVD10) -#define NVME_CTRL_OAES_ANACN(oaes) NVME_GET(oaes, CTRL_OAES_ANACN) -#define NVME_CTRL_OAES_PLEAN(oaes) NVME_GET(oaes, CTRL_OAES_PLEAN) -#define NVME_CTRL_OAES_LSIAN(oaes) NVME_GET(oaes, CTRL_OAES_LSIAN) -#define NVME_CTRL_OAES_EGEAN(oaes) NVME_GET(oaes, CTRL_OAES_EGEAN) -#define NVME_CTRL_OAES_NNSS(oaes) NVME_GET(oaes, CTRL_OAES_NNSS) -#define NVME_CTRL_OAES_TTHR(oaes) NVME_GET(oaes, CTRL_OAES_TTHR) -#define NVME_CTRL_OAES_RGCNS(oaes) NVME_GET(oaes, CTRL_OAES_RGCNS) -#define NVME_CTRL_OAES_RSVD18(oaes) NVME_GET(oaes, CTRL_OAES_RSVD18) -#define NVME_CTRL_OAES_ANSAN(oaes) NVME_GET(oaes, CTRL_OAES_ANSAN) -#define NVME_CTRL_OAES_CCRCN(oaes) NVME_GET(oaes, CTRL_OAES_CCRCN) -#define NVME_CTRL_OAES_LHCN(oaes) NVME_GET(oaes, CTRL_OAES_LHCN) -#define NVME_CTRL_OAES_RLCC(oaes) NVME_GET(oaes, CTRL_OAES_RLCC) -#define NVME_CTRL_OAES_RSVD23(oaes) NVME_GET(oaes, CTRL_OAES_RSVD23) -#define NVME_CTRL_OAES_ZDCN(oaes) NVME_GET(oaes, CTRL_OAES_ZDCN) -#define NVME_CTRL_OAES_RSVD28(oaes) NVME_GET(oaes, CTRL_OAES_RSVD28) -#define NVME_CTRL_OAES_DLPCN(oaes) NVME_GET(oaes, CTRL_OAES_DLPCN) - -/** - * enum nvme_id_ctrl_ctratt - Controller attributes - * @NVME_CTRL_CTRATT_HIDS_SHIFT: HIDS shift - * @NVME_CTRL_CTRATT_NOPSPM_SHIFT: NOPSPM shift - * @NVME_CTRL_CTRATT_NSETS_SHIFT: NSETS shift - * @NVME_CTRL_CTRATT_RRLVLS_SHIFT: RRLVLS shift - * @NVME_CTRL_CTRATT_EGS_SHIFT: EGS shift - * @NVME_CTRL_CTRATT_PLM_SHIFT: PLM shift - * @NVME_CTRL_CTRATT_TBKAS_SHIFT: TBKAS shift - * @NVME_CTRL_CTRATT_NG_SHIFT: NG shift - * @NVME_CTRL_CTRATT_SQA_SHIFT: SQA shift - * @NVME_CTRL_CTRATT_ULIST_SHIFT: ULIST shift - * @NVME_CTRL_CTRATT_MDS_SHIFT: MDS shift - * @NVME_CTRL_CTRATT_FCM_SHIFT: FCM shift - * @NVME_CTRL_CTRATT_VCM_SHIFT: VCM shift - * @NVME_CTRL_CTRATT_DEG_SHIFT: DEG shift - * @NVME_CTRL_CTRATT_DNVMS_SHIFT: DNVMS shift - * @NVME_CTRL_CTRATT_ELBAS_SHIFT: ELBAS shift - * @NVME_CTRL_CTRATT_MEM_SHIFT: MEM shift - * @NVME_CTRL_CTRATT_HMBR_SHIFT: HMBR shift - * @NVME_CTRL_CTRATT_RHII_SHIFT: RHII shift - * @NVME_CTRL_CTRATT_FDPS_SHIFT: FDPS shift - * @NVME_CTRL_CTRATT_PLS_SHIFT: PLS shift - * @NVME_CTRL_CTRATT_PMS_SHIFT: PMS shift - * @NVME_CTRL_CTRATT_VMS_SHIFT: VMS shift - * @NVME_CTRL_CTRATT_IIELLSS_SHIFT: IIELLSS shift - * @NVME_CTRL_CTRATT_RSVD25_SHIFT: Reserved shift - * @NVME_CTRL_CTRATT_HIDS_MASK: HIDS mask - * @NVME_CTRL_CTRATT_NOPSPM_MASK: NOPSPM mask - * @NVME_CTRL_CTRATT_NSETS_MASK: NSETS mask - * @NVME_CTRL_CTRATT_RRLVLS_MASK: RRLVLS mask - * @NVME_CTRL_CTRATT_EGS_MASK: EGS mask - * @NVME_CTRL_CTRATT_PLM_MASK: PLM mask - * @NVME_CTRL_CTRATT_TBKAS_MASK: TBKAS mask - * @NVME_CTRL_CTRATT_NG_MASK: NG mask - * @NVME_CTRL_CTRATT_SQA_MASK: SQA mask - * @NVME_CTRL_CTRATT_ULIST_MASK: ULIST mask - * @NVME_CTRL_CTRATT_MDS_MASK: MDS mask - * @NVME_CTRL_CTRATT_FCM_MASK: FCM mask - * @NVME_CTRL_CTRATT_VCM_MASK: VCM mask - * @NVME_CTRL_CTRATT_DEG_MASK: DEG mask - * @NVME_CTRL_CTRATT_DNVMS_MASK: DNVMS mask - * @NVME_CTRL_CTRATT_ELBAS_MASK: ELBAS mask - * @NVME_CTRL_CTRATT_MEM_MASK: MEM mask - * @NVME_CTRL_CTRATT_HMBR_MASK: HMBR mask - * @NVME_CTRL_CTRATT_RHII_MASK: RHII mask - * @NVME_CTRL_CTRATT_FDPS_MASK: FDPS mask - * @NVME_CTRL_CTRATT_PLS_MASK: PLS mask - * @NVME_CTRL_CTRATT_PMS_MASK: PMS mask - * @NVME_CTRL_CTRATT_VMS_MASK: VMS mask - * @NVME_CTRL_CTRATT_IIELLSS_MASK: IIELLSS mask - * @NVME_CTRL_CTRATT_RSVD25_MASK: Reserved mask - * @NVME_CTRL_CTRATT_128_ID: 128-bit Host Identifier supported - * @NVME_CTRL_CTRATT_NON_OP_PSP: Non-Operational Poser State Permissive Mode - * supported - * @NVME_CTRL_CTRATT_NVM_SETS: NVM Sets supported - * @NVME_CTRL_CTRATT_READ_RECV_LVLS: Read Recovery Levels supported - * @NVME_CTRL_CTRATT_ENDURANCE_GROUPS: Endurance Groups supported - * @NVME_CTRL_CTRATT_PREDICTABLE_LAT: Predictable Latency Mode supported - * @NVME_CTRL_CTRATT_TBKAS: Traffic Based Keep Alive Support - * @NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY: Namespace Granularity reporting - * supported - * @NVME_CTRL_CTRATT_SQ_ASSOCIATIONS: SQ Associations supported - * @NVME_CTRL_CTRATT_UUID_LIST: UUID List reporting supported - * @NVME_CTRL_CTRATT_MDS: Multi-Domain Subsystem supported - * @NVME_CTRL_CTRATT_FIXED_CAP: Fixed Capacity Management supported - * @NVME_CTRL_CTRATT_VARIABLE_CAP: Variable Capacity Management supported - * @NVME_CTRL_CTRATT_DEL_ENDURANCE_GROUPS: Delete Endurance Groups supported - * @NVME_CTRL_CTRATT_DEL_NVM_SETS: Delete NVM Sets supported - * @NVME_CTRL_CTRATT_ELBAS: Extended LBA Formats supported - * @NVME_CTRL_CTRATT_MEM: MDTS and Size Limits Exclude Metadata supported - * @NVME_CTRL_CTRATT_HMBR: HMB Restrict Non-Operational Power State Access - * @NVME_CTRL_CTRATT_RHII: Reservations and Host Identifier Interaction - * @NVME_CTRL_CTRATT_FDPS: Flexible Data Placement supported - * @NVME_CTRL_CTRATT_PLS: Power Limit Support - * @NVME_CTRL_CTRATT_PMS: Power Measurement Support - * @NVME_CTRL_CTRATT_VMS: Voltage Measurement Support - * @NVME_CTRL_CTRATT_IIELLSS: Idle I/O Exit Latency Limit Support and Scope - * @NVME_CTRL_CTRATT_IIELLSS_POWER_STATE: Each operational power state scope - * @NVME_CTRL_CTRATT_IIELLSS_GLOBAL: All operational power states scope - */ -enum nvme_id_ctrl_ctratt { - NVME_CTRL_CTRATT_HIDS_SHIFT = 0, - NVME_CTRL_CTRATT_NOPSPM_SHIFT = 1, - NVME_CTRL_CTRATT_NSETS_SHIFT = 2, - NVME_CTRL_CTRATT_RRLVLS_SHIFT = 3, - NVME_CTRL_CTRATT_EGS_SHIFT = 4, - NVME_CTRL_CTRATT_PLM_SHIFT = 5, - NVME_CTRL_CTRATT_TBKAS_SHIFT = 6, - NVME_CTRL_CTRATT_NG_SHIFT = 7, - NVME_CTRL_CTRATT_SQA_SHIFT = 8, - NVME_CTRL_CTRATT_ULIST_SHIFT = 9, - NVME_CTRL_CTRATT_MDS_SHIFT = 10, - NVME_CTRL_CTRATT_FCM_SHIFT = 11, - NVME_CTRL_CTRATT_VCM_SHIFT = 12, - NVME_CTRL_CTRATT_DEG_SHIFT = 13, - NVME_CTRL_CTRATT_DNVMS_SHIFT = 14, - NVME_CTRL_CTRATT_ELBAS_SHIFT = 15, - NVME_CTRL_CTRATT_MEM_SHIFT = 16, - NVME_CTRL_CTRATT_HMBR_SHIFT = 17, - NVME_CTRL_CTRATT_RHII_SHIFT = 18, - NVME_CTRL_CTRATT_FDPS_SHIFT = 19, - NVME_CTRL_CTRATT_PLS_SHIFT = 20, - NVME_CTRL_CTRATT_PMS_SHIFT = 21, - NVME_CTRL_CTRATT_VMS_SHIFT = 22, - NVME_CTRL_CTRATT_IIELLSS_SHIFT = 23, - NVME_CTRL_CTRATT_RSVD25_SHIFT = 25, - NVME_CTRL_CTRATT_HIDS_MASK = 0x1, - NVME_CTRL_CTRATT_NOPSPM_MASK = 0x1, - NVME_CTRL_CTRATT_NSETS_MASK = 0x1, - NVME_CTRL_CTRATT_RRLVLS_MASK = 0x1, - NVME_CTRL_CTRATT_EGS_MASK = 0x1, - NVME_CTRL_CTRATT_PLM_MASK = 0x1, - NVME_CTRL_CTRATT_TBKAS_MASK = 0x1, - NVME_CTRL_CTRATT_NG_MASK = 0x1, - NVME_CTRL_CTRATT_SQA_MASK = 0x1, - NVME_CTRL_CTRATT_ULIST_MASK = 0x1, - NVME_CTRL_CTRATT_MDS_MASK = 0x1, - NVME_CTRL_CTRATT_FCM_MASK = 0x1, - NVME_CTRL_CTRATT_VCM_MASK = 0x1, - NVME_CTRL_CTRATT_DEG_MASK = 0x1, - NVME_CTRL_CTRATT_DNVMS_MASK = 0x1, - NVME_CTRL_CTRATT_ELBAS_MASK = 0x1, - NVME_CTRL_CTRATT_MEM_MASK = 0x1, - NVME_CTRL_CTRATT_HMBR_MASK = 0x1, - NVME_CTRL_CTRATT_RHII_MASK = 0x1, - NVME_CTRL_CTRATT_FDPS_MASK = 0x1, - NVME_CTRL_CTRATT_PLS_MASK = 0x1, - NVME_CTRL_CTRATT_PMS_MASK = 0x1, - NVME_CTRL_CTRATT_VMS_MASK = 0x1, - NVME_CTRL_CTRATT_IIELLSS_MASK = 0x3, - NVME_CTRL_CTRATT_RSVD25_MASK = 0x7f, - NVME_CTRL_CTRATT_128_ID = NVME_VAL(CTRL_CTRATT_HIDS), - NVME_CTRL_CTRATT_NON_OP_PSP = NVME_VAL(CTRL_CTRATT_NOPSPM), - NVME_CTRL_CTRATT_NVM_SETS = NVME_VAL(CTRL_CTRATT_NSETS), - NVME_CTRL_CTRATT_READ_RECV_LVLS = NVME_VAL(CTRL_CTRATT_RRLVLS), - NVME_CTRL_CTRATT_ENDURANCE_GROUPS = NVME_VAL(CTRL_CTRATT_EGS), - NVME_CTRL_CTRATT_PREDICTABLE_LAT = NVME_VAL(CTRL_CTRATT_PLM), - NVME_CTRL_CTRATT_TBKAS = NVME_VAL(CTRL_CTRATT_TBKAS), - NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY = NVME_VAL(CTRL_CTRATT_NG), - NVME_CTRL_CTRATT_SQ_ASSOCIATIONS = NVME_VAL(CTRL_CTRATT_SQA), - NVME_CTRL_CTRATT_UUID_LIST = NVME_VAL(CTRL_CTRATT_ULIST), - NVME_CTRL_CTRATT_MDS = NVME_VAL(CTRL_CTRATT_MDS), - NVME_CTRL_CTRATT_FIXED_CAP = NVME_VAL(CTRL_CTRATT_FCM), - NVME_CTRL_CTRATT_VARIABLE_CAP = NVME_VAL(CTRL_CTRATT_VCM), - NVME_CTRL_CTRATT_DEL_ENDURANCE_GROUPS = NVME_VAL(CTRL_CTRATT_DEG), - NVME_CTRL_CTRATT_DEL_NVM_SETS = NVME_VAL(CTRL_CTRATT_DNVMS), - NVME_CTRL_CTRATT_ELBAS = NVME_VAL(CTRL_CTRATT_ELBAS), - NVME_CTRL_CTRATT_MEM = NVME_VAL(CTRL_CTRATT_MEM), - NVME_CTRL_CTRATT_HMBR = NVME_VAL(CTRL_CTRATT_HMBR), - NVME_CTRL_CTRATT_RHII = NVME_VAL(CTRL_CTRATT_RHII), - NVME_CTRL_CTRATT_FDPS = NVME_VAL(CTRL_CTRATT_FDPS), - NVME_CTRL_CTRATT_PLS = NVME_VAL(CTRL_CTRATT_PLS), - NVME_CTRL_CTRATT_PMS = NVME_VAL(CTRL_CTRATT_PMS), - NVME_CTRL_CTRATT_VMS = NVME_VAL(CTRL_CTRATT_VMS), - NVME_CTRL_CTRATT_IIELLSS = NVME_VAL(CTRL_CTRATT_IIELLSS), - NVME_CTRL_CTRATT_IIELLSS_POWER_STATE = 1, - NVME_CTRL_CTRATT_IIELLSS_GLOBAL = 2, -}; - -#define NVME_CTRL_CTRATT_HIDS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_HIDS) -#define NVME_CTRL_CTRATT_NOPSPM(ctratt) NVME_GET(ctratt, CTRL_CTRATT_NOPSPM) -#define NVME_CTRL_CTRATT_NSETS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_NSETS) -#define NVME_CTRL_CTRATT_RRLVLS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_RRLVLS) -#define NVME_CTRL_CTRATT_EGS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_EGS) -#define NVME_CTRL_CTRATT_PLM(ctratt) NVME_GET(ctratt, CTRL_CTRATT_PLM) -#define NVME_CTRL_CTRATT_TBKAS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_TBKAS) -#define NVME_CTRL_CTRATT_NG(ctratt) NVME_GET(ctratt, CTRL_CTRATT_NG) -#define NVME_CTRL_CTRATT_SQA(ctratt) NVME_GET(ctratt, CTRL_CTRATT_SQA) -#define NVME_CTRL_CTRATT_ULIST(ctratt) NVME_GET(ctratt, CTRL_CTRATT_ULIST) -#define NVME_CTRL_CTRATT_MDS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_MDS) -#define NVME_CTRL_CTRATT_FCM(ctratt) NVME_GET(ctratt, CTRL_CTRATT_FCM) -#define NVME_CTRL_CTRATT_VCM(ctratt) NVME_GET(ctratt, CTRL_CTRATT_VCM) -#define NVME_CTRL_CTRATT_DEG(ctratt) NVME_GET(ctratt, CTRL_CTRATT_DEG) -#define NVME_CTRL_CTRATT_DNVMS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_DNVMS) -#define NVME_CTRL_CTRATT_ELBAS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_ELBAS) -#define NVME_CTRL_CTRATT_MEM(ctratt) NVME_GET(ctratt, CTRL_CTRATT_MEM) -#define NVME_CTRL_CTRATT_HMBR(ctratt) NVME_GET(ctratt, CTRL_CTRATT_HMBR) -#define NVME_CTRL_CTRATT_RHII(ctratt) NVME_GET(ctratt, CTRL_CTRATT_RHII) -#define NVME_CTRL_CTRATT_FDPS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_FDPS) -#define NVME_CTRL_CTRATT_PLS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_PLS) -#define NVME_CTRL_CTRATT_PMS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_PMS) -#define NVME_CTRL_CTRATT_VMS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_VMS) -#define NVME_CTRL_CTRATT_IIELLSS(ctratt) NVME_GET(ctratt, CTRL_CTRATT_IIELLSS) -#define NVME_CTRL_CTRATT_RSVD25(ctratt) NVME_GET(ctratt, CTRL_CTRATT_RSVD25) - -/** - * enum nvme_id_ctrl_bpcap - Boot Partition Capabilities - * @NVME_CTRL_BPCAP_RPMBBPWPS_SHIFT: Shift amount to get the RPMB - * Boot Partition Write Protection - * Support from the &struct - * nvme_id_ctrl.bpcap field. - * @NVME_CTRL_BPCAP_SFBPWPS_SHIFT: Shift amount to get the Set - * Features Boot Partition Write - * Protection Support from the - * &struct nvme_id_ctrl.bpcap - * field. - * @NVME_CTRL_BPCAP_RSVD3_SHIFT: Shift amount to get the Reserved - * @NVME_CTRL_BPCAP_RPMBBPWPS_MASK: Mask to get the RPMB Boot - * Partition Write Protection - * Support from the &struct - * nvme_id_ctrl.bpcap field. - * @NVME_CTRL_BPCAP_SFBPWPS_MASK: Mask to get the Set Features - * Boot Partition Write Protection - * Support from the &struct - * nvme_id_ctrl.bpcap field. - * @NVME_CTRL_BPCAP_RSVD3_MASK: Mask to get the Reserved - * @NVME_CTRL_BPCAP_RPMBBPWPS_NOT_SPECIFIED: Support for RPMB Boot Partition - * Write Protection is not - * specified. - * @NVME_CTRL_BPCAP_RPMBBPWPS_NOT_SUPPORTED: RPMB Boot Partition Write - * Protection is not supported by - * this controller. - * @NVME_CTRL_BPCAP_RPMBBPWPS_SUPPORTED: RPMB Boot Partition Write - * Protection is supported by this - * controller. - */ -enum nvme_id_ctrl_bpcap { - NVME_CTRL_BPCAP_RPMBBPWPS_SHIFT = 0, - NVME_CTRL_BPCAP_SFBPWPS_SHIFT = 2, - NVME_CTRL_BPCAP_RSVD3_SHIFT = 3, - NVME_CTRL_BPCAP_RPMBBPWPS_MASK = 0x3, - NVME_CTRL_BPCAP_SFBPWPS_MASK = 0x1, - NVME_CTRL_BPCAP_RSVD3_MASK = 0x1f, - NVME_CTRL_BPCAP_RPMBBPWPS_NOT_SPECIFIED = 0, - NVME_CTRL_BPCAP_RPMBBPWPS_NOT_SUPPORTED = 1, - NVME_CTRL_BPCAP_RPMBBPWPS_SUPPORTED = 2, -}; - -#define NVME_CTRL_BPCAP_RPMBBPWPS(bpcap) NVME_GET(bpcap, CTRL_BPCAP_RPMBBPWPS) -#define NVME_CTRL_BPCAP_SFBPWPS(bpcap) NVME_GET(bpcap, CTRL_BPCAP_SFBPWPS) -#define NVME_CTRL_BPCAP_RSVD3(bpcap) NVME_GET(bpcap, CTRL_BPCAP_RSVD3) - -/** - * enum nvme_id_ctrl_chsi - CXL HDM Support Information - * @NVME_CTRL_CHSI_CHS_SHIFT: Shift amount to get the CXL HDM Support (CHS) - * from the &struct nvme_id_ctrl.chsi field. - * @NVME_CTRL_CHSI_RSVD1_SHIFT: Shift amount to get the Reserved - * @NVME_CTRL_CHSI_CHS_MASK: Mask to get CHS - * @NVME_CTRL_CHSI_RSVD1_MASK: Mask to get Reserved - */ -enum nvme_id_ctrl_chsi { - NVME_CTRL_CHSI_CHS_SHIFT = 0, - NVME_CTRL_CHSI_RSVD1_SHIFT = 1, - NVME_CTRL_CHSI_CHS_MASK = 0x1, - NVME_CTRL_CHSI_RSVD1_MASK = 0x7f, -}; - -#define NVME_CTRL_CHSI_CHS(chsi) NVME_GET(chsi, CTRL_CHSI_CHS) -#define NVME_CTRL_CHSI_RSVD1(chsi) NVME_GET(chsi, CTRL_CHSI_RSVD1) - -/** - * enum nvme_id_ctrl_rmdca - Restore Manufacturing Configuration Attributes - * @NVME_CTRL_RMDCA_RDSCS_SHIFT: Shift amount to get the Restore Default - * NVM Subsystem Configuration Supported - * (RDSCS) from the &struct - * nvme_id_ctrl.rmdca field. - * @NVME_CTRL_RMDCA_RDSCS_MASK: Mask to get RDSCS - * @NVME_CTRL_RMDCA_RDNCS_SHIFT: Shift amount to get the Restore Default - * Namespace Configuration Supported - * (RDNCS) - * @NVME_CTRL_RMDCA_RDNCS_MASK: Mask to get RDNCS - * @NVME_CTRL_RMDCA_RDCCS_SHIFT: Shift amount to get the Restore Default - * Capacity Management Configuration - * Supported (RDCCS) - * @NVME_CTRL_RMDCA_RDCCS_MASK: Mask to get RDCCS - * @NVME_CTRL_RMDCA_RSVD3_SHIFT: Shift amount to get the Reserved - * @NVME_CTRL_RMDCA_RSVD3_MASK: Mask to get Reserved - */ -enum nvme_id_ctrl_rmdca { - NVME_CTRL_RMDCA_RDSCS_SHIFT = 0, - NVME_CTRL_RMDCA_RDSCS_MASK = 0x1, - NVME_CTRL_RMDCA_RDNCS_SHIFT = 1, - NVME_CTRL_RMDCA_RDNCS_MASK = 0x1, - NVME_CTRL_RMDCA_RDCCS_SHIFT = 2, - NVME_CTRL_RMDCA_RDCCS_MASK = 0x1, - NVME_CTRL_RMDCA_RSVD3_SHIFT = 3, - NVME_CTRL_RMDCA_RSVD3_MASK = 0x1fff, -}; - -#define NVME_CTRL_RMDCA_RDSCS(rmdca) NVME_GET(rmdca, CTRL_RMDCA_RDSCS) -#define NVME_CTRL_RMDCA_RDNCS(rmdca) NVME_GET(rmdca, CTRL_RMDCA_RDNCS) -#define NVME_CTRL_RMDCA_RDCCS(rmdca) NVME_GET(rmdca, CTRL_RMDCA_RDCCS) -#define NVME_CTRL_RMDCA_RSVD3(rmdca) NVME_GET(rmdca, CTRL_RMDCA_RSVD3) - -/** - * enum nvme_id_ctrl_plsi - Power Loss Signaling Information - * @NVME_CTRL_PLSI_PLSEPF_SHIFT: Shift amount to get the PLS Emergency Power Fail from the - * &struct nvme_id_ctrl.plsi field. - * @NVME_CTRL_PLSI_PLSFQ_SHIFT: Shift amount to get the PLS Forced Quiescence from the - * &struct nvme_id_ctrl.plsi field. - * @NVME_CTRL_PLSI_RSVD2_SHIFT: Shift amount to get the Reserved - * @NVME_CTRL_PLSI_PLSEPF_MASK: Mask to get the PLS Emergency Power Fail from the - * &struct nvme_id_ctrl.plsi field. - * @NVME_CTRL_PLSI_PLSFQ_MASK: Mask to get the PLS Forced Quiescence from the - * &struct nvme_id_ctrl.plsi field. - * @NVME_CTRL_PLSI_RSVD2_MASK: Mask to get the Reserved - */ -enum nvme_id_ctrl_plsi { - NVME_CTRL_PLSI_PLSEPF_SHIFT = 0, - NVME_CTRL_PLSI_PLSFQ_SHIFT = 1, - NVME_CTRL_PLSI_RSVD2_SHIFT = 2, - NVME_CTRL_PLSI_PLSEPF_MASK = 0x1, - NVME_CTRL_PLSI_PLSFQ_MASK = 0x1, - NVME_CTRL_PLSI_RSVD2_MASK = 0x3f, -}; - -#define NVME_CTRL_PLSI_PLSEPF(plsi) NVME_GET(plsi, CTRL_PLSI_PLSEPF) -#define NVME_CTRL_PLSI_PLSFQ(plsi) NVME_GET(plsi, CTRL_PLSI_PLSFQ) -#define NVME_CTRL_PLSI_RSVD2(plsi) NVME_GET(plsi, CTRL_PLSI_RSVD2) - -/** - * enum nvme_id_ctrl_crcap - Power Loss Signaling Information - * @NVME_CTRL_CRCAP_RRSUP_SHIFT: Shift amount to get the Reachability Reporting Supported - * from the &struct nvme_id_ctrl.crcap field. - * @NVME_CTRL_CRCAP_RGIDC_SHIFT: Shift amount to get the Reachability Group ID Changeable - * from the &struct nvme_id_ctrl.crcap field. - * @NVME_CTRL_CRCAP_RSVD2_SHIFT: Shift amount to get the Reserved - * @NVME_CTRL_CRCAP_RRSUP_MASK: Mask to get the Reachability Reporting Supported from the - * &struct nvme_id_ctrl.crcap field. - * @NVME_CTRL_CRCAP_RGIDC_MASK: Mask to get the Reachability Group ID Changeable from the - * &struct nvme_id_ctrl.crcap field. - * @NVME_CTRL_CRCAP_RSVD2_MASK: Mask to get the Reserved - */ -enum nvme_id_ctrl_crcap { - NVME_CTRL_CRCAP_RRSUP_SHIFT = 0, - NVME_CTRL_CRCAP_RGIDC_SHIFT = 1, - NVME_CTRL_CRCAP_RSVD2_SHIFT = 2, - NVME_CTRL_CRCAP_RRSUP_MASK = 0x1, - NVME_CTRL_CRCAP_RGIDC_MASK = 0x1, - NVME_CTRL_CRCAP_RSVD2_MASK = 0x3f, -}; - -#define NVME_CTRL_CRCAP_RRSUP(crcap) NVME_GET(crcap, CTRL_CRCAP_RRSUP) -#define NVME_CTRL_CRCAP_RGIDC(crcap) NVME_GET(crcap, CTRL_CRCAP_RGIDC) -#define NVME_CTRL_CRCAP_RSVD2(crcap) NVME_GET(crcap, CTRL_CRCAP_RSVD2) - -/** - * enum nvme_id_ctrl_cntrltype - Controller types - * @NVME_CTRL_CNTRLTYPE_IO: NVM I/O controller - * @NVME_CTRL_CNTRLTYPE_DISCOVERY: Discovery controller - * @NVME_CTRL_CNTRLTYPE_ADMIN: Admin controller - */ -enum nvme_id_ctrl_cntrltype { - NVME_CTRL_CNTRLTYPE_IO = 1, - NVME_CTRL_CNTRLTYPE_DISCOVERY = 2, - NVME_CTRL_CNTRLTYPE_ADMIN = 3, -}; - -/** - * enum nvme_id_ctrl_dctype - Discovery Controller types - * @NVME_CTRL_DCTYPE_NOT_REPORTED: Not reported (I/O, Admin, and pre-TP8010) - * @NVME_CTRL_DCTYPE_DDC: Direct Discovery controller - * @NVME_CTRL_DCTYPE_CDC: Central Discovery controller - */ -enum nvme_id_ctrl_dctype { - NVME_CTRL_DCTYPE_NOT_REPORTED = 0, - NVME_CTRL_DCTYPE_DDC = 1, - NVME_CTRL_DCTYPE_CDC = 2, -}; - -/** - * enum nvme_id_ctrl_nvmsr - This field reports information associated with the - * NVM Subsystem, see &struct nvme_id_ctrl.nvmsr. - * @NVME_CTRL_NVMSR_NVMESD_SHIFT: NVMESD shift - * @NVME_CTRL_NVMSR_NVMEE_SHIFT: NVMEE shift - * @NVME_CTRL_NVMSR_RSVD2_SHIFT: Reserved shift - * @NVME_CTRL_NVMSR_NVMESD_MASK: NVMESD mask - * @NVME_CTRL_NVMSR_NVMEE_MASK: NVMEE mask - * @NVME_CTRL_NVMSR_RSVD2_MASK: Reserved mask - * @NVME_CTRL_NVMSR_NVMESD: If set, then the NVM Subsystem is part of an NVMe - * Storage Device; if cleared, then the NVM Subsystem - * is not part of an NVMe Storage Device. - * @NVME_CTRL_NVMSR_NVMEE: If set, then the NVM Subsystem is part of an NVMe - * Enclosure; if cleared, then the NVM Subsystem is - * not part of an NVMe Enclosure. - */ -enum nvme_id_ctrl_nvmsr { - NVME_CTRL_NVMSR_NVMESD_SHIFT = 0, - NVME_CTRL_NVMSR_NVMEE_SHIFT = 1, - NVME_CTRL_NVMSR_RSVD2_SHIFT = 2, - NVME_CTRL_NVMSR_NVMESD_MASK = 0x1, - NVME_CTRL_NVMSR_NVMEE_MASK = 0x1, - NVME_CTRL_NVMSR_RSVD2_MASK = 0x3f, - NVME_CTRL_NVMSR_NVMESD = NVME_VAL(CTRL_NVMSR_NVMESD), - NVME_CTRL_NVMSR_NVMEE = NVME_VAL(CTRL_NVMSR_NVMEE), -}; - -#define NVME_CTRL_NVMSR_NVMESD(nvmsr) NVME_GET(nvmsr, CTRL_NVMSR_NVMESD) -#define NVME_CTRL_NVMSR_NVMEE(nvmsr) NVME_GET(nvmsr, CTRL_NVMSR_NVMEE) -#define NVME_CTRL_NVMSR_RSVD2(nvmsr) NVME_GET(nvmsr, CTRL_NVMSR_RSVD2) - -/** - * enum nvme_id_ctrl_vwci - This field indicates information about remaining - * number of times that VPD contents are able to be - * updated using the VPD Write command, see &struct - * nvme_id_ctrl.vwci. - * @NVME_CTRL_VWCI_VWCR_SHIFT: VWCR shift - * @NVME_CTRL_VWCI_VWCRV_SHIFT: VWCRV shift - * @NVME_CTRL_VWCI_VWCR_MASK: VWCR mask - * @NVME_CTRL_VWCI_VWCRV_MASK: VWCRV mask - * @NVME_CTRL_VWCI_VWCR: Mask to get value of VPD Write Cycles Remaining. If - * the VPD Write Cycle Remaining Valid bit is set, then - * this field contains a value indicating the remaining - * number of times that VPD contents are able to be - * updated using the VPD Write command. If this field is - * set to 7Fh, then the remaining number of times that - * VPD contents are able to be updated using the VPD - * Write command is greater than or equal to 7Fh. - * @NVME_CTRL_VWCI_VWCRV: VPD Write Cycle Remaining Valid. If this bit is set, - * then the VPD Write Cycle Remaining field is valid. If - * this bit is cleared, then the VPD Write Cycles - * Remaining field is invalid and cleared to 0h. - */ -enum nvme_id_ctrl_vwci { - NVME_CTRL_VWCI_VWCR_SHIFT = 0, - NVME_CTRL_VWCI_VWCRV_SHIFT = 7, - NVME_CTRL_VWCI_VWCR_MASK = 0x7f, - NVME_CTRL_VWCI_VWCRV_MASK = 0x1, - NVME_CTRL_VWCI_VWCR = NVME_VAL(CTRL_VWCI_VWCR), - NVME_CTRL_VWCI_VWCRV = NVME_VAL(CTRL_VWCI_VWCRV), -}; - -#define NVME_CTRL_VWCI_VWCR(vwci) NVME_GET(vwci, CTRL_VWCI_VWCR) -#define NVME_CTRL_VWCI_VWCRV(vwci) NVME_GET(vwci, CTRL_VWCI_VWCRV) - -/** - * enum nvme_id_ctrl_mec - Flags indicating the capabilities of the Management - * Endpoint in the Controller, &struct nvme_id_ctrl.mec. - * @NVME_CTRL_MEC_TWPME_SHIFT: TWPME shift - * @NVME_CTRL_MEC_PCIEME_SHIFT: PCIEME shift - * @NVME_CTRL_MEC_RSVD2_SHIFT: Reserved shift - * @NVME_CTRL_MEC_TWPME_MASK: TWPME mask - * @NVME_CTRL_MEC_PCIEME_MASK: PCIEME mask - * @NVME_CTRL_MEC_RSVD2_MASK: Reserved mask - * @NVME_CTRL_MEC_TWPME: If set, then the NVM Subsystem contains one or more - * Management Endpoints on the 2-Wire port. - * @NVME_CTRL_MEC_PCIEME: If set, then the NVM Subsystem contains one or more - * Management Endpoints on one or more PCIe ports. - */ -enum nvme_id_ctrl_mec { - NVME_CTRL_MEC_TWPME_SHIFT = 0, - NVME_CTRL_MEC_PCIEME_SHIFT = 1, - NVME_CTRL_MEC_RSVD2_SHIFT = 2, - NVME_CTRL_MEC_TWPME_MASK = 0x1, - NVME_CTRL_MEC_PCIEME_MASK = 0x1, - NVME_CTRL_MEC_RSVD2_MASK = 0x3f, - NVME_CTRL_MEC_TWPME = NVME_VAL(CTRL_MEC_TWPME), - NVME_CTRL_MEC_PCIEME = NVME_VAL(CTRL_MEC_PCIEME), -}; - -#define NVME_CTRL_MEC_TWPME(mec) NVME_GET(mec, CTRL_MEC_TWPME) -#define NVME_CTRL_MEC_PCIEME(mec) NVME_GET(mec, CTRL_MEC_PCIEME) -#define NVME_CTRL_MEC_RSVD2(mec) NVME_GET(mec, CTRL_MEC_RSVD2) - -/** - * enum nvme_id_ctrl_oacs - Flags indicating the optional Admin commands and - * features supported by the controller, see - * &struct nvme_id_ctrl.oacs. - * @NVME_CTRL_OACS_SSRS_SHIFT: Shift amount to get the Security Send Receive supported - * @NVME_CTRL_OACS_FNVMS_SHIFT:Shift amount to get the Format NVM supported - * @NVME_CTRL_OACS_FWDS_SHIFT: Shift amount to get the Firmware Download supported - * @NVME_CTRL_OACS_NMS_SHIFT: Shift amount to get the Namespace Management supported - * @NVME_CTRL_OACS_DSTS_SHIFT: Shift amount to get the Device Self-test supported - * @NVME_CTRL_OACS_DIRS_SHIFT: Shift amount to get the Directives supported - * @NVME_CTRL_OACS_NSRS_SHIFT: Shift amount to get the NVMe-MI Send Receive supported - * @NVME_CTRL_OACS_VMS_SHIFT: Shift amount to get the Virtualization Management supported - * @NVME_CTRL_OACS_DBCS_SHIFT: Shift amount to get the Doorbell Buffer Config supported - * @NVME_CTRL_OACS_GLSS_SHIFT: Shift amount to get the Get LBA Status supported - * @NVME_CTRL_OACS_CFLS_SHIFT: Shift amount to get the Command and Feature Lockdown supported - * @NVME_CTRL_OACS_HMLMS_SHIFT:Shift amount to get the Host Managed Live Migration support - * @NVME_CTRL_OACS_ENSS_SHIFT: Shift amount to get the Exported NVM Subsystem - * Support - * @NVME_CTRL_OACS_CCFLS_SHIFT: Shift amount to get the Controller-scoped - * Command and Feature Lockdown supported - * @NVME_CTRL_OACS_RSVD14_SHIFT:Shift amount to get the Reserved - * @NVME_CTRL_OACS_SSRS_MASK: Mask to get the Security Send Receive supported - * @NVME_CTRL_OACS_FNVMS_MASK: Mask to get the Format NVM supported - * @NVME_CTRL_OACS_FWDS_MASK: Mask to get the Firmware Download supported - * @NVME_CTRL_OACS_NMS_MASK: Mask to get the Namespace Management supported - * @NVME_CTRL_OACS_DSTS_MASK: Mask to get the Device Self-test supported - * @NVME_CTRL_OACS_DIRS_MASK: Mask to get the Directives supported - * @NVME_CTRL_OACS_NSRS_MASK: Mask to get the NVMe-MI Send Receive supported - * @NVME_CTRL_OACS_VMS_MASK: Mask to get the Virtualization Management supported - * @NVME_CTRL_OACS_DBCS_MASK: Mask to get the Doorbell Buffer Config supported - * @NVME_CTRL_OACS_GLSS_MASK: Mask to get the Get LBA Status supported - * @NVME_CTRL_OACS_CFLS_MASK: Mask to get the Command and Feature Lockdown supported - * @NVME_CTRL_OACS_HMLMS_MASK: Mask to get the Host Managed Live Migration support - * @NVME_CTRL_OACS_ENSS_MASK: Mask to get the Exported NVM Subsystem Support - * @NVME_CTRL_OACS_CCFLS_MASK: Mask to get the Controller-scoped Command and - * Feature Lockdown supported - * @NVME_CTRL_OACS_RSVD14_MASK:Mask to get the Reserved - * @NVME_CTRL_OACS_SSRS: If set, then the controller supports the - * Security Send and Security Receive commands. - * @NVME_CTRL_OACS_FNVMS: If set then the controller supports the Format - * NVM command. - * @NVME_CTRL_OACS_FWDS: If set, then the controller supports the - * Firmware Commit and Firmware Image Download commands. - * @NVME_CTRL_OACS_NMS: If set, then the controller supports the - * Namespace Management capability - * @NVME_CTRL_OACS_DSTS: If set, then the controller supports the Device - * Self-test command. - * @NVME_CTRL_OACS_DIRS: If set, then the controller supports Directives - * and the Directive Send and Directive Receive - * commands. - * @NVME_CTRL_OACS_NSRS: If set, then the controller supports the NVMe-MI - * Send and NVMe-MI Receive commands. - * @NVME_CTRL_OACS_VMS: If set, then the controller supports the - * Virtualization Management command. - * @NVME_CTRL_OACS_DBCS: If set, then the controller supports the - * Doorbell Buffer Config command. - * @NVME_CTRL_OACS_GLSS: If set, then the controller supports the Get LBA - * Status capability. - * @NVME_CTRL_OACS_CFLS: If set, then the controller supports the command - * and feature lockdown capability. - * @NVME_CTRL_OACS_HMLMS: If set, then the controller supports the - * Host Managed Live Migration capability. - * @NVME_CTRL_OACS_ENSS: If set, then the controller supports the - * Exported Resource Management capability. - * @NVME_CTRL_OACS_CCFLS: If set, then the controller supports the - * Controller-scoped Command and Feature Lockdown - * capability. Cleared to '0' if the Command and - * Feature Lockdown Supported (CFLS) bit is cleared - * to '0'. - */ -enum nvme_id_ctrl_oacs { - NVME_CTRL_OACS_SSRS_SHIFT = 0, - NVME_CTRL_OACS_FNVMS_SHIFT = 1, - NVME_CTRL_OACS_FWDS_SHIFT = 2, - NVME_CTRL_OACS_NMS_SHIFT = 3, - NVME_CTRL_OACS_DSTS_SHIFT = 4, - NVME_CTRL_OACS_DIRS_SHIFT = 5, - NVME_CTRL_OACS_NSRS_SHIFT = 6, - NVME_CTRL_OACS_VMS_SHIFT = 7, - NVME_CTRL_OACS_DBCS_SHIFT = 8, - NVME_CTRL_OACS_GLSS_SHIFT = 9, - NVME_CTRL_OACS_CFLS_SHIFT = 10, - NVME_CTRL_OACS_HMLMS_SHIFT = 11, - NVME_CTRL_OACS_ENSS_SHIFT = 12, - NVME_CTRL_OACS_CCFLS_SHIFT = 13, - NVME_CTRL_OACS_RSVD14_SHIFT = 14, - NVME_CTRL_OACS_SSRS_MASK = 1, - NVME_CTRL_OACS_FNVMS_MASK = 1, - NVME_CTRL_OACS_FWDS_MASK = 1, - NVME_CTRL_OACS_NMS_MASK = 1, - NVME_CTRL_OACS_DSTS_MASK = 1, - NVME_CTRL_OACS_DIRS_MASK = 1, - NVME_CTRL_OACS_NSRS_MASK = 1, - NVME_CTRL_OACS_VMS_MASK = 1, - NVME_CTRL_OACS_DBCS_MASK = 1, - NVME_CTRL_OACS_GLSS_MASK = 1, - NVME_CTRL_OACS_CFLS_MASK = 1, - NVME_CTRL_OACS_HMLMS_MASK = 1, - NVME_CTRL_OACS_ENSS_MASK = 1, - NVME_CTRL_OACS_CCFLS_MASK = 1, - NVME_CTRL_OACS_RSVD14_MASK = 3, - NVME_CTRL_OACS_SSRS = NVME_VAL(CTRL_OACS_SSRS), - NVME_CTRL_OACS_FNVMS = NVME_VAL(CTRL_OACS_FNVMS), - NVME_CTRL_OACS_FWDS = NVME_VAL(CTRL_OACS_FWDS), - NVME_CTRL_OACS_NMS = NVME_VAL(CTRL_OACS_NMS), - NVME_CTRL_OACS_DSTS = NVME_VAL(CTRL_OACS_DSTS), - NVME_CTRL_OACS_DIRS = NVME_VAL(CTRL_OACS_DIRS), - NVME_CTRL_OACS_NSRS = NVME_VAL(CTRL_OACS_NSRS), - NVME_CTRL_OACS_VMS = NVME_VAL(CTRL_OACS_VMS), - NVME_CTRL_OACS_DBCS = NVME_VAL(CTRL_OACS_DBCS), - NVME_CTRL_OACS_GLSS = NVME_VAL(CTRL_OACS_GLSS), - NVME_CTRL_OACS_CFLS = NVME_VAL(CTRL_OACS_CFLS), - NVME_CTRL_OACS_HMLMS = NVME_VAL(CTRL_OACS_HMLMS), - NVME_CTRL_OACS_ENSS = NVME_VAL(CTRL_OACS_ENSS), - NVME_CTRL_OACS_CCFLS = NVME_VAL(CTRL_OACS_CCFLS), -}; - -#define NVME_CTRL_OACS_SSRS(oacs) NVME_GET(oacs, CTRL_OACS_SSRS) -#define NVME_CTRL_OACS_FNVMS(oacs) NVME_GET(oacs, CTRL_OACS_FNVMS) -#define NVME_CTRL_OACS_FWDS(oacs) NVME_GET(oacs, CTRL_OACS_FWDS) -#define NVME_CTRL_OACS_NMS(oacs) NVME_GET(oacs, CTRL_OACS_NMS) -#define NVME_CTRL_OACS_DSTS(oacs) NVME_GET(oacs, CTRL_OACS_DSTS) -#define NVME_CTRL_OACS_DIRS(oacs) NVME_GET(oacs, CTRL_OACS_DIRS) -#define NVME_CTRL_OACS_NSRS(oacs) NVME_GET(oacs, CTRL_OACS_NSRS) -#define NVME_CTRL_OACS_VMS(oacs) NVME_GET(oacs, CTRL_OACS_VMS) -#define NVME_CTRL_OACS_DBCS(oacs) NVME_GET(oacs, CTRL_OACS_DBCS) -#define NVME_CTRL_OACS_GLSS(oacs) NVME_GET(oacs, CTRL_OACS_GLSS) -#define NVME_CTRL_OACS_CFLS(oacs) NVME_GET(oacs, CTRL_OACS_CFLS) -#define NVME_CTRL_OACS_HMLMS(oacs) NVME_GET(oacs, CTRL_OACS_HMLMS) -#define NVME_CTRL_OACS_ENSS(oacs) NVME_GET(oacs, CTRL_OACS_ENSS) -#define NVME_CTRL_OACS_CCFLS(oacs) NVME_GET(oacs, CTRL_OACS_CCFLS) -#define NVME_CTRL_OACS_RSVD14(oacs) NVME_GET(oacs, CTRL_OACS_RSVD14) - -/** - * enum nvme_id_ctrl_frmw - Flags and values indicates capabilities regarding - * firmware updates from &struct nvme_id_ctrl.frmw. - * @NVME_CTRL_FRMW_FFSRO_SHIFT: FFSRO shift - * @NVME_CTRL_FRMW_NOFS_SHIFT: NOFS shift - * @NVME_CTRL_FRMW_FAWR_SHIFT: FAWR shift - * @NVME_CTRL_FRMW_SMUD_SHIFT: SMUD shift - * @NVME_CTRL_FRMW_RSVD6_SHIFT: Reserved shift - * @NVME_CTRL_FRMW_FFSRO_MASK: FFSRO mask - * @NVME_CTRL_FRMW_NOFS_MASK: NOFS mask - * @NVME_CTRL_FRMW_FAWR_MASK: FAWR mask - * @NVME_CTRL_FRMW_SMUD_MASK: SMUD mask - * @NVME_CTRL_FRMW_RSVD6_MASK: Reserved mask - * @NVME_CTRL_FRMW_FFSRO: If set, the first firmware slot is readonly - * @NVME_CTRL_FRMW_NOFS: Mask to get the value of the number of - * firmware slots that the controller supports. - * @NVME_CTRL_FRMW_FAWR: If set, the controller supports firmware - * activation without a reset. - * @NVME_CTRL_FRMW_SMUD: If set, the controller is able to detect - * overlapping firmware/boot partition - * image update. - */ -enum nvme_id_ctrl_frmw { - NVME_CTRL_FRMW_FFSRO_SHIFT = 0, - NVME_CTRL_FRMW_NOFS_SHIFT = 1, - NVME_CTRL_FRMW_FAWR_SHIFT = 4, - NVME_CTRL_FRMW_SMUD_SHIFT = 5, - NVME_CTRL_FRMW_RSVD6_SHIFT = 6, - NVME_CTRL_FRMW_FFSRO_MASK = 0x1, - NVME_CTRL_FRMW_NOFS_MASK = 0x7, - NVME_CTRL_FRMW_FAWR_MASK = 0x1, - NVME_CTRL_FRMW_SMUD_MASK = 0x1, - NVME_CTRL_FRMW_RSVD6_MASK = 0x3, - NVME_CTRL_FRMW_FFSRO = NVME_VAL(CTRL_FRMW_FFSRO), - NVME_CTRL_FRMW_NOFS = NVME_VAL(CTRL_FRMW_NOFS), - NVME_CTRL_FRMW_FAWR = NVME_VAL(CTRL_FRMW_FAWR), - NVME_CTRL_FRMW_SMUD = NVME_VAL(CTRL_FRMW_SMUD), -}; - -#define NVME_CTRL_FRMW_FFSRO(frmw) NVME_GET(frmw, CTRL_FRMW_FFSRO) -#define NVME_CTRL_FRMW_NOFS(frmw) NVME_GET(frmw, CTRL_FRMW_NOFS) -#define NVME_CTRL_FRMW_FAWR(frmw) NVME_GET(frmw, CTRL_FRMW_FAWR) -#define NVME_CTRL_FRMW_SMUD(frmw) NVME_GET(frmw, CTRL_FRMW_SMUD) -#define NVME_CTRL_FRMW_RSVD6(frmw) NVME_GET(frmw, CTRL_FRMW_RSVD6) - -/** - * enum nvme_id_ctrl_lpa - Flags indicating optional attributes for log pages - * that are accessed via the Get Log Page command. - * @NVME_CTRL_LPA_SMARTS_SHIFT: SMARTS shift - * @NVME_CTRL_LPA_CSES_SHIFT: CSES shift - * @NVME_CTRL_LPA_LPEDS_SHIFT: LPEDS shift - * @NVME_CTRL_LPA_TS_SHIFT: TS shift - * @NVME_CTRL_LPA_PES_SHIFT: PES shift - * @NVME_CTRL_LPA_MLPS_SHIFT: MLPS shift - * @NVME_CTRL_LPA_DA4S_SHIFT: DA4S shift - * @NVME_CTRL_LPA_RSVD7_SHIFT: Reserved shift - * @NVME_CTRL_LPA_SMARTS_MASK: SMARTS mask - * @NVME_CTRL_LPA_CSES_MASK: CSES mask - * @NVME_CTRL_LPA_LPEDS_MASK: LPEDS mask - * @NVME_CTRL_LPA_TS_MASK: TS mask - * @NVME_CTRL_LPA_PES_MASK: PES mask - * @NVME_CTRL_LPA_MLPS_MASK: MLPS mask - * @NVME_CTRL_LPA_DA4S_MASK: DA4S mask - * @NVME_CTRL_LPA_RSVD7_MASK: Reserved mask - * @NVME_CTRL_LPA_SMARTS: If set, controller supports SMART/Health log - * page on a per namespace basis. - * @NVME_CTRL_LPA_CSES: If Set, the controller supports the commands - * supported and effects log page. - * @NVME_CTRL_LPA_LPEDS: If set, the controller supports extended data - * for log page command including extended number - * of dwords and log page offset fields. - * @NVME_CTRL_LPA_TS: If set, the controller supports the telemetry - * host-initiated and telemetry controller-initiated - * log pages and sending telemetry log notices. - * @NVME_CTRL_LPA_PES: If set, the controller supports - * persistent event log. - * @NVME_CTRL_LPA_MLPS: If set, the controller supports - * the log pages log page, the scope of - * each command in the commands - * supported and effects log page, the - * feature identifiers supported and - * effects log page, and the NVMe-MI - * commands supported and effects log - * page. - * @NVME_CTRL_LPA_DA4S: If set, the controller supports data - * area 4 for telemetry host-initiated and - * telemetry. - */ -enum nvme_id_ctrl_lpa { - NVME_CTRL_LPA_SMARTS_SHIFT = 0, - NVME_CTRL_LPA_CSES_SHIFT = 1, - NVME_CTRL_LPA_LPEDS_SHIFT = 2, - NVME_CTRL_LPA_TS_SHIFT = 3, - NVME_CTRL_LPA_PES_SHIFT = 4, - NVME_CTRL_LPA_MLPS_SHIFT = 5, - NVME_CTRL_LPA_DA4S_SHIFT = 6, - NVME_CTRL_LPA_RSVD7_SHIFT = 7, - NVME_CTRL_LPA_SMARTS_MASK = 0x1, - NVME_CTRL_LPA_CSES_MASK = 0x1, - NVME_CTRL_LPA_LPEDS_MASK = 0x1, - NVME_CTRL_LPA_TS_MASK = 0x1, - NVME_CTRL_LPA_PES_MASK = 0x1, - NVME_CTRL_LPA_MLPS_MASK = 0x1, - NVME_CTRL_LPA_DA4S_MASK = 0x1, - NVME_CTRL_LPA_RSVD7_MASK = 0x1, - NVME_CTRL_LPA_SMARTS = NVME_VAL(CTRL_LPA_SMARTS), - NVME_CTRL_LPA_CSES = NVME_VAL(CTRL_LPA_CSES), - NVME_CTRL_LPA_LPEDS = NVME_VAL(CTRL_LPA_LPEDS), - NVME_CTRL_LPA_TS = NVME_VAL(CTRL_LPA_TS), - NVME_CTRL_LPA_PES = NVME_VAL(CTRL_LPA_PES), - NVME_CTRL_LPA_MLPS = NVME_VAL(CTRL_LPA_MLPS), - NVME_CTRL_LPA_DA4S = NVME_VAL(CTRL_LPA_DA4S), -}; - -#define NVME_CTRL_LPA_SMARTS(lpa) NVME_GET(lpa, CTRL_LPA_SMARTS) -#define NVME_CTRL_LPA_CSES(lpa) NVME_GET(lpa, CTRL_LPA_CSES) -#define NVME_CTRL_LPA_LPEDS(lpa) NVME_GET(lpa, CTRL_LPA_LPEDS) -#define NVME_CTRL_LPA_TS(lpa) NVME_GET(lpa, CTRL_LPA_TS) -#define NVME_CTRL_LPA_PES(lpa) NVME_GET(lpa, CTRL_LPA_PES) -#define NVME_CTRL_LPA_MLPS(lpa) NVME_GET(lpa, CTRL_LPA_MLPS) -#define NVME_CTRL_LPA_DA4S(lpa) NVME_GET(lpa, CTRL_LPA_DA4S) -#define NVME_CTRL_LPA_RSVD7(lpa) NVME_GET(lpa, CTRL_LPA_RSVD7) - -/** - * enum nvme_id_ctrl_avscc - Flags indicating the configuration settings for - * Admin Vendor Specific command handling. - * @NVME_CTRL_AVSCC_VSCF_SHIFT: VSCF shift - * @NVME_CTRL_AVSCC_RSVD1_SHIFT:Reserved shift - * @NVME_CTRL_AVSCC_VSCF_MASK: VSCF mask - * @NVME_CTRL_AVSCC_RSVD1_MASK: Reserved mask - * @NVME_CTRL_AVSCC_VSCF: If set, all Admin Vendor Specific Commands use - * the optional vendor specific command format with - * NDT and NDM fields. - */ -enum nvme_id_ctrl_avscc { - NVME_CTRL_AVSCC_VSCF_SHIFT = 0, - NVME_CTRL_AVSCC_RSVD1_SHIFT = 1, - NVME_CTRL_AVSCC_VSCF_MASK = 0x1, - NVME_CTRL_AVSCC_RSVD1_MASK = 0x7f, - NVME_CTRL_AVSCC_VSCF = NVME_VAL(CTRL_AVSCC_VSCF), -}; - -#define NVME_CTRL_AVSCC_VSCF(avscc) NVME_GET(avscc, CTRL_AVSCC_VSCF) -#define NVME_CTRL_AVSCC_RSVD1(avscc) NVME_GET(avscc, CTRL_AVSCC_RSVD1) - -/** - * enum nvme_id_ctrl_apsta - Flags indicating the attributes of the autonomous - * power state transition feature. - * @NVME_CTRL_APSTA_APTS_SHIFT: APTS shift - * @NVME_CTRL_APSTA_RSVD1_SHIFT: Reserved shift - * @NVME_CTRL_APSTA_APTS_MASK: APTS mask - * @NVME_CTRL_APSTA_RSVD1_MASK: Reserved mask - * @NVME_CTRL_APSTA_APST: If set, then the controller supports autonomous power - * state transitions. - */ -enum nvme_id_ctrl_apsta { - NVME_CTRL_APSTA_APTS_SHIFT = 0, - NVME_CTRL_APSTA_RSVD1_SHIFT = 1, - NVME_CTRL_APSTA_APTS_MASK = 0x0, - NVME_CTRL_APSTA_RSVD1_MASK = 0x7f, - NVME_CTRL_APSTA_APST = NVME_VAL(CTRL_APSTA_APTS), -}; - -#define NVME_CTRL_APSTA_APTS(apsta) NVME_GET(apsta, CTRL_APSTA_APTS) -#define NVME_CTRL_APSTA_RSVD1(apsta) NVME_GET(apsta, CTRL_APSTA_RSVD1) - -/** - * enum nvme_id_ctrl_rpmbs - This field indicates if the controller supports - * one or more Replay Protected Memory Blocks, from - * &struct nvme_id_ctrl.rpmbs. - * @NVME_CTRL_RPMBS_NRPMBU_SHIFT:NRPMBU shift - * @NVME_CTRL_RPMBS_AUTHM_SHIFT: AUTHM shift - * @NVME_CTRL_RPMBS_RSVD6_SHIFT: Reserved shift - * @NVME_CTRL_RPMBS_TSZE_SHIFT: TSZE shift - * @NVME_CTRL_RPMBS_ASZE_SHIFT: ASZE shift - * @NVME_CTRL_RPMBS_NRPMBU_MASK: NRPMBU mask - * @NVME_CTRL_RPMBS_AUTHM_MASK: AUTHM mask - * @NVME_CTRL_RPMBS_RSVD6_MASK: Reserved mask - * @NVME_CTRL_RPMBS_TSZE_MASK: TSZE mask - * @NVME_CTRL_RPMBS_ASZE_MASK: ASZE mask - * @NVME_CTRL_RPMBS_NR_UNITS: Mask to get the value of the Number of RPMB Units - * @NVME_CTRL_RPMBS_AUTH_METHOD: Mask to get the value of the Authentication Method - * @NVME_CTRL_RPMBS_TOTAL_SIZE: Mask to get the value of Total Size - * @NVME_CTRL_RPMBS_ACCESS_SIZE: Mask to get the value of Access Size - */ -enum nvme_id_ctrl_rpmbs { - NVME_CTRL_RPMBS_NRPMBU_SHIFT = 0, - NVME_CTRL_RPMBS_AUTHM_SHIFT = 3, - NVME_CTRL_RPMBS_RSVD6_SHIFT = 6, - NVME_CTRL_RPMBS_TSZE_SHIFT = 16, - NVME_CTRL_RPMBS_ASZE_SHIFT = 24, - NVME_CTRL_RPMBS_NRPMBU_MASK = 0x7, - NVME_CTRL_RPMBS_AUTHM_MASK = 0x7, - NVME_CTRL_RPMBS_RSVD6_MASK = 0x3ff, - NVME_CTRL_RPMBS_TSZE_MASK = 0xff, - NVME_CTRL_RPMBS_ASZE_MASK = 0xff, - NVME_CTRL_RPMBS_NR_UNITS = NVME_VAL(CTRL_RPMBS_NRPMBU), - NVME_CTRL_RPMBS_AUTH_METHOD = NVME_VAL(CTRL_RPMBS_AUTHM), - NVME_CTRL_RPMBS_TOTAL_SIZE = NVME_VAL(CTRL_RPMBS_TSZE), - NVME_CTRL_RPMBS_ACCESS_SIZE = NVME_VAL(CTRL_RPMBS_ASZE), -}; - -#define NVME_CTRL_RPMBS_NRPMBU(rpmbs) NVME_GET(rpmbs, CTRL_RPMBS_NRPMBU) -#define NVME_CTRL_RPMBS_AUTHM(rpmbs) NVME_GET(rpmbs, CTRL_RPMBS_AUTHM) -#define NVME_CTRL_RPMBS_RSVD6(rpmbs) NVME_GET(rpmbs, CTRL_RPMBS_RSVD6) -#define NVME_CTRL_RPMBS_TSZE(rpmbs) NVME_GET(rpmbs, CTRL_RPMBS_TSZE) -#define NVME_CTRL_RPMBS_ASZE(rpmbs) NVME_GET(rpmbs, CTRL_RPMBS_ASZE) - -/** - * enum nvme_id_ctrl_dsto - Flags indicating the optional Device Self-test - * command or operation behaviors supported by the - * controller or NVM subsystem. - * @NVME_CTRL_DSTO_SDSO_SHIFT: Shift amount to get the value of Single Device Self-test - * Operation from Device Self-test Options field. - * @NVME_CTRL_DSTO_HIRS_SHIFT: Shift amount to get the value of Host-Initiated Refresh - * Support from Device Self-test Options field. - * @NVME_CTRL_DSTO_RSVD2_SHIFT: Shift amount to get the Reserved - * @NVME_CTRL_DSTO_SDSO_MASK: Mask to get the value of Single Device Self-test Operation - * @NVME_CTRL_DSTO_HIRS_MASK: Mask to get the value of Host-Initiated Refresh Support - * @NVME_CTRL_DSTO_RSVD2_MASK: Mask to get the value of Reserved - * @NVME_CTRL_DSTO_ONE_DST: If set, then the NVM subsystem supports only one device - * self-test operation in progress at a time. If cleared, - * then the NVM subsystem supports one device self-test - * operation per controller at a time. - * @NVME_CTRL_DSTO_HIRS: If set, then the controller supports the Host-Initiated - * Refresh capability. - */ -enum nvme_id_ctrl_dsto { - NVME_CTRL_DSTO_SDSO_SHIFT = 0, - NVME_CTRL_DSTO_HIRS_SHIFT = 1, - NVME_CTRL_DSTO_RSVD2_SHIFT = 2, - NVME_CTRL_DSTO_SDSO_MASK = 0x1, - NVME_CTRL_DSTO_HIRS_MASK = 0x1, - NVME_CTRL_DSTO_RSVD2_MASK = 0x3f, - NVME_CTRL_DSTO_ONE_DST = NVME_VAL(CTRL_DSTO_SDSO), - NVME_CTRL_DSTO_HIRS = NVME_VAL(CTRL_DSTO_HIRS), -}; - -#define NVME_CTRL_DSTO_SDSO(dsto) NVME_GET(dsto, CTRL_DSTO_SDSO) -#define NVME_CTRL_DSTO_HIRS(dsto) NVME_GET(dsto, CTRL_DSTO_HIRS) -#define NVME_CTRL_DSTO_RSVD2(dsto) NVME_GET(dsto, CTRL_DSTO_RSVD2) - -/** - * enum nvme_id_ctrl_hctm - Flags indicate the attributes of the host - * controlled thermal management feature - * @NVME_CTRL_HCTMA_HCTMS_SHIFT: HCTMS shift - * @NVME_CTRL_HCTMA_RSVD1_SHIFT: Reserved shift - * @NVME_CTRL_HCTMA_HCTMS_MASK: HCTMS mask - * @NVME_CTRL_HCTMA_RSVD1_MASK: Reserved mask - * @NVME_CTRL_HCTMA_HCTM: then the controller supports host controlled thermal - * management, and the Set Features command and Get - * Features command with the Feature Identifier field - * set to %NVME_FEAT_FID_HCTM. - */ -enum nvme_id_ctrl_hctm { - NVME_CTRL_HCTMA_HCTMS_SHIFT = 0, - NVME_CTRL_HCTMA_RSVD1_SHIFT = 1, - NVME_CTRL_HCTMA_HCTMS_MASK = 0x1, - NVME_CTRL_HCTMA_RSVD1_MASK = 0x7fff, - NVME_CTRL_HCTMA_HCTM = NVME_VAL(CTRL_HCTMA_HCTMS), -}; - -#define NVME_CTRL_HCTMA_HCTMS(hctma) NVME_GET(hctma, CTRL_HCTMA_HCTMS) -#define NVME_CTRL_HCTMA_RSVD1(hctma) NVME_GET(hctma, CTRL_HCTMA_RSVD1) - -/** - * enum nvme_id_ctrl_sanicap - Indicates attributes for sanitize operations. - * @NVME_CTRL_SANICAP_CES_SHIFT: Crypto erase support shift - * @NVME_CTRL_SANICAP_BES_SHIFT: Block erase support shift - * @NVME_CTRL_SANICAP_OWS_SHIFT: Overwrite support shift - * @NVME_CTRL_SANICAP_VERS_SHIFT: Verification support shift - * @NVME_CTRL_SANICAP_NVERS_SHIFT: Namespace verification support shift - * @NVME_CTRL_SANICAP_NDI_SHIFT: No-deallocate inhibited shift - * @NVME_CTRL_SANICAP_NODMMAS_SHIFT: No-deallocate modifies media after sanitize - * shift - * @NVME_CTRL_SANICAP_SPRRS_SHIFT: Sanitize purge request and reporting - * supported shift - * @NVME_CTRL_SANICAP_RSVD6_SHIFT: Reserved shift - * @NVME_CTRL_SANICAP_CES_MASK: Crypto erase support mask - * @NVME_CTRL_SANICAP_BES_MASK: Block erase support mask - * @NVME_CTRL_SANICAP_OWS_MASK: Overwrite support mask - * @NVME_CTRL_SANICAP_VERS_MASK: Verification support mask - * @NVME_CTRL_SANICAP_NVERS_MASK: Namespace verification support mask - * @NVME_CTRL_SANICAP_NDI_MASK: No-deallocate inhibited mask - * @NVME_CTRL_SANICAP_NODMMAS_MASK: No-deallocate modifies media after sanitize - * mask - * @NVME_CTRL_SANICAP_SPRRS_MASK: Sanitize purge request and reporting - * supported mask - * @NVME_CTRL_SANICAP_RSVD6_MASK: Reserved mask - * @NVME_CTRL_SANICAP_CES: Crypto Erase Support. If set, then the - * controller supports the Crypto Erase sanitize operation. - * @NVME_CTRL_SANICAP_BES: Block Erase Support. If set, then the controller - * supports the Block Erase sanitize operation. - * @NVME_CTRL_SANICAP_OWS: Overwrite Support. If set, then the controller - * supports the Overwrite sanitize operation. - * @NVME_CTRL_SANICAP_VERS: Verification support - * @NVME_CTRL_SANICAP_NVERS: Namespace verification support - * @NVME_CTRL_SANICAP_NDI: No-Deallocate Inhibited. If set and the No- - * Deallocate Response Mode bit is set, then the - * controller deallocates after the sanitize - * operation even if the No-Deallocate After - * Sanitize bit is set in a Sanitize command. - * @NVME_CTRL_SANICAP_NODMMAS: No-Deallocate Modifies Media After Sanitize, - * mask to extract value. - * @NVME_CTRL_SANICAP_SPRRS: Sanitize Purge Request and Reporting - * Supported. If set, then the controller supports - * the Purged (PRGD) field in the Sanitize Status - * log page and the Purge Required (PREQ) bit in - * the Sanitize command and the Sanitize Namespace - * command. - */ -enum nvme_id_ctrl_sanicap { - NVME_CTRL_SANICAP_CES_SHIFT = 0, - NVME_CTRL_SANICAP_BES_SHIFT = 1, - NVME_CTRL_SANICAP_OWS_SHIFT = 2, - NVME_CTRL_SANICAP_VERS_SHIFT = 3, - NVME_CTRL_SANICAP_NVERS_SHIFT = 4, - NVME_CTRL_SANICAP_SPRRS_SHIFT = 5, - NVME_CTRL_SANICAP_RSVD6_SHIFT = 6, - NVME_CTRL_SANICAP_NDI_SHIFT = 29, - NVME_CTRL_SANICAP_NODMMAS_SHIFT = 30, - NVME_CTRL_SANICAP_CES_MASK = 0x1, - NVME_CTRL_SANICAP_BES_MASK = 0x1, - NVME_CTRL_SANICAP_OWS_MASK = 0x1, - NVME_CTRL_SANICAP_VERS_MASK = 0x1, - NVME_CTRL_SANICAP_NVERS_MASK = 0x1, - NVME_CTRL_SANICAP_SPRRS_MASK = 0x1, - NVME_CTRL_SANICAP_RSVD6_MASK = 0x7fffff, - NVME_CTRL_SANICAP_NDI_MASK = 0x1, - NVME_CTRL_SANICAP_NODMMAS_MASK = 0x3, - NVME_CTRL_SANICAP_CES = NVME_VAL(CTRL_SANICAP_CES), - NVME_CTRL_SANICAP_BES = NVME_VAL(CTRL_SANICAP_BES), - NVME_CTRL_SANICAP_OWS = NVME_VAL(CTRL_SANICAP_OWS), - NVME_CTRL_SANICAP_VERS = NVME_VAL(CTRL_SANICAP_VERS), - NVME_CTRL_SANICAP_NVERS = NVME_VAL(CTRL_SANICAP_NVERS), - NVME_CTRL_SANICAP_SPRRS = NVME_VAL(CTRL_SANICAP_SPRRS), - NVME_CTRL_SANICAP_NDI = NVME_VAL(CTRL_SANICAP_NDI), - NVME_CTRL_SANICAP_NODMMAS = NVME_VAL(CTRL_SANICAP_NODMMAS), -}; - -#define NVME_CTRL_SANICAP_CES(sanicap) NVME_GET(sanicap, CTRL_SANICAP_CES) -#define NVME_CTRL_SANICAP_BES(sanicap) NVME_GET(sanicap, CTRL_SANICAP_BES) -#define NVME_CTRL_SANICAP_OWS(sanicap) NVME_GET(sanicap, CTRL_SANICAP_OWS) -#define NVME_CTRL_SANICAP_VERS(sanicap) NVME_GET(sanicap, CTRL_SANICAP_VERS) -#define NVME_CTRL_SANICAP_NVERS(sanicap) NVME_GET(sanicap, CTRL_SANICAP_NVERS) -#define NVME_CTRL_SANICAP_SPRRS(sanicap) NVME_GET(sanicap, CTRL_SANICAP_SPRRS) -#define NVME_CTRL_SANICAP_RSVD6(sanicap) NVME_GET(sanicap, CTRL_SANICAP_RSVD6) -#define NVME_CTRL_SANICAP_NDI(sanicap) NVME_GET(sanicap, CTRL_SANICAP_NDI) -#define NVME_CTRL_SANICAP_NODMMAS(sanicap) \ - NVME_GET(sanicap, CTRL_SANICAP_NODMMAS) - -/** - * enum nvme_id_ctrl_anacap - This field indicates the capabilities associated - * with Asymmetric Namespace Access Reporting. - * @NVME_CTRL_ANACAP_RANAOS_SHIFT: RANAOS shift - * @NVME_CTRL_ANACAP_RANANOS_SHIFT: RANANOS shift - * @NVME_CTRL_ANACAP_RANAIS_SHIFT: RANAIS shift - * @NVME_CTRL_ANACAP_RANAPLS_SHIFT: RANPLOS shift - * @NVME_CTRL_ANACAP_RANACS_SHIFT: RANACS shift - * @NVME_CTRL_ANACAP_RSVD5_SHIFT: Reserved shift - * @NVME_CTRL_ANACAP_ANAGIDLWAS_SHIFT:RANAGIDLWAS shift - * @NVME_CTRL_ANACAP_ANAGIDS_SHIFT: RANAGIDS shift - * @NVME_CTRL_ANACAP_RANAOS_MASK: RANAOS mask - * @NVME_CTRL_ANACAP_RANANOS_MASK: RANANOS shift - * @NVME_CTRL_ANACAP_RANAIS_MASK: RANAIS shift - * @NVME_CTRL_ANACAP_RANAPLS_MASK: RANAPLS shift - * @NVME_CTRL_ANACAP_RANACS_MASK: RANACS shift - * @NVME_CTRL_ANACAP_RSVD5_MASK: Reserved shift - * @NVME_CTRL_ANACAP_ANAGIDLWAS_MASK: RANAGIDLWAS shift - * @NVME_CTRL_ANACAP_ANAGIDS_MASK: RANAGIDS shift - * @NVME_CTRL_ANACAP_OPT: If set, then the controller is able to - * report ANA Optimized state. - * @NVME_CTRL_ANACAP_NON_OPT: If set, then the controller is able to - * report ANA Non-Optimized state. - * @NVME_CTRL_ANACAP_INACCESSIBLE: If set, then the controller is able to - * report ANA Inaccessible state. - * @NVME_CTRL_ANACAP_PERSISTENT_LOSS: If set, then the controller is able to - * report ANA Persistent Loss state. - * @NVME_CTRL_ANACAP_CHANGE: If set, then the controller is able to - * report ANA Change state. - * @NVME_CTRL_ANACAP_GRPID_NO_CHG: If set, then the ANAGRPID field in the - * Identify Namespace data structure - * (&struct nvme_id_ns.anagrpid), does not - * change while the namespace is attached to - * any controller. - * @NVME_CTRL_ANACAP_GRPID_MGMT: If set, then the controller supports a - * non-zero value in the ANAGRPID field of - * the Namespace Management command. - */ -enum nvme_id_ctrl_anacap { - NVME_CTRL_ANACAP_RANAOS_SHIFT = 0, - NVME_CTRL_ANACAP_RANANOS_SHIFT = 1, - NVME_CTRL_ANACAP_RANAIS_SHIFT = 2, - NVME_CTRL_ANACAP_RANAPLS_SHIFT = 3, - NVME_CTRL_ANACAP_RANACS_SHIFT = 4, - NVME_CTRL_ANACAP_RSVD5_SHIFT = 5, - NVME_CTRL_ANACAP_ANAGIDLWAS_SHIFT = 6, - NVME_CTRL_ANACAP_ANAGIDS_SHIFT = 7, - NVME_CTRL_ANACAP_RANAOS_MASK = 0x1, - NVME_CTRL_ANACAP_RANANOS_MASK = 0x1, - NVME_CTRL_ANACAP_RANAIS_MASK = 0x1, - NVME_CTRL_ANACAP_RANAPLS_MASK = 0x1, - NVME_CTRL_ANACAP_RANACS_MASK = 0x1, - NVME_CTRL_ANACAP_RSVD5_MASK = 0x1, - NVME_CTRL_ANACAP_ANAGIDLWAS_MASK = 0x1, - NVME_CTRL_ANACAP_ANAGIDS_MASK = 0x1, - NVME_CTRL_ANACAP_OPT = NVME_VAL(CTRL_ANACAP_RANAOS), - NVME_CTRL_ANACAP_NON_OPT = NVME_VAL(CTRL_ANACAP_RANANOS), - NVME_CTRL_ANACAP_INACCESSIBLE = NVME_VAL(CTRL_ANACAP_RANAIS), - NVME_CTRL_ANACAP_PERSISTENT_LOSS = NVME_VAL(CTRL_ANACAP_RANAPLS), - NVME_CTRL_ANACAP_CHANGE = NVME_VAL(CTRL_ANACAP_RANACS), - NVME_CTRL_ANACAP_GRPID_NO_CHG = NVME_VAL(CTRL_ANACAP_ANAGIDLWAS), - NVME_CTRL_ANACAP_GRPID_MGMT = NVME_VAL(CTRL_ANACAP_ANAGIDS), -}; - -#define NVME_CTRL_ANACAP_RANAOS(anacap) NVME_GET(anacap, CTRL_ANACAP_RANAOS) -#define NVME_CTRL_ANACAP_RANANOS(anacap) NVME_GET(anacap, CTRL_ANACAP_RANANOS) -#define NVME_CTRL_ANACAP_RANAIS(anacap) NVME_GET(anacap, CTRL_ANACAP_RANAIS) -#define NVME_CTRL_ANACAP_RANAPLS(anacap) NVME_GET(anacap, CTRL_ANACAP_RANAPLS) -#define NVME_CTRL_ANACAP_RANACS(anacap) NVME_GET(anacap, CTRL_ANACAP_RANACS) -#define NVME_CTRL_ANACAP_RSVD5(anacap) NVME_GET(anacap, CTRL_ANACAP_RSVD5) -#define NVME_CTRL_ANACAP_ANAGIDLWAS(anacap) \ - NVME_GET(anacap, CTRL_ANACAP_ANAGIDLWAS) -#define NVME_CTRL_ANACAP_ANAGIDS(anacap) NVME_GET(anacap, CTRL_ANACAP_ANAGIDS) - -/** - * enum nvme_id_ctrl_kpioc - Key Per I/O Capabilities - * @NVME_CTRL_KPIOC_KPIOS_SHIFT: Shift amount to get the Key Per I/O Supported from the - * &struct nvme_id_ctrl.kpioc field. - * @NVME_CTRL_KPIOC_KPIOSC_SHIFT: Shift amount to get the Key Per I/O Scope from the - * &struct nvme_id_ctrl.kpioc field. - * @NVME_CTRL_KPIOC_RSVD2_SHIFT: Shift amount to get the Reserved - * @NVME_CTRL_KPIOC_KPIOS_MASK: Mask to get the Key Per I/O Supported from the - * &struct nvme_id_ctrl.kpioc field. - * @NVME_CTRL_KPIOC_KPIOSC_MASK: Mask to get the Key Per I/O Scope from the - * &struct nvme_id_ctrl.kpioc field. - * @NVME_CTRL_KPIOC_RSVD2_MASK: Mask to get the Reserved - */ -enum nvme_id_ctrl_kpioc { - NVME_CTRL_KPIOC_KPIOS_SHIFT = 0, - NVME_CTRL_KPIOC_KPIOSC_SHIFT = 1, - NVME_CTRL_KPIOC_RSVD2_SHIFT = 2, - NVME_CTRL_KPIOC_KPIOS_MASK = 0x1, - NVME_CTRL_KPIOC_KPIOSC_MASK = 0x1, - NVME_CTRL_KPIOC_RSVD2_MASK = 0x3f, -}; - -#define NVME_CTRL_KPIOC_KPIOS(kpioc) NVME_GET(kpioc, CTRL_KPIOC_KPIOS) -#define NVME_CTRL_KPIOC_KPIOSC(kpioc) NVME_GET(kpioc, CTRL_KPIOC_KPIOSC) -#define NVME_CTRL_KPIOC_RSVD2(kpioc) NVME_GET(kpioc, CTRL_KPIOC_RSVD2) - -/** - * enum nvme_id_ctrl_tmpthha - Temperature Threshold Hysteresis Attributes - * @NVME_CTRL_TMPTHHA_TMPTHMH_SHIFT: TMPTHMH shift - * @NVME_CTRL_TMPTHHA_RSVD3_SHIFT: Reserved shift - * @NVME_CTRL_TMPTHHA_TMPTHMH_MASK: TMPTHMH mask - * @NVME_CTRL_TMPTHHA_RSVD3_MASK: Reserved mask - */ -enum nvme_id_ctrl_tmpthha { - NVME_CTRL_TMPTHHA_TMPTHMH_SHIFT = 0, - NVME_CTRL_TMPTHHA_RSVD3_SHIFT = 3, - NVME_CTRL_TMPTHHA_TMPTHMH_MASK = 0x7, - NVME_CTRL_TMPTHHA_RSVD3_MASK = 0x1f, -}; - -#define NVME_CTRL_TMPTHHA_TMPTHMH(tmpthha) \ - NVME_GET(tmpthha, CTRL_TMPTHHA_TMPTHMH) -#define NVME_CTRL_TMPTHHA_RSVD3(tmpthha) NVME_GET(tmpthha, CTRL_TMPTHHA_RSVD3) -/** - * enum nvme_id_ctrl_mupa - Maximum Unlimited Power Attributes - * @NVME_CTRL_MUPA_MUPS_SHIFT: Shift amount to get the Maximum Unlimited Power - * Scale - * @NVME_CTRL_MUPA_MUPS_MASK: Mask to get the Maximum Unlimited Power Scale - */ -enum nvme_id_ctrl_mupa { - NVME_CTRL_MUPA_MUPS_SHIFT = 0, - NVME_CTRL_MUPA_MUPS_MASK = 0x3, -}; - -#define NVME_CTRL_MUPA_MUPS(MUPA) NVME_GET(MUPA, CTRL_MUPA_MUPS) - -/** - * enum nvme_id_ctrl_cdpa - Configurable Device Personality Attributes - * @NVME_CTRL_CDPA_CDPALG_SHIFT: CDPALG shift - * @NVME_CTRL_CDPA_RSVD8_SHIFT: RSVD8 shift - * @NVME_CTRL_CDPA_CDPALG_HS3_SHIFT: CDPALG.HS3 shift - * @NVME_CTRL_CDPA_CDPALG_RSVD1_SHIFT: CDPALG.RSVD1 shift - * @NVME_CTRL_CDPA_CDPALG_MASK: CDPALG mask - * @NVME_CTRL_CDPA_RSVD8_MASK: RSVD8 mask - * @NVME_CTRL_CDPA_CDPALG_HS3_MASK: CDPALG.HS3 mask - * @NVME_CTRL_CDPA_CDPALG_RSVD1_MASK: CDPALG.RSVD1 mask - * @NVME_CTRL_CDPA_HMAC_SHA_384: If set, then the controller supports - * the HMAC-SHA-384 standard. - */ -enum nvme_id_ctrl_cdpa { - NVME_CTRL_CDPA_CDPALG_SHIFT = 0, - NVME_CTRL_CDPA_RSVD8_SHIFT = 8, - NVME_CTRL_CDPA_CDPALG_HS3_SHIFT = 0, - NVME_CTRL_CDPA_CDPALG_RSVD1_SHIFT = 1, - NVME_CTRL_CDPA_CDPALG_MASK = 0xff, - NVME_CTRL_CDPA_RSVD8_MASK = 0xff, - NVME_CTRL_CDPA_CDPALG_HS3_MASK = 0x1, - NVME_CTRL_CDPA_CDPALG_RSVD1_MASK = 0x7f, - NVME_CTRL_CDPA_HMAC_SHA_384 = NVME_VAL(CTRL_CDPA_CDPALG_HS3), -}; - -#define NVME_CTRL_CDPA_CDPALG(cdpa) NVME_GET(cdpa, CTRL_CDPA_CDPALG) -#define NVME_CTRL_CDPA_RSVD8(cdpa) NVME_GET(cdpa, CTRL_CDPA_RSVD8) -#define NVME_CTRL_CDPA_CDPALG_HS3(cdpa) NVME_GET(cdpa, CTRL_CDPA_CDPALG_HS3) -#define NVME_CTRL_CDPA_CDPALG_RSVD1(cdpa) NVME_GET(cdpa, CTRL_CDPA_CDPALG_RSVD1) - -/** - * enum nvme_id_ctrl_ipmsr - Interval Power Measurement Sample Rate - * @NVME_CTRL_IPMSR_SRS_SHIFT: Shift amount to get the Sample Rate - * Scale from the &struct nvme_id_ctrl.ipmsr field. - * @NVME_CTRL_IPMSR_SRV_SHIFT: Shift amount to get the Sample Rate - * Value from the &struct nvme_id_ctrl.ipmsr field. - * @NVME_CTRL_IPMSR_SRS_MASK: Mask to get the Sample Rate Scale - * from the &struct nvme_id_ctrl.ipmsr field. - * @NVME_CTRL_IPMSR_SRV_MASK: Mask to get the Sample Rate Value - * from the &struct nvme_id_ctrl.ipmsr field. - */ -enum nvme_id_ctrl_ipmsr { - NVME_CTRL_IPMSR_SRS_SHIFT = 8, - NVME_CTRL_IPMSR_SRV_SHIFT = 0, - NVME_CTRL_IPMSR_SRS_MASK = 0x00FF, - NVME_CTRL_IPMSR_SRV_MASK = 0x00FF, -}; - -#define NVME_CTRL_IPMSR_SRS(ipmsr) NVME_GET(ipmsr, CTRL_IPMSR_SRS) -#define NVME_CTRL_IPMSR_SRV(ipmsr) NVME_GET(ipmsr, CTRL_IPMSR_SRV) - -/** - * enum nvme_id_ctrl_ensa - Exported NVM Subsystem Attributes - * @NVME_CTRL_ENSA_ENSMS_SHIFT: Shift amount to get the Exported NVM Subsystem - * Support Migration Support - * @NVME_CTRL_ENSA_ENSTS_SHIFT: Shift amount to get the Exported NVM Subsystem - * Template Support - * @NVME_CTRL_ENSA_ENSMS_MASK: Mask to get the Exported NVM Subsystem Support - * Migration Support - * @NVME_CTRL_ENSA_ENSTS_MASK: Mask to get the Exported NVM Subsystem Template - * Support - */ -enum nvme_id_ctrl_ensa { - NVME_CTRL_ENSA_ENSMS_SHIFT = 1, - NVME_CTRL_ENSA_ENSTS_SHIFT = 0, - NVME_CTRL_ENSA_ENSMS_MASK = 0x1, - NVME_CTRL_ENSA_ENSTS_MASK = 0x1, -}; - -#define NVME_CTRL_ENSA_ENSMS(ensa) NVME_GET(ensa, CTRL_ENSA_ENSMS) -#define NVME_CTRL_ENSA_ENSTS(ensa) NVME_GET(ensa, CTRL_ENSA_ENSTS) - -/** - * enum nvme_id_ctrl_endsfs - Exported Namespace Data Structure Formats - * Supported - * @NVME_CTRL_ENDSFS_ENF1_SHIFT:Shift amount to get the Exported Namespace - * Format 1 - * @NVME_CTRL_ENDSFS_ENF0_SHIFT:Shift amount to get the Exported Namespace - * Format 0 - * Template Support - * @NVME_CTRL_ENDSFS_ENF1_MASK: Mask to get the Exported Namespace Format 1 - * @NVME_CTRL_ENDSFS_ENF0_MASK: Mask to get the Exported Namespace Format 0 - */ -enum nvme_id_ctrl_endsfs { - NVME_CTRL_ENDSFS_ENF1_SHIFT = 1, - NVME_CTRL_ENDSFS_ENF0_SHIFT = 0, - NVME_CTRL_ENDSFS_ENF1_MASK = 0x1, - NVME_CTRL_ENDSFS_ENF0_MASK = 0x1, -}; - -#define NVME_CTRL_ENDSFS_ENF1(endsfs) NVME_GET(endsfs, CTRL_ENDSFS_ENF1) -#define NVME_CTRL_ENDSFS_ENF0(endsfs) NVME_GET(endsfs, CTRL_ENDSFS_ENF0) - -/** - * enum nvme_id_ctrl_sqes - Defines the required and maximum Submission Queue - * entry size when using the NVM Command Set. - * @NVME_CTRL_SQES_MINSQES_SHIFT: MINSQES shift - * @NVME_CTRL_SQES_MAXSQES_SHIFT: MAXSQES shift - * @NVME_CTRL_SQES_MINSQES_MASK: MINSQES mask - * @NVME_CTRL_SQES_MAXSQES_MASK: MAXSQES mask - * @NVME_CTRL_SQES_MIN: Mask to get the value of the required Submission Queue - * Entry size when using the NVM Command Set. - * @NVME_CTRL_SQES_MAX: Mask to get the value of the maximum Submission Queue - * entry size when using the NVM Command Set. - */ -enum nvme_id_ctrl_sqes { - NVME_CTRL_SQES_MINSQES_SHIFT = 0, - NVME_CTRL_SQES_MAXSQES_SHIFT = 4, - NVME_CTRL_SQES_MINSQES_MASK = 0xf, - NVME_CTRL_SQES_MAXSQES_MASK = 0xf, - NVME_CTRL_SQES_MIN = NVME_VAL(CTRL_SQES_MINSQES), - NVME_CTRL_SQES_MAX = NVME_VAL(CTRL_SQES_MAXSQES), -}; - -#define NVME_CTRL_SQES_MINSQES(sqes) NVME_GET(sqes, CTRL_SQES_MINSQES) -#define NVME_CTRL_SQES_MAXSQES(sqes) NVME_GET(sqes, CTRL_SQES_MAXSQES) - -/** - * enum nvme_id_ctrl_cqes - Defines the required and maximum Completion Queue - * entry size when using the NVM Command Set. - * @NVME_CTRL_CQES_MINCQES_SHIFT: MINCQES shift - * @NVME_CTRL_CQES_MAXCQES_SHIFT: MAXCQES shift - * @NVME_CTRL_CQES_MINCQES_MASK: MINCQES mask - * @NVME_CTRL_CQES_MAXCQES_MASK: MAXCQES mask - * @NVME_CTRL_CQES_MIN: Mask to get the value of the required Completion Queue - * Entry size when using the NVM Command Set. - * @NVME_CTRL_CQES_MAX: Mask to get the value of the maximum Completion Queue - * entry size when using the NVM Command Set. - */ -enum nvme_id_ctrl_cqes { - NVME_CTRL_CQES_MINCQES_SHIFT = 0, - NVME_CTRL_CQES_MAXCQES_SHIFT = 4, - NVME_CTRL_CQES_MINCQES_MASK = 0xf, - NVME_CTRL_CQES_MAXCQES_MASK = 0xf, - NVME_CTRL_CQES_MIN = NVME_VAL(CTRL_CQES_MINCQES), - NVME_CTRL_CQES_MAX = NVME_VAL(CTRL_CQES_MAXCQES), -}; - -#define NVME_CTRL_CQES_MINCQES(cqes) NVME_GET(cqes, CTRL_CQES_MINCQES) -#define NVME_CTRL_CQES_MAXCQES(cqes) NVME_GET(cqes, CTRL_CQES_MAXCQES) - -/** - * enum nvme_id_ctrl_oncs - This field indicates the optional NVM commands and - * features supported by the controller. - * @NVME_CTRL_ONCS_NVMCMPS_SHIFT: NVMCMPS shift - * @NVME_CTRL_ONCS_NVMWUSV_SHIFT: NVMWUSV shift - * @NVME_CTRL_ONCS_NVMDSMSV_SHIFT: NVMDSMSV shift - * @NVME_CTRL_ONCS_NVMWZSV_SHIFT: NVMWZSV shift - * @NVME_CTRL_ONCS_SSFS_SHIFT: SSFS shift - * @NVME_CTRL_ONCS_RESERVS_SHIFT: RESERVS shift - * @NVME_CTRL_ONCS_TSS_SHIFT: TSS shift - * @NVME_CTRL_ONCS_NVMVFYS_SHIFT: NVMVFYS shift - * @NVME_CTRL_ONCS_NVMCPYS_SHIFT: NVMCPYS shift - * @NVME_CTRL_ONCS_NVMCSA_SHIFT: NVMCSA shift - * @NVME_CTRL_ONCS_NVMAFC_SHIFT: NVMAFC shift - * @NVME_CTRL_ONCS_MAXWZD_SHIFT: MAXWZD shift - * @NVME_CTRL_ONCS_NSZS_SHIFT: NSZS shift - * @NVME_CTRL_ONCS_RSVD13_SHIFT: RSVD13 shift - * @NVME_CTRL_ONCS_NVMCMPS_MASK: NVMCMPS mask - * @NVME_CTRL_ONCS_NVMWUSV_MASK: NVMWUSV mask - * @NVME_CTRL_ONCS_NVMDSMSV_MASK: NVMDSMSV mask - * @NVME_CTRL_ONCS_NVMWZSV_MASK: NVMWASV mask - * @NVME_CTRL_ONCS_SSFS_MASK: SSFS mask - * @NVME_CTRL_ONCS_RESERVS_MASK: RESERVS mask - * @NVME_CTRL_ONCS_TSS_MASK: TSS mask - * @NVME_CTRL_ONCS_NVMVFYS_MASK: NVMVFYS mask - * @NVME_CTRL_ONCS_NVMCPYS_MASK: NVMCPYS mask - * @NVME_CTRL_ONCS_NVMCSA_MASK: NVMCSA mask - * @NVME_CTRL_ONCS_NVMAFC_MASK: NVMAFC mask - * @NVME_CTRL_ONCS_MAXWZD_MASK: MAXWZD mask - * @NVME_CTRL_ONCS_NSZS_MASK: NSZS mask - * @NVME_CTRL_ONCS_RSVD13_MASK: Reserved mask - * @NVME_CTRL_ONCS_COMPARE: If set, then the controller supports - * the Compare command. - * @NVME_CTRL_ONCS_WRITE_UNCORRECTABLE: If set, then the controller supports - * the Write Uncorrectable command. - * @NVME_CTRL_ONCS_DSM: If set, then the controller supports - * the Dataset Management command. - * @NVME_CTRL_ONCS_WRITE_ZEROES: If set, then the controller supports - * the Write Zeroes command. - * @NVME_CTRL_ONCS_SAVE_FEATURES: If set, then the controller supports - * the Save field set to a non-zero value - * in the Set Features command and the - * Select field set to a non-zero value in - * the Get Features command. - * @NVME_CTRL_ONCS_RESERVATIONS: If set, then the controller supports - * reservations. - * @NVME_CTRL_ONCS_TIMESTAMP: If set, then the controller supports - * the Timestamp feature. - * @NVME_CTRL_ONCS_VERIFY: If set, then the controller supports - * the Verify command. - * @NVME_CTRL_ONCS_COPY: If set, then the controller supports - * the copy command. - * @NVME_CTRL_ONCS_COPY_SINGLE_ATOMICITY: If set, then the write portion of a - * Copy command is performed as a single - * write command to which the same - * atomicity requirements that apply to - * a write command apply. - * @NVME_CTRL_ONCS_ALL_FAST_COPY: If set, then all copy operations for - * the Copy command are fast copy - * operations. - * @NVME_CTRL_ONCS_WRITE_ZEROES_DEALLOCATE: If MAXWZD bit set, then the maximum data - * size for Write Zeroes command depends on the - * value of the Deallocate bit in the Write Zeroes - * command and the value in the WZDSL field in the - * I/O Command Set specific Identify Controller - * data structure. - * @NVME_CTRL_ONCS_NAMESPACE_ZEROES: If NSZS bit set, then the controller supports - * the Namespace Zeroes (NSZ) bit in the NVM - * Command Set Write Zeroes command. - */ -enum nvme_id_ctrl_oncs { - NVME_CTRL_ONCS_NVMCMPS_SHIFT = 0, - NVME_CTRL_ONCS_NVMWUSV_SHIFT = 1, - NVME_CTRL_ONCS_NVMDSMSV_SHIFT = 2, - NVME_CTRL_ONCS_NVMWZSV_SHIFT = 3, - NVME_CTRL_ONCS_SSFS_SHIFT = 4, - NVME_CTRL_ONCS_RESERVS_SHIFT = 5, - NVME_CTRL_ONCS_TSS_SHIFT = 6, - NVME_CTRL_ONCS_NVMVFYS_SHIFT = 7, - NVME_CTRL_ONCS_NVMCPYS_SHIFT = 8, - NVME_CTRL_ONCS_NVMCSA_SHIFT = 9, - NVME_CTRL_ONCS_NVMAFC_SHIFT = 10, - NVME_CTRL_ONCS_MAXWZD_SHIFT = 11, - NVME_CTRL_ONCS_NSZS_SHIFT = 12, - NVME_CTRL_ONCS_RSVD13_SHIFT = 13, - NVME_CTRL_ONCS_NVMCMPS_MASK = 0x1, - NVME_CTRL_ONCS_NVMWUSV_MASK = 0x1, - NVME_CTRL_ONCS_NVMDSMSV_MASK = 0x1, - NVME_CTRL_ONCS_NVMWZSV_MASK = 0x1, - NVME_CTRL_ONCS_SSFS_MASK = 0x1, - NVME_CTRL_ONCS_RESERVS_MASK = 0x1, - NVME_CTRL_ONCS_TSS_MASK = 0x1, - NVME_CTRL_ONCS_NVMVFYS_MASK = 0x1, - NVME_CTRL_ONCS_NVMCPYS_MASK = 0x1, - NVME_CTRL_ONCS_NVMCSA_MASK = 0x1, - NVME_CTRL_ONCS_NVMAFC_MASK = 0x1, - NVME_CTRL_ONCS_MAXWZD_MASK = 0x1, - NVME_CTRL_ONCS_NSZS_MASK = 0x1, - NVME_CTRL_ONCS_RSVD13_MASK = 0x7, - NVME_CTRL_ONCS_COMPARE = NVME_VAL(CTRL_ONCS_NVMCMPS), - NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = NVME_VAL(CTRL_ONCS_NVMWUSV), - NVME_CTRL_ONCS_DSM = NVME_VAL(CTRL_ONCS_NVMDSMSV), - NVME_CTRL_ONCS_WRITE_ZEROES = NVME_VAL(CTRL_ONCS_NVMWZSV), - NVME_CTRL_ONCS_SAVE_FEATURES = NVME_VAL(CTRL_ONCS_SSFS), - NVME_CTRL_ONCS_RESERVATIONS = NVME_VAL(CTRL_ONCS_RESERVS), - NVME_CTRL_ONCS_TIMESTAMP = NVME_VAL(CTRL_ONCS_TSS), - NVME_CTRL_ONCS_VERIFY = NVME_VAL(CTRL_ONCS_NVMVFYS), - NVME_CTRL_ONCS_COPY = NVME_VAL(CTRL_ONCS_NVMCPYS), - NVME_CTRL_ONCS_COPY_SINGLE_ATOMICITY = NVME_VAL(CTRL_ONCS_NVMCSA), - NVME_CTRL_ONCS_ALL_FAST_COPY = NVME_VAL(CTRL_ONCS_NVMAFC), - NVME_CTRL_ONCS_WRITE_ZEROES_DEALLOCATE = NVME_VAL(CTRL_ONCS_MAXWZD), - NVME_CTRL_ONCS_NAMESPACE_ZEROES = NVME_VAL(CTRL_ONCS_NSZS), -}; - -#define NVME_CTRL_ONCS_NVMCMPS(oncs) NVME_GET(oncs, CTRL_ONCS_NVMCMPS) -#define NVME_CTRL_ONCS_NVMWUSV(oncs) NVME_GET(oncs, CTRL_ONCS_NVMWUSV) -#define NVME_CTRL_ONCS_NVMDSMSV(oncs) NVME_GET(oncs, CTRL_ONCS_NVMDSMSV) -#define NVME_CTRL_ONCS_NVMWZSV(oncs) NVME_GET(oncs, CTRL_ONCS_NVMWZSV) -#define NVME_CTRL_ONCS_SSFS(oncs) NVME_GET(oncs, CTRL_ONCS_SSFS) -#define NVME_CTRL_ONCS_RESERVS(oncs) NVME_GET(oncs, CTRL_ONCS_RESERVS) -#define NVME_CTRL_ONCS_TSS(oncs) NVME_GET(oncs, CTRL_ONCS_TSS) -#define NVME_CTRL_ONCS_NVMVFYS(oncs) NVME_GET(oncs, CTRL_ONCS_NVMVFYS) -#define NVME_CTRL_ONCS_NVMCPYS(oncs) NVME_GET(oncs, CTRL_ONCS_NVMCPYS) -#define NVME_CTRL_ONCS_NVMCSA(oncs) NVME_GET(oncs, CTRL_ONCS_NVMCSA) -#define NVME_CTRL_ONCS_NVMAFC(oncs) NVME_GET(oncs, CTRL_ONCS_NVMAFC) -#define NVME_CTRL_ONCS_MAXWZD(oncs) NVME_GET(oncs, CTRL_ONCS_MAXWZD) -#define NVME_CTRL_ONCS_NSZS(oncs) NVME_GET(oncs, CTRL_ONCS_NSZS) -#define NVME_CTRL_ONCS_RSVD13(oncs) NVME_GET(oncs, CTRL_ONCS_RSVD13) - -/** - * enum nvme_id_ctrl_fuses - This field indicates the fused operations that the - * controller supports. - * @NVME_CTRL_FUSES_FCWS_SHIFT: FCWS shift - * @NVME_CTRL_FUSES_RSVD1_SHIFT: Reserved shift - * @NVME_CTRL_FUSES_FCWS_MASK: FCWS mask - * @NVME_CTRL_FUSES_RSVD1_MASK: Reserved mask - * @NVME_CTRL_FUSES_COMPARE_AND_WRITE: If set, then the controller supports the - * Compare and Write fused operation. - */ -enum nvme_id_ctrl_fuses { - NVME_CTRL_FUSES_FCWS_SHIFT = 0, - NVME_CTRL_FUSES_RSVD1_SHIFT = 1, - NVME_CTRL_FUSES_FCWS_MASK = 0x1, - NVME_CTRL_FUSES_RSVD1_MASK = 0x7fff, - NVME_CTRL_FUSES_COMPARE_AND_WRITE = NVME_VAL(CTRL_FUSES_FCWS), -}; - -#define NVME_CTRL_FUSES_FCWS(fuses) NVME_GET(fuses, CTRL_FUSES_FCWS) -#define NVME_CTRL_FUSES_RSVD1(fuses) NVME_GET(fuses, CTRL_FUSES_RSVD1) - -/** - * enum nvme_id_ctrl_fna - This field indicates attributes for the Format NVM - * command. - * @NVME_CTRL_FNA_FMT_ALL_NS_SHIFT: Shift amount to get the format applied to all namespaces - * @NVME_CTRL_FNA_SEC_ALL_NS_SHIFT: Shift amount to get the secure erase applied to all namespaces - * @NVME_CTRL_FNA_CES_SHIFT: Shift amount to get the cryptographic erase supported - * @NVME_CTRL_FNA_NSID_ALL_F_SHIFT: Shift amount to get the format supported an NSID FFFFFFFFh - * @NVME_CTRL_FNA_RSVD4_SHIFT: Shift amount to get the Reserved - * @NVME_CTRL_FNA_FMT_ALL_NS_MASK: Mask to get the format applied to all namespaces - * @NVME_CTRL_FNA_SEC_ALL_NS_MASK: Mask to get the secure erase applied to all namespaces - * @NVME_CTRL_FNA_CES_MASK: Mask to get the cryptographic erase supported - * @NVME_CTRL_FNA_NSID_ALL_F_MASK: Mask to get the format supported an NSID FFFFFFFFh - * @NVME_CTRL_FNA_RSVD4_MASK: Mask to get the Reserved - * @NVME_CTRL_FNA_FMT_ALL_NAMESPACES: If set, then all namespaces in an NVM - * subsystem shall be configured with the - * same attributes and a format (excluding - * secure erase) of any namespace results in - * a format of all namespaces in an NVM - * subsystem. If cleared, then the - * controller supports format on a per - * namespace basis. - * @NVME_CTRL_FNA_SEC_ALL_NAMESPACES: If set, then any secure erase performed - * as part of a format operation results in - * a secure erase of all namespaces in the - * NVM subsystem. If cleared, then any - * secure erase performed as part of a - * format results in a secure erase of the - * particular namespace specified. - * @NVME_CTRL_FNA_CRYPTO_ERASE: If set, then cryptographic erase is - * supported. If cleared, then cryptographic - * erase is not supported. - * @NVME_CTRL_FNA_NSID_FFFFFFFF: If set, then format does not support - * nsid value set to FFFFFFFFh. If cleared, - * format supports nsid value set to - * FFFFFFFFh. - */ -enum nvme_id_ctrl_fna { - NVME_CTRL_FNA_FMT_ALL_NS_SHIFT = 0, - NVME_CTRL_FNA_SEC_ALL_NS_SHIFT = 1, - NVME_CTRL_FNA_CES_SHIFT = 2, - NVME_CTRL_FNA_NSID_ALL_F_SHIFT = 3, - NVME_CTRL_FNA_RSVD4_SHIFT = 4, - NVME_CTRL_FNA_FMT_ALL_NS_MASK = 0x1, - NVME_CTRL_FNA_SEC_ALL_NS_MASK = 0x1, - NVME_CTRL_FNA_CES_MASK = 0x1, - NVME_CTRL_FNA_NSID_ALL_F_MASK = 0x1, - NVME_CTRL_FNA_RSVD4_MASK = 0xf, - NVME_CTRL_FNA_FMT_ALL_NAMESPACES = NVME_VAL(CTRL_FNA_FMT_ALL_NS), - NVME_CTRL_FNA_SEC_ALL_NAMESPACES = NVME_VAL(CTRL_FNA_SEC_ALL_NS), - NVME_CTRL_FNA_CRYPTO_ERASE = NVME_VAL(CTRL_FNA_CES), - NVME_CTRL_FNA_NSID_FFFFFFFF = NVME_VAL(CTRL_FNA_NSID_ALL_F), -}; - -#define NVME_CTRL_FNA_FMT_ALL_NS(fna) NVME_GET(fna, CTRL_FNA_FMT_ALL_NS) -#define NVME_CTRL_FNA_SEC_ALL_NS(fna) NVME_GET(fna, CTRL_FNA_SEC_ALL_NS) -#define NVME_CTRL_FNA_CES(fna) NVME_GET(fna, CTRL_FNA_CES) -#define NVME_CTRL_FNA_NSID_ALL_F(fna) NVME_GET(fna, CTRL_FNA_NSID_ALL_F) -#define NVME_CTRL_FNA_RSVD4(fna) NVME_GET(fna, CTRL_FNA_RSVD4) - -/** - * enum nvme_id_ctrl_vwc - Volatile write cache - * @NVME_CTRL_VWC_VWCP_SHIFT: VWCP shift - * @NVME_CTRL_VWC_FB_SHIFT: FB shift - * @NVME_CTRL_VWC_RSVD3_SHIFT: Reserved shiftt - * @NVME_CTRL_VWC_VWCP_MASK: VWCP mask - * @NVME_CTRL_VWC_FB_MASK: FB mask - * @NVME_CTRL_VWC_RSVD3_MASK: Reserved mask - * @NVME_CTRL_VWC_PRESENT: If set, indicates a volatile write cache is present. - * If a volatile write cache is present, then the host - * controls whether the volatile write cache is enabled - * with a Set Features command specifying the value - * %NVME_FEAT_FID_VOLATILE_WC. - * @NVME_CTRL_VWC_FLUSH: Mask to get the value of the flush command behavior. - */ -enum nvme_id_ctrl_vwc { - NVME_CTRL_VWC_VWCP_SHIFT = 0, - NVME_CTRL_VWC_FB_SHIFT = 1, - NVME_CTRL_VWC_RSVD3_SHIFT = 3, - NVME_CTRL_VWC_VWCP_MASK = 0x1, - NVME_CTRL_VWC_FB_MASK = 0x3, - NVME_CTRL_VWC_RSVD3_MASK = 0x1f, - NVME_CTRL_VWC_PRESENT = NVME_VAL(CTRL_VWC_VWCP), - NVME_CTRL_VWC_FLUSH = NVME_VAL(CTRL_VWC_FB), -}; - -#define NVME_CTRL_VWC_VWCP(vwc) NVME_GET(vwc, CTRL_VWC_VWCP) -#define NVME_CTRL_VWC_FB(vwc) NVME_GET(vwc, CTRL_VWC_FB) -#define NVME_CTRL_VWC_RSVD3(vwc) NVME_GET(vwc, CTRL_VWC_RSVD3) - -/** - * enum nvme_id_ctrl_nvscc - This field indicates the configuration settings - * for NVM Vendor Specific command handling. - * @NVME_CTRL_ICSVSCC_SNVSCF_SHIFT: SNVSCF shift - * @NVME_CTRL_ICSVSCC_RSVD1_SHIFT: Reserved shift - * @NVME_CTRL_ICSVSCC_SNVSCF_MASK: SNVSCF mask - * @NVME_CTRL_ICSVSCC_RSVD1_MASK: Reserved mask - * @NVME_CTRL_NVSCC_FMT: If set, all NVM Vendor Specific Commands use the - * format with NDT and NDM fields. - */ -enum nvme_id_ctrl_nvscc { - NVME_CTRL_ICSVSCC_SNVSCF_SHIFT = 0, - NVME_CTRL_ICSVSCC_RSVD1_SHIFT = 1, - NVME_CTRL_ICSVSCC_SNVSCF_MASK = 0x1, - NVME_CTRL_ICSVSCC_RSVD1_MASK = 0x7f, - NVME_CTRL_NVSCC_FMT = NVME_VAL(CTRL_ICSVSCC_SNVSCF), -}; - -#define NVME_CTRL_ICSVSCC_SNVSCF(icsvscc) NVME_GET(icsvscc, CTRL_ICSVSCC_SNVSCF) -#define NVME_CTRL_ICSVSCC_RSVD1(icsvscc) NVME_GET(icsvscc, CTRL_ICSVSCC_RSVD1) - -/** - * enum nvme_id_ctrl_nwpc - This field indicates the optional namespace write - * protection capabilities supported by the - * controller. - * @NVME_CTRL_NWPC_NWPWPS_SHIFT: NWPWPS shift - * @NVME_CTRL_NWPC_WPUPCS_SHIFT: WPUPCS shift - * @NVME_CTRL_NWPC_PWPS_SHIFT: PWPS shift - * @NVME_CTRL_NWPC_RSVD3_SHIFT: Reserved shift - * @NVME_CTRL_NWPC_NWPWPS_MASK: NWPWPS mask - * @NVME_CTRL_NWPC_WPUPCS_MASK: WPUPCS mask - * @NVME_CTRL_NWPC_PWPS_MASK: PWPS mask - * @NVME_CTRL_NWPC_RSVD3_MASK: Reserved mask - * @NVME_CTRL_NWPC_WRITE_PROTECT: If set, then the controller shall - * support the No Write Protect and - * Write Protect namespace write - * protection states and may support - * the Write Protect Until Power - * Cycle state and Permanent Write - * Protect namespace write - * protection states. - * @NVME_CTRL_NWPC_WRITE_PROTECT_POWER_CYCLE: If set, then the controller - * supports the Write Protect Until - * Power Cycle state. - * @NVME_CTRL_NWPC_WRITE_PROTECT_PERMANENT: If set, then the controller - * supports the Permanent Write - * Protect state. - */ -enum nvme_id_ctrl_nwpc { - NVME_CTRL_NWPC_NWPWPS_SHIFT = 0, - NVME_CTRL_NWPC_WPUPCS_SHIFT = 1, - NVME_CTRL_NWPC_PWPS_SHIFT = 2, - NVME_CTRL_NWPC_RSVD3_SHIFT = 3, - NVME_CTRL_NWPC_NWPWPS_MASK = 0x1, - NVME_CTRL_NWPC_WPUPCS_MASK = 0x1, - NVME_CTRL_NWPC_PWPS_MASK = 0x1, - NVME_CTRL_NWPC_RSVD3_MASK = 0x1f, - NVME_CTRL_NWPC_WRITE_PROTECT = NVME_VAL(CTRL_NWPC_NWPWPS), - NVME_CTRL_NWPC_WRITE_PROTECT_POWER_CYCLE = NVME_VAL(CTRL_NWPC_WPUPCS), - NVME_CTRL_NWPC_WRITE_PROTECT_PERMANENT = NVME_VAL(CTRL_NWPC_PWPS), -}; - -#define NVME_CTRL_NWPC_NWPWPS(nwpc) NVME_GET(nwpc, CTRL_NWPC_NWPWPS) -#define NVME_CTRL_NWPC_WPUPCS(nwpc) NVME_GET(nwpc, CTRL_NWPC_WPUPCS) -#define NVME_CTRL_NWPC_PWPS(nwpc) NVME_GET(nwpc, CTRL_NWPC_PWPS) -#define NVME_CTRL_NWPC_RSVD3(nwpc) NVME_GET(nwpc, CTRL_NWPC_RSVD3) - -/** - * enum nvme_id_ctrl_cdfs - Copy descriptor formats supported - * @NVME_CTRL_CDFS_CDF0S_SHIFT: CDF0S shift - * @NVME_CTRL_CDFS_CDF1S_SHIFT: CDF1S shift - * @NVME_CTRL_CDFS_CDF2S_SHIFT: CDF2S shift - * @NVME_CTRL_CDFS_CDF3S_SHIFT: CDF3S shift - * @NVME_CTRL_CDFS_CDF4S_SHIFT: CDF4S shift - * @NVME_CTRL_CDFS_RSVD5_SHIFT: Reserved shift - * @NVME_CTRL_CDFS_CDF0S_MASK: CDF0S mask - * @NVME_CTRL_CDFS_CDF1S_MASK: CDF1S mask - * @NVME_CTRL_CDFS_CDF2S_MASK: CDF2S mask - * @NVME_CTRL_CDFS_CDF3S_MASK: CDF3S mask - * @NVME_CTRL_CDFS_CDF4S_MASK: CDF4S mask - * @NVME_CTRL_CDFS_RSVD5_MASK: Reserved mask - */ -enum nvme_id_ctrl_cdfs { - NVME_CTRL_CDFS_CDF0S_SHIFT = 0, - NVME_CTRL_CDFS_CDF1S_SHIFT = 1, - NVME_CTRL_CDFS_CDF2S_SHIFT = 2, - NVME_CTRL_CDFS_CDF3S_SHIFT = 3, - NVME_CTRL_CDFS_CDF4S_SHIFT = 4, - NVME_CTRL_CDFS_RSVD5_SHIFT = 5, - NVME_CTRL_CDFS_CDF0S_MASK = 0x1, - NVME_CTRL_CDFS_CDF1S_MASK = 0x1, - NVME_CTRL_CDFS_CDF2S_MASK = 0x1, - NVME_CTRL_CDFS_CDF3S_MASK = 0x1, - NVME_CTRL_CDFS_CDF4S_MASK = 0x1, - NVME_CTRL_CDFS_RSVD5_MASK = 0x7ff, -}; - -#define NVME_CTRL_CDFS_CDF0S(cdfs) NVME_GET(cdfs, CTRL_CDFS_CDF0S) -#define NVME_CTRL_CDFS_CDF1S(cdfs) NVME_GET(cdfs, CTRL_CDFS_CDF1S) -#define NVME_CTRL_CDFS_CDF2S(cdfs) NVME_GET(cdfs, CTRL_CDFS_CDF2S) -#define NVME_CTRL_CDFS_CDF3S(cdfs) NVME_GET(cdfs, CTRL_CDFS_CDF3S) -#define NVME_CTRL_CDFS_CDF4S(cdfs) NVME_GET(cdfs, CTRL_CDFS_CDF4S) -#define NVME_CTRL_CDFS_RSVD5(cdfs) NVME_GET(cdfs, CTRL_CDFS_RSVD5) - -/** - * enum nvme_id_ctrl_sgls - This field indicates if SGLs are supported for the - * NVM Command Set and the particular SGL types supported. - * @NVME_CTRL_SGLS_SGLS_SHIFT: - * @NVME_CTRL_SGLS_KSDBDS_SHIFT: - * @NVME_CTRL_SGLS_RSVD3_SHIFT: - * @NVME_CTRL_SGLS_SDT_SHIFT: - * @NVME_CTRL_SGLS_SBBDS_SHIFT: - * @NVME_CTRL_SGLS_MBA_SHIFT: - * @NVME_CTRL_SGLS_LLDTS_SHIFT: - * @NVME_CTRL_SGLS_MSDS_SHIFT: - * @NVME_CTRL_SGLS_SAOS_SHIFT: - * @NVME_CTRL_SGLS_TSDBDS_SHIFT: - * @NVME_CTRL_SGLS_RSVD22_SHIFT: - * @NVME_CTRL_SGLS_SGLS_MASK: - * @NVME_CTRL_SGLS_KSDBDS_MASK: - * @NVME_CTRL_SGLS_RSVD3_MASK: - * @NVME_CTRL_SGLS_SDT_MASK: - * @NVME_CTRL_SGLS_SBBDS_MASK: - * @NVME_CTRL_SGLS_MBA_MASK: - * @NVME_CTRL_SGLS_LLDTS_MASK: - * @NVME_CTRL_SGLS_MSDS_MASK: - * @NVME_CTRL_SGLS_SAOS_MASK: - * @NVME_CTRL_SGLS_TSDBDS_MASK: - * @NVME_CTRL_SGLS_RSVD22_MASK: - * @NVME_CTRL_SGLS_SUPPORTED: - * @NVME_CTRL_SGLS_KEYED: - * @NVME_CTRL_SGLS_BIT_BUCKET: - * @NVME_CTRL_SGLS_MPTR_BYTE_ALIGNED: - * @NVME_CTRL_SGLS_OVERSIZE: - * @NVME_CTRL_SGLS_MPTR_SGL: - * @NVME_CTRL_SGLS_OFFSET: - * @NVME_CTRL_SGLS_TPORT: - */ -enum nvme_id_ctrl_sgls { - NVME_CTRL_SGLS_SGLS_SHIFT = 0, - NVME_CTRL_SGLS_KSDBDS_SHIFT = 2, - NVME_CTRL_SGLS_RSVD3_SHIFT = 3, - NVME_CTRL_SGLS_SDT_SHIFT = 8, - NVME_CTRL_SGLS_SBBDS_SHIFT = 16, - NVME_CTRL_SGLS_MBA_SHIFT = 17, - NVME_CTRL_SGLS_LLDTS_SHIFT = 18, - NVME_CTRL_SGLS_MSDS_SHIFT = 19, - NVME_CTRL_SGLS_SAOS_SHIFT = 20, - NVME_CTRL_SGLS_TSDBDS_SHIFT = 21, - NVME_CTRL_SGLS_RSVD22_SHIFT = 22, - NVME_CTRL_SGLS_SGLS_MASK = 0x3, - NVME_CTRL_SGLS_KSDBDS_MASK = 0x1, - NVME_CTRL_SGLS_RSVD3_MASK = 0x1f, - NVME_CTRL_SGLS_SDT_MASK = 0xff, - NVME_CTRL_SGLS_SBBDS_MASK = 0x1, - NVME_CTRL_SGLS_MBA_MASK = 0x1, - NVME_CTRL_SGLS_LLDTS_MASK = 0x1, - NVME_CTRL_SGLS_MSDS_MASK = 0x1, - NVME_CTRL_SGLS_SAOS_MASK = 0x1, - NVME_CTRL_SGLS_TSDBDS_MASK = 0x1, - NVME_CTRL_SGLS_RSVD22_MASK = 0x3ff, - NVME_CTRL_SGLS_SUPPORTED = NVME_VAL(CTRL_SGLS_SGLS), - NVME_CTRL_SGLS_KEYED = NVME_VAL(CTRL_SGLS_KSDBDS), - NVME_CTRL_SGLS_BIT_BUCKET = NVME_VAL(CTRL_SGLS_SBBDS), - NVME_CTRL_SGLS_MPTR_BYTE_ALIGNED = NVME_VAL(CTRL_SGLS_MBA), - NVME_CTRL_SGLS_OVERSIZE = NVME_VAL(CTRL_SGLS_LLDTS), - NVME_CTRL_SGLS_MPTR_SGL = NVME_VAL(CTRL_SGLS_MSDS), - NVME_CTRL_SGLS_OFFSET = NVME_VAL(CTRL_SGLS_SAOS), - NVME_CTRL_SGLS_TPORT = NVME_VAL(CTRL_SGLS_TSDBDS), -}; - -#define NVME_CTRL_SGLS_SGLS(sgls) NVME_GET(sgls, CTRL_SGLS_SGLS) -#define NVME_CTRL_SGLS_KSDBDS(sgls) NVME_GET(sgls, CTRL_SGLS_KSDBDS) -#define NVME_CTRL_SGLS_RSVD3(sgls) NVME_GET(sgls, CTRL_SGLS_RSVD3) -#define NVME_CTRL_SGLS_SDT(sgls) NVME_GET(sgls, CTRL_SGLS_SDT) -#define NVME_CTRL_SGLS_SBBDS(sgls) NVME_GET(sgls, CTRL_SGLS_SBBDS) -#define NVME_CTRL_SGLS_MBA(sgls) NVME_GET(sgls, CTRL_SGLS_MBA) -#define NVME_CTRL_SGLS_LLDTS(sgls) NVME_GET(sgls, CTRL_SGLS_LLDTS) -#define NVME_CTRL_SGLS_MSDS(sgls) NVME_GET(sgls, CTRL_SGLS_MSDS) -#define NVME_CTRL_SGLS_SAOS(sgls) NVME_GET(sgls, CTRL_SGLS_SAOS) -#define NVME_CTRL_SGLS_TSDBDS(sgls) NVME_GET(sgls, CTRL_SGLS_TSDBDS) -#define NVME_CTRL_SGLS_RSVD22(sgls) NVME_GET(sgls, CTRL_SGLS_RSVD22) - -/** - * enum nvme_id_ctrl_trattr - Tracking Attributes - * @NVME_CTRL_TRATTR_THMCS_SHIFT: Shift amount to get the Track Host Memory Changes Support - * from the &struct nvme_id_ctrl.trattr field. - * @NVME_CTRL_TRATTR_TUDCS_SHIFT: Shift amount to get the Track User Data Changes Support - * from the &struct nvme_id_ctrl.trattr field. - * @NVME_CTRL_TRATTR_MRTLL_SHIFT: Shift amount to get the Memory Range Tracking Length Limit - * from the &struct nvme_id_ctrl.trattr field. - * @NVME_CTRL_TRATTR_RSVD3_SHIFT: Shift amount to get the Reserved - * @NVME_CTRL_TRATTR_THMCS_MASK: Mask to get the Track Host Memory Changes Support - * from the &struct nvme_id_ctrl.trattr field. - * @NVME_CTRL_TRATTR_TUDCS_MASK: Mask to get the Track User Data Changes Support - * from the &struct nvme_id_ctrl.trattr field. - * @NVME_CTRL_TRATTR_MRTLL_MASK: Mask to get the Memory Range Tracking Length Limit - * from the &struct nvme_id_ctrl.trattr field. - * @NVME_CTRL_TRATTR_RSVD3_MASK: Mask to get the Reserved - */ -enum nvme_id_ctrl_trattr { - NVME_CTRL_TRATTR_THMCS_SHIFT = 0, - NVME_CTRL_TRATTR_TUDCS_SHIFT = 1, - NVME_CTRL_TRATTR_MRTLL_SHIFT = 2, - NVME_CTRL_TRATTR_RSVD3_SHIFT = 3, - NVME_CTRL_TRATTR_THMCS_MASK = 0x1, - NVME_CTRL_TRATTR_TUDCS_MASK = 0x1, - NVME_CTRL_TRATTR_MRTLL_MASK = 0x1, - NVME_CTRL_TRATTR_RSVD3_MASK = 0x1f, -}; - -#define NVME_CTRL_TRATTR_THMCS(trattr) NVME_GET(trattr, CTRL_TRATTR_THMCS) -#define NVME_CTRL_TRATTR_TUDCS(trattr) NVME_GET(trattr, CTRL_TRATTR_TUDCS) -#define NVME_CTRL_TRATTR_MRTLL(trattr) NVME_GET(trattr, CTRL_TRATTR_MRTLL) -#define NVME_CTRL_TRATTR_RSVD3(trattr) NVME_GET(trattr, CTRL_TRATTR_RSVD3) - -/** - * enum nvme_id_ctrl_fcatt - This field indicates attributes of the controller - * that are specific to NVMe over Fabrics. - * @NVME_CTRL_FCATT_DCMS_SHIFT: DCMS shift - * @NVME_CTRL_FCATT_NZNSETIDS_SHIFT: NZNSETIDS shift - * @NVME_CTRL_FCATT_RSVD2_SHIFT: Reserved shift - * @NVME_CTRL_FCATT_DCMS_MASK: DCMS mask - * @NVME_CTRL_FCATT_NZNSETIDS_MASK: NZNSETIDS mask - * @NVME_CTRL_FCATT_RSVD2_MASK: Reserved mask - * @NVME_CTRL_FCATT_DYNAMIC: If cleared, then the NVM subsystem uses a dynamic - * controller model. If set, then the NVM subsystem - * uses a static controller model. - */ -enum nvme_id_ctrl_fcatt { - NVME_CTRL_FCATT_DCMS_SHIFT = 0, - NVME_CTRL_FCATT_NZNSETIDS_SHIFT = 1, - NVME_CTRL_FCATT_RSVD2_SHIFT = 2, - NVME_CTRL_FCATT_DCMS_MASK = 0x1, - NVME_CTRL_FCATT_NZNSETIDS_MASK = 0x1, - NVME_CTRL_FCATT_RSVD2_MASK = 0x3f, - NVME_CTRL_FCATT_DYNAMIC = NVME_VAL(CTRL_FCATT_DCMS), -}; - -#define NVME_CTRL_FCATT_DCMS(fcatt) NVME_GET(fcatt, CTRL_FCATT_DCMS) -#define NVME_CTRL_FCATT_NZNSETIDS(fcatt) NVME_GET(fcatt, CTRL_FCATT_NZNSETIDS) -#define NVME_CTRL_FCATT_RSVD2(fcatt) NVME_GET(fcatt, CTRL_FCATT_RSVD2) - -/** - * enum nvme_id_ctrl_ofcs - Indicate whether the controller supports optional - * fabric commands. - * @NVME_CTRL_OFCS_DCS_SHIFT: DCS shift - * @NVME_CTRL_OFCS_RSVD1_SHIFT:Reserved shift - * @NVME_CTRL_OFCS_DCS_MASK: DCS mask - * @NVME_CTRL_OFCS_RSVD1_MASK: Reserved mask - * @NVME_CTRL_OFCS_DISCONNECT: If set, then the controller supports the - * Disconnect command and deletion of individual - * I/O Queues. - */ -enum nvme_id_ctrl_ofcs { - NVME_CTRL_OFCS_DCS_SHIFT = 0, - NVME_CTRL_OFCS_RSVD1_SHIFT = 1, - NVME_CTRL_OFCS_DCS_MASK = 0x1, - NVME_CTRL_OFCS_RSVD1_MASK = 0x7fff, - NVME_CTRL_OFCS_DISCONNECT = NVME_VAL(CTRL_OFCS_DCS), -}; - -#define NVME_CTRL_OFCS_DCS(ofcs) NVME_GET(ofcs, CTRL_OFCS_DCS) -#define NVME_CTRL_OFCS_RSVD1(ofcs) NVME_GET(ofcs, CTRL_OFCS_RSVD1) - -/** - * struct nvme_lbaf - LBA Format Data Structure - * @ms: Metadata Size indicates the number of metadata bytes provided per LBA - * based on the LBA Data Size indicated. - * @ds: LBA Data Size indicates the LBA data size supported, reported as a - * power of two. - * @rp: Relative Performance, see &enum nvme_lbaf_rp. - */ -struct nvme_lbaf { - __le16 ms; - __u8 ds; - __u8 rp; -}; - -/** - * enum nvme_lbaf_rp - This field indicates the relative performance of the LBA - * format indicated relative to other LBA formats supported - * by the controller. - * @NVME_LBAF_RP_BEST: Best performance - * @NVME_LBAF_RP_BETTER: Better performance - * @NVME_LBAF_RP_GOOD: Good performance - * @NVME_LBAF_RP_DEGRADED: Degraded performance - * @NVME_LBAF_RP_SHIFT: Relative performance shift - * @NVME_LBAF_RP_MASK: Mask to get the relative performance value from the - * field - */ -enum nvme_lbaf_rp { - NVME_LBAF_RP_BEST = 0, - NVME_LBAF_RP_BETTER = 1, - NVME_LBAF_RP_GOOD = 2, - NVME_LBAF_RP_DEGRADED = 3, - NVME_LBAF_RP_SHIFT = 0, - NVME_LBAF_RP_MASK = 3, -}; - -/** - * struct nvme_id_ns - Identify Namespace data structure - * @nsze: Namespace Size indicates the total size of the namespace in - * logical blocks. The number of logical blocks is based on the - * formatted LBA size. - * @ncap: Namespace Capacity indicates the maximum number of logical blocks - * that may be allocated in the namespace at any point in time. The - * number of logical blocks is based on the formatted LBA size. - * @nuse: Namespace Utilization indicates the current number of logical - * blocks allocated in the namespace. This field is smaller than or - * equal to the Namespace Capacity. The number of logical blocks is - * based on the formatted LBA size. - * @nsfeat: Namespace Features, see &enum nvme_id_nsfeat. - * @nlbaf: Number of LBA Formats defines the number of supported LBA data - * size and metadata size combinations supported by the namespace - * and the highest possible index to &struct nvme_id_ns.lbaf. - * @flbas: Formatted LBA Size, see &enum nvme_id_ns_flbas. - * @mc: Metadata Capabilities, see &enum nvme_id_ns_mc. - * @dpc: End-to-end Data Protection Capabilities, see - * &enum nvme_id_ns_dpc. - * @dps: End-to-end Data Protection Type Settings, see - * &enum nvme_id_ns_dps. - * @nmic: Namespace Multi-path I/O and Namespace Sharing Capabilities, see - * &enum nvme_id_ns_nmic. - * @rescap: Reservation Capabilities, see &enum nvme_id_ns_rescap. - * @fpi: Format Progress Indicator, see &enum nvme_nd_ns_fpi. - * @dlfeat: Deallocate Logical Block Features, see &enum nvme_id_ns_dlfeat. - * @nawun: Namespace Atomic Write Unit Normal indicates the - * namespace specific size of the write operation guaranteed to be - * written atomically to the NVM during normal operation. - * @nawupf: Namespace Atomic Write Unit Power Fail indicates the - * namespace specific size of the write operation guaranteed to be - * written atomically to the NVM during a power fail or error - * condition. - * @nacwu: Namespace Atomic Compare & Write Unit indicates the namespace - * specific size of the write operation guaranteed to be written - * atomically to the NVM for a Compare and Write fused command. - * @nabsn: Namespace Atomic Boundary Size Normal indicates the atomic - * boundary size for this namespace for the NAWUN value. This field - * is specified in logical blocks. - * @nabo: Namespace Atomic Boundary Offset indicates the LBA on this - * namespace where the first atomic boundary starts. - * @nabspf: Namespace Atomic Boundary Size Power Fail indicates the atomic - * boundary size for this namespace specific to the Namespace Atomic - * Write Unit Power Fail value. This field is specified in logical - * blocks. - * @noiob: Namespace Optimal I/O Boundary indicates the optimal I/O boundary - * for this namespace. This field is specified in logical blocks. - * The host should construct Read and Write commands that do not - * cross the I/O boundary to achieve optimal performance. - * @nvmcap: NVM Capacity indicates the total size of the NVM allocated to - * this namespace. The value is in bytes. - * @npwg: Namespace Preferred Write Granularity indicates the smallest - * recommended write granularity in logical blocks for this - * namespace. This is a 0's based value. - * @npwa: Namespace Preferred Write Alignment indicates the recommended - * write alignment in logical blocks for this namespace. This is a - * 0's based value. - * @npdg: Namespace Preferred Deallocate Granularity indicates the - * recommended granularity in logical blocks for the Dataset - * Management command with the Attribute - Deallocate bit. - * @npda: Namespace Preferred Deallocate Alignment indicates the - * recommended alignment in logical blocks for the Dataset - * Management command with the Attribute - Deallocate bit - * @nows: Namespace Optimal Write Size indicates the size in logical blocks - * for optimal write performance for this namespace. This is a 0's - * based value. - * @mssrl: Maximum Single Source Range Length indicates the maximum number - * of logical blocks that may be specified in each valid Source Range - * field of a Copy command. - * @mcl: Maximum Copy Length indicates the maximum number of logical - * blocks that may be specified in a Copy command. - * @msrc: Maximum Source Range Count indicates the maximum number of Source - * Range entries that may be used to specify source data in a Copy - * command. This is a 0’s based value. - * @kpios: Key Per I/O Status indicates namespace Key Per I/O capability status. - * @nulbaf: Number of Unique Capability LBA Formats defines the number of - * supported user data size and metadata size combinations supported - * by the namespace that may not share the same capabilities. LBA - * formats shall be allocated in order and packed sequentially. - * @rsvd83: Reserved - * @kpiodaag: Key Per I/O Data Access Alignment and Granularity indicates the - * alignment and granularity in logical blocks that is required - * for commands that support a KPIOTAG value in the CETYPE field. - * @rsvd88: Reserved - * @anagrpid: ANA Group Identifier indicates the ANA Group Identifier of the - * ANA group of which the namespace is a member. - * @rsvd96: Reserved - * @nsattr: Namespace Attributes, see &enum nvme_id_ns_attr. - * @nvmsetid: NVM Set Identifier indicates the NVM Set with which this - * namespace is associated. - * @endgid: Endurance Group Identifier indicates the Endurance Group with - * which this namespace is associated. - * @nguid: Namespace Globally Unique Identifier contains a 128-bit value - * that is globally unique and assigned to the namespace when the - * namespace is created. This field remains fixed throughout the - * life of the namespace and is preserved across namespace and - * controller operations - * @eui64: IEEE Extended Unique Identifier contains a 64-bit IEEE Extended - * Unique Identifier (EUI-64) that is globally unique and assigned - * to the namespace when the namespace is created. This field - * remains fixed throughout the life of the namespace and is - * preserved across namespace and controller operations - * @lbaf: LBA Format, see &struct nvme_lbaf. - * @vs: Vendor Specific - */ -struct nvme_id_ns { - __le64 nsze; - __le64 ncap; - __le64 nuse; - __u8 nsfeat; - __u8 nlbaf; - __u8 flbas; - __u8 mc; - __u8 dpc; - __u8 dps; - __u8 nmic; - __u8 rescap; - __u8 fpi; - __u8 dlfeat; - __le16 nawun; - __le16 nawupf; - __le16 nacwu; - __le16 nabsn; - __le16 nabo; - __le16 nabspf; - __le16 noiob; - __u8 nvmcap[16]; - __le16 npwg; - __le16 npwa; - __le16 npdg; - __le16 npda; - __le16 nows; - __le16 mssrl; - __le32 mcl; - __u8 msrc; - __u8 kpios; - __u8 nulbaf; - __u8 rsvd83; - __le32 kpiodaag; - __u8 rsvd88[4]; - __le32 anagrpid; - __u8 rsvd96[3]; - __u8 nsattr; - __le16 nvmsetid; - __le16 endgid; - __u8 nguid[16]; - __u8 eui64[8]; - struct nvme_lbaf lbaf[64]; - __u8 vs[3712]; -}; - -/** - * enum nvme_id_nsfeat - This field defines features of the namespace. - * @NVME_NS_NSFEAT_THINP_SHIFT: THINP shift - * @NVME_NS_NSFEAT_NSABP_SHIFT: NSABP shift - * @NVME_NS_NSFEAT_DAE_SHIFT: DAE shift - * @NVME_NS_NSFEAT_UIDREUSE_SHIFT: UIDREUSE shift - * @NVME_NS_NSFEAT_OPTPERF_SHIFT: OPTPERF shift - * @NVME_NS_NSFEAT_MAM_SHIFT: MAM shift - * @NVME_NS_NSFEAT_OPTRPERF_SHIFT: OPTRPERF shift - * @NVME_NS_NSFEAT_THINP_MASK: THINP mask - * @NVME_NS_NSFEAT_NSABP_MASK: NSABP mask - * @NVME_NS_NSFEAT_DAE_MASK: DAE mask - * @NVME_NS_NSFEAT_UIDREUSE_MASK: UIDREUSE mask - * @NVME_NS_NSFEAT_OPTPERF_MASK: OPTPERF mask - * @NVME_NS_NSFEAT_MAM_MASK: MAM mask - * @NVME_NS_NSFEAT_OPTRPERF_MASK: OPTRPERF mask - * @NVME_NS_FEAT_THIN: If set, indicates that the namespace supports thin - * provisioning. Specifically, the Namespace Capacity - * reported may be less than the Namespace Size. - * @NVME_NS_FEAT_NATOMIC: If set, indicates that the fields NAWUN, NAWUPF, and - * NACWU are defined for this namespace and should be - * used by the host for this namespace instead of the - * AWUN, AWUPF, and ACWU fields in the Identify - * Controller data structure. - * @NVME_NS_FEAT_DULBE: If set, indicates that the controller supports the - * Deallocated or Unwritten Logical Block error for - * this namespace. - * @NVME_NS_FEAT_ID_REUSE: If set, indicates that the value in the NGUID field - * for this namespace, if non- zero, is never reused by - * the controller and that the value in the EUI64 field - * for this namespace, if non-zero, is never reused by - * the controller. - * @NVME_NS_FEAT_IO_OPT: If set, indicates that the fields NPWG, NPWA, NPDG, - * NPDA, and NOWS are defined for this namespace and - * should be used by the host for I/O optimization - * @NVME_NS_FEAT_MAM: If set, indicates that Multiple Atomicity Mode - * applies to write operations to this namespace. If - * cleared, indicates that Single Atomicity Mode - * applies to write operations to this namespace. - * @NVME_NS_FEAT_OPTRPERF: If set, indicates that the NPRG, NPRA, and NORS - * fields are defined for this namespace and should be - * used by the host for I/O optimization. - * @NVME_NS_NSFEAT_OPTPERF_NPDG: If set NPDG supported - * @NVME_NS_NSFEAT_OPTPERF_LARGE: If set NPDGL and NPDAL supported - */ -enum nvme_id_nsfeat { - NVME_NS_NSFEAT_THINP_SHIFT = 0, - NVME_NS_NSFEAT_NSABP_SHIFT = 1, - NVME_NS_NSFEAT_DAE_SHIFT = 2, - NVME_NS_NSFEAT_UIDREUSE_SHIFT = 3, - NVME_NS_NSFEAT_OPTPERF_SHIFT = 4, - NVME_NS_NSFEAT_MAM_SHIFT = 6, - NVME_NS_NSFEAT_OPTRPERF_SHIFT = 7, - NVME_NS_NSFEAT_THINP_MASK = 0x1, - NVME_NS_NSFEAT_NSABP_MASK = 0x1, - NVME_NS_NSFEAT_DAE_MASK = 0x1, - NVME_NS_NSFEAT_UIDREUSE_MASK = 0x1, - NVME_NS_NSFEAT_OPTPERF_MASK = 0x3, - NVME_NS_NSFEAT_MAM_MASK = 0x1, - NVME_NS_NSFEAT_OPTRPERF_MASK = 0x1, - NVME_NS_FEAT_THIN = NVME_VAL(NS_NSFEAT_THINP), - NVME_NS_FEAT_NATOMIC = NVME_VAL(NS_NSFEAT_NSABP), - NVME_NS_FEAT_DULBE = NVME_VAL(NS_NSFEAT_DAE), - NVME_NS_FEAT_ID_REUSE = NVME_VAL(NS_NSFEAT_UIDREUSE), - NVME_NS_FEAT_IO_OPT = NVME_VAL(NS_NSFEAT_OPTPERF), - NVME_NS_FEAT_MAM = NVME_VAL(NS_NSFEAT_MAM), - NVME_NS_FEAT_OPTRPERF = NVME_VAL(NS_NSFEAT_OPTRPERF), - NVME_NS_NSFEAT_OPTPERF_NPDG = 0x1, - NVME_NS_NSFEAT_OPTPERF_LARGE = 0x2, -}; - -#define NVME_NS_NSFEAT_THINP(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_THINP) -#define NVME_NS_NSFEAT_NSABP(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_NSABP) -#define NVME_NS_NSFEAT_DAE(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_DAE) -#define NVME_NS_NSFEAT_UIDREUSE(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_UIDREUSE) -#define NVME_NS_NSFEAT_OPTPERF(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_OPTPERF) -#define NVME_NS_NSFEAT_MAM(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_MAM) -#define NVME_NS_NSFEAT_OPTRPERF(nsfeat) NVME_GET(nsfeat, NS_NSFEAT_OPTRPERF) - -#define NVME_NS_NSFEAT_OPTPERF_NPDG(nsfeat) \ - (NVME_NS_NSFEAT_OPTRPERF(nsfeat) & NVME_NS_NSFEAT_OPTPERF_NPDG) -#define NVME_NS_NSFEAT_OPTPERF_LARGE(nsfeat) \ - (NVME_NS_NSFEAT_OPTRPERF(nsfeat) & NVME_NS_NSFEAT_OPTPERF_LARGE) - -/** - * enum nvme_id_ns_flbas - This field indicates the LBA data size & metadata - * size combination that the namespace has been - * formatted with - * @NVME_NS_FLBAS_LOWER_SHIFT: Shift to get the lower 4 bits of LBA format index - * @NVME_NS_FLBAS_LOWER_MASK: Mask to get the index of one of the supported - * LBA Formats's least significant - * 4bits indicated in - * :c:type:`struct nvme_id_ns `.lbaf. - * @NVME_NS_FLBAS_META_EXT: Applicable only if format contains metadata. If - * this bit is set, indicates that the metadata is - * transferred at the end of the data LBA, creating an - * extended data LBA. If cleared, indicates that all - * of the metadata for a command is transferred as a - * separate contiguous buffer of data. - * @NVME_NS_FLBAS_HIGHER_SHIFT: Shift to get the higher 2 bits of LBA format index - * @NVME_NS_FLBAS_HIGHER_MASK: Mask to get the index of one of - * the supported LBA Formats's most significant - * 2bits indicated in - * :c:type:`struct nvme_id_ns `.lbaf. - */ -enum nvme_id_ns_flbas { - NVME_NS_FLBAS_LOWER_SHIFT = 0, - NVME_NS_FLBAS_LOWER_MASK = 0xf, - NVME_NS_FLBAS_META_EXT = 1 << 4, - NVME_NS_FLBAS_HIGHER_SHIFT = 5, - NVME_NS_FLBAS_HIGHER_MASK = 0x3, -}; - -#define NVME_NS_FLBAS_LOWER(flbas) NVME_GET(flbas, NS_FLBAS_LOWER) -#define NVME_NS_FLBAS_HIGHER(flbas) NVME_GET(flbas, NS_FLBAS_HIGHER) - - -/** - * enum nvme_id_ns_mc - This field indicates the capabilities for metadata. - * @NVME_NS_MC_EXTENDED: If set, indicates that the namespace supports the - * metadata being transferred as part of an extended data LBA. - * @NVME_NS_MC_SEPARATE: If set, indicates the namespace supports the metadata - * being transferred as part of a separate buffer that is - * specified in the Metadata Pointer. - */ -enum nvme_id_ns_mc { - NVME_NS_MC_EXTENDED = 1 << 0, - NVME_NS_MC_SEPARATE = 1 << 1, -}; - -/** - * enum nvme_id_ns_dpc - This field indicates the capabilities for the - * end-to-end data protection feature. - * @NVME_NS_DPC_PIT1S_SHIFT: PIT1S shift - * @NVME_NS_DPC_PIT2S_SHIFT: PIT2S shift - * @NVME_NS_DPC_PIT3S_SHIFT: PIT3S shift - * @NVME_NS_DPC_PIIFB_SHIFT: PIIFB shift - * @NVME_NS_DPC_PIILB_SHIFT: PIILB shift - * @NVME_NS_DPC_RSVD5_SHIFT: Reserved shift - * @NVME_NS_DPC_PIT1S_MASK: PIT1S mask - * @NVME_NS_DPC_PIT2S_MASK: PIT2S mask - * @NVME_NS_DPC_PIT3S_MASK: PIT3S mask - * @NVME_NS_DPC_PIIFB_MASK: PIIFB mask - * @NVME_NS_DPC_PIILB_MASK: PIILB mask - * @NVME_NS_DPC_RSVD5_MASK: Reserved mask - * @NVME_NS_DPC_PI_TYPE1: If set, indicates that the namespace supports - * Protection Information Type 1. - * @NVME_NS_DPC_PI_TYPE2: If set, indicates that the namespace supports - * Protection Information Type 2. - * @NVME_NS_DPC_PI_TYPE3: If set, indicates that the namespace supports - * Protection Information Type 3. - * @NVME_NS_DPC_PI_FIRST: If set, indicates that the namespace supports - * protection information transferred as the first eight - * bytes of metadata. - * @NVME_NS_DPC_PI_LAST: If set, indicates that the namespace supports - * protection information transferred as the last eight - * bytes of metadata. - */ -enum nvme_id_ns_dpc { - NVME_NS_DPC_PIT1S_SHIFT = 0, - NVME_NS_DPC_PIT2S_SHIFT = 1, - NVME_NS_DPC_PIT3S_SHIFT = 2, - NVME_NS_DPC_PIIFB_SHIFT = 3, - NVME_NS_DPC_PIILB_SHIFT = 4, - NVME_NS_DPC_RSVD5_SHIFT = 5, - NVME_NS_DPC_PIT1S_MASK = 0x1, - NVME_NS_DPC_PIT2S_MASK = 0x1, - NVME_NS_DPC_PIT3S_MASK = 0x1, - NVME_NS_DPC_PIIFB_MASK = 0x1, - NVME_NS_DPC_PIILB_MASK = 0x1, - NVME_NS_DPC_RSVD5_MASK = 0x7, - NVME_NS_DPC_PI_TYPE1 = NVME_VAL(NS_DPC_PIT1S), - NVME_NS_DPC_PI_TYPE2 = NVME_VAL(NS_DPC_PIT2S), - NVME_NS_DPC_PI_TYPE3 = NVME_VAL(NS_DPC_PIT3S), - NVME_NS_DPC_PI_FIRST = NVME_VAL(NS_DPC_PIIFB), - NVME_NS_DPC_PI_LAST = NVME_VAL(NS_DPC_PIILB), -}; - -#define NVME_NS_DPC_PIT1S(dpc) NVME_GET(dpc, NS_DPC_PIT1S) -#define NVME_NS_DPC_PIT2S(dpc) NVME_GET(dpc, NS_DPC_PIT2S) -#define NVME_NS_DPC_PIT3S(dpc) NVME_GET(dpc, NS_DPC_PIT3S) -#define NVME_NS_DPC_PIIFB(dpc) NVME_GET(dpc, NS_DPC_PIIFB) -#define NVME_NS_DPC_PIILB(dpc) NVME_GET(dpc, NS_DPC_PIILB) -#define NVME_NS_DPC_RSVD5(dpc) NVME_GET(dpc, NS_DPC_RSVD5) - -/** - * enum nvme_id_ns_dps - This field indicates the Type settings for the - * end-to-end data protection feature. - * @NVME_NS_DPS_PI_NONE: Protection information is not enabled - * @NVME_NS_DPS_PI_TYPE1: Protection information is enabled, Type 1 - * @NVME_NS_DPS_PI_TYPE2: Protection information is enabled, Type 2 - * @NVME_NS_DPS_PI_TYPE3: Protection information is enabled, Type 3 - * @NVME_NS_DPS_PI_SHIFT: Protection information type shift - * @NVME_NS_DPS_PI_MASK: Mask to get the value of the PI type - * @NVME_NS_DPS_PI_FIRST_SHIFT: Protection information in first bytes shift - * @NVME_NS_DPS_PI_FIRST_MASK: Protection information in first bytes mask - * @NVME_NS_DPS_RSVD4_SHIFT: Reserved shift - * @NVME_NS_DPS_RSVD4_MASK: Reserved mask - * @NVME_NS_DPS_PI_FIRST: If set, indicates that the protection information, if - * enabled, is transferred as the first eight bytes of - * metadata. - */ -enum nvme_id_ns_dps { - NVME_NS_DPS_PI_NONE = 0, - NVME_NS_DPS_PI_TYPE1 = 1, - NVME_NS_DPS_PI_TYPE2 = 2, - NVME_NS_DPS_PI_TYPE3 = 3, - NVME_NS_DPS_PI_SHIFT = 0, - NVME_NS_DPS_PI_MASK = 0x7, - NVME_NS_DPS_PI_FIRST_SHIFT = 3, - NVME_NS_DPS_PI_FIRST_MASK = 0x1, - NVME_NS_DPS_RSVD4_SHIFT = 4, - NVME_NS_DPS_RSVD4_MASK = 0xf, - NVME_NS_DPS_PI_FIRST = NVME_VAL(NS_DPS_PI_FIRST), -}; - -#define NVME_NS_DPS_PI(dps) NVME_GET(dps, NS_DPS_PI) -#define NVME_NS_DPS_PI_FIRST(dps) NVME_GET(dps, NS_DPS_PI_FIRST) -#define NVME_NS_DPS_RSVD4(dps) NVME_GET(dps, NS_DPS_RSVD4) - -/** - * enum nvme_id_ns_nmic - This field specifies multi-path I/O and namespace - * sharing capabilities of the namespace. - * @NVME_NS_NMIC_SHRNS_SHIFT: SHRNS shift - * @NVME_NS_NMIC_DISNS_SHIFT: DISNS shift - * @NVME_NS_NMIC_RSVD2_SHIFT: Reserved shift - * @NVME_NS_NMIC_SHRNS_MASK: SHRNS mask - * @NVME_NS_NMIC_DISNS_MASK: DISNS mask - * @NVME_NS_NMIC_RSVD2_MASK: RSVD2 mask - * @NVME_NS_NMIC_SHARED: If set, then the namespace may be attached to two or - * more controllers in the NVM subsystem concurrently - */ -enum nvme_id_ns_nmic { - NVME_NS_NMIC_SHRNS_SHIFT = 0, - NVME_NS_NMIC_DISNS_SHIFT = 1, - NVME_NS_NMIC_RSVD2_SHIFT = 2, - NVME_NS_NMIC_SHRNS_MASK = 0x1, - NVME_NS_NMIC_DISNS_MASK = 0x1, - NVME_NS_NMIC_RSVD2_MASK = 0x3f, - NVME_NS_NMIC_SHARED = NVME_VAL(NS_NMIC_SHRNS), -}; - -#define NVME_NS_NMIC_SHRNS(nmic) NVME_GET(nmic, NS_NMIC_SHRNS) -#define NVME_NS_NMIC_DISNS(nmic) NVME_GET(nmic, NS_NMIC_DISNS) -#define NVME_NS_NMIC_RSVD2(nmic) NVME_GET(nmic, NS_NMIC_RSVD2) - -/** - * enum nvme_id_ns_rescap - This field indicates the reservation capabilities - * of the namespace. - * @NVME_NS_RESCAP_PTPLS_SHIFT: PTPLS shift - * @NVME_NS_RESCAP_WES_SHIFT: WES shift - * @NVME_NS_RESCAP_EAS_SHIFT: EAS shift - * @NVME_NS_RESCAP_WEROS_SHIFT: WEROS shift - * @NVME_NS_RESCAP_EAROS_SHIFT: EAROS shift - * @NVME_NS_RESCAP_WEARS_SHIFT: WEARS shift - * @NVME_NS_RESCAP_EAARS_SHIFT: EAARS shift - * @NVME_NS_RESCAP_IEKS_SHIFT: IEKS shift - * @NVME_NS_RESCAP_PTPLS_MASK: PTPLS mask - * @NVME_NS_RESCAP_WES_MASK: WES mask - * @NVME_NS_RESCAP_EAS_MASK: EAS mask - * @NVME_NS_RESCAP_WEROS_MASK: WEROS mask - * @NVME_NS_RESCAP_EAROS_MASK: EAROS mask - * @NVME_NS_RESCAP_WEARS_MASK: WEARS mask - * @NVME_NS_RESCAP_EAARS_MASK: EAARS mask - * @NVME_NS_RESCAP_IEKS_MASK: IEKS mask - * @NVME_NS_RESCAP_PTPL: If set, indicates that the namespace supports the - * Persist Through Power Loss capability. - * @NVME_NS_RESCAP_WE: If set, indicates that the namespace supports the - * Write Exclusive reservation type. - * @NVME_NS_RESCAP_EA: If set, indicates that the namespace supports the - * Exclusive Access reservation type. - * @NVME_NS_RESCAP_WERO: If set, indicates that the namespace supports the - * Write Exclusive - Registrants Only reservation type. - * @NVME_NS_RESCAP_EARO: If set, indicates that the namespace supports the - * Exclusive Access - Registrants Only reservation type. - * @NVME_NS_RESCAP_WEAR: If set, indicates that the namespace supports the - * Write Exclusive - All Registrants reservation type. - * @NVME_NS_RESCAP_EAAR: If set, indicates that the namespace supports the - * Exclusive Access - All Registrants reservation type. - * @NVME_NS_RESCAP_IEK_13: If set, indicates that Ignore Existing Key is used - * as defined in revision 1.3 or later of this specification. - */ -enum nvme_id_ns_rescap { - NVME_NS_RESCAP_PTPLS_SHIFT = 0, - NVME_NS_RESCAP_WES_SHIFT = 1, - NVME_NS_RESCAP_EAS_SHIFT = 2, - NVME_NS_RESCAP_WEROS_SHIFT = 3, - NVME_NS_RESCAP_EAROS_SHIFT = 4, - NVME_NS_RESCAP_WEARS_SHIFT = 5, - NVME_NS_RESCAP_EAARS_SHIFT = 6, - NVME_NS_RESCAP_IEKS_SHIFT = 7, - NVME_NS_RESCAP_PTPLS_MASK = 0x1, - NVME_NS_RESCAP_WES_MASK = 0x1, - NVME_NS_RESCAP_EAS_MASK = 0x1, - NVME_NS_RESCAP_WEROS_MASK = 0x1, - NVME_NS_RESCAP_EAROS_MASK = 0x1, - NVME_NS_RESCAP_WEARS_MASK = 0x1, - NVME_NS_RESCAP_EAARS_MASK = 0x1, - NVME_NS_RESCAP_IEKS_MASK = 0x1, - NVME_NS_RESCAP_PTPL = NVME_VAL(NS_RESCAP_PTPLS), - NVME_NS_RESCAP_WE = NVME_VAL(NS_RESCAP_WES), - NVME_NS_RESCAP_EA = NVME_VAL(NS_RESCAP_EAS), - NVME_NS_RESCAP_WERO = NVME_VAL(NS_RESCAP_WEROS), - NVME_NS_RESCAP_EARO = NVME_VAL(NS_RESCAP_EAROS), - NVME_NS_RESCAP_WEAR = NVME_VAL(NS_RESCAP_WEARS), - NVME_NS_RESCAP_EAAR = NVME_VAL(NS_RESCAP_EAARS), - NVME_NS_RESCAP_IEK_13 = NVME_VAL(NS_RESCAP_IEKS), -}; - -#define NVME_NS_RESCAP_PTPLS(rescap) NVME_GET(rescap, NS_RESCAP_PTPLS) -#define NVME_NS_RESCAP_WES(rescap) NVME_GET(rescap, NS_RESCAP_WES) -#define NVME_NS_RESCAP_EAS(rescap) NVME_GET(rescap, NS_RESCAP_EAS) -#define NVME_NS_RESCAP_WEROS(rescap) NVME_GET(rescap, NS_RESCAP_WEROS) -#define NVME_NS_RESCAP_EAROS(rescap) NVME_GET(rescap, NS_RESCAP_EAROS) -#define NVME_NS_RESCAP_WEARS(rescap) NVME_GET(rescap, NS_RESCAP_WEARS) -#define NVME_NS_RESCAP_EAARS(rescap) NVME_GET(rescap, NS_RESCAP_EAARS) -#define NVME_NS_RESCAP_IEKS(rescap) NVME_GET(rescap, NS_RESCAP_IEKS) - -/** - * enum nvme_nd_ns_fpi - If a format operation is in progress, this field - * indicates the percentage of the namespace that remains - * to be formatted. - * @NVME_NS_FPI_RFNVM_SHIFT: RFNVM shift - * @NVME_NS_FPI_FPIS_SHIFT: FPIS shift - * @NVME_NS_FPI_RFNVM_MASK: RFNVM mask - * @NVME_NS_FPI_FPIS_MASK: FPIS mask - * @NVME_NS_FPI_REMAINING: Mask to get the format percent remaining value - * @NVME_NS_FPI_SUPPORTED: If set, indicates that the namespace supports the - * Format Progress Indicator defined for the field. - */ -enum nvme_nd_ns_fpi { - NVME_NS_FPI_RFNVM_SHIFT = 0, - NVME_NS_FPI_FPIS_SHIFT = 7, - NVME_NS_FPI_RFNVM_MASK = 0x7f, - NVME_NS_FPI_FPIS_MASK = 0x1, - NVME_NS_FPI_REMAINING = NVME_VAL(NS_FPI_RFNVM), - NVME_NS_FPI_SUPPORTED = NVME_VAL(NS_FPI_FPIS), -}; - -#define NVME_NS_FPI_RFNVM(fpi) NVME_GET(fpi, NS_FPI_RFNVM) -#define NVME_NS_FPI_FPIS(fpi) NVME_GET(fpi, NS_FPI_FPIS) - -/** - * enum nvme_id_ns_dlfeat - This field indicates information about features - * that affect deallocating logical blocks for this - * namespace. - * @NVME_NS_DLFEAT_DRB_SHIFT: DRB shift - * @NVME_NS_DLFEAT_WZDS_SHIFT: WADS shift - * @NVME_NS_DLFEAT_GDS_SHIFT: GDS shift - * @NVME_NS_DLFEAT_RSVD5_SHIFT: Reserved shift - * @NVME_NS_DLFEAT_DRB_MASK: DRB mask - * @NVME_NS_DLFEAT_WZDS_MASK: WZDS mask, - * @NVME_NS_DLFEAT_GDS_MASK: GDS mask - * @NVME_NS_DLFEAT_RSVD5_MASK: Reserved mask - * @NVME_NS_DLFEAT_RB: Mask to get the value of the read behavior - * @NVME_NS_DLFEAT_RB_NR: Read behvaior is not reported - * @NVME_NS_DLFEAT_RB_ALL_0S: A deallocated logical block returns all bytes - * cleared to 0h. - * @NVME_NS_DLFEAT_RB_ALL_FS: A deallocated logical block returns all bytes - * set to FFh. - * @NVME_NS_DLFEAT_WRITE_ZEROES: If set, indicates that the controller supports - * the Deallocate bit in the Write Zeroes command - * for this namespace. - * @NVME_NS_DLFEAT_CRC_GUARD: If set, indicates that the Guard field for - * deallocated logical blocks that contain - * protection information is set to the CRC for - * the value read from the deallocated logical - * block and its metadata - */ -enum nvme_id_ns_dlfeat { - NVME_NS_DLFEAT_DRB_SHIFT = 0, - NVME_NS_DLFEAT_WZDS_SHIFT = 3, - NVME_NS_DLFEAT_GDS_SHIFT = 4, - NVME_NS_DLFEAT_RSVD5_SHIFT = 5, - NVME_NS_DLFEAT_DRB_MASK = 0x7, - NVME_NS_DLFEAT_WZDS_MASK = 0x1, - NVME_NS_DLFEAT_GDS_MASK = 0x1, - NVME_NS_DLFEAT_RSVD5_MASK = 0x7, - NVME_NS_DLFEAT_RB = NVME_VAL(NS_DLFEAT_DRB), - NVME_NS_DLFEAT_RB_NR = 0, - NVME_NS_DLFEAT_RB_ALL_0S = 1, - NVME_NS_DLFEAT_RB_ALL_FS = 2, - NVME_NS_DLFEAT_WRITE_ZEROES = NVME_VAL(NS_DLFEAT_WZDS), - NVME_NS_DLFEAT_CRC_GUARD = NVME_VAL(NS_DLFEAT_GDS), -}; - -#define NVME_NS_DLFEAT_DRB(dlfeat) NVME_GET(dlfeat, NS_DLFEAT_DRB) -#define NVME_NS_DLFEAT_WZDS(dlfeat) NVME_GET(dlfeat, NS_DLFEAT_WZDS) -#define NVME_NS_DLFEAT_GDS(dlfeat) NVME_GET(dlfeat, NS_DLFEAT_GDS) -#define NVME_NS_DLFEAT_RSVD5(dlfeat) NVME_GET(dlfeat, NS_DLFEAT_RSVD5) - -/** - * enum nvme_id_ns_nstat - Namespace Status - * @NVME_NS_NSTAT_NRDY_SHIFT: NRDY shift - * @NVME_NS_NSTAT_IOI_SHIFT: IOI shift - * @NVME_NS_NSTAT_RSVD3_SHIFT: Reserved shift - * @NVME_NS_NSTAT_NRDY_MASK: NRDY mask - * @NVME_NS_NSTAT_IOI_MASK: IOI mask - * @NVME_NS_NSTAT_RSVD3_MASK: Reserved mask - */ -enum nvme_id_ns_nstat { - NVME_NS_NSTAT_NRDY_SHIFT = 0, - NVME_NS_NSTAT_IOI_SHIFT = 1, - NVME_NS_NSTAT_RSVD3_SHIFT = 3, - NVME_NS_NSTAT_NRDY_MASK = 0x1, - NVME_NS_NSTAT_IOI_MASK = 0x3, - NVME_NS_NSTAT_RSVD3_MASK = 0x1f, -}; - -#define NVME_NS_NSTAT_NRDY(nstat) NVME_GET(nstat, NS_NSTAT_NRDY) -#define NVME_NS_NSTAT_IOI(nstat) NVME_GET(nstat, NS_NSTAT_IOI) -#define NVME_NS_NSTAT_RSVD3(nstat) NVME_GET(nstat, NS_NSTAT_RSVD3) - -/** - * enum nvme_id_ns_kpios - Key Per I/O Status - * @NVME_NS_KPIOS_KPIOENS_SHIFT: Shift amount to get Key Per I/O Enabled - * in Namespace from the &struct nvme_id_ns.kpios field. - * @NVME_NS_KPIOS_KPIOENS_MASK: Mask to get Key Per I/O Enabled in Namespace - * from the &struct nvme_id_ns.kpios field. - * @NVME_NS_KPIOS_KPIOSNS_SHIFT: Shift amount to get Key Per I/O Supported - * in Namespace from the &struct nvme_id_ns.kpios field. - * @NVME_NS_KPIOS_KPIOSNS_MASK: Mask to get Key Per I/O Supported in Namespace - * from the &struct nvme_id_ns.kpios field. - * @NVME_NS_KPIOS_RSVD2_SHIFT: Shift amount to get Reserved - * @NVME_NS_KPIOS_RSVD2_MASK: Mask to get Reserved - */ -enum nvme_id_ns_kpios { - NVME_NS_KPIOS_KPIOENS_SHIFT = 0, - NVME_NS_KPIOS_KPIOENS_MASK = 0x1, - NVME_NS_KPIOS_KPIOSNS_SHIFT = 1, - NVME_NS_KPIOS_KPIOSNS_MASK = 0x1, - NVME_NS_KPIOS_RSVD2_SHIFT = 2, - NVME_NS_KPIOS_RSVD2_MASK = 0x3f, -}; - -#define NVME_NS_KPIOS_KPIOENS(kpios) NVME_GET(kpios, NS_KPIOS_KPIOENS) -#define NVME_NS_KPIOS_KPIOSNS(kpios) NVME_GET(kpios, NS_KPIOS_KPIOSNS) -#define NVME_NS_KPIOS_RSVD2(kpios) NVME_GET(kpios, NS_KPIOS_RSVD2) - -/** - * enum nvme_id_ns_attr - Specifies attributes of the namespace. - * @NVME_NS_NSATTR_CWP_SHIFT: CWP shift - * @NVME_NS_NSATTR_RSVD1_SHIFT: Reserved shift - * @NVME_NS_NSATTR_CWP_MASK: CWP mask - * @NVME_NS_NSATTR_RSVD1_MASK: Reserved mask - * @NVME_NS_NSATTR_WRITE_PROTECTED: If set, then the namespace is currently - * write protected and all write access to the - * namespace shall fail. - */ -enum nvme_id_ns_attr { - NVME_NS_NSATTR_CWP_SHIFT = 0, - NVME_NS_NSATTR_RSVD1_SHIFT = 1, - NVME_NS_NSATTR_CWP_MASK = 0x1, - NVME_NS_NSATTR_RSVD1_MASK = 0x7f, - NVME_NS_NSATTR_WRITE_PROTECTED = NVME_VAL(NS_NSATTR_CWP), -}; - -#define NVME_NS_NSATTR_CWP(nsattr) NVME_GET(nsattr, NS_NSATTR_CWP) -#define NVME_NS_NSATTR_RSVD1(nsattr) NVME_GET(nsattr, NS_NSATTR_RSVD1) - -/** - * struct nvme_ns_id_desc - Namespace identifier type descriptor - * @nidt: Namespace Identifier Type, see &enum nvme_ns_id_desc_nidt - * @nidl: Namespace Identifier Length contains the length in bytes of the - * &struct nvme_id_ns.nid. - * @rsvd: Reserved - * @nid: Namespace Identifier contains a value that is globally unique and - * assigned to the namespace when the namespace is created. The length - * is defined in &struct nvme_id_ns.nidl. - */ -struct nvme_ns_id_desc { - __u8 nidt; - __u8 nidl; - __le16 rsvd; - __u8 nid[]; -} __attribute__((packed)); - -/** - * enum nvme_ns_id_desc_nidt - Known namespace identifier types - * @NVME_NIDT_EUI64: IEEE Extended Unique Identifier, the NID field contains a - * copy of the EUI64 field in the struct nvme_id_ns.eui64. - * @NVME_NIDT_NGUID: Namespace Globally Unique Identifier, the NID field - * contains a copy of the NGUID field in struct nvme_id_ns.nguid. - * @NVME_NIDT_UUID: The NID field contains a 128-bit Universally Unique - * Identifier (UUID) as specified in RFC 4122. - * @NVME_NIDT_CSI: The NID field contains the command set identifier. - */ -enum nvme_ns_id_desc_nidt { - NVME_NIDT_EUI64 = 1, - NVME_NIDT_NGUID = 2, - NVME_NIDT_UUID = 3, - NVME_NIDT_CSI = 4, -}; - -/** - * enum nvme_ns_id_desc_nidt_lens - Namespace Identifier Descriptor Type Lengths - * @NVME_NIDT_EUI64_LEN: IEEE Extended Unique Identifier length (8 bytes) - * @NVME_NIDT_NGUID_LEN: Namespace Globally Unique Identifier length (16 bytes) - * @NVME_NIDT_UUID_LEN: Universally Unique Identifier length (16 bytes) - * @NVME_NIDT_CSI_LEN: Command Set Identifier length (1 byte) - */ -enum nvme_ns_id_desc_nidt_lens { - NVME_NIDT_EUI64_LEN = 8, - NVME_NIDT_NGUID_LEN = 16, - NVME_NIDT_UUID_LEN = 16, - NVME_NIDT_CSI_LEN = 1, -}; - -/** - * struct nvme_nvmset_attr - NVM Set Attributes Entry - * @nvmsetid: NVM Set Identifier - * @endgid: Endurance Group Identifier - * @rsvd4: Reserved - * @rr4kt: Random 4 KiB Read Typical indicates the typical - * time to complete a 4 KiB random read in 100 nanosecond units - * when the NVM Set is in a Predictable Latency Mode Deterministic - * Window and there is 1 outstanding command per NVM Set. - * @ows: Optimal Write Size - * @tnvmsetcap: Total NVM Set Capacity - * @unvmsetcap: Unallocated NVM Set Capacity - * @rsvd48: Reserved - */ -struct nvme_nvmset_attr { - __le16 nvmsetid; - __le16 endgid; - __u8 rsvd4[4]; - __le32 rr4kt; - __le32 ows; - __u8 tnvmsetcap[16]; - __u8 unvmsetcap[16]; - __u8 rsvd48[80]; -}; - -/** - * struct nvme_id_nvmset_list - NVM set list - * @nid: Nvmset id - * @rsvd1: Reserved - * @ent: nvmset id list - */ -struct nvme_id_nvmset_list { - __u8 nid; - __u8 rsvd1[127]; - struct nvme_nvmset_attr ent[NVME_ID_NVMSET_LIST_MAX]; -}; - -/** - * struct nvme_id_independent_id_ns - Identify - I/O Command Set Independent Identify Namespace Data Structure - * @nsfeat: common namespace features - * @nmic: Namespace Multi-path I/O and Namespace - * Sharing Capabilities - * @rescap: Reservation Capabilities - * @fpi: Format Progress Indicator - * @anagrpid: ANA Group Identifier - * @nsattr: Namespace Attributes - * @rsvd9: reserved - * @nvmsetid: NVM Set Identifier - * @endgid: Endurance Group Identifier - * @nstat: Namespace Status - * @kpios: Key Per I/O Status - * @maxkt: Maximum Key Tag - * @rsvd18: Reserved - * @rgrpid: Reachability Group Identifier - * @rsvd24: Reserved - */ -struct nvme_id_independent_id_ns { - __u8 nsfeat; - __u8 nmic; - __u8 rescap; - __u8 fpi; - __le32 anagrpid; - __u8 nsattr; - __u8 rsvd9; - __le16 nvmsetid; - __le16 endgid; - __u8 nstat; - __u8 kpios; - __le16 maxkt; - __u8 rsvd18[2]; - __le32 rgrpid; - __u8 rsvd24[4072]; -}; - -/** - * enum nvme_id_ind_nsfeat - This field defines features of the namespace. - * @NVME_IND_NSFEAT_RSVD0_SHIFT: RSVD0 shift - * @NVME_IND_NSFEAT_UIDREUSE_SHIFT: UIDREUSE shift - * @NVME_IND_NSFEAT_RMEDIA_SHIFT: RMEDIA shift - * @NVME_IND_NSFEAT_VWCNP_SHIFT: VWCNP shift - * @NVME_IND_NSFEAT_RSVD6_SHIFT: RSVD6 shift - * @NVME_IND_NSFEAT_RSVD0_MASK: RSVD0 mask - * @NVME_IND_NSFEAT_UIDREUSE_MASK: UIDREUSE mask - * @NVME_IND_NSFEAT_RMEDIA_MASK: RMEDIA mask - * @NVME_IND_NSFEAT_VWCNP_MASK: VWCNP mask - * @NVME_IND_NSFEAT_RSVD6_MASK: RSVD6 mask - */ -enum nvme_id_ind_nsfeat { - NVME_IND_NSFEAT_RSVD0_SHIFT = 0, - NVME_IND_NSFEAT_UIDREUSE_SHIFT = 3, - NVME_IND_NSFEAT_RMEDIA_SHIFT = 4, - NVME_IND_NSFEAT_VWCNP_SHIFT = 5, - NVME_IND_NSFEAT_RSVD6_SHIFT = 6, - NVME_IND_NSFEAT_RSVD0_MASK = 0x7, - NVME_IND_NSFEAT_UIDREUSE_MASK = 0x1, - NVME_IND_NSFEAT_RMEDIA_MASK = 0x1, - NVME_IND_NSFEAT_VWCNP_MASK = 0x1, - NVME_IND_NSFEAT_RSVD6_MASK = 0x3, -}; - -#define NVME_IND_NSFEAT_RSVD0(nsfeat) NVME_GET(nsfeat, IND_NSFEAT_RSVD0) -#define NVME_IND_NSFEAT_UIDREUSE(nsfeat) NVME_GET(nsfeat, IND_NSFEAT_UIDREUSE) -#define NVME_IND_NSFEAT_RMEDIA(nsfeat) NVME_GET(nsfeat, IND_NSFEAT_RMEDIA) -#define NVME_IND_NSFEAT_VWCNP(nsfeat) NVME_GET(nsfeat, IND_NSFEAT_VWCNP) -#define NVME_IND_NSFEAT_RSVD6(nsfeat) NVME_GET(nsfeat, IND_NSFEAT_RSVD6) - -/** - * struct nvme_id_ns_granularity_desc - Namespace Granularity Descriptor - * @nszegran: Namespace Size Granularity - * @ncapgran: Namespace Capacity Granularity - */ -struct nvme_id_ns_granularity_desc { - __le64 nszegran; - __le64 ncapgran; -}; - -/** - * struct nvme_id_ns_granularity_list - Namespace Granularity List - * @attributes: Namespace Granularity Attributes - * @num_descriptors: Number of Descriptors - * @rsvd5: reserved - * @entry: Namespace Granularity Descriptor - * @rsvd1056: reserved - */ -struct nvme_id_ns_granularity_list { - __le32 attributes; - __u8 num_descriptors; - __u8 rsvd5[27]; - struct nvme_id_ns_granularity_desc entry[NVME_ID_ND_DESCRIPTOR_MAX]; - __u8 rsvd1056[3040]; -}; - -/** - * struct nvme_id_uuid_list_entry - UUID List Entry - * @header: UUID Lists Entry Header - * @rsvd1: reserved - * @uuid: 128-bit Universally Unique Identifier - */ -struct nvme_id_uuid_list_entry { - __u8 header; - __u8 rsvd1[15]; - __u8 uuid[16]; -}; - -/** - * enum nvme_id_uuid - Identifier Association - * @NVME_ID_UUID_HDR_ASSOCIATION_SHIFT: - * @NVME_ID_UUID_HDR_ASSOCIATION_MASK: - * @NVME_ID_UUID_ASSOCIATION_NONE: - * @NVME_ID_UUID_ASSOCIATION_VENDOR: - * @NVME_ID_UUID_ASSOCIATION_SUBSYSTEM_VENDOR: - */ -enum nvme_id_uuid { - NVME_ID_UUID_HDR_ASSOCIATION_SHIFT = 0, - NVME_ID_UUID_HDR_ASSOCIATION_MASK = 0x3, - NVME_ID_UUID_ASSOCIATION_NONE = 0, - NVME_ID_UUID_ASSOCIATION_VENDOR = 1, - NVME_ID_UUID_ASSOCIATION_SUBSYSTEM_VENDOR = 2, -}; - -#define NVME_ID_UUID_HDR_ASSOCIATION(uuid) NVME_GET(uuid, ID_UUID_HDR_ASSOCIATION) - -/** - * struct nvme_id_uuid_list - UUID list - * @rsvd0: reserved - * @entry: UUID list entry - */ -struct nvme_id_uuid_list { - __u8 rsvd0[32]; - struct nvme_id_uuid_list_entry entry[NVME_ID_UUID_LIST_MAX]; -}; - -/** - * struct nvme_underlying_ns_entry - Underlying Namespace Entry Data - * Structure - * @unsnqn: Underlying NVM Subsystem NQN (UNSNQN) - * @nsid: Namespace Identifier (NSID) of the Underlying Namespace - * @cntlid: Controller ID (CNTLID) of a controller able to attach @nsid - * @rsvd58: Reserved - * @idx: Index (IDX) into the list of reportable Underlying Namespaces - */ -struct nvme_underlying_ns_entry { - __u8 unsnqn[NVME_NQN_LENGTH]; - __le32 nsid; - __le16 cntlid; - __u8 rsvd58[56]; - __le16 idx; -}; - -/** - * struct nvme_underlying_ns_list - Underlying Namespace List Data Structure - * (CNS 1Dh) - * @genctr: Generation Counter (GENCTR) - * @nument: Number Entries (NUMENT) - * @rsvd10: Reserved - * @entries: Underlying Namespace list, see &struct - * nvme_underlying_ns_entry. Reportable up to - * %NVME_UNDERLYING_NS_LIST_MAX entries. - */ -struct nvme_underlying_ns_list { - __le64 genctr; - __le16 nument; - __u8 rsvd10[6]; - struct nvme_underlying_ns_entry entries[NVME_UNDERLYING_NS_LIST_MAX]; -}; - -/** - * struct nvme_fabrics_transport_entry - Underlying Fabrics Transport Entry - * Data Structure - * @traddr: Transport Address (TRADDR) - * @tsas: Transport Specific Address Subtype (TSAS) - * @pidup: Port ID of the Underlying Port (PIDUP) - * @trtype: Transport Type (TRTYPE), see &enum nvmf_trtype - * @adrfam: Transport Address Family (ADRFAM), see &enum nvmf_addr_family - * @treq: Transport Requirements (TREQ), see &enum nvmf_treq - * @rsvd517: Reserved - */ -struct nvme_fabrics_transport_entry { - __u8 traddr[NVMF_TRADDR_SIZE]; - __u8 tsas[NVMF_TSAS_SIZE]; - __le16 pidup; - __u8 trtype; - __u8 adrfam; - __u8 treq; - __u8 rsvd517[59]; -}; - -/** - * struct nvme_ports_list - Ports List Data Structure (CNS 1Eh) - * @genctr: Generation Counter (GENCTR) - * @nument: Number Entries (NUMENT) - * @rsvd10: Reserved - * @entries: Underlying Fabrics Transport Entry list, see &struct - * nvme_fabrics_transport_entry - */ -struct nvme_ports_list { - __le64 genctr; - __le16 nument; - __u8 rsvd10[6]; - struct nvme_fabrics_transport_entry entries[]; -}; - -/** - * struct nvme_supported_ctrl_state_formats - Supported Controller State - * Formats Data Structure (CNS 20h) - * @nv: Number of Versions (NV) in the NVMe Controller State Version - * list at the start of @data - * @nuuid: Number of UUIDs (NUUID) in the Vendor Specific Controller - * State UUID Supported list, immediately following the NVMe - * Controller State Version list in @data - * @data: NVMe Controller State Version list (@nv &__le16 entries) - * immediately followed by the Vendor Specific Controller State - * UUID Supported list (@nuuid 128-bit UUID entries) - */ -struct nvme_supported_ctrl_state_formats { - __u8 nv; - __u8 nuuid; - __u8 data[4094]; -}; - -/** - * struct nvme_exported_nvm_subsys_template_uuid_list - Exported NVM - * Subsystem Template UUID List data structure (CNS 22h) - * @rsvd0: Reserved - * @enst: Exported NVM Subsystem Template UUID list, up to 255 entries, - * listed in ascending order. An entry that is not reserved and - * is cleared to 0h indicates the end of the list. - */ -struct nvme_exported_nvm_subsys_template_uuid_list { - __u8 rsvd0[16]; - __u8 enst[255][16]; -}; - -/** - * struct nvme_ctrl_list - Controller List - * @num: Number of Identifiers - * @identifier: NVM subsystem unique controller identifier - */ -struct nvme_ctrl_list { - __le16 num; - __le16 identifier[NVME_ID_CTRL_LIST_MAX]; -}; - -/** - * struct nvme_ns_list - Namespace List - * @ns: Namespace Identifier - */ -struct nvme_ns_list { - __le32 ns[NVME_ID_NS_LIST_MAX]; -}; - -/** - * enum nvme_id_ctrl_nvm_lbamqf - LBA Migration Queue Format - * @NVME_ID_CTRL_NVM_LBAMQF_TYPE_0: - * @NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MIN: - * @NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MAX: - */ -enum nvme_id_ctrl_nvm_lbamqf { - NVME_ID_CTRL_NVM_LBAMQF_TYPE_0 = 0x0, - NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MIN = 0xc0, - NVME_ID_CTRL_NVM_LBAMQF_VENDOR_MAX = 0xff, -}; - -/** - * enum nvme_id_ctrl_nvm_rla - Rate Limiting Attributes - * @NVME_ID_CTRL_NVM_RLA_HLS_SHIFT: Shift amount to get Hard Limit Support (HLS) - * @NVME_ID_CTRL_NVM_RLA_HLS_MASK: Mask to get HLS - * @NVME_ID_CTRL_NVM_RLA_SLS_SHIFT: Shift amount to get Soft Limit Support (SLS) - * @NVME_ID_CTRL_NVM_RLA_SLS_MASK: Mask to get SLS - */ -enum nvme_id_ctrl_nvm_rla { - NVME_ID_CTRL_NVM_RLA_HLS_SHIFT = 0, - NVME_ID_CTRL_NVM_RLA_HLS_MASK = 0x1, - NVME_ID_CTRL_NVM_RLA_SLS_SHIFT = 1, - NVME_ID_CTRL_NVM_RLA_SLS_MASK = 0x1, -}; - -#define NVME_ID_CTRL_NVM_RLA_HLS(rla) NVME_GET(rla, ID_CTRL_NVM_RLA_HLS) -#define NVME_ID_CTRL_NVM_RLA_SLS(rla) NVME_GET(rla, ID_CTRL_NVM_RLA_SLS) - -/** - * enum nvme_id_ctrl_nvm_kpiocap - Key Per I/O Capabilities - * @NVME_ID_CTRL_NVM_KPIOCAP_KPIOS_SHIFT: Shift amount to get Key Per I/O - * Supported (KPIOS) - * @NVME_ID_CTRL_NVM_KPIOCAP_KPIOS_MASK: Mask to get KPIOS - * @NVME_ID_CTRL_NVM_KPIOCAP_KPIOSC_SHIFT: Shift amount to get Key Per I/O - * Scope (KPIOSC) - * @NVME_ID_CTRL_NVM_KPIOCAP_KPIOSC_MASK: Mask to get KPIOSC - */ -enum nvme_id_ctrl_nvm_kpiocap { - NVME_ID_CTRL_NVM_KPIOCAP_KPIOS_SHIFT = 0, - NVME_ID_CTRL_NVM_KPIOCAP_KPIOS_MASK = 0x1, - NVME_ID_CTRL_NVM_KPIOCAP_KPIOSC_SHIFT = 1, - NVME_ID_CTRL_NVM_KPIOCAP_KPIOSC_MASK = 0x1, -}; - -#define NVME_ID_CTRL_NVM_KPIOCAP_KPIOS(kpiocap) NVME_GET(kpiocap, ID_CTRL_NVM_KPIOCAP_KPIOS) -#define NVME_ID_CTRL_NVM_KPIOCAP_KPIOSC(kpiocap) NVME_GET(kpiocap, ID_CTRL_NVM_KPIOCAP_KPIOSC) - -/** - * enum nvme_id_ctrl_nvm_aocs - Admin Optional Command Support - * @NVME_ID_CTRL_NVM_AOCS_RALBAS_SHIFT: Shift amount to get Reporting - * Allocated LBA Supported (RALBAS) - * @NVME_ID_CTRL_NVM_AOCS_RSVD1_SHIFT: Shift amount to get Reserved - * @NVME_ID_CTRL_NVM_AOCS_RALBAS_MASK: Mask to get RALBAS - * @NVME_ID_CTRL_NVM_AOCS_RSVD1_MASK: Mask to get Reserved - */ -enum nvme_id_ctrl_nvm_aocs { - NVME_ID_CTRL_NVM_AOCS_RALBAS_SHIFT = 0, - NVME_ID_CTRL_NVM_AOCS_RSVD1_SHIFT = 1, - NVME_ID_CTRL_NVM_AOCS_RALBAS_MASK = 0x1, - NVME_ID_CTRL_NVM_AOCS_RSVD1_MASK = 0x7fff, -}; - -#define NVME_ID_CTRL_NVM_AOCS_RALBAS(aocs) NVME_GET(aocs, ID_CTRL_NVM_AOCS_RALBAS) -#define NVME_ID_CTRL_NVM_AOCS_RSVD1(aocs) NVME_GET(aocs, ID_CTRL_NVM_AOCS_RSVD1) - -/** - * struct nvme_id_ctrl_nvm - I/O Command Set Specific Identify Controller data structure - * @vsl: Verify Size Limit - * @wzsl: Write Zeroes Size Limit - * @wusl: Write Uncorrectable Size Limit - * @dmrl: Dataset Management Ranges Limit - * @dmrsl: Dataset Management Range Size Limit - * @dmsl: Dataset Management Size Limit - * @kpiocap: Key Per I/O Capabilities - * @wzdsl: Write Zeroes With Deallocate Size Limit - * @aocs: Admin Optional Command Support - * @ver: Version - * @lbamqf: LBA Migration Queue Format - * @rla: Rate Limiting Attributes, see &enum nvme_id_ctrl_nvm_rla - * @slmc: Soft Limit Maximum Controllers (0's based), valid only if SLS is set - * @rsvd28: Reserved - */ -struct nvme_id_ctrl_nvm { - __u8 vsl; - __u8 wzsl; - __u8 wusl; - __u8 dmrl; - __le32 dmrsl; - __le64 dmsl; - __u8 kpiocap; - __u8 wzdsl; - __le16 aocs; - __le32 ver; - __u8 lbamqf; - __u8 rla; - __le16 slmc; - __u8 rsvd28[4068]; -}; - -/** - * enum nvme_primary_ctrl_cap_crt - Controller Resource Types - * @NVME_PRIMARY_CTRL_CAP_CRT_VQRS_SHIFT: Shift amount to get VQRS - * @NVME_PRIMARY_CTRL_CAP_CRT_VQRS_MASK: Mask to get VQRS - * @NVME_PRIMARY_CTRL_CAP_CRT_VIRS_SHIFT: Shift amount to get VIRS - * @NVME_PRIMARY_CTRL_CAP_CRT_VIRS_MASK: Mask to get VIRS - * @NVME_PRIMARY_CTRL_CAP_CRT_RSVD_SHIFT: Shift amount to get Reserved - * @NVME_PRIMARY_CTRL_CAP_CRT_RSVD_MASK: Mask to get Reserved - */ -enum nvme_primary_ctrl_cap_crt { - NVME_PRIMARY_CTRL_CAP_CRT_VQRS_SHIFT = 0, - NVME_PRIMARY_CTRL_CAP_CRT_VQRS_MASK = 0x1, - NVME_PRIMARY_CTRL_CAP_CRT_VIRS_SHIFT = 1, - NVME_PRIMARY_CTRL_CAP_CRT_VIRS_MASK = 0x1, - NVME_PRIMARY_CTRL_CAP_CRT_RSVD_SHIFT = 2, - NVME_PRIMARY_CTRL_CAP_CRT_RSVD_MASK = 0x3f, -}; - -#define NVME_PRIMARY_CTRL_CAP_CRT_VQRS(crt) \ - NVME_GET(crt, PRIMARY_CTRL_CAP_CRT_VQRS) -#define NVME_PRIMARY_CTRL_CAP_CRT_VIRS(crt) \ - NVME_GET(crt, PRIMARY_CTRL_CAP_CRT_VIRS) -#define NVME_PRIMARY_CTRL_CAP_CRT_RSVD(crt) \ - NVME_GET(crt, PRIMARY_CTRL_CAP_CRT_RSVD) - -/** - * struct nvme_primary_ctrl_cap - Identify - Controller Capabilities Structure - * @cntlid: Controller Identifier - * @portid: Port Identifier - * @crt: Controller Resource Types - * @rsvd5: reserved - * @vqfrt: VQ Resources Flexible Total - * @vqrfa: VQ Resources Flexible Assigned - * @vqrfap: VQ Resources Flexible Allocated to Primary - * @vqprt: VQ Resources Private Total - * @vqfrsm: VQ Resources Flexible Secondary Maximum - * @vqgran: VQ Flexible Resource Preferred Granularity - * @rsvd48: reserved - * @vifrt: VI Resources Flexible Total - * @virfa: VI Resources Flexible Assigned - * @virfap: VI Resources Flexible Allocated to Primary - * @viprt: VI Resources Private Total - * @vifrsm: VI Resources Flexible Secondary Maximum - * @vigran: VI Flexible Resource Preferred Granularity - * @rsvd80: reserved - */ -struct nvme_primary_ctrl_cap { - __le16 cntlid; - __le16 portid; - __u8 crt; - __u8 rsvd5[27]; - __le32 vqfrt; - __le32 vqrfa; - __le16 vqrfap; - __le16 vqprt; - __le16 vqfrsm; - __le16 vqgran; - __u8 rsvd48[16]; - __le32 vifrt; - __le32 virfa; - __le16 virfap; - __le16 viprt; - __le16 vifrsm; - __le16 vigran; - __u8 rsvd80[4016]; -}; - -/** - * enum nvme_secondary_ctrl_scs - Secondary Controller State - * @NVME_SECONDARY_CTRL_SCS_OLS_SHIFT: OLS shift - * @NVME_SECONDARY_CTRL_SCS_RSVD1_SHIFT: Reserved shift - * @NVME_SECONDARY_CTRL_SCS_OLS_MASK: OLS mask - * @NVME_SECONDARY_CTRL_SCS_RSVD1_MASK: Reserved mask - */ -enum nvme_secondary_ctrl_scs { - NVME_SECONDARY_CTRL_SCS_OLS_SHIFT = 0, - NVME_SECONDARY_CTRL_SCS_RSVD1_SHIFT = 1, - NVME_SECONDARY_CTRL_SCS_OLS_MASK = 0x1, - NVME_SECONDARY_CTRL_SCS_RSVD1_MASK = 0x7f, -}; - -#define NVME_SECONDARY_CTRL_SCS_OLS(scs) NVME_GET(scs, SECONDARY_CTRL_SCS_OLS) -#define NVME_SECONDARY_CTRL_SCS_RSVD1(scs) \ - NVME_GET(scs, SECONDARY_CTRL_SCS_RSVD1) - -/** - * struct nvme_secondary_ctrl - Secondary Controller Entry - * @scid: Secondary Controller Identifier - * @pcid: Primary Controller Identifier - * @scs: Secondary Controller State - * @rsvd5: Reserved - * @vfn: Virtual Function Number - * @nvq: Number of VQ Flexible Resources Assigned - * @nvi: Number of VI Flexible Resources Assigned - * @rsvd14: Reserved - */ -struct nvme_secondary_ctrl { - __le16 scid; - __le16 pcid; - __u8 scs; - __u8 rsvd5[3]; - __le16 vfn; - __le16 nvq; - __le16 nvi; - __u8 rsvd14[18]; -}; - -/** - * struct nvme_secondary_ctrl_list - Secondary Controller List - * @num: Number of Identifiers - * @rsvd: Reserved - * @sc_entry: Secondary Controller Entry - */ -struct nvme_secondary_ctrl_list { - __u8 num; - __u8 rsvd[31]; - struct nvme_secondary_ctrl sc_entry[NVME_ID_SECONDARY_CTRL_MAX]; -}; - -/** - * struct nvme_id_iocs - NVMe Identify IO Command Set data structure - * @iocsc: List of supported IO Command Set Combination vectors - */ -struct nvme_id_iocs { - __le64 iocsc[512]; -}; - -/** - * struct nvme_id_domain_attr - Domain Attributes Entry - * @dom_id: Domain Identifier - * @rsvd2: Reserved - * @dom_cap: Total Domain Capacity - * @unalloc_dom_cap: Unallocated Domain Capacity - * @max_egrp_dom_cap: Max Endurance Group Domain Capacity - * @rsvd64: Reserved - */ -struct nvme_id_domain_attr { - __le16 dom_id; - __u8 rsvd2[14]; - __u8 dom_cap[16]; - __u8 unalloc_dom_cap[16]; - __u8 max_egrp_dom_cap[16]; - __u8 rsvd64[64]; -}; - -/** - * struct nvme_id_domain_list - Domain List - * @num: Number of domain attributes - * @rsvd: Reserved - * @domain_attr: List of domain attributes - */ -struct nvme_id_domain_list { - __u8 num; - __u8 rsvd[127]; - struct nvme_id_domain_attr domain_attr[NVME_ID_DOMAIN_LIST_MAX]; -}; - -/** - * struct nvme_id_endurance_group_list - Endurance Group List - * @num: Number of Identifiers - * @identifier: Endurance Group Identifier - */ -struct nvme_id_endurance_group_list { - __le16 num; - __le16 identifier[NVME_ID_ENDURANCE_GROUP_LIST_MAX]; -}; - /** * struct nvme_supported_log_pages - Supported Log Pages - Log * @lid_support: Log Page Identifier Supported @@ -5152,7 +990,7 @@ enum nvme_log_lids_lidsp { NVME_LOG_LIDS_LIDSP_EXTDLPES_MASK = 0x1, NVME_LOG_LIDS_LIDSP_PLEOS_MASK = 0x1, NVME_LOG_LIDS_LIDSP_ALLSUBES_MASK = 0x1, - NVME_LOG_LIDS_LIDSP_ALLHOSTES_MASK = 0, + NVME_LOG_LIDS_LIDSP_ALLHOSTES_MASK = 0x1, }; #define NVME_LOG_LIDS_LIDSP_MCDAS(lidsp) NVME_GET(lidsp, LOG_LIDS_LIDSP_MCDAS) @@ -5667,44 +1505,6 @@ enum nvme_voltage_threshold_type { NVME_VOLTAGE_THRESHOLD_TYPE_UNDERVOLTAGE = 0x01, }; -/** - * enum nvme_id_ctrl_vsen - Identify Controller Voltage Sensor data - * structure (VSEN1-VSEN4) - * @NVME_CTRL_VSEN_VSRV_SHIFT: Shift amount to get the Voltage Sample Rate - * Value (VSRV) - * @NVME_CTRL_VSEN_VSRV_MASK: Mask to get VSRV - * @NVME_CTRL_VSEN_VSRS_SHIFT: Shift amount to get the Voltage Sample Rate - * Scale (VSRS) - * @NVME_CTRL_VSEN_VSRS_MASK: Mask to get VSRS - * @NVME_CTRL_VSEN_VOLSS_SHIFT: Shift amount to get the Voltage Sample Scale - * (VOLSS) - * @NVME_CTRL_VSEN_VOLSS_MASK: Mask to get VOLSS - * @NVME_CTRL_VSEN_PISL_SHIFT: Shift amount to get the Power Input Supply - * Label (PISL) - * @NVME_CTRL_VSEN_PISL_MASK: Mask to get PISL - * @NVME_CTRL_VSEN_PISV_SHIFT: Shift amount to get the Power Input Supply - * Value (PISV), in units of 0.05 V - * @NVME_CTRL_VSEN_PISV_MASK: Mask to get PISV - */ -enum nvme_id_ctrl_vsen { - NVME_CTRL_VSEN_VSRV_SHIFT = 16, - NVME_CTRL_VSEN_VSRV_MASK = 0xff, - NVME_CTRL_VSEN_VSRS_SHIFT = 24, - NVME_CTRL_VSEN_VSRS_MASK = 0xff, - NVME_CTRL_VSEN_VOLSS_SHIFT = 14, - NVME_CTRL_VSEN_VOLSS_MASK = 0x3, - NVME_CTRL_VSEN_PISL_SHIFT = 12, - NVME_CTRL_VSEN_PISL_MASK = 0x3, - NVME_CTRL_VSEN_PISV_SHIFT = 0, - NVME_CTRL_VSEN_PISV_MASK = 0xfff, -}; - -#define NVME_CTRL_VSEN_VSRV(vsen) NVME_GET(vsen, CTRL_VSEN_VSRV) -#define NVME_CTRL_VSEN_VSRS(vsen) NVME_GET(vsen, CTRL_VSEN_VSRS) -#define NVME_CTRL_VSEN_VOLSS(vsen) NVME_GET(vsen, CTRL_VSEN_VOLSS) -#define NVME_CTRL_VSEN_PISL(vsen) NVME_GET(vsen, CTRL_VSEN_PISL) -#define NVME_CTRL_VSEN_PISV(vsen) NVME_GET(vsen, CTRL_VSEN_PISV) - /** * enum nvme_voltage_measurement_vma - Voltage Measurement log page - * Voltage Measurement Attributes (VMA) @@ -8780,18 +4580,6 @@ struct nvme_streams_directive_status { __le16 sid[]; }; -/** - * struct nvme_id_directives - Identify Directive - Return Parameters Data Structure - * @supported: Identify directive is supported - * @enabled: Identify directive is Enabled - * @rsvd64: Reserved - */ -struct nvme_id_directives { - __u8 supported[32]; - __u8 enabled[32]; - __u8 rsvd64[4032]; -}; - /** * enum nvme_directive_types - Directives Supported or Enabled * @NVME_ID_DIR_ID_BIT: Identify directive is supported @@ -10827,88 +6615,6 @@ enum nvme_async_event_cqe_dw0 { #define NVME_ASYNC_EVENT_CQE_DW0_AEI(dw0) NVME_GET(dw0, ASYNC_EVENT_CQE_DW0_AEI) #define NVME_ASYNC_EVENT_CQE_DW0_LID(dw0) NVME_GET(dw0, ASYNC_EVENT_CQE_DW0_LID) -/** - * enum nvme_identify_cns - Identify - CNS Values - * @NVME_IDENTIFY_CNS_NS: Identify Namespace data structure - * @NVME_IDENTIFY_CNS_CTRL: Identify Controller data structure - * @NVME_IDENTIFY_CNS_NS_ACTIVE_LIST: Active Namespace ID list - * @NVME_IDENTIFY_CNS_NS_DESC_LIST: Namespace Identification Descriptor list - * @NVME_IDENTIFY_CNS_NVMSET_LIST: NVM Set List - * @NVME_IDENTIFY_CNS_CSI_NS: I/O Command Set specific Identify - * Namespace data structure - * @NVME_IDENTIFY_CNS_CSI_CTRL: I/O Command Set specific Identify - * Controller data structure - * @NVME_IDENTIFY_CNS_CSI_NS_ACTIVE_LIST: Active Namespace ID list associated - * with the specified I/O Command Set - * @NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS: I/O Command Set Independent Identify - * @NVME_IDENTIFY_CNS_NS_USER_DATA_FORMAT: Namespace user data format - * @NVME_IDENTIFY_CNS_CSI_NS_USER_DATA_FORMAT: I/O Command Set specific user data - * format - * Namespace data structure - * @NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST: Allocated Namespace ID list - * @NVME_IDENTIFY_CNS_ALLOCATED_NS: Identify Namespace data structure for - * the specified allocated NSID - * @NVME_IDENTIFY_CNS_NS_CTRL_LIST: Controller List of controllers attached - * to the specified NSID - * @NVME_IDENTIFY_CNS_CTRL_LIST: Controller List of controllers that exist - * in the NVM subsystem - * @NVME_IDENTIFY_CNS_PRIMARY_CTRL_CAP: Primary Controller Capabilities data - * structure for the specified primary controller - * @NVME_IDENTIFY_CNS_SECONDARY_CTRL_LIST: Secondary Controller list of controllers - * associated with the primary controller - * processing the command - * @NVME_IDENTIFY_CNS_NS_GRANULARITY: A Namespace Granularity List - * @NVME_IDENTIFY_CNS_UUID_LIST: A UUID List - * @NVME_IDENTIFY_CNS_DOMAIN_LIST: Domain List - * @NVME_IDENTIFY_CNS_ENDURANCE_GROUP_ID: Endurance Group List - * @NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS_LIST: I/O Command Set specific Allocated Namespace - * ID list - * @NVME_IDENTIFY_CNS_CSI_ID_NS_DATA_STRUCTURE: I/O Command Set specific ID Namespace - * Data Structure for Allocated Namespace ID - * @NVME_IDENTIFY_CNS_COMMAND_SET_STRUCTURE: I/O Command Set data structure - * @NVME_IDENTIFY_CNS_UNDERLYING_NS_LIST: Get Underlying Namespace List - * @NVME_IDENTIFY_CNS_PORTS_LIST: Get Ports List - * @NVME_IDENTIFY_CNS_IOCS_IND_ID_ALLOC_NS: I/O Command Set Independent Identify Namespace data - * structure for the specified allocated NSID - * @NVME_IDENTIFY_CNS_SUPPORTED_CTRL_STATE_FORMATS: Supported Controller State Formats - * identifying the supported NVMe Controller - * State data structures - * @NVME_IDENTIFY_CNS_UNDERLYING_CTRL_LIST: Get Underlying Controller List - * @NVME_IDENTIFY_CNS_EXPORTED_NVM_SUBSYS_TEMPLATE_UUID_LIST: Exported NVM - * Subsystem Template UUID List - */ -enum nvme_identify_cns { - NVME_IDENTIFY_CNS_NS = 0x00, - NVME_IDENTIFY_CNS_CTRL = 0x01, - NVME_IDENTIFY_CNS_NS_ACTIVE_LIST = 0x02, - NVME_IDENTIFY_CNS_NS_DESC_LIST = 0x03, - NVME_IDENTIFY_CNS_NVMSET_LIST = 0x04, - NVME_IDENTIFY_CNS_CSI_NS = 0x05, - NVME_IDENTIFY_CNS_CSI_CTRL = 0x06, - NVME_IDENTIFY_CNS_CSI_NS_ACTIVE_LIST = 0x07, - NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS = 0x08, - NVME_IDENTIFY_CNS_NS_USER_DATA_FORMAT = 0x09, - NVME_IDENTIFY_CNS_CSI_NS_USER_DATA_FORMAT = 0x0A, - NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST = 0x10, - NVME_IDENTIFY_CNS_ALLOCATED_NS = 0x11, - NVME_IDENTIFY_CNS_NS_CTRL_LIST = 0x12, - NVME_IDENTIFY_CNS_CTRL_LIST = 0x13, - NVME_IDENTIFY_CNS_PRIMARY_CTRL_CAP = 0x14, - NVME_IDENTIFY_CNS_SECONDARY_CTRL_LIST = 0x15, - NVME_IDENTIFY_CNS_NS_GRANULARITY = 0x16, - NVME_IDENTIFY_CNS_UUID_LIST = 0x17, - NVME_IDENTIFY_CNS_DOMAIN_LIST = 0x18, - NVME_IDENTIFY_CNS_ENDURANCE_GROUP_ID = 0x19, - NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS_LIST = 0x1A, - NVME_IDENTIFY_CNS_CSI_ID_NS_DATA_STRUCTURE = 0x1B, - NVME_IDENTIFY_CNS_COMMAND_SET_STRUCTURE = 0x1C, - NVME_IDENTIFY_CNS_UNDERLYING_NS_LIST = 0x1D, - NVME_IDENTIFY_CNS_PORTS_LIST = 0x1E, - NVME_IDENTIFY_CNS_IOCS_IND_ID_ALLOC_NS = 0x1F, - NVME_IDENTIFY_CNS_SUPPORTED_CTRL_STATE_FORMATS = 0x20, - NVME_IDENTIFY_CNS_UNDERLYING_CTRL_LIST = 0x21, - NVME_IDENTIFY_CNS_EXPORTED_NVM_SUBSYS_TEMPLATE_UUID_LIST = 0x22, -}; /** * enum nvme_cmd_get_log_lid - Get Log Page -Log Page Identifiers @@ -13302,10 +9008,3 @@ nvme_feature_decode_namespace_write_protect(__u32 value, __u8 *wps) #define NVME_FEAT_BPWPC_BP0WPS(v) NVME_GET(v, FEAT_BPWPC_BP0WPS) #define NVME_FEAT_BPWPC_BP1WPS(v) NVME_GET(v, FEAT_BPWPC_BP1WPS) - -static inline void -nvme_id_ns_flbas_to_lbaf_inuse(__u8 flbas, __u8 *lbaf_inuse) -{ - *lbaf_inuse = ((NVME_FLBAS_HIGHER(flbas) << 4) | - NVME_FLBAS_LOWER(flbas)); -} diff --git a/libnvme/src/nvme/nvme-types-fabrics.h b/libnvme/src/nvme/nvme-types-fabrics.h index a8996a8490..ec6764d279 100644 --- a/libnvme/src/nvme/nvme-types-fabrics.h +++ b/libnvme/src/nvme/nvme-types-fabrics.h @@ -17,6 +17,30 @@ #include #include +/** + * NVMF_GET() - extract field from complex value + * @value: The original value of a complex field + * @name: The name of the sub-field within an nvme value + * + * By convention, this library defines _SHIFT and _MASK such that mask can be + * applied after the shift to isolate a specific set of bits that decode to a + * sub-field. + * + * Returns: The 'name' field from 'value' + */ +#define NVMF_GET(value, name) \ + (((value) >> NVMF_##name##_SHIFT) & NVMF_##name##_MASK) + +/** + * NVMF_SET() - set field into complex value + * @value: The value to be set in its completed position + * @name: The name of the sub-field within an nvme value + * + * Returns: The 'name' field from 'value' + */ +#define NVMF_SET(value, name) \ + (((__u32)(value) & NVMF_##name##_MASK) << NVMF_##name##_SHIFT) + /** * DOC: nvme-types-fabrics.h * diff --git a/plugins/micron/micron-nvme.c b/plugins/micron/micron-nvme.c index 0efd9ad458..90707109c1 100644 --- a/plugins/micron/micron-nvme.c +++ b/plugins/micron/micron-nvme.c @@ -3695,7 +3695,7 @@ static int micron_internal_logs(int argc, char **argv, struct command *acmd, char strOSDirName[1024]; char strCtrlDirName[1024]; char strMainDirName[256]; - unsigned int *puiIDDBuf; + unsigned int puiIDDBuf[sizeof(struct nvme_id_ctrl)]; unsigned int uiMask; struct nvme_id_ctrl ctrl; struct libnvme_passthru_cmd cmd; @@ -4002,7 +4002,7 @@ static int micron_internal_logs(int argc, char **argv, struct command *acmd, break; case 0xE6: case 0xE7: - puiIDDBuf = (unsigned int *)&ctrl; + memcpy(puiIDDBuf, &ctrl, sizeof(struct nvme_id_ctrl)); uiMask = puiIDDBuf[1015]; if (!uiMask || (aVendorLogs[i].ucLogPage == 0xE6 && uiMask == 2) || (aVendorLogs[i].ucLogPage == 0xE7 && uiMask == 1))