Recently, I am interested in Linux power management. I just want to learn about power management. This is not the case. What are the similarities and differences between APM and ACPI power management solutions? The following are all from the Web blog posts. Of course, I have made some preparations.
I. APM deficiency and ACPI generation
APM is short for advanced power management. It is a BIOS-based system power management solution, it provides CPU and peripheral power management and determines when to switch the device to a low-power mode through device operation timeout settings. The latest version is 1.2. Compared with versions 1.0 and 1.1, the latest version of APM allows the operating system to define management practices. The actual execution actions are performed by the BIOS.
APM Power status includes: Ready, standby, suspend, sleep, and off.
However, this power management mode is mainly implemented by BIOS, so there are some defects, such as excessive dependence on bios and incompatibility between old and new BIOS, and cannot judge whether the power management command is initiated by the user or by the bios, and does not support some new hardware, such as USB and 1394. Main disadvantages include:
1. Because APM-based BIOS has its own power management solution, there is a lack of consistency between the computer and the computer. Every BIOS developer must carefully maintain their own apm bios code and functions.
2. The reason why the system is suspended is unknown. Whether the user presses the sleep button, or the BIOS determines that the system is idle, or the battery voltage is too low, the APM information is unknown, but windows must know the reason for suspension, even if the system is not idle.
3. BIOS does not know what the user is doing. It only monitors the interruption and I/O ports to guess the user's activity. Sometimes, the BIOS will make the system completely messy. When the system is not idle, the system will be suspended or when the system is idle, but it will not be suspended.
4. Earlier versions of bios apm (1.0 and 1.1) do not provide any system performance information. If the system supports sleep, you only need to try to transfer the system to sleep mode. If the BIOS does not support sleep mode, the system will crash. The bios apm 1.2 solves this vulnerability.
5. the BIOS has no idea about the USB device, the computer accessory card and the ieee1394 device. As a result, when the above devices are not idle, the BIOS considers the system to be idle, causing a conflict, make these devices unavailable or the system crashes.
Because of the above limitations of APM, ACPI came into being.
The full name of ACPI is advanced configuration Power Interface (Advanced Configuration Power Interface). ACPI is released to solve the defects of APM. It defines many new specifications:
1. ACPI combines the existing power Management BIOS code, APM application programming interface, pnp bios application programming interface, and multi-processor specification form into a new power management and configuration interface specification.
2. ACPI allows the operating system (not the BIOS) to control power management, which is different from APM.
3. The ACPI standard defines hardware registers, BIOS interfaces (including configuration tables, control methods, and motherboard device lists and configurations), power status of systems and devices, and ACPI thermal models.
4. The code supported by BIOS is not written in assembly language but in AML (ACPI machine language, ACPI machine language. BiOS cannot determine the policy or timeout for power management or resource management.
5. all devices using the ACPI system can communicate with each other to understand their usage and are controlled by the operating system. The operating system knows the running system status well, therefore, the operating system is in the optimal position for executing power management.
Ii. ACPI Introduction
ACPI indicates the Advanced Configuration and power management interface ). For Windows 2000, ACPI defines a new working interface between windows, bios, and system hardware. These new interfaces include mechanisms that allow Windows 2000 to control power management and device configuration.
Windows 2000 has a power management function, which enables the system to enter the "Sleep" state with low power consumption, such as waiting and sleep, to control the power consumption of the computer. In Windows 2000, you can "wake up" the system again when you press the power button, and the system enters the running status immediately.
ACPI (Advanced Configuration Management) is a new type of power management specification proposed by Intel/Microsoft/toshba (Intel, Microsoft, and Toshiba) in 1997, with the intention of giving the system, not the bios, full control of power management, this makes the system more energy-efficient.
Its features mainly include: the immediate start function is provided, that is, after the boot can be immediately restored to the status when the previous shutdown, the optical drive, soft drive and hard drive will automatically turn off the power when not in use, it can be switched on again when it is in use. It supports both plug-and-unplug and change at any time when it is powered on.
ACPI supports three power-saving methods:
1. the standby display is automatically powered off, but the host is powered on. At this time, you can press any key to restore the original state.
2. The suspend to ram is suspended to the memory. The system stores the current information in the memory. Only the memory and other key components are powered on. At this time, the computer is in a high power-saving state. Press any key, the computer quickly restores the Information read from the memory to its original state.
3. (suspend to disk is suspended to the hard disk) the computer will automatically shut down and store the current data on the hard disk before shutdown. The computer will not need to start the system the next time you press the key to boot, read data directly from the hard disk to restore the original state.
ACPI provides the following functions:
1. You can enable the peripherals to switch at a specified time;
2. Users who use laptops can specify that the computer enters the low-power state at low voltage to ensure that important applications run properly;
3. The operating system can reduce the clock frequency when the application requires less time;
4. The operating system can allocate energy to peripherals and boards based on their specific needs;
5. When no one uses a computer, the computer can enter sleep state, but some communication devices can be enabled;
6. The plug-and-play device can be controlled by ACPI during insertion.
However, ACPI is the same as other power management methods. to enjoy these features, you must have software and hardware support. In terms of software, Windows 98 supports (but not all, STD is disabled, and parameters are forced to be enabled for setup.exe, but there are many bugs). Windows 2000 provides comprehensive support for ACPI; hardware is troublesome, in addition to supporting ACPI for peripherals such as the motherboard, video card, and nic, the power supply of the chassis is also required. When the power supply provides a 5 V voltage to the motherboard, it must also make the current stable at more than 720 mA, so that it can achieve computer "Sleep" and "wake up ".
There are six ACPI statuses: S0 to s5. They represent the following meanings:
S0 -- in fact, this is our normal working state. All devices are fully open, and the power consumption generally exceeds 80 W;
S1 -- also known as pos (power on suspend = standby). In this case, in addition to disabling the CPU through the CPU clock controller, other components still work normally, and the power consumption is generally below 30 W; (In fact, some CPU cooling software uses this working principle)
S2-the CPU is stopped and the bus clock is disabled, but other devices are still running;
S3 -- this is the familiar STR (suspend to ram). At this time, the power consumption cannot exceed 10 W;
S4 -- also known as STD (suspend to disk), when the system master power is off, but the hard disk is still charged and can be awakened;
S5 -- this state is the most simple, that is, all the devices, including the power supply, are shut down, and the power consumption is 0.
What we use most frequently is the S3 status, that is, the suspend to Ram (suspended to memory) status, STR for short. As the name suggests, STR stores all the operating status data before the system enters STR into the memory. In the STR state, the power supply continues to power the most necessary devices, such as memory, to ensure that data is not lost, while other devices are in the off state, and the power consumption of the system is extremely low. Once we press the power button (host power switch), the system will be awakened and the data will be immediately read from the memory and restored to the working status before Str. Memory read/write speed is extremely fast, so we feel that it takes only a few seconds to enter and exit the STR state; and S4 status, that is, STD (suspended to the hard disk) the principle is the same as that of STR, except that the data is stored on the hard disk. Because the read/write speed of the hard disk is much slower than the memory, it is not as fast as Str. The advantage of STD is that it can be implemented only through software. For example, Windows 2000 can implement STD on hardware that does not support Str.
3. APM and ACPI supported by Linux
For two different standards of APM and ACPI, the Linux Kernel provides two different modules for power management, namely, APM and ACPI. Note that APM and ACPI are two conflicting modules. Users can only load one of them at a time. If they find that one of them has been loaded when loading, it will automatically exit.
This article introduces Linux's support for power management:
Http://www.ibm.com/developerworks/cn/linux/l-power/
You can first take a look at the knowledge, and then study in depth.
Http://www.novell.com/documentation/suse91/suselinux-adminguide/html/ch09s03.html#sec:pmanage.probs
This URL introduces the ACPI interface for upper-level user space and the daemon program acpid.
Reference:
1. http://hi.baidu.com/kunlaurel/blog/item/dfe12e0d419618e6ab6457ad.html
2. http://hi.baidu.com/yanyulou/blog/item/f56e5143dec9d3129313c6f1.html
3. http://hi.baidu.com/tian___tian/blog/item/37ec77c7bc8e1d1d9d163d08.html
4. http:// OS .51cto.com/art/201006/206488.htm