summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorAleksey Makarov <aleksey.makarov@linaro.org>2016-09-27 16:54:13 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-28 11:46:46 -0400
commitad1696f6f09daacfdf2bf04bc83cd8f48d80e34a (patch)
tree5621bb984dfcd615ce17180fd00f08d8163eb756 /drivers/tty
parentd503187b6cc4e41c21c02e695e0e7b5acdd066de (diff)
ACPI: parse SPCR and enable matching console
'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. Defer initialization of DT earlycon until ACPI/DT decision is made. Parse the ACPI SPCR table, setup earlycon if required, enable specified console. Thanks to Peter Hurley for explaining how this should work. [1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0044a/index.html [2] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639132(v=vs.85).aspx Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Tested-by: Kefeng Wang <wangkefeng.wang@huawei.com> Tested-by: Christopher Covington <cov@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/earlycon.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 836cad222fcc..c3651540e1ba 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -21,6 +21,7 @@
21#include <linux/sizes.h> 21#include <linux/sizes.h>
22#include <linux/of.h> 22#include <linux/of.h>
23#include <linux/of_fdt.h> 23#include <linux/of_fdt.h>
24#include <linux/acpi.h>
24 25
25#ifdef CONFIG_FIX_EARLYCON_MEM 26#ifdef CONFIG_FIX_EARLYCON_MEM
26#include <asm/fixmap.h> 27#include <asm/fixmap.h>
@@ -198,6 +199,14 @@ int __init setup_earlycon(char *buf)
198 return -ENOENT; 199 return -ENOENT;
199} 200}
200 201
202/*
203 * When CONFIG_ACPI_SPCR_TABLE is defined, "earlycon" without parameters in
204 * command line does not start DT earlycon immediately, instead it defers
205 * starting it until DT/ACPI decision is made. At that time if ACPI is enabled
206 * call parse_spcr(), else call early_init_dt_scan_chosen_stdout()
207 */
208bool earlycon_init_is_deferred __initdata;
209
201/* early_param wrapper for setup_earlycon() */ 210/* early_param wrapper for setup_earlycon() */
202static int __init param_setup_earlycon(char *buf) 211static int __init param_setup_earlycon(char *buf)
203{ 212{
@@ -207,8 +216,14 @@ static int __init param_setup_earlycon(char *buf)
207 * Just 'earlycon' is a valid param for devicetree earlycons; 216 * Just 'earlycon' is a valid param for devicetree earlycons;
208 * don't generate a warning from parse_early_params() in that case 217 * don't generate a warning from parse_early_params() in that case
209 */ 218 */
210 if (!buf || !buf[0]) 219 if (!buf || !buf[0]) {
211 return early_init_dt_scan_chosen_stdout(); 220 if (IS_ENABLED(CONFIG_ACPI_SPCR_TABLE)) {
221 earlycon_init_is_deferred = true;
222 return 0;
223 } else {
224 return early_init_dt_scan_chosen_stdout();
225 }
226 }
212 227
213 err = setup_earlycon(buf); 228 err = setup_earlycon(buf);
214 if (err == -ENOENT || err == -EALREADY) 229 if (err == -ENOENT || err == -EALREADY)