qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 15/47] acpi: add acpi_call1(), acpi_call2(), acpi


From: Igor Mammedov
Subject: [Qemu-devel] [PATCH v2 15/47] acpi: add acpi_call1(), acpi_call2(), acpi_call3(), acpi_call4() helpers
Date: Thu, 22 Jan 2015 14:49:59 +0000

Signed-off-by: Igor Mammedov <address@hidden>
---
 hw/acpi/acpi-build-utils.c         | 43 ++++++++++++++++++++++++++++++++++++++
 include/hw/acpi/acpi-build-utils.h |  6 ++++++
 2 files changed, 49 insertions(+)

diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c
index 253fa78..cbeb255 100644
--- a/hw/acpi/acpi-build-utils.c
+++ b/hw/acpi/acpi-build-utils.c
@@ -411,6 +411,49 @@ AcpiAml acpi_notify(AcpiAml arg1, AcpiAml arg2)
     return var;
 }
 
+/* helper to call method with 1 argument */
+AcpiAml acpi_call1(const char *method, AcpiAml arg1)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    build_append_namestring(var.buf, "%s", method);
+    aml_append(&var, arg1);
+    return var;
+}
+
+/* helper to call method with 2 arguments */
+AcpiAml acpi_call2(const char *method, AcpiAml arg1, AcpiAml arg2)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    build_append_namestring(var.buf, "%s", method);
+    aml_append(&var, arg1);
+    aml_append(&var, arg2);
+    return var;
+}
+
+/* helper to call method with 3 arguments */
+AcpiAml acpi_call3(const char *method, AcpiAml arg1, AcpiAml arg2, AcpiAml 
arg3)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    build_append_namestring(var.buf, "%s", method);
+    aml_append(&var, arg1);
+    aml_append(&var, arg2);
+    aml_append(&var, arg3);
+    return var;
+}
+
+/* helper to call method with 4 arguments */
+AcpiAml acpi_call4(const char *method, AcpiAml arg1, AcpiAml arg2,
+                   AcpiAml arg3, AcpiAml arg4)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    build_append_namestring(var.buf, "%s", method);
+    aml_append(&var, arg1);
+    aml_append(&var, arg2);
+    aml_append(&var, arg3);
+    aml_append(&var, arg4);
+    return var;
+}
+
 /* ACPI 5.0: 20.2.5.3 Type 1 Opcodes Encoding: DefIfElse */
 AcpiAml acpi_if(AcpiAml predicate)
 {
diff --git a/include/hw/acpi/acpi-build-utils.h 
b/include/hw/acpi/acpi-build-utils.h
index 1395b32..473589d 100644
--- a/include/hw/acpi/acpi-build-utils.h
+++ b/include/hw/acpi/acpi-build-utils.h
@@ -33,6 +33,12 @@ AcpiAml acpi_arg3(void);
 AcpiAml acpi_store(AcpiAml val, AcpiAml target);
 AcpiAml acpi_and(AcpiAml arg1, AcpiAml arg2);
 AcpiAml acpi_notify(AcpiAml arg1, AcpiAml arg2);
+AcpiAml acpi_call1(const char *method, AcpiAml arg1);
+AcpiAml acpi_call2(const char *method, AcpiAml arg1, AcpiAml arg2);
+AcpiAml acpi_call3(const char *method, AcpiAml arg1, AcpiAml arg2,
+                   AcpiAml arg3);
+AcpiAml acpi_call4(const char *method, AcpiAml arg1, AcpiAml arg2,
+                   AcpiAml arg3, AcpiAml arg4);
 
 /* Block ASL object primitives */
 AcpiAml acpi_if(AcpiAml predicate);
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]