Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6.git] / arch / m32r / mm / discontig.c
index 1d1a01e..5d2858f 100644 (file)
@@ -6,19 +6,20 @@
  *  Copyright (c) 2003  Hitoshi Yamamoto
  */
 
-#include <linux/config.h>
 #include <linux/mm.h>
 #include <linux/bootmem.h>
 #include <linux/mmzone.h>
 #include <linux/initrd.h>
 #include <linux/nodemask.h>
+#include <linux/module.h>
+#include <linux/pfn.h>
 
 #include <asm/setup.h>
 
 extern char _end[];
 
 struct pglist_data *node_data[MAX_NUMNODES];
-static bootmem_data_t node_bdata[MAX_NUMNODES] __initdata;
+EXPORT_SYMBOL(node_data);
 
 pg_data_t m32r_node_data[MAX_NUMNODES];
 
@@ -31,6 +32,9 @@ typedef struct {
 } mem_prof_t;
 static mem_prof_t mem_prof[MAX_NUMNODES];
 
+extern unsigned long memory_start;
+extern unsigned long memory_end;
+
 static void __init mem_prof_init(void)
 {
        unsigned long start_pfn, holes, free_pfn;
@@ -41,7 +45,7 @@ static void __init mem_prof_init(void)
        /* Node#0 SDRAM */
        mp = &mem_prof[0];
        mp->start_pfn = PFN_UP(CONFIG_MEMORY_START);
-       mp->pages = PFN_DOWN(CONFIG_MEMORY_SIZE);
+       mp->pages = PFN_DOWN(memory_end - memory_start);
        mp->holes = 0;
        mp->free_pfn = PFN_UP(__pa(_end));
 
@@ -79,7 +83,7 @@ unsigned long __init setup_memory(void)
        for_each_online_node(nid) {
                mp = &mem_prof[nid];
                NODE_DATA(nid)=(pg_data_t *)&m32r_node_data[nid];
-               NODE_DATA(nid)->bdata = &node_bdata[nid];
+               NODE_DATA(nid)->bdata = &bootmem_node_data[nid];
                min_pfn = mp->start_pfn;
                max_pfn = mp->start_pfn + mp->pages;
                bootmap_size = init_bootmem_node(NODE_DATA(nid), mp->free_pfn,
@@ -89,7 +93,8 @@ unsigned long __init setup_memory(void)
                        PFN_PHYS(mp->pages));
 
                reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn),
-                       PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size);
+                       PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size,
+                       BOOTMEM_DEFAULT);
 
                if (max_low_pfn < max_pfn)
                        max_low_pfn = max_pfn;
@@ -102,18 +107,16 @@ unsigned long __init setup_memory(void)
        if (LOADER_TYPE && INITRD_START) {
                if (INITRD_START + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) {
                        reserve_bootmem_node(NODE_DATA(0), INITRD_START,
-                               INITRD_SIZE);
-                       initrd_start = INITRD_START ?
-                               INITRD_START + PAGE_OFFSET : 0;
-
+                               INITRD_SIZE, BOOTMEM_DEFAULT);
+                       initrd_start = INITRD_START + PAGE_OFFSET;
                        initrd_end = initrd_start + INITRD_SIZE;
                        printk("initrd:start[%08lx],size[%08lx]\n",
                                initrd_start, INITRD_SIZE);
                } else {
                        printk("initrd extends beyond end of memory "
-                               "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
+                               "(0x%08lx > 0x%08llx)\ndisabling initrd\n",
                                INITRD_START + INITRD_SIZE,
-                               PFN_PHYS(max_low_pfn));
+                               (unsigned long long)PFN_PHYS(max_low_pfn));
 
                        initrd_start = 0;
                }
@@ -123,8 +126,7 @@ unsigned long __init setup_memory(void)
        return max_low_pfn;
 }
 
-#define START_PFN(nid) \
-       (NODE_DATA(nid)->bdata->node_boot_start >> PAGE_SHIFT)
+#define START_PFN(nid)         (NODE_DATA(nid)->bdata->node_min_pfn)
 #define MAX_LOW_PFN(nid)       (NODE_DATA(nid)->bdata->node_low_pfn)
 
 unsigned long __init zone_sizes_init(void)
@@ -135,12 +137,6 @@ unsigned long __init zone_sizes_init(void)
        int nid, i;
        mem_prof_t *mp;
 
-       pgdat_list = NULL;
-       for (nid = num_online_nodes() - 1 ; nid >= 0 ; nid--) {
-               NODE_DATA(nid)->pgdat_next = pgdat_list;
-               pgdat_list = NODE_DATA(nid);
-       }
-
        for_each_online_node(nid) {
                mp = &mem_prof[nid];
                for (i = 0 ; i < MAX_NR_ZONES ; i++) {
@@ -153,8 +149,7 @@ unsigned long __init zone_sizes_init(void)
                zholes_size[ZONE_DMA] = mp->holes;
                holes += zholes_size[ZONE_DMA];
 
-               free_area_init_node(nid, NODE_DATA(nid), zones_size,
-                       start_pfn, zholes_size);
+               free_area_init_node(nid, zones_size, start_pfn, zholes_size);
        }
 
        /*
@@ -162,10 +157,9 @@ unsigned long __init zone_sizes_init(void)
         *  Use all area of internal RAM.
         *  see __alloc_pages()
         */
-       NODE_DATA(1)->node_zones->pages_min = 0;
-       NODE_DATA(1)->node_zones->pages_low = 0;
-       NODE_DATA(1)->node_zones->pages_high = 0;
+       NODE_DATA(1)->node_zones->watermark[WMARK_MIN] = 0;
+       NODE_DATA(1)->node_zones->watermark[WMARK_LOW] = 0;
+       NODE_DATA(1)->node_zones->watermark[WMARK_HIGH] = 0;
 
        return holes;
 }
-