[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / m68k / mm / init.c
blobc45beb955943d6c1d5e3c89e6917b8de9ec0bca3
1 /*
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
8 */
10 #include <linux/config.h>
11 #include <linux/signal.h>
12 #include <linux/sched.h>
13 #include <linux/mm.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>
23 #include <asm/page.h>
24 #include <asm/pgalloc.h>
25 #include <asm/system.h>
26 #include <asm/machdep.h>
27 #include <asm/io.h>
28 #ifdef CONFIG_ATARI
29 #include <asm/atari_stram.h>
30 #endif
31 #include <asm/tlb.h>
33 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
36 * ZERO_PAGE is a special page that is used for zero-initialized
37 * data and COW.
40 void *empty_zero_page;
42 void show_mem(void)
44 unsigned long i;
45 int free = 0, total = 0, reserved = 0, shared = 0;
46 int cached = 0;
48 printk("\nMem-info:\n");
49 show_free_areas();
50 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
51 i = max_mapnr;
52 while (i-- > 0) {
53 total++;
54 if (PageReserved(mem_map+i))
55 reserved++;
56 else if (PageSwapCache(mem_map+i))
57 cached++;
58 else if (!page_count(mem_map+i))
59 free++;
60 else
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)
81 int codepages = 0;
82 int datapages = 0;
83 int initpages = 0;
84 unsigned long tmp;
85 #ifndef CONFIG_SUN3
86 int i;
87 #endif
89 max_mapnr = num_physpages = (((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT);
91 #ifdef CONFIG_ATARI
92 if (MACH_IS_ATARI)
93 atari_stram_mem_init_hook();
94 #endif
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)
103 codepages++;
104 else if (tmp >= (unsigned long) &__init_begin
105 && tmp < (unsigned long) &__init_end)
106 initpages++;
107 else
108 datapages++;
109 continue;
113 #ifndef CONFIG_SUN3
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 */
122 if (zero_pgtable)
123 init_pointer_table((unsigned long)zero_pgtable);
124 #endif
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)
137 int pages = 0;
138 for (; start < end; start += PAGE_SIZE) {
139 ClearPageReserved(virt_to_page(start));
140 set_page_count(virt_to_page(start), 1);
141 free_page(start);
142 totalram_pages++;
143 pages++;
145 printk ("Freeing initrd memory: %dk freed\n", pages);
147 #endif