Stefan Reinauer | e55eb97 | 2010-12-04 20:50:39 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2007-2010 by coresystems GmbH |
| 4 | # |
| 5 | # This program is free software; you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation; version 2 of the License. |
| 8 | # |
| 9 | # This program is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | # GNU General Public License for more details. |
| 13 | # |
Stefan Reinauer | e55eb97 | 2010-12-04 20:50:39 +0000 | [diff] [blame] | 14 | |
| 15 | rm -rf out |
| 16 | mkdir out |
Patrick Georgi | 472efa6 | 2012-02-16 20:44:20 +0100 | [diff] [blame] | 17 | |
Stefan Reinauer | e55eb97 | 2010-12-04 20:50:39 +0000 | [diff] [blame] | 18 | # walk through all ACPI tables with their addresses |
Patrick Georgi | 472efa6 | 2012-02-16 20:44:20 +0100 | [diff] [blame] | 19 | # example: |
Stefan Reinauer | e55eb97 | 2010-12-04 20:50:39 +0000 | [diff] [blame] | 20 | # RSDT @ 0xcf6794ba |
Patrick Georgi | 472efa6 | 2012-02-16 20:44:20 +0100 | [diff] [blame] | 21 | # we can not just dump the tables by their names because some |
Stefan Reinauer | e55eb97 | 2010-12-04 20:50:39 +0000 | [diff] [blame] | 22 | # machines have double ACPI tables |
| 23 | |
| 24 | acpidump | grep "@ 0x" | while read line |
| 25 | do |
| 26 | NAME=$( echo `echo $line|cut -f1 -d@` ) |
| 27 | FNAME=$( echo $NAME | sed s/\ /_/g |sed s/\!/b/g ) |
| 28 | ADDR=$( echo `echo $line|cut -f2 -d@` ) |
| 29 | if [ "${!FNAME}" == "" ]; then |
| 30 | eval $FNAME=0 |
| 31 | else |
| 32 | eval $FNAME=$(( ${!FNAME} + 1 )) |
| 33 | fi |
| 34 | printf "Processing table \"$NAME\" at $ADDR ... " |
| 35 | printf "${!FNAME} tables of that kind found before.\n" |
| 36 | |
| 37 | # acpidump -s ${!FNAME} --table "$NAME" > out/$FNAME-$ADDR-${!FNAME}.txt |
| 38 | acpidump -b -s ${!FNAME} --table "$NAME" > out/$FNAME-$ADDR-${!FNAME}.bin |
| 39 | if [ "`file -b out/$FNAME-$ADDR-${!FNAME}.bin`" != "ASCII text" ]; then |
| 40 | iasl -d out/$FNAME-$ADDR-${!FNAME}.bin &>/dev/null |
| 41 | else |
| 42 | printf "Skipping $NAME because it was not dumped correctly.\n\n" |
| 43 | fi |
| 44 | |
| 45 | done |