summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorZhang Jiejing <jiejing.zhang@freescale.com>2012-07-09 12:38:05 +0800
committerZhang Jiejing <jiejing.zhang@freescale.com>2012-07-10 11:17:31 +0800
commit9e3fdb64c63565175fea16c257370af58c699d06 (patch)
treefe6494d7c8fb3b75f642569c654497372bde80e4 /mm
parent35f83d7745c8e5a9c6af833fd39deb7bdff124aa (diff)
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: Zhang Jiejing <jiejing.zhang@freescale.com>
Diffstat (limited to 'mm')
-rw-r--r--mm/memblock.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index a0562d1a6ad4..cf52324a365b 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -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)
{