Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Feb 2017 06:56:28 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313417 - head/sys/dev/iwm
Message-ID:  <201702080656.v186uS5i013445@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Wed Feb  8 06:56:28 2017
New Revision: 313417
URL: https://svnweb.freebsd.org/changeset/base/313417

Log:
  [iwm] Very basic DTS thermal sensor support (prints temp as debug msg).
  
  * Adds IWM_DEBUG_TEMP debug message type, for printing messages related
    to temperature sensors and thermal/TDP infos.
  
  * The firmware regularly sends us DTS measurement notifications, so just
    print the temperature value as a debugging message.
  
  (Adrian's addition):
  
  * Eventually this can be used by the driver to limit transmit rate / power to
    try and do some thermal throttling.
  
  Obtained from:	DragonflyBSD commit efb7d4eb5c3140889a8880e12fd83c7bbfd0059d

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_debug.h
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==============================================================================
--- head/sys/dev/iwm/if_iwm.c	Wed Feb  8 06:54:08 2017	(r313416)
+++ head/sys/dev/iwm/if_iwm.c	Wed Feb  8 06:56:28 2017	(r313417)
@@ -5451,8 +5451,20 @@ iwm_notif_intr(struct iwm_softc *sc)
 			    notif->source_id, sc->sc_fw_mcc);
 			break; }
 
-		case IWM_DTS_MEASUREMENT_NOTIFICATION:
+		case IWM_DTS_MEASUREMENT_NOTIFICATION: {
+			struct iwm_dts_measurement_notif_v1 *notif;
+
+			if (iwm_rx_packet_payload_len(pkt) < sizeof(*notif)) {
+				device_printf(sc->sc_dev,
+				    "Invalid DTS_MEASUREMENT_NOTIFICATION\n");
+				break;
+			}
+			notif = (void *)pkt->data;
+			IWM_DPRINTF(sc, IWM_DEBUG_TEMP,
+			    "IWM_DTS_MEASUREMENT_NOTIFICATION - %d\n",
+			    notif->temp);
 			break;
+		}
 
 		case IWM_PHY_CONFIGURATION_CMD:
 		case IWM_TX_ANT_CONFIGURATION_CMD:

Modified: head/sys/dev/iwm/if_iwm_debug.h
==============================================================================
--- head/sys/dev/iwm/if_iwm_debug.h	Wed Feb  8 06:54:08 2017	(r313416)
+++ head/sys/dev/iwm/if_iwm_debug.h	Wed Feb  8 06:56:28 2017	(r313417)
@@ -41,6 +41,7 @@ enum {
 	IWM_DEBUG_FIRMWARE_TLV	= 0x00020000,	/* Firmware TLV parsing */
 	IWM_DEBUG_TRANS		= 0x00040000,	/* Transport layer (eg PCIe) */
 	IWM_DEBUG_EEPROM	= 0x00080000,	/* EEPROM/channel information */
+	IWM_DEBUG_TEMP		= 0x00100000,	/* Thermal Sensor handling */
 	IWM_DEBUG_REGISTER	= 0x20000000,	/* print chipset register */
 	IWM_DEBUG_TRACE		= 0x40000000,	/* Print begin and start driver function */
 	IWM_DEBUG_FATAL		= 0x80000000,	/* fatal errors */

Modified: head/sys/dev/iwm/if_iwmreg.h
==============================================================================
--- head/sys/dev/iwm/if_iwmreg.h	Wed Feb  8 06:54:08 2017	(r313416)
+++ head/sys/dev/iwm/if_iwmreg.h	Wed Feb  8 06:56:28 2017	(r313417)
@@ -5978,6 +5978,30 @@ enum iwm_mcc_source {
 	IWM_MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
 };
 
+/**
+ * struct iwm_dts_measurement_notif_v1 - measurements notification
+ *
+ * @temp: the measured temperature
+ * @voltage: the measured voltage
+ */
+struct iwm_dts_measurement_notif_v1 {
+	int32_t temp;
+	int32_t voltage;
+} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_1*/
+
+/**
+ * struct iwm_dts_measurement_notif_v2 - measurements notification
+ *
+ * @temp: the measured temperature
+ * @voltage: the measured voltage
+ * @threshold_idx: the trip index that was crossed
+ */
+struct iwm_dts_measurement_notif_v2 {
+	int32_t temp;
+	int32_t voltage;
+	int32_t threshold_idx;
+} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_2 */
+
 /*
  * Some cherry-picked definitions
  */



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