From: Guan Junxiong Date: Wed, 21 Jun 2017 05:09:22 +0000 (+0800) Subject: nvme-cli: add thermal management fields for smart-log X-Git-Tag: v1.4~43 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=96853a4685c84a2454b900d8a50f11e34e7c9c9e;p=users%2Fsagi%2Fnvme-cli.git nvme-cli: add thermal management fields for smart-log NVMe 1.3 introduce new thermal management temperature related fields into the smart log page. Those fileds include two temperature transition counts and two total time. Signed-off-by: Guan Junxiong --- diff --git a/linux/nvme.h b/linux/nvme.h index d1a322b8..fd58a364 100644 --- a/linux/nvme.h +++ b/linux/nvme.h @@ -328,7 +328,11 @@ struct nvme_smart_log { __le32 warning_temp_time; __le32 critical_comp_time; __le16 temp_sensor[8]; - __u8 rsvd216[296]; + __le32 thm_temp1_trans_count; + __le32 thm_temp2_trans_count; + __le32 thm_temp1_total_time; + __le32 thm_temp2_total_time; + __u8 rsvd232[280]; }; enum { diff --git a/nvme-print.c b/nvme-print.c index dca4a19d..6005e065 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -1023,6 +1023,10 @@ void show_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char printf("Temperature Sensor %d : %d C\n", c + 1, temp - 273); } + printf("Thermal Management T1 Trans Count : %u\n", le32_to_cpu(smart->thm_temp1_trans_count)); + printf("Thermal Management T2 Trans Count : %u\n", le32_to_cpu(smart->thm_temp2_trans_count)); + printf("Thermal Management T1 Total Time : %u\n", le32_to_cpu(smart->thm_temp1_total_time)); + printf("Thermal Management T2 Total Time : %u\n", le32_to_cpu(smart->thm_temp2_total_time)); } char *nvme_feature_to_string(int feature) @@ -1677,6 +1681,14 @@ void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char le32_to_cpu(smart->warning_temp_time)); json_object_add_value_int(root, "critical_comp_time", le32_to_cpu(smart->critical_comp_time)); + json_object_add_value_int(root, "thm_temp1_trans_count", + le32_to_cpu(smart->thm_temp1_trans_count)); + json_object_add_value_int(root, "thm_temp2_trans_count", + le32_to_cpu(smart->thm_temp2_trans_count)); + json_object_add_value_int(root, "thm_temp1_total_time", + le32_to_cpu(smart->thm_temp1_total_time)); + json_object_add_value_int(root, "thm_temp2_total_time", + le32_to_cpu(smart->thm_temp2_total_time)); json_print_object(root, NULL); printf("\n");