Aug 21, 2007
How to ACPI in Linux
ACPI is the power specification which is an alternative to APM. For more detailed onformation on what ACPI is, please refer to: http://www.acpi.info/
--------------------------------------------------------------------------------
News
Check out this new "beta" page for DSDT tables: http://acpi.sf.net/dsdt/index.php
OK, fixed my Pres2701US BIOS table and booted (2.4.18 / acpi / dsdt) I found that the battstat_applet doesn't line up with what is in /proc. I edited the source code and now I see BAT1 through the applet.
Now if I can convince battstat_applet to see my 2nd battery...
Played with speedstep stuff (CPU performance) - I get 733MHz or 1000MHz
I'm still missing my Easy Access Keys (even after trying lineakd). I believe I need to play with grabbing the correct IRQ so I can get access to these extra keys (including the fn+F# keys).
Temperature anyone...
--------------------------------------------------------------------------------
Downloads
acpidump - http://people.freebsd.org/~takawata/pacpidump.tar.gz
iasl - http://www.intel.com/technology/iapc/acpi/downloads/iasl-linux-20030523.tar.gz
dsdt patch - http://dude.noc.clara.net/~faye/compaq2701ea/linux-2.4.18-acpi-20020709-dsdt.patch.bz2
ACPI download page - http://sourceforge.net/project/showfiles.php?group_id=36832
battstat_applet download - http://sourceforge.net/projects/battstat/
speedstep 0.1 - http://dude.noc.clara.net/~faye/compaq2701ea/speedstep-0.1.tar.gz
The following download is not needed but I list it here for completeness as ad.zip doesn't seem to be avaialble from phoenix anymore: http://www.manlug.mcc.ac.uk/ad.zip (254k)
Kernel - http://www.kernel.org
--------------------------------------------------------------------------------
Readings
This page - Hey, you're already here (http://www.cpqlinux.com/acpi-howto.html)
ACPI site at sourceforge - http://sourceforge.net/projects/acpi
acpi specification - http://www.acpi.info/index.html
faye's page - http://dude.noc.clara.net/~faye/compaq2701ea/index.html
CPU performance and CPU throttling - http://www.brodo.de/english/pub/acpi/proc/processor.html
--------------------------------------------------------------------------------
Mailing Lists
If you would like to sign up on one of the ACPI mailing lists then get list info and signup info here: http://sourceforge.net/mail/?group_id=36832
--------------------------------------------------------------------------------
Basic Steps to add ACPI and DSDT to your kernel
As a user do this:
mkdir /tmp/acpi && cd /tmp/acpi
cat /proc/acpi/dsdt > dsdt.dat (root power needed here)
build pacpidump.tar.gz (modify the Makefile to build on linux -- it has good comments and it is very short)
./pacpidump/acpidump > dsdt.asl (need root power here)
Note: It _may_ be possible to use iasl with the -d option to dump your table to .asl as well; however, one guy at the acpica ML who showed me this had the following to say:
"I have not checked actually if iasl is 'good' in order to disable the AML. It is a new feature, so that it has perhaps some bugs. I can not be sure.
Using pacpidump should be OK, but the version you point was updated, debugged, etc. under FreeBSD, and those changes are present only under FBSD, not the one you pointed."
Unfortunately there is nothing better to point to.
fix dsdt.asl (this is specific to your individual problem - see below for tips)
unpack iasl-linux-20020725.tar.gz
./iasl-linux-20020725/iasl -tc dsdt.asl (Compilation complete. 0 errors 0 warnings)
cat linux-2.4.18.tar.bz2 | bunzip2 | tar -xvf -
cd linux
zcat ../acpi-20020726-2.4.18.diff.gz | patch -p1 (looks clean) (from www.sf.net)
cat ../linux-2.4.18-acpi-20020709-dsdt.patch.bz2 | bunzip2 | patch -p1 (looks clean)
cp -a ../dsdt.hex drivers/acpi/tables/acpi_dsdt.c
follow standard kernel building procedures (http://www.cpqlinux.com/kernel.html)
--------------------------------------------------------------------------------
Adding ACPI and DSDT to your 2.4.19 kernel
Perform the following as a user:
Unpack the 2.4.19 kernel source and name the 2.4.19 directory
mkdir /usr/src/unpack
cd /usr/src/unpack
cat /tmp/linux-2.4.19.tar.bz2 | bunzip2 | tar -xvf -
(http://www.kernel.org/pub/linux/kernel/v2.4/)
mv linux-2.4.19 ../linux-2.4.19-acpi-dsdt
cd ../linux-2.4.19-acpi-dsdt
rmdir ../unpack
Apply the ACPI patch (acpi-20020821-2.4.19.diff.gz)
zcat /tmp/acpi-20020832-2.4.19.diff.gz | patch -p1
(http://sourceforge.net/project/showfiles.php?group_id=36832)
The results from patching should look very clean.
If including your own DSDT table, then patch osl.c (so it will include your dsdt table)
zcat /tmp/linux-2.4.18-acpi-20020709-dsdt.patch.bz2 | bunzip2 | patch -p1
(http://dude.noc.clara.net/~faye/compaq2701ea/linux-2.4.18-acpi-20020709-dsdt.patch.bz2)
This too should patch cleanly.
If including your own DSDT table, then insert your fixed one now
cp -a /tmp/dsdt.hex drivers/acpi/tables/acpi_dsdt.c
Now build your kernel as normal (http://www.cpqlinux.com/kernel.html)
edit the Makefile
Change "EXTRAVERSION = " (located at the top) to something like "EXTRAVERSION = -acpi-dsdt-20020905-1"
Increment this "EXTRAVERSION =" value each time you build a new kernel.
grab a default Red Hat kernel "config" file
cp ../linux-2.4/configs/kernel-2.4.7-10 arch/i386/defconfig
set up your new .config file
make mrproper
yes "" | make oldconfig
make sure acpi is turned on as static and not built as a module. Might be a good idea to turn off APM unless you know what you're doing.
make xconfig
Also, if you ran make mrproper, then it is a good idea to save and exit "make xconfig", even if you are not making any changes in "make xconfig" -- "make mrproper" removes some links that "make xconfig" needs to put back for you.
Now build your kernel and modules
make clean dep bzImage modules
Now install your kernel and modules
As root user do the following in this same directory (/usr/src/linux-2.4.19-acpi-dsdt)
make modules_install
Look at the value you put in your Makefile and use that value for the following entries: "cat Makefile | grep ^EXTRAVERSION"
cp -a arch/i386/boot/bzImage /boot/vmlinuz-2.4.19-acpi-dsdt-20020905-1
cp -a System.map /boot/System.map-2.4.19-acpi-dsdt-20020905-1
mkinitrd /boot/initrd-2.4.19-acpi-dsdt-20020905-1.img 2.4.19-acpi-dsdt-20020905-1
Be sure to edit /boot/grub/grub.conf or /etc/lilo.conf; if using LILO, then you must run /sbin/lilo after modifying /etc/lilo.conf
See http://www.cpqlinux.com/kernel.html for more details.
Also, once you boot on your new kernel, if you use VMWARE or a LinModem or any other similar add on that depends on the kernel you are running, then go ahead and set them up right after you boot while you still have your kernel source directory (usually this requires root power as well):
yes "" | /usr/bin/vmware-config.pl
yes "" | /usr/sbin/hsfconfig
I would recommend doing a dmesg right after boot to get the fewest messages possible:
cd /tmp
dmesg > dmesg.txt
Then start looking for errors, failures, unknowns, warnings, etc. Also check in /proc/acpi for the various components of interest to you.
Oh, and battstat probably needs patching, search this current web page for the battstat patch.
ACPI (Advanced Configuration & Power Interface)
With ACPI, the following capabilities are possible (assuming the operating system supports them):
ACPI must be supported by the computer motherboard, basic input/output system (BIOS), and the operating system. One of several power schemes can be chosen. Within a power scheme, the user can control the power to individual devices. In order for ACPI to work on your computer, your BIOS must include the ACPI software and the operating system must be ACPI-compatible. ACPI is designed to work with Windows 98 and with Windows 2000.
ACPI is in part a response to global concerns about energy conservation and environmental control. ACPI replaces Intel's SL technology and the more recent APM (Advanced Power Management) technology. Based on the collaborative effort of Hewlett-Packard, Intel, Microsoft, Phoenix, and Toshiba, ACPI moves away from power management that simply times out during inactivity to a more sophisticated demand-based power management. ACPI components collect information about power consumption from the computer and gives that information to the operating system. The operating system then distributes power to the different computer components on an as-needed basis. With ACPI, the computer can power itself down to a deep sleep state but still be capable of responding to an incoming phone call or a timed backup procedure. Another feature of ACPI is the "hibernation" mode. Before the computer goes into a deep sleep or hibernation, the contents of RAM are written to an image file and saved on the hard drive. When the computer is turned back on, the image file is reloaded, eliminating the need to reboot the system and open applications.
Aug 7, 2007
Window XP 전원 관리 기능
ACPI 호환 시스템에서는 운영 체제를 통해 전원을 관리, 감독 및 조정하기 때문에, 작업 중이 아닐 때에는 최소한의 전원만 소모하며 대기하다가 사용자가 필요할 때 즉시 사용할 수 있게 됩니다. APM 등과 같은 기존의 전원 관리 아키텍처에서는 운영 체제와 관련 없이 BIOS가 시스템 장치들의 전원 상태를 제어했습니다.
ACPI 사양과 호환되도록 설계된 장치 및 응용 프로그램은 시스템 전원의 상태에 따라 반응하거나 전원 상태 변경을 요청할 수 있습니다. 예를 들어 응용 프로그램이 동작 중이거나, 마우스 등과 같은 장치의 입력이 있을 경우에는 그 컴퓨터나 장치가 사용 중이라는 사실이 운영 체제에게 전달됩니다. 그러면 운영 체제의 전원 정책 관리자는 시스템에 모든 전원을 할당합니다. 그렇지 않은 경우 운영 체제는 컴퓨터를 저전력 모드 혹은 절전 모드로의 전환을 시도하게 됩니다. 예를 들어 시스템이 대기 모드에 있을 때 팩스 모뎀이 최소의 전력만 소비하며 대기하고 있다가 전화가 울리면 시스템이 작동하여 팩스를 수신할 수 있게 됩니다. 그리고 더 이상 필요 없으면 시스템은 다시 대기 모드로 돌아가는 것입니다.
전원 관리 기능
Windows XP에는 다음과 같은 전원 관리 기능들이 포함되어 있습니다.
전원 효율성: 특히 휴대용 컴퓨터의 전원 효율성을 향상시켜 주는 기능으로, 프로세서 성능 제어 기술, 배터리 전원을 켤 때 LCD 화면을 흐리게 하는 기능, 그리고 뚜껑을 닫으면 휴대 컴퓨터의 디스플레이 패널이 꺼지도록 하는 기능 등이 포함됩니다.
시스템 깨우기 지원:컴퓨터를 사용하지 않으면 꺼진 것처럼 보이지만 전화가 온다거나 네트워크 요청이 들어오는 등의 시스템 깨우기 이벤트에 반응을 할 수 있습니다.
전원 기본 설정을 할 수 있는 UI: 제어판의 전원 옵션에서는 배터리 사용 옵션을 지정하고 저전력 경고를 설정하는 등 전원 구성을 선택하거나 만들어서 사용자 기본 설정을 할 수 있는 UI를 제공합니다. UPS(무정전 전원 공급 장치)가 장착되어 있으면 전원 옵션에서 UPS도 관리할 수 있습니다.
장치별 전원 정책 소유권: Windows의 전원 관리 기능을 사용하도록 설계된 장치들은 모두 전원 관리에 참여할 수 있습니다. 이런 장치들은 사용 중이 아닐 때에는 운영 체제 쪽에 장치를 저전력 상태로 전환시키도록 요청하여 전원을 절약합니다.
응용 프로그램의 전원 관리 기능: Windows의 전원 관리 기능을 사용하도록 설계된 응용 프로그램은 운영 체제에 대해 절전 모드로 전환되지 않도록 지정합니다. 예를 들어 화면에 표시되기는 하지만 처리 작업이 많지 않은 프레젠테이션 소프트웨어의 경우, 운영 체제에 대해 모니터를 대기 모드로 전환시키지 않도록 요청할 수 있습니다.
마더보드에 최상급 전력관리 제공하는 ACPI 제어
이 사양은 새로운 전력관리 기술들이 운영체제 및 하드웨어 내에서 독립적으로 발전함으로써 서로 협력해 나갈 수 있도록 해준다. PC 실버박스는 5V, 3.3V 및 12V를 제공하지만, 마더보드는 널리 사용되는 VRM/VRD CPU 전압 레귤레이터 말고도 추가적인 전압들을 필요로 한다. 여기서는 대부분의 마더보드 전압들(5V 듀얼, 3.3V 듀얼, DDR 메모리 전압(VDDQ 및 VTT-DDR2) 그리고 ACPI 하의 VTT-CPU/IO와 같은)을 효율적으로 제공하는 방법을 살펴보자.
동작 상태 S0(PWR_OK=1)에서는 실버박스가 제공하는 모든 전압들과 메인(3.3V, 5V 및12V) 그리고 5V 대기전압은 물론 마더보드 상에서 지엽적으로 생성되는 다른 전압들도 있다. S3(S3#는 S3의 “반대”이다)나 RAM의 중지는 휴면 상태로서, 이 때는 메인이 오프 상태이고 메모리는 저전력의 자동 리프레시나 자가 리프레시 상태에 놓인다. 이 상태에서 마더보드 상에 남아 있는 잔류 전압들은 실버박스로부터 오는 5V 대기 파워서 플라이 라인으로부터 전력을 얻는다.
S5나 Soft Off는 사실상의 오프 상태로서, 어떠한 시스템 콘텍스트도 유지되지 않지만, 어느 정도의 잔류 전력은 아직 남아있어 동작 상태 S0로 전환할 수 있다.
마더보드의 전력 공급
그림 1은 마더보드에 전력을 공급하기 위한 전략을보여준다. CPU와 그래픽은 동작 상태에서만 전력을 받지만, PCI Express, I/O 채널 허브(ICH8) 및 DDR 메모리와 같은 나머지 기능들은 ACPI 하에서 최소한의 전력 소모로 기능을 수행하도록 해주는 메인 및 대기 전원의최상의 조합을 통해 얻는전압들에 의해 전력을 공급 받는다.
그림 1의 스틱 다이어그램에 있는 스위치 심볼들은 진정한 MOSFET 스위치(SSx)나 선형 레귤레이터(SLx) 또는 스위칭 레귤레이터(SWx)를 나타낸다. S3 상태에서 5V 대기 상태는 스위치 SS1(p-채널 MOSFET 트랜지스터)을 통해 DDR 메모리에 전력을 공급한다. 이 때 SS2는 열려 있어 5V 메인을 차단한다. 그래서 이 중간 전압을 5V 듀얼이라고 한다. 이어서 벅 컨버터 SW1이 5V를 1.8V로 낮추며, 필요한 전압이 DDR 메모리 모듈에 전력을 공급한다. 이 1.8V는 선형 레귤레이터 SL1과 SL2를 통해서 DDR 메모리를 위한 터미네이션 전압(0.9V)과 CPU를 위한 터미네이션 전압(1.2V)을 생성하는 데도 사용된다. S5 상태에서 벅 컨버터 SW1은 전력이 끊겨 DDR 메모리로부터 보조 전력을 끌어오게 된다. 이 상태에서는 3.3V 듀얼만이 살아 있어 5V 대기 상태로부터 선형 레귤레이터 SL3를 통해 5V 대기 상태로부터 전력을 받게 되며 스위치 SS3는 열린 상태가 되어 5V 메인으로부터 전력을 차단하게 된다.ACPI 컨트롤러
ACPI 하의 모든 전압들은 Fair-child사의 FAN5068과 같은 하나의 다기능 컨트롤러 칩을 몇 개의 이산형 트랜지스터들과 함께 사용하여 생성 및 제어할 수 있다.
이 컨트롤러의 중심에는 ACPI 제어 장치를 구현하는 로직 블록은 물론, 모든 전압 조정 회로가 자리잡고 있다. 그림 1의 어플리케이션 회로는 DDR2 메모리에 맞춤화 되어 있다. 기존의 DDR에 비해 DDR2 파워서플라이 VDDQ는 2.5V로부터 1.8V로 감소되었으며, VTT는 1.25V로부터 0.9V로 감소되었다. 덕분에 DDR2 메모리는 1세대 DDR보다 훨씬 적은 전력을 소모하게 되었다.
예를 들어, DDR2-533은 DDR-400에 비해 절반 정도의 전력을 소모한다. DDR2의 터미네이션 방식은 DDR의 경우와는 다소 다르며, 터미네이션 저항기들이 마더보드가 아니라 칩에 있다. 그러나 외부 VTT 터미네이션 전압이 여전히 필요하다. DDR2의 전력소모 수준이 훨씬 낮기 때문에 VTT에 선형 레귤레이터를 사용할 수 있는데, 이는 단순성과 비용이 전력소모를 최소화 시키는 문제보다 중요한 고려 사항일 경우 특히 그렇다. FAN5068은 DDRx 메모리 시스템에 전력을 공급하는 데 필요한 모든 회로들을 갖고 있다. 이 단일 IC에는 VDDQ를 위한 스위처 컨트롤러와 VTT 터미네이션 전압을 위한 선형 컨트롤러가 둘 다 통합되어 있다. VDDQ를 위한 스위처는 5V 듀얼로 동작하며, VTT를 위한 선형 레
귤레이터는 VDDQ 전력으로 동작한다. FAN5068은 두 개의 외부 스위치인 SS2 및 SS3에 필요한 제어 로직도 제공하는데, 이 스위치들은 5V 듀얼 서플라이 전압은 물론 CPU를 위한 1.2V 터미네이션의 구현에 사용되는 선형 레귤레이터도 구현한다.
최종적으로, 그림 2는 FAN5068 ACPI/DDR 파워서플라이에 상응하는 마더보드 영역을 보여준다. 특징적인 정사각형 모양(24핀, 5x5 MLP 패키지)을 보여주는 컨트롤러 IC는 백색 고리 모양으로 강조된 부분이다. 컨트롤러 IC 부근에서 이산형 트랜지스터와 수동형 부품들, 그중에도 특히 덩치 큰 1.8μH의 인덕터와 출력 전해 콘덴서가 눈에 띈다. CPU에는 별도의 VRD(마더보드에 있는 전압 레귤레이터)가 필요하다. 예를 들어, Fairchild사의 칩셋인 FAN5019 PWM 컨트롤러와 FAN5009 드라이버 IC들이 VRM10 클래스의 마더보드에 권장되며, FAN6522A와 같은 벅 컨버터는 그래픽 카드에 전력을 공급하게 된다.
ACPI 전력관리(선형 레귤레이터와 스위칭 레귤레이터 그리고 포화 패스 트랜지스터의 조합을 솜씨 좋게 사용한 효과적인 전압 조정 방식들의 보드상 구현물과 함께)는 최소한의 비용으로 최적의 전력분배와 낮은 전력소모를 구현하는 최상급의 전력관리 방식을 제공한다. 여기서 살펴본 예제에서 ACPI 하의 모든 전원들은 하나의 다기능 IC에 의해 제어되며, 마더보드 전체에 전력을 공급하기 위해서는 다른 레귤레이터 컨트롤러 IC가 두 개만 더 있으면 된다.
저전력 리눅스 커널, dvs
1. voltage & frequency scaling : CPU 사용 정도에 따라서 전압과 클럭을 바꾸기
http://www.research.ibm.com/arl/projects/papers/DPM_V1.1.pdf http://sourceforge.net/projects/dynamicpower/
2. idle 상태일 때 CPU에 있는 저전력용 halt instruction을 사용하기
3. 사용하지 않는 칩의 전원을 끊거나 저전력 모드로 전환하기.
i386 환경이라면 ACPI를 통해서 할 수 있고,
http://sourceforge.net/projects/acpi
각각의 프로세서에서 어떻게 할 수 있는지에 대해서는 인터넷을 찾아보세요.