From patchwork Fri Feb 26 06:22:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8431791 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 46AC29F52D for ; Fri, 26 Feb 2016 06:26:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B85020392 for ; Fri, 26 Feb 2016 06:26:42 +0000 (UTC) Received: from lists.xen.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 5C91F20145 for ; Fri, 26 Feb 2016 06:26:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aZBpL-0006Kg-R3; Fri, 26 Feb 2016 06:24:35 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aZBpK-0006FM-0x for xen-devel@lists.xen.org; Fri, 26 Feb 2016 06:24:34 +0000 Received: from [193.109.254.147] by server-5.bemta-14.messagelabs.com id A4/C6-03497-1AFEFC65; Fri, 26 Feb 2016 06:24:33 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-15.tower-27.messagelabs.com!1456467867!26878909!1 X-Originating-IP: [58.251.152.64] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60865 invoked from network); 26 Feb 2016 06:24:31 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-15.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 26 Feb 2016 06:24:31 -0000 Received: from 172.24.1.47 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.1.47]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DFG21619; Fri, 26 Feb 2016 14:24:12 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by SZXEML429-HUB.china.huawei.com (10.82.67.184) with Microsoft SMTP Server id 14.3.235.1; Fri, 26 Feb 2016 14:24:04 +0800 From: Shannon Zhao To: Date: Fri, 26 Feb 2016 14:22:58 +0800 Message-ID: <1456467780-8476-21-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1456467780-8476-1-git-send-email-zhaoshenglong@huawei.com> References: <1456467780-8476-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.0A020204.56CFEF8D.0017, 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: 7e5804cc4ac3b459ea98dd3c8c15b57a Cc: peter.huangpeng@huawei.com, stefano.stabellini@citrix.com, ian.campbell@citrix.com, Jan Beulich , shannon.zhao@linaro.org Subject: [Xen-devel] [PATCH v5 20/22] arm/acpi: Initialize serial port from ACPI SPCR table 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=-1.9 required=5.0 tests=BAYES_00, 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 Parse ACPI SPCR (Serial Port Console Redirection table) table and initialize the serial port pl011. Signed-off-by: Parth Dixit Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini Acked-by: Jan Beulich --- Cc: Jan Beulich --- xen/drivers/char/pl011.c | 37 +++++++++++++++++++++++++++++++++++++ xen/include/acpi/actbl2.h | 5 +++++ 2 files changed, 42 insertions(+) diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c index 7e16294..30a8551 100644 --- a/xen/drivers/char/pl011.c +++ b/xen/drivers/char/pl011.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -308,6 +309,42 @@ DT_DEVICE_START(pl011, "PL011 UART", DEVICE_SERIAL) .init = pl011_dt_uart_init, DT_DEVICE_END +#ifdef CONFIG_ACPI +static int __init pl011_acpi_uart_init(const void *data) +{ + acpi_status status; + struct acpi_table_spcr *spcr = NULL; + int res; + + status = acpi_get_table(ACPI_SIG_SPCR, 0, + (struct acpi_table_header **)&spcr); + + if ( ACPI_FAILURE(status) ) + { + printk("pl011: Failed to get SPCR table\n"); + return -EINVAL; + } + + /* trigger/polarity information is not available in spcr */ + irq_set_type(spcr->interrupt, IRQ_TYPE_EDGE_BOTH); + + res = pl011_uart_init(spcr->interrupt, spcr->serial_port.address, + PAGE_SIZE); + if ( res < 0 ) + { + printk("pl011: Unable to initialize\n"); + return res; + } + + return 0; +} + +ACPI_DEVICE_START(apl011, "PL011 UART", DEVICE_SERIAL) + .class_type = ACPI_DBG2_PL011, + .init = pl011_acpi_uart_init, +ACPI_DEVICE_END +#endif + /* * Local variables: * mode: C diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h index 1ad67f8..4341a30 100644 --- a/xen/include/acpi/actbl2.h +++ b/xen/include/acpi/actbl2.h @@ -281,6 +281,11 @@ struct acpi_dbg2_device { #define ACPI_DBG2_16550_COMPATIBLE 0x0000 #define ACPI_DBG2_16550_SUBSET 0x0001 +#define ACPI_DBG2_PL011 0x0003 +#define ACPI_DBG2_SBSA_32 0x000d +#define ACPI_DBG2_SBSA 0x000e +#define ACPI_DBG2_DCC 0x000f +#define ACPI_DBG2_BCM2835 0x0010 #define ACPI_DBG2_1394_STANDARD 0x0000