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: 61877 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp967670lbl; Fri, 12 Feb 2016 09:49:20 -0800 (PST) X-Received: by 10.98.42.207 with SMTP id q198mr3966838pfq.103.1455299360370; Fri, 12 Feb 2016 09:49:20 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u69si21217355pfa.253.2016.02.12.09.49.20; Fri, 12 Feb 2016 09:49:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752351AbcBLRtO (ORCPT + 30 others); Fri, 12 Feb 2016 12:49:14 -0500 Received: from mail-lf0-f53.google.com ([209.85.215.53]:34865 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752271AbcBLRtK (ORCPT ); Fri, 12 Feb 2016 12:49:10 -0500 Received: by mail-lf0-f53.google.com with SMTP id l143so56386485lfe.2 for ; Fri, 12 Feb 2016 09:49:09 -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=hz7cMavm14fEhJ3QOdXJbI/Z68PUX5JJ6Pra2ay/EgxwlHCU1oWPtQvrte0vnVrcwj rZs7WO8k4dZ8PEJ/A6N3dOfOQnFE2NwLLkFM5dpQ/lJeDXkjssB8eZbqx8/gOuKTg2n0 uyjzWJiGS8YoQa1FZ9dNyw2WCZpjD1yVvALU4slDKFD1tbJSbBQZ+AeYPI6XXy6GKHqv bs5hwevw5mbjmol9t/OqIm5m9fZwli/tbTFjFTS+3OS7T+oAVlnxppQ0VWg5i7qf99K/ IzK1RYrGrVNFMr696zB55hYS4XuGTQ349EKqGTwAcbQGMrsBpoKBIqtdCkoM1xiMrbNA TI2g== X-Gm-Message-State: AG10YOQS+WmpCL8mrRlKMCXH6hjJnv9LWR/xyzN13rkNkcvoslwX4sG5QMVzyub88lZToYIB 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 Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Aleksey Makarov , Russell King , Greg Kroah-Hartman , "Rafael J . Wysocki" , Leif Lindholm , Graeme Gregory , Al Stone , Christopher Covington , Mark Salter , Jiri Slaby 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 2.7.0 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,