aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/memblock.h3
-rw-r--r--mm/memblock.c19
2 files changed, 9 insertions, 13 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index d235ec5fe678..349688899cb0 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -46,7 +46,8 @@ extern int memblock_can_resize;
46#define memblock_dbg(fmt, ...) \ 46#define memblock_dbg(fmt, ...) \
47 if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 47 if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
48 48
49u64 memblock_find_in_range(u64 start, u64 end, u64 size, u64 align); 49phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
50 phys_addr_t size, phys_addr_t align);
50int memblock_free_reserved_regions(void); 51int memblock_free_reserved_regions(void);
51int memblock_reserve_reserved_regions(void); 52int memblock_reserve_reserved_regions(void);
52 53
diff --git a/mm/memblock.c b/mm/memblock.c
index 196993661346..0f9626f01b5e 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -97,8 +97,11 @@ static phys_addr_t __init_memblock memblock_find_region(phys_addr_t start, phys_
97 return 0; 97 return 0;
98} 98}
99 99
100static phys_addr_t __init_memblock memblock_find_base(phys_addr_t size, 100/*
101 phys_addr_t align, phys_addr_t start, phys_addr_t end) 101 * Find a free area with specified alignment in a specific range.
102 */
103phys_addr_t __init_memblock memblock_find_in_range(phys_addr_t start, phys_addr_t end,
104 phys_addr_t size, phys_addr_t align)
102{ 105{
103 long i; 106 long i;
104 107
@@ -133,14 +136,6 @@ static phys_addr_t __init_memblock memblock_find_base(phys_addr_t size,
133} 136}
134 137
135/* 138/*
136 * Find a free area with specified alignment in a specific range.
137 */
138u64 __init_memblock memblock_find_in_range(u64 start, u64 end, u64 size, u64 align)
139{
140 return memblock_find_base(size, align, start, end);
141}
142
143/*
144 * Free memblock.reserved.regions 139 * Free memblock.reserved.regions
145 */ 140 */
146int __init_memblock memblock_free_reserved_regions(void) 141int __init_memblock memblock_free_reserved_regions(void)
@@ -216,7 +211,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type)
216 new_array = kmalloc(new_size, GFP_KERNEL); 211 new_array = kmalloc(new_size, GFP_KERNEL);
217 addr = new_array ? __pa(new_array) : 0; 212 addr = new_array ? __pa(new_array) : 0;
218 } else 213 } else
219 addr = memblock_find_base(new_size, sizeof(phys_addr_t), 0, MEMBLOCK_ALLOC_ACCESSIBLE); 214 addr = memblock_find_in_range(0, MEMBLOCK_ALLOC_ACCESSIBLE, new_size, sizeof(phys_addr_t));
220 if (!addr) { 215 if (!addr) {
221 pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n", 216 pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n",
222 memblock_type_name(type), type->max, type->max * 2); 217 memblock_type_name(type), type->max, type->max * 2);
@@ -477,7 +472,7 @@ phys_addr_t __init __memblock_alloc_base(phys_addr_t size, phys_addr_t align, ph
477 */ 472 */
478 size = round_up(size, align); 473 size = round_up(size, align);
479 474
480 found = memblock_find_base(size, align, 0, max_addr); 475 found = memblock_find_in_range(0, max_addr, size, align);
481 if (found && !memblock_add_region(&memblock.reserved, found, size)) 476 if (found && !memblock_add_region(&memblock.reserved, found, size))
482 return found; 477 return found;
483 478