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