summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/memblock.h1
-rw-r--r--mm/memblock.c18
2 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 7525e38c434d..7b72782d862d 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -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);
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)
{