From patchwork Fri Feb 26 06:22:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 63278 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1580194lbc; Mon, 29 Feb 2016 18:39:15 -0800 (PST) X-Received: by 10.107.169.138 with SMTP id f10mr21763561ioj.192.1456799528609; Mon, 29 Feb 2016 18:32:08 -0800 (PST) Return-Path: Received: from lists.xen.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id b20si33648286ioe.8.2016.02.29.18.32.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Feb 2016 18:32:08 -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 1aZBpK-0006G2-0Z; Fri, 26 Feb 2016 06:24:34 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aZBpI-0006CB-0l for xen-devel@lists.xen.org; Fri, 26 Feb 2016 06:24:32 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 33/A9-23864-F9FEFC65; Fri, 26 Feb 2016 06:24:31 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1456467865!2874209!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 20856 invoked from network); 26 Feb 2016 06:24:30 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-9.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 26 Feb 2016 06:24:30 -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 DFG21618; Fri, 26 Feb 2016 14:24:11 +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:02 +0800 From: Shannon Zhao To: Date: Fri, 26 Feb 2016 14:22:56 +0800 Message-ID: <1456467780-8476-19-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.56CFEF8C.00E3, 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: b655a43ab9c8aa31ce0247daa9c2752f Cc: peter.huangpeng@huawei.com, stefano.stabellini@citrix.com, ian.campbell@citrix.com, shannon.zhao@linaro.org Subject: [Xen-devel] [PATCH v5 18/22] 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 --- V5: fix coding style --- 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 *);