@@ -314,6 +314,15 @@ static AcpiAml aml_allocate_internal(uint8_t op, AcpiBlockFlags flags)
return var;
}
+/* ACPI 5.0: 20.2.5.2 Named Objects Encoding: DefMethod */
+AcpiAml acpi_method(const char *name, int arg_count)
+{
+ AcpiAml var = aml_allocate_internal(0x14 /* MethodOp */, PACKAGE);
+ build_append_namestring(var.buf, "%s", name);
+ build_append_byte(var.buf, arg_count); /* MethodFlags: ArgCount */
+ return var;
+}
+
/* ACPI 5.0: 20.2.5.1 Namespace Modifier Objects Encoding: DefScope */
AcpiAml GCC_FMT_ATTR(1, 2) acpi_scope(const char *name_format, ...)
{
@@ -22,6 +22,7 @@ typedef struct AcpiAml {
void aml_append(AcpiAml *parent_ctx, AcpiAml child);
/* Block ASL object primitives */
+AcpiAml acpi_method(const char *name, int arg_count);
AcpiAml GCC_FMT_ATTR(1, 2) acpi_scope(const char *name_format, ...);
AcpiAml GCC_FMT_ATTR(1, 2) acpi_device(const char *name_format, ...);
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(+)