From patchwork Wed Mar 30 10:07:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8695001 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A0E8EC0555 for ; Wed, 30 Mar 2016 10:11:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8E4820382 for ; Wed, 30 Mar 2016 10:11:43 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2C9420379 for ; Wed, 30 Mar 2016 10:11:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1alD3x-0002Xq-IJ; Wed, 30 Mar 2016 10:09:21 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1alD3w-0002Ww-Iv for xen-devel@lists.xen.org; Wed, 30 Mar 2016 10:09:20 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id E8/74-03149-FC5ABF65; Wed, 30 Mar 2016 10:09:19 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-6.tower-31.messagelabs.com!1459332552!5814516!1 X-Originating-IP: [119.145.14.65] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NSA9PiA3NzQ2Mw==\n X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7408 invoked from network); 30 Mar 2016 10:09:18 -0000 Received: from szxga02-in.huawei.com (HELO szxga02-in.huawei.com) (119.145.14.65) by server-6.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 30 Mar 2016 10:09:18 -0000 Received: from 172.24.1.50 (EHLO SZXEML423-HUB.china.huawei.com) ([172.24.1.50]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DEK04340; Wed, 30 Mar 2016 18:09:03 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by SZXEML423-HUB.china.huawei.com (10.82.67.154) with Microsoft SMTP Server id 14.3.235.1; Wed, 30 Mar 2016 18:08:53 +0800 From: Shannon Zhao To: Date: Wed, 30 Mar 2016 18:07:59 +0800 Message-ID: <1459332494-18964-7-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1459332494-18964-1-git-send-email-zhaoshenglong@huawei.com> References: <1459332494-18964-1-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.0A090201.56FBA5C0.00ED, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3810e56df2ee986adb4f3534d7eb32c0 Cc: sstabellini@kernel.org, peter.huangpeng@huawei.com, julien.grall@arm.com, stefano.stabellini@citrix.com, shannon.zhao@linaro.org, zhaoshenglong@huawei.com Subject: [Xen-devel] [PATCH v8 06/21] arm/acpi: Prepare STAO table for Dom0 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shannon Zhao Create STAO table for Dom0. This table is used to tell Dom0 whether it should ignore UART defined in SPCR table or the ACPI namespace names. Look at below url for details: http://wiki.xenproject.org/mediawiki/images/0/02/Status-override-table.pdf Signed-off-by: Parth Dixit Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini Acked-by: Julien Grall --- xen/arch/arm/domain_build.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 9d17295..3df2c00 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1357,6 +1357,43 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) } #ifdef CONFIG_ACPI +static int acpi_create_stao(struct domain *d, struct membank tbl_add[]) +{ + struct acpi_table_header *table = NULL; + struct acpi_table_stao *stao = NULL; + u32 table_size = sizeof(struct acpi_table_stao); + u32 offset = acpi_get_table_offset(tbl_add, TBL_STAO); + acpi_status status; + u8 *base_ptr, checksum; + + /* Copy OEM and ASL compiler fields from another table, use MADT */ + status = acpi_get_table(ACPI_SIG_MADT, 0, &table); + + if ( ACPI_FAILURE(status) ) + { + const char *msg = acpi_format_exception(status); + + printk("STAO: Failed to get MADT table, %s\n", msg); + return -EINVAL; + } + + base_ptr = d->arch.efi_acpi_table + offset; + ACPI_MEMCPY(base_ptr, table, sizeof(struct acpi_table_header)); + + stao = (struct acpi_table_stao *)base_ptr; + ACPI_MEMCPY(stao->header.signature, ACPI_SIG_STAO, 4); + stao->header.revision = 1; + stao->header.length = table_size; + stao->ignore_uart = 1; + checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, stao), table_size); + stao->header.checksum -= checksum; + + tbl_add[TBL_STAO].start = d->arch.efi_acpi_gpa + offset; + tbl_add[TBL_STAO].size = table_size; + + return 0; +} + static int acpi_create_madt(struct domain *d, struct membank tbl_add[]) { struct acpi_table_header *table = NULL; @@ -1544,6 +1581,10 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) if ( rc != 0 ) return rc; + rc = acpi_create_stao(d, tbl_add); + if ( rc != 0 ) + return rc; + return 0; } #else