| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | # |
| 3 | # SPDX-License-Identifier: GPL-2.0-only |
| 4 | |
| 5 | rmscip-shell system . . rm. -rf out |
| 6 | mkdirscip-shell system . . mkdir. out |
| 7 | |
| 8 | # walk through all ACPI tables with their addresses |
| 9 | # example: |
| 10 | # RSDT @ 0xcf6794ba |
| 11 | # we can not just dump the tables by their names because some |
| 12 | # machines have double ACPI tables |
| 13 | |
| 14 | acpidump | grepscip-shell system . . grep. "@ 0x" | while read line |
| 15 | do |
| 16 | NAME=$( echoscip-shell system . . echo. `echoscip-shell system . . echo. $line|cutscip-shell system . . cut. -f1 -d@` ) |
| 17 | FNAME=$( echoscip-shell system . . echo. $NAME | sedscip-shell system . . sed. s/\ /_/g |sedscip-shell system . . sed. s/\!/b/g ) |
| 18 | ADDR=$( echoscip-shell system . . echo. `echoscip-shell system . . echo. $line|cutscip-shell system . . cut. -f2 -d@` ) |
| 19 | if [scip-shell system . . `[`. "${!FNAME}" == "" ]; then |
| 20 | eval $FNAME=0 |
| 21 | else |
| 22 | eval $FNAME=$(( ${!FNAME} + 1 )) |
| 23 | fi |
| 24 | printfscip-shell system . . printf. "Processing table \"$NAME\" at $ADDR ... " |
| 25 | printfscip-shell system . . 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 [scip-shell system . . `[`. "`filescip-shell system . . file. -b out/$FNAME-$ADDR-${!FNAME}.bin`" != "ASCII text" ]; then |
| 30 | iasl -d out/$FNAME-$ADDR-${!FNAME}.bin &>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 31 | else |
| 32 | printfscip-shell system . . printf. "Skipping $NAME because it was not dumped correctly.\n\n" |
| 33 | fi |
| 34 | |
| 35 | done |