hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/mips/netlogic/xlp/setup.c
....@@ -34,6 +34,7 @@
3434
3535 #include <linux/kernel.h>
3636 #include <linux/of_fdt.h>
37
+#include <linux/memblock.h>
3738
3839 #include <asm/idle.h>
3940 #include <asm/reboot.h>
....@@ -67,12 +68,11 @@
6768 static void nlm_fixup_mem(void)
6869 {
6970 const int pref_backup = 512;
70
- int i;
71
+ struct memblock_region *mem;
7172
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);
7676 }
7777 }
7878
....@@ -89,7 +89,7 @@
8989 if (map[i] > 0x10000000 && map[i] < 0x20000000)
9090 map[i] = 0x20000000;
9191
92
- add_memory_region(map[i], map[i+1] - map[i], BOOT_MEM_RAM);
92
+ memblock_add(map[i], map[i+1] - map[i]);
9393 }
9494 }
9595
....@@ -110,7 +110,7 @@
110110 /* memory and bootargs from DT */
111111 xlp_early_init_devtree();
112112
113
- if (boot_mem_map.nr_map == 0) {
113
+ if (memblock_end_of_DRAM() == 0) {
114114 pr_info("Using DRAM BARs for memory map.\n");
115115 xlp_init_mem_from_bars();
116116 }