Shell Script to List ACPI tables

ACPI (Advanced Configuration and Power Interface) defines platform-independent interfaces for hardware discovery, configuration, power management and monitoring, and these tables contain lots of useful information for low-level programmers such as myself.

Here is a short shell script which I clobbered together a few days ago to list out the ACPI tables on a system together with a short description of each table where possible.

#   Author:  Finnbarr P. Murphy
#     Date:  January 2015
#  Purpose:  List ACPI tables
#  License:  BSD

TMP1=$(mktemp -u -p /var/tmp/ acpiXXXXXX)
TMP2=$(mktemp -u -p /var/tmp/ acpiXXXXXX)
TMP3=$(mktemp -u -p /var/tmp/ acpiXXXXXX)

cat << EOF | sed -e 's/^[ t]*//' > $TMP1
    APIC, Multiple APIC Description
    BERT, Boot Error Record
    BGRT, Boot Graphics Resource
    BOOT, Simple Boot Flag
    CPEP, Corrected Platform Error Polling
    CRST, Core System Resources
    DBG2, Micosoft Debug Port2
    DSDT, Differentiated System Description
    ECDT, Embedded Controller Boot Resources
    EINJ, Error Injection
    ERST, Error Record Serialization
    FACP, Fixed ACPI Description
    FACS, Firmware ACPI Control Structure
    FADT, Fixed ACPI Description
    GTDT, Generic Timer Description
    HEST, Hardware Error Source
    HPET, High Precision Event Timer
    MADT, Multiple APIC Description
    MCFG, Memory Configuration
    MSCT, Maximum System Characteristics
    MSDM, Microsoft Data Management
    PMTT, Platform Memory Topology
    PSDT, Persistent System Description
    RASF, RAS Feature
    RSDP, Root System Description Pointer
    RSDT, Root System Description
    SBST, Smart Battery
    SLIC, Software Licensing Description
    SLIT, System Locality Distance Information
    SPCR, Serial Port Console Redirection
    SRAT, System Resource Affinity
    SSDT, Secondary System Descriptor
    XSDT, Extended System Description

# get the list of ACPI tables that Linux knows about
ls -1 /sys/firmware/acpi/tables | sed '/dynamic/d' > $TMP2
ls -1 /sys/firmware/acpi/tables/dynamic >> $TMP2
sort $TMP2 > $TMP3

# output each table with a description where possible
awk -F, 'NR == FNR { a[$1] = $2; next }
             desc = a[substr($1,1,4)]
             if (desc == "") {
                 desc = " Unknown ACPI Table"
             printf "%st-%s Tablen", $1, desc
         }' $TMP1 $TMP3

rm -f $TMP1 $TMP2 $TMP3

exit 0

The above code should be self-explanatory to most experienced Linux administrators who are familiar with bash and awk.

Here is the output for my current system:

$ ./listapci
APIC	- Multiple APIC Description Table
BGRT	- Boot Graphics Resource Table
DSDT	- Differentiated System Description Table
FACP	- Fixed ACPI Description Table
FACS	- Firmware ACPI Control Structure Table
HPET	- High Precision Event Timer Table
MCFG	- Memory Configuration Table
SSDT1	- Secondary System Descriptor Table
SSDT2	- Secondary System Descriptor Table
SSDT3	- Secondary System Descriptor Table
SSDT4	- Secondary System Descriptor Table
SSDT5	- Secondary System Descriptor Table
SSDT6	- Secondary System Descriptor Table

The list of ACPI tables included with the script contains the most common ACPI tables up to revision 5 of the ACPI specification. It does not include some of the more uncommon tables. You can easily add those yourself if you are so inclined.

Comments are closed.