From patchwork Wed May 20 05:00:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48785 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C2BFE21411 for ; Wed, 20 May 2015 05:05:12 +0000 (UTC) Received: by lagr1 with SMTP id r1sf12983899lag.3 for ; Tue, 19 May 2015 22:05:11 -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=jnZkFB3m+w4tQ5QH3X+OYWjvO/RO+SYr+2KSw2iDqLs=; b=ZmUb76q9EBM7S9DITyuao7C7bzQ0oaRuSIqa5PIaYeq90rIyjBdTTfA7RENCsPP7// oW/gHYamb0qQpOwRyXK/7T5Z5c7T1E1Ijh9Xk+nf6ekhWMmP3iFBZJ34nxK8Xh5vePrR SalnqolSh7xs1dJoNaaY6dDEK6KayowRnLPcsYEZbrMeRPj+ZGAxNLgP7c2RegpUa8SD s3cqQ/gNzienQof1OAiybH5O7BU0MZ6JEAWFVMjndxLd9lWqBJ4hugZYHbuiFZYKgrin wwkGmWRRxNEdLjgAOfwzJATTWGDfKihRVI8GrSYVxtWfhhcDuEORojn2OF5vsxFMAMc9 AKHw== X-Gm-Message-State: ALoCoQnrfu88akRyaVIC1eIc7MhfyvI1hldfiz8yoT72jC6MAYcPEGBYqNQ6rlktp7WqhwVg6S70 X-Received: by 10.180.160.197 with SMTP id xm5mr5745143wib.1.1432098311731; Tue, 19 May 2015 22:05:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.232 with SMTP id o8ls148034lag.39.gmail; Tue, 19 May 2015 22:05:11 -0700 (PDT) X-Received: by 10.152.22.72 with SMTP id b8mr8214044laf.1.1432098311596; Tue, 19 May 2015 22:05:11 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id x9si10448363lal.18.2015.05.19.22.05.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 May 2015 22:05:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lagv1 with SMTP id v1so56605490lag.3 for ; Tue, 19 May 2015 22:05:11 -0700 (PDT) X-Received: by 10.112.204.6 with SMTP id ku6mr7002169lbc.73.1432098311174; Tue, 19 May 2015 22:05:11 -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 hn6csp1269172lbb; Tue, 19 May 2015 22:05:10 -0700 (PDT) X-Received: by 10.229.215.10 with SMTP id hc10mr21549627qcb.22.1432098310006; Tue, 19 May 2015 22:05:10 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u125si948900qhd.75.2015.05.19.22.05.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 May 2015 22:05:10 -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]:49877 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuwBp-0008DE-5U for patch@linaro.org; Wed, 20 May 2015 01:05:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuwBS-0007wn-1S for qemu-devel@nongnu.org; Wed, 20 May 2015 01:04:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YuwBN-0005ie-OL for qemu-devel@nongnu.org; Wed, 20 May 2015 01:04:45 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:52923) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuwBN-0005i7-5W for qemu-devel@nongnu.org; Wed, 20 May 2015 01:04:41 -0400 Received: from 172.24.2.119 (EHLO szxeml432-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BGH47675; Wed, 20 May 2015 13:01:17 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml432-hub.china.huawei.com (10.82.67.209) with Microsoft SMTP Server id 14.3.158.1; Wed, 20 May 2015 13:01:08 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Wed, 20 May 2015 13:00:58 +0800 Message-ID: <1432098058-11124-1-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1431595182-7552-21-git-send-email-zhaoshenglong@huawei.com> References: <1431595182-7552-21-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.555C151E.022A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 0a2617bcef374004de6181d8b2d1bbb1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 Cc: hangaohuai@huawei.com, zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Subject: [Qemu-devel] [RESEND 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.53 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 | 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 9a80b80..aa34d0a 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1121,6 +1121,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,