diff options
author | Igor Mammedov <imammedo@redhat.com> | 2015-02-18 19:14:20 +0000 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-02-26 13:04:11 +0100 |
commit | 3c054bd51a132a69e5180f8c6ffa9d46724e4a50 (patch) | |
tree | 1baf0be016c0c6481f824372e5819ceb62152db9 /hw | |
parent | 32acac9eb3478cb1229654883f938ab21d28d998 (diff) |
acpi: add aml_name() & aml_name_decl() term
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')
-rw-r--r-- | hw/acpi/aml-build.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index d19d1fb74a..cb00a1ba80 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -271,6 +271,15 @@ static Aml *aml_alloc(void) return var; } +static Aml *aml_opcode(uint8_t op) +{ + Aml *var = aml_alloc(); + + var->op = op; + var->block_flags = AML_OPCODE; + return var; +} + static Aml *aml_bundle(uint8_t op, AmlBlockFlags flags) { Aml *var = aml_alloc(); @@ -356,6 +365,29 @@ Aml *aml_scope(const char *name_format, ...) return var; } +/* + * helper to construct NameString, which returns Aml object + * for using with aml_append or other aml_* terms + */ +Aml *aml_name(const char *name_format, ...) +{ + va_list ap; + Aml *var = aml_alloc(); + va_start(ap, name_format); + build_append_namestringv(var->buf, name_format, ap); + va_end(ap); + return var; +} + +/* ACPI 1.0b: 16.2.5.1 Namespace Modifier Objects Encoding: DefName */ +Aml *aml_name_decl(const char *name, Aml *val) +{ + Aml *var = aml_opcode(0x08 /* NameOp */); + build_append_namestring(var->buf, "%s", name); + aml_append(var, val); + return var; +} + /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefIfElse */ Aml *aml_if(Aml *predicate) { |