]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
ocp: Fix timestamp displayed by fw-activate-history command
authorjeff-lien-wdc <jeff.lien@wdc.com>
Mon, 4 Mar 2024 20:31:26 +0000 (14:31 -0600)
committerDaniel Wagner <wagi@monom.org>
Tue, 5 Mar 2024 09:18:25 +0000 (10:18 +0100)
The current code is displaying all 8 bytes of the timestamp
field for the timestamp.  The timestamp value is only in
the first 6 bytes. The 7th byte contains the origin and
synch fields and the 8th byte is reserved.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
plugins/ocp/ocp-fw-activation-history.c

index ad96c6be6fce320da7cb2108adbe742b5915bc6f..9f1f7f5b7a39f08a12ba8c55c570f850353b0d3b 100644 (file)
@@ -66,7 +66,7 @@ static void ocp_fw_activation_history_normal(const struct fw_activation_history
                printf("      %-22s%d\n", "activation count:",
                       le16_to_cpu(entry->activation_count));
                printf("      %-22s%"PRIu64"\n", "timestamp:",
-                      le64_to_cpu(entry->timestamp));
+                               (0x0000FFFFFFFFFFFF & le64_to_cpu(entry->timestamp)));
                printf("      %-22s%"PRIu64"\n", "power cycle count:",
                       le64_to_cpu(entry->power_cycle_count));
                printf("      %-22s%.*s\n", "previous firmware:", (int)sizeof(entry->previous_fw),
@@ -106,7 +106,7 @@ static void ocp_fw_activation_history_json(const struct fw_activation_history *f
                json_object_add_value_uint(entry_obj, "activation count",
                                           le16_to_cpu(entry->activation_count));
                json_object_add_value_uint64(entry_obj, "timestamp",
-                                            le64_to_cpu(entry->timestamp));
+                               (0x0000FFFFFFFFFFFF & le64_to_cpu(entry->timestamp)));
                json_object_add_value_uint(entry_obj, "power cycle count",
                                           le64_to_cpu(entry->power_cycle_count));