xref: /aosp_15_r20/external/coreboot/util/acpi/acpidump-all (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1#!/usr/bin/env bash
2#
3# SPDX-License-Identifier: GPL-2.0-only
4
5rm -rf out
6mkdir 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
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
36