linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aleksey Makarov <aleksey.makarov@linaro.org>
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 <aleksey.makarov@linaro.org>,
	Russell King <linux@arm.linux.org.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Graeme Gregory <graeme.gregory@linaro.org>,
	Al Stone <ahs3@redhat.com>,
	Christopher Covington <cov@codeaurora.org>,
	Mark Salter <msalter@redhat.com>, Jiri Slaby <jslaby@suse.com>
Subject: [PATCH v2 8/9] serial: 8250: add acpi_match
Date: Fri, 12 Feb 2016 20:43:39 +0300	[thread overview]
Message-ID: <1455299022-11641-9-git-send-email-aleksey.makarov@linaro.org> (raw)
In-Reply-To: <1455299022-11641-1-git-send-email-aleksey.makarov@linaro.org>

From: Mark Salter <msalter@redhat.com>

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 <msalter@redhat.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 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 <linux/sunserialcore.h>
 #endif
+#include <linux/acpi.h>
 
 #include <asm/irq.h>
 
@@ -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,
-- 
2.7.0

  parent reply	other threads:[~2016-02-12 17:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12 17:43 [PATCH v2 0/9] ACPI: parse the SPCR table Aleksey Makarov
2016-02-12 17:43 ` [PATCH v2 1/9] printk: fix name and type of some variables Aleksey Makarov
2016-02-12 17:43 ` [PATCH v2 2/9] ACPI: Change __init to __ref for early_acpi_os_unmap_memory() Aleksey Makarov
2016-02-12 17:43 ` [PATCH v2 3/9] ACPI: introduce acpi_table_parse2() Aleksey Makarov
2016-02-12 18:44   ` kbuild test robot
2016-02-12 18:51   ` Greg Kroah-Hartman
2016-02-12 23:08     ` Rafael J. Wysocki
2016-02-15 12:57       ` Aleksey Makarov
2016-02-12 23:07   ` Rafael J. Wysocki
2016-02-15 12:51     ` Aleksey Makarov
2016-02-12 17:43 ` [PATCH v2 4/9] ACPI: parse SPCR and enable matching console Aleksey Makarov
2016-02-12 18:53   ` Greg Kroah-Hartman
2016-02-12 17:43 ` [PATCH v2 5/9] ACPI: enable ACPI_SPCR_TABLE on ARM64 Aleksey Makarov
2016-02-12 17:43 ` [PATCH v2 6/9] ACPI: add definition of DBG2 subtypes Aleksey Makarov
2016-02-12 22:47   ` Moore, Robert
2016-02-12 17:43 ` [PATCH v2 7/9] serial: pl011: add acpi_match Aleksey Makarov
2016-02-12 17:43 ` Aleksey Makarov [this message]
2016-02-12 18:56   ` [PATCH v2 8/9] serial: 8250: " Greg Kroah-Hartman
2016-02-12 17:43 ` [PATCH v2 9/9] serial: pl011: use SPCR to setup 32-bit access Aleksey Makarov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455299022-11641-9-git-send-email-aleksey.makarov@linaro.org \
    --to=aleksey.makarov@linaro.org \
    --cc=ahs3@redhat.com \
    --cc=cov@codeaurora.org \
    --cc=graeme.gregory@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=leif.lindholm@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=msalter@redhat.com \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).