Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Nov 2016 17:13:03 +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: r308854 - in head: sbin/nvmecontrol sys/dev/nvme
Message-ID:  <201611191713.uAJHD3uG082872@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611191713.uAJHD3uG082872>