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
0 commit comments