From patchwork Thu May 21 02:28:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48836 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 551F22121F for ; Thu, 21 May 2015 02:39:58 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf22746977wgt.1 for ; Wed, 20 May 2015 19:39:57 -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=smtgpJnIBGrfa6RlS1EGi28ArtVh/PVcwNFHNr7oDuA=; b=hdiupqRNVQZ4V2njqk3kZ8S9/oOk84nP8Jdiq7cOLJrOy/Pu0ry9dJ4LPPbzsIah11 2R2PLXFqIAhwgIcogN6TBqorSycArILbWRF41bC907Ca4iapDywyZWQmgxRFT0JPwxiw Jwh/IIZ6UC9g/0JG4nJNjF7H4MoWOMTSbVGsDiMwgpdb1HnKdCpGMM0330/7CJjzuxaN XUGwexSFdSrHV8EPRbxH37mzurLY9Bc6MMMwW/jaE/M+X/oUVa21b1WEtuuCn4v7lF2D tGBHOLHblko74RJZQaXKZNb8JLwWWcqa0vqjc7mnnBKiTtZDm3YNES9flWsnVLYlgcw0 VWYw== X-Gm-Message-State: ALoCoQnpx3zyTN6Y+w7gPVpTM++W5qEHqBBp9rECpmS9WPOyAsLqIa5HgVVQjERNVrxDlruRyoGs X-Received: by 10.180.85.129 with SMTP id h1mr926727wiz.6.1432175997689; Wed, 20 May 2015 19:39:57 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.8.171 with SMTP id dl11ls262089lad.55.gmail; Wed, 20 May 2015 19:39:57 -0700 (PDT) X-Received: by 10.152.28.73 with SMTP id z9mr302142lag.93.1432175997551; Wed, 20 May 2015 19:39:57 -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 e9si12326637laa.104.2015.05.20.19.39.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2015 19:39:57 -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 qq2so8038477lbb.3 for ; Wed, 20 May 2015 19:39:57 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr331692lay.72.1432175997125; Wed, 20 May 2015 19:39:57 -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 hn6csp231492lbb; Wed, 20 May 2015 19:39:56 -0700 (PDT) X-Received: by 10.55.50.84 with SMTP id y81mr921986qky.98.1432175995619; Wed, 20 May 2015 19:39:55 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 5si5558525qkv.19.2015.05.20.19.39.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 20 May 2015 19:39:55 -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]:54648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvGOo-0000kO-Lp for patch@linaro.org; Wed, 20 May 2015 22:39:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvGJA-0006ev-PD for qemu-devel@nongnu.org; Wed, 20 May 2015 22:34:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvGJ6-0006oY-97 for qemu-devel@nongnu.org; Wed, 20 May 2015 22:34:04 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:2892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvGJ5-0006nd-MC for qemu-devel@nongnu.org; Wed, 20 May 2015 22:34:00 -0400 Received: from 172.24.2.119 (EHLO szxeml434-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CLR49670; Thu, 21 May 2015 10:30:39 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml434-hub.china.huawei.com (10.82.67.225) with Microsoft SMTP Server id 14.3.158.1; Thu, 21 May 2015 10:30:30 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Thu, 21 May 2015 10:28:48 +0800 Message-ID: <1432175331-12548-22-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432175331-12548-1-git-send-email-zhaoshenglong@huawei.com> References: <1432175331-12548-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 v8 21/24] hw/acpi/aml-build: Add Unicode macro 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.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 Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao Reviewed-by: Igor Mammedov --- hw/acpi/aml-build.c | 17 +++++++++++++++++ include/hw/acpi/aml-build.h | 1 + 2 files changed, 18 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index bd91981..323b7bc 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1069,6 +1069,23 @@ Aml *aml_touuid(const char *uuid) return var; } +/* + * ACPI 2.0b: 16.2.3.6.4.3 Unicode Macro (Convert Ascii String To Unicode) + */ +Aml *aml_unicode(const char *str) +{ + int i = 0; + Aml *var = aml_bundle(0x11 /* BufferOp */, AML_BUFFER); + + do { + build_append_byte(var->buf, str[i]); + build_append_byte(var->buf, 0); + i++; + } while (i <= strlen(str)); + + return var; +} + void build_header(GArray *linker, GArray *table_data, AcpiTableHeader *h, const char *sig, int len, uint8_t rev) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index b81c838..9773bfd 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -267,6 +267,7 @@ Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule); Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name); Aml *aml_varpackage(uint32_t num_elements); Aml *aml_touuid(const char *uuid); +Aml *aml_unicode(const char *str); void build_header(GArray *linker, GArray *table_data,