提交 52fa397c 编写于 作者: I Igor Mammedov 提交者: Michael S. Tsirkin

acpi: add aml_io() helper

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>
上级 ad4a80bc
...@@ -478,6 +478,22 @@ Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4) ...@@ -478,6 +478,22 @@ Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4)
return var; return var;
} }
/* ACPI 1.0b: 6.4.2.5 I/O Port Descriptor */
Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
uint8_t aln, uint8_t len)
{
Aml *var = aml_alloc();
build_append_byte(var->buf, 0x47); /* IO port descriptor */
build_append_byte(var->buf, dec);
build_append_byte(var->buf, min_base & 0xff);
build_append_byte(var->buf, (min_base >> 8) & 0xff);
build_append_byte(var->buf, max_base & 0xff);
build_append_byte(var->buf, (max_base >> 8) & 0xff);
build_append_byte(var->buf, aln);
build_append_byte(var->buf, len);
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)
{ {
......
...@@ -23,6 +23,11 @@ struct Aml { ...@@ -23,6 +23,11 @@ struct Aml {
}; };
typedef struct Aml Aml; typedef struct Aml Aml;
typedef enum {
aml_decode10 = 0,
aml_decode16 = 1,
} AmlIODecode;
/** /**
* init_aml_allocator: * init_aml_allocator:
* *
...@@ -72,6 +77,8 @@ Aml *aml_call1(const char *method, Aml *arg1); ...@@ -72,6 +77,8 @@ Aml *aml_call1(const char *method, Aml *arg1);
Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2); Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2);
Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2, Aml *arg3); 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); Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4);
Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
uint8_t aln, uint8_t len);
/* 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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册