|
@@ -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
|