]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli: add thermal management fields for smart-log
authorGuan Junxiong <guanjunxiong@huawei.com>
Wed, 21 Jun 2017 05:09:22 +0000 (13:09 +0800)
committerKeith Busch <keith.busch@intel.com>
Mon, 26 Jun 2017 20:01:20 +0000 (16:01 -0400)
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 <guanjunxiong@huawei.com>
linux/nvme.h
nvme-print.c

index d1a322b80249d6abfe266d73a1be29980df4342d..fd58a364befcd04b8888daa51b06b8624e795cc7 100644 (file)
@@ -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 {
index dca4a19df5bd18661d9eadf444c498f1c621958c..6005e065c8740be04f138606537b9d08b16e4ea0 100644 (file)
@@ -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");