From patchwork Sat Jan 23 09:20:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 60249 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp353103lbb; Sat, 23 Jan 2016 01:27:37 -0800 (PST) X-Received: by 10.194.103.2 with SMTP id fs2mr8700445wjb.36.1453541257146; Sat, 23 Jan 2016 01:27:37 -0800 (PST) Return-Path: Received: from lists.xen.org (lists.xenproject.org. [50.57.142.19]) by mx.google.com with ESMTPS id w124si9963401wmw.53.2016.01.23.01.27.36 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 23 Jan 2016 01:27:37 -0800 (PST) Received-SPF: neutral (google.com: 50.57.142.19 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=50.57.142.19; Authentication-Results: mx.google.com; spf=neutral (google.com: 50.57.142.19 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.72) (envelope-from ) id 1aMuSe-0000Ug-ES; Sat, 23 Jan 2016 09:26:24 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMuSc-0000TZ-Kk for xen-devel@lists.xen.org; Sat, 23 Jan 2016 09:26:22 +0000 Received: from [85.158.137.68] by server-10.bemta-3.messagelabs.com id FA/C4-02807-D3743A65; Sat, 23 Jan 2016 09:26:21 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1453541175!17684018!1 X-Originating-IP: [58.251.152.64] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 58400 invoked from network); 23 Jan 2016 09:26:20 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-5.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 23 Jan 2016 09:26:20 -0000 Received: from 172.24.1.51 (EHLO szxeml427-hub.china.huawei.com) ([172.24.1.51]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DDP82357; Sat, 23 Jan 2016 17:22:36 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml427-hub.china.huawei.com (10.82.67.182) with Microsoft SMTP Server id 14.3.235.1; Sat, 23 Jan 2016 17:22:24 +0800 From: Shannon Zhao To: Date: Sat, 23 Jan 2016 17:20:10 +0800 Message-ID: <1453540813-15764-19-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1453540813-15764-1-git-send-email-zhaoshenglong@huawei.com> References: <1453540813-15764-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.0A090204.56A3465E.0026, 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: 1ac599181ab12892ed4b5332b18c5fb7 Cc: ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, peter.huangpeng@huawei.com, julien.grall@citrix.com, stefano.stabellini@citrix.com, shannon.zhao@linaro.org Subject: [Xen-devel] [PATCH v4 18/21] arm/acpi: Add a new ACPI initialized function for UART X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org From: Shannon Zhao This adds a new function to initialize UART for ACPI on ARM. Signed-off-by: Shannon Zhao --- xen/arch/arm/setup.c | 2 +- xen/drivers/char/arm-uart.c | 33 +++++++++++++++++++++++++++++++-- xen/include/xen/serial.h | 2 +- 3 files changed, 33 insertions(+), 4 deletions(-) -- 2.0.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index c15a09d..63feadf 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -766,7 +766,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..a68959b 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,34 @@ void __init dt_uart_init(void) printk("Unable to initialize dtuart: %d\n", ret); } +static void __init acpi_uart_init(void) +{ +#ifdef CONFIG_ACPI + 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); + } +#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..5e1a536 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 __init arm_uart_init(void); struct physdev_dbgp_op; int dbgp_op(const struct physdev_dbgp_op *);