of: create default early_init_dt_add_memory_arch
authorRob Herring <rob.herring@calxeda.com>
Wed, 25 Sep 2013 03:20:01 +0000 (22:20 -0500)
committerRob Herring <rob.herring@calxeda.com>
Wed, 9 Oct 2013 16:38:19 +0000 (11:38 -0500)
Create a weak version of early_init_dt_add_memory_arch which uses
memblock. This will unify all architectures except ones with custom
memory bank structs.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Jonas Bonn <jonas@southpole.se>
Acked-by: Grant Likely <grant.likely@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: linux@lists.openrisc.net
Cc: devicetree@vger.kernel.org
arch/arm64/kernel/setup.c
arch/microblaze/kernel/prom.c
arch/openrisc/kernel/prom.c
drivers/of/fdt.c

index 4a5f6243ade26cd9ca34a0e6cdd7f280869c5bad..7feb0c97d0dd0faf9b2ab2fbea569b4fae8c7af9 100644 (file)
@@ -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.
  */
index e13686ede3301ea3b222eff32fde70f4a413823e..951e4d61ca2dc26bc40e934b13f79af9df65ae6b 100644 (file)
 #include <asm/sections.h>
 #include <asm/pci-bridge.h>
 
-void __init early_init_dt_add_memory_arch(u64 base, u64 size)
-{
-       memblock_add(base, size);
-}
-
 #ifdef CONFIG_EARLY_PRINTK
 static char *stdout;
 
index fbed459ea36547af8b1a8223d06c5a3277b6f383..6dbcaa85421ce3d5c61806c30b586ab082b4ff84 100644 (file)
 #include <asm/sections.h>
 #include <asm/setup.h>
 
-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);
index bfbfda5437682c54a79e76cbb3cbacbbe0f43bd7..5bc55b6e2b41e9afa791ea576527e0aa77f3f795 100644 (file)
@@ -775,6 +775,25 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
 }
 
 #ifdef CONFIG_HAVE_MEMBLOCK
+void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
+{
+       const u64 phys_offset = __pa(PAGE_OFFSET);
+       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);
+}
+
 /*
  * called from unflatten_device_tree() to bootstrap devicetree itself
  * Architectures can override this definition if memblock isn't used