NVME_SQ_PRIO_HIGH = (1 << 1),
NVME_SQ_PRIO_MEDIUM = (2 << 1),
NVME_SQ_PRIO_LOW = (3 << 1),
+ NVME_LOG_ERROR = 0x01,
+ NVME_LOG_SMART = 0x02,
+ NVME_LOG_FW_SLOT = 0x03,
+ NVME_LOG_CHANGED_NS = 0x04,
+ NVME_LOG_CMD_EFFECTS = 0x05,
+ NVME_LOG_DEVICE_SELF_TEST = 0x06,
+ NVME_LOG_TELEMETRY_HOST = 0x07,
+ NVME_LOG_TELEMETRY_CTRL = 0x08,
+ NVME_LOG_ENDURANCE_GROUP = 0x09,
+ NVME_LOG_ANA = 0x0c,
+ NVME_LOG_DISC = 0x70,
+ NVME_LOG_RESERVATION = 0x80,
+ NVME_LOG_SANITIZE = 0x81,
+ NVME_LOG_ZONE_CHANGED_LIST = 0xbf,
+ NVME_FWACT_REPL = (0 << 3),
+ NVME_FWACT_REPL_ACTV = (1 << 3),
+ NVME_FWACT_ACTV = (2 << 3),
+};
+
+enum nvme_feat {
+ NVME_FEAT_NONE = 0x0,
NVME_FEAT_ARBITRATION = 0x01,
NVME_FEAT_POWER_MGMT = 0x02,
NVME_FEAT_LBA_RANGE = 0x03,
NVME_FEAT_RESV_MASK = 0x82,
NVME_FEAT_RESV_PERSIST = 0x83,
NVME_FEAT_WRITE_PROTECT = 0x84,
- NVME_LOG_ERROR = 0x01,
- NVME_LOG_SMART = 0x02,
- NVME_LOG_FW_SLOT = 0x03,
- NVME_LOG_CHANGED_NS = 0x04,
- NVME_LOG_CMD_EFFECTS = 0x05,
- NVME_LOG_DEVICE_SELF_TEST = 0x06,
- NVME_LOG_TELEMETRY_HOST = 0x07,
- NVME_LOG_TELEMETRY_CTRL = 0x08,
- NVME_LOG_ENDURANCE_GROUP = 0x09,
- NVME_LOG_ANA = 0x0c,
- NVME_LOG_DISC = 0x70,
- NVME_LOG_RESERVATION = 0x80,
- NVME_LOG_SANITIZE = 0x81,
- NVME_LOG_ZONE_CHANGED_LIST = 0xbf,
- NVME_FWACT_REPL = (0 << 3),
- NVME_FWACT_REPL_ACTV = (1 << 3),
- NVME_FWACT_ACTV = (2 << 3),
-};
+} __attribute__ ((__packed__));
enum {
NVME_NO_LOG_LSP = 0x0,
le32_to_cpu(sanitize->est_crypto_erase_time_with_no_deallocate));
}
-const char *nvme_feature_to_string(int feature)
+const char *nvme_feature_to_string(enum nvme_feat feature)
{
switch (feature) {
+ case NVME_FEAT_NONE: return "None";
case NVME_FEAT_ARBITRATION: return "Arbitration";
case NVME_FEAT_POWER_MGMT: return "Power Management";
case NVME_FEAT_LBA_RANGE: return "LBA Range Type";
case NVME_FEAT_HCTM: return "Host Controlled Thermal Management";
case NVME_FEAT_HOST_BEHAVIOR: return "Host Behavior";
case NVME_FEAT_SANITIZE: return "Sanitize";
- default: return "Unknown";
}
+ /*
+ * We don't use the "default:" statement to let the compiler warning if
+ * some values of the enum nvme_feat are missing in the switch().
+ * The following return is acting as the default: statement.
+ */
+ return "Unknown";
}
const char *nvme_register_to_string(int reg)
printf("\tDTWIN Time Threshold :%"PRIu64"\n", le64_to_cpu(plmcfg->dtwin_time_thresh));
}
-void nvme_feature_show_fields(__u32 fid, unsigned int result, unsigned char *buf)
+void nvme_feature_show_fields(enum nvme_feat fid, unsigned int result, unsigned char *buf)
{
__u8 field;
uint64_t ull;
case NVME_FEAT_HOST_BEHAVIOR:
printf("\tHost Behavior Support: %s\n", (buf[0] & 0x1) ? "True" : "False");
break;
+ case NVME_FEAT_NONE:
+ case NVME_FEAT_SANITIZE:
+ case NVME_FEAT_RRL:
+ printf("\t%s: to be implemented\n", nvme_feature_to_string(fid));
+ break;
}
}
enum nvme_print_flags flags);
void nvme_show_id_iocs(struct nvme_id_iocs *iocs);
-void nvme_feature_show_fields(__u32 fid, unsigned int result, unsigned char *buf);
+void nvme_feature_show_fields(enum nvme_feat fid, unsigned int result, unsigned char *buf);
void nvme_directive_show(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __u32 result,
void *buf, __u32 len, enum nvme_print_flags flags);
void nvme_show_select_result(__u32 result);
const char *nvme_status_to_string(__u32 status);
const char *nvme_select_to_string(int sel);
-const char *nvme_feature_to_string(int feature);
+const char *nvme_feature_to_string(enum nvme_feat feature);
const char *nvme_register_to_string(int reg);
#endif