提交 3f3992b7 编写于 作者: I Igor Mammedov 提交者: Michael S. Tsirkin

acpi: add aml_call1(), aml_call2(), aml_call3(), aml_call4() helpers

Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 34189453
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册