On Fri, 23 Oct 1998, Gavin M. Roy wrote:

> Anyone know of a package to get cpu temp from the bios?  my motherboard
> supports this, but I am unaware of a program to us.

There's a bunch of different packages floating around, and they are all
called lm78. Alexander Larsson's package
(http://www.lysator.liu.se/~alla/) has a comparison of several of the
different implementations. I'm using the one by Erik Hendriks, which I got
off of the main beowulf site. Here's the README:

------

Erik Hendriks
[EMAIL PROTECTED]
Notes for release 0.3

This driver was built/tested with Linux 2.0.35,2.1.105

The LM78 driver is a module that will create a directory tree in
/proc/sys/dev for the lm78's monitors.  Note that the "sysctl"
part of the interface (not the /proc part) is untested.

/proc/sys/dev/lm78/limits  The files in this directory hold the
   thresholds to trigger interrupts.  (See note about interrupts below)
/proc/sys/dev/lm78/status  The files in this directory hold the
   current status of the lm78's monitors.
/proc/sys/dev/lm78/control The files in this directory perform
   system control functions like reseting the system.

Fans -----------------------------------------------------------------
/proc/sys/dev/lm78/status/fan[0-2]
/proc/sys/dev/lm78/limits/fan[0-2]
The status files contain a single number which is the RPM that the fan
is running at.  The limits consist of 2 numbers: "<rpm> <divisor>"
where RPM is the speed the fan must go below to trigger an interrupt.
The LM78 measures the period between pulses from the fan tachometer.
A higher divisor allows it measure slower fan speeds.  The possible
divisors are 1,2,4, and 8.  The divisor for fan 3 is hardwired to 2.
These divisors exist to change the range of RPM's that the lm78 can
measure.  Fan speeds are given in RPM and are converted from te LM78's
values using the the formula given in the LM78 datasheet which is:

COUNT = 1350000/(RPM * DIVISOR)
COUNT can range from 0 - 255.

The Chassis Intrusion Flag -------------------------------------------
/proc/sys/dev/lm78/status/chassis

This file will read 1 if the case has been opened.  This flag should
get set if the case is opened while the power is on or off.  Write at
least one byte into this file to reset this flag.  (Not all
motherboards implement this.)

The "reset" file -----------------------------------------------------
/proc/sys/dev/lm78/control/reset

The LM78 has the ability to initiate a hardware reset.  (like hitting
the reset button)  Writing anything (1+ bytes) and it will initiate a
hardware reset.  (This doesn't seem to be wired up on all systems.)

The ADC inputs -------------------------------------------------------
/proc/sys/dev/lm78/status/in[0-6]
/proc/sys/dev/lm78/limits/in[0-6]

These contain voltages from the ADC's.  Voltages reported are in mV.
The limit files contain 2 numbers, the high limit and the low limit.

The "interrupts" file ------------------------------------------------
/proc/sys/dev/lm78/status/interrupts
This file contains string with 1 token for each interrupt that has
been tripped.  For example:
# cat interrupts 
IN0 IN2 IN3 TEMP0 FAN1 IN4 IN6

The interrupt names are:
IN0 IN1 IN2 IN3 IN4 IN5 IN6
TEMP0 TEMP12
FAN0 FAN1 FAN2
CHASSIS
FIFO
SMI_IN
RESRVD

Limit files: Each limit file contains two numbers.  Except for the fan
limits, the first number is the high limit and the second number is
the low limit.

Kernel module parameters:
io=x            Set the base address for the hardware monitor.
                default = 0x290
monitor_type=x  If set, skip detection and assume monitor type X.
                default = 0
                0 = autodetect
                1 = LM78
                2 = LM78-J  (same as LM78, really.)
                3 = Winbond W83781D

The sysctl interface -------------------------------------------------
This interface is untested although I think there's a good chance that
it will work.  You can find the definitions you'll need for user
programs in monitor.h.  Let me know if you successfully use it.

A note about interrupts ----------------------------------------------
According to the data sheets, the LM78 is capable of generating
regular interrupts, NMI's or SMI's.  I wasn't able to generate any of
these with the motherboard that I'm using which is an Intel
Advanced/PR (Providence) aka PR440FX.  There is a register on the LM78
which tells you which interrupts have been generated since last
reading that register.  That's what is used by this driver.

The LM78 polls its monitors in a round-robin fashion.  Polling all
of them takes about 1.5 seconds.  This is the frequency at which stuff
changes in the interrupts file.

A note about the Winbond W83781D -------------------------------------
The temperature sensor code for the second and third sensors is
untested.  The motherboard that I'm using only has one sensor so I
can't check this myself.  Please let me know if these work.  (And send
me bug fixes if they don't :) I'm also going on the assumption that
the BIOS will have initialized the chip somewhat correctly.  The
Winbond chip has lots of extra configuration registers that I don't
support (yet ?).

Reply via email to