Jump to content

ACPI

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 193.138.13.200 (talk) at 15:23, 10 December 2007 (Global states). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The Advanced Configuration and Power Interface (ACPI) specification is an open industry standard first released in December 1996 developed by HP, Intel, Microsoft, Phoenix, and Toshiba that defines common interfaces for hardware recognition, motherboard and device configuration and power management. According to its specification[1], "ACPI is the key element in Operating System-directed configuration and Power Management (OSPM)".

The latest revision of the ACPI specification is 3.0b which was released on October 10, 2006.

Overview

The most widely recognized element of the standard is power management, of which there have been two major improvements. First, it puts the Operating System (OS) in control of power management. This stands in contrast with the previously existing APM model, which assigns power management control to the BIOS, with limited intervention from the OS. In ACPI, the BIOS provides the operating system with methods for directly controlling the low-level details of the hardware so it has nearly complete control over the power savings.

The other important feature of ACPI is in bringing power management features previously only available in portable computers to desktop computers and servers. For example, systems may be put into extremely low consumption states, i.e. in which only memory, or not even memory is powered, but from which "general-purpose events" (GPEs, similar to interrupts, which can be sent by devices such as the real-time clock, keyboard, modem, etc.) can quickly wake the system.

The standard supports keys on a normal keyboard for suspending or powering off the computer. Some vendors (e.g. ASUS and Compaq) have extended this feature and use it for other keys, especially so-called Power management keys.

ACPI requires compliant hardware (which includes support for ACPI registers, defined by the specification) and thus cannot be applied to older hardware. The operating system, motherboard chipset and for some functions even the CPU, must be designed with support for it.

ACPI uses its own ACPI Machine Language (or AML) for implementing power event handlers, rather than the native assembly language of the host system. The AML code is part of firmware (BIOS), but is interpreted by the operating system.

The first version of Microsoft Windows to support ACPI was Windows 98. The first version of FreeBSD to support ACPI was 5.0. Linux, NetBSD and OpenBSD all have at least some support for ACPI.

States

Global states

