From owner-svn-src-head@freebsd.org Sat Nov 19 17:15:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B243C4B354; Sat, 19 Nov 2016 17:15:32 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CD8365BDE; Sat, 19 Nov 2016 17:12:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJHCncG082710; Sat, 19 Nov 2016 17:12:49 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHCn7l082708; Sat, 19 Nov 2016 17:12:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611191712.uAJHCn7l082708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 19 Nov 2016 17:12:49 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Nov 2016 17:15:32 -0000 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 {