From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1muK-0000vx-9Y for qemu-devel@nongnu.org; Thu, 18 Dec 2014 21:03:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y1muB-0002dg-Kv for qemu-devel@nongnu.org; Thu, 18 Dec 2014 21:03:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1muB-0002ct-Du for qemu-devel@nongnu.org; Thu, 18 Dec 2014 21:02:59 -0500 From: Igor Mammedov Date: Fri, 19 Dec 2014 02:02:00 +0000 Message-Id: <1418954562-13716-6-git-send-email-imammedo@redhat.com> In-Reply-To: <1418954562-13716-1-git-send-email-imammedo@redhat.com> References: <1418954562-13716-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [RFC 05/47] acpi: add acpi_if() term List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, drjones@redhat.com, claudio.fontana@huawei.com, mst@redhat.com Signed-off-by: Igor Mammedov --- hw/acpi/acpi_gen_utils.c | 8 ++++++++ include/hw/acpi/acpi_gen_utils.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/acpi/acpi_gen_utils.c b/hw/acpi/acpi_gen_utils.c index a481adb..7bb41ce 100644 --- a/hw/acpi/acpi_gen_utils.c +++ b/hw/acpi/acpi_gen_utils.c @@ -289,6 +289,14 @@ static AcpiAml aml_allocate_internal(uint8_t op, AcpiBlockFlags flags) return var; } +/* ACPI 5.0: 20.2.5.3 Type 1 Opcodes Encoding: DefIfElse */ +AcpiAml acpi_if(AcpiAml predicate) +{ + AcpiAml var = aml_allocate_internal(0xA0 /* IfOp */, PACKAGE); + aml_append(&var, predicate); + return var; +} + /* ACPI 5.0: 20.2.5.2 Named Objects Encoding: DefMethod */ AcpiAml acpi_method(const char *name, int arg_count) { diff --git a/include/hw/acpi/acpi_gen_utils.h b/include/hw/acpi/acpi_gen_utils.h index 19ebc2d..177f9ed 100644 --- a/include/hw/acpi/acpi_gen_utils.h +++ b/include/hw/acpi/acpi_gen_utils.h @@ -22,6 +22,7 @@ typedef struct AcpiAml { void aml_append(AcpiAml *parent_ctx, AcpiAml child); /* Block ASL object primitives */ +AcpiAml acpi_if(AcpiAml predicate); AcpiAml acpi_method(const char *name, int arg_count); AcpiAml GCC_FMT_ATTR(1, 2) acpi_scope(const char *name_format, ...); AcpiAml GCC_FMT_ATTR(1, 2) acpi_device(const char *name_format, ...); -- 1.8.3.1