From patchwork Sun Sep 13 12:43:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 53534 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 42EAE22B26 for ; Sun, 13 Sep 2015 12:50:45 +0000 (UTC) Received: by lamp12 with SMTP id p12sf39089075lam.2 for ; Sun, 13 Sep 2015 05:50:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=qT0y/jbrgFFzw5l6kynYKW5V7IYXD9snV4MOFhO6cB0=; b=GL3Jvz4fl/ZDtkrJi6NMhumA2HSxHNdTBBIXPNWmphxdCq+kp1rki70Ot9IK8j77Wl DYyP3WGVMnVh4r+MDSPsBnYWqQGm5y+GHMVT/Kj5193JN6Erj7YtMm7zSDbZsVHmLOjT MKCYntg1+I81ywROAAYP5mNt7oJ1rSgkJzNmQjB4vAEkybP218+laMYD5EKQyG1rSuUz If5e079z5Tajdktue0n787earXMEy+S35PIsckIA1pqZxVh6PKEAGTOkCk5ECKJKiwGy wxDN3iLQohIuW1YkQLj1+gKdqWe8piYt4dyT+ptulQOSBFh3iZIQKqVDyct9yWfz29hX sUSg== X-Gm-Message-State: ALoCoQlWYBlGpjSngvWJHSv5/KVYj3+XpCcdetZ26EmEq+TVcsBS63I5sn3SEsORDmBp23QynoTy X-Received: by 10.112.140.195 with SMTP id ri3mr2020827lbb.22.1442148644224; Sun, 13 Sep 2015 05:50:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.130 with SMTP id r2ls426811laa.87.gmail; Sun, 13 Sep 2015 05:50:44 -0700 (PDT) X-Received: by 10.112.128.227 with SMTP id nr3mr8535277lbb.42.1442148644032; Sun, 13 Sep 2015 05:50:44 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id e2si5319262lae.170.2015.09.13.05.50.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Sep 2015 05:50:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lagj9 with SMTP id j9so73193232lag.2 for ; Sun, 13 Sep 2015 05:50:43 -0700 (PDT) X-Received: by 10.112.51.142 with SMTP id k14mr7843090lbo.76.1442148643471; Sun, 13 Sep 2015 05:50:43 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp702870lbq; Sun, 13 Sep 2015 05:50:42 -0700 (PDT) X-Received: by 10.50.66.232 with SMTP id i8mr10786175igt.34.1442148642627; Sun, 13 Sep 2015 05:50:42 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l63si6037100ioi.153.2015.09.13.05.50.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 13 Sep 2015 05:50:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:35781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6jx-0006UR-Gy for patch@linaro.org; Sun, 13 Sep 2015 08:50:41 -0400 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) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8DChnP3024712; Sun, 13 Sep 2015 08:44:20 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gal Hammer , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov Subject: [Qemu-devel] [PATCH FYI 11/13] hw/acpi: add AML generator function for AccessAs() 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lersek@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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) {