Date: Sat, 19 Nov 2016 17:12:49 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308851 - in head: sbin/nvmecontrol sys/dev/nvme Message-ID: <201611191712.uAJHCn7l082708@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Sat Nov 19 17:12:49 2016 New Revision: 308851 URL: https://svnweb.freebsd.org/changeset/base/308851 Log: Expand the SMART / Health Information Log Page (Page 02) printout based on NVM Express 1.2.1 Standard. Sponsored by: Netflix, Inc Modified: head/sbin/nvmecontrol/logpage.c head/sys/dev/nvme/nvme.h Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:12:44 2016 (r308850) +++ head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:12:49 2016 (r308851) @@ -162,10 +162,18 @@ print_log_error(void *buf, uint32_t size } static void +print_temp(uint16_t t) +{ + printf("%u K, %2.2f C, %3.2f F\n", t, (float)t - 273.15, (float)t * 9 / 5 - 459.67); +} + + +static void print_log_health(void *buf, uint32_t size __unused) { struct nvme_health_information_page *health = buf; char cbuf[UINT128_DIG + 1]; + int i; printf("SMART/Health Information Log\n"); printf("============================\n"); @@ -182,10 +190,8 @@ print_log_health(void *buf, uint32_t siz health->critical_warning.bits.read_only); printf(" Volatile memory backup: %d\n", health->critical_warning.bits.volatile_memory_backup); - printf("Temperature: %u K, %2.2f C, %3.2f F\n", - health->temperature, - (float)health->temperature - (float)273.15, - ((float)health->temperature * (float)9/5) - (float)459.67); + printf("Temperature: "); + print_temp(health->temperature); printf("Available spare: %u\n", health->available_spare); printf("Available spare threshold: %u\n", @@ -193,9 +199,9 @@ print_log_health(void *buf, uint32_t siz printf("Percentage used: %u\n", health->percentage_used); - printf("Data units (512,000 byte) read: %s\n", + printf("Data units (512,000 byte) read: %s\n", uint128_to_str(to128(health->data_units_read), cbuf, sizeof(cbuf))); - printf("Data units (512,000 byte) written: %s\n", + printf("Data units written: %s\n", uint128_to_str(to128(health->data_units_written), cbuf, sizeof(cbuf))); printf("Host read commands: %s\n", uint128_to_str(to128(health->host_read_commands), cbuf, sizeof(cbuf))); @@ -213,6 +219,15 @@ print_log_health(void *buf, uint32_t siz uint128_to_str(to128(health->media_errors), cbuf, sizeof(cbuf))); printf("No. error info log entries: %s\n", uint128_to_str(to128(health->num_error_info_log_entries), cbuf, sizeof(cbuf))); + + printf("Warning Temp Composite Time: %d\n", health->warning_temp_time); + printf("Error Temp Composite Time: %d\n", health->error_temp_time); + for (i = 0; i < 7; i++) { + if (health->temp_sensor[i] == 0) + continue; + printf("Temperature Sensor %d: ", i + 1); + print_temp(health->temp_sensor[i]); + } } static void Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sat Nov 19 17:12:44 2016 (r308850) +++ head/sys/dev/nvme/nvme.h Sat Nov 19 17:12:49 2016 (r308851) @@ -724,8 +724,11 @@ struct nvme_health_information_page { uint64_t unsafe_shutdowns[2]; uint64_t media_errors[2]; uint64_t num_error_info_log_entries[2]; + uint32_t warning_temp_time; + uint32_t error_temp_time; + uint16_t temp_sensor[8]; - uint8_t reserved2[320]; + uint8_t reserved2[296]; } __packed __aligned(4); struct nvme_firmware_page {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611191712.uAJHCn7l082708>