aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm26/mm/init.c
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2007-07-31 03:38:19 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-31 18:39:39 -0400
commit99eb8a550dbccc0e1f6c7e866fe421810e0585f6 (patch)
tree130c6e3338a0655ba74355eba83afab9261e1ed0 /arch/arm26/mm/init.c
parent0d0ed42e5ca2e22465c591341839c18025748fe8 (diff)
Remove the arm26 port
The arm26 port has been in a state where it was far from even compiling for quite some time. Ian Molton agreed with the removal. Signed-off-by: Adrian Bunk <bunk@stusta.de> Cc: Ian Molton <spyro@f2s.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/arm26/mm/init.c')
-rw-r--r--arch/arm26/mm/init.c403
1 files changed, 0 insertions, 403 deletions
diff --git a/arch/arm26/mm/init.c b/arch/arm26/mm/init.c
deleted file mode 100644
index 36e7ee3f8321..000000000000
--- a/arch/arm26/mm/init.c
+++ /dev/null
@@ -1,403 +0,0 @@
1/*
2 * linux/arch/arm26/mm/init.c
3 *
4 * Copyright (C) 1995-2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/signal.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/errno.h>
14#include <linux/string.h>
15#include <linux/types.h>
16#include <linux/ptrace.h>
17#include <linux/mman.h>
18#include <linux/mm.h>
19#include <linux/swap.h>
20#include <linux/smp.h>
21#include <linux/init.h>
22#include <linux/initrd.h>
23#include <linux/bootmem.h>
24#include <linux/blkdev.h>
25#include <linux/pfn.h>
26
27#include <asm/segment.h>
28#include <asm/mach-types.h>
29#include <asm/dma.h>
30#include <asm/hardware.h>
31#include <asm/setup.h>
32#include <asm/tlb.h>
33
34#include <asm/map.h>
35
36struct mmu_gather mmu_gathers[NR_CPUS];
37
38extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
39extern char _stext, _text, _etext, _end, __init_begin, __init_end;
40#ifdef CONFIG_XIP_KERNEL
41extern char _endtext, _sdata;
42#endif
43extern unsigned long phys_initrd_start;
44extern unsigned long phys_initrd_size;
45
46/*
47 * The sole use of this is to pass memory configuration
48 * data from paging_init to mem_init.
49 */
50static struct meminfo meminfo __initdata = { 0, };
51
52/*
53 * empty_zero_page is a special page that is used for
54 * zero-initialized data and COW.
55 */
56struct page *empty_zero_page;
57
58void show_mem(void)
59{
60 int free = 0, total = 0, reserved = 0;
61 int shared = 0, cached = 0, slab = 0;
62 struct page *page, *end;
63
64 printk("Mem-info:\n");
65 show_free_areas();
66 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
67
68
69 page = NODE_MEM_MAP(0);
70 end = page + NODE_DATA(0)->node_spanned_pages;
71
72 do {
73 total++;
74 if (PageReserved(page))
75 reserved++;
76 else if (PageSwapCache(page))
77 cached++;
78 else if (PageSlab(page))
79 slab++;
80 else if (!page_count(page))
81 free++;
82 else
83 shared += page_count(page) - 1;
84 page++;
85 } while (page < end);
86
87 printk("%d pages of RAM\n", total);
88 printk("%d free pages\n", free);
89 printk("%d reserved pages\n", reserved);
90 printk("%d slab pages\n", slab);
91 printk("%d pages shared\n", shared);
92 printk("%d pages swap cached\n", cached);
93}
94
95struct node_info {
96 unsigned int start;
97 unsigned int end;
98 int bootmap_pages;
99};
100
101/*
102 * FIXME: We really want to avoid allocating the bootmap bitmap
103 * over the top of the initrd. Hopefully, this is located towards
104 * the start of a bank, so if we allocate the bootmap bitmap at
105 * the end, we won't clash.
106 */
107static unsigned int __init
108find_bootmap_pfn(struct meminfo *mi, unsigned int bootmap_pages)
109{
110 unsigned int start_pfn, bootmap_pfn;
111 unsigned int start, end;
112
113 start_pfn = PFN_UP((unsigned long)&_end);
114 bootmap_pfn = 0;
115
116 /* ARM26 machines only have one node */
117 if (mi->bank->node != 0)
118 BUG();
119
120 start = PFN_UP(mi->bank->start);
121 end = PFN_DOWN(mi->bank->size + mi->bank->start);
122
123 if (start < start_pfn)
124 start = start_pfn;
125
126 if (end <= start)
127 BUG();
128
129 if (end - start >= bootmap_pages)
130 bootmap_pfn = start;
131 else
132 BUG();
133
134 return bootmap_pfn;
135}
136
137/*
138 * Scan the memory info structure and pull out:
139 * - the end of memory
140 * - the number of nodes
141 * - the pfn range of each node
142 * - the number of bootmem bitmap pages
143 */
144static void __init
145find_memend_and_nodes(struct meminfo *mi, struct node_info *np)
146{
147 unsigned int memend_pfn = 0;
148
149 nodes_clear(node_online_map);
150 node_set_online(0);
151
152 np->bootmap_pages = 0;
153
154 if (mi->bank->size == 0) {
155 BUG();
156 }
157
158 /*
159 * Get the start and end pfns for this bank
160 */
161 np->start = PFN_UP(mi->bank->start);
162 np->end = PFN_DOWN(mi->bank->start + mi->bank->size);
163
164 if (memend_pfn < np->end)
165 memend_pfn = np->end;
166
167 /*
168 * Calculate the number of pages we require to
169 * store the bootmem bitmaps.
170 */
171 np->bootmap_pages = bootmem_bootmap_pages(np->end - np->start);
172
173 /*
174 * This doesn't seem to be used by the Linux memory
175 * manager any more. If we can get rid of it, we
176 * also get rid of some of the stuff above as well.
177 */
178 max_low_pfn = memend_pfn - PFN_DOWN(PHYS_OFFSET);
179 max_pfn = memend_pfn - PFN_DOWN(PHYS_OFFSET);
180 mi->end = memend_pfn << PAGE_SHIFT;
181
182}
183
184/*
185 * Initialise the bootmem allocator for all nodes. This is called
186 * early during the architecture specific initialisation.
187 */
188void __init bootmem_init(struct meminfo *mi)
189{
190 struct node_info node_info;
191 unsigned int bootmap_pfn;
192 pg_data_t *pgdat = NODE_DATA(0);
193
194 find_memend_and_nodes(mi, &node_info);
195
196 bootmap_pfn = find_bootmap_pfn(mi, node_info.bootmap_pages);
197
198 /*
199 * Note that node 0 must always have some pages.
200 */
201 if (node_info.end == 0)
202 BUG();
203
204 /*
205 * Initialise the bootmem allocator.
206 */
207 init_bootmem_node(pgdat, bootmap_pfn, node_info.start, node_info.end);
208
209 /*
210 * Register all available RAM in this node with the bootmem allocator.
211 */
212 free_bootmem_node(pgdat, mi->bank->start, mi->bank->size);
213
214 /*
215 * Register the kernel text and data with bootmem.
216 * Note: with XIP we dont register .text since
217 * its in ROM.
218 */
219#ifdef CONFIG_XIP_KERNEL
220 reserve_bootmem_node(pgdat, __pa(&_sdata), &_end - &_sdata);
221#else
222 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext);
223#endif
224
225 /*
226 * And don't forget to reserve the allocator bitmap,
227 * which will be freed later.
228 */
229 reserve_bootmem_node(pgdat, bootmap_pfn << PAGE_SHIFT,
230 node_info.bootmap_pages << PAGE_SHIFT);
231
232 /*
233 * These should likewise go elsewhere. They pre-reserve
234 * the screen memory region at the start of main system
235 * memory. FIXME - screen RAM is not 512K!
236 */
237 reserve_bootmem_node(pgdat, 0x02000000, 0x00080000);
238
239#ifdef CONFIG_BLK_DEV_INITRD
240 initrd_start = phys_initrd_start;
241 initrd_end = initrd_start + phys_initrd_size;
242
243 /* Achimedes machines only have one node, so initrd is in node 0 */
244#ifdef CONFIG_XIP_KERNEL
245 /* Only reserve initrd space if it is in RAM */
246 if(initrd_start && initrd_start < 0x03000000){
247#else
248 if(initrd_start){
249#endif
250 reserve_bootmem_node(pgdat, __pa(initrd_start),
251 initrd_end - initrd_start);
252 }
253#endif /* CONFIG_BLK_DEV_INITRD */
254
255
256}
257
258/*
259 * paging_init() sets up the page tables, initialises the zone memory
260 * maps, and sets up the zero page, bad page and bad page tables.
261 */
262void __init paging_init(struct meminfo *mi)
263{
264 void *zero_page;
265 unsigned long zone_size[MAX_NR_ZONES];
266 unsigned long zhole_size[MAX_NR_ZONES];
267 struct bootmem_data *bdata;
268 pg_data_t *pgdat;
269 int i;
270
271 memcpy(&meminfo, mi, sizeof(meminfo));
272
273 /*
274 * allocate the zero page. Note that we count on this going ok.
275 */
276 zero_page = alloc_bootmem_low_pages(PAGE_SIZE);
277
278 /*
279 * initialise the page tables.
280 */
281 memtable_init(mi);
282 flush_tlb_all();
283
284 /*
285 * initialise the zones in node 0 (archimedes have only 1 node)
286 */
287
288 for (i = 0; i < MAX_NR_ZONES; i++) {
289 zone_size[i] = 0;
290 zhole_size[i] = 0;
291 }
292
293 pgdat = NODE_DATA(0);
294 bdata = pgdat->bdata;
295 zone_size[0] = bdata->node_low_pfn -
296 (bdata->node_boot_start >> PAGE_SHIFT);
297 if (!zone_size[0])
298 BUG();
299 pgdat->node_mem_map = NULL;
300 free_area_init_node(0, pgdat, zone_size,
301 bdata->node_boot_start >> PAGE_SHIFT, zhole_size);
302
303 /*
304 * finish off the bad pages once
305 * the mem_map is initialised
306 */
307 memzero(zero_page, PAGE_SIZE);
308 empty_zero_page = virt_to_page(zero_page);
309}
310
311static inline void free_area(unsigned long addr, unsigned long end, char *s)
312{
313 unsigned int size = (end - addr) >> 10;
314
315 for (; addr < end; addr += PAGE_SIZE) {
316 struct page *page = virt_to_page(addr);
317 ClearPageReserved(page);
318 init_page_count(page);
319 free_page(addr);
320 totalram_pages++;
321 }
322
323 if (size && s)
324 printk(KERN_INFO "Freeing %s memory: %dK\n", s, size);
325}
326
327/*
328 * mem_init() marks the free areas in the mem_map and tells us how much
329 * memory is free. This is done after various parts of the system have
330 * claimed their memory after the kernel image.
331 */
332void __init mem_init(void)
333{
334 unsigned int codepages, datapages, initpages;
335 pg_data_t *pgdat = NODE_DATA(0);
336 extern int sysctl_overcommit_memory;
337
338
339 /* Note: data pages includes BSS */
340#ifdef CONFIG_XIP_KERNEL
341 codepages = &_endtext - &_text;
342 datapages = &_end - &_sdata;
343#else
344 codepages = &_etext - &_text;
345 datapages = &_end - &_etext;
346#endif
347 initpages = &__init_end - &__init_begin;
348
349 high_memory = (void *)__va(meminfo.end);
350 max_mapnr = virt_to_page(high_memory) - mem_map;
351
352 /* this will put all unused low memory onto the freelists */
353 if (pgdat->node_spanned_pages != 0)
354 totalram_pages += free_all_bootmem_node(pgdat);
355
356 num_physpages = meminfo.bank[0].size >> PAGE_SHIFT;
357
358 printk(KERN_INFO "Memory: %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
359 printk(KERN_NOTICE "Memory: %luKB available (%dK code, "
360 "%dK data, %dK init)\n",
361 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
362 codepages >> 10, datapages >> 10, initpages >> 10);
363
364 /*
365 * Turn on overcommit on tiny machines
366 */
367 if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
368 sysctl_overcommit_memory = OVERCOMMIT_ALWAYS;
369 printk("Turning on overcommit\n");
370 }
371}
372
373void free_initmem(void){
374#ifndef CONFIG_XIP_KERNEL
375 free_area((unsigned long)(&__init_begin),
376 (unsigned long)(&__init_end),
377 "init");
378#endif
379}
380
381#ifdef CONFIG_BLK_DEV_INITRD
382
383static int keep_initrd;
384
385void free_initrd_mem(unsigned long start, unsigned long end)
386{
387#ifdef CONFIG_XIP_KERNEL
388 /* Only bin initrd if it is in RAM... */
389 if(!keep_initrd && start < 0x03000000)
390#else
391 if (!keep_initrd)
392#endif
393 free_area(start, end, "initrd");
394}
395
396static int __init keepinitrd_setup(char *__unused)
397{
398 keep_initrd = 1;
399 return 1;
400}
401
402__setup("keepinitrd", keepinitrd_setup);
403#endif