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