From patchwork Thu May 7 09:29:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48103 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3DE0B20553 for ; Thu, 7 May 2015 09:42:46 +0000 (UTC) Received: by wiun10 with SMTP id n10sf13841532wiu.1 for ; Thu, 07 May 2015 02:42:45 -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=yl74k5YGjkP3BbSb+gSdHa9BSjGRtHmSXWe31ef+0ys=; b=BuvZKCgFCtWDuv12+hImFXBz+L5lHwx/Ey+cd3CuT13SpLEZ3o/f4N+luS7C5zdJxe WDonke3JVM4lOG/rvr8kvlAzRJ7W8MNdbwEVEj0hZZptJ6r9co6GSPOMqz5e2n0lol4q n7Bb3wt8kX+LHeSqradgtaKCipSOkAQrcABoRc2ZwfD2z9AfBjYbWiFU6fIAuIVRNKHt Ygt1fVy3C5U+ZLbZRf6NWsxas/BOHGG2Aw5MUt3gqlwllbLSLh/9Q5adNZjhzIq5GlqO dV1uvLVuSQ0Ala/9jXPKNM5rL9l3oM9RuMWfdO6RvSY9KkmvOul/KyyxDuIz0mUjeHAa 4KQw== X-Gm-Message-State: ALoCoQmKkKPB9E3nFsKhZWd7BhLjt0WL6uOccOR+wVT/uJRgV+DB+JzsMzPd2klKpd2wSOY84Fjm X-Received: by 10.194.240.164 with SMTP id wb4mr1762553wjc.1.1430991765510; Thu, 07 May 2015 02:42:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.239.130 with SMTP id vs2ls148350lac.97.gmail; Thu, 07 May 2015 02:42:45 -0700 (PDT) X-Received: by 10.152.23.38 with SMTP id j6mr2257972laf.47.1430991765381; Thu, 07 May 2015 02:42:45 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id w2si930531laz.126.2015.05.07.02.42.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2015 02:42:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by labbd9 with SMTP id bd9so26472260lab.2 for ; Thu, 07 May 2015 02:42:45 -0700 (PDT) X-Received: by 10.152.9.66 with SMTP id x2mr2376680laa.36.1430991765256; Thu, 07 May 2015 02:42:45 -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.67.65 with SMTP id l1csp3332459lbt; Thu, 7 May 2015 02:42:44 -0700 (PDT) X-Received: by 10.140.33.227 with SMTP id j90mr3826270qgj.6.1430991764142; Thu, 07 May 2015 02:42:44 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 188si1431899qhr.88.2015.05.07.02.42.43 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 07 May 2015 02:42:44 -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]:49737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqIKJ-0006kx-9D for patch@linaro.org; Thu, 07 May 2015 05:42:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqIAK-0007sz-N0 for qemu-devel@nongnu.org; Thu, 07 May 2015 05:32:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqIAI-0001vk-Ol for qemu-devel@nongnu.org; Thu, 07 May 2015 05:32:24 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:42327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqIAI-0001uY-1p for qemu-devel@nongnu.org; Thu, 07 May 2015 05:32:22 -0400 Received: from 172.24.2.119 (EHLO szxeml426-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CNI17483; Thu, 07 May 2015 17:32:07 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.158.1; Thu, 7 May 2015 17:31:41 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Thu, 7 May 2015 17:29:22 +0800 Message-ID: <1430990964-10528-21-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1430990964-10528-1-git-send-email-zhaoshenglong@huawei.com> References: <1430990964-10528-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 v6 20/22] 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.46 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 67b7719..06f9d37 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1061,6 +1061,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 5ff9c14..39b44e4 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -269,6 +269,7 @@ Aml *aml_field(const char *name, AmlFieldFlags flags); 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,