From 4613ed760c25cadfc84c738082ca8f237cc42ab2 Mon Sep 17 00:00:00 2001 From: GangCao Date: Sat, 15 Apr 2017 22:03:07 -0400 Subject: [PATCH] nvme: add the temperature related fields for the health info page Change-Id: I5231412d122615a92566e81a8712d83577c7327e Signed-off-by: GangCao --- examples/nvme/identify/identify.c | 10 ++++++++++ include/spdk/nvme_spec.h | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/examples/nvme/identify/identify.c b/examples/nvme/identify/identify.c index 6bdb086e07..3a2901567a 100644 --- a/examples/nvme/identify/identify.c +++ b/examples/nvme/identify/identify.c @@ -676,6 +676,7 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport features[SPDK_NVME_FEAT_TEMPERATURE_THRESHOLD].result, features[SPDK_NVME_FEAT_TEMPERATURE_THRESHOLD].result - 273); printf("Available Spare: %u%%\n", health_page.available_spare); + printf("Available Spare Threshold: %u%%\n", health_page.available_spare_threshold); printf("Life Percentage Used: %u%%\n", health_page.percentage_used); printf("Data Units Read: "); print_uint128_dec(health_page.data_units_read); @@ -707,6 +708,15 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport printf("Lifetime Error Log Entries: "); print_uint128_dec(health_page.num_error_info_log_entries); printf("\n"); + printf("Warning Temperature Time: %u minutes\n", health_page.warning_temp_time); + printf("Critical Temperature Time: %u minutes\n", health_page.critical_temp_time); + for (i = 0; i < 8; i++) { + if (health_page.temp_sensor[i] != 0) { + printf("Temperature Sensor %d: %u Kelvin (%u Celsius)\n", + i + 1, health_page.temp_sensor[i], + health_page.temp_sensor[i] - 273); + } + } printf("\n"); } diff --git a/include/spdk/nvme_spec.h b/include/spdk/nvme_spec.h index f5631d243f..b80353ad1a 100644 --- a/include/spdk/nvme_spec.h +++ b/include/spdk/nvme_spec.h @@ -1409,8 +1409,12 @@ struct __attribute__((packed)) spdk_nvme_health_information_page { uint64_t unsafe_shutdowns[2]; uint64_t media_errors[2]; uint64_t num_error_info_log_entries[2]; + /* Controller temperature related. */ + uint32_t warning_temp_time; + uint32_t critical_temp_time; + uint16_t temp_sensor[8]; - uint8_t reserved2[320]; + uint8_t reserved2[296]; }; SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_health_information_page) == 512, "Incorrect size");