From patchwork Tue Sep 8 12:43:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 53267 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 9CBFB22B18 for ; Tue, 8 Sep 2015 12:44:48 +0000 (UTC) Received: by wicuu12 with SMTP id uu12sf36432209wic.2 for ; Tue, 08 Sep 2015 05:44:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=LgU1DQQ2+a3OQYHQwWM+68/XETgIDKDJ7ZAqzPmqzxY=; b=NP6j5CHThRSPWG4oRr6f89jzDuKl3/X2PtfnhcdkCYKq9YXhbUYX4ukkOWB/UrqXDs httXdqWM5y2ZrHNNMtV8ioPV10DVf6A1M51yLi1+A4qqkPrdq9gT9HX1BG1p2OPLQIT2 flfGIUN+YAH/KkJrLRQt8knEvgx0IdP+aD9iYpUjSEEDv2et5uathIY0Y7BCG/KhqOQK mo888tBEhKxDIeLXaTf7RZxOM0EOhGTxMu+T50BhNrg9f/6Wa/8ONNpvdihYy8pl6jwq lAk8M6UQZjBf0f0NbwxsjyJ5B6T1ttBgG5srXbasrIVBdIpjkgeFiM20y7HOKAUvmcrx wDvw== X-Gm-Message-State: ALoCoQmJSt6LjoKNAP+bspDSmk1k1SxcOuZ6hTSMxI/4pcygN6W8x+6Ub6M5mCLp/FyLowgER9RV X-Received: by 10.152.27.10 with SMTP id p10mr6503552lag.1.1441716287870; Tue, 08 Sep 2015 05:44:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.136 with SMTP id w8ls651905lal.16.gmail; Tue, 08 Sep 2015 05:44:47 -0700 (PDT) X-Received: by 10.152.8.169 with SMTP id s9mr22253333laa.3.1441716287686; Tue, 08 Sep 2015 05:44:47 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id ms1si3107434lbb.159.2015.09.08.05.44.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2015 05:44:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lanb10 with SMTP id b10so67707775lan.3 for ; Tue, 08 Sep 2015 05:44:47 -0700 (PDT) X-Received: by 10.152.9.200 with SMTP id c8mr20316890lab.76.1441716287572; Tue, 08 Sep 2015 05:44:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp951662lbq; Tue, 8 Sep 2015 05:44:46 -0700 (PDT) X-Received: by 10.202.80.67 with SMTP id e64mr19186429oib.100.1441716286510; Tue, 08 Sep 2015 05:44:46 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gs1si5349590pac.67.2015.09.08.05.44.45; Tue, 08 Sep 2015 05:44:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754726AbbIHMod (ORCPT + 28 others); Tue, 8 Sep 2015 08:44:33 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:36811 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754346AbbIHMnt (ORCPT ); Tue, 8 Sep 2015 08:43:49 -0400 Received: by wicgb1 with SMTP id gb1so76661971wic.1 for ; Tue, 08 Sep 2015 05:43:48 -0700 (PDT) X-Received: by 10.194.235.6 with SMTP id ui6mr17427916wjc.92.1441716227991; Tue, 08 Sep 2015 05:43:47 -0700 (PDT) Received: from mohikan.mushroom.smurfnet.nu (cpc4-cmbg17-2-0-cust71.5-4.cable.virginm.net. [86.14.224.72]) by smtp.gmail.com with ESMTPSA id i7sm4696047wib.15.2015.09.08.05.43.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Sep 2015 05:43:47 -0700 (PDT) From: Leif Lindholm 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 Message-Id: <1441716217-23786-2-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441716217-23786-1-git-send-email-leif.lindholm@linaro.org> References: <1441716217-23786-1-git-send-email-leif.lindholm@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: leif.lindholm@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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.