From patchwork Mon May 25 02:55:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48935 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 ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0C0332121F for ; Mon, 25 May 2015 03:03:30 +0000 (UTC) Received: by lami4 with SMTP id i4sf18602489lam.3 for ; Sun, 24 May 2015 20:03: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:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type: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=ou8q6T/8SIyYVDHcWZAPb2LvLqoFPqmpJtAFvSl4hL0=; b=KpA9OeHdhntSnZx0HdL2H0jZXYbtbvlWe6FmjFSCl2LZpDTaP8D95ALMHOcE31I5zK sILrwXuk1f7glhfySV9aTwKIIFks+2vRF6XOAhA7CwXWmv6z29edghJJYJsKdOxNuF6Z LYSDPAxun0Nn4IU9ysop/iSmCRU2tX8K3NI/N8FaZlxHSJWazPUlPahAZEZKQkls/xyZ WqKzadhXRB6cIGFn+76mkMOjSTsS08zXWyEW5k6rSdGbZ5gH35pscMpSSAjfvngnlf2y XwWX7jssWTaFjDCbPv8FQmotk2+eVqb78TiSgQPAAO5quuZTjI4Qu0/lvT5MCOviJoEP HF/A== X-Gm-Message-State: ALoCoQkiS5Pt2pUU++iQn4Xbb/xDBe9p9kqpBZnevLQjCT/03gw900ZeJ/Ol2Yb50tY6UNxK7yds X-Received: by 10.112.122.39 with SMTP id lp7mr20207875lbb.5.1432523008958; Sun, 24 May 2015 20:03:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.201 with SMTP id p9ls139281lae.42.gmail; Sun, 24 May 2015 20:03:28 -0700 (PDT) X-Received: by 10.152.18.227 with SMTP id z3mr16162137lad.6.1432523008835; Sun, 24 May 2015 20:03:28 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id g1si7306956lbs.32.2015.05.24.20.03.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 May 2015 20:03:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbcmx3 with SMTP id mx3so43859523lbc.1 for ; Sun, 24 May 2015 20:03:28 -0700 (PDT) X-Received: by 10.112.222.133 with SMTP id qm5mr16397824lbc.86.1432523008755; Sun, 24 May 2015 20:03: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.108.230 with SMTP id hn6csp1542293lbb; Sun, 24 May 2015 20:03:27 -0700 (PDT) X-Received: by 10.140.28.163 with SMTP id 32mr25142986qgz.5.1432523007470; Sun, 24 May 2015 20:03:27 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s68si10100631qgs.69.2015.05.24.20.03.26 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 24 May 2015 20:03: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]:41676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ywifm-0007Vi-F9 for patch@linaro.org; Sun, 24 May 2015 23:03:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwicK-0001Fg-N7 for qemu-devel@nongnu.org; Sun, 24 May 2015 22:59:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YwicG-0001Te-Bi for qemu-devel@nongnu.org; Sun, 24 May 2015 22:59:52 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:64488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwicF-0001TP-Qv for qemu-devel@nongnu.org; Sun, 24 May 2015 22:59:48 -0400 Received: from 172.24.2.119 (EHLO szxeml428-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CLV56141; Mon, 25 May 2015 10:56:32 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml428-hub.china.huawei.com (10.82.67.183) with Microsoft SMTP Server id 14.3.158.1; Mon, 25 May 2015 10:56:21 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Mon, 25 May 2015 10:55:10 +0800 Message-ID: <1432522520-8068-15-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432522520-8068-1-git-send-email-zhaoshenglong@huawei.com> References: <1432522520-8068-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 Cc: hangaohuai@huawei.com, zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v9 14/24] 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: patch@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.178 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 --- 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);