fmem: reserve memory for fmem

Fmem will use a block of contiguous memory at the
end of the memory bank with the greatest physical address.

Change-Id: I74d93f356e1e24b76e7b8f3432c3b021503fd387
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
This commit is contained in:
Larry Bassel
2011-12-06 16:01:59 -08:00
committed by Laura Abbott
parent 1daa0f027e
commit 1eb58f0a2f
2 changed files with 20 additions and 0 deletions

View File

@@ -62,4 +62,6 @@ struct reserve_info {
};
extern struct reserve_info *reserve_info;
unsigned long __init reserve_memory_for_fmem(unsigned long);
#endif

View File

@@ -304,6 +304,24 @@ static void __init reserve_memory_for_mempools(void)
}
}
unsigned long __init reserve_memory_for_fmem(unsigned long fmem_size)
{
struct membank *mb;
int ret;
unsigned long fmem_phys;
if (!fmem_size)
return 0;
mb = &meminfo.bank[meminfo.nr_banks - 1];
fmem_phys = mb->start + (mb->size - fmem_size);
ret = memblock_remove(fmem_phys, fmem_size);
BUG_ON(ret);
pr_info("fmem start %lx size %lx\n", fmem_phys, fmem_size);
return fmem_phys;
}
static void __init initialize_mempools(void)
{
struct mem_pool *mpool;