xref: /freebsd/share/man/man4/man4.i386/apm.4 (revision 7660b554bc59a07be0431c17e0e33815818baa69)
1.\" LP (Laptop Package)
2.\"
3.\" Copyright (c) 1994 by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
4.\"
5.\" This software may be used, modified, copied, and distributed, in
6.\" both source and binary form provided that the above copyright and
7.\" these terms are retained. Under no circumstances is the author
8.\" responsible for the proper functioning of this software, nor does
9.\" the author assume any responsibility for damages incurred with its
10.\" use.
11.\"
12.\" $FreeBSD$
13.\"
14.Dd November 1, 1994
15.Dt APM 4 i386
16.Os
17.Sh NAME
18.Nm apm
19.Nd APM BIOS interface
20.Sh SYNOPSIS
21.Cd device apm
22.Sh DESCRIPTION
23.Nm
24is an interface to the Intel / Microsoft APM (Advanced Power Management) BIOS
25on laptop PCs.
26.Pp
27.Nm
28provides the following power management functions.
29.Bl -enum -offset indent
30.It
31When the system wakes up from suspended mode,
32.Nm
33adjusts the system clock to RTC.
34.It
35When the system wakes up from suspended mode,
36.Nm
37passes a message to
38.Xr syslogd 8
39comprising of system wakeup time and elapsed time during suspended mode.
40.It
41.Nm
42slows CPU clock when there are no system activities (runnable processes,
43interrupts, etc.).  This function is available only on systems whose APM
44supports CPU idling.
45.It
46.Nm
47exports an application interface as a character device.  Applications
48can control APM, or retrieve APM status information via this interface.
49.Nm
50exports the following interfaces.  These symbols are defined in
51.In machine/apm_bios.h .
52.Bl -tag -width 4n -offset indent
53.It Sy APMIO_SUSPEND
54Suspend system.
55.It Sy APMIO_GET
56Get power management information.
57.It Sy APMIO_ENABLE
58.It Sy APMIO_DISABLE
59Enable / Disable power management.
60.It Sy APMIO_HALTCPU
61.It Sy APMIO_NOTHALTCPU
62Control execution of HLT in the kernel context switch routine.
63.It Sy APMIO_GETPWSTATUS
64Get per battery information.
65.Pp
66Some APM implementations execute the HLT
67(Halt CPU until an interrupt occurs)
68instruction in the
69.Dq Em Idle CPU
70call, while others do not.  Thus enabling this may result in
71redundant HLT executions because
72.Dq Em Idle CPU
73is called from the kernel context switch routine that inherently executes
74HLT. This may reduce peak system performance.
75.Pp
76Also the system hangs up if HLT instruction is disabled in the kernel
77context switch routine, and if the APM implementation of the machine
78does not execute HLT in
79.Dq Em Idle CPU .
80On some implementations that do not support CPU clock slowdown, APM
81might not execute HLT.
82.Nm
83disables
84.Sy APMIO_NOTHALTCPU
85operation on such machines.
86.Pp
87The current version of
88.Nm
89does not call
90.Dq Em Idle CPU
91from the kernel context switch routine if clock slowdown is not supported,
92and it executes HLT instruction by default.  Therefore, there is
93no need to use these two operations in most cases.
94.El
95.Pp
96These interfaces are used by
97.Xr apm 8 .
98.It
99.Nm
100polls APM events and handles the following events.
101.Bl -column PMEV_POWERSTATECHANGEXXX "suspend system xxxxx"
102.It Sy "Name                  " "Action          " "Description"
103.It Dv "PMEV_STANDBYREQ       " No "suspend system  " "standby request"
104.It Dv "PMEV_SUSPENDREQ       " No "suspend system  " "suspend request"
105.It Dv "PMEV_USERSUSPENDREQ   " No "suspend system  " "user suspend request"
106.It Dv "PMEV_CRITSUSPEND      " No "suspend system  " "critical suspend request"
107.It Dv "PMEV_NORMRESUME       " No "resume system   " "normal resume"
108.It Dv "PMEV_CRITRESUME       " No "resume system   " "critical resume"
109.It Dv "PMEV_STANDBYRESUME    " No "resume system   " "standby resume"
110.It Dv "PMEV_BATTERYLOW       " No "notify message  " "battery low"
111.It Dv "PMEV_UPDATETIME       " No "adjust clock    " "update time"
112.El
113.El
114.Sh BUGS
115WARNING!  Many, if not most, of the implementations of APM-bios in laptops
116today are buggy.  You may be putting your LCD-display and batteries at
117a risk by using this interface.  (The reason this isn't a problem for
118MS-windows is that they use the real-mode interface.)  If you see any
119weird behavior from your system with this code in use, unplug the
120power and batteries ASAP, if not immediately, and disable this code.
121.Pp
122We are very interested in getting this code working, so please send you
123observations of any anomalous behavior to us.
124.Pp
125When
126.Nm
127is active, calling the BIOS setup routine by using hot-keys,
128may cause serious trouble when resuming the system.
129BIOS setup programs should be called during bootstrap, or from DOS.
130.Pp
131Some APM implementations cannot handle events such as pushing the
132power button or closing the cover.  On such implementations, the system
133.Ar must
134be suspended
135.Ar only
136by using
137.Xr apm 8
138or
139.Xr zzz 8 .
140.Pp
141Disk spin-down, LCD backlight control, and power on demand have not
142been supported on the current version.
143.Sh SEE ALSO
144.Xr apm 8 ,
145.Xr zzz 8
146.Sh AUTHORS
147Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org>
148