From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6ds-0004Aq-5U for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zb6dr-0000Mv-1b for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45475) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6dq-0000MM-RW for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:22 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 8B574A4459 for ; Sun, 13 Sep 2015 12:44:22 +0000 (UTC) From: Laszlo Ersek Date: Sun, 13 Sep 2015 14:43:45 +0200 Message-Id: <1442148227-17343-12-git-send-email-lersek@redhat.com> In-Reply-To: <1442148227-17343-1-git-send-email-lersek@redhat.com> References: <55F5647C.6030901@redhat.com> <1442148227-17343-1-git-send-email-lersek@redhat.com> Subject: [Qemu-devel] [PATCH FYI 11/13] hw/acpi: add AML generator function for AccessAs() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gal Hammer , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov The AccessAs(AccessType) macro can be used inside the Field() operator in ASL, for diverging from the Field's default access type, for the fields that follow AccessAs(). The new helper function allows us to generate the matching AML. The AccessAttribute parameter of the macro (described in the spec) is not exposed because it is reserved for all spaces except SMBus device space, and we don't use that. Cc: Paolo Bonzini Cc: Gal Hammer Cc: Igor Mammedov Cc: "Michael S. Tsirkin" Signed-off-by: Laszlo Ersek --- include/hw/acpi/aml-build.h | 1 + hw/acpi/aml-build.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index dc4d215..32e49b3 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -230,6 +230,7 @@ Aml *aml_data_table_region(const char *name, Aml *sig, Aml *oem_id, Aml *aml_irq_no_flags(uint8_t irq); Aml *aml_named_field(const char *name, unsigned length); Aml *aml_reserved_field(unsigned length); +Aml *aml_access_field(AmlAccessType type); Aml *aml_local(int num); Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2); Aml *aml_lnot(Aml *arg); diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 2dd2f33..5aeb289 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -821,6 +821,17 @@ Aml *aml_reserved_field(unsigned length) return var; } +/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: AccessField */ +Aml *aml_access_field(AmlAccessType type) +{ + Aml *var = aml_alloc(); + /* AccessField := 0x01 AccessType AccessAttrib */ + build_append_byte(var->buf, 0x01); + build_append_byte(var->buf, type); + build_append_byte(var->buf, 0x00 /* reserved outside SMBus dev space */); + return var; +} + /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefField */ Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule) { -- 1.8.3.1