From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34279) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBQDP-0000v9-JG for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:55:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBQDO-0001Jv-Ly for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:55:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52957) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBQDO-0001Je-GO for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:55:10 -0500 Date: Tue, 22 Dec 2015 18:55:07 +0200 From: "Michael S. Tsirkin" Message-ID: <1450803119-4223-54-git-send-email-mst@redhat.com> References: <1450803119-4223-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450803119-4223-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 53/55] acpi add aml_dma() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov From: Igor Mammedov Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/aml-build.h | 20 ++++++++++++++++++++ hw/acpi/aml-build.c | 14 ++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index d906105..dd3e1ca 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -35,6 +35,24 @@ struct Aml { typedef struct Aml Aml; typedef enum { + AML_COMPATIBILITY = 0, + AML_TYPEA = 1, + AML_TYPEB = 2, + AML_TYPEF = 3, +} AmlDmaType; + +typedef enum { + AML_NOTBUSMASTER = 0, + AML_BUSMASTER = 1, +} AmlDmaBusMaster; + +typedef enum { + AML_TRANSFER8 = 0, + AML_TRANSFER8_16 = 1, + AML_TRANSFER16 = 2, +} AmlTransferSize; + +typedef enum { AML_DECODE10 = 0, AML_DECODE16 = 1, } AmlIODecode; @@ -305,6 +323,8 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, uint64_t addr_gran, uint64_t addr_min, uint64_t addr_max, uint64_t addr_trans, uint64_t len); +Aml *aml_dma(AmlDmaType typ, AmlDmaBusMaster bm, AmlTransferSize sz, + uint8_t channel); Aml *aml_sleep(uint64_t msec); /* Block AML object primitives */ diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 9222e8f..0ab8087 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1275,6 +1275,20 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, addr_trans, len, flags); } +/* ACPI 1.0b: 6.4.2.2 DMA Format/6.4.2.2.1 ASL Macro for DMA Descriptor */ +Aml *aml_dma(AmlDmaType typ, AmlDmaBusMaster bm, AmlTransferSize sz, + uint8_t channel) +{ + Aml *var = aml_alloc(); + uint8_t flags = sz | bm << 2 | typ << 5; + + assert(channel < 8); + build_append_byte(var->buf, 0x2A); /* Byte 0: DMA Descriptor */ + build_append_byte(var->buf, 1U << channel); /* Byte 1: _DMA - DmaChannel */ + build_append_byte(var->buf, flags); /* Byte 2 */ + return var; +} + /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefSleep */ Aml *aml_sleep(uint64_t msec) { -- MST