From patchwork Thu May 14 09:19:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48484 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 A1432214BA for ; Thu, 14 May 2015 09:22:51 +0000 (UTC) Received: by wgvl6 with SMTP id l6sf16249450wgv.2 for ; Thu, 14 May 2015 02:22:51 -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=5dVUZTUsZtBmZeEj1MTMqbNkt/Tc1y2sqO0163x1sZE=; b=BbGujkEE7/qoTeP56bmAuk3tib2IbAx47J3rJa0VKO9UPH454Vp6Ya9BHV7XhUmaZ/ Wg4MlY9eQdxpLJVnP1ph6SyhsuwvKwUQ9V6PouyVEtNbvWxx9kumys0aTEpw9vZGBNoG YN/lg+QMWZro+BtXNdEx0y4uKEkZkcADb4UCqbrYVoWtL3gCiSJ+ukptTdLBbSI1I5/j wgox3n7jMvtlynAo02nkZY6eCLGwN698VukBpyA6QRtAaDH6Ct/Sc5w3zvA95pMxATAZ xhMzWFcz+ZkjHHNQe0wDbNtD/CCGE93Yg3AN3Wh9Svcd92dkY3ufETiqB8QtUGK/aEj6 BR4g== X-Gm-Message-State: ALoCoQlRaUywJRnEMxVmRHbuJBFIX5QlGpq4TJFpfz5L2BDMqfpOXhSsIABHL8L9DX0Ln9ipViEJ X-Received: by 10.112.42.236 with SMTP id r12mr2451315lbl.2.1431595370940; Thu, 14 May 2015 02:22:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.12 with SMTP id dc12ls46696lac.17.gmail; Thu, 14 May 2015 02:22:50 -0700 (PDT) X-Received: by 10.112.125.33 with SMTP id mn1mr2415287lbb.82.1431595370834; Thu, 14 May 2015 02:22:50 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id es16si14110133lbc.122.2015.05.14.02.22.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 May 2015 02:22:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by laat2 with SMTP id t2so58938012laa.1 for ; Thu, 14 May 2015 02:22:50 -0700 (PDT) X-Received: by 10.152.27.98 with SMTP id s2mr2496659lag.106.1431595369231; Thu, 14 May 2015 02:22:49 -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 hn6csp1113057lbb; Thu, 14 May 2015 02:22:48 -0700 (PDT) X-Received: by 10.140.94.104 with SMTP id f95mr4037947qge.38.1431595368040; Thu, 14 May 2015 02:22:48 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 194si687895qhs.8.2015.05.14.02.22.47 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 14 May 2015 02:22:48 -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]:53242 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YspLr-0001Xg-2h for patch@linaro.org; Thu, 14 May 2015 05:22:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YspKi-0000Ad-Eb for qemu-devel@nongnu.org; Thu, 14 May 2015 05:21:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YspKd-0004zk-HK for qemu-devel@nongnu.org; Thu, 14 May 2015 05:21:36 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:31063) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YspKc-0004sY-CJ for qemu-devel@nongnu.org; Thu, 14 May 2015 05:21:31 -0400 Received: from 172.24.2.119 (EHLO szxeml430-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CNT05321; Thu, 14 May 2015 17:21:15 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml430-hub.china.huawei.com (10.82.67.185) with Microsoft SMTP Server id 14.3.158.1; Thu, 14 May 2015 17:21:07 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Thu, 14 May 2015 17:19:39 +0800 Message-ID: <1431595182-7552-21-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1431595182-7552-1-git-send-email-zhaoshenglong@huawei.com> References: <1431595182-7552-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: 58.251.152.64 Cc: hangaohuai@huawei.com, zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v7 20/23] 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.215.43 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 --- hw/acpi/aml-build.c | 18 ++++++++++++++++++ include/hw/acpi/aml-build.h | 1 + 2 files changed, 19 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 238d6a3..360023a 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1056,6 +1056,24 @@ 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) +{ + Aml *var = aml_bundle(0x11 /* BufferOp */, AML_BUFFER); + + while (*str != '\0') { + build_append_byte(var->buf, 0); + build_append_byte(var->buf, *str); + str++; + } + build_append_byte(var->buf, 0); + build_append_byte(var->buf, *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 2fea838..564561e 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -275,6 +275,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,