From patchwork Fri Mar 25 13:48:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 64468 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp183282lbc; Fri, 25 Mar 2016 06:50:54 -0700 (PDT) X-Received: by 10.28.68.136 with SMTP id r130mr39270810wma.28.1458913848716; Fri, 25 Mar 2016 06:50:48 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id la7si14443212wjc.203.2016.03.25.06.50.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Mar 2016 06:50:48 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajS7S-00015v-Eu; Fri, 25 Mar 2016 13:49:42 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajS7R-000159-DN for xen-devel@lists.xen.org; Fri, 25 Mar 2016 13:49:41 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id AE/B2-29419-4F145F65; Fri, 25 Mar 2016 13:49:40 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-8.tower-206.messagelabs.com!1458913778!31144797!1 X-Originating-IP: [209.85.220.42] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30051 invoked from network); 25 Mar 2016 13:49:39 -0000 Received: from mail-pa0-f42.google.com (HELO mail-pa0-f42.google.com) (209.85.220.42) by server-8.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Mar 2016 13:49:39 -0000 Received: by mail-pa0-f42.google.com with SMTP id fe3so46934145pab.1 for ; Fri, 25 Mar 2016 06:49:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OYKk5JqJ514dH15aJfjw5fmKIuNksWPEzlZoBT9ZzP0=; b=Wpm5QOesxqm88cUFcdUe5IqBWIzQJyVk+mdpIJ32kVi6JAIe6wjB7uqtd3TwBu0x8p 5DjFhcgoMWRt1iwAutV3+wTo7uSUdPod+6oC4ZYDn3ntP5Yl81Hs7JMCEuRegY5UgOki PRppOnqPx2iRtrui8Hms9GpaLPzOTwNoZ1Ed8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OYKk5JqJ514dH15aJfjw5fmKIuNksWPEzlZoBT9ZzP0=; b=OPEYWGYF12QYBbqC4NDSAZcTXmdjj5kpX3+28VzTi4EcffR297W1NAJcyCYr52yUNr hJDwZkftQ/8IYWkb/V9Vf3e4PrCN1Oxu3F1YQKpyCh5m5PEQMkjVj123FkbOcWyni+Nh PB+s60nD1Fs0WoO6djAUu2LiiSKxxV+JxO+dpm8D8ENjNuONRbZIbZmpeuEsfbMW+7Tu hX8KXqa6dy2pDSMUwS/cB7cDRM0RXNsEHaBmbPqwULExmLRnBlg1xJej2z0rHc7oBHHP Q+0+VHqfbwpEXB/auBSucb6wofJwq4vFcVkR2jGlejMrV8qnuPdwJDS+5SnkmIkdVJHJ aPWw== X-Gm-Message-State: AD7BkJIE8JJ1owvvQ1AisstGuUu3xm8TxGBDGMOjIkMnSIIaamTBu0BVBthgUYeiqHuiC+Yl X-Received: by 10.66.255.39 with SMTP id an7mr21262365pad.2.1458913778422; Fri, 25 Mar 2016 06:49:38 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.2]) by smtp.gmail.com with ESMTPSA id w20sm16744178pfi.31.2016.03.25.06.49.34 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Mar 2016 06:49:37 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Fri, 25 Mar 2016 21:48:39 +0800 Message-Id: <1458913735-2678-7-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458913735-2678-1-git-send-email-shannon.zhao@linaro.org> References: <1458913735-2678-1-git-send-email-shannon.zhao@linaro.org> Cc: julien.grall@arm.com, shannon.zhao@linaro.org, stefano.stabellini@citrix.com, peter.huangpeng@huawei.com, zhaoshenglong@huawei.com Subject: [Xen-devel] [PATCH v7 06/22] 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" 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 86fc3e0..c09fb26 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