What Is ACPI (Advanced Configuration and Power Interface)
Advanced Configuration and Power Interface (ACPI) is an open standard that is used for configuration and management of power consumption in mobile and desktop computers. Initially introduced in 1996 by Intel, Toshiba and Microsoft (HP, Huawei and Phoenix also joined later), its aim was to give the power management control to the Operating System. Before, the BIOS firmware was used which was hardware platform specific. Thus, there was need for a universal configuration and policies around power management. Together, they formed ACPI Special Interest Group (ACPI SIG) which maintained the standard.
In 2013, ACPI SIG agreed to transfer all assets to the UEFI Forum which has responsible for further development since then.
The Operating System has Operating System Power Management (OSPM) system which uses the ACPI to manage power of the platform and enable switching between power, performance, and processor states. It is applicable in a platform across all devices and components which gives tighter control since it is standardized. The OSPM takes exclusive control of all aspects and exposes certain power states i.e device, system, performance and processor states.
Power States
Device states
Device power state is the state of a device in a computer independently of other devices in the computer.
The device states are characterized by:
- Power consumption of the device
- Retention of device context
- Behaviour of device drivers
- Wake-up capability
- Device restoration time.
The device states are:
D0 (Fully on)
The device is fully on, assumed to be the highest level of power consumption. The device is completely active and responsive, and is expected to remember all relevant context continuously.
Intel has D0ix states that introduce intermediate states ranging from D0i0 to D0i3, where D0i0 is fully powered on and D0i3 is primarily powered off.
D1 and D2
These are intermediate power states and their definitions vary by device. The meaning of D1 and D2 are defined by each device class. In summary, D1 is expected to save less power and preserve more device context than D2.
D3
It is further divided into two:
- D3 Hot - A device can assert power management requests to transition to higher power states. In general, D3 Hot is expected to save as much power as possible without affecting PNP (Plug and Play) Enumeration. Devices in this state must have enough power to remain enumerable by software.
- D3 Cold - The device is powered off and unresponsive to its bus. All device context is lost when this state is entered, so the Operating system will reinitialize the device when powering it back on. They cannot be enumerated by software. They have the longest restore times.
System or Global states
System power states describe the power consumption of the system as a whole. These states depend on the amount of power consumption by the system and other factors. The global states are characterized by:
- The power consumption of the system
- The software resumption of the the operating system.
- The hardware latency of the system to return to working state
- System hardware context retention such as volatile processor registers, memory caches, and RAM.
There are four global states denoted by 'Gx' and correspond to six sleep states denoted by 'Sx'. Here is a summary of the states:
Global state | Name | Sleep state | Description |
---|---|---|---|
G0 | Working | S0 | computer is fully on, running and executing instructions. |
G1 | Sleeping | S0ix | known as Modern standby. Allows computers to be turned on and off instantly. The processor is still turned on and allows for execution of background tasks. |
S1 | known as Power on Suspend(POS). CPU caches are flushed. CPU stops executing instructions. However, power is maintained to CPU and memory. | ||
S2 | CPU is turned off. Dirty cache (data that has not been committed to disk) is flushed to RAM. | ||
S3 | known as Standby, sleep or Suspend to RAM. Here the RAM remains powered while the CPU is turned off. | ||
S4 | known as hibernation or suspend to disk. All data in RAM is saved to persistent memory(non-volatile) i.e SSDs and hard drives. | ||
G2 | Sort Off | S5 | computer is off. low power is still supplied to the power button or any other device that allows it to be turned on to working state. |
G3 | Mechanical off | computer has no power supply at all with exception of CMOS battery for system clock. The computer can be safely disassembled. |
G0 (Working state or S0)
The system is on, awake on a full running state. The CPU is executing instructions normally. However, hardware components that are in use can enter into a lower power state. Example is "Awaymode" where the monitor is off but tasks are running in the background.
G1 (Sleep state)
These are S1, S2, S3 and S4 sleeping states.
S1
Also known as Power on Suspend(POS). Processor caches are flushed (cleared), and the processor stops executing instructions. The power to the CPU and RAM is maintained. Devices that do not indicate that they must remain on may be powered off.
S2
The processor (CPU) is powered off. Dirty Cache is flushed to RAM.
S3
commonly known as Standby, Sleep, or Suspend to RAM. Here, RAM remains powered. However, the CPU is turned off.
S4 (Hibernate state)
Hibernation or Suspend to Disk. All the contents of the main memory is saved to persistent memory i.e hard drives and SSDs. Then the system is powered down. In Windows operating system, it uses hibernation to provide fast startup experience. It also gives a mechanism of saving the users state prior to shutting down for example in mobile devices. In hibernate transition, all data in memory is written to a file in the primary system drive, called the hibernation file. This preserves the state of the operating system, applications, and devices. Therefore, DRAM does not need to maintain self refresh and can be powered off. This means that power consumption of hibernation is very low, almost the same as power off.
G2 (Sort Off or S5)
Here the system is off, except the power supply unit still supplies power, at a minimum, to the power button to allow return to S0 (working state). A full reboot is required to return the computer to a working state. Other components may remain powered so the computer can be turned on on input from keyboard, clock, modem, LAN, USB device.
G3 (Mechanical Off)
The system is off similar to S5. However, the computers power has been totally removed via a mechanical switch, i.e in PSU switch or power cord from the wall.
Processor states (C-states)
This refers to the amount of power to the processor. They are states when the CPU has reduced or turned off selected functions. Different processors support different numbers of C-states in which various parts of the CPU are turned off. There are several states:
C0
This is the working, normal operating state
C1 (Halt)
In this state, the processor is not executing instructions. However, it can return to executing state instantly. The processor power state has the lowest latency. The hardware latency in this state must be low enough that the operating software does not consider the latency aspect of the state when deciding whether to use it.
C2 (Stop-Clock)
The processor maintains all software-visible state, but may take longer to wake.
C3 (Sleep)
The processor does not need to keep its cache coherent (uniformity of shared resource data that ends up stored in multiple local caches), but maintains other state. Some processors have variations such as Deep Sleep and Deeper Sleep that differ in how long it takes to wake the processor.
C2 and C3 are optional processor states.
Some processors have additional states defined by the manufacturer and vary in standard.
Performance states (Px-states)
These states provide a way to scale the frequency and voltage at which the processor runs so as to reduce the power consumption of the CPU. The number of available performance states can be different for each model of CPU, even those of the same family. Performance states allow OSPM to make tradeoffs between performance and energy conservation. The performance states:
P0
The device or processor uses maximum performance capability and may consume maximum power. This means maximum power and frequency.
P1
The performance capability of a device or processor is limited below its maximum and consumes less than maximum power.
Pn
The performance capability is at its minimum level and consumes minimal power while remaining in an active state. State n is a maximum number and is processor or device dependent.