
	APM BIOS Driver for Linux

	by Stephen Rothwell       Stephen.Rothwell@pd.necisa.oz.au

This driver interfaces to an Advanced Power Management (APM) BIOS on
a system (usually a laptop) to allow the control of power management
and the reporting of PM events under Linux.

Currently the driver works with Linux versions 1.1.78, but
there should be no problems with using them with newer patch levels
of the kernel.

INSTALLATION:

There are a set of kernel patches to be applied called kernel.patch.
Use
	patch -p0 <kernel.patch	(from /usr/src)
or
	patch -p1 <kernel.patch (from /usr/src/linux)

There are also some new files to install:
	apm_bios.h belongs in include/linux/apm_bios.h
	apm_bios.c belongs in drivers/char/apm_bios.c
Copy these to the appropriate directories in /usr/src/linux.

Then do
	make config;make depend;make
in /usr/src/linux.

There is a very simple apm daemon: apmd.c.

DETAILS:

The driver itself just prints some debugging information at startup
and then polls the APM BIOS every second to get events.  It then
passes these evnts onto any other drivers that have registered and
also to a user process if it has the apm_bios device open.  If there
is no user process with the device open, and the driver gets a SUSPEND
event, it tells the APM BIOS to suspend the system and then when the
BIOS returns, resets the system time.  If it gets a RESUME event, it
just reset the system time.  Any other event just gets logged (using
printk).  This logging can be disabled in the driver.

The major number for the device is dynamically allocated.  You can use
	cat /proc/devices
to find it.  Then you must use
	mknod /dev/apm_bios c <major> 0
to create the device.  This device may be read to get notification of
APM events.  Each event is returned as an unsigned short (currently in
Intel order - least significant byte first).  Select and O_NONBLOCK
also both work.

There are currently only two ioctls.  These allow a user process to
put the machine into suspend or standby mode.

Only one process can have the device open, and only root can open the
device.
