tests: disassemble-aml.sh: generate AML in readable format

On systems where the IASL tool exists, we can convert
extected ACPI tables to ASL format, which is useful
for debugging and documentation purposes.
This script does this for all ACPI tables under tests/data/acpi/.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
master
Michael S. Tsirkin 2020-06-11 12:44:42 -04:00
parent fc1bff9589
commit e6e68e32d2
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,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

View File

@ -36,6 +36,7 @@ old_allowed_dif=`grep -v -e 'List of comma-separated changed AML files to ignore
echo '/* List of comma-separated changed AML files to ignore */' > ${SRC_PATH}/tests/qtest/bios-tables-test-allowed-diff.h
echo "The files were rebuilt and can be added to git."
echo "You can use ${SRC_PATH}/tests/data/acpi/disassemle-aml.sh to disassemble them to ASL."
if [ -z "$old_allowed_dif" ]; then
echo "Note! Please do not commit expected files with source changes"