From patchwork Mon Feb 2 12:45:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 44127 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 700392034D for ; Mon, 2 Feb 2015 12:49:11 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id x12sf16054730wgg.0 for ; Mon, 02 Feb 2015 04:49:10 -0800 (PST) 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=Z/sx/nfrjcKiJ+/ZyxCBxxt2GNktIOAZy3rBpP/OcEU=; b=cWi3RN3f88y/tbmKU4crtwFpw7bZ+iDyGLUXEwjqab2RFD4W9C+Qzj/wUFBWdvWOqN Gshas+49hm9PTy+BBLqbeP0z6b+8eLLaUFfQ5PfVgiErc5kjfa5tW7mLjMoLxnGb6btq Y7U4kU3S+sRrqfiyUA9HoR/GKXbw+6hbszurCJ9F5kG0ZRZ+LvaDzWWy9hGqxt5AlyY9 4RJECl1Av01gXdSh9kb6K4ulM8ohGS3XS4Et7bZaqgyrHcLw+Qmo3lULYCbPma9US7VQ Y1ocV3+gu63SxDRdlE4SgFuFPRiP+ULVPUbf2S07c4u5ghEV9zBy9z6use8DU6d1xGE0 aXBw== X-Gm-Message-State: ALoCoQkbD2/oOkhkdiN73gv9Q8NNxnAD66zJlhBfYLkkZnyzh0hV0wPjliN5NDUtXasCyZReqxtV X-Received: by 10.112.133.98 with SMTP id pb2mr2382384lbb.2.1422881350705; Mon, 02 Feb 2015 04:49:10 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.135 with SMTP id s7ls649053las.39.gmail; Mon, 02 Feb 2015 04:49:10 -0800 (PST) X-Received: by 10.152.21.10 with SMTP id r10mr19220240lae.11.1422881350568; Mon, 02 Feb 2015 04:49:10 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id w1si3366122laj.114.2015.02.02.04.49.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Feb 2015 04:49:10 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id s18so40474306lam.5 for ; Mon, 02 Feb 2015 04:49:10 -0800 (PST) X-Received: by 10.152.2.41 with SMTP id 9mr414247lar.59.1422881350417; Mon, 02 Feb 2015 04:49:10 -0800 (PST) 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.35.133 with SMTP id h5csp1273254lbj; Mon, 2 Feb 2015 04:49:09 -0800 (PST) X-Received: by 10.70.95.166 with SMTP id dl6mr28830300pdb.140.1422881348178; Mon, 02 Feb 2015 04:49:08 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fc3si23640707pad.15.2015.02.02.04.49.07; Mon, 02 Feb 2015 04:49:08 -0800 (PST) Received-SPF: none (google.com: linux-acpi-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754866AbbBBMtD (ORCPT + 7 others); Mon, 2 Feb 2015 07:49:03 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:43109 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932271AbbBBMs6 (ORCPT ); Mon, 2 Feb 2015 07:48:58 -0500 Received: by mail-pa0-f45.google.com with SMTP id et14so82067547pad.4 for ; Mon, 02 Feb 2015 04:48:58 -0800 (PST) X-Received: by 10.66.164.200 with SMTP id ys8mr29165676pab.130.1422881338163; Mon, 02 Feb 2015 04:48:58 -0800 (PST) Received: from localhost ([180.150.157.4]) by mx.google.com with ESMTPSA id v11sm18815077pdi.13.2015.02.02.04.48.56 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 02 Feb 2015 04:48:57 -0800 (PST) From: Hanjun Guo To: Catalin Marinas , "Rafael J. Wysocki" , Olof Johansson , Arnd Bergmann , Mark Rutland , Grant Likely , Will Deacon Cc: Lorenzo Pieralisi , Graeme Gregory , Sudeep Holla , Jon Masters , Jason Cooper , Marc Zyngier , Bjorn Helgaas , Daniel Lezcano , Mark Brown , Rob Herring , Robert Richter , Randy Dunlap , Charles.Garcia-Tobin@arm.com, phoenix.liyi@huawei.com, Timur Tabi , Ashwin Chaugule , suravee.suthikulpanit@amd.com, Mark Langsdorf , wangyijing@huawei.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Hanjun Guo , Jonathan Corbet , Leif Lindholm , Matt Fleming Subject: [PATCH v8 08/21] dt / chosen: Add linux, uefi-stub-generated-dtb property Date: Mon, 2 Feb 2015 20:45:36 +0800 Message-Id: <1422881149-8177-9-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422881149-8177-1-git-send-email-hanjun.guo@linaro.org> References: <1422881149-8177-1-git-send-email-hanjun.guo@linaro.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@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.46 as permitted sender) smtp.mail=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: , When system supporting both DT and ACPI but firmware providing no dtb, we can use this linux,uefi-stub-generated-dtb property to let kernel know that we can try ACPI configuration data even if no "acpi=force" is passed in early parameters. CC: Mark Rutland CC: Jonathan Corbet CC: Catalin Marinas CC: Will Deacon CC: Leif Lindholm CC: Grant Likely CC: Matt Fleming Signed-off-by: Hanjun Guo --- Documentation/arm/uefi.txt | 3 +++ arch/arm64/include/asm/acpi.h | 1 + arch/arm64/kernel/setup.c | 30 ++++++++++++++++++++++++++++++ drivers/firmware/efi/libstub/fdt.c | 8 ++++++++ 4 files changed, 42 insertions(+) diff --git a/Documentation/arm/uefi.txt b/Documentation/arm/uefi.txt index d60030a..5f86eae 100644 --- a/Documentation/arm/uefi.txt +++ b/Documentation/arm/uefi.txt @@ -60,5 +60,8 @@ linux,uefi-mmap-desc-ver | 32-bit | Version of the mmap descriptor format. -------------------------------------------------------------------------------- linux,uefi-stub-kern-ver | string | Copy of linux_banner from build. -------------------------------------------------------------------------------- +linux,uefi-stub-generated-dtb | bool | Indication for no DTB provided by + | | firmware. +-------------------------------------------------------------------------------- For verbose debug messages, specify 'uefi_debug' on the kernel command line. diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index 496c33b..9fcf632 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -49,6 +49,7 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) { } #else static inline void disable_acpi(void) { } +static inline void enable_acpi(void) { } #endif /* CONFIG_ACPI */ #endif /*_ASM_ACPI_H*/ diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index fc4fb7b..510a681 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -371,6 +371,29 @@ static void __init request_standard_resources(void) } } +static int __init dt_scan_chosen(unsigned long node, const char *uname, + int depth, void *data) +{ + const char *p; + + if (depth != 1 || !data || (strcmp(uname, "chosen") != 0)) + return 0; + + p = of_get_flat_dt_prop(node, "linux,uefi-stub-generated-dtb", NULL); + *(bool *)data = p ? true : false; + + return 1; +} + +static bool __init is_uefi_stub_generated_dtb(void) +{ + bool flag = false; + + of_scan_flat_dt(dt_scan_chosen, &flag); + + return flag; +} + u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID }; void __init setup_arch(char **cmdline_p) @@ -399,6 +422,13 @@ void __init setup_arch(char **cmdline_p) parse_early_param(); /* + * If no dtb provided by firmware, enable ACPI and give system a + * chance to boot with ACPI configuration data + */ + if (is_uefi_stub_generated_dtb() && acpi_disabled) + enable_acpi(); + + /* * Unmask asynchronous aborts after bringing up possible earlycon. * (Report possible System Errors once we can report this occurred) */ diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index c846a96..3777d50 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -154,6 +154,14 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, if (status) goto fdt_set_fail; + /* Add a property to show the dtb is generated by uefi stub */ + if (!orig_fdt) { + status = fdt_setprop(fdt, node, + "linux,uefi-stub-generated-dtb", NULL, 0); + if (status) + goto fdt_set_fail; + } + return EFI_SUCCESS; fdt_set_fail: