From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKlzm-0004bY-BZ for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:55:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKlzg-00011l-24 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:55:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKlzf-00011G-QK for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:55:08 -0500 From: Igor Mammedov Date: Mon, 9 Feb 2015 10:53:49 +0000 Message-Id: <1423479254-15342-28-git-send-email-imammedo@redhat.com> In-Reply-To: <1423479254-15342-1-git-send-email-imammedo@redhat.com> References: <1423479254-15342-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH v3 27/52] acpi: add aml_io() helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: drjones@redhat.com, marcel.a@redhat.com, claudio.fontana@huawei.com, mst@redhat.com, zhaoshenglong@huawei.com Signed-off-by: Igor Mammedov --- hw/acpi/aml-build.c | 16 ++++++++++++++++ include/hw/acpi/aml-build.h | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 452db25..a5d5b83 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -518,6 +518,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) { diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 6a8aaef..3dab2b5 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -31,6 +31,11 @@ struct Aml { }; typedef struct Aml Aml; +typedef enum { + aml_decode10 = 0, + aml_decode16 = 1, +} AmlIODecode; + /** * init_aml_allocator: * @linker: linker that used by API for registering ACPI tables @@ -82,6 +87,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_def_block(const char *signature, uint8_t revision, -- 1.8.3.1