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: 5761321 Return-Path: X-Original-To: patchwork-linux-arm@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 3E47B9F302 for ; Mon, 2 Feb 2015 12:51:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48D53202DD for ; Mon, 2 Feb 2015 12:51:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 479EE202E6 for ; Mon, 2 Feb 2015 12:51:56 +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 1YIGRt-0001G5-Ex; Mon, 02 Feb 2015 12:49:53 +0000 Received: from mail-pa0-f43.google.com ([209.85.220.43]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YIGRL-0008EF-VH for linux-arm-kernel@lists.infradead.org; Mon, 02 Feb 2015 12:49:20 +0000 Received: by mail-pa0-f43.google.com with SMTP id eu11so82023286pac.2 for ; Mon, 02 Feb 2015 04:48:58 -0800 (PST) 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=ctKwiuNjhpWEZ5YeGJx1wKC5WUDWipkyjwEwE50aDZQ=; b=UUesmMUwNYIVmH7XLH0eVD8dIkhyKNM2JlXhYht/L+qVz2ht0elMFyPgIiWgNDpAWI 3qOu8vB6kUVpDT+qkHlaNh39dv3NnDOMMgKtUAAwtvI2fl3y07I8uaywf5Lo8Npqjsj0 wJZK/ysqH7fVH/Pd9NBe2OphPy8RYUDtc4u2jTNwisQAXb7deGvqwz2/jxAcj4mxUZ89 MNRDyD8vMyba5RlmDdV9SjvvZIz254aj8fz/neFiBKDLgQx9cWcnYArDuwrn1gpEqmtj /cSIyfKuq45MXb1JzTd4e4ys0eDK9a2eUbfkA4vhDbca2QdPSS6Ur3ggCgJ9PEYcoI0M zWLw== X-Gm-Message-State: ALoCoQmEN2X2cX02skDucHQE/8UdedcmGtgM9LtYA8/2B43eWTEk5VG9xPaTXRVjGX+mXFx44Fxh 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150202_044920_037670_F43418C7 X-CRM114-Status: GOOD ( 14.62 ) X-Spam-Score: -0.7 (/) Cc: Mark Langsdorf , linaro-acpi@lists.linaro.org, wangyijing@huawei.com, Rob Herring , Lorenzo Pieralisi , Jonathan Corbet , Timur Tabi , Daniel Lezcano , linux-acpi@vger.kernel.org, Charles.Garcia-Tobin@arm.com, phoenix.liyi@huawei.com, Robert Richter , Jason Cooper , Marc Zyngier , Jon Masters , Leif Lindholm , Mark Brown , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, Matt Fleming , Ashwin Chaugule , Graeme Gregory , Randy Dunlap , linux-kernel@vger.kernel.org, Hanjun Guo , suravee.suthikulpanit@amd.com, Sudeep Holla X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 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: