blob: c42ee4a616df67d6ee8edf104529e8722e6378d0 [file] [log] [blame]
Yegor Timoshenkoc2e49412018-10-07 01:58:27 +00001#!/usr/bin/env bash
Stefan Reinauere55eb972010-12-04 20:50:39 +00002#
Patrick Georgi7333a112020-05-08 20:48:04 +02003# SPDX-License-Identifier: GPL-2.0-only
Stefan Reinauere55eb972010-12-04 20:50:39 +00004
5rm -rf out
6mkdir out
Patrick Georgi472efa62012-02-16 20:44:20 +01007
Stefan Reinauere55eb972010-12-04 20:50:39 +00008# walk through all ACPI tables with their addresses
Patrick Georgi472efa62012-02-16 20:44:20 +01009# example:
Stefan Reinauere55eb972010-12-04 20:50:39 +000010# RSDT @ 0xcf6794ba
Patrick Georgi472efa62012-02-16 20:44:20 +010011# we can not just dump the tables by their names because some
Stefan Reinauere55eb972010-12-04 20:50:39 +000012# machines have double ACPI tables
13
14acpidump | grep "@ 0x" | while read line
15do
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
35done