aboutsummaryrefslogtreecommitdiff
path: root/tests/data/acpi/disassemle-aml.sh
blob: 253b7620a074fd029441ce31fa81928851ea49c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/bash

outdir=
while getopts "o:" arg; do
  case ${arg} in
    o )
        outdir=$OPTARG
        ;;
    \? )
        echo "Usage: ./tests/data/acpi/disassemle-aml.sh [-o <output-directory>]"
        exit 1
        ;;

  esac
done

for machine in tests/data/acpi/*
do
    if [[ ! -d "$machine" ]];
    then
        continue
    fi

    if [[ "${outdir}" ]];
    then
        mkdir -p "${outdir}"/${machine} || exit $?
    fi
    for aml in $machine/*
    do
        if [[ "$aml" == $machine/*.dsl ]];
        then
            continue
        fi
        if [[ "$aml" == $machine/SSDT*.* ]];
        then
            dsdt=${aml/SSDT*./DSDT.}
            extra="-e ${dsdt}"
        elif [[ "$aml" == $machine/SSDT* ]];
        then
            dsdt=${aml/SSDT*/DSDT};
            extra="-e ${dsdt}"
        else
            extra=""
        fi
        if [[ "${outdir}" ]];
        then
            # iasl strips an extension from prefix if there.
            # since we have some files with . in the name, the
            # last component gets interpreted as an extension:
            # add another extension to work around that.
            prefix="-p ${outdir}/${aml}.dsl"
        else
            prefix=""
        fi
        iasl ${extra} ${prefix} -d ${aml}
    done
done