From patchwork Mon Sep 16 23:09:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 2900011 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 758C6BFF05 for ; Mon, 16 Sep 2013 23:11:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 87E522030B for ; Mon, 16 Sep 2013 23:11:49 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 744B5201EF for ; Mon, 16 Sep 2013 23:11:48 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLhwW-0000FR-FS; Mon, 16 Sep 2013 23:10:57 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLhwI-0003Dt-8z; Mon, 16 Sep 2013 23:10:42 +0000 Received: from mail-oa0-x233.google.com ([2607:f8b0:4003:c02::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLhvk-000378-Ca for linux-arm-kernel@lists.infradead.org; Mon, 16 Sep 2013 23:10:11 +0000 Received: by mail-oa0-f51.google.com with SMTP id l6so605185oag.38 for ; Mon, 16 Sep 2013 16:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=t+DUCb2YiuT3IEfWGjiCsvy1vVt5j02rTH6xvC3Vi7s=; b=jXtGNb1HSXoaP8sx4qnuR1uAL3fstkJId6O06H4M+IcTvDEXKjaS+BFHk2TZgOwxDc f1xdU12x0fBNDSeKUEAIo7tE93TyDrntAyFX2moHL8w7t+zclKWvUGOADdao2XWfVjS0 dgPb9tii4szJEIpcYcfht8NUKFHdArcpElBPd8hDwKypktqQd4lEQE9enEWjkpJfHFCR q9nrVlesrd3YvEsqjGMjK5ZSXIkdC7CsdMk8dXrlJMAK3QYtd3KCIbnPAPvpA9nSSOTY lDiJU5zpmimuxRqXR2hiEHzBlzPlkv0mwA4+p3PImlbAYa5d57Onrko2myct1vLqaUIF g+tg== X-Received: by 10.182.60.194 with SMTP id j2mr27177202obr.2.1379372988906; Mon, 16 Sep 2013 16:09:48 -0700 (PDT) Received: from rob-laptop.calxeda.com ([173.226.190.126]) by mx.google.com with ESMTPSA id s14sm34574615oeo.1.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 16:09:48 -0700 (PDT) From: Rob Herring To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 18/28] of: create default early_init_dt_add_memory_arch Date: Mon, 16 Sep 2013 18:09:14 -0500 Message-Id: <1379372965-22359-19-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1379372965-22359-1-git-send-email-robherring2@gmail.com> References: <1379372965-22359-1-git-send-email-robherring2@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130916_191008_702372_D0A3955C X-CRM114-Status: GOOD ( 15.74 ) X-Spam-Score: 1.8 (+) Cc: Jonas Bonn , Michal Simek , James Hogan , Catalin Marinas , microblaze-uclinux@itee.uq.edu.au, x86@kernel.org, Will Deacon , Rob Herring , linux@lists.openrisc.net, Ingo Molnar , "H. Peter Anvin" , Grant Likely , Thomas Gleixner , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-1.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no 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: Rob Herring Create a weak version of early_init_dt_add_memory_arch which uses memblock or is an empty function when memblock is not enabled. This will unify all architectures except ones with custom memory bank structs. Signed-off-by: Rob Herring Cc: Catalin Marinas Cc: Will Deacon Cc: James Hogan Cc: Michal Simek Cc: Jonas Bonn Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: Grant Likely Cc: linux-arm-kernel@lists.infradead.org Cc: microblaze-uclinux@itee.uq.edu.au Cc: linux@lists.openrisc.net Cc: devicetree@vger.kernel.org Acked-by: Grant Likely --- arch/arm64/kernel/setup.c | 18 ------------------ arch/metag/kernel/devtree.c | 6 ------ arch/microblaze/kernel/prom.c | 5 ----- arch/openrisc/kernel/prom.c | 6 ------ arch/x86/kernel/devicetree.c | 10 ---------- drivers/of/fdt.c | 11 +++++++++++ 6 files changed, 11 insertions(+), 45 deletions(-) diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index b4461e1..3790004 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -147,24 +147,6 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys) pr_info("Machine: %s\n", machine_name); } -void __init early_init_dt_add_memory_arch(u64 base, u64 size) -{ - base &= PAGE_MASK; - size &= PAGE_MASK; - if (base + size < PHYS_OFFSET) { - pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", - base, base + size); - return; - } - if (base < PHYS_OFFSET) { - pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", - base, PHYS_OFFSET); - size -= PHYS_OFFSET - base; - base = PHYS_OFFSET; - } - memblock_add(base, size); -} - /* * Limit the memory size that was specified via FDT. */ diff --git a/arch/metag/kernel/devtree.c b/arch/metag/kernel/devtree.c index 049af56..2c6ee6d 100644 --- a/arch/metag/kernel/devtree.c +++ b/arch/metag/kernel/devtree.c @@ -23,12 +23,6 @@ #include #include -void __init early_init_dt_add_memory_arch(u64 base, u64 size) -{ - pr_err("%s(%llx, %llx)\n", - __func__, base, size); -} - void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) { return alloc_bootmem_align(size, align); diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c index e13686e..951e4d6 100644 --- a/arch/microblaze/kernel/prom.c +++ b/arch/microblaze/kernel/prom.c @@ -41,11 +41,6 @@ #include #include -void __init early_init_dt_add_memory_arch(u64 base, u64 size) -{ - memblock_add(base, size); -} - #ifdef CONFIG_EARLY_PRINTK static char *stdout; diff --git a/arch/openrisc/kernel/prom.c b/arch/openrisc/kernel/prom.c index fbed459..6dbcaa8 100644 --- a/arch/openrisc/kernel/prom.c +++ b/arch/openrisc/kernel/prom.c @@ -47,12 +47,6 @@ #include #include -void __init early_init_dt_add_memory_arch(u64 base, u64 size) -{ - size &= PAGE_MASK; - memblock_add(base, size); -} - void __init early_init_devtree(void *params) { early_init_dt_scan(params); diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index 0db805c..2f5cb37 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -36,16 +36,6 @@ unsigned long pci_address_to_pio(phys_addr_t address) } EXPORT_SYMBOL_GPL(pci_address_to_pio); -void __init early_init_dt_scan_chosen_arch(unsigned long node) -{ - BUG(); -} - -void __init early_init_dt_add_memory_arch(u64 base, u64 size) -{ - BUG(); -} - void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) { return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 0714dd4..a9dce7a 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -688,6 +688,17 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp) return of_read_number(p, s); } +void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) +{ +#ifdef CONFIG_HAVE_MEMBLOCK + base &= PAGE_MASK; + size &= PAGE_MASK; + memblock_add(base, size); +#else + pr_err("%s: ignoring memory (%llx, %llx)\n", __func__, base, size); +#endif +} + /** * early_init_dt_scan_memory - Look for an parse memory nodes */