xref: /freebsd/share/man/man4/man4.i386/apm.4 (revision eb69d1f144a6fcc765d1b9d44a5ae8082353e70b)
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.).
44This function is available only on systems whose APM
45supports CPU idling.
46.It
47.Nm
48exports an application interface as a character device.
49Applications
50can control APM, or retrieve APM status information via this interface.
51.Nm
52exports the following interfaces.
53These symbols are defined in
54.In machine/apm_bios.h .
55.Bl -tag -width 4n -offset indent
56.It Sy APMIO_SUSPEND
57Suspend system.
58.It Sy APMIO_GET
59Get power management information.
60.It Sy APMIO_ENABLE
61.It Sy APMIO_DISABLE
62Enable / Disable power management.
63.It Sy APMIO_HALTCPU
64.It Sy APMIO_NOTHALTCPU
65Control execution of HLT in the kernel context switch routine.
66.It Sy APMIO_GETPWSTATUS
67Get per battery information.
68.Pp
69Some APM implementations execute the HLT
70(Halt CPU until an interrupt occurs)
71instruction in the
72.Dq Em Idle CPU
73call, while others do not.
74Thus enabling this may result in
75redundant HLT executions because
76.Dq Em Idle CPU
77is called from the kernel context switch routine that inherently executes
78HLT.
79This may reduce peak system performance.
80.Pp
81Also the system hangs up if HLT instruction is disabled in the kernel
82context switch routine, and if the APM implementation of the machine
83does not execute HLT in
84.Dq Em Idle CPU .
85On some implementations that do not support CPU clock slowdown, APM
86might not execute HLT.
87.Nm
88disables
89.Sy APMIO_NOTHALTCPU
90operation on such machines.
91.Pp
92The current version of
93.Nm
94does not call
95.Dq Em Idle CPU
96from the kernel context switch routine if clock slowdown is not supported,
97and it executes HLT instruction by default.
98Therefore, there is
99no need to use these two operations in most cases.
100.El
101.Pp
102These interfaces are used by
103.Xr apm 8 .
104.It
105.Nm
106polls APM events and handles the following events.
107.Bl -column "xxxxxxxxxxxxxxxxx" "xxxxxxxxxxxxx" "xxxxxxxx"
108.It Sy "Name" Ta Sy "Action" Ta Sy "Description"
109.It Dv "PMEV_STANDBYREQ" Ta No "suspend system" Ta "standby request"
110.It Dv "PMEV_SUSPENDREQ" Ta No "suspend system" Ta "suspend request"
111.It Dv "PMEV_USERSUSPENDREQ" Ta No "suspend system" Ta "user suspend request"
112.It Dv "PMEV_CRITSUSPEND" Ta No "suspend system" Ta "critical suspend request"
113.It Dv "PMEV_NORMRESUME" Ta No "resume system" Ta "normal resume"
114.It Dv "PMEV_CRITRESUME" Ta No "resume system" Ta "critical resume"
115.It Dv "PMEV_STANDBYRESUME" Ta No "resume system" Ta "standby resume"
116.It Dv "PMEV_BATTERYLOW" Ta No "notify message" Ta "battery low"
117.It Dv "PMEV_UPDATETIME" Ta No "adjust clock" Ta "update time"
118.El
119.El
120.Sh SEE ALSO
121.Xr apm 8 ,
122.Xr zzz 8
123.Sh AUTHORS
124.An Tatsumi Hosokawa Aq Mt hosokawa@jp.FreeBSD.org
125.Sh BUGS
126WARNING!
127Many, if not most, of the implementations of APM-bios in laptops
128today are buggy.
129You may be putting your LCD-display and batteries at
130a risk by using this interface.
131(The reason this is not a problem for
132MS-Windows is that they use the real-mode interface.)
133If you see any
134weird behavior from your system with this code in use, unplug the
135power and batteries ASAP, if not immediately, and disable this code.
136.Pp
137We are very interested in getting this code working, so please send your
138observations of any anomalous behavior to us.
139.Pp
140When
141.Nm
142is active, calling the BIOS setup routine by using hot-keys,
143may cause serious trouble when resuming the system.
144BIOS setup programs should be called during bootstrap, or from DOS.
145.Pp
146Some APM implementations cannot handle events such as pushing the
147power button or closing the cover.
148On such implementations, the system
149.Ar must
150be suspended
151.Ar only
152by using
153.Xr apm 8
154or
155.Xr zzz 8 .
156.Pp
157Disk spin-down, LCD backlight control, and power on demand have not
158been supported on the current version.
159