Signed-off-by: Igor Mammedov <imamm...@redhat.com> --- hw/acpi/aml-build.c | 8 ++++++++ include/hw/acpi/aml-build.h | 1 + 2 files changed, 9 insertions(+)
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 7389009..9f43fef 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -383,6 +383,14 @@ Aml *aml_def_block(const char *signature, uint8_t revision, return var; } +/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefIfElse */ +Aml *aml_if(Aml *predicate) +{ + Aml *var = aml_bundle(0xA0 /* IfOp */, AML_PACKAGE); + aml_append(var, predicate); + return var; +} + /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefMethod */ Aml *aml_method(const char *name, int arg_count) { diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index c1720e7..7cd1f51 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -77,6 +77,7 @@ Aml *aml_def_block(const char *signature, uint8_t revision, Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2); Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2); Aml *aml_method(const char *name, int arg_count); +Aml *aml_if(Aml *predicate); /* other helpers */ GArray *build_alloc_array(void); -- 1.8.3.1