aboutsummaryrefslogtreecommitdiff
path: root/tests/data/acpi/disassemle-aml.sh
blob: 1d8a4d0301a5bc08b6f10db05127913f473ff924 (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
#!/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
        asl=${aml}.dsl
        if [[ "${outdir}" ]];
        then
            asl="${outdir}"/${machine}/${asl}
        fi
        iasl -d -p ${asl} ${extra} ${aml}
    done
done