From: Andy Shevchenko <andy.shevchenko@gmail.com> To: Aleksey Makarov <aleksey.makarov@linaro.org> Cc: "linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>, "linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, linux-arm Mailing List <linux-arm-kernel@lists.infradead.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>, Yury Norov <ynorov@caviumnetworks.com>, Peter Hurley <peter@hurleysoftware.com>, "Zheng, Lv" <lv.zheng@intel.com>, Len Brown <lenb@kernel.org>, Jiri Slaby <jslaby@suse.com> Subject: Re: [PATCH v4 1/4] ACPI: parse SPCR and enable matching console Date: Mon, 29 Feb 2016 15:29:41 +0200 [thread overview] Message-ID: <CAHp75VdswvD23xqRNUX=fwMt5HReR-wcSo+RYweB6FYqWPar8w@mail.gmail.com> (raw) In-Reply-To: <1456747355-15692-2-git-send-email-aleksey.makarov@linaro.org> On Mon, Feb 29, 2016 at 2:02 PM, Aleksey Makarov <aleksey.makarov@linaro.org> wrote: > 'ARM Server Base Boot Requiremets' [1] mentions SPCR (Serial Port > Console Redirection Table) [2] as a mandatory ACPI table that > specifies the configuration of serial console. > > Parse this table and check if any registered console match the > description. If it does, enable that console. > > Introduce a new function acpi_console_check(). At the uart port > registration, this function checks if the ACPI SPCR table specifies > its argument of type struct uart_port to be a console > and if so calls add_preferred_console(). > + if (ACPI_FAILURE(status)) { > + pr_err("could not get the table\n"); Is it worse to have on error level? Is it possible to have firmware without this table? I think it would be a normal case for non-arm world. I'm also not sure if this message useful even on warn level. > + return -ENOENT; > + } > + > + if (table->header.revision < 2) { > + err = -EINVAL; > + pr_err("wrong table version\n"); And this one quite good to have, indeed. > + * acpi_console_check - Check if uart matches the console specified by SPCR. > + * > + * @uport: uart port to check > + * Since you use sections, you may add: + * Description: > + * This function checks if the ACPI SPCR table specifies @uport to be a console > + * and if so calls add_preferred_console() > + * > + * Return: a non-error value if the console matches. > @@ -2654,8 +2655,17 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) > spin_lock_init(&uport->lock); > lockdep_set_class(&uport->lock, &port_lock_key); > } > - if (uport->cons && uport->dev) > - of_console_check(uport->dev->of_node, uport->cons->name, uport->line); > + > + /* > + * Support both open FW and ACPI access to console definitions. > + * Both of_console_check() and acpi_console_check() will call > + * add_preferred_console() if a console definition is found. > + */ > + if (uport->cons && uport->dev) { > + if (!acpi_console_check(uport)) if (cond1) { if (cond2) { ... } } is equivalent to if (cond1 && cond2) { ... } > + of_console_check(uport->dev->of_node, uport->cons->name, > + uport->line); > + } -- With Best Regards, Andy Shevchenko
WARNING: multiple messages have this Message-ID (diff)
From: andy.shevchenko@gmail.com (Andy Shevchenko) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 1/4] ACPI: parse SPCR and enable matching console Date: Mon, 29 Feb 2016 15:29:41 +0200 [thread overview] Message-ID: <CAHp75VdswvD23xqRNUX=fwMt5HReR-wcSo+RYweB6FYqWPar8w@mail.gmail.com> (raw) In-Reply-To: <1456747355-15692-2-git-send-email-aleksey.makarov@linaro.org> On Mon, Feb 29, 2016 at 2:02 PM, Aleksey Makarov <aleksey.makarov@linaro.org> wrote: > 'ARM Server Base Boot Requiremets' [1] mentions SPCR (Serial Port > Console Redirection Table) [2] as a mandatory ACPI table that > specifies the configuration of serial console. > > Parse this table and check if any registered console match the > description. If it does, enable that console. > > Introduce a new function acpi_console_check(). At the uart port > registration, this function checks if the ACPI SPCR table specifies > its argument of type struct uart_port to be a console > and if so calls add_preferred_console(). > + if (ACPI_FAILURE(status)) { > + pr_err("could not get the table\n"); Is it worse to have on error level? Is it possible to have firmware without this table? I think it would be a normal case for non-arm world. I'm also not sure if this message useful even on warn level. > + return -ENOENT; > + } > + > + if (table->header.revision < 2) { > + err = -EINVAL; > + pr_err("wrong table version\n"); And this one quite good to have, indeed. > + * acpi_console_check - Check if uart matches the console specified by SPCR. > + * > + * @uport: uart port to check > + * Since you use sections, you may add: + * Description: > + * This function checks if the ACPI SPCR table specifies @uport to be a console > + * and if so calls add_preferred_console() > + * > + * Return: a non-error value if the console matches. > @@ -2654,8 +2655,17 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) > spin_lock_init(&uport->lock); > lockdep_set_class(&uport->lock, &port_lock_key); > } > - if (uport->cons && uport->dev) > - of_console_check(uport->dev->of_node, uport->cons->name, uport->line); > + > + /* > + * Support both open FW and ACPI access to console definitions. > + * Both of_console_check() and acpi_console_check() will call > + * add_preferred_console() if a console definition is found. > + */ > + if (uport->cons && uport->dev) { > + if (!acpi_console_check(uport)) if (cond1) { if (cond2) { ... } } is equivalent to if (cond1 && cond2) { ... } > + of_console_check(uport->dev->of_node, uport->cons->name, > + uport->line); > + } -- With Best Regards, Andy Shevchenko
next prev parent reply other threads:[~2016-02-29 13:29 UTC|newest] Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-02-29 12:02 [PATCH v4 0/4] ACPI: parse the SPCR table Aleksey Makarov 2016-02-29 12:02 ` Aleksey Makarov 2016-02-29 12:02 ` [PATCH v4 1/4] ACPI: parse SPCR and enable matching console Aleksey Makarov 2016-02-29 12:02 ` Aleksey Makarov 2016-02-29 13:29 ` Andy Shevchenko [this message] 2016-02-29 13:29 ` Andy Shevchenko 2016-02-29 13:47 ` Aleksey Makarov 2016-02-29 13:47 ` Aleksey Makarov 2016-03-17 17:20 ` Timur Tabi 2016-03-17 17:20 ` Timur Tabi 2016-02-29 12:02 ` [PATCH v4 2/4] ACPI: enable ACPI_SPCR_TABLE on ARM64 Aleksey Makarov 2016-02-29 12:02 ` Aleksey Makarov 2016-03-01 15:27 ` Peter Hurley 2016-03-01 15:27 ` Peter Hurley 2016-03-01 17:35 ` Aleksey Makarov 2016-03-01 17:35 ` Aleksey Makarov 2016-03-17 17:20 ` Timur Tabi 2016-03-17 17:20 ` Timur Tabi 2016-03-17 17:20 ` Timur Tabi 2016-02-29 12:02 ` [PATCH v4 3/4] ACPI: add definitions of DBG2 subtypes Aleksey Makarov 2016-02-29 12:02 ` Aleksey Makarov 2016-02-29 12:02 ` [PATCH v4 4/4] serial: pl011: use ACPI SPCR to setup 32-bit access Aleksey Makarov 2016-02-29 12:02 ` Aleksey Makarov 2016-03-01 15:27 ` [PATCH v4 0/4] ACPI: parse the SPCR table Peter Hurley 2016-03-01 15:27 ` Peter Hurley 2016-03-01 15:31 ` Peter Hurley 2016-03-01 15:31 ` Peter Hurley 2016-03-03 11:59 ` Aleksey Makarov 2016-03-03 11:59 ` Aleksey Makarov 2016-03-03 15:35 ` Peter Hurley 2016-03-03 15:35 ` Peter Hurley 2016-03-04 11:53 ` Aleksey Makarov 2016-03-04 11:53 ` Aleksey Makarov 2016-03-04 15:47 ` Peter Hurley 2016-03-04 15:47 ` Peter Hurley 2016-03-11 16:25 ` Aleksey Makarov 2016-03-11 16:25 ` 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='CAHp75VdswvD23xqRNUX=fwMt5HReR-wcSo+RYweB6FYqWPar8w@mail.gmail.com' \ --to=andy.shevchenko@gmail.com \ --cc=ahs3@redhat.com \ --cc=aleksey.makarov@linaro.org \ --cc=cov@codeaurora.org \ --cc=graeme.gregory@linaro.org \ --cc=gregkh@linuxfoundation.org \ --cc=jslaby@suse.com \ --cc=leif.lindholm@linaro.org \ --cc=lenb@kernel.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=lv.zheng@intel.com \ --cc=peter@hurleysoftware.com \ --cc=rjw@rjwysocki.net \ --cc=ynorov@caviumnetworks.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.