/* $Id: k10s_kstats.h 755 2012-06-25 06:15:47Z elkner $ */
#ifndef K10S_KSTATS_H
#define K10S_KSTATS_H
#include <sys/kstat.h>
#include "k10sensor.h"
#ifdef __cplusplus
extern "C" {
#endif
#define K10S_KSTAT_CLASS "t_sensor"
#define K10S_KSTAT_INFO_NAME "chipInfo"
#define K10S_KSTAT_DATA_NAME_PREFIX "cpu "
#define K10S_KSTAT_DATA_VALUE_NAME "Temperature [C/1000]"
/* named index into (k10sensor_t.ksp_info)->ks_data */
typedef enum {
KS_SILICON_REV = 0, /* CPU silicon revision */
KS_FAMILY, /* CPU family */
KS_ERRATUM, /* Erratum # wrt. inaccurate temp vals. 0 == none */
KS_THERMTRIP, /* Thermtrip enabled ? */
KS_HTC_CAPABLE, /* HTC capable ? */
KS_T_CASE_MAX, /* T case max, INT32_MAX => n/a */
KS_T_OFFSET, /* T diode offset [1/1000 C] */
KS_HTC_ENABLED, /* HTC enabled ? */
KS_HTC_SLEWED, /* HTC slew-controlled ? */
KS_HTC_T_CRIT, /* T HTC Limit [1/1000 C], INT32_MAX => n/a */
KS_HTC_T_HYST, /* T HTC hysteresis [1/1000 C], INT32_MAX => n/a */
KS_ATC_ENABLED, /* Alternative Thermal Control (STC | LHTC) enabled ? */
KS_ATC_SLEWED, /* ATC slew-controlled ? */
KS_ATC_T_CRIT, /* T ATC Limit [1/1000 C], INT32_MAX => n/a */
KS_ATC_T_HYST /* T ATC hysteresis [1/1000 C], INT32_MAX => n/a */
} k10s_stats_offset_t;
#ifdef _KERNEL
/* per instance data */
typedef struct k10sensor {
/* info for the device this driver instance is attached to */
dev_info_t *dip;
/* handle to the related PCI device */
PCI_HDL pci_hdl;
/* collection of CPU chip related parameters, which are usually required to
* obtain other chip related infos and have mostly a static nature */
cpu_vars_t v[1];
/* cpu_vars_t as kstats */
kstat_t *ksp_info;
/* temperature values as kstats */
kstat_t *ksp_data[2];
kmutex_t lock[1];
} k10sensor_t;
void k10s_kstat_create(k10sensor_t *);
void k10s_kstat_destroy(k10sensor_t *);
#endif
#ifdef __cplusplus
}
#endif
#endif