wiki:Scripts/AcpiDsdtSearch

ACPI DSDT searching for methods

A directory containing a number of disassembled DSDT tables, usually produced using iasl -d.

Create mawk script find-EC-REG-Notify.mawk:

BEGIN {
 EC=0;
 EC_brace_count=0;
 REG=0;
 REG_brace_count=0;
}
/Device \(EC\)/ {
 # found the embedded controller
 # print "Found EC";
 EC=1;
}

EC==1 && REG==0 && /{/ {
 EC_brace_count++;
 # print "EC brace:" EC_brace_count;
}
EC==1 && REG==0 && /}/ {
 EC_brace_count--;
 # print "EC brace:" EC_brace_count;
 if (EC_brace_count == 0) {
 EC=0;
 }
}

EC==1 && /Method \(_REG/ {
 # found the _REGion control handler
 # print "Found _REG"
 REG=1;
}
EC==1 && REG==1 && /{/ {
 REG_brace_count++;
 # print "REG brace:" REG_brace_count;
}
EC==1 && REG==1 && /}/ {
 REG_brace_count--;
 # print "REG brace:" REG_brace_count;
 if (REG_brace_count == 0) {
 REG=0;
 }
}

EC==1 && REG==1 && /Notify \(/ {
 # found a Notify
 offset = index(FILENAME, ".dsl");
 print substr(FILENAME, 1, offset-1);
 # "\t" substr($0, offset, length - offset + 1);
}
END {
}
for dsl in $(ls -1 *.dsl); do mawk -f find-EC-REG-Notify.mawk  $dsl; done | sort | uniq | while read line; do echo -n "$line, "; done