.. | .. |
---|
34 | 34 | |
---|
35 | 35 | #include <linux/kernel.h> |
---|
36 | 36 | #include <linux/of_fdt.h> |
---|
| 37 | +#include <linux/memblock.h> |
---|
37 | 38 | |
---|
38 | 39 | #include <asm/idle.h> |
---|
39 | 40 | #include <asm/reboot.h> |
---|
.. | .. |
---|
67 | 68 | static void nlm_fixup_mem(void) |
---|
68 | 69 | { |
---|
69 | 70 | const int pref_backup = 512; |
---|
70 | | - int i; |
---|
| 71 | + struct memblock_region *mem; |
---|
71 | 72 | |
---|
72 | | - for (i = 0; i < boot_mem_map.nr_map; i++) { |
---|
73 | | - if (boot_mem_map.map[i].type != BOOT_MEM_RAM) |
---|
74 | | - continue; |
---|
75 | | - boot_mem_map.map[i].size -= pref_backup; |
---|
| 73 | + for_each_mem_region(mem) { |
---|
| 74 | + memblock_remove(mem->base + mem->size - pref_backup, |
---|
| 75 | + pref_backup); |
---|
76 | 76 | } |
---|
77 | 77 | } |
---|
78 | 78 | |
---|
.. | .. |
---|
89 | 89 | if (map[i] > 0x10000000 && map[i] < 0x20000000) |
---|
90 | 90 | map[i] = 0x20000000; |
---|
91 | 91 | |
---|
92 | | - add_memory_region(map[i], map[i+1] - map[i], BOOT_MEM_RAM); |
---|
| 92 | + memblock_add(map[i], map[i+1] - map[i]); |
---|
93 | 93 | } |
---|
94 | 94 | } |
---|
95 | 95 | |
---|
.. | .. |
---|
110 | 110 | /* memory and bootargs from DT */ |
---|
111 | 111 | xlp_early_init_devtree(); |
---|
112 | 112 | |
---|
113 | | - if (boot_mem_map.nr_map == 0) { |
---|
| 113 | + if (memblock_end_of_DRAM() == 0) { |
---|
114 | 114 | pr_info("Using DRAM BARs for memory map.\n"); |
---|
115 | 115 | xlp_init_mem_from_bars(); |
---|
116 | 116 | } |
---|