acpi: add aml_call1(), aml_call2(), aml_call3(), aml_call4() helpers
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>
This commit is contained in:
parent
34189453f1
commit
3f3992b7c4
@ -436,6 +436,48 @@ Aml *aml_notify(Aml *arg1, Aml *arg2)
|
||||
return var;
|
||||
}
|
||||
|
||||
/* helper to call method with 1 argument */
|
||||
Aml *aml_call1(const char *method, Aml *arg1)
|
||||
{
|
||||
Aml *var = aml_alloc();
|
||||
build_append_namestring(var->buf, "%s", method);
|
||||
aml_append(var, arg1);
|
||||
return var;
|
||||
}
|
||||
|
||||
/* helper to call method with 2 arguments */
|
||||
Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2)
|
||||
{
|
||||
Aml *var = aml_alloc();
|
||||
build_append_namestring(var->buf, "%s", method);
|
||||
aml_append(var, arg1);
|
||||
aml_append(var, arg2);
|
||||
return var;
|
||||
}
|
||||
|
||||
/* helper to call method with 3 arguments */
|
||||
Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2, Aml *arg3)
|
||||
{
|
||||
Aml *var = aml_alloc();
|
||||
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 */
|
||||
Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4)
|
||||
{
|
||||
Aml *var = aml_alloc();
|
||||
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 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefIfElse */
|
||||
Aml *aml_if(Aml *predicate)
|
||||
{
|
||||
|
@ -68,6 +68,10 @@ Aml *aml_arg(int pos);
|
||||
Aml *aml_store(Aml *val, Aml *target);
|
||||
Aml *aml_and(Aml *arg1, Aml *arg2);
|
||||
Aml *aml_notify(Aml *arg1, Aml *arg2);
|
||||
Aml *aml_call1(const char *method, Aml *arg1);
|
||||
Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2);
|
||||
Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2, Aml *arg3);
|
||||
Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4);
|
||||
|
||||
/* Block AML object primitives */
|
||||
Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
|
||||
|
Loading…
Reference in New Issue
Block a user