Skip to content

Commit e7ae8d1

Browse files
committed
MIPS: replace add_memory_region with memblock
add_memory_region was the old interface for registering memory and was already changed to used memblock internaly. Replace it by directly calling memblock functions. Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 73826d6 commit e7ae8d1

28 files changed

Lines changed: 82 additions & 149 deletions

File tree

arch/mips/alchemy/common/prom.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
#include <linux/init.h>
3737
#include <linux/kernel.h>
38+
#include <linux/memblock.h>
3839
#include <linux/sizes.h>
3940
#include <linux/string.h>
4041

@@ -93,7 +94,7 @@ void __init prom_init(void)
9394
if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
9495
memsize = SZ_64M; /* minimum memsize is 64MB RAM */
9596

96-
add_memory_region(0, memsize, BOOT_MEM_RAM);
97+
memblock_add(0, memsize);
9798
}
9899

99100
static inline unsigned char str2hexnum(unsigned char c)

arch/mips/ar7/memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void __init prom_meminit(void)
4747
unsigned long pages;
4848

4949
pages = memsize() >> PAGE_SHIFT;
50-
add_memory_region(PHYS_OFFSET, pages << PAGE_SHIFT, BOOT_MEM_RAM);
50+
memblock_add(PHYS_OFFSET, pages << PAGE_SHIFT);
5151
}
5252

5353
void __init prom_free_prom_memory(void)

arch/mips/ath25/ar2315.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/bitops.h>
2020
#include <linux/irqdomain.h>
2121
#include <linux/interrupt.h>
22+
#include <linux/memblock.h>
2223
#include <linux/platform_device.h>
2324
#include <linux/reboot.h>
2425
#include <asm/bootinfo.h>
@@ -266,7 +267,7 @@ void __init ar2315_plat_mem_setup(void)
266267
memsize <<= 1 + ATH25_REG_MS(memcfg, AR2315_MEM_CFG_COL_WIDTH);
267268
memsize <<= 1 + ATH25_REG_MS(memcfg, AR2315_MEM_CFG_ROW_WIDTH);
268269
memsize <<= 3;
269-
add_memory_region(0, memsize, BOOT_MEM_RAM);
270+
memblock_add(0, memsize);
270271
iounmap(sdram_base);
271272

272273
ar2315_rst_base = ioremap(AR2315_RST_BASE, AR2315_RST_SIZE);

arch/mips/ath25/ar5312.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/bitops.h>
2020
#include <linux/irqdomain.h>
2121
#include <linux/interrupt.h>
22+
#include <linux/memblock.h>
2223
#include <linux/platform_device.h>
2324
#include <linux/mtd/physmap.h>
2425
#include <linux/reboot.h>
@@ -363,7 +364,7 @@ void __init ar5312_plat_mem_setup(void)
363364
memsize = (bank0_ac ? (1 << (bank0_ac + 1)) : 0) +
364365
(bank1_ac ? (1 << (bank1_ac + 1)) : 0);
365366
memsize <<= 20;
366-
add_memory_region(0, memsize, BOOT_MEM_RAM);
367+
memblock_add(0, memsize);
367368
iounmap(sdram_base);
368369

369370
ar5312_rst_base = ioremap(AR5312_RST_BASE, AR5312_RST_SIZE);

arch/mips/bcm47xx/prom.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/init.h>
2828
#include <linux/types.h>
2929
#include <linux/kernel.h>
30+
#include <linux/memblock.h>
3031
#include <linux/spinlock.h>
3132
#include <linux/ssb/ssb_driver_chipcommon.h>
3233
#include <linux/ssb/ssb_regs.h>
@@ -97,7 +98,7 @@ static __init void prom_init_mem(void)
9798
*/
9899
if (c->cputype == CPU_74K && (mem == (128 << 20)))
99100
mem -= 0x1000;
100-
add_memory_region(0, mem, BOOT_MEM_RAM);
101+
memblock_add(0, mem);
101102
}
102103

103104
/*

arch/mips/bcm47xx/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static void __init bcm47xx_register_bcma(void)
141141

142142
/*
143143
* Memory setup is done in the early part of MIPS's arch_mem_init. It's supposed
144-
* to detect memory and record it with add_memory_region.
144+
* to detect memory and record it with memblock_add.
145145
* Any extra initializaion performed here must not use kmalloc or bootmem.
146146
*/
147147
void __init plat_mem_setup(void)

arch/mips/bcm63xx/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void __init plat_time_init(void)
146146

