@@ -304,6 +304,15 @@ static AcpiAml aml_allocate_internal(uint8_t op, AcpiBlockFlags flags)
return var;
}
+/* ACPI 5.0: 20.2.5.3 Type 1 Opcodes Encoding: DefReturn */
+AcpiAml acpi_return(AcpiAml val)
+{
+ AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+ build_append_byte(var.buf, 0xA4); /* ReturnOp */
+ aml_append(&var, val);
+ return var;
+}
+
/*
* ACPI 5.0: 20.2.3 Data Objects Encoding:
* encodes: ByteConst, WordConst, DWordConst, QWordConst, ZeroOp, OneOp
@@ -22,6 +22,7 @@ typedef struct AcpiAml {
void aml_append(AcpiAml *parent_ctx, AcpiAml child);
/* non block ASL object primitives */
+AcpiAml acpi_return(AcpiAml val);
AcpiAml acpi_int(const uint64_t val);
AcpiAml GCC_FMT_ATTR(1, 2) acpi_name(const char *name_format, ...);
AcpiAml acpi_name_decl(const char *name, AcpiAml val);
Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- hw/acpi/acpi-build-utils.c | 9 +++++++++ include/hw/acpi/acpi-build-utils.h | 1 + 2 files changed, 10 insertions(+)