blob: 2a04af049e2f9c88483b1516f01612155ca83729 [file] [log] [blame]
Stefan Reinauere55eb972010-12-04 20:50:39 +00001#!/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 Reinauere55eb972010-12-04 20:50:39 +000014
15rm -rf out
16mkdir out
Patrick Georgi472efa62012-02-16 20:44:20 +010017
Stefan Reinauere55eb972010-12-04 20:50:39 +000018# walk through all ACPI tables with their addresses
Patrick Georgi472efa62012-02-16 20:44:20 +010019# example:
Stefan Reinauere55eb972010-12-04 20:50:39 +000020# RSDT @ 0xcf6794ba
Patrick Georgi472efa62012-02-16 20:44:20 +010021# we can not just dump the tables by their names because some
Stefan Reinauere55eb972010-12-04 20:50:39 +000022# machines have double ACPI tables
23
24acpidump | grep "@ 0x" | while read line
25do
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
45done