diff options
Diffstat (limited to 'arch/sh64/mm/init.c')
-rw-r--r-- | arch/sh64/mm/init.c | 189 |
1 files changed, 0 insertions, 189 deletions
diff --git a/arch/sh64/mm/init.c b/arch/sh64/mm/init.c deleted file mode 100644 index 21cf42de23e2..000000000000 --- a/arch/sh64/mm/init.c +++ /dev/null | |||
@@ -1,189 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * arch/sh64/mm/init.c | ||
7 | * | ||
8 | * Copyright (C) 2000, 2001 Paolo Alberelli | ||
9 | * Copyright (C) 2003, 2004 Paul Mundt | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/init.h> | ||
14 | #include <linux/rwsem.h> | ||
15 | #include <linux/mm.h> | ||
16 | #include <linux/swap.h> | ||
17 | #include <linux/bootmem.h> | ||
18 | |||
19 | #include <asm/mmu_context.h> | ||
20 | #include <asm/page.h> | ||
21 | #include <asm/pgalloc.h> | ||
22 | #include <asm/pgtable.h> | ||
23 | #include <asm/tlb.h> | ||
24 | |||
25 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); | ||
26 | |||
27 | /* | ||
28 | * Cache of MMU context last used. | ||
29 | */ | ||
30 | unsigned long mmu_context_cache; | ||
31 | pgd_t * mmu_pdtp_cache; | ||
32 | int after_bootmem = 0; | ||
33 | |||
34 | /* | ||
35 | * BAD_PAGE is the page that is used for page faults when linux | ||
36 | * is out-of-memory. Older versions of linux just did a | ||
37 | * do_exit(), but using this instead means there is less risk | ||
38 | * for a process dying in kernel mode, possibly leaving an inode | ||
39 | * unused etc.. | ||
40 | * | ||
41 | * BAD_PAGETABLE is the accompanying page-table: it is initialized | ||
42 | * to point to BAD_PAGE entries. | ||
43 | * | ||
44 | * ZERO_PAGE is a special page that is used for zero-initialized | ||
45 | * data and COW. | ||
46 | */ | ||
47 | |||
48 | extern unsigned char empty_zero_page[PAGE_SIZE]; | ||
49 | extern unsigned char empty_bad_page[PAGE_SIZE]; | ||
50 | extern pte_t empty_bad_pte_table[PTRS_PER_PTE]; | ||
51 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | ||
52 | |||
53 | extern char _text, _etext, _edata, __bss_start, _end; | ||
54 | extern char __init_begin, __init_end; | ||
55 | |||
56 | /* It'd be good if these lines were in the standard header file. */ | ||
57 | #define START_PFN (NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT) | ||
58 | #define MAX_LOW_PFN (NODE_DATA(0)->bdata->node_low_pfn) | ||
59 | |||
60 | |||
61 | void show_mem(void) | ||
62 | { | ||
63 | int i, total = 0, reserved = 0; | ||
64 | int shared = 0, cached = 0; | ||
65 | |||
66 | printk("Mem-info:\n"); | ||
67 | show_free_areas(); | ||
68 | printk("Free swap: %6ldkB\n",nr_swap_pages<<(PAGE_SHIFT-10)); | ||
69 | i = max_mapnr; | ||
70 | while (i-- > 0) { | ||
71 | total++; | ||
72 | if (PageReserved(mem_map+i)) | ||
73 | reserved++; | ||
74 | else if (PageSwapCache(mem_map+i)) | ||
75 | cached++; | ||
76 | else if (page_count(mem_map+i)) | ||
77 | shared += page_count(mem_map+i) - 1; | ||
78 | } | ||
79 | printk("%d pages of RAM\n",total); | ||
80 | printk("%d reserved pages\n",reserved); | ||
81 | printk("%d pages shared\n",shared); | ||
82 | printk("%d pages swap cached\n",cached); | ||
83 | printk("%ld pages in page table cache\n", quicklist_total_size()); | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * paging_init() sets up the page tables. | ||
88 | * | ||
89 | * head.S already did a lot to set up address translation for the kernel. | ||
90 | * Here we comes with: | ||
91 | * . MMU enabled | ||
92 | * . ASID set (SR) | ||
93 | * . some 512MB regions being mapped of which the most relevant here is: | ||
94 | * . CACHED segment (ASID 0 [irrelevant], shared AND NOT user) | ||
95 | * . possible variable length regions being mapped as: | ||
96 | * . UNCACHED segment (ASID 0 [irrelevant], shared AND NOT user) | ||
97 | * . All of the memory regions are placed, independently from the platform | ||
98 | * on high addresses, above 0x80000000. | ||
99 | * . swapper_pg_dir is already cleared out by the .space directive | ||
100 | * in any case swapper does not require a real page directory since | ||
101 | * it's all kernel contained. | ||
102 | * | ||
103 | * Those pesky NULL-reference errors in the kernel are then | ||
104 | * dealt with by not mapping address 0x00000000 at all. | ||
105 | * | ||
106 | */ | ||
107 | void __init paging_init(void) | ||
108 | { | ||
109 | unsigned long zones_size[MAX_NR_ZONES] = {0, }; | ||
110 | |||
111 | pgd_init((unsigned long)swapper_pg_dir); | ||
112 | pgd_init((unsigned long)swapper_pg_dir + | ||
113 | sizeof(pgd_t) * USER_PTRS_PER_PGD); | ||
114 | |||
115 | mmu_context_cache = MMU_CONTEXT_FIRST_VERSION; | ||
116 | |||
117 | zones_size[ZONE_NORMAL] = MAX_LOW_PFN - START_PFN; | ||
118 | NODE_DATA(0)->node_mem_map = NULL; | ||
119 | free_area_init_node(0, NODE_DATA(0), zones_size, __MEMORY_START >> PAGE_SHIFT, 0); | ||
120 | } | ||
121 | |||
122 | void __init mem_init(void) | ||
123 | { | ||
124 | int codesize, reservedpages, datasize, initsize; | ||
125 | int tmp; | ||
126 | |||
127 | max_mapnr = num_physpages = MAX_LOW_PFN - START_PFN; | ||
128 | high_memory = (void *)__va(MAX_LOW_PFN * PAGE_SIZE); | ||
129 | |||
130 | /* | ||
131 | * Clear the zero-page. | ||
132 | * This is not required but we might want to re-use | ||
133 | * this very page to pass boot parameters, one day. | ||
134 | */ | ||
135 | memset(empty_zero_page, 0, PAGE_SIZE); | ||
136 | |||
137 | /* this will put all low memory onto the freelists */ | ||
138 | totalram_pages += free_all_bootmem_node(NODE_DATA(0)); | ||
139 | reservedpages = 0; | ||
140 | for (tmp = 0; tmp < num_physpages; tmp++) | ||
141 | /* | ||
142 | * Only count reserved RAM pages | ||
143 | */ | ||
144 | if (PageReserved(mem_map+tmp)) | ||
145 | reservedpages++; | ||
146 | |||
147 | after_bootmem = 1; | ||
148 | |||
149 | codesize = (unsigned long) &_etext - (unsigned long) &_text; | ||
150 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; | ||
151 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | ||
152 | |||
153 | printk("Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n", | ||
154 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), | ||
155 | max_mapnr << (PAGE_SHIFT-10), | ||
156 | codesize >> 10, | ||
157 | reservedpages << (PAGE_SHIFT-10), | ||
158 | datasize >> 10, | ||
159 | initsize >> 10); | ||
160 | } | ||
161 | |||
162 | void free_initmem(void) | ||
163 | { | ||
164 | unsigned long addr; | ||
165 | |||
166 | addr = (unsigned long)(&__init_begin); | ||
167 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | ||
168 | ClearPageReserved(virt_to_page(addr)); | ||
169 | init_page_count(virt_to_page(addr)); | ||
170 | free_page(addr); | ||
171 | totalram_pages++; | ||
172 | } | ||
173 | printk ("Freeing unused kernel memory: %ldk freed\n", (&__init_end - &__init_begin) >> 10); | ||
174 | } | ||
175 | |||
176 | #ifdef CONFIG_BLK_DEV_INITRD | ||
177 | void free_initrd_mem(unsigned long start, unsigned long end) | ||
178 | { | ||
179 | unsigned long p; | ||
180 | for (p = start; p < end; p += PAGE_SIZE) { | ||
181 | ClearPageReserved(virt_to_page(p)); | ||
182 | init_page_count(virt_to_page(p)); | ||
183 | free_page(p); | ||
184 | totalram_pages++; | ||
185 | } | ||
186 | printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); | ||
187 | } | ||
188 | #endif | ||
189 | |||