tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: sysmon_envsys - Setting sensor on-chip thresholds from userland
Paul Goyette wrote:
I'm working on a driver for On-DIMM temperature sensors for memory
modules, similar to OpenBSD's sdtemp but with sysmon_envsys(9) support.
Great!
These sensors have on-chip limit registers for a Lower, Uppper, and
Critical boundary setting, and have on-chip comparison and flag-bit
setting when the actual temp transitions from one zone to another.
(The sensor chips also have an event output pin, which might be able to
generate an I2C interrupt, but that's a question for another day!)
I've been muddling through the sysmon_envsys stuff, and I'm having
difficulty understanding how a userland program might provide some
threshold values to the driver. Would it be correct (or at least
acceptable) for the driver's sensor refresh routine to grovel through
the sensor's event queue to find the values associated with certain
monitor types (ie, ENVSYS_FMONWARNUNDER, WARNOVER, and CRITOVER)?
Yes, that's right.
I'm also a bit more confused about all this, since the example in the
sysmon_envsys(9) man page seems to use a hard-wired threshold for
setting the sensor state, rather than using a limit from userland.
Any guidance in this area would be greatly appreciated.
When I wrote the amdtemp(4) driver, I used sys/dev/acpi/aiboost.c
as example code.
You in turn may use amdtemp(4) and aiboost(4) as example code :)
In your softc you need these two members:
struct sysmon_envsys *sc_sme;
envsys_data_t *sc_sensor;
In the attach routine, run the envsys setup.
The refresh routine is of type
void (*refresh)(struct sysmon_envsys *sme, envsys_data_t *edata);
In the refresh routine read out the sensor data fill out edata.
If all is done right, envstat will show your driver and
the sensor data your driver provides.
Christoph
Home |
Main Index |
Thread Index |
Old Index