blob: 8fec26392ae71f00381e209d5f58bc7ae2a8e234 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/cris/mm/init.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Copyright (C) 2000,2001 Axis Communications AB
6 *
7 * Authors: Bjorn Wesen (bjornw@axis.com)
8 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 */
10
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090011#include <linux/gfp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/init.h>
13#include <linux/bootmem.h>
14#include <asm/tlb.h>
Jiang Liu2e529812013-04-29 15:06:36 -070015#include <asm/sections.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Linus Torvalds1da177e2005-04-16 15:20:36 -070017unsigned long empty_zero_page;
18
Linus Torvalds1da177e2005-04-16 15:20:36 -070019void __init
20mem_init(void)
21{
22 int codesize, reservedpages, datasize, initsize;
23 unsigned long tmp;
24
Stoyan Gaydarov59b97762009-03-10 06:10:40 +010025 BUG_ON(!mem_map);
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27 /* max/min_low_pfn was set by setup.c
28 * now we just copy it to some other necessary places...
29 *
30 * high_memory was also set in setup.c
31 */
32
33 max_mapnr = num_physpages = max_low_pfn - min_low_pfn;
34
35 /* this will put all memory onto the freelists */
36 totalram_pages = free_all_bootmem();
37
38 reservedpages = 0;
39 for (tmp = 0; tmp < max_mapnr; tmp++) {
40 /*
41 * Only count reserved RAM pages
42 */
43 if (PageReserved(mem_map + tmp))
44 reservedpages++;
45 }
46
47 codesize = (unsigned long) &_etext - (unsigned long) &_stext;
48 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
49 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
50
51 printk(KERN_INFO
52 "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, "
53 "%dk init)\n" ,
Geert Uytterhoevencc013a82009-09-21 17:02:36 -070054 nr_free_pages() << (PAGE_SHIFT-10),
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 max_mapnr << (PAGE_SHIFT-10),
56 codesize >> 10,
57 reservedpages << (PAGE_SHIFT-10),
58 datasize >> 10,
59 initsize >> 10
60 );
61}
62
63/* free the pages occupied by initialization code */
64
65void
66free_initmem(void)
67{
Jiang Liudbe67df2013-07-03 15:02:51 -070068 free_initmem_default(-1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070069}