*********************************************************
    Mother Board Monitor Program for X Window System

        XMBmon ver.1.05

    for FreeBSD (Linux with ISA IO port access).
 *********************************************************

  Recently there are a lot of mother boards available, which have
functionalities to monitor the CPU temperature and the frequency
of CPU cooling fan etc.  Although some programs to use these
functionalities have been developed for the Windows95/98/NT platforms,
no program seems to exist for the PC-UNIX platforms.  Therefore
I have made small programs, which have least functionalities.

  By using "./configure" and "make", two binary programs

      mbmon      Mother Board Monitor for tty-terminal
      xmbmon     Mother Board Monitor for X

will be generated.  Both programs access SMBus or ISA IO port so
that they should sit in a directory in the PATH variable with
"setuid root" permission.  An example of installation is written
in Makefile (make install).  Only the ISA IO port access method is
supported for Linux platforms.  Add -DLINUX to the DEFS variable
in Makefile and compile.

(((NOTICE))) These programs access SMBus or ISA IO port without
   any kind of checkings.  It is, therefore, very dangerous and
   may cause system-crash in worst cases.  Especially, accesses of
   IO port 0x295, 0x296 may conflict NE2000 boards' IO ports.
   Users are requested to be sure that those ports are available.
   I do not take any responsibilities for problems caused by using
   these programs.

  These programs are arranged mainly to use Winbond W86781D chip
as a hardware monitor chip of mother board.  This chip can handle
three temperatures (Temp0, Temp1, Temp2), seven voltages (V0 - V6),
and three FAN rotational speeds (Fan0, Fan1, Fan2).  The program,
mbmon, shows all the information in text on tty's, and xmbmon shows
Temp0,1,2 and V0(Vcore) in graphic on X.  The units are degree in
centigrade (C) for temperatures, Volt (V) for voltages, and rotations
per minute (rpm) for Fan rotation speeds. In the case of xmbmon,
Temp0,1,2 are depicted with legends "MB", "CPU", "chip", respectively.
They are X-resources and can be freely changed (see the included file,
xmbmon.resources).  If these legends are not appropriate for your
mother board, please change them.  If you have no third temperature
(Temp2) and/or your third temperature is connected to nowhere,
it may be better not to show the third temperature itself.  In such
a case, please add -DNO_TEMP3 option to the DEFS variable in Makefile,
and use xmbmon.resources.no_temp3 in place of xmbmon_resources.

  If you do not know what kind of hardware monitor chip your mother
board has, then by using the following "debug" option

      mbmon -d
      xmbmon -debug

information of the monitor chip would be obtained.  You can judge,
more or less, whether these programs can run on your machine.  The
default behaviour of the programs is to access the SMBus, so that
if you get the message like

      InitMBInfo: Device not configured

then add an option like

      mbmon -d -I
      xmbmon -debug -method I

in order switch to the ISA IO port access method.

  Generally, recent mother boards provide two access methods to the
hardware monitor chip, namely those using the SMBus (System Management
Bus) and the old fashioned ISA IO port.  Newest chips (like AS99127F
on ASUS P3B-F mother board) would only allow the SMBus access method.
After FreeBSD 3.3-Stable, SMBus access is supported by the device
driver ("intpm" device).  If your system's version is before 3.3RELEASE
then you have to include "intpm" device from the CVS source tree.
Otherwise you cannot use the SMBus access method at all.  About
the SMBus on FreeBSD see Takanori Watanabe's homepage:

      http://www.planet.sci.kobe-u.ac.jp/~takawata/smbus/

In the case where no SMBus is available (like in the case that you
are using FreeBSD 2.2.x versions), you have to use "I" option above 
and switch to the other method, i.e. the ISA IO port access.  If the
configure program does not find /usr/include/machine/smb.h, then the
ISA IO port access method becomes the default method automatically.

  I have developed the programs in the environment of FreeBSD 3.3-
RELEASE with the "intpm" device attached.  But if the part of the
access methods such as SMBus and ISA IO port is modified, I believe
it easy to make the programs work on other PC-UNIX platforms.  The
mother board on my machine is ASUS's P2B/P2B-F, but if the following
hardware monitor chips

     WinBond co.                  W83781D, W83782D, W83783S
     ASUSTek co.                  AS99127F
     National Semiconductor co.   LM78/LM79


are used in your mother board, the programs would possibly work.
Here LM78/79 has only Temp0 (measuring the temperature of mother
board), and W83783S does not support Temp2.  Some mother board may
not use all Temp0/1/2 functionalities even though the monitor chip
has all.  Usually, Temp0 is for measuring mother board's temperature,
which is about the room temperature and does not change.  Temp1,2
are only effective when they are connected to external sensor chips
explicitly in most cases.  But in recent mother boards (like ASUS
P3B-F) Temp1 is often connected to the inner sensor of Pentium II/III
CPU by default.  The mother boards I have tried to run the programs
and the results of run with the "debug" option are collected in the
file DEBUG_info.

  I have followed the information on these chips, which is nicely
documented at the WWW page

    http://members.brabant.chello.nl/~a.vankaam/mbm/

by the author of "Mother Board Monitor" program on Windows95/98/NT,
Alex van Kaam.  There is a comprehensive list of which mother board
uses which hardware monitor chip in this homepage.  The technical
information of the Winbond chips can be found in the following
pdf files,

	http://www.winbond.com.tw/sheet/w83781d.pdf
	http://www.winbond.com.tw/sheet/w83782d.pdf
	http://www.winbond.com.tw/sheet/w83783s.pdf

And useful pdf files related to many hardware monitor chips are
collected in the homepage of the Linux hardware monitor project,

    http://www.netroedge.com/~lm78/pdfs.html

  On the development of version 1.05, the code to use the SMBus and
the configure procedure have been incorporated by Takanori Watanabe
at Kobe univ., and the modification for Linux platforms, which is not
complete but only for ISA IO port access method, has been done by
Koji Okamura at Kyushu univ..  Information of controlling the ASUS
chip, AS99127F, has been provided by Noriyuki Yoneya (:p araffin.)
(http://www.infoaomori.ne.jp/~paraffin/), who is the developer of
a monitor program, "LM78mon", on Windows platforms.  I appreciate
all the help of those people.

  The programs are completely free software.   Any modifications and
changes to the programs are welcome, and they are freely copied and
distributed.  The author is not at all responsible if anyone have
any problems or damages when using the programs.  The author won't
keep the development of the programs any further, at least now.  But
if someone develops any new better programs based on them, I am
very glad if feedback is made to me (of course, it is not any kind
of duties!).

     November 24, 1999       Yoshifumi R. Shimizu,
                             Department of Fundamental Physics,
                             Kyushu University

  e-mail : yrsh2scp@mbox.nc.kyushu-u.ac.jp
  http://www.nt.phys.kyushu-u.ac.jp/shimizu/index.html