Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Feb 2018 16:21:45 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r328673 - in stable/11: sbin/nvmecontrol sys/dev/nvme
Message-ID:  <201802011621.w11GLjVq013200@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Feb  1 16:21:45 2018
New Revision: 328673
URL: https://svnweb.freebsd.org/changeset/base/328673

Log:
  MFC r308854 (by imp): Print Intel's expanded Temperature log page.

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:20:44 2018	(r328672)
+++ stable/11/sbin/nvmecontrol/logpage.c	Thu Feb  1 16:21:45 2018	(r328673)
@@ -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 size __unused)
 	}
 }
 
+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: stable/11/sys/dev/nvme/nvme.h
==============================================================================
--- stable/11/sys/dev/nvme/nvme.h	Thu Feb  1 16:20:44 2018	(r328672)
+++ stable/11/sys/dev/nvme/nvme.h	Thu Feb  1 16:21:45 2018	(r328673)
@@ -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,
@@ -754,6 +754,19 @@ struct nvme_firmware_page {
 	uint8_t			reserved[7];
 	uint64_t		revision[7]; /* revisions for 7 slots */
 	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



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