15 Overriding the DSDT
15.1 How it works
The DSDT is one of several tables that is exported by the ACPI
BIOS parts of your system from ROM to RAM.
The BIOS tells the Operating System where to find these tables
and loads/uses them.
The DSDT table actually is code that can be executed by the Operating
System and the BIOS to communicate with each other.
This code (the DSDT) is byte-code (similar to compiled Java code) that
is interpreted by the kernel. It can easily be extracted, disassembled,
modified (errors corrected, debug info attached, ...) and compiled to
byte-code again. You can attach the modified DSDT to your initrd/initramfs
(the modular part of the kernel that is loaded very early at boot time).
After the BIOS exported the ACPI tables to RAM and tells the kernel where to
find them, the kernel can replace e.g. the DSDT with your modfied/corrected
one. Having said this, two points should be very important for you:
- Your BIOS Rom is not flashed. It's just replaced in RAM and
booting another kernel/OS (without a modified DSDT) will
use your manufacturer's DSDT as it was shipped.
- The DSDT code is partly generated by your BIOS.
If you add or remove memory you need to repatch (extract
the original DSDT, modify it, ...) your changes.
For some distributions you need a kernel patch to be able to do that.
(not needed for most distributions like
current versions of SUSE Linux, Ubuntu, Mandrake and others)
You find the patch here: http://gaugusch.at/kernel.shtml
15.2 How to check your DSDT for errors and debugging it
You can disassemble the byte-code of your DSDT. You then
have a C-like bunch of functions that were exported by your BIOS.
You can modify and add debug statements to it, recompile it and
let the kernel override the one exported by BIOS with your
modified/fixed one. The pmtools package has to be installed for this.
You do this by:
- Extract all your ACPI BIOS tables by e.g.: acpidmp >/tmp/acpidmp
- Extract the DSDT from the tables: acpixtract dsdt /tmp/acpidmp >/tmp/dsdt
- Disassemble the dsdt: iasl -d /tmp/dsdt
- You now have a human readable C like file(dsdt.dsl) you can edit.
- You can recompile it by: iasl -sa dsdt.dsl
- Often you now get obvious compile errors -> try to fix them.
This is the time where you should have a look at the ACPI specification for help.
See http://www.acpi.info/ to download the newest version.
- You can add e.g. debug statements that are written to syslog if the code
is executed by adding lines like: Store ("Read battery", Debug).
Be aware that your kernel must have CONFIG_ACPI_DEBUG set and you have to set the
kernel ACPI debug values higher (see ACPI_Debugging). This is not the case
for e.g. SUSE kernels for verions 9.3 and higher.
- After successfully compiling your modified DSDT, c
copy the DSDT.aml file where you want to (recommended:
/etc/DSDT.aml). Edit /etc/sysconfig/kernel and modify the
path to a DSDT variable where you copied your compiled
DSDT (e.g. /etc/DSDT.aml). Run mkinitrd (located in the
mkinitrd package). Everytime you reinstall your kernel and
use mkinitrd to create a initrd, your DSDT will be included
and loaded at boottime.
15.3 Finding and Adding an already fixed DSDT
Find a DSDT for your laptop under:
http://acpi.sourceforge.net/dsdt/tables/
In the SUSE Linux distribution for example you can override
your DSDT by:
- Download the table for your machine. Be sure that it is
unzipped and compiled (normally ending on AML [ACPI Machine
Language], if so go to step 3.).
- If it is ending on ASL (ACPI Source Language) , you still
have to compile the table using the iasl program located in
the pmtools package. Compile the file: iasl -sa XXX.asl
You also find the newest version of iasl (Intel ACPI
compiler) under:
http://developer.intel.com/technology/iapc/acpi/downloads.htm
- Copy the DSDT.aml where you want to (recommended:
/etc/DSDT.aml) Edit /etc/sysconfig/kernel and modify the
path to a DSDT variable where you copied your compiled
DSDT (e.g. /etc/DSDT.aml). Run mkinitrd (located in the
mkinitrd package). Everytime you reinstall your kernel and
use mkinitrd to create a initrd, your DSDT will be included
and loaded at boottime.