Author: eadler
Date: Thu Mar  1 05:54:39 2018
New Revision: 330177
URL: https://svnweb.freebsd.org/changeset/base/330177

Log:
  MFC r313417:
  
  [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.

Modified:
  stable/11/sys/dev/iwm/if_iwm.c
  stable/11/sys/dev/iwm/if_iwm_debug.h
  stable/11/sys/dev/iwm/if_iwmreg.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/iwm/if_iwm.c
==============================================================================
--- stable/11/sys/dev/iwm/if_iwm.c      Thu Mar  1 05:53:55 2018        
(r330176)
+++ stable/11/sys/dev/iwm/if_iwm.c      Thu Mar  1 05:54:39 2018        
(r330177)
@@ -5425,8 +5425,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: stable/11/sys/dev/iwm/if_iwm_debug.h
==============================================================================
--- stable/11/sys/dev/iwm/if_iwm_debug.h        Thu Mar  1 05:53:55 2018        
(r330176)
+++ stable/11/sys/dev/iwm/if_iwm_debug.h        Thu Mar  1 05:54:39 2018        
(r330177)
@@ -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: stable/11/sys/dev/iwm/if_iwmreg.h
==============================================================================
--- stable/11/sys/dev/iwm/if_iwmreg.h   Thu Mar  1 05:53:55 2018        
(r330176)
+++ stable/11/sys/dev/iwm/if_iwmreg.h   Thu Mar  1 05:54:39 2018        
(r330177)
@@ -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
  */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to