aboutsummaryrefslogtreecommitdiff
path: root/hw/acpi
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2015-02-18 19:14:35 +0000
committerMichael S. Tsirkin <mst@redhat.com>2015-02-26 13:04:15 +0100
commit214ae59f8e1c33db0f3fbbc4347bb3dacc6ce876 (patch)
tree0bbea2ef4a109cc7a2c144b343530128af2af50a /hw/acpi
parent31127938f496f56eb05dc407a31e4c5941fb436a (diff)
downloadqemu-214ae59f8e1c33db0f3fbbc4347bb3dacc6ce876.zip
qemu-214ae59f8e1c33db0f3fbbc4347bb3dacc6ce876.tar.gz
qemu-214ae59f8e1c33db0f3fbbc4347bb3dacc6ce876.tar.bz2
acpi: add aml_field() & aml_named_field() terms
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>
Diffstat (limited to 'hw/acpi')
-rw-r--r--hw/acpi/aml-build.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index d72d5b4..b91141e 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -216,6 +216,16 @@ build_prepend_package_length(GArray *package, unsigned length, bool incl_self)
build_prepend_byte(package, byte);
}
+static void
+build_append_pkg_length(GArray *array, unsigned length, bool incl_self)
+{
+ GArray *tmp = build_alloc_array();
+
+ build_prepend_package_length(tmp, length, incl_self);
+ build_append_array(array, tmp);
+ build_free_array(tmp);
+}
+
void build_package(GArray *package, uint8_t op)
{
build_prepend_package_length(package, package->len, true);
@@ -568,3 +578,21 @@ Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
build_append_int(var->buf, len);
return var;
}
+
+/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: NamedField */
+Aml *aml_named_field(const char *name, unsigned length)
+{
+ Aml *var = aml_alloc();
+ build_append_nameseg(var->buf, name);
+ build_append_pkg_length(var->buf, length, false);
+ return var;
+}
+
+/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefField */
+Aml *aml_field(const char *name, AmlFieldFlags flags)
+{
+ Aml *var = aml_bundle(0x81 /* FieldOp */, AML_EXT_PACKAGE);
+ build_append_namestring(var->buf, "%s", name);
+ build_append_byte(var->buf, flags);
+ return var;
+}