From patchwork Fri May 29 13:10:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 49174 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B6D80218E7 for ; Fri, 29 May 2015 13:12:15 +0000 (UTC) Received: by lbbqq2 with SMTP id qq2sf18990005lbb.0 for ; Fri, 29 May 2015 06:12:14 -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: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=eH0DJ/6rZ78yw3hEjb+BcnqlwiyJynWw4sAc1AOZnLA=; b=lhgbjiMRXGaH5bSa8l9sTbxdORV7EkOySebu0Pa9r9DS502TG+k3CDHV3xwqd/98RU YRdpg6srcXy2Gf7MrM5GDQRi/mUV84RnOKWBlebGKIOdnlEb/4x4QAG71h62+9PzvtpS zR0i5/EvBsx8zQ/iH7Zjmj5c8tdpM4uRla+aBjtKJS0CGm4JYq6WA5BpHNayXo2raPkC lp7Ct1OMOhfoPCOfcDisxlK41O0CYwvrI5VgJJ0UeVkzLuQ18rp0aAp7F27OTETxH8cz f34LtKFh4Nzgium0LWj1SNx6qYEuSatWaGFAmf4Fr7U4JmV+cGF+ph79uCqKzFf97Bp2 +U1g== X-Gm-Message-State: ALoCoQkCGZqdVgZg+KHjDQODbmLK7KXxs8t4XM/qmKgXbqqVHbG3cXePeH+glPJYVqJgtUZjJ8F0 X-Received: by 10.152.8.17 with SMTP id n17mr7339563laa.0.1432905134670; Fri, 29 May 2015 06:12:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.10 with SMTP id p10ls361252lag.29.gmail; Fri, 29 May 2015 06:12:14 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr7786062lay.72.1432905134517; Fri, 29 May 2015 06:12:14 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id q6si4659715lby.85.2015.05.29.06.12.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 May 2015 06:12:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbqq2 with SMTP id qq2so48119134lbb.3 for ; Fri, 29 May 2015 06:12:14 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr7786041lay.72.1432905134292; Fri, 29 May 2015 06:12:14 -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.108.230 with SMTP id hn6csp321050lbb; Fri, 29 May 2015 06:12:13 -0700 (PDT) X-Received: by 10.140.27.211 with SMTP id 77mr9329369qgx.64.1432905128335; Fri, 29 May 2015 06:12:08 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g69si5512278qkh.104.2015.05.29.06.12.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 29 May 2015 06:12:08 -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]:35751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyK51-000530-6j for patch@linaro.org; Fri, 29 May 2015 09:12:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyK3v-0003sv-Gl for qemu-devel@nongnu.org; Fri, 29 May 2015 09:11:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YyK3s-0003Xg-3r for qemu-devel@nongnu.org; Fri, 29 May 2015 09:10:59 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyK3r-0003US-Sv for qemu-devel@nongnu.org; Fri, 29 May 2015 09:10:56 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1YyK3i-0005nm-NY for qemu-devel@nongnu.org; Fri, 29 May 2015 14:10:46 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 29 May 2015 14:10:34 +0100 Message-Id: <1432905045-22138-29-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1432905045-22138-1-git-send-email-peter.maydell@linaro.org> References: <1432905045-22138-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 28/39] hw/acpi/aml-build: Make aml_buffer() definition consistent with the spec 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: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=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 From: Shannon Zhao According to ACPI spec, DefBuffer can take two parameters: BufferSize and ByteList. Make it consistent with the spec. Uninitialized buffer could be requested by passing ByteList as NULL to reserve space. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao Reviewed-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Message-id: 1432522520-8068-15-git-send-email-zhaoshenglong@huawei.com Signed-off-by: Peter Maydell --- hw/acpi/aml-build.c | 16 ++++++++++++++-- include/hw/acpi/aml-build.h | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index de19c63..22478c2 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -642,10 +642,22 @@ Aml *aml_resource_template(void) return var; } -/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefBuffer */ -Aml *aml_buffer(void) +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefBuffer + * Pass byte_list as NULL to request uninitialized buffer to reserve space. + */ +Aml *aml_buffer(int buffer_size, uint8_t *byte_list) { + int i; Aml *var = aml_bundle(0x11 /* BufferOp */, AML_BUFFER); + + for (i = 0; i < buffer_size; i++) { + if (byte_list == NULL) { + build_append_byte(var->buf, 0x0); + } else { + build_append_byte(var->buf, byte_list[i]); + } + } + return var; } diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index f4e678f..fac70ea 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -253,7 +253,7 @@ Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2); Aml *aml_method(const char *name, int arg_count); Aml *aml_if(Aml *predicate); Aml *aml_package(uint8_t num_elements); -Aml *aml_buffer(void); +Aml *aml_buffer(int buffer_size, uint8_t *byte_list); Aml *aml_resource_template(void); Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule); Aml *aml_varpackage(uint32_t num_elements);