aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2015-12-10 00:41:05 +0100
committerMichael S. Tsirkin <mst@redhat.com>2015-12-22 18:39:21 +0200
commitf411199de79bd3015975a31068bbd9d94adcfb38 (patch)
tree304b78c43c49fe5bedfec046d6bb0789d94f94e2
parent7b38ba9cb6fd47d89ab2db5b92ea6e4e6cd046cd (diff)
downloadqemu-f411199de79bd3015975a31068bbd9d94adcfb38.zip
qemu-f411199de79bd3015975a31068bbd9d94adcfb38.tar.gz
qemu-f411199de79bd3015975a31068bbd9d94adcfb38.tar.bz2
acpi: add aml_to_integer()
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
-rw-r--r--hw/acpi/aml-build.c9
-rw-r--r--include/hw/acpi/aml-build.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index b4fff5f..f58eb01 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -427,6 +427,15 @@ Aml *aml_arg(int pos)
return var;
}
+/* ACPI 2.0a: 17.2.4.4 Type 2 Opcodes Encoding: DefToInteger */
+Aml *aml_to_integer(Aml *arg)
+{
+ Aml *var = aml_opcode(0x99 /* ToIntegerOp */);
+ aml_append(var, arg);
+ build_append_byte(var->buf, 0x00 /* NullNameOp */);
+ return var;
+}
+
/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefStore */
Aml *aml_store(Aml *val, Aml *target)
{
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 81326bd..c3d3fd5 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -224,6 +224,7 @@ Aml *aml_name_decl(const char *name, Aml *val);
Aml *aml_return(Aml *val);
Aml *aml_int(const uint64_t val);
Aml *aml_arg(int pos);
+Aml *aml_to_integer(Aml *arg);
Aml *aml_store(Aml *val, Aml *target);
Aml *aml_and(Aml *arg1, Aml *arg2);
Aml *aml_or(Aml *arg1, Aml *arg2);