From patchwork Fri Feb 12 17:43:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 8294541 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E6C2AC02AA for ; Fri, 12 Feb 2016 17:52:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11D2C2041F for ; Fri, 12 Feb 2016 17:52:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 361C020212 for ; Fri, 12 Feb 2016 17:52:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aUHs9-0001k2-AW; Fri, 12 Feb 2016 17:51:13 +0000 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aUHqU-0007k7-Rc for linux-arm-kernel@lists.infradead.org; Fri, 12 Feb 2016 17:49:33 +0000 Received: by mail-lf0-x22a.google.com with SMTP id j78so56284229lfb.1 for ; Fri, 12 Feb 2016 09:49:10 -0800 (PST) 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=i0WB9xNhXWTM6g/1e4pwyAf5ze1EYEt3frKDyi2rjZo=; b=bSK5I3H4+69b9ZZsTc3EIfTE3kZnqH7W1UhRhuiWfc2NMjX2YuOg8DsCUBHWm7ztaq p5VNb3s4bQLyGrfmX8Kzhdugo+6nneR8tC7U0eSItG6N4rvcmHmE6wNNRGVyJdwVXUND P4uB10AETr72B9Xk2UtplbV11Nm2wauIOZVO0= 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=i0WB9xNhXWTM6g/1e4pwyAf5ze1EYEt3frKDyi2rjZo=; b=BDo5WRlZ8jU751XaqVibxeNZkDbziF7jltt8kvWq9AnFL7auk7nWEp6TbM+Qx4u0dd n1QIemefy8tbJvrH/RuwAUpnX/xqvj/RjPdMPmrpPMQO+M0nf7cFiyq9tSzwhZyyDrhJ 2lKwsLfJGr6nksl3nf+HVRgLJt4hzwoYGS7a2Dnnb5Fbca/YbTTtABHQDL/v12Y1c0j7 3ng7ZE0wa1a9EWCvp3FQyWWF3S/4CKGXrkeBYpjEwh/KCEL77ZwqHg4uuY1hIt8K4qlM VNHpiTc3AGklCRnT+57+8OYgK5MMXdweLHqaHILkBaqq4OVgbm76TMdYDv0bZnLuUAU/ qQKA== X-Gm-Message-State: AG10YOThOCYrs2jZRffBlXPdz81XPI259p0l6JsegPrUEmURbPjYPFfIesGSebhzSxPqdfmp X-Received: by 10.25.170.129 with SMTP id t123mr1196257lfe.103.1455299348866; Fri, 12 Feb 2016 09:49:08 -0800 (PST) Received: from turnip.localdomain (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id ei4sm2017549lbb.18.2016.02.12.09.49.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 09:49:07 -0800 (PST) From: Aleksey Makarov To: linux-acpi@vger.kernel.org Subject: [PATCH v2 8/9] serial: 8250: add acpi_match Date: Fri, 12 Feb 2016 20:43:39 +0300 Message-Id: <1455299022-11641-9-git-send-email-aleksey.makarov@linaro.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455299022-11641-1-git-send-email-aleksey.makarov@linaro.org> References: <1455299022-11641-1-git-send-email-aleksey.makarov@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160212_094931_314672_D5DC7743 X-CRM114-Status: GOOD ( 11.69 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Russell King , Graeme Gregory , Greg Kroah-Hartman , Jiri Slaby , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, Leif Lindholm , Aleksey Makarov , Christopher Covington , linux-serial@vger.kernel.org, Mark Salter , Al Stone , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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: Mark Salter Add an implementation of acpi_match() to the 8250 driver. It allows console to check if it matches the console specified by ACPI SPCR table. Signed-off-by: Mark Salter Signed-off-by: Aleksey Makarov --- drivers/tty/serial/8250/8250_core.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 7775221..059338a 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -40,6 +40,7 @@ #ifdef CONFIG_SPARC #include #endif +#include #include @@ -669,12 +670,34 @@ static int univ8250_console_match(struct console *co, char *name, int idx, return -ENODEV; } +static int __init univ8250_console_acpi_match(struct console *co, + struct acpi_table_spcr *spcr) +{ + int index = co->index >= 0 ? co->index : 0; + struct uart_port *port = &serial8250_ports[index].port; + + if (spcr->interface_type != ACPI_DBG2_16550_SUBSET && + spcr->interface_type != ACPI_DBG2_16550_COMPATIBLE) + return -ENODEV; + + if (spcr->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY && + spcr->serial_port.address == (u64)port->mapbase) + return 0; + + if (spcr->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_IO && + spcr->serial_port.address == (u64)port->iobase) + return 0; + + return -ENODEV; +} + static struct console univ8250_console = { .name = "ttyS", .write = univ8250_console_write, .device = uart_console_device, .setup = univ8250_console_setup, .match = univ8250_console_match, + .acpi_match = univ8250_console_acpi_match, .flags = CON_PRINTBUFFER | CON_ANYTIME, .index = -1, .data = &serial8250_reg,