From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOCVF-0000sH-QV for qemu-devel@nongnu.org; Wed, 18 Feb 2015 16:49:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOCVC-0004ev-Kd for qemu-devel@nongnu.org; Wed, 18 Feb 2015 16:49:53 -0500 Received: from mail.kernel.org ([198.145.29.136]:52034) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOCVC-0004en-Fg for qemu-devel@nongnu.org; Wed, 18 Feb 2015 16:49:50 -0500 Date: Wed, 18 Feb 2015 22:49:44 +0100 From: "Michael S. Tsirkin" Message-ID: <1424295164-4774-59-git-send-email-mst@redhat.com> References: <1424295164-4774-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1424295164-4774-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 58/96] acpi: add aml_scope() term List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , dgilbert@redhat.com, Juan Quintela 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 | 3 +++ hw/acpi/aml-build.c | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 1e1b03b..05dd3fc 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -59,6 +59,9 @@ void free_aml_allocator(void); */ void aml_append(Aml *parent_ctx, Aml *child); +/* Block AML object primitives */ +Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2); + /* other helpers */ GArray *build_alloc_array(void); void build_free_array(GArray *array); diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index caf792b..f891406 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -271,6 +271,15 @@ static Aml *aml_alloc(void) return var; } +static Aml *aml_bundle(uint8_t op, AmlBlockFlags flags) +{ + Aml *var = aml_alloc(); + + var->op = op; + var->block_flags = flags; + return var; +} + static void aml_free(gpointer data) { Aml *var = data; @@ -335,3 +344,14 @@ void aml_append(Aml *parent_ctx, Aml *child) } build_append_array(parent_ctx->buf, child->buf); } + +/* ACPI 1.0b: 16.2.5.1 Namespace Modifier Objects Encoding: DefScope */ +Aml *aml_scope(const char *name_format, ...) +{ + va_list ap; + Aml *var = aml_bundle(0x10 /* ScopeOp */, AML_PACKAGE); + va_start(ap, name_format); + build_append_namestringv(var->buf, name_format, ap); + va_end(ap); + return var; +} -- MST