From patchwork Wed Feb 24 17:10:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 8410001 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 051CC9F372 for ; Wed, 24 Feb 2016 17:14:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1AAFC202EC for ; Wed, 24 Feb 2016 17:14:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03EFB202AE for ; Wed, 24 Feb 2016 17:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758450AbcBXRN5 (ORCPT ); Wed, 24 Feb 2016 12:13:57 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:32969 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757679AbcBXRKw (ORCPT ); Wed, 24 Feb 2016 12:10:52 -0500 Received: by mail-lf0-f41.google.com with SMTP id m1so16312262lfg.0 for ; Wed, 24 Feb 2016 09:10:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nmQgM8upV2sn4UfvmzNJG9nhBeqhw7pWDkCokBlLB6w=; b=ZvyX+E+05Zi2JP2zpYBqkgoe8kNLEDevyxPzQx1IpArprY6Iq9ft8QQ4aD5SL0xaKe eCqco+a7Lt/8qzbNK8CSVwRxpyTcm2S3pHjsvhqqvXB1ZbtMUNNGzF5DnzbwuCkEqLOW heOPxhexWUukd2rbMgfX/b/1wW+OBpvm4jsUc= 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=nmQgM8upV2sn4UfvmzNJG9nhBeqhw7pWDkCokBlLB6w=; b=Gabl4ZBGq5+30SACVhgRr6et/YroAPZvTvaBLIV2xZRIg8mhYk7Y/Z6gOAK6MoFf1n K5nTRoL5fNl1svrXcz4ySZgdg+HQ7/uPlvTGmUkfEI3qioTV2P9pJ8rztajDZZaNP09d +FqvnXJBMRG8h6OkNzPqaaUXImt+Sm7aKkO8/y/AxlixVg/8NUKbb+dzmAyD/GaokZom cQc3AZmtnkhrDxXKQOleWVsEIb7Q69WV4WZKZf3C3+KjFkGtS8xvSZ2is2q45k600ow0 vKP+/I9BrXDscG2u9qzUyId8xWCYNg8iFGA8rTLHotZc13FW5b1ZYQopCMv6x3MaleH/ Ap0Q== X-Gm-Message-State: AG10YOTSUd3/qwaTHdRudXJ7MczLfAlcEE7FmCujfFhz3fYPONuXZyM4uWFpGKDc/8fCJ//C X-Received: by 10.25.83.83 with SMTP id h80mr12631438lfb.115.1456333851017; Wed, 24 Feb 2016 09:10:51 -0800 (PST) Received: from turnip.localdomain (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id ne8sm509556lbc.21.2016.02.24.09.10.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Feb 2016 09:10:50 -0800 (PST) From: Aleksey Makarov To: linux-acpi@vger.kernel.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Aleksey Makarov , Russell King , Greg Kroah-Hartman , "Rafael J . Wysocki" , Leif Lindholm , Graeme Gregory , Al Stone , Christopher Covington , Catalin Marinas , Will Deacon Subject: [PATCH v2 1/8] arm64: move acpi/dt decision earlier in boot process Date: Wed, 24 Feb 2016 20:10:10 +0300 Message-Id: <1456333819-13482-2-git-send-email-aleksey.makarov@linaro.org> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1456333819-13482-1-git-send-email-aleksey.makarov@linaro.org> References: <1456333819-13482-1-git-send-email-aleksey.makarov@linaro.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 From: Leif Lindholm 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 Signed-off-by: Aleksey Makarov --- arch/arm64/kernel/acpi.c | 62 +++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index d1ce8e2..3faa323 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -41,26 +41,8 @@ EXPORT_SYMBOL(acpi_disabled); int acpi_pci_disabled = 1; /* skip ACPI PCI scan and IRQ initialization */ EXPORT_SYMBOL(acpi_pci_disabled); -static bool param_acpi_off __initdata; static bool param_acpi_force __initdata; -static int __init parse_acpi(char *arg) -{ - if (!arg) - return -EINVAL; - - /* "acpi=off" disables both ACPI table parsing and interpreter */ - if (strcmp(arg, "off") == 0) - param_acpi_off = true; - else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */ - param_acpi_force = true; - else - return -EINVAL; /* Core will print when we return error */ - - return 0; -} -early_param("acpi", parse_acpi); - static int __init dt_scan_depth1_nodes(unsigned long node, const char *uname, int depth, void *data) @@ -74,6 +56,35 @@ static int __init dt_scan_depth1_nodes(unsigned long node, return 0; } +static int __init parse_acpi(char *arg) +{ + if (!arg) + return -EINVAL; + + /* + * 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 (strcmp(arg, "off") == 0) + return 0; + else if (strcmp(arg, "force") == 0) + param_acpi_force = true; + else if (of_scan_flat_dt(dt_scan_depth1_nodes, NULL)) + return 0; + + /* + * ACPI is disabled at this point. Enable it in order to parse + * the ACPI tables and carry out sanity checks + */ + enable_acpi(); + + return 0; +} + +early_param("acpi", parse_acpi); + /* * __acpi_map_table() will be called before page_init(), so early_ioremap() * or early_memremap() should be called here to for ACPI table mapping. @@ -181,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.