The ACPI specification defines the following seven states (so-called global states) an ACPI-compliant computer system can be in:

  • G0 (S0) Working is the normal working state of the computer - the operating system and applications are running. The CPU(s) execute instructions. Within this state (i.e., without entering G1 Sleeping), it is possible for CPU(s) and devices like hard drives, DVD drives, etc. to be repeatedly put into and come back from low-energy states, called C0Cn and D0D3. (Laptops, for example, routinely power down all currently unused devices when running on battery; some desktops also do this to reduce noise.)
  • G1 Sleeping subdivides into the four states S1 through S4. The time needed to bring the system from here back into G0 Working (wake-latency time) is shortest for S1, short for S2 and S3, and not so short for S4.
    • S1 is the most power-hungry of sleep modes. All processor caches are flushed, and the CPU(s) stop executing instructions. Power to the CPU(s) and RAM is maintained; devices that do not indicate they must remain on may be powered down. This mode is often referred to as Power On Standby or simply POS, particularly in BIOS configuration screens. Some newer machines do not support S1; older machines are more likely to support S1 than S3.
    • S2 is a deeper sleep state than S1, where the CPU is powered off; however, it is not commonly implemented.
    • S3 is called Standby in versions of Windows through Windows XP and in some varieties of Linux, Sleep in Windows Vista and Mac OS X, and sometimes also Suspend to RAM (STR), although the ACPI specification mentions only the terms S3 and Sleep. In this state, main memory (RAM) is still powered, although it is almost the only component that is. Since the state of the operating system and all applications, open documents, etc. lies all in main memory, the user can resume work exactly where he/she left off—the main memory content when the computer comes back from S3 is the same as when it was put into S3. (The specification mentions that S3 is rather similar to S2, only that some more components are powered down in S3.) S3 has two advantages over S4; the computer resumes in about the time it takes the monitor to come on, secondly if any running applications (opened documents, etc) have private information in them, this will not be written to the disk. However, disk caches may be flushed to prevent data corruption in case the system doesn't wake up e.g. due to power failure.
    • S4 is called Hibernation in Windows, Safe Sleep in Mac OS X, and sometimes also Suspend to disk, although the ACPI specification mentions only the term S4 (main article: Hibernate (OS feature)). In this state, all content of main memory is saved to a hard drive, preserving the state of the operating system, all applications, open documents etc. That means that after coming back from S4, the user can resume work where it was left off in much the same way as with S3. The difference between S4 and S3, apart from the added time of moving the main memory content to disk and back, is that a power loss of a computer in S3 makes it lose all data in main memory, including all unsaved documents, while a computer in S4 is unaffected. S4 is quite different from the other S states and actually resembles G2 Soft Off and G3 Mechanical Off more than it resembles S1–S3. A system that's in S4 can also be put in G3 (Mechanical Off) and still keep it's S4 state so it can resume the operating state after getting back power.
  • G2 (S5) Soft Off-- G2, S5, and Soft Off are synonyms. G2 is almost the same as G3 Mechanical Off, but some components remain powered so the computer can "wake" from input from the keyboard, LAN, or USB device [2]. This state is the same as G3 Mechanical Off, in that the boot procedure must be run to bring the system from G2 to G0 Working. G3 Mechanical Off is entered only when a power loss occurs, whereas G2 is initiated by the operating system (typically because the user issued a shutdown command in some way). The computer is not safe for disassembly in the G2 state due to the components that remain powered, however it is safe to unplug the computer and, after approximately 20 seconds, the computer will be in the G3 state. It is always advisable to unplug a desktop computer (and wait 20 seconds) prior to disassembly, because, although internal drives are usually not powered, the (PS2) keyboard, USB ports, mainboard, expansion cards, and power supply may remain powered, even if the computer is not used to wake from input to these devices.
  • G3 Mechanical Off: The computer's power consumption is very close to zero, to the point that the power cord can be removed and the system is safe for disassembly (typically, only the real-time clock is running off its own small battery). The computer falls into this state when a power loss occurs, e.g. in case of a power outage. Once power is restored, a full boot procedure is necessary to bring the system from G3 to G0 Working.

Furthermore, a state Legacy is defined as the state when an operating system runs which does not support ACPI. In this state, the hardware and power are not managed via ACPI, effectively disabling ACPI.

(Reference: ACPI specification 3.0b is linked to under External links, section 7.3.4)

Device states

The device states D0-D3 are device-dependent:

  • D0 Fully-On is the operating state.
  • D1 and D2 are intermediate power states whose definition varies by device.
  • D3 Off has the device powered off and unresponsive to its bus.

Processor states

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. Some processors, such as the Pentium 4, also support an Enhanced C1 state (C1E) for lower power consumption.
  • C2 (often known as Stop-Clock) is a state where the processor maintains all software-visible state, but may take longer to wake up.
  • 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.

Performance states

While a device or processor is operating (D0 and C0, respectively), it can be in one of several power-performance states. These states are implementation-dependent, but 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.

P-states are called SpeedStep in Intel processors, PowerNow! or Cool'n'Quiet in AMD processors and PowerSaver in VIA processors.

ACPI Tables

These tables are used by operating systems to get hardware information.

RSDP (Root System Description Pointer)
RSDT (Root System Description Table)
DSDT (Differentiated System Description Table)

DSDT stands for Differentiated System Description Table. It is a part of the ACPI specification and it supplies configuration information about a base system.

The DSDT comprises a system description table header, followed by a definition block. The definition block is encoded using ACPI Machine Language (AML), and unlike other definition blocks on the system, the DSDT definition block can not be unloaded since it provides the basic ACPI namespace scope that all other dynamic definition blocks can later add onto.

