Advanced Power Management


Advanced power management is an API developed by Intel and Microsoft and released in 1992 which enables an operating system running an IBM-compatible personal computer to work with the BIOS to achieve power management.
Revision 1.2 was the last version of the APM specification, released in 1996. ACPI is intended as the successor to APM. Microsoft dropped support for APM in Windows Vista. The Linux kernel still mostly supports APM, though support for APM CPU idle was dropped in version 3.0.

Overview

APM uses a layered approach to manage devices. APM-aware applications talk to an OS-specific APM driver. This driver communicates to the APM-aware BIOS, which controls the hardware. There is the ability to opt out of APM control on a device-by-device basis, which can be used if a driver wants to communicate directly with a hardware device.
Communication occurs both ways; power management events are sent from the BIOS to the APM driver, and the APM driver sends information and requests to the BIOS via function calls. In this way the APM driver is an intermediary between the BIOS and the operating system.
Power management happens in two ways; through the above-mentioned function calls from the APM driver to the BIOS requesting power state changes, and automatically based on device activity.

Power management events

There are 12 power events, plus OEM-defined events, that can be sent from the APM BIOS to the operating system. The APM driver regularly polls for event change notifications.
Power Management Events:
NameCodeComment
System Standby Request Notification0x0001
System Suspend Request Notification0x0002
Normal Resume System Notification0x0003
Critical Resume System Notification0x0004
Battery Low Notification0x0005
Power Status Change Notification0x0006
Update Time Notification0x0007
Critical System Suspend Notification0x0008
User System Standby Request Notification0x0009
User System Suspend Request Notification0x000A
System Standby Resume Notification0x000B
Capabilities Change Notification0x000CDue to setup or device insertion/removal

Power management functions:
NameCodeComment
APM Installation Check0x00
APM Real Mode Interface Connect0x01
APM Protected Mode 16-bit Interface Connect0x02Avoids real or virtual86 mode.
APM Protected Mode 32-bit Interface Connect0x03Avoids real or virtual86 mode.
APM Interface Disconnect0x04
CPU Idle0x05Requests system suspend.
0) Clock halted until timer tick interrupt.
1) Slow clock
CPU Busy0x06Driver tells system APM to restore clock speed of the CPU.
Set Power State0x07Set system or device into Suspend/Standby/Off state.
Enable/Disable Power Management0x08
Restore APM BIOS Power-On Defaults0x09
Get Power Status0x0ASupports AC status "On backup power". And battery status.
Get PM Event0x0BChecks for APM events. Shall be called once per second.
Get Power State0x0C
Enable/Disable Device Power Management0x0D
APM Driver Version0x0E
Engage/Disengage Power Management0x0FAPM management for a specific device.
Get Capabilities0x10
Get/Set/Disable Resume Timer0x11
Enable/Disable Resume on Ring Indicator0x12
Enable/Disable Timer Based Requests0x13
OEM APM Installation Check0x80Tells if APM BIOS supports OEM hardware dependent functions.
OEM APM Function0x80Access to OEM specific functions.

APM functions

There are 21 APM function calls defined that the APM driver can use to query power management statuses, or request power state transitions. Example function calls include letting the BIOS know about current CPU usage, retrieving the current power state of a device, or requesting a power state change.

Power states

The APM specification defines system power states and device power states.

System power states

APM defines five power states for the computer system:
APM also defines power states that APM-aware hardware can implement. There is no requirement that an APM-aware device implement all states.
The four states are:
The CPU core is treated specially in APM, as it is the last device to be powered down, and the first device to be powered back up. The CPU core is always controlled through the APM BIOS. Drivers can use APM function calls to notify the BIOS about CPU usage, but it is up to the BIOS to act on this information; a driver cannot directly tell the CPU to go into a power saving state.

In ATA drives

The ATA specification defines APM provisions for hard drives via the subcommand, which specifies a trade-off between spin-down frequency and always-on performance. Unlike the BIOS-side APM, the ATA APM has never been deprecated.