From owner-svn-src-all@freebsd.org Sat Nov 19 17:16:31 2016 Return-Path: Delivered-To: svn-src-all@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 02356C4B436; Sat, 19 Nov 2016 17:16:31 +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 963DA65D70; Sat, 19 Nov 2016 17:13:04 +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 uAJHD3O8082874; Sat, 19 Nov 2016 17:13:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHD3uG082872; Sat, 19 Nov 2016 17:13:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611191713.uAJHD3uG082872@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:13:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308854 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Nov 2016 17:16:31 -0000 Author: imp Date: Sat Nov 19 17:13:03 2016 New Revision: 308854 URL: https://svnweb.freebsd.org/changeset/base/308854 Log: Print Intel's expanded Temperature log page. 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:58 2016 (r308853) +++ head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:13:03 2016 (r308854) @@ -100,7 +100,7 @@ get_log_buffer(uint32_t size) } void -read_logpage(int fd, uint8_t log_page, int nsid, void *payload, +read_logpage(int fd, uint8_t log_page, int nsid, void *payload, uint32_t payload_size) { struct nvme_pt_command pt; @@ -259,6 +259,35 @@ print_log_firmware(void *buf, uint32_t s } } +static void +print_intel_temp_stats(void *buf, uint32_t size __unused) +{ + struct intel_log_temp_stats *temp = buf; + + printf("Intel Temperature Log\n"); + printf("=====================\n"); + + printf("Current: "); + print_temp(temp->current); + printf("Overtemp Last Flags %#jx\n", (uintmax_t)temp->overtemp_flag_last); + printf("Overtemp Lifetime Flags %#jx\n", (uintmax_t)temp->overtemp_flag_life); + printf("Max Temperature "); + print_temp(temp->max_temp); + printf("Min Temperature "); + print_temp(temp->min_temp); + printf("Max Operating Temperature "); + print_temp(temp->max_oper_temp); + printf("Min Operating Temperature "); + print_temp(temp->min_oper_temp); + printf("Estimated Temperature Offset: %ju C/K\n", (uintmax_t)temp->est_offset); +} + +/* + * Table of log page printer / sizing. + * + * This includes Intel specific pages that are widely implemented. Not + * sure how best to switch between different vendors. + */ static struct logpage_function { uint8_t log_page; print_fn_t print_fn; @@ -270,6 +299,8 @@ static struct logpage_function { sizeof(struct nvme_health_information_page)}, {NVME_LOG_FIRMWARE_SLOT, print_log_firmware, sizeof(struct nvme_firmware_page)}, + {INTEL_LOG_TEMP_STATS, print_intel_temp_stats, + sizeof(struct intel_log_temp_stats)}, {0, NULL, 0}, }; Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sat Nov 19 17:12:58 2016 (r308853) +++ head/sys/dev/nvme/nvme.h Sat Nov 19 17:13:03 2016 (r308854) @@ -670,7 +670,7 @@ enum nvme_log_page { NVME_LOG_RES_NOTIFICATION = 0x80, /* 0xC0-0xFF - vendor specific */ /* - * The following are Intel Specific log pages, but they seem to + * The following are Intel Specific log pages, but they seem to * be widely implemented. */ INTEL_LOG_READ_LAT_LOG = 0xc1, @@ -756,6 +756,19 @@ struct nvme_firmware_page { uint8_t reserved2[448]; } __packed __aligned(4); +struct intel_log_temp_stats +{ + uint64_t current; + uint64_t overtemp_flag_last; + uint64_t overtemp_flag_life; + uint64_t max_temp; + uint64_t min_temp; + uint64_t _rsvd[5]; + uint64_t max_oper_temp; + uint64_t min_oper_temp; + uint64_t est_offset; +} __packed __aligned(4); + #define NVME_TEST_MAX_THREADS 128 struct nvme_io_test {