diff options
Diffstat (limited to 'mm/memblock.c')
-rw-r--r-- | mm/memblock.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mm/memblock.c b/mm/memblock.c index 88adc8afb610..b8d9147e5c08 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -828,6 +828,23 @@ phys_addr_t __init memblock_phys_mem_size(void) | |||
828 | return memblock.memory.total_size; | 828 | return memblock.memory.total_size; |
829 | } | 829 | } |
830 | 830 | ||
831 | phys_addr_t __init memblock_mem_size(unsigned long limit_pfn) | ||
832 | { | ||
833 | unsigned long pages = 0; | ||
834 | struct memblock_region *r; | ||
835 | unsigned long start_pfn, end_pfn; | ||
836 | |||
837 | for_each_memblock(memory, r) { | ||
838 | start_pfn = memblock_region_memory_base_pfn(r); | ||
839 | end_pfn = memblock_region_memory_end_pfn(r); | ||
840 | start_pfn = min_t(unsigned long, start_pfn, limit_pfn); | ||
841 | end_pfn = min_t(unsigned long, end_pfn, limit_pfn); | ||
842 | pages += end_pfn - start_pfn; | ||
843 | } | ||
844 | |||
845 | return (phys_addr_t)pages << PAGE_SHIFT; | ||
846 | } | ||
847 | |||
831 | /* lowest address */ | 848 | /* lowest address */ |
832 | phys_addr_t __init_memblock memblock_start_of_DRAM(void) | 849 | phys_addr_t __init_memblock memblock_start_of_DRAM(void) |
833 | { | 850 | { |