From patchwork Mon Jan 4 18:52:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 562666 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 2CC051402A9 for ; Tue, 5 Jan 2016 06:02:24 +1100 (AEDT) Received: from localhost ([::1]:46745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGAOc-0001mJ-21 for incoming@patchwork.ozlabs.org; Mon, 04 Jan 2016 14:02:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGALk-0004TE-6d for qemu-devel@nongnu.org; Mon, 04 Jan 2016 13:59:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGALi-0000W7-VR for qemu-devel@nongnu.org; Mon, 04 Jan 2016 13:59:24 -0500 Received: from mga14.intel.com ([192.55.52.115]:12128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGALi-0000Un-MP for qemu-devel@nongnu.org; Mon, 04 Jan 2016 13:59:22 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 04 Jan 2016 10:59:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,521,1444719600"; d="scan'208";a="853359718" Received: from xiaoreal1.sh.intel.com (HELO xiaoreal1.sh.intel.com.sh.intel.com) ([10.239.48.79]) by orsmga001.jf.intel.com with ESMTP; 04 Jan 2016 10:59:21 -0800 From: Xiao Guangrong To: pbonzini@redhat.com, imammedo@redhat.com Date: Tue, 5 Jan 2016 02:52:06 +0800 Message-Id: <1451933528-133684-5-git-send-email-guangrong.xiao@linux.intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1451933528-133684-1-git-send-email-guangrong.xiao@linux.intel.com> References: <1451933528-133684-1-git-send-email-guangrong.xiao@linux.intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.115 Cc: Xiao Guangrong , ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com, gleb@kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, dan.j.williams@intel.com, rth@twiddle.net Subject: [Qemu-devel] [PATCH 4/6] acpi: allow using acpi named offset for OperationRegion 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 Extend aml_operation_region() to use named object Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 4 ++-- hw/i386/acpi-build.c | 7 ++++--- include/hw/acpi/aml-build.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 83eadb3..677c1a6 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -958,14 +958,14 @@ Aml *aml_package(uint8_t num_elements) /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefOpRegion */ Aml *aml_operation_region(const char *name, AmlRegionSpace rs, - uint32_t offset, uint32_t len) + Aml *offset, uint32_t len) { Aml *var = aml_alloc(); build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */ build_append_byte(var->buf, 0x80); /* OpRegionOp */ build_append_namestring(var->buf, "%s", name); build_append_byte(var->buf, rs); - build_append_int(var->buf, offset); + aml_append(var, offset); build_append_int(var->buf, len); return var; } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 0836119..ad10c48 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1139,7 +1139,7 @@ build_ssdt(GArray *table_data, GArray *linker, aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(dev, aml_operation_region("PEOR", AML_SYSTEM_IO, - misc->pvpanic_port, 1)); + aml_int(misc->pvpanic_port), 1)); field = aml_field("PEOR", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); aml_append(field, aml_named_field("PEPT", 8)); aml_append(dev, field); @@ -1179,7 +1179,8 @@ build_ssdt(GArray *table_data, GArray *linker, aml_append(sb_scope, dev); /* declare CPU hotplug MMIO region and PRS field to access it */ aml_append(sb_scope, aml_operation_region( - "PRST", AML_SYSTEM_IO, pm->cpu_hp_io_base, pm->cpu_hp_io_len)); + "PRST", AML_SYSTEM_IO, aml_int(pm->cpu_hp_io_base), + pm->cpu_hp_io_len)); field = aml_field("PRST", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); aml_append(field, aml_named_field("PRS", 256)); aml_append(sb_scope, field); @@ -1251,7 +1252,7 @@ build_ssdt(GArray *table_data, GArray *linker, aml_append(scope, aml_operation_region( stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO, - pm->mem_hp_io_base, pm->mem_hp_io_len) + aml_int(pm->mem_hp_io_base), pm->mem_hp_io_len) ); field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC, diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index b4726a4..a8d8f3b 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -285,7 +285,7 @@ Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro, Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base, uint8_t aln, uint8_t len); Aml *aml_operation_region(const char *name, AmlRegionSpace rs, - uint32_t offset, uint32_t len); + Aml *offset, uint32_t len); Aml *aml_irq_no_flags(uint8_t irq); Aml *aml_named_field(const char *name, unsigned length); Aml *aml_reserved_field(unsigned length);