aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/mm/discontig.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/mm/discontig.c')
-rw-r--r--arch/i386/mm/discontig.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c
index 103b76e56a94..e0c390d6ceb5 100644
--- a/arch/i386/mm/discontig.c
+++ b/arch/i386/mm/discontig.c
@@ -405,3 +405,31 @@ void __init set_highmem_pages_init(int bad_ppro)
405 totalram_pages += totalhigh_pages; 405 totalram_pages += totalhigh_pages;
406#endif 406#endif
407} 407}
408
409#ifdef CONFIG_MEMORY_HOTPLUG
410int paddr_to_nid(u64 addr)
411{
412 int nid;
413 unsigned long pfn = PFN_DOWN(addr);
414
415 for_each_node(nid)
416 if (node_start_pfn[nid] <= pfn &&
417 pfn < node_end_pfn[nid])
418 return nid;
419
420 return -1;
421}
422
423/*
424 * This function is used to ask node id BEFORE memmap and mem_section's
425 * initialization (pfn_to_nid() can't be used yet).
426 * If _PXM is not defined on ACPI's DSDT, node id must be found by this.
427 */
428int memory_add_physaddr_to_nid(u64 addr)
429{
430 int nid = paddr_to_nid(addr);
431 return (nid >= 0) ? nid : 0;
432}
433
434EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
435#endif