Yegor Timoshenko | c2e4941 | 2018-10-07 01:58:27 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Stefan Reinauer | e55eb97 | 2010-12-04 20:50:39 +0000 | [diff] [blame] | 2 | # |
Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 3 | # SPDX-License-Identifier: GPL-2.0-only |
Stefan Reinauer | e55eb97 | 2010-12-04 20:50:39 +0000 | [diff] [blame] | 4 | |
| 5 | rm -rf out |
| 6 | mkdir out |
Patrick Georgi | 472efa6 | 2012-02-16 20:44:20 +0100 | [diff] [blame] | 7 | |
Stefan Reinauer | e55eb97 | 2010-12-04 20:50:39 +0000 | [diff] [blame] | 8 | # walk through all ACPI tables with their addresses |
Patrick Georgi | 472efa6 | 2012-02-16 20:44:20 +0100 | [diff] [blame] | 9 | # example: |
Stefan Reinauer | e55eb97 | 2010-12-04 20:50:39 +0000 | [diff] [blame] | 10 | # RSDT @ 0xcf6794ba |
Patrick Georgi | 472efa6 | 2012-02-16 20:44:20 +0100 | [diff] [blame] | 11 | # we can not just dump the tables by their names because some |
Stefan Reinauer | e55eb97 | 2010-12-04 20:50:39 +0000 | [diff] [blame] | 12 | # machines have double ACPI tables |
| 13 | |
| 14 | acpidump | grep "@ 0x" | while read line |
| 15 | do |
| 16 | NAME=$( echo `echo $line|cut -f1 -d@` ) |
| 17 | FNAME=$( echo $NAME | sed s/\ /_/g |sed s/\!/b/g ) |
| 18 | ADDR=$( echo `echo $line|cut -f2 -d@` ) |
| 19 | if [ "${!FNAME}" == "" ]; then |
| 20 | eval $FNAME=0 |
| 21 | else |
| 22 | eval $FNAME=$(( ${!FNAME} + 1 )) |
| 23 | fi |
| 24 | printf "Processing table \"$NAME\" at $ADDR ... " |
| 25 | printf "${!FNAME} tables of that kind found before.\n" |
| 26 | |
| 27 | # acpidump -s ${!FNAME} --table "$NAME" > out/$FNAME-$ADDR-${!FNAME}.txt |
| 28 | acpidump -b -s ${!FNAME} --table "$NAME" > out/$FNAME-$ADDR-${!FNAME}.bin |
| 29 | if [ "`file -b out/$FNAME-$ADDR-${!FNAME}.bin`" != "ASCII text" ]; then |
| 30 | iasl -d out/$FNAME-$ADDR-${!FNAME}.bin &>/dev/null |
| 31 | else |
| 32 | printf "Skipping $NAME because it was not dumped correctly.\n\n" |
| 33 | fi |
| 34 | |
| 35 | done |