147147
void __init plat_mem_setup(void)
148148
{
149-
add_memory_region(0, bcm63xx_get_memory_size(), BOOT_MEM_RAM);
149+
memblock_add(0, bcm63xx_get_memory_size());
150150

151151
_machine_halt = bcm63xx_machine_halt;
152152
_machine_restart = __bcm63xx_machine_reboot;

arch/mips/cavium-octeon/setup.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/export.h>
1717
#include <linux/interrupt.h>
1818
#include <linux/io.h>
19+
#include <linux/memblock.h>
1920
#include <linux/serial.h>
2021
#include <linux/smp.h>
2122
#include <linux/types.h>
@@ -930,7 +931,7 @@ static __init void memory_exclude_page(u64 addr, u64 *mem, u64 *size)
930931
{
931932
if (addr > *mem && addr < *mem + *size) {
932933
u64 inc = addr - *mem;
933-
add_memory_region(*mem, inc, BOOT_MEM_RAM);
934+
memblock_add(*mem, inc);
934935
*mem += inc;
935936
*size -= inc;
936937
}
@@ -992,19 +993,18 @@ void __init plat_mem_setup(void)
992993

993994
/* Crashkernel ignores bootmem list. It relies on mem=X@Y option */
994995
#ifdef CONFIG_CRASH_DUMP
995-
add_memory_region(reserve_low_mem, max_memory, BOOT_MEM_RAM);
996+
memblock_add(reserve_low_mem, max_memory);
996997
total += max_memory;
997998
#else
998999
#ifdef CONFIG_KEXEC
9991000
if (crashk_size > 0) {
1000-
add_memory_region(crashk_base, crashk_size, BOOT_MEM_RAM);
1001+
memblock_add(crashk_base, crashk_size);
10011002
crashk_end = crashk_base + crashk_size;
10021003
}
10031004
#endif
10041005
/*
1005-
* When allocating memory, we want incrementing addresses from
1006-
* bootmem_alloc so the code in add_memory_region can merge
1007-
* regions next to each other.
1006+
* When allocating memory, we want incrementing addresses,
1007+
* which is handled by memblock
10081008
*/
10091009
cvmx_bootmem_lock();
10101010
while (total < max_memory) {
@@ -1039,13 +1039,9 @@ void __init plat_mem_setup(void)
10391039
*/
10401040
if (memory < crashk_base && end > crashk_end) {
10411041
/* region is fully in */
1042-
add_memory_region(memory,
1043-
crashk_base - memory,
1044-
BOOT_MEM_RAM);
1042+
memblock_add(memory, crashk_base - memory);
10451043
total += crashk_base - memory;
1046-
add_memory_region(crashk_end,
1047-
end - crashk_end,
1048-
BOOT_MEM_RAM);
1044+
memblock_add(crashk_end, end - crashk_end);
10491045
total += end - crashk_end;
10501046
continue;
10511047
}
@@ -1073,7 +1069,7 @@ void __init plat_mem_setup(void)
10731069
*/
10741070
mem_alloc_size -= end - crashk_base;
10751071
#endif
1076-
add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM);
1072+
memblock_add(memory, mem_alloc_size);
10771073
total += mem_alloc_size;
10781074
/* Recovering mem_alloc_size */
10791075
mem_alloc_size = 4 << 20;
@@ -1088,7 +1084,7 @@ void __init plat_mem_setup(void)
10881084

10891085
/* Adjust for physical offset. */
10901086
kernel_start &= ~0xffffffff80000000ULL;
1091-
add_memory_region(kernel_start, kernel_size, BOOT_MEM_RAM);
1087+
memblock_add(kernel_start, kernel_size);
10921088
#endif /* CONFIG_CRASH_DUMP */
10931089

10941090
#ifdef CONFIG_CAVIUM_RESERVE32

arch/mips/cobalt/setup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/interrupt.h>
1414
#include <linux/io.h>
1515
#include <linux/ioport.h>
16+
#include <linux/memblock.h>
1617
#include <linux/pm.h>
1718

1819
#include <asm/bootinfo.h>
@@ -112,7 +113,7 @@ void __init prom_init(void)
112113
strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
113114
}
114115

115-
add_memory_region(0x0, memsz, BOOT_MEM_RAM);
116+
memblock_add(0, memsz);
116117

117118
setup_8250_early_printk_port(CKSEG1ADDR(0x1c800000), 0, 0);
118119
}

arch/mips/dec/prom/memory.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <linux/types.h>
1313

1414
#include <asm/addrspace.h>
15-
#include <asm/bootinfo.h>
1615
#include <asm/dec/machtype.h>
1716
#include <asm/dec/prom.h>
1817
#include <asm/page.h>
@@ -50,8 +49,7 @@ static inline void pmax_setup_memory_region(void)
5049
}
5150
memcpy((void *)(CKSEG0 + 0x80), &old_handler, 0x80);
5251

53-
add_memory_region(0, (unsigned long)memory_page - CKSEG1 - CHUNK_SIZE,
54-
BOOT_MEM_RAM);
52+
memblock_add(0, (unsigned long)memory_page - CKSEG1 - CHUNK_SIZE);
5553
}
5654

5755
/*
@@ -76,13 +74,13 @@ static inline void rex_setup_memory_region(void)
7674
else if (!mem_size)
7775
mem_start += (8 * bm->pagesize);
7876
else {
79-
add_memory_region(mem_start, mem_size, BOOT_MEM_RAM);
77+
memblock_add(mem_start, mem_size);
8078
mem_start += mem_size + (8 * bm->pagesize);
8179
mem_size = 0;
8280
}
8381
}
8482
if (mem_size)
85-
add_memory_region(mem_start, mem_size, BOOT_MEM_RAM);
83+
memblock_add(mem_start, mem_size);
8684
}
8785

8886
void __init prom_meminit(u32 magic)

0 commit comments

Comments
 (0)