Advanced Configuration and Power Interface
This article needs additional citations for verification. (July 2010) (Learn how and when to remove this template message)
In a computer, the Advanced Configuration and Power Interface (ACPI) provides an open standard that operating systems can use to discover and configure computer hardware components, to perform power management e.g. putting unused hardware components to sleep, to perform auto configuration e.g. Plug and Play, and to perform status monitoring. First released in December 1996, ACPI aims to replace Advanced Power Management (APM), the MultiProcessor Specification, the PCI BIOS specification, and the Plug and Play BIOS (PnP) Specification. ACPI brings the power management under the control of the operating system, as opposed to the previous BIOS-centric system that relied on platform-specific firmware to determine power management and configuration policies. The specification is central to the Operating System-directed configuration and Power Management (OSPM) system. ACPI defines a hardware abstraction interface between the system firmware (BIOS or UEFI), the computer hardware components, and the operating systems.
Internally, ACPI advertises the available components and their functions to the operating system kernel using instruction lists ("methods") provided through the system firmware (UEFI or BIOS), which the kernel parses. ACPI then executes the desired operations written in ACPI Machine Language (such as the initialization of hardware components) using an embedded minimal virtual machine.
Intel, Microsoft and Toshiba originally developed the standard, while HP, Huawei and Phoenix also participated later. In October 2013, ACPI Special Interest Group (ACPI SIG), the original developers of the ACPI standard, agreed to transfer all assets to the UEFI Forum, in which all future development will take place.
The firmware-level ACPI has three main components: the ACPI tables, the ACPI BIOS, and the ACPI registers. The ACPI BIOS generates ACPI tables and loads ACPI tables into main memory. Most of the firmware ACPI functionality is provided in bytecode of ACPI Machine Language (AML), a Turing-complete, domain-specific low-level language, stored in the ACPI tables. To make use of the ACPI tables, the operating system must have an interpreter for the AML bytecode. A reference AML interpreter implementation is provided by the ACPI Component Architecture (ACPICA). At the BIOS development time, AML bytecode is compiled from the ASL (ACPI Source Language) code.
Overall design decision was not without criticism. In November 2003, Linus Torvalds—author of the Linux kernel—described ACPI as "a complete design disaster in every way". In 2001, other senior Linux software developers like Alan Cox expressed concerns about the requirements that bytecode from an external source must be run by the kernel with full privileges, as well as the overall complexity of the ACPI specification. In 2014, Mark Shuttleworth, founder of the Ubuntu Linux distribution, compared ACPI with Trojan horses.
ACPI Component Architecture (ACPICA)
The ACPI Component Architecture (ACPICA), mainly written by Intel's engineers, provides an open-source platform-independent reference implementation of the operating system–related ACPI code. The ACPICA code is used by Linux, Haiku, ArcaOS and FreeBSD, which supplement it with their operating-system specific code.
The first revision of the ACPI specification was released in December 1996, supporting 16, 24 and 32-bit addressing spaces. It was not until August 2000 that ACPI received 64-bit address support as well as support for multiprocessor workstations and servers with revision 2.0.
In September 2004, revision 3.0 was released, bringing to the ACPI specification support for SATA interfaces, PCI Express bus, multiprocessor support for more than 256 processors, ambient light sensors and user-presence devices, as well as extending the thermal model beyond the previous processor-centric support.
The latest specification revision is 6.3, which was released in January 2019.
Microsoft's Windows 98 was the first operating system to implement ACPI, but its implementation was somewhat buggy or incomplete, although some of the problems associated with it were caused by the first-generation ACPI hardware. Windows 98 first edition disabled ACPI by default except on a whitelist of systems. Other operating systems, including later versions of Windows, eComStation, ArcaOS, FreeBSD (since FreeBSD 5.0), NetBSD (since NetBSD 1.6), OpenBSD (since OpenBSD 3.8), HP-UX, OpenVMS, Linux, and PC versions of Solaris, have at least some support for ACPI. Some newer operating systems, like Windows Vista, require the computer to have an ACPI-compliant BIOS, and since Windows 8, the S0ix/Modern Standby state was implemented.
Windows operating systems use acpi.sys to access ACPI events.
The 2.4 series of the Linux kernel had only minimal support for ACPI, with better support implemented (and enabled by default) from kernel version 2.6.0 onwards. Old ACPI BIOS implementations tend to be quite buggy, and consequently are not supported by later operating systems. For example, Windows 2000, Windows XP, and Windows Server 2003 only use ACPI if the BIOS date is after January 1, 1999, and for Windows 98 Second Edition this date is December 1, 1999. Similarly, Linux kernel 2.6 blacklisted any ACPI BIOS from before January 1, 2001.
Linux-based operating systems can provide access to ACPI events via acpid.
Once an OSPM-compatible operating system activates ACPI, it takes exclusive control of all aspects of power management and device configuration. The OSPM implementation must expose an ACPI-compatible environment to device drivers, which exposes certain system, device and processor states.
|G0||Working||S0||The computer is running and the CPU executes instructions. "Awaymode" is a subset of S0, where monitor is off but background tasks are running|
|G1||Sleeping||S0ix||Modern Standby, or "Low Power S0 Idle". Partial processor SoC sleep. Known to ARM and x86 devices.|
|S1||Power on Suspend (POS): Processor caches are flushed, and the CPU(s) stops executing instructions. The power to the CPU(s) and RAM is maintained. Devices that do not indicate they must remain on may be powered off|
|S2||CPU powered off. Dirty cache is flushed to RAM|
|S3||commonly referred to as Standby, Sleep, or Suspend to RAM (STR): RAM remains powered|
|S4||Hibernation or Suspend to Disk: All content of the main memory is saved to non-volatile memory such as a hard drive, and the system is powered down|
|G2||Soft Off||S5||G2/S5 is almost the same as G3 Mechanical Off, except that the power supply unit (PSU) still supplies power, at a minimum, to the power button to allow return to S0. A full reboot is required. No previous content is retained. Other components may remain powered so the computer can "wake" on input from the keyboard, clock, modem, LAN, or USB device|
|G3||Mechanical Off||The computer's power has been totally removed via a mechanical switch (as on the rear of a PSU). The power cord can be removed and the system is safe for disassembly (typically, only the real-time clock continues to run using its own small battery)|
The specification also defines a Legacy state: the state of an operating system which does not support ACPI. In this state, the hardware and power are not managed via ACPI, effectively disabling ACPI.
The device states D0–D3 are device dependent:
- D0 or Fully On is the operating state.
- As with S0ix, Intel has D0ix states for intermediate levels on the SoC.
- D1 and D2 are intermediate power-states whose definition varies by device.
- D3: The D3 state is further divided into D3 Hot (has auxiliary power), and D3 Cold (no power provided):
- Hot: A device can assert power management requests to transition to higher power states.
- Cold or Off has the device powered off and unresponsive to its bus.
The CPU power states C0–C3 are defined as follows:
- C0 is the operating state.
- C1 (often known as Halt) is a state where the processor is not executing instructions, but can return to an executing state essentially instantaneously. All ACPI-conformant processors must support this power state. Some processors, such as the Pentium 4 and AMD Athlon, also support an Enhanced C1 state (C1E or Enhanced Halt State) for lower power consumption, however this proved to be buggy on some systems.
- C2 (often known as Stop-Clock) is a state where the processor maintains all software-visible state, but may take longer to wake up. This processor state is optional.
- C3 (often known as Sleep) is a state where the processor does not need to keep its cache coherent, but maintains other state. Some processors have variations on the C3 state (Deep Sleep, Deeper Sleep, etc.) that differ in how long it takes to wake the processor. This processor state is optional.
- Additional states are defined by manufacturers for some processors. For example, Intel's Haswell platform has states up to C10, where it distinguishes core states and package states.
While a device or processor operates (D0 and C0, respectively), it can be in one of several power-performance states. These states are implementation-dependent. P0 is always the highest-performance state, with P1 to Pn being successively lower-performance states, up to an implementation-specific limit of n no greater than 16.
- P0 maximum power and frequency
- P1 less than P0, voltage and frequency scaled
- P2 less than P1, voltage and frequency scaled
- Pn less than P(n–1), voltage and frequency scaled
ACPI-compliant systems interact with hardware through either a "Function Fixed Hardware (FFH) Interface", or a platform-independent hardware programming model which relies on platform-specific ACPI Machine Language (AML) provided by the original equipment manufacturer (OEM).
Function Fixed Hardware interfaces are platform-specific features, provided by platform manufacturers for the purposes of performance and failure recovery. Standard Intel-based PCs have a fixed function interface defined by Intel, which provides a set of core functionality that reduces an ACPI-compliant system's need for full driver stacks for providing basic functionality during boot time or in the case of major system failure.
ACPI Platform Error Interface (APEI) is a specification for reporting of hardware errors, e.g. chipset, RAM to the operating system.
ACPI defines many tables that provide the interface between an ACPI-compliant operating system and system firmware (BIOS or UEFI). This includes RSDP, RSDT, XSDT, FADT, DSDT, SSDT, MADT, and MCFG, for example.
The tables allow description of system hardware in a platform-independent manner, and are presented as either fixed-formatted data structures or in AML. The main AML table is the DSDT (differentiated system description table). The AML can be decompiled by tools like Intel's iASL (open-source, part of ACPICA) for purposes like patching the tables for expanding OS compatibility.
The Root System Description Pointer (RSDP) is located in a platform-dependent manner, and describes the rest of the tables.
This article relies too much on references to primary sources. (March 2020) (Learn how and when to remove this template message)
Ubuntu founder Mark Shuttleworth has likened ACPI to Trojan horses. He has described proprietary firmware (ACPI-related or any other firmware) as a security risk, saying that "firmware on your device is the NSA's best friend" and calling firmware (ACPI or non-ACPI) "a Trojan horse of monumental proportions". He has pointed out that low quality, closed source firmware is a major threat to system security: "Your biggest mistake is to assume that the NSA is the only institution abusing this position of trust — in fact, it's reasonable to assume that all firmware is a cesspool of insecurity, courtesy of incompetence of the highest degree from manufacturers, and competence of the highest degree from a very wide range of such agencies." As a solution to this problem, he has called for open-source, declarative firmware (ACPI or non-ACPI), which instead of containing executable code, only describes "hardware linkage and dependencies".
A custom ACPI table called the Windows Platform Binary Table (WPBT) is used by Microsoft to allow vendors to add software into the Windows OS automatically. Some vendors, such as Lenovo and Samsung, have been caught using this feature to install harmful software like Superfish. Windows versions older than Windows 7 do not support this feature, but alternative techniques can be used. This behavior has been compared to rootkits.
- PCI BIOS specification, PCI-SIG
- PCI firmware specification, PCI-SIG
- "ACPI Overview" (PDF). www.acpi.info. Archived from the original (slide show in PDF) on May 25, 2019.
- "APM BIOS Specification". Intel Corporation, Microsoft Corporation. February 1996. Archived from the original (RTF) on February 26, 2012. Retrieved July 2, 2010.
- "What is ACPI (Advanced Configuration and Power Interface)? - Definition from WhatIs.com". SearchWindowsServer. Retrieved September 18, 2020.
- "ACPI Device Tree - Representation of ACPI Namespace — The Linux Kernel documentation". www.kernel.org. Retrieved September 18, 2020.
- "The Advanced Configuration & Power Interface web page has a prominent note that links to the Preexisting ACPI Specifications page on the UEFI web site". acpi.org. July 23, 2014. Retrieved January 25, 2016.
- "Advanced Configuration and Power Interface Specification, Version 6.3" (PDF). UEFI.org/specifications. January 2019. Retrieved January 30, 2019.
- Bernhard Kauer (August 2009). "ATARE: ACPI Tables and Regular Expressions" (PDF). Retrieved February 18, 2019.
- ACPI implementation on FreeBSD - Usenix
- ACPI in Linux, 2005
- Linux Magazine issue 162, May 2014, page 9
- Searls, Doc (November 25, 2003). "Linus & the Lunatics, Part II". Linux Journal. Retrieved January 13, 2010.
- Corbet, Jonathan (July 4, 2001). "Kernel Development". LWN.net weekly edition. LWN.net. Retrieved July 2, 2010.
- Linux Format n°184, June 2014, page 7.
- ACPICA: ACPI Component Architecture
- "Readme for the ACPI Driver Package". arcanoae.com. Retrieved September 6, 2020.
- Hewlett-Packard; Intel Corporation; Microsoft; Phoenix Technologies; Toshiba (December 6, 2011). "Advanced Configuration and Power Interface Specification (Revision 5.0)" (PDF). acpi.info. Retrieved November 17, 2013.
- "Advanced Configuration and Power Interface Specification (Revision 5.1)" (PDF). uefi.org. July 23, 2014. Retrieved May 24, 2015.
- "Limitations When Using Microsoft Windows 98 on Compaq Armada Portables" (PDF). physik.hu-berlin.de. October 1998. p. 3. Retrieved January 27, 2014.[permanent dead link]
- "Windows 98 on ThinkPad systems - ThinkPad General". Support.lenovo.com. Archived from the original on February 3, 2014. Retrieved January 27, 2014.
- Robert Cowart; Brian Knittel (2000). Using Microsoft Windows 2000 Professional. Que Publishing. p. 30. ISBN 978-0-7897-2125-9.
- Windows 98 Does Not Support ACPI Passive Cooling Mode
- "Cover Story: Win98 Bugs & Fixes - December 1998". winmag.com. Archived from the original on October 13, 1999.
- "ArcaOS Changelog". Retrieved August 24, 2020.
- "FreeBSD 5.0-RELEASE Announcement". www.freebsd.org. Retrieved December 3, 2020.
- "acpi(4) - NetBSD Manual Pages". man.netbsd.org. Retrieved December 3, 2020.
- "acpi(4) - OpenBSD manual pages". man.openbsd.org. Retrieved December 3, 2020.
- Therien, Guy (January 6, 2000). "ACPI 2.0 Specification Technical Review, Intel Developer Forum" (PPT). Intel Corporation. Archived from the original on July 21, 2011. Retrieved August 21, 2011.
- Marshall, Allen. "ACPI in Windows Vista" (PPT). Microsoft Corporation. Retrieved July 2, 2010.
- "Acpi.sys: The Windows ACPI Driver". Microsoft Corporation. June 15, 2017. Retrieved September 20, 2019.
- The State of ACPI in the Linux Kernel
- ACPI BIOS. msdn.microsoft.com.
- "acpid In Debian". Debian. July 2, 2011. Retrieved September 20, 2019.
- ACPI Spec Rev 5.0 - dated December 6, 2011
- Anand Lal Shimpi (October 5, 2012). "Intel's Haswell Architecture Analyzed". AnandTech. Retrieved October 20, 2013.
- windows-driver-content. "Modern Standby". docs.microsoft.com. Retrieved March 20, 2020.
- "S0ix States". software.intel.com. March 9, 2020.
- Wang, Wendy (October 17, 2018). "How to achieve S0ix states in Linux*". 01.org.
- "D0ix States". software.intel.com. March 9, 2020.
- "Athlon II X2: Hardware C1E and Return of the CnQ Bug". AnandTech. Retrieved October 26, 2020.
- Wasson, Scott (February 21, 2005). "Intel's Pentium 4 600 series processors". The Tech Report. p. 2.
- "Processor Package and Core C-States". AnandTech. June 9, 2013. Retrieved October 20, 2013.
- "Advanced Configuration and Power Interface Specification, Revision 3.0, Section 2.6 Device and Processor Performance State Definitions" (PDF). ACPI.info. September 2, 2004. p. 23. Retrieved August 19, 2015.
- Intel Corporation (September 2006). "Intel Processor Vendor-Specific ACPI" (PDF). Archived from the original (PDF) on December 25, 2012. Retrieved October 5, 2014.
- Brown, Len (July 20, 2005). "ACPI in Linux". Ottawa Linux Symposium: 3. CiteSeerX 10.1.1.173.2206.
- "ACPI Tables — The Linux Kernel documentation". www.kernel.org. Retrieved November 8, 2020.
- "DSDT". ArchWiki.
- "Getting Started With ACPI". GitBook.
- Mark Shuttleworth blog (2014-03-17), ACPI, firmware and your security
- Hoffman, Chris. "Zombie Crapware: How the Windows Platform Binary Table Works". How-To Geek.
- "Vendors 'rootkit': 'Windows Platform Binary Table' (WPBT)". Born's Tech and Windows World.
- Official website (UEFI and ACPI specifications)
- Everything You Need to Know About the CPU C-States Power Saving Modes
- Sample ASL code (in the *.dsl files) from the SeaBIOS project
- Sample EFI ASL code used by VirtualBox; EFI/ASL code itself is from the open source Intel EFI Development Kit II (TianoCore)