diff options
Diffstat (limited to 'mm/memblock.c')
-rw-r--r-- | mm/memblock.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mm/memblock.c b/mm/memblock.c index a847bfe6f3ba..0ac412a0a7ee 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -914,6 +914,24 @@ int __init_memblock memblock_is_memory(phys_addr_t addr) | |||
914 | return memblock_search(&memblock.memory, addr) != -1; | 914 | return memblock_search(&memblock.memory, addr) != -1; |
915 | } | 915 | } |
916 | 916 | ||
917 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | ||
918 | int __init_memblock memblock_search_pfn_nid(unsigned long pfn, | ||
919 | unsigned long *start_pfn, unsigned long *end_pfn) | ||
920 | { | ||
921 | struct memblock_type *type = &memblock.memory; | ||
922 | int mid = memblock_search(type, (phys_addr_t)pfn << PAGE_SHIFT); | ||
923 | |||
924 | if (mid == -1) | ||
925 | return -1; | ||
926 | |||
927 | *start_pfn = type->regions[mid].base >> PAGE_SHIFT; | ||
928 | *end_pfn = (type->regions[mid].base + type->regions[mid].size) | ||
929 | >> PAGE_SHIFT; | ||
930 | |||
931 | return type->regions[mid].nid; | ||
932 | } | ||
933 | #endif | ||
934 | |||
917 | /** | 935 | /** |
918 | * memblock_is_region_memory - check if a region is a subset of memory | 936 | * memblock_is_region_memory - check if a region is a subset of memory |
919 | * @base: base of region to check | 937 | * @base: base of region to check |