linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-serial@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: mark.rutland@arm.com, al.stone@linaro.org, torez@redhat.com,
	jcm@redhat.com, graeme.gregory@linaro.org,
	linaro-acpi@lists.linaro.org, lv.zheng@intel.com
Subject: [RFC 1/5] arm64: move acpi/dt decision earlier in boot process
Date: Tue,  8 Sep 2015 13:43:33 +0100	[thread overview]
Message-ID: <1441716217-23786-2-git-send-email-leif.lindholm@linaro.org> (raw)
In-Reply-To: <1441716217-23786-1-git-send-email-leif.lindholm@linaro.org>

In order to support selecting earlycon via either ACPI or DT, move
the decision on whether to attempt ACPI configuration into the
early_param handling. Then make acpi_boot_table_init() bail out if
acpi_disabled.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
 arch/arm64/kernel/acpi.c | 53 +++++++++++++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 25 deletions(-)

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 19de753..b9a5623 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -39,6 +39,19 @@ EXPORT_SYMBOL(acpi_pci_disabled);
 static bool param_acpi_off __initdata;
 static bool param_acpi_force __initdata;
 
+static int __init dt_scan_depth1_nodes(unsigned long node,
+				       const char *uname, int depth,
+				       void *data)
+{
+	/*
+	 * Return 1 as soon as we encounter a node at depth 1 that is
+	 * not the /chosen node.
+	 */
+	if (depth == 1 && (strcmp(uname, "chosen") != 0))
+		return 1;
+	return 0;
+}
+
 static int __init parse_acpi(char *arg)
 {
 	if (!arg)
@@ -52,22 +65,25 @@ static int __init parse_acpi(char *arg)
 	else
 		return -EINVAL;	/* Core will print when we return error */
 
-	return 0;
-}
-early_param("acpi", parse_acpi);
+	/*
+	 * Enable ACPI instead of device tree unless
+	 * - ACPI has been disabled explicitly (acpi=off), or
+	 * - the device tree is not empty (it has more than just a /chosen node)
+	 *   and ACPI has not been force enabled (acpi=force)
+	 */
+	if (param_acpi_off ||
+	    (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
+		return 0;
 
-static int __init dt_scan_depth1_nodes(unsigned long node,
-				       const char *uname, int depth,
-				       void *data)
-{
 	/*
-	 * Return 1 as soon as we encounter a node at depth 1 that is
-	 * not the /chosen node.
+	 * ACPI is disabled at this point. Enable it in order to parse
+	 * the ACPI tables and carry out sanity checks
 	 */
-	if (depth == 1 && (strcmp(uname, "chosen") != 0))
-		return 1;
+	enable_acpi();
+
 	return 0;
 }
+early_param("acpi", parse_acpi);
 
 /*
  * __acpi_map_table() will be called before page_init(), so early_ioremap()
@@ -176,23 +192,10 @@ out:
  */
 void __init acpi_boot_table_init(void)
 {
-	/*
-	 * Enable ACPI instead of device tree unless
-	 * - ACPI has been disabled explicitly (acpi=off), or
-	 * - the device tree is not empty (it has more than just a /chosen node)
-	 *   and ACPI has not been force enabled (acpi=force)
-	 */
-	if (param_acpi_off ||
-	    (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
+	if (acpi_disabled)
 		return;
 
 	/*
-	 * ACPI is disabled at this point. Enable it in order to parse
-	 * the ACPI tables and carry out sanity checks
-	 */
-	enable_acpi();
-
-	/*
 	 * If ACPI tables are initialized and FADT sanity checks passed,
 	 * leave ACPI enabled and carry on booting; otherwise disable ACPI
 	 * on initialization error.
-- 
2.1.4


  reply	other threads:[~2015-09-08 12:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08 12:43 [RFC 0/5] console/acpi: add DBG2 and SPCR console configuration Leif Lindholm
2015-09-08 12:43 ` Leif Lindholm [this message]
2015-09-08 12:43 ` [RFC 2/5] of/serial: move earlycon early_param handling to serial Leif Lindholm
     [not found]   ` <1441716217-23786-3-git-send-email-leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-09-08 12:52     ` Mark Rutland
2015-09-08 16:45       ` Leif Lindholm
2015-09-08 12:43 ` [RFC 3/5] acpi/serial: add DBG2 earlycon support Leif Lindholm
2015-09-08 13:09   ` Mark Rutland
2015-09-08 17:03     ` Leif Lindholm
2015-09-09  9:36       ` Mark Rutland
2015-09-08 16:38   ` [Linaro-acpi] " Mark Salter
2015-09-08 17:17     ` Leif Lindholm
     [not found]       ` <20150908171744.GQ10728-t77nlHhSwNqAroYi2ySoxKxOck334EZe@public.gmane.org>
2015-09-08 17:40         ` Mark Salter
2015-09-08 17:53       ` Mark Salter
2015-09-08 12:43 ` [RFC 4/5] tty/console: use SPCR table to define console Leif Lindholm
2015-09-10 15:28   ` [Linaro-acpi] " Mark Salter
     [not found] ` <1441716217-23786-1-git-send-email-leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-09-08 12:43   ` [RFC 5/5] HACK: serial: move pl011 initcall to device_initcall Leif Lindholm
2015-09-08 12:56     ` Mark Rutland
2015-09-08 16:55       ` Leif Lindholm
2015-09-23  7:38 ` [RFC 0/5] console/acpi: add DBG2 and SPCR console configuration Ming Lei
2015-09-23 15:45   ` G Gregory
2016-01-12 15:14 ` Christopher Covington
2016-01-13  0:07   ` Al Stone

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=1441716217-23786-2-git-send-email-leif.lindholm@linaro.org \
    --to=leif.lindholm@linaro.org \
    --cc=al.stone@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=graeme.gregory@linaro.org \
    --cc=jcm@redhat.com \
    --cc=linaro-acpi@lists.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=lv.zheng@intel.com \
    --cc=mark.rutland@arm.com \
    --cc=torez@redhat.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: 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).