获取ACPI TABLE的方法
1. 首先要安装acpidump和iasl命令
有的机器上需要安装pmtools才可以。1
2
3 sudo apt-get install acpidump
sudo apt-get install iasl
sudo apt-get install pmtools
2. 导出ACPI的数据。
1 | sudo cat /proc/acpi/dsdt > dstd.dat |
或者1
sudo cat /sys/firmware/acpi/tables/DSDT > /tmp/dsdt.dat
如果找不到该文件可以使用下面的命令:1
sudo acpidump > acpi.dat
3. 分离各表格数据,会生成多个数据文件。
1 | acpixtract -a acpi.dat |
4. 反汇编DSDT.dat
1 | iasl -d DSDT.dat |
5. 重新编译DSL
根据需要修改DSDT.dsl文件,然后重新编译该文件,会生成DSDT.aml和DSDT.hex两个文件。1
2
3
4
5
6
7
8
9 iasl -tc dsdt.dsl
Intel ACPI Component Architecture
ASL Optimizing Compiler version 20100528 [Oct 15 2010]
Copyright (c) 2000 - 2010 Intel Corporation
Supports ACPI Specification Revision 4.0a
......................................................
ASL Input: DSDT.dsl - 8762 lines, 320704 bytes, 3778 keywords
AML Output: DSDT.aml - 39328 bytes, 780 named objects, 2998 executable opcodes
Compilation complete. 0 Errors, 41 Warnings, 0 Remarks, 988 Optimizations
6. 更新DSDT的方法。
其一(没有测试过,不知道能否成功):
使用新的dsdt.aml代替BIOS中的版本:1
2
3cp /boot/initrd.img-2.6.20-16-generic /boot/initrd.img-2.6.20-16-generic-bak
sudo cp dsdt.aml /etc/initramfs-tools/DSDT.aml
sudo update-initramfs -u -k all其二(需要安装acpiexec,为找到)
1
2
3iasl -sa DSDT.dsl # e.g. recompile a modified, disassembled DSDT for
initramfs inclusion (see later)
acpiexec DSDT.dat # parse, interpret and load a DSDT in userspace其三: 这个方法需要重新编译内核。
首先将DSDT.hex文件复制到内核源码的include目录下。1
cp DSDT.hex $SRC/include/
然后修改内核配置文件.config
1
2
3CONFIG_STANDALONE=n
CONFIG_ACPI_CUSTOM_DSDT=y
CONFIG_ACPI_CUSTOM_DSDT_FILE="DSDT.hex"重新编译,更新内核,然后启动,可以在dmesg中看到
1
2
3
4[ 0.000000] ACPI: Override [DSDT- CDV-TPT], this is unsafe: tainting kernel
[ 0.000000] Disabling lock debugging due to kernel taint
[ 0.000000] ACPI: DSDT @ 0x7f378010 Table override, replaced with:
[ 0.000000] ACPI: DSDT c0f0f140 0703F (v02 Intel CDV-TPT 00000000 INTL 20091214)就说明DSDT已经被替换成修改过的了。
7. 打开CONFIG_ACPI_DEBUG
在DSDT中添加LOG。 首先应该打开CONFIG_ACPI_DEBUG=y。
acpi.debug_level= ACPI_LV_DEBUG_OBJECT,
acpi.debug_layer= ACPI_TABLES | ACPI_NAMESPACE,
使用将想要的变量或者字符串赋值给Debug即可。
(Store (AAAA, Debug)