2 * linux/arch/m68k/mm/init.c
4 * Copyright (C) 1995 Hamish Macdonald
6 * Contains common initialization routines, specific init code moved
7 * to motorola.c and sun3mmu.c
10 #include <linux/config.h>
11 #include <linux/signal.h>
12 #include <linux/sched.h>
14 #include <linux/swap.h>
15 #include <linux/kernel.h>
16 #include <linux/string.h>
17 #include <linux/types.h>
18 #include <linux/init.h>
19 #include <linux/bootmem.h>
21 #include <asm/setup.h>
22 #include <asm/uaccess.h>
24 #include <asm/pgalloc.h>
25 #include <asm/system.h>
26 #include <asm/machdep.h>
29 #include <asm/atari_stram.h>
33 DEFINE_PER_CPU(struct mmu_gather
, mmu_gathers
);
36 * ZERO_PAGE is a special page that is used for zero-initialized
40 void *empty_zero_page
;
45 int free
= 0, total
= 0, reserved
= 0, shared
= 0;
48 printk("\nMem-info:\n");
50 printk("Free swap: %6ldkB\n", nr_swap_pages
<<(PAGE_SHIFT
-10));
54 if (PageReserved(mem_map
+i
))
56 else if (PageSwapCache(mem_map
+i
))
58 else if (!page_count(mem_map
+i
))
61 shared
+= page_count(mem_map
+i
) - 1;
63 printk("%d pages of RAM\n",total
);
64 printk("%d free pages\n",free
);
65 printk("%d reserved pages\n",reserved
);
66 printk("%d pages shared\n",shared
);
67 printk("%d pages swap cached\n",cached
);
70 extern void init_pointer_table(unsigned long ptable
);
72 /* References to section boundaries */
74 extern char _text
, _etext
, _edata
, __bss_start
, _end
;
75 extern char __init_begin
, __init_end
;
77 extern pmd_t
*zero_pgtable
;
79 void __init
mem_init(void)
89 max_mapnr
= num_physpages
= (((unsigned long)high_memory
- PAGE_OFFSET
) >> PAGE_SHIFT
);
93 atari_stram_mem_init_hook();
96 /* this will put all memory onto the freelists */
97 totalram_pages
= free_all_bootmem();
99 for (tmp
= PAGE_OFFSET
; tmp
< (unsigned long)high_memory
; tmp
+= PAGE_SIZE
) {
100 if (PageReserved(virt_to_page(tmp
))) {
101 if (tmp
>= (unsigned long)&_text
102 && tmp
< (unsigned long)&_etext
)
104 else if (tmp
>= (unsigned long) &__init_begin
105 && tmp
< (unsigned long) &__init_end
)
114 /* insert pointer tables allocated so far into the tablelist */
115 init_pointer_table((unsigned long)kernel_pg_dir
);
116 for (i
= 0; i
< PTRS_PER_PGD
; i
++) {
117 if (pgd_present(kernel_pg_dir
[i
]))
118 init_pointer_table(__pgd_page(kernel_pg_dir
[i
]));
121 /* insert also pointer table that we used to unmap the zero page */
123 init_pointer_table((unsigned long)zero_pgtable
);
126 printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n",
127 (unsigned long)nr_free_pages() << (PAGE_SHIFT
-10),
128 max_mapnr
<< (PAGE_SHIFT
-10),
129 codepages
<< (PAGE_SHIFT
-10),
130 datapages
<< (PAGE_SHIFT
-10),
131 initpages
<< (PAGE_SHIFT
-10));
134 #ifdef CONFIG_BLK_DEV_INITRD
135 void free_initrd_mem(unsigned long start
, unsigned long end
)
138 for (; start
< end
; start
+= PAGE_SIZE
) {
139 ClearPageReserved(virt_to_page(start
));
140 set_page_count(virt_to_page(start
), 1);
145 printk ("Freeing initrd memory: %dk freed\n", pages
);