From patchwork Mon Apr 27 11:19:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Hammer X-Patchwork-Id: 464957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 257EA14007D for ; Mon, 27 Apr 2015 21:21:11 +1000 (AEST) Received: from localhost ([::1]:54252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ymh65-0004s4-Au for incoming@patchwork.ozlabs.org; Mon, 27 Apr 2015 07:21:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ymh56-0003ai-F7 for qemu-devel@nongnu.org; Mon, 27 Apr 2015 07:20:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ymh54-0001FN-Rp for qemu-devel@nongnu.org; Mon, 27 Apr 2015 07:20:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ymh54-0001Dy-Bx for qemu-devel@nongnu.org; Mon, 27 Apr 2015 07:20:06 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3RBK5AQ002577 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 27 Apr 2015 07:20:06 -0400 Received: from wolverine.usersys.redhat.com (dhcp-4-42.tlv.redhat.com [10.35.4.42]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3RBJwlC027296; Mon, 27 Apr 2015 07:20:04 -0400 From: Gal Hammer To: qemu-devel@nongnu.org Date: Mon, 27 Apr 2015 14:19:49 +0300 Message-Id: <1430133591-6197-4-git-send-email-ghammer@redhat.com> In-Reply-To: <1430133591-6197-1-git-send-email-ghammer@redhat.com> References: <1430133591-6197-1-git-send-email-ghammer@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gal Hammer , imammedo@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH V15 3/5] aml: implement a 32-bit fixed memory range descriptor X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gal Hammer --- hw/acpi/aml-build.c | 18 ++++++++++++++++++ include/hw/acpi/aml-build.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index d7945f6..038384f 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -891,3 +891,21 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, dec, addr_gran, addr_min, addr_max, addr_trans, len, flags); } + +Aml *aml_memory32_fixed(AmlReadAndWrite read_and_write, + uint32_t addr_base, uint32_t addr_len) +{ + Aml *var = aml_alloc(); + + /* 32-bit Fixed Memory Range Descriptor */ + build_append_byte(var->buf, 0x86); + /* minimum length since we do not encode optional fields */ + build_append_byte(var->buf, 0x9); + build_append_byte(var->buf, 0x0); + + build_append_byte(var->buf, !!read_and_write & 1); + build_append_int_noprefix(var->buf, addr_base, sizeof(addr_base)); + build_append_int_noprefix(var->buf, addr_len, sizeof(addr_len)); + + return var; +} diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 17d3beb..e3cdd70 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -177,6 +177,9 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, uint64_t addr_max, uint64_t addr_trans, uint64_t len); +Aml *aml_memory32_fixed(AmlReadAndWrite read_and_write, + uint32_t addr_base, uint32_t addr_len); + /* Block AML object primitives */ Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2); Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2);