[PATCH] memory hotplug: fix compile error for i386 with NUMA config
[pandora-kernel.git] / arch / i386 / mm / discontig.c
index 103b76e..e0c390d 100644 (file)
@@ -405,3 +405,31 @@ void __init set_highmem_pages_init(int bad_ppro)
        totalram_pages += totalhigh_pages;
 #endif
 }
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+int paddr_to_nid(u64 addr)
+{
+       int nid;
+       unsigned long pfn = PFN_DOWN(addr);
+
+       for_each_node(nid)
+               if (node_start_pfn[nid] <= pfn &&
+                   pfn < node_end_pfn[nid])
+                       return nid;
+
+       return -1;
+}
+
+/*
+ * This function is used to ask node id BEFORE memmap and mem_section's
+ * initialization (pfn_to_nid() can't be used yet).
+ * If _PXM is not defined on ACPI's DSDT, node id must be found by this.
+ */
+int memory_add_physaddr_to_nid(u64 addr)
+{
+       int nid = paddr_to_nid(addr);
+       return (nid >= 0) ? nid : 0;
+}
+
+EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
+#endif