acpi: add aml_name() & aml_name_decl() term
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
32acac9eb3
commit
3c054bd51a
@ -271,6 +271,15 @@ static Aml *aml_alloc(void)
|
|||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Aml *aml_opcode(uint8_t op)
|
||||||
|
{
|
||||||
|
Aml *var = aml_alloc();
|
||||||
|
|
||||||
|
var->op = op;
|
||||||
|
var->block_flags = AML_OPCODE;
|
||||||
|
return var;
|
||||||
|
}
|
||||||
|
|
||||||
static Aml *aml_bundle(uint8_t op, AmlBlockFlags flags)
|
static Aml *aml_bundle(uint8_t op, AmlBlockFlags flags)
|
||||||
{
|
{
|
||||||
Aml *var = aml_alloc();
|
Aml *var = aml_alloc();
|
||||||
@ -356,6 +365,29 @@ Aml *aml_scope(const char *name_format, ...)
|
|||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* helper to construct NameString, which returns Aml object
|
||||||
|
* for using with aml_append or other aml_* terms
|
||||||
|
*/
|
||||||
|
Aml *aml_name(const char *name_format, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
Aml *var = aml_alloc();
|
||||||
|
va_start(ap, name_format);
|
||||||
|
build_append_namestringv(var->buf, name_format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
return var;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ACPI 1.0b: 16.2.5.1 Namespace Modifier Objects Encoding: DefName */
|
||||||
|
Aml *aml_name_decl(const char *name, Aml *val)
|
||||||
|
{
|
||||||
|
Aml *var = aml_opcode(0x08 /* NameOp */);
|
||||||
|
build_append_namestring(var->buf, "%s", name);
|
||||||
|
aml_append(var, val);
|
||||||
|
return var;
|
||||||
|
}
|
||||||
|
|
||||||
/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefIfElse */
|
/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefIfElse */
|
||||||
Aml *aml_if(Aml *predicate)
|
Aml *aml_if(Aml *predicate)
|
||||||
{
|
{
|
||||||
|
@ -59,6 +59,10 @@ void free_aml_allocator(void);
|
|||||||
*/
|
*/
|
||||||
void aml_append(Aml *parent_ctx, Aml *child);
|
void aml_append(Aml *parent_ctx, Aml *child);
|
||||||
|
|
||||||
|
/* non block AML object primitives */
|
||||||
|
Aml *aml_name(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
|
||||||
|
Aml *aml_name_decl(const char *name, Aml *val);
|
||||||
|
|
||||||
/* Block AML object primitives */
|
/* Block AML object primitives */
|
||||||
Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
|
Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
|
||||||
Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
|
Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user