/* $Id: k10sensor.h 743 2012-06-18 06:10:35Z elkner $ */
#ifndef K10SENSOR_H
#define K10SENSOR_H
#ifdef _KERNEL
#else
#include <pciaccess.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#else
#endif
/*
* Extracts bits from index h (high, inclusive) to l (low, inclusive) from
* u, which must be an unsigned integer.
*/
/* helper for cat_range_map */
struct cat_range {
/* the first xfamilyModel of the next generation, which doesn't belong to
* this category */
/* the commonly use category name */
const char *name;
};
{ 0x10, "0Fh" },
{ 0x20, "10h" },
{ 0x30, "11h" },
{ 0x60, "12h/14h" },
{ 0x70, "15h" },
{ 0xfff + 1, "unknown" } /* max. possible val for xfamilyModel is 0xfff */
};
/* temperature limit info. Only usable, if the TC_ENABLED flag is set */
typedef struct tc_limit {
/* state flags: see TC_*. */
/* T control max. [1/1000 C]. INT32_MAX => n/a */
/* T_crit - T_hysteresis [1/1000 C]. INT32_MAX => n/a */
} tc_limit_t;
* Static means, once fully populated, there is no need to update its members
* as long as it is associated with the same CPU.
* eax and ebx refer to the corresponding values of the so named registers
* after a CPUID standard function call with eax=1. */
typedef struct cpu_vars {
/* the NodeId or CPU instance number */
/* BITX eax[27:16] */
/* BITX eax[7:0] */
/* the index for the category_range_map */
/* CPUID ebx (we are interested in [31:27,15:0],only) */
/* silicon version of the chip. Usually populated by getSilicon() */
/* HTC_* flags */
/* if != 0, the relevant erratum # wrt. inaccurate temperature */
/* HTC, STC limits. NOTE: Can usually be modified by special software. */
/* diode offset, which needs to be substracted from T control [1/1000 C]
* @see AMD Functional Data Sheet */
/* t case max. [1/1000 C]. INT32_MAX => n/a */
} cpu_vars_t;
/** Populate the index v->catIdx for the category_range_map based on
* v->xfamilyModel */
void fillCategoryIndex(cpu_vars_t *v);
/** Populate v->revision based on v->xfamilyModel and v->modelStepping */
void fillSiliconRevision(cpu_vars_t *v);
/** Checks, whether an "inaccurate temperature" erratum applies based on
* v->{xfamilyModel, modelStepping, ebx} */
void fillErratum(cpu_vars_t *v);
/** Populate v->{flags[HTC_THERMTRIP], t_case_max, diode_offset} from the
* Thermtrip register based on v->{xfamilyModel, modelStepping, revision, ebx}
*/
/** Populate v->flags[HTC_CAPABLE,LHTC_CAPABLE,DC_0Fh] from the
* Northbridge Capabilities register based on v->{pci_hdl, xfamilyModel} */
/** Populate v->limits[HTC] from the Hardware Thermal Control register based on
* v->{xfamilyModel, modelStepping, revision, ebx} */
/** Populate v->limits[STC] from the Software or Local Hardware Thermal Control
* register based on v->{xfamilyModel, flags[HTC_CAPABLE,LHTC_CAPABLE]} */
/** Get the current control temperature based on
* v->{xfamilyModel, revision}. Returns 0 on error or if n/a */
/** Append v data as a human readable string to buf */
/** Append T control value(s) as a human readable string to buf */
#ifdef __cplusplus
}
#endif
#endif /* K10TEMP_H */