From patchwork Sun Sep 13 12:43:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 53528 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 389EF22B26 for ; Sun, 13 Sep 2015 12:47:30 +0000 (UTC) Received: by lagj9 with SMTP id j9sf41844579lag.0 for ; Sun, 13 Sep 2015 05:47:29 -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=/7g+4YeCEUy/h0SjzVMVnibpnZhqBvCC6WAXRY97qOU=; b=e3ftw2Z5ws99it+ujy6RpwObV3aTayPD6Zz7hnSChKB76d+FMFwudG6XQ8Bl9MwbiW 7IISKCd/Nb8TTuuSMFDKubFc5vR0SBsFqWjMVHQxYV7MDV7kR4NI9T/bwwKwOzt3ARDy F0SIkmzybBpJnVfUElzQalTxiaSQR4uynuauymmuOvR+dkiCMYwlbHZ4uHnEHlak7+Gs GiZwiygFtug6vwC/ZObk6RPZ2GBF2nzC0o0k6HhRMmQz60GuVPD5t+7OZE0vPfnCvVE2 jsfGVcR1XmsDJx6GBzWWsePRqY9CENZR2FWVAlVoTtv2KjscSolDyWKb0vRA5XmFKNfN FoYw== X-Gm-Message-State: ALoCoQnvMYLf5UXzjUHTPym0/u7a2CS4jkQBN5//pXga+K8sTIBYw1T1o4BBek8BMOmrST6N0NAN X-Received: by 10.112.130.41 with SMTP id ob9mr1229128lbb.17.1442148449009; Sun, 13 Sep 2015 05:47:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.105 with SMTP id i9ls529397laa.72.gmail; Sun, 13 Sep 2015 05:47:28 -0700 (PDT) X-Received: by 10.112.166.106 with SMTP id zf10mr8439627lbb.36.1442148448829; Sun, 13 Sep 2015 05:47:28 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id n8si6438706lbm.52.2015.09.13.05.47.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Sep 2015 05:47:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lamp12 with SMTP id p12so71320211lam.0 for ; Sun, 13 Sep 2015 05:47:28 -0700 (PDT) X-Received: by 10.112.166.106 with SMTP id zf10mr8439621lbb.36.1442148448729; Sun, 13 Sep 2015 05:47:28 -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 w3csp701566lbq; Sun, 13 Sep 2015 05:47:27 -0700 (PDT) X-Received: by 10.50.124.106 with SMTP id mh10mr8757179igb.65.1442148447842; Sun, 13 Sep 2015 05:47:27 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id mf6si4940412igb.0.2015.09.13.05.47.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 13 Sep 2015 05:47:27 -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]:35744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6gp-0000EG-4m for patch@linaro.org; Sun, 13 Sep 2015 08:47:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6dp-00045e-Nf 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 1Zb6dl-0000En-QU for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6dl-0000ED-IC for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:17 -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 44444550CC for ; Sun, 13 Sep 2015 12:44:17 +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 t8DChnP1024712; Sun, 13 Sep 2015 08:44:15 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org Date: Sun, 13 Sep 2015 14:43:43 +0200 Message-Id: <1442148227-17343-10-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 09/13] hw/acpi: expose more parameters for aml_method() 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.49 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 ACPI 1.0b defines the SerializeFlag in MethodFlags. We have not exposed this until now, but serializing methods that create named objects is warmly recommended by (recent versions of) the ACPI spec, and recent iasl actually warns about it. Therefore expose SerializeFlag in a new function. The old aml_method() function is preserved for old callers' sake. While at it, expose the SyncLevel bitfield of MethodFlags as well. Because that was introduced in ACPI 2.0, add a separate function for it. This allows us to provide one comprehensive DefMethod implementation. Cc: Paolo Bonzini Cc: Gal Hammer Cc: Igor Mammedov Cc: "Michael S. Tsirkin" Signed-off-by: Laszlo Ersek --- include/hw/acpi/aml-build.h | 3 +++ hw/acpi/aml-build.c | 26 +++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index ee54242..f8f96ec 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -266,6 +266,9 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2); Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2); Aml *aml_method(const char *name, int arg_count); +Aml *aml_method_serialized(const char *name, int arg_count, bool serialized); +Aml *aml_method_flags(const char *name, int arg_count, bool serialized, + int sync_level); Aml *aml_if(Aml *predicate); Aml *aml_else(void); Aml *aml_while(Aml *predicate); diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 7d58483..a0f187e 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -698,9 +698,33 @@ Aml *aml_while(Aml *predicate) /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefMethod */ Aml *aml_method(const char *name, int arg_count) { + return aml_method_serialized(name, arg_count, false); +} + +/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefMethod */ +Aml *aml_method_serialized(const char *name, int arg_count, bool serialized) +{ + return aml_method_flags(name, arg_count, serialized, 0); +} + +/* ACPI 2.0: 17.2.4.2 Named Objects Encoding: DefMethod */ +Aml *aml_method_flags(const char *name, int arg_count, bool serialized, + int sync_level) +{ Aml *var = aml_bundle(0x14 /* MethodOp */, AML_PACKAGE); build_append_namestring(var->buf, "%s", name); - build_append_byte(var->buf, arg_count); /* MethodFlags: ArgCount */ + + assert(arg_count >= 0); + assert(arg_count <= 7); + if (serialized) { + assert(sync_level >= 0x00); + assert(sync_level <= 0x0f); + } else { + assert(sync_level == 0); + } + + build_append_byte(var->buf, + arg_count | (serialized << 3) | (sync_level << 4)); return var; }