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>
This commit is contained in:
Yinghai Lu 2010-07-28 15:38:40 +10:00 committed by Benjamin Herrenschmidt
parent 10d0643988
commit 5303b68f57
2 changed files with 10 additions and 0 deletions

View File

@ -47,6 +47,8 @@ extern int memblock_can_resize;
#define memblock_dbg(fmt, ...) \ #define memblock_dbg(fmt, ...) \
if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
u64 memblock_find_in_range(u64 start, u64 end, u64 size, u64 align);
extern void __init memblock_init(void); extern void __init memblock_init(void);
extern void __init memblock_analyze(void); extern void __init memblock_analyze(void);
extern long memblock_add(phys_addr_t base, phys_addr_t size); extern long memblock_add(phys_addr_t base, phys_addr_t size);

View File

@ -162,6 +162,14 @@ static phys_addr_t __init memblock_find_base(phys_addr_t size, phys_addr_t align
return MEMBLOCK_ERROR; return MEMBLOCK_ERROR;
} }
/*
* Find a free area with specified alignment in a specific range.
*/
u64 __init_memblock memblock_find_in_range(u64 start, u64 end, u64 size, u64 align)
{
return memblock_find_base(size, align, start, end);
}
static void __init_memblock memblock_remove_region(struct memblock_type *type, unsigned long r) static void __init_memblock memblock_remove_region(struct memblock_type *type, unsigned long r)
{ {
unsigned long i; unsigned long i;