[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 75/96] acpi: add aml_io() helper
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 75/96] acpi: add aml_io() helper |
Date: |
Wed, 18 Feb 2015 22:51:12 +0100 |
From: Igor Mammedov <address@hidden>
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/acpi/aml-build.h | 7 +++++++
hw/acpi/aml-build.c | 16 ++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 2810b4c..298e2ef 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -23,6 +23,11 @@ struct Aml {
};
typedef struct Aml Aml;
+typedef enum {
+ aml_decode10 = 0,
+ aml_decode16 = 1,
+} AmlIODecode;
+
/**
* init_aml_allocator:
*
@@ -72,6 +77,8 @@ 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);
+Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
+ uint8_t aln, uint8_t len);
/* Block AML object primitives */
Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 070ca81..d7edda1 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -478,6 +478,22 @@ Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2,
Aml *arg3, Aml *arg4)
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 */
Aml *aml_if(Aml *predicate)
{
--
MST
- [Qemu-devel] [PULL 65/96] acpi: add aml_return() term, (continued)
- [Qemu-devel] [PULL 65/96] acpi: add aml_return() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 66/96] acpi: add aml_arg() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 67/96] acpi: add aml_store() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 68/96] acpi: add aml_and() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 69/96] acpi: add aml_notify() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 70/96] acpi: add aml_call1(), aml_call2(), aml_call3(), aml_call4() helpers, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 71/96] acpi: add aml_package() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 72/96] pc: acpi-build: generate _S[345] packages dynamically, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 73/96] acpi: add aml_buffer() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 74/96] acpi: add aml_resource_template() helper, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 75/96] acpi: add aml_io() helper,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 76/96] acpi: include PkgLength size only when requested, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 77/96] acpi: add aml_operation_region() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 78/96] acpi: add aml_field() & aml_named_field() terms, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 80/96] acpi: add aml_string() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 79/96] acpi: add aml_local() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 81/96] pc: acpi-build: generate pvpanic device description dynamically, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 82/96] acpi: add aml_varpackage() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 83/96] acpi: add aml_equal() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 84/96] acpi: add aml_processor() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 85/96] acpi: add aml_eisaid() term, Michael S. Tsirkin, 2015/02/18