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: 469383 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6E06D140281 for ; Thu, 7 May 2015 19:42:21 +1000 (AEST) Received: from localhost ([::1]:49737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqIJv-0006kx-D7 for incoming@patchwork.ozlabs.org; Thu, 07 May 2015 05:42:19 -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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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,