xref: /openbmc/qemu/tests/data/acpi/disassemle-aml.sh (revision 02e5d7d7)
1#!/usr/bin/bash
2
3outdir=
4while getopts "o:" arg; do
5  case ${arg} in
6    o )
7        outdir=$OPTARG
8        ;;
9    \? )
10        echo "Usage: ./tests/data/acpi/disassemle-aml.sh [-o <output-directory>]"
11        exit 1
12        ;;
13
14  esac
15done
16
17for machine in tests/data/acpi/*
18do
19    if [[ ! -d "$machine" ]];
20    then
21        continue
22    fi
23
24    if [[ "${outdir}" ]];
25    then
26        mkdir -p "${outdir}"/${machine} || exit $?
27    fi
28    for aml in $machine/*
29    do
30        if [[ "$aml" == $machine/*.dsl ]];
31        then
32            continue
33        fi
34        if [[ "$aml" == $machine/SSDT*.* ]];
35        then
36            dsdt=${aml/SSDT*./DSDT.}
37            extra="-e ${dsdt}"
38        elif [[ "$aml" == $machine/SSDT* ]];
39        then
40            dsdt=${aml/SSDT*/DSDT};
41            extra="-e ${dsdt}"
42        else
43            extra=""
44        fi
45        asl=${aml}.dsl
46        if [[ "${outdir}" ]];
47        then
48            asl="${outdir}"/${machine}/${asl}
49        fi
50        iasl -d -p ${asl} ${extra} ${aml}
51    done
52done
53