From patchwork Wed Mar 2 07:34:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 63375 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2242464lbc; Tue, 1 Mar 2016 23:38:05 -0800 (PST) X-Received: by 10.31.141.10 with SMTP id p10mr19656710vkd.93.1456904273878; Tue, 01 Mar 2016 23:37:53 -0800 (PST) Return-Path: Received: from lists.xen.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id m184si21588423vkf.194.2016.03.01.23.37.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Mar 2016 23:37:53 -0800 (PST) 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; 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.xen.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ab1LR-0005cs-Jm; Wed, 02 Mar 2016 07:37:17 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ab1LN-0005Zz-IQ for xen-devel@lists.xen.org; Wed, 02 Mar 2016 07:37:16 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id EC/64-23864-82896D65; Wed, 02 Mar 2016 07:37:12 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1456904227!26359976!1 X-Originating-IP: [119.145.14.66] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NiA9PiA4NTI3\n X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 59695 invoked from network); 2 Mar 2016 07:37:11 -0000 Received: from szxga03-in.huawei.com (HELO szxga03-in.huawei.com) (119.145.14.66) by server-8.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 2 Mar 2016 07:37:11 -0000 Received: from 172.24.1.47 (EHLO SZXEML424-HUB.china.huawei.com) ([172.24.1.47]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BXB04022; Wed, 02 Mar 2016 15:35:46 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by SZXEML424-HUB.china.huawei.com (10.82.67.153) with Microsoft SMTP Server id 14.3.235.1; Wed, 2 Mar 2016 15:35:24 +0800 From: Shannon Zhao To: Date: Wed, 2 Mar 2016 15:34:41 +0800 Message-ID: <1456904083-13168-16-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1456904083-13168-1-git-send-email-zhaoshenglong@huawei.com> References: <1456904083-13168-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.0A090203.56D697D4.00C1, 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: 57f6233ee19edc7299a080dcf7c8a6e9 Cc: zhaoshenglong@huawei.com, stefano.stabellini@citrix.com, ian.campbell@citrix.com, shannon.zhao@linaro.org Subject: [Xen-devel] [PATCH v8 15/17] arm/acpi: Add a new ACPI initialized function for UART 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" From: Shannon Zhao This adds a new function to initialize UART for ACPI on ARM. Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini --- xen/arch/arm/setup.c | 2 +- xen/drivers/char/arm-uart.c | 37 +++++++++++++++++++++++++++++++++++-- xen/include/xen/serial.h | 2 +- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index d4261e8..6d205a9 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -768,7 +768,7 @@ void __init start_xen(unsigned long boot_phys_offset, gic_preinit(); - dt_uart_init(); + arm_uart_init(); console_init_preirq(); console_init_ring(); diff --git a/xen/drivers/char/arm-uart.c b/xen/drivers/char/arm-uart.c index 883e615..627746b 100644 --- a/xen/drivers/char/arm-uart.c +++ b/xen/drivers/char/arm-uart.c @@ -1,7 +1,7 @@ /* * xen/drivers/char/arm-uart.c * - * Generic uart retrieved via the device tree + * Generic uart retrieved via the device tree or ACPI * * Julien Grall * Copyright (c) 2013 Linaro Limited. @@ -23,6 +23,7 @@ #include #include #include +#include /* * Configure UART port with a string: @@ -35,7 +36,7 @@ static char __initdata opt_dtuart[256] = ""; string_param("dtuart", opt_dtuart); -void __init dt_uart_init(void) +static void __init dt_uart_init(void) { struct dt_device_node *dev; int ret; @@ -96,6 +97,38 @@ void __init dt_uart_init(void) printk("Unable to initialize dtuart: %d\n", ret); } +#ifdef CONFIG_ACPI +static void __init acpi_uart_init(void) +{ + struct acpi_table_spcr *spcr = NULL; + int ret; + + acpi_get_table(ACPI_SIG_SPCR, 0, (struct acpi_table_header **)&spcr); + + if ( spcr == NULL ) + { + printk("Unable to get spcr table\n"); + } + else + { + ret = acpi_device_init(DEVICE_SERIAL, NULL, spcr->interface_type); + + if ( ret ) + printk("Unable to initialize acpi uart: %d\n", ret); + } +} +#else +static void __init acpi_uart_init(void) { } +#endif + +void __init arm_uart_init(void) +{ + if ( acpi_disabled ) + dt_uart_init(); + else + acpi_uart_init(); +} + /* * Local variables: * mode: C diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h index 71e6ade..1212a12 100644 --- a/xen/include/xen/serial.h +++ b/xen/include/xen/serial.h @@ -170,7 +170,7 @@ struct ns16550_defaults { void ns16550_init(int index, struct ns16550_defaults *defaults); void ehci_dbgp_init(void); -void __init dt_uart_init(void); +void arm_uart_init(void); struct physdev_dbgp_op; int dbgp_op(const struct physdev_dbgp_op *);