aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m32r/mm/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m32r/mm/init.c')
-rw-r--r--arch/m32r/mm/init.c49
1 files changed, 5 insertions, 44 deletions
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index a501838233ab..a4f8d934e25f 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -40,7 +40,6 @@ unsigned long mmu_context_cache_dat;
40#else 40#else
41unsigned long mmu_context_cache_dat[NR_CPUS]; 41unsigned long mmu_context_cache_dat[NR_CPUS];
42#endif 42#endif
43static unsigned long hole_pages;
44 43
45/* 44/*
46 * function prototype 45 * function prototype
@@ -57,7 +56,7 @@ void free_initrd_mem(unsigned long, unsigned long);
57#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) 56#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn)
58 57
59#ifndef CONFIG_DISCONTIGMEM 58#ifndef CONFIG_DISCONTIGMEM
60unsigned long __init zone_sizes_init(void) 59void __init zone_sizes_init(void)
61{ 60{
62 unsigned long zones_size[MAX_NR_ZONES] = {0, }; 61 unsigned long zones_size[MAX_NR_ZONES] = {0, };
63 unsigned long max_dma; 62 unsigned long max_dma;
@@ -83,11 +82,9 @@ unsigned long __init zone_sizes_init(void)
83#endif /* CONFIG_MMU */ 82#endif /* CONFIG_MMU */
84 83
85 free_area_init_node(0, zones_size, start_pfn, 0); 84 free_area_init_node(0, zones_size, start_pfn, 0);
86
87 return 0;
88} 85}
89#else /* CONFIG_DISCONTIGMEM */ 86#else /* CONFIG_DISCONTIGMEM */
90extern unsigned long zone_sizes_init(void); 87extern void zone_sizes_init(void);
91#endif /* CONFIG_DISCONTIGMEM */ 88#endif /* CONFIG_DISCONTIGMEM */
92 89
93/*======================================================================* 90/*======================================================================*
@@ -105,24 +102,7 @@ void __init paging_init(void)
105 for (i = 0 ; i < USER_PTRS_PER_PGD * 2 ; i++) 102 for (i = 0 ; i < USER_PTRS_PER_PGD * 2 ; i++)
106 pgd_val(pg_dir[i]) = 0; 103 pgd_val(pg_dir[i]) = 0;
107#endif /* CONFIG_MMU */ 104#endif /* CONFIG_MMU */
108 hole_pages = zone_sizes_init(); 105 zone_sizes_init();
109}
110
111int __init reservedpages_count(void)
112{
113 int reservedpages, nid, i;
114
115 reservedpages = 0;
116 for_each_online_node(nid) {
117 unsigned long flags;
118 pgdat_resize_lock(NODE_DATA(nid), &flags);
119 for (i = 0 ; i < MAX_LOW_PFN(nid) - START_PFN(nid) ; i++)
120 if (PageReserved(nid_page_nr(nid, i)))
121 reservedpages++;
122 pgdat_resize_unlock(NODE_DATA(nid), &flags);
123 }
124
125 return reservedpages;
126} 106}
127 107
128/*======================================================================* 108/*======================================================================*
@@ -131,20 +111,13 @@ int __init reservedpages_count(void)
131 *======================================================================*/ 111 *======================================================================*/
132void __init mem_init(void) 112void __init mem_init(void)
133{ 113{
134 int codesize, reservedpages, datasize, initsize;
135 int nid; 114 int nid;
136#ifndef CONFIG_MMU 115#ifndef CONFIG_MMU
137 extern unsigned long memory_end; 116 extern unsigned long memory_end;
138#endif 117#endif
139 118
140 num_physpages = 0;
141 for_each_online_node(nid)
142 num_physpages += MAX_LOW_PFN(nid) - START_PFN(nid) + 1;
143
144 num_physpages -= hole_pages;
145
146#ifndef CONFIG_DISCONTIGMEM 119#ifndef CONFIG_DISCONTIGMEM
147 max_mapnr = num_physpages; 120 max_mapnr = get_num_physpages();
148#endif /* CONFIG_DISCONTIGMEM */ 121#endif /* CONFIG_DISCONTIGMEM */
149 122
150#ifdef CONFIG_MMU 123#ifdef CONFIG_MMU
@@ -160,19 +133,7 @@ void __init mem_init(void)
160 for_each_online_node(nid) 133 for_each_online_node(nid)
161 free_all_bootmem_node(NODE_DATA(nid)); 134 free_all_bootmem_node(NODE_DATA(nid));
162 135
163 reservedpages = reservedpages_count() - hole_pages; 136 mem_init_print_info(NULL);
164 codesize = (unsigned long) &_etext - (unsigned long)&_text;
165 datasize = (unsigned long) &_edata - (unsigned long)&_etext;
166 initsize = (unsigned long) &__init_end - (unsigned long)&__init_begin;
167
168 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
169 "%dk reserved, %dk data, %dk init)\n",
170 nr_free_pages() << (PAGE_SHIFT-10),
171 num_physpages << (PAGE_SHIFT-10),
172 codesize >> 10,
173 reservedpages << (PAGE_SHIFT-10),
174 datasize >> 10,
175 initsize >> 10);
176} 137}
177 138
178/*======================================================================* 139/*======================================================================*