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: 7140811 Return-Path: X-Original-To: patchwork-linux-arm@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 4D89EBEEC1 for ; Tue, 8 Sep 2015 12:47:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61C67206EE for ; Tue, 8 Sep 2015 12:47:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 83FCD20622 for ; Tue, 8 Sep 2015 12:47:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZZIG4-0003Tr-UM; Tue, 08 Sep 2015 12:44:20 +0000 Received: from mail-wi0-f172.google.com ([209.85.212.172]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZZIFv-0003Lp-3t for linux-arm-kernel@lists.infradead.org; Tue, 08 Sep 2015 12:44:12 +0000 Received: by wicge5 with SMTP id ge5so115153539wic.0 for ; Tue, 08 Sep 2015 05:43:48 -0700 (PDT) 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=nbuzBtOiWNPYnnt5XIDRDSAqEEmt8nyMFVwQZHdBqw8=; b=YqqRUWp4omOv8R/mNDSIZhLTuL72bksuigr1xCyfbpSQ7oa8VQ4KSfcl3t9ISZA0OR cCpBqy54dX2dCNHObhxT3o3xKas43BIDb74h8YsZOOIsC6YskgXVUzFw/TeZD6U87EPm Ta3VH/WNT31dzS+lg9b+feOdBZ8wgHjENgOL7QyZzwKuE4X4dfs7kZUomSbA+txYZgm3 15ckmbAhbwyLIr3jDsho/2CioU0y2/oh3k34f0I+AbLAnmaE+LLeAaGgzKL2YV9LkAED UIx0fqvK/GUdUfExWT0kzBOScNdTilgm0ibblEm+3SkTP7qtxBAj2if8CmUZiO60iqH3 5Pbw== X-Gm-Message-State: ALoCoQkazw9TCUnWGl2ha1fuhsX827sjoDG3/qpkS3c0oCH+a3VTkECwXGkuQZidaUHxkoNuzqDH 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150908_054411_308328_2EA3A926 X-CRM114-Status: GOOD ( 17.34 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, al.stone@linaro.org, graeme.gregory@linaro.org, linaro-acpi@lists.linaro.org, jcm@redhat.com, torez@redhat.com, lv.zheng@intel.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 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.