Commit d38cbf26 authored by Zhang Jiejing's avatar Zhang Jiejing Committed by Terry Lv

ENGR00216013-1 memblock: add memblock_end_of_DRAM_with_reserved() function.

add a function to check the end address including reserved memory,
this API can provide the top address of phy memory,
it can be used to check if the phy memory is valild in some driver
like VPU.
Signed-off-by: default avatarZhang Jiejing <jiejing.zhang@freescale.com>
parent e406119f
......@@ -81,6 +81,7 @@ extern phys_addr_t __memblock_alloc_base(phys_addr_t size,
phys_addr_t max_addr);
extern phys_addr_t memblock_phys_mem_size(void);
extern phys_addr_t memblock_end_of_DRAM(void);
extern phys_addr_t memblock_end_of_DRAM_with_reserved(void);
extern void memblock_enforce_memory_limit(phys_addr_t memory_limit);
extern int memblock_is_memory(phys_addr_t addr);
extern int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
......
......@@ -633,6 +633,24 @@ phys_addr_t __init_memblock memblock_end_of_DRAM(void)
return (memblock.memory.regions[idx].base + memblock.memory.regions[idx].size);
}
phys_addr_t __init_memblock memblock_end_of_DRAM_with_reserved(void)
{
int idx = memblock.memory.cnt - 1;
phys_addr_t top_addr = 0;
int i;
for (i = 0; i < memblock.reserved.cnt; i++) {
phys_addr_t t;
t = memblock.reserved.regions[i].base
+ memblock.reserved.regions[i].size;
top_addr = max(t, top_addr);
}
return max(top_addr,
memblock.memory.regions[idx].base
+ memblock.memory.regions[idx].size);
}
/* You must call memblock_analyze() after this. */
void __init memblock_enforce_memory_limit(phys_addr_t memory_limit)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment