summaryrefslogtreecommitdiffstats
path: root/src/nvme/types.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvme/types.h')
-rw-r--r--src/nvme/types.h282
1 files changed, 266 insertions, 16 deletions
diff --git a/src/nvme/types.h b/src/nvme/types.h
index 3bf2237..29ac050 100644
--- a/src/nvme/types.h
+++ b/src/nvme/types.h
@@ -43,7 +43,7 @@
* Returns: The 'name' field from 'value'
*/
#define NVME_SET(value, name) \
- (((value) & NVME_##name##_MASK) << NVME_##name##_SHIFT)
+ (((__u32)(value) & NVME_##name##_MASK) << NVME_##name##_SHIFT)
/**
* enum nvme_constants - A place to stash various constant nvme values
@@ -611,6 +611,19 @@ static const __u64 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 {
+ NVME_FLBAS_LOWER_SHIFT = 0,
+ NVME_FLBAS_META_EXT_SHIFT = 4,
+ NVME_FLBAS_HIGHER_SHIFT = 5,
+ NVME_FLBAS_LOWER_MASK = 0xf,
+ NVME_FLBAS_META_EXT_MASK = 0x1,
+ NVME_FLBAS_HIGHER_MASK = 0x3,
+};
+
+#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)
+
/**
* enum nvme_psd_flags - Possible flag values in nvme power state descriptor
* @NVME_PSD_FLAGS_MXPS: Indicates the scale for the Maximum Power
@@ -930,7 +943,10 @@ struct nvme_id_psd {
* @maxcna: Maximum I/O Controller Namespace Attachments indicates the
* maximum number of namespaces that are allowed to be attached to
* this I/O controller.
- * @rsvd564: Reserved
+ * @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.
+ * @rsvd568: 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
@@ -1035,7 +1051,8 @@ struct nvme_id_ctrl {
__le32 mnan;
__u8 maxdna[16];
__le32 maxcna;
- __u8 rsvd564[204];
+ __le32 oaqd;
+ __u8 rsvd568[200];
char subnqn[NVME_NQN_LENGTH];
__u8 rsvd1024[768];
@@ -1489,6 +1506,14 @@ enum nvme_id_ctrl_cqes {
* 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.
*/
enum nvme_id_ctrl_oncs {
NVME_CTRL_ONCS_COMPARE = 1 << 0,
@@ -1500,6 +1525,8 @@ enum nvme_id_ctrl_oncs {
NVME_CTRL_ONCS_TIMESTAMP = 1 << 6,
NVME_CTRL_ONCS_VERIFY = 1 << 7,
NVME_CTRL_ONCS_COPY = 1 << 8,
+ NVME_CTRL_ONCS_COPY_SINGLE_ATOMICITY = 1 << 9,
+ NVME_CTRL_ONCS_ALL_FAST_COPY = 1 << 10,
};
/**
@@ -1772,7 +1799,6 @@ enum nvme_lbaf_rp {
* remains fixed throughout the life of the namespace and is
* preserved across namespace and controller operations
* @lbaf: LBA Format, see &struct nvme_lbaf.
- * @lbstm: Logical Block Storage Tag Mask for end-to-end protection
* @vs: Vendor Specific
*/
struct nvme_id_ns {
@@ -1816,8 +1842,7 @@ struct nvme_id_ns {
__u8 nguid[16];
__u8 eui64[8];
struct nvme_lbaf lbaf[64];
- __le64 lbstm;
- __u8 vs[3704];
+ __u8 vs[3712];
};
/**
@@ -3075,11 +3100,13 @@ struct nvme_telemetry_log {
/**
* struct nvme_endurance_group_log - Endurance Group Information Log
* @critical_warning: Critical Warning
- * @rsvd1: Reserved
+ * @endurance_group_features: Endurance Group Features
+ * @rsvd2: Reserved
* @avl_spare: Available Spare
* @avl_spare_threshold: Available Spare Threshold
* @percent_used: Percentage Used
- * @rsvd6: Reserved
+ * @domain_identifier: Domain Identifier
+ * @rsvd8: Reserved
* @endurance_estimate: Endurance Estimate
* @data_units_read: Data Units Read
* @data_units_written: Data Units Written
@@ -3088,15 +3115,19 @@ struct nvme_telemetry_log {
* @host_write_cmds: Host Write Commands
* @media_data_integrity_err: Media and Data Integrity Errors
* @num_err_info_log_entries: Number of Error Information Log Entries
- * @rsvd160: Reserved
+ * @total_end_grp_cap: Total Endurance Group Capacity
+ * @unalloc_end_grp_cap: Unallocated Endurance Group Capacity
+ * @rsvd192: Reserved
*/
struct nvme_endurance_group_log {
__u8 critical_warning;
- __u8 rsvd1[2];
+ __u8 endurance_group_features;
+ __u8 rsvd2;
__u8 avl_spare;
__u8 avl_spare_threshold;
__u8 percent_used;
- __u8 rsvd6[26];
+ __le16 domain_identifier;
+ __u8 rsvd8[24];
__u8 endurance_estimate[16];
__u8 data_units_read[16];
__u8 data_units_written[16];
@@ -3105,7 +3136,9 @@ struct nvme_endurance_group_log {
__u8 host_write_cmds[16];
__u8 media_data_integrity_err[16];
__u8 num_err_info_log_entries[16];
- __u8 rsvd160[352];
+ __u8 total_end_grp_cap[16];
+ __u8 unalloc_end_grp_cap[16];
+ __u8 rsvd192[320];
};
/**
@@ -3710,6 +3743,110 @@ struct nvme_boot_partition {
};
/**
+ * struct nvme_eom_lane_desc - EOM Lane Descriptor
+ * @rsvd0: Reserved
+ * @mstatus: Measurement Status
+ * @lane: Lane number
+ * @eye: Eye number
+ * @top: Absolute number of rows from center to top edge of eye
+ * @bottom: Absolute number of rows from center to bottom edge of eye
+ * @left: Absolute number of rows from center to left edge of eye
+ * @right: Absolute number of rows from center to right edge of eye
+ * @nrows: Number of Rows
+ * @ncols: Number of Columns
+ * @edlen: Eye Data Length
+ * @rsvd18: Reserved
+ * @eye_desc: Printable Eye, Eye Data, and any Padding
+ */
+struct nvme_eom_lane_desc {
+ __u8 rsvd0;
+ __u8 mstatus;
+ __u8 lane;
+ __u8 eye;
+ __le16 top;
+ __le16 bottom;
+ __le16 left;
+ __le16 right;
+ __le16 nrows;
+ __le16 ncols;
+ __le16 edlen;
+ __u8 rsvd18[14];
+ __u8 eye_desc[];
+};
+
+/**
+ * struct nvme_phy_rx_eom_log - Physical Interface Receiver Eye Opening Measurement Log
+ * @lid: Log Identifier
+ * @eomip: EOM In Progress
+ * @hsize: Header Size
+ * @rsize: Result Size
+ * @eomdgn: EOM Data Generation Number
+ * @lr: Log Revision
+ * @odp: Optional Data Present
+ * @lanes: Number of lanes configured for this port
+ * @epl: Eyes Per Lane
+ * @lspfc: Log Specific Parameter Field Copy
+ * @li: Link Information
+ * @rsvd15: Reserved
+ * @lsic: Log Specific Identifier Copy
+ * @dsize: Descriptor Size
+ * @nd: Number of Descriptors
+ * @maxtb: Maximum Top Bottom
+ * @maxlr: Maximum Left Right
+ * @etgood: Estimated Time for Good Quality
+ * @etbetter: Estimated Time for Better Quality
+ * @etbest: Estimated Time for Best Quality
+ * @rsvd36: Reserved
+ * @descs: EOM Lane Descriptors
+ */
+struct nvme_phy_rx_eom_log {
+ __u8 lid;
+ __u8 eomip;
+ __le16 hsize;
+ __le32 rsize;
+ __u8 eomdgn;
+ __u8 lr;
+ __u8 odp;
+ __u8 lanes;
+ __u8 epl;
+ __u8 lspfc;
+ __u8 li;
+ __u8 rsvd15[3];
+ __le16 lsic;
+ __le32 dsize;
+ __le16 nd;
+ __le16 maxtb;
+ __le16 maxlr;
+ __le16 etgood;
+ __le16 etbetter;
+ __le16 etbest;
+ __u8 rsvd36[28];
+ struct nvme_eom_lane_desc descs[];
+};
+
+/**
+ * enum nvme_eom_optional_data - EOM Optional Data Present Fields
+ * @NVME_EOM_EYE_DATA_PRESENT: Eye Data Present
+ * @NVME_EOM_PRINTABLE_EYE_PRESENT: Printable Eye Present
+ */
+enum nvme_eom_optional_data {
+ NVME_EOM_EYE_DATA_PRESENT = 1,
+ NVME_EOM_PRINTABLE_EYE_PRESENT = 1 << 1,
+};
+
+/**
+ * enum nvme_phy_rx_eom_progress - EOM In Progress Values
+ * @NVME_PHY_RX_EOM_NOT_STARTED: EOM Not Started
+ * @NVME_PHY_RX_EOM_IN_PROGRESS: EOM In Progress
+ * @NVME_PHY_RX_EOM_COMPLETED: EOM Completed
+ */
+enum nvme_phy_rx_eom_progress {
+ NVME_PHY_RX_EOM_NOT_STARTED = 0,
+ NVME_PHY_RX_EOM_IN_PROGRESS = 1,
+ NVME_PHY_RX_EOM_COMPLETED = 2,
+};
+
+/**
* struct nvme_media_unit_stat_desc - Media Unit Status Descriptor
* @muid: Media Unit Identifier
* @domainid: Domain Identifier
@@ -4604,11 +4741,19 @@ struct nvme_plm_config {
/**
* struct nvme_feat_host_behavior - Host Behavior Support - Data Structure
* @acre: Advanced Command Retry Enable
- * @rsvd1: Reserved
+ * @etdas: Extended Telemetry Data Area 4 Supported
+ * @lbafee: LBA Format Extension Enable
+ * @rsvd3: Reserved
+ * @cdfe: Copy Descriptor Formats Enable
+ * @rsvd6: Reserved
*/
struct nvme_feat_host_behavior {
__u8 acre;
- __u8 rsvd1[511];
+ __u8 etdas;
+ __u8 lbafee;
+ __u8 rsvd3;
+ __u16 cdfe;
+ __u8 rsvd6[506];
};
/**
@@ -4674,6 +4819,66 @@ struct nvme_copy_range_f1 {
};
/**
+ * enum nvme_copy_range_sopt - NVMe Copy Range Source Options
+ * @NVME_COPY_SOPT_FCO: NVMe Copy Source Option Fast Copy Only
+ */
+enum nvme_copy_range_sopt {
+ NVME_COPY_SOPT_FCO = 1 << 15,
+};
+
+/**
+ * struct nvme_copy_range_f2 - Copy - Source Range Entries Descriptor Format 2h
+ * @snsid: Source Namespace Identifier
+ * @rsvd4: Reserved
+ * @slba: Starting LBA
+ * @nlb: Number of Logical Blocks
+ * @rsvd18: Reserved
+ * @sopt: Source Options
+ * @eilbrt: Expected Initial Logical Block Reference Tag /
+ * Expected Logical Block Storage Tag
+ * @elbatm: Expected Logical Block Application Tag Mask
+ * @elbat: Expected Logical Block Application Tag
+ */
+struct nvme_copy_range_f2 {
+ __le32 snsid;
+ __u8 rsvd4[4];
+ __le64 slba;
+ __le16 nlb;
+ __u8 rsvd18[4];
+ __le16 sopt;
+ __le32 eilbrt;
+ __le16 elbat;
+ __le16 elbatm;
+};
+
+/**
+ * struct nvme_copy_range_f3 - Copy - Source Range Entries Descriptor Format 3h
+ * @snsid: Source Namespace Identifier
+ * @rsvd4: Reserved
+ * @slba: Starting LBA
+ * @nlb: Number of Logical Blocks
+ * @rsvd18: Reserved
+ * @sopt: Source Options
+ * @rsvd24: Reserved
+ * @elbt: Expected Initial Logical Block Reference Tag /
+ * Expected Logical Block Storage Tag
+ * @elbatm: Expected Logical Block Application Tag Mask
+ * @elbat: Expected Logical Block Application Tag
+ */
+struct nvme_copy_range_f3 {
+ __le32 snsid;
+ __u8 rsvd4[4];
+ __le64 slba;
+ __le16 nlb;
+ __u8 rsvd18[4];
+ __le16 sopt;
+ __u8 rsvd24[2];
+ __u8 elbt[10];
+ __le16 elbat;
+ __le16 elbatm;
+};
+
+/**
* struct nvme_registered_ctrl - Registered Controller Data Structure
* @cntlid: Controller ID
* @rcsts: Reservation Status
@@ -6125,6 +6330,21 @@ struct nvme_mi_vpd_hdr {
* @NVME_SC_INVALID_PI: Invalid Protection Information
* @NVME_SC_READ_ONLY: Attempted Write to Read Only Range
* @NVME_SC_CMD_SIZE_LIMIT_EXCEEDED: Command Size Limit Exceeded
+ * @NVME_SC_INCOMPATIBLE_NS: Incompatible Namespace or Format: At
+ * least one source namespace and the
+ * destination namespace have incompatible
+ * formats.
+ * @NVME_SC_FAST_COPY_NOT_POSSIBLE: Fast Copy Not Possible: The Fast Copy
+ * Only (FCO) bit was set to ‘1’ in a Source
+ * Range entry and the controller was not
+ * able to use fast copy operations to copy
+ * the specified data.
+ * @NVME_SC_OVERLAPPING_IO_RANGE: Overlapping I/O Range: A source logical
+ * block range overlaps the destination
+ * logical block range.
+ * @NVME_SC_INSUFFICIENT_RESOURCES: Insufficient Resources: A resource
+ * shortage prevented the controller from
+ * performing the requested copy.
* @NVME_SC_CONNECT_FORMAT: Incompatible Format: The NVM subsystem
* does not support the record format
* specified by the host.
@@ -6370,6 +6590,10 @@ enum nvme_status_field {
NVME_SC_INVALID_PI = 0x81,
NVME_SC_READ_ONLY = 0x82,
NVME_SC_CMD_SIZE_LIMIT_EXCEEDED = 0x83,
+ NVME_SC_INCOMPATIBLE_NS = 0x85,
+ NVME_SC_FAST_COPY_NOT_POSSIBLE = 0x86,
+ NVME_SC_OVERLAPPING_IO_RANGE = 0x87,
+ NVME_SC_INSUFFICIENT_RESOURCES = 0x89,
/*
* I/O Command Set Specific - Fabrics commands:
@@ -6501,7 +6725,7 @@ static inline __u32 nvme_status_get_type(int status)
*/
static inline __u32 nvme_status_get_value(int status)
{
- return status & ~(NVME_STATUS_TYPE_MASK << NVME_STATUS_TYPE_SHIFT);
+ return status & ~NVME_SET(NVME_STATUS_TYPE_MASK, STATUS_TYPE);
}
/**
@@ -6688,6 +6912,7 @@ enum nvme_identify_cns {
* @NVME_LOG_LID_FID_SUPPORTED_EFFECTS: Feature Identifiers Supported and Effects
* @NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS: NVMe-MI Commands Supported and Effects
* @NVME_LOG_LID_BOOT_PARTITION: Boot Partition
+ * @NVME_LOG_LID_PHY_RX_EOM: Physical Interface Receiver Eye Opening Measurement
* @NVME_LOG_LID_FDP_CONFIGS: FDP Configurations
* @NVME_LOG_LID_FDP_RUH_USAGE: Reclaim Unit Handle Usage
* @NVME_LOG_LID_FDP_STATS: FDP Statistics
@@ -6719,6 +6944,7 @@ enum nvme_cmd_get_log_lid {
NVME_LOG_LID_FID_SUPPORTED_EFFECTS = 0x12,
NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS = 0x13,
NVME_LOG_LID_BOOT_PARTITION = 0x15,
+ NVME_LOG_LID_PHY_RX_EOM = 0x19,
NVME_LOG_LID_FDP_CONFIGS = 0x20,
NVME_LOG_LID_FDP_RUH_USAGE = 0x21,
NVME_LOG_LID_FDP_STATS = 0x22,
@@ -7012,7 +7238,7 @@ enum nvme_feat {
NVME_FEAT_WP_WPS_SHIFT = 0,
NVME_FEAT_WP_WPS_MASK = 0x7,
NVME_FEAT_IOCSP_IOCSCI_SHIFT = 0,
- NVME_FEAT_IOCSP_IOCSCI_MASK = 0xff,
+ NVME_FEAT_IOCSP_IOCSCI_MASK = 0x1ff,
NVME_FEAT_FDP_ENABLED_SHIFT = 0,
NVME_FEAT_FDP_ENABLED_MASK = 0x1,
NVME_FEAT_FDP_INDEX_SHIFT = 8,
@@ -7273,6 +7499,30 @@ enum nvme_log_ana_lsp {
};
/**
+ * enum nvme_log_phy_rx_eom_action - Physical Interface Receiver Eye Opening Measurement Action
+ * @NVME_LOG_PHY_RX_EOM_READ: Read Log Data
+ * @NVME_LOG_PHY_RX_EOM_START_READ: Start Measurement and Read Log Data
+ * @NVME_LOG_PHY_RX_EOM_ABORT_CLEAR: Abort Measurement and Clear Log Data
+ */
+enum nvme_log_phy_rx_eom_action {
+ NVME_LOG_PHY_RX_EOM_READ = 0,
+ NVME_LOG_PHY_RX_EOM_START_READ = 1,
+ NVME_LOG_PHY_RX_EOM_ABORT_CLEAR = 2,
+};
+
+/**
+ * enum nvme_log_phy_rx_eom_quality - Physical Interface Receiver Eye Opening Measurement Quality
+ * @NVME_LOG_PHY_RX_EOM_GOOD: <= Better Quality
+ * @NVME_LOG_PHY_RX_EOM_BETTER: <= Best Quality, >= Good Quality
+ * @NVME_LOG_PHY_RX_EOM_BEST: >= Better Quality
+ */
+enum nvme_log_phy_rx_eom_quality {
+ NVME_LOG_PHY_RX_EOM_GOOD = 0,
+ NVME_LOG_PHY_RX_EOM_BETTER = 1,
+ NVME_LOG_PHY_RX_EOM_BEST = 2,
+};
+
+/**
* enum nvme_pevent_log_action - Persistent Event Log - Action
* @NVME_PEVENT_LOG_READ: Read Log Data
* @NVME_PEVENT_LOG_EST_CTX_AND_READ: Establish Context and Read Log Data