From owner-svn-src-stable-11@freebsd.org Thu Feb 1 16:15:04 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3427BEDB143; Thu, 1 Feb 2018 16:15:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB74F74588; Thu, 1 Feb 2018 16:15:03 +0000 (UTC) (envelope-from mav@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D66D1747B; Thu, 1 Feb 2018 16:15:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GF3Nq010526; Thu, 1 Feb 2018 16:15:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GF34V010524; Thu, 1 Feb 2018 16:15:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011615.w11GF34V010524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:15:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328669 - in stable/11: sbin/nvmecontrol sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: sbin/nvmecontrol sys/dev/nvme X-SVN-Commit-Revision: 328669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:15:04 -0000 Author: mav Date: Thu Feb 1 16:15:03 2018 New Revision: 328669 URL: https://svnweb.freebsd.org/changeset/base/328669 Log: MFC r308851 (by imp): Expand the SMART / Health Information Log Page (Page 02) printout based on NVM Express 1.2.1 Standard. Modified: stable/11/sbin/nvmecontrol/logpage.c stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 16:13:28 2018 (r328668) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 16:15:03 2018 (r328669) @@ -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 size __unused) 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 size __unused) 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 size __unused) 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: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:13:28 2018 (r328668) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:15:03 2018 (r328669) @@ -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 {