Commit 5303b68f57c227c27193a14e57dd12be27cd670f
Committed by
Benjamin Herrenschmidt
1 parent
10d0643988
Exists in
master
and in
20 other branches
memblock: Add memblock_find_in_range()
This is a wrapper for memblock_find_base() using slightly different arguments (start,end instead of start,size for example) in order to make it easier to convert existing arch/x86 code. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Showing 2 changed files with 10 additions and 0 deletions Side-by-side Diff
include/linux/memblock.h
... | ... | @@ -47,6 +47,8 @@ |
47 | 47 | #define memblock_dbg(fmt, ...) \ |
48 | 48 | if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
49 | 49 | |
50 | +u64 memblock_find_in_range(u64 start, u64 end, u64 size, u64 align); | |
51 | + | |
50 | 52 | extern void __init memblock_init(void); |
51 | 53 | extern void __init memblock_analyze(void); |
52 | 54 | extern long memblock_add(phys_addr_t base, phys_addr_t size); |
mm/memblock.c
... | ... | @@ -162,6 +162,14 @@ |
162 | 162 | return MEMBLOCK_ERROR; |
163 | 163 | } |
164 | 164 | |
165 | +/* | |
166 | + * Find a free area with specified alignment in a specific range. | |
167 | + */ | |
168 | +u64 __init_memblock memblock_find_in_range(u64 start, u64 end, u64 size, u64 align) | |
169 | +{ | |
170 | + return memblock_find_base(size, align, start, end); | |
171 | +} | |
172 | + | |
165 | 173 | static void __init_memblock memblock_remove_region(struct memblock_type *type, unsigned long r) |
166 | 174 | { |
167 | 175 | unsigned long i; |