From patchwork Sun Sep 13 12:43:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 53529 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 B37FD22B26 for ; Sun, 13 Sep 2015 12:47:38 +0000 (UTC) Received: by lamp12 with SMTP id p12sf39077265lam.2 for ; Sun, 13 Sep 2015 05:47:37 -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=lzvoBgJ8ePIUSa/AJMWhbf36yLdBHffEMkdlhOkkLlE=; b=Za4DkAzSeQB/OvgAZGaay+2JDl/jcTaUUdhNMMhOYkzqT/3ur9oq8CBnMLFinICyib EwAxgC+s/ClIcWg6WFfaKB9v5V20PAj2m3HDyh00wOTI+j1J+9ARFgmOj85ktGbda3Mf LdlaDHZp55PSYGzdJhXvoJN0RF6Hzvz7V3buCIXRJFJ6VzHAQA93TTKod9LE7Z71ScDL QzvtKgoUKPUadM0MQTUyFeMmEgjrpciHv9HVC2wUVj6oulg06UEymngDNMg4FpRT34g8 7rlugWAeePHP7f3/y4r452ABtRgrqn1nQ1+3Yto9Z0AQN/cxRtTTYGhUBBubkZRO6Ofw uZdA== X-Gm-Message-State: ALoCoQlTM4FBriZwRGe36Y4p0pzWPNL94LfO8QMZRBh65ZWGyg3JDOZ/tKxUQVK+UVr4hRfi2yng X-Received: by 10.180.188.211 with SMTP id gc19mr1828499wic.6.1442148457450; Sun, 13 Sep 2015 05:47:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.132 with SMTP id q4ls349526laj.77.gmail; Sun, 13 Sep 2015 05:47:37 -0700 (PDT) X-Received: by 10.152.21.129 with SMTP id v1mr7980177lae.87.1442148457122; Sun, 13 Sep 2015 05:47:37 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id am8si6420133lac.144.2015.09.13.05.47.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Sep 2015 05:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lagj9 with SMTP id j9so73171583lag.2 for ; Sun, 13 Sep 2015 05:47:37 -0700 (PDT) X-Received: by 10.152.5.133 with SMTP id s5mr8450340las.19.1442148457034; Sun, 13 Sep 2015 05:47:37 -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 w3csp701616lbq; Sun, 13 Sep 2015 05:47:36 -0700 (PDT) X-Received: by 10.107.47.87 with SMTP id j84mr16295774ioo.168.1442148456104; Sun, 13 Sep 2015 05:47:36 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x4si4922971igr.34.2015.09.13.05.47.35 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 13 Sep 2015 05:47:36 -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]:35746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6gw-0000Pq-TH for patch@linaro.org; Sun, 13 Sep 2015 08:47:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6dp-00045d-Np for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zb6do-0000In-4z for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6do-0000IV-0e for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:20 -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 B28B08EA47 for ; Sun, 13 Sep 2015 12:44:19 +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 t8DChnP2024712; Sun, 13 Sep 2015 08:44:17 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org Date: Sun, 13 Sep 2015 14:43:44 +0200 Message-Id: <1442148227-17343-11-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 10/13] hw/acpi: add AML generator function for DataTableRegion() 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.47 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 This ASL operator (and the underlying AML) enables named ACPI data tables to be located from AML code, and to be accessed field-wise, like an operation region. This is useful for passing down "parameter tables" to the guest; the ACPI linker/loader can relocate pointers in them, and then the AML code can read valid pointer values from the fields in the tables. Cc: Paolo Bonzini Cc: Gal Hammer Cc: Igor Mammedov Cc: "Michael S. Tsirkin" Signed-off-by: Laszlo Ersek --- include/hw/acpi/aml-build.h | 2 ++ hw/acpi/aml-build.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index f8f96ec..dc4d215 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -225,6 +225,8 @@ 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 *aml_data_table_region(const char *name, Aml *sig, Aml *oem_id, + Aml *oem_table_id); Aml *aml_irq_no_flags(uint8_t irq); Aml *aml_named_field(const char *name, unsigned length); Aml *aml_reserved_field(unsigned length); diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index a0f187e..2dd2f33 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -788,6 +788,20 @@ Aml *aml_operation_region(const char *name, AmlRegionSpace rs, return var; } +/* ACPI 2.0: 17.2.4.2 Named Objects Encoding: DefDataRegion */ +Aml *aml_data_table_region(const char *name, Aml *sig, Aml *oem_id, + Aml *oem_table_id) +{ + Aml *var = aml_alloc(); + build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */ + build_append_byte(var->buf, 0x88); /* DataRegionOp */ + build_append_namestring(var->buf, "%s", name); + aml_append(var, sig); + aml_append(var, oem_id); + aml_append(var, oem_table_id); + return var; +} + /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: NamedField */ Aml *aml_named_field(const char *name, unsigned length) {