summaryrefslogtreecommitdiffstats
path: root/arch/openrisc
diff options
context:
space:
mode:
authorJiang Liu <liuj97@gmail.com>2013-07-03 18:04:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:07:37 -0400
commit1173db12bf145a0d0c6a2716e861de2fafde0522 (patch)
tree9cfafcebe25096414eee561f7016fc21fc8750c9 /arch/openrisc
parent76feaedeb9f33011c7048d4339d18c3fd342f984 (diff)
mm/openrisc: prepare for removing num_physpages and simplify mem_init()
Prepare for removing num_physpages and simplify mem_init(). Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Acked-by: Jonas Bonn <jonas@southpole.se> Cc: David Howells <dhowells@redhat.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/openrisc')
-rw-r--r--arch/openrisc/mm/init.c44
1 files changed, 4 insertions, 40 deletions
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
index 16c1e135cf34..7f94652311d7 100644
--- a/arch/openrisc/mm/init.c
+++ b/arch/openrisc/mm/init.c
@@ -202,56 +202,20 @@ void __init paging_init(void)
202 202
203/* References to section boundaries */ 203/* References to section boundaries */
204 204
205static int __init free_pages_init(void)
206{
207 int reservedpages, pfn;
208
209 /* this will put all low memory onto the freelists */
210 free_all_bootmem();
211
212 reservedpages = 0;
213 for (pfn = 0; pfn < max_low_pfn; pfn++) {
214 /*
215 * Only count reserved RAM pages
216 */
217 if (PageReserved(mem_map + pfn))
218 reservedpages++;
219 }
220
221 return reservedpages;
222}
223
224static void __init set_max_mapnr_init(void)
225{
226 max_mapnr = num_physpages = max_low_pfn;
227}
228
229void __init mem_init(void) 205void __init mem_init(void)
230{ 206{
231 int codesize, reservedpages, datasize, initsize;
232
233 BUG_ON(!mem_map); 207 BUG_ON(!mem_map);
234 208
235 set_max_mapnr_init(); 209 max_mapnr = max_low_pfn;
236
237 high_memory = (void *)__va(max_low_pfn * PAGE_SIZE); 210 high_memory = (void *)__va(max_low_pfn * PAGE_SIZE);
238 211
239 /* clear the zero-page */ 212 /* clear the zero-page */
240 memset((void *)empty_zero_page, 0, PAGE_SIZE); 213 memset((void *)empty_zero_page, 0, PAGE_SIZE);
241 214
242 reservedpages = free_pages_init(); 215 /* this will put all low memory onto the freelists */
243 216 free_all_bootmem();
244 codesize = (unsigned long)&_etext - (unsigned long)&_stext;
245 datasize = (unsigned long)&_edata - (unsigned long)&_etext;
246 initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
247 217
248 printk(KERN_INFO 218 mem_init_print_info(NULL);
249 "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n",
250 (unsigned long)nr_free_pages() << (PAGE_SHIFT - 10),
251 max_mapnr << (PAGE_SHIFT - 10), codesize >> 10,
252 reservedpages << (PAGE_SHIFT - 10), datasize >> 10,
253 initsize >> 10, (unsigned long)(0 << (PAGE_SHIFT - 10))
254 );
255 219
256 printk("mem_init_done ...........................................\n"); 220 printk("mem_init_done ...........................................\n");
257 mem_init_done = 1; 221 mem_init_done = 1;