home > linux > firmware > dsdt > dsdt-debugging

DSDT Debugging

33 | 20 Nov 2016

Extract the firmware DSDT and SSDT tables

The DSDT table can be extracted from the sysfs at;

sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml

To complement the DSDT, there are also SSDT tables, these should be extracted also regardless of if you wish to also override the SSDT's. On my current machine there are a total of eight SSDT deffinition blocks, each of these serve a purpose for subjects like WMI, TPM, VGA.

Extracting the SSDT alongside the DSDT will aid the depompiler in correctly defining the external references, in particular their data types.

sudo cat /sys/firmware/acpi/tables/SSDT1 > ssdt1.aml
sudo cat /sys/firmware/acpi/tables/SSDT2 > ssdt2.aml
sudo cat /sys/firmware/acpi/tables/SSDT3 > ssdt3.aml
sudo cat /sys/firmware/acpi/tables/SSDT4 > ssdt4.aml
sudo cat /sys/firmware/acpi/tables/SSDT5 > ssdt5.aml
sudo cat /sys/firmware/acpi/tables/SSDT6 > ssdt6.aml
sudo cat /sys/firmware/acpi/tables/SSDT7 > ssdt7.aml
sudo cat /sys/firmware/acpi/tables/SSDT8 > ssdt8.aml

Decompile the firmware tables

Use iasl to decompile the DSDT with a reference to the various SSDT tables.

iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml

this will produce a human readable file dsdt.dsl, you can repeat the process to attain dsl files for the SSDT if you intend to override or which to review them.

Adding Debug Statements

Within the DSDT you can add debug statements, this will be printed out to syslog when parsed. Typical places you may want to add debug statements will be in the _Q[0-9] methods. The Q[0-9] methods are used for brightness events and similar.

Also button methods can be useful to debug these can be located by searching for PNP0C0C, lid methods with PNP0C0D, sleep methods by searching for PNP0C0E, and host bridge methods by searching for PNP0A03.

Example code change:

    Method (_BCM, 1, NotSerialized)  // _BCM: Brightness Control Method
    {
        Store("Debug: _SB.PCI0.VGA.LCD._BCM", Debug)
        Store(Arg0, BRTL)
        Store("Debug: IDPC", Debug)
        Store(IDPC, Debug)
        If ((IDPC == 0x0614))
        ...

Override the current DSDT

override the DSDT in the kernel, whilst doing so make sure the kernel config option "CONFIG_ACPI_DEBUG" is enabled.

Enable DSDT Debug

Once the DSDT has been overriden there are two methods to enable the debug methods.

Option 1:

echo 1 | sudo tee /sys/module/acpi/parameters/aml_debug_output

This option is ideal if you do not need boot time debug, and wish to enable and disable the debugging messages quickly.

Option 2:

add the command line kernel parameters to grub:

acpi.debug_layer=0x10000000 acpi.debug_level=0xffffffff

These boot options will enable debug messages from ACPI kernel modules aswell as from the DSDT. There are various debug layes and levels, you can cat the following files to see all the possibilities;

/sys/module/acpi/parameters/debug_layer
/sys/module/acpi/parameters/debug_level

Tail the Logs

you should now see output similar to the following:

[    8.994062] [ACPI Debug]  "Debug: IDPC"
[    8.994108] [ACPI Debug]  0x000038ED

Post a Comment