Since power loss signaling function introduced by NVMe 2.1.
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
}
}
+static void print_psd_time(const char *desc, __u8 time, __u8 ts)
+{
+ int width = 12 + strlen(desc);
+ char value[STR_LEN] = { 0 };
+
+ switch (time) {
+ case 0:
+ snprintf(value, sizeof(value), "-");
+ break;
+ case 1 ... 99:
+ snprintf(value, sizeof(value), "%d (unit: %s)", time,
+ nvme_time_scale_to_string(ts));
+ break;
+ default:
+ snprintf(value, sizeof(value), "reserved");
+ break;
+ }
+
+ printf("%*s: %s\n", width, desc, value);
+}
+
static void stdout_id_ctrl_power(struct nvme_id_ctrl *ctrl)
{
int i;
printf("\n active_power_workload:");
print_psd_workload(ctrl->psd[i].apws);
printf("\n");
-
+ print_psd_time("emergency power fail recovery time", ctrl->psd[i].epfrt,
+ ctrl->psd[i].epfr_fqv_ts & 0xf);
+ print_psd_time("forced quiescence vault time", ctrl->psd[i].fqvt,
+ ctrl->psd[i].epfr_fqv_ts >> 4);
+ print_psd_time("emergency power fail vault time", ctrl->psd[i].epfvt,
+ ctrl->psd[i].epfvts & 0xf);
}
}
return "unknown";
}
+const char *nvme_time_scale_to_string(__u8 ts)
+{
+ switch (ts) {
+ case 0:
+ return "1 microsecond";
+ case 1:
+ return "10 microseconds";
+ case 2:
+ return "100 microseconds";
+ case 3:
+ return "1 millisecond";
+ case 4:
+ return "10 milliseconds";
+ case 5:
+ return "100 milliseconds";
+ case 6:
+ return "1 second";
+ case 7:
+ return "10 seconds";
+ case 8:
+ return "100 seconds";
+ case 9:
+ return "1,000 seconds";
+ case 0xa:
+ return "10,000 seconds";
+ case 0xb:
+ return "100,000 seconds";
+ case 0xc:
+ return "1,000,000 seconds";
+ default:
+ break;
+ }
+
+ return "Reserved";
+}
+
void nvme_feature_show(enum nvme_features_id fid, int sel, unsigned int result)
{
nvme_print(show_feature, NORMAL, fid, sel, result);
const char *nvme_pel_rci_rcpit_to_string(enum nvme_pel_rci_rcpit rcpit);
const char *nvme_pel_ehai_pit_to_string(enum nvme_pel_ehai_pit pit);
const char *nvme_ssi_state_to_string(__u8 state);
+const char *nvme_time_scale_to_string(__u8 ts);
void nvme_dev_full_path(nvme_ns_t n, char *path, size_t len);
void nvme_generic_full_path(nvme_ns_t n, char *path, size_t len);