XSDT (Extended System Description Table)
FADT (Fixed ACPI Description Table)
FACS (Firmware ACPI Control Structure)
SBST (Smart Battery Table)
ECDT (Embedded Controller Boot Resources Table)
MADT (Multiple APIC Description Table)
SRAT (System Resource Affinity Table)

This table is used by NUMA (Non-Uniform Memory Access) aware operating systems to be able to allocate local memory to local threads on NUMA systems, e.g. on multi processor AMD Opteron systems. For a real NUMA system, "Node Interleave" in Opteron BIOSes has to be disabled, accordingly "SRAT" has to be enabled. Furthermore the operating system itself has to support NUMA as well. So far all x64 Windows Systems and Linux systems with a NUMA aware kernel are NUMA capable.

SLIT (System Locality Distance Information Table)

This optional SLIT (System Locality Information Table) describes the distances between all processors, memory controllers, and host bridges. Each module will be associated with a specific locality (could tie with the _PXM) which will be equivalent to an SMP node. The table will give units of distance between nodes. The units of distance will be relative to the SMP or intra-node distance. SMP distances will arbitrarily have a value of 10. There is a field in the table called Localities. Localities is the number of localities in the SLIT. It is an unsigned 64-bit integer. The locality indices for each locality range from 0 to Localities-1. The SLIT can be viewed as a matrix of distances, with row i of the matrix indicating the distance from locality i to every locality (including itself). Each table entry is a 1-byte unsigned integer. To get the distance from locality i to locality j, read the i*( Localities) + j entry in the matrix. Except for the distances from a locality to itself, each distance is stored twice in the matrix. What this means is that the diagonal elements of the matrix, the distances from a locality to itself, which are the SMP distances, are all given a value of 10. The distances for the non-diagonal elements are scaled to be relative to the SMP distance, so, for example, if the distance from locality i to locality j is 2.4 times the SMP distance, a value of 24 would be stored in table entry i*( localities)+ j and in j*( localities)+ i. If one locality is unreachable from another, a value of 255 (0xFF) will be stored in that table entry. A value of 0 has no meaning, and is reserved. Values 1 through 9 are also reserved. This will enable the operating system to enhance its ability to process the locality information to increase its performance on a NUMA system.

SLIC (Software Licensing Description Table)

This newly-released table is used by OEM versions of Windows Vista for activation by Royalty OEMs in order for the end-user to not have problems with activating, called SLP 2.0, or System-Locked Preinstallation 2.0. For activation to work, clients obtained through the OEM channels that have an ACPI_SLIC table in the system BIOS are required to have a valid Windows marker in the same ACPI_SLIC table. The appearance of the Windows marker is important for volume license customers who are planning to use Windows Vista volume-licensed media to re-image or upgrade OEM through the re-imaging rights provided in their volume license agreement. Not having the appropriate BIOS marker results in the following error or errors on these systems and prevents them from activating.

SSDT (Secondary System Descriptor Table)

Criticism

  • ACPI is a complex specification (over 600 pages long) that contains multiple components, including declarative tables, an imperative bytecode, and specific hardware components. Concerns have been repeatedly raised [3] that an implementation of ACPI has to run complex, untrusted and potentially buggy bytecode with full privileges, thus potentially making any system that implements ACPI unstable and/or insecure.
  • Where hardware is non-conforming to ACPI, but claims to be, the software interoperating with that hardware is faced with a dilemma: Either it can be written to be ACPI-compliant, thus risking problems with the not-entirely-compliant hardware, or it can deviate from the ACPI standard to accommodate the hardware quirks. That, however, is generally seen as undesirable from a software-engineering point of view, since the software would potentially have to be adapted for and tested with arbitrarily large numbers of hardware devices, which is precisely what standards such as ACPI are intended to avoid. Additionally, availability of compatible software does not provide the hardware manufacturer with an incentive to repair their compliance. This is a constant debate between "standards purists" and advocates of software that "simply works" with as much hardware as possible.

See also

This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the "relicensing" terms of the GFDL, version 1.3 or later.