case NVME_FEAT_FID_ENDURANCE_EVT_CFG: return "Enduarance Event Group Configuration";
case NVME_FEAT_FID_IOCS_PROFILE: return "I/O Command Set Profile";
case NVME_FEAT_FID_SPINUP_CONTROL: return "Spinup Control";
+ case NVME_FEAT_FID_CTRL_METADATA: return "Controller Metadata";
+ case NVME_FEAT_FID_NS_METADATA: return "Namespace Metadata";
case NVME_FEAT_FID_SW_PROGRESS: return "Software Progress";
case NVME_FEAT_FID_HOST_ID: return "Host Identifier";
case NVME_FEAT_FID_RESV_MASK: return "Reservation Notification Mask";
printf("\tDTWIN Time Threshold :%"PRIu64"\n", le64_to_cpu(plmcfg->dtwintt));
}
+static char *nvme_show_host_metadata_type_to_string(enum nvme_features_id fid,
+ __u8 type)
+{
+ switch (fid) {
+ case NVME_FEAT_FID_CTRL_METADATA:
+ switch (type) {
+ case NVME_CTRL_METADATA_OS_CTRL_NAME:
+ return "Operating System Controller Name";
+ case NVME_CTRL_METADATA_OS_DRIVER_NAME:
+ return "Operating System Driver Name";
+ case NVME_CTRL_METADATA_OS_DRIVER_VER:
+ return "Operating System Driver Version";
+ case NVME_CTRL_METADATA_PRE_BOOT_CTRL_NAME:
+ return "Pre-boot Controller Name";
+ case NVME_CTRL_METADATA_PRE_BOOT_DRIVER_NAME:
+ return "Pre-boot Driver Name";
+ case NVME_CTRL_METADATA_PRE_BOOT_DRIVER_VER:
+ return "Pre-boot Driver Version";
+ case NVME_CTRL_METADATA_SYS_PROC_MODEL:
+ return "System Processor Model";
+ case NVME_CTRL_METADATA_CHIPSET_DRV_NAME:
+ return "Chipset Driver Name";
+ case NVME_CTRL_METADATA_CHIPSET_DRV_VERSION:
+ return "Chipset Driver Version";
+ case NVME_CTRL_METADATA_OS_NAME_AND_BUILD:
+ return "Operating System Name and Build";
+ case NVME_CTRL_METADATA_SYS_PROD_NAME:
+ return "System Product Name";
+ case NVME_CTRL_METADATA_FIRMWARE_VERSION:
+ return "Firmware Version";
+ case NVME_CTRL_METADATA_OS_DRIVER_FILENAME:
+ return "Operating System Driver Filename";
+ case NVME_CTRL_METADATA_DISPLAY_DRV_NAME:
+ return "Display Driver Name";
+ case NVME_CTRL_METADATA_DISPLAY_DRV_VERSION:
+ return "Display Driver Version";
+ case NVME_CTRL_METADATA_HOST_DET_FAIL_REC:
+ return "Host-Determined Failure Record";
+ default:
+ return "Unknown Controller Type";
+ }
+ case NVME_FEAT_FID_NS_METADATA:
+ switch (type) {
+ case NVME_NS_METADATA_OS_NS_NAME:
+ return "Operating System Namespace Name";
+ case NVME_NS_METADATA_PRE_BOOT_NS_NAME:
+ return "Pre-boot Namespace Name";
+ case NVME_NS_METADATA_OS_NS_QUAL_1:
+ return "Operating System Namespace Name Qualifier 1";
+ case NVME_NS_METADATA_OS_NS_QUAL_2:
+ return "Operating System Namespace Name Qualifier 2";
+ default:
+ return "Unknown Namespace Type";
+ }
+ default:
+ return "Unknown Feature";
+ }
+}
+
+static void nvme_show_host_metadata(enum nvme_features_id fid,
+ struct nvme_host_metadata *data)
+{
+ struct nvme_metadata_element_desc *desc = &data->descs[0];
+ int i;
+ char val[4096];
+ __u16 len;
+
+ printf("\tNum Metadata Element Descriptors: %d\n", data->ndesc);
+ for (i = 0; i < data->ndesc; i++) {
+ len = le16_to_cpu(desc->len);
+ strncpy(val, (char *)desc->val, min(sizeof(val) - 1, len));
+
+ printf("\tElement[%-3d]:\n", i);
+ printf("\t\tType : 0x%02x (%s)\n", desc->type,
+ nvme_show_host_metadata_type_to_string(fid, desc->type));
+ printf("\t\tRevision : %d\n", desc->rev);
+ printf("\t\tLength : %d\n", len);
+ printf("\t\tValue : %s\n", val);
+
+ desc = (struct nvme_metadata_element_desc *)
+ &desc->val[desc->len];
+ }
+}
+
void nvme_feature_show_fields(enum nvme_features_id fid, unsigned int result, unsigned char *buf)
{
__u8 field;
case NVME_FEAT_FID_SPINUP_CONTROL:
printf("\tSpinup control feature Enabled: %s\n", (result & 1) ? "True" : "False");
break;
+ case NVME_FEAT_FID_CTRL_METADATA:
+ case NVME_FEAT_FID_NS_METADATA:
+ nvme_show_host_metadata(fid, (struct nvme_host_metadata *)buf);
+ break;
case NVME_FEAT_FID_SW_PROGRESS:
printf("\tPre-boot Software Load Count (PBSLC): %u\n", result & 0x000000ff);
break;