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: 8294371 Return-Path: X-Original-To: patchwork-linux-acpi@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 1920DC02AA for ; Fri, 12 Feb 2016 17:49:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3478D20421 for ; Fri, 12 Feb 2016 17:49:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48B942041E for ; Fri, 12 Feb 2016 17:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752299AbcBLRtM (ORCPT ); Fri, 12 Feb 2016 12:49:12 -0500 Received: from mail-lf0-f52.google.com ([209.85.215.52]:36817 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbcBLRtK (ORCPT ); Fri, 12 Feb 2016 12:49:10 -0500 Received: by mail-lf0-f52.google.com with SMTP id 78so56289647lfy.3 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=Q1vmmv9lOs4Eqa/EjYTmgP88YcPJpbx9uNKLcnKhJO57kTdqyRRZLc8IjBKviuy1gl qUO+P4L3hiwnBPvdHx1cylGyumfo66U0cFWa4fV2cfp6xEp4KUas2zLw5ttckAQ3LKmI QoqK6ewXlRxdiIO3qoOzBxKU0HQrsYcrnPkMqUob4uc12npPckzbwPAFJhjUbuMrXnGj 3RFr2M+cP2pKTFJODlJrXBl9VtPzwXCanSJ1MT8IgwXnXXZBADg+3GgRUc1V0FUBHtzJ l6tZmj6wqaaG2pUCzif06LsxSqlfLADyl6Ut6ZJz6R7fKumW9yOsfa936S32oIxxzlAU Gikg== X-Gm-Message-State: AG10YOTil8Hf4gtm0qHGEsruwpJPT+eD/aPXyyPenDid2qXoO76JifTivXLdcg/hVKhhvrCa 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-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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,