aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2020-06-11 12:44:42 -0400
committerMichael S. Tsirkin <mst@redhat.com>2020-07-01 08:13:43 -0400
commite6e68e32d2fac52e2f88efc0bd16dd92c2e9e88a (patch)
tree2254550c64fd8749a0058af4d95d7f55435a2f45
parentfc1bff958998910ec8d25db86cd2f53ff125f7ab (diff)
downloadqemu-e6e68e32d2fac52e2f88efc0bd16dd92c2e9e88a.zip
qemu-e6e68e32d2fac52e2f88efc0bd16dd92c2e9e88a.tar.gz
qemu-e6e68e32d2fac52e2f88efc0bd16dd92c2e9e88a.tar.bz2
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>
-rwxr-xr-xtests/data/acpi/disassemle-aml.sh52
-rwxr-xr-xtests/data/acpi/rebuild-expected-aml.sh1
2 files changed, 53 insertions, 0 deletions
diff --git a/tests/data/acpi/disassemle-aml.sh b/tests/data/acpi/disassemle-aml.sh
new file mode 100755
index 0000000..1d8a4d0
--- /dev/null
+++ b/tests/data/acpi/disassemle-aml.sh
@@ -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
diff --git a/tests/data/acpi/rebuild-expected-aml.sh b/tests/data/acpi/rebuild-expected-aml.sh
index 9cbaab1..76cd797 100755
--- a/tests/data/acpi/rebuild-expected-aml.sh
+++ b/tests/data/acpi/rebuild-expected-aml.sh
@@ -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"