Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/arch/arm/mm/init.c | |
3 | * | |
90072059 | 4 | * Copyright (C) 1995-2005 Russell King |
1da177e4 LT |
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 | */ | |
1da177e4 LT |
10 | #include <linux/kernel.h> |
11 | #include <linux/errno.h> | |
1da177e4 LT |
12 | #include <linux/swap.h> |
13 | #include <linux/init.h> | |
14 | #include <linux/bootmem.h> | |
15 | #include <linux/mman.h> | |
16 | #include <linux/nodemask.h> | |
17 | #include <linux/initrd.h> | |
18 | ||
19 | #include <asm/mach-types.h> | |
1da177e4 | 20 | #include <asm/setup.h> |
74d02fb9 | 21 | #include <asm/sizes.h> |
1da177e4 LT |
22 | #include <asm/tlb.h> |
23 | ||
24 | #include <asm/mach/arch.h> | |
25 | #include <asm/mach/map.h> | |
26 | ||
1b2e2b73 RK |
27 | #include "mm.h" |
28 | ||
012d1f4a RK |
29 | static unsigned long phys_initrd_start __initdata = 0; |
30 | static unsigned long phys_initrd_size __initdata = 0; | |
31 | ||
32 | static void __init early_initrd(char **p) | |
33 | { | |
34 | unsigned long start, size; | |
35 | ||
36 | start = memparse(*p, p); | |
37 | if (**p == ',') { | |
38 | size = memparse((*p) + 1, p); | |
39 | ||
40 | phys_initrd_start = start; | |
41 | phys_initrd_size = size; | |
42 | } | |
43 | } | |
44 | __early_param("initrd=", early_initrd); | |
45 | ||
46 | static int __init parse_tag_initrd(const struct tag *tag) | |
47 | { | |
48 | printk(KERN_WARNING "ATAG_INITRD is deprecated; " | |
49 | "please update your bootloader.\n"); | |
50 | phys_initrd_start = __virt_to_phys(tag->u.initrd.start); | |
51 | phys_initrd_size = tag->u.initrd.size; | |
52 | return 0; | |
53 | } | |
54 | ||
55 | __tagtable(ATAG_INITRD, parse_tag_initrd); | |
56 | ||
57 | static int __init parse_tag_initrd2(const struct tag *tag) | |
58 | { | |
59 | phys_initrd_start = tag->u.initrd.start; | |
60 | phys_initrd_size = tag->u.initrd.size; | |
61 | return 0; | |
62 | } | |
63 | ||
64 | __tagtable(ATAG_INITRD2, parse_tag_initrd2); | |
1da177e4 LT |
65 | |
66 | /* | |
4b5f32ce NP |
67 | * This keeps memory configuration data used by a couple memory |
68 | * initialization functions, as well as show_mem() for the skipping | |
69 | * of holes in the memory map. It is populated by arm_add_memory(). | |
1da177e4 | 70 | */ |
4b5f32ce | 71 | struct meminfo meminfo; |
5e709827 | 72 | |
1da177e4 LT |
73 | void show_mem(void) |
74 | { | |
75 | int free = 0, total = 0, reserved = 0; | |
5e709827 RL |
76 | int shared = 0, cached = 0, slab = 0, node, i; |
77 | struct meminfo * mi = &meminfo; | |
1da177e4 LT |
78 | |
79 | printk("Mem-info:\n"); | |
80 | show_free_areas(); | |
1da177e4 | 81 | for_each_online_node(node) { |
204ecae4 | 82 | pg_data_t *n = NODE_DATA(node); |
b7a69ac3 | 83 | struct page *map = pgdat_page_nr(n, 0) - n->node_start_pfn; |
204ecae4 | 84 | |
5e709827 | 85 | for_each_nodebank (i,mi,node) { |
d2a38ef9 | 86 | struct membank *bank = &mi->bank[i]; |
5e709827 RL |
87 | unsigned int pfn1, pfn2; |
88 | struct page *page, *end; | |
89 | ||
d2a38ef9 RK |
90 | pfn1 = bank_pfn_start(bank); |
91 | pfn2 = bank_pfn_end(bank); | |
5e709827 | 92 | |
204ecae4 RK |
93 | page = map + pfn1; |
94 | end = map + pfn2; | |
5e709827 RL |
95 | |
96 | do { | |
97 | total++; | |
98 | if (PageReserved(page)) | |
99 | reserved++; | |
100 | else if (PageSwapCache(page)) | |
101 | cached++; | |
102 | else if (PageSlab(page)) | |
103 | slab++; | |
104 | else if (!page_count(page)) | |
105 | free++; | |
106 | else | |
107 | shared += page_count(page) - 1; | |
108 | page++; | |
109 | } while (page < end); | |
110 | } | |
1da177e4 LT |
111 | } |
112 | ||
113 | printk("%d pages of RAM\n", total); | |
114 | printk("%d free pages\n", free); | |
115 | printk("%d reserved pages\n", reserved); | |
116 | printk("%d slab pages\n", slab); | |
117 | printk("%d pages shared\n", shared); | |
118 | printk("%d pages swap cached\n", cached); | |
119 | } | |
120 | ||
1da177e4 LT |
121 | /* |
122 | * FIXME: We really want to avoid allocating the bootmap bitmap | |
123 | * over the top of the initrd. Hopefully, this is located towards | |
124 | * the start of a bank, so if we allocate the bootmap bitmap at | |
125 | * the end, we won't clash. | |
126 | */ | |
127 | static unsigned int __init | |
128 | find_bootmap_pfn(int node, struct meminfo *mi, unsigned int bootmap_pages) | |
129 | { | |
d2a38ef9 | 130 | unsigned int start_pfn, i, bootmap_pfn; |
1da177e4 | 131 | |
90072059 | 132 | start_pfn = PAGE_ALIGN(__pa(&_end)) >> PAGE_SHIFT; |
1da177e4 LT |
133 | bootmap_pfn = 0; |
134 | ||
d2a38ef9 RK |
135 | for_each_nodebank(i, mi, node) { |
136 | struct membank *bank = &mi->bank[i]; | |
1da177e4 LT |
137 | unsigned int start, end; |
138 | ||
d2a38ef9 RK |
139 | start = bank_pfn_start(bank); |
140 | end = bank_pfn_end(bank); | |
1da177e4 LT |
141 | |
142 | if (end < start_pfn) | |
143 | continue; | |
144 | ||
145 | if (start < start_pfn) | |
146 | start = start_pfn; | |
147 | ||
148 | if (end <= start) | |
149 | continue; | |
150 | ||
151 | if (end - start >= bootmap_pages) { | |
152 | bootmap_pfn = start; | |
153 | break; | |
154 | } | |
155 | } | |
156 | ||
157 | if (bootmap_pfn == 0) | |
158 | BUG(); | |
159 | ||
160 | return bootmap_pfn; | |
161 | } | |
162 | ||
1da177e4 LT |
163 | static int __init check_initrd(struct meminfo *mi) |
164 | { | |
165 | int initrd_node = -2; | |
166 | #ifdef CONFIG_BLK_DEV_INITRD | |
167 | unsigned long end = phys_initrd_start + phys_initrd_size; | |
168 | ||
169 | /* | |
170 | * Make sure that the initrd is within a valid area of | |
171 | * memory. | |
172 | */ | |
173 | if (phys_initrd_size) { | |
174 | unsigned int i; | |
175 | ||
176 | initrd_node = -1; | |
177 | ||
178 | for (i = 0; i < mi->nr_banks; i++) { | |
d2a38ef9 RK |
179 | struct membank *bank = &mi->bank[i]; |
180 | if (bank_phys_start(bank) <= phys_initrd_start && | |
181 | end <= bank_phys_end(bank)) | |
182 | initrd_node = bank->node; | |
1da177e4 LT |
183 | } |
184 | } | |
185 | ||
186 | if (initrd_node == -1) { | |
b962a286 | 187 | printk(KERN_ERR "INITRD: 0x%08lx+0x%08lx extends beyond " |
1da177e4 | 188 | "physical memory - disabling initrd\n", |
b962a286 | 189 | phys_initrd_start, phys_initrd_size); |
1da177e4 LT |
190 | phys_initrd_start = phys_initrd_size = 0; |
191 | } | |
192 | #endif | |
193 | ||
194 | return initrd_node; | |
195 | } | |
196 | ||
456335e2 RK |
197 | static inline void map_memory_bank(struct membank *bank) |
198 | { | |
d111e8f9 | 199 | #ifdef CONFIG_MMU |
456335e2 RK |
200 | struct map_desc map; |
201 | ||
d2a38ef9 RK |
202 | map.pfn = bank_pfn_start(bank); |
203 | map.virtual = __phys_to_virt(bank_phys_start(bank)); | |
204 | map.length = bank_phys_size(bank); | |
456335e2 RK |
205 | map.type = MT_MEMORY; |
206 | ||
207 | create_mapping(&map); | |
d111e8f9 | 208 | #endif |
456335e2 RK |
209 | } |
210 | ||
b7a69ac3 | 211 | static unsigned long __init bootmem_init_node(int node, struct meminfo *mi) |
1da177e4 | 212 | { |
90072059 RK |
213 | unsigned long start_pfn, end_pfn, boot_pfn; |
214 | unsigned int boot_pages; | |
215 | pg_data_t *pgdat; | |
216 | int i; | |
1da177e4 | 217 | |
90072059 RK |
218 | start_pfn = -1UL; |
219 | end_pfn = 0; | |
1da177e4 | 220 | |
90072059 RK |
221 | /* |
222 | * Calculate the pfn range, and map the memory banks for this node. | |
223 | */ | |
224 | for_each_nodebank(i, mi, node) { | |
456335e2 | 225 | struct membank *bank = &mi->bank[i]; |
90072059 | 226 | unsigned long start, end; |
1da177e4 | 227 | |
d2a38ef9 RK |
228 | start = bank_pfn_start(bank); |
229 | end = bank_pfn_end(bank); | |
1da177e4 | 230 | |
90072059 RK |
231 | if (start_pfn > start) |
232 | start_pfn = start; | |
233 | if (end_pfn < end) | |
234 | end_pfn = end; | |
235 | ||
456335e2 | 236 | map_memory_bank(bank); |
90072059 | 237 | } |
1da177e4 LT |
238 | |
239 | /* | |
90072059 | 240 | * If there is no memory in this node, ignore it. |
1da177e4 | 241 | */ |
90072059 RK |
242 | if (end_pfn == 0) |
243 | return end_pfn; | |
1da177e4 | 244 | |
90072059 RK |
245 | /* |
246 | * Allocate the bootmem bitmap page. | |
247 | */ | |
248 | boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn); | |
249 | boot_pfn = find_bootmap_pfn(node, mi, boot_pages); | |
1da177e4 | 250 | |
90072059 RK |
251 | /* |
252 | * Initialise the bootmem allocator for this node, handing the | |
253 | * memory banks over to bootmem. | |
254 | */ | |
255 | node_set_online(node); | |
256 | pgdat = NODE_DATA(node); | |
257 | init_bootmem_node(pgdat, boot_pfn, start_pfn, end_pfn); | |
1da177e4 | 258 | |
d2a38ef9 RK |
259 | for_each_nodebank(i, mi, node) { |
260 | struct membank *bank = &mi->bank[i]; | |
261 | free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank)); | |
b7a69ac3 | 262 | memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank)); |
d2a38ef9 | 263 | } |
90072059 RK |
264 | |
265 | /* | |
266 | * Reserve the bootmem bitmap for this node. | |
267 | */ | |
268 | reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT, | |
72a7fe39 | 269 | boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT); |
1da177e4 | 270 | |
b7a69ac3 RK |
271 | return end_pfn; |
272 | } | |
b962a286 | 273 | |
b7a69ac3 RK |
274 | static void __init bootmem_reserve_initrd(int node) |
275 | { | |
1da177e4 | 276 | #ifdef CONFIG_BLK_DEV_INITRD |
b7a69ac3 RK |
277 | pg_data_t *pgdat = NODE_DATA(node); |
278 | int res; | |
279 | ||
280 | res = reserve_bootmem_node(pgdat, phys_initrd_start, | |
281 | phys_initrd_size, BOOTMEM_EXCLUSIVE); | |
282 | ||
283 | if (res == 0) { | |
284 | initrd_start = __phys_to_virt(phys_initrd_start); | |
285 | initrd_end = initrd_start + phys_initrd_size; | |
286 | } else { | |
287 | printk(KERN_ERR | |
288 | "INITRD: 0x%08lx+0x%08lx overlaps in-use " | |
289 | "memory region - disabling initrd\n", | |
290 | phys_initrd_start, phys_initrd_size); | |
1da177e4 LT |
291 | } |
292 | #endif | |
b7a69ac3 RK |
293 | } |
294 | ||
295 | static void __init bootmem_free_node(int node, struct meminfo *mi) | |
296 | { | |
297 | unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; | |
298 | unsigned long start_pfn, end_pfn; | |
299 | pg_data_t *pgdat = NODE_DATA(node); | |
300 | int i; | |
301 | ||
302 | start_pfn = pgdat->bdata->node_min_pfn; | |
303 | end_pfn = pgdat->bdata->node_low_pfn; | |
1da177e4 | 304 | |
90072059 RK |
305 | /* |
306 | * initialise the zones within this node. | |
307 | */ | |
308 | memset(zone_size, 0, sizeof(zone_size)); | |
309 | memset(zhole_size, 0, sizeof(zhole_size)); | |
310 | ||
311 | /* | |
312 | * The size of this node has already been determined. If we need | |
313 | * to do anything fancy with the allocation of this memory to the | |
314 | * zones, now is the time to do it. | |
315 | */ | |
316 | zone_size[0] = end_pfn - start_pfn; | |
317 | ||
318 | /* | |
319 | * For each bank in this node, calculate the size of the holes. | |
320 | * holes = node_size - sum(bank_sizes_in_node) | |
321 | */ | |
322 | zhole_size[0] = zone_size[0]; | |
323 | for_each_nodebank(i, mi, node) | |
d2a38ef9 | 324 | zhole_size[0] -= bank_pfn_size(&mi->bank[i]); |
90072059 RK |
325 | |
326 | /* | |
327 | * Adjust the sizes according to any special requirements for | |
328 | * this machine type. | |
329 | */ | |
330 | arch_adjust_zones(node, zone_size, zhole_size); | |
331 | ||
9109fb7b | 332 | free_area_init_node(node, zone_size, start_pfn, zhole_size); |
1da177e4 LT |
333 | } |
334 | ||
4b5f32ce | 335 | void __init bootmem_init(void) |
1da177e4 | 336 | { |
4b5f32ce | 337 | struct meminfo *mi = &meminfo; |
456335e2 | 338 | unsigned long memend_pfn = 0; |
eca73214 | 339 | int node, initrd_node; |
1da177e4 | 340 | |
1da177e4 | 341 | /* |
90072059 | 342 | * Locate which node contains the ramdisk image, if any. |
1da177e4 | 343 | */ |
90072059 | 344 | initrd_node = check_initrd(mi); |
1da177e4 | 345 | |
90072059 RK |
346 | /* |
347 | * Run through each node initialising the bootmem allocator. | |
348 | */ | |
349 | for_each_node(node) { | |
b7a69ac3 | 350 | unsigned long end_pfn = bootmem_init_node(node, mi); |
1da177e4 | 351 | |
b7a69ac3 RK |
352 | /* |
353 | * Reserve any special node zero regions. | |
354 | */ | |
355 | if (node == 0) | |
356 | reserve_node_zero(NODE_DATA(node)); | |
357 | ||
358 | /* | |
359 | * If the initrd is in this node, reserve its memory. | |
360 | */ | |
361 | if (node == initrd_node) | |
362 | bootmem_reserve_initrd(node); | |
1da177e4 LT |
363 | |
364 | /* | |
90072059 | 365 | * Remember the highest memory PFN. |
1da177e4 | 366 | */ |
90072059 RK |
367 | if (end_pfn > memend_pfn) |
368 | memend_pfn = end_pfn; | |
369 | } | |
1da177e4 | 370 | |
b7a69ac3 RK |
371 | /* |
372 | * sparse_init() needs the bootmem allocator up and running. | |
373 | */ | |
374 | sparse_init(); | |
375 | ||
376 | /* | |
377 | * Now free memory in each node - free_area_init_node needs | |
378 | * the sparse mem_map arrays initialized by sparse_init() | |
379 | * for memmap_init_zone(), otherwise all PFNs are invalid. | |
380 | */ | |
381 | for_each_node(node) | |
382 | bootmem_free_node(node, mi); | |
383 | ||
90072059 | 384 | high_memory = __va(memend_pfn << PAGE_SHIFT); |
1da177e4 | 385 | |
90072059 RK |
386 | /* |
387 | * This doesn't seem to be used by the Linux memory manager any | |
388 | * more, but is used by ll_rw_block. If we can get rid of it, we | |
389 | * also get rid of some of the stuff above as well. | |
390 | * | |
391 | * Note: max_low_pfn and max_pfn reflect the number of _pages_ in | |
392 | * the system, not the maximum PFN. | |
393 | */ | |
394 | max_pfn = max_low_pfn = memend_pfn - PHYS_PFN_OFFSET; | |
395 | } | |
1da177e4 | 396 | |
6db015e4 | 397 | static inline int free_area(unsigned long pfn, unsigned long end, char *s) |
1da177e4 | 398 | { |
6db015e4 | 399 | unsigned int pages = 0, size = (end - pfn) << (PAGE_SHIFT - 10); |
1da177e4 | 400 | |
6db015e4 NP |
401 | for (; pfn < end; pfn++) { |
402 | struct page *page = pfn_to_page(pfn); | |
1da177e4 | 403 | ClearPageReserved(page); |
7835e98b | 404 | init_page_count(page); |
6db015e4 NP |
405 | __free_page(page); |
406 | pages++; | |
1da177e4 LT |
407 | } |
408 | ||
409 | if (size && s) | |
410 | printk(KERN_INFO "Freeing %s memory: %dK\n", s, size); | |
6db015e4 NP |
411 | |
412 | return pages; | |
1da177e4 LT |
413 | } |
414 | ||
a013053d RK |
415 | static inline void |
416 | free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn) | |
417 | { | |
418 | struct page *start_pg, *end_pg; | |
419 | unsigned long pg, pgend; | |
420 | ||
421 | /* | |
422 | * Convert start_pfn/end_pfn to a struct page pointer. | |
423 | */ | |
424 | start_pg = pfn_to_page(start_pfn); | |
425 | end_pg = pfn_to_page(end_pfn); | |
426 | ||
427 | /* | |
428 | * Convert to physical addresses, and | |
429 | * round start upwards and end downwards. | |
430 | */ | |
431 | pg = PAGE_ALIGN(__pa(start_pg)); | |
432 | pgend = __pa(end_pg) & PAGE_MASK; | |
433 | ||
434 | /* | |
435 | * If there are free pages between these, | |
436 | * free the section of the memmap array. | |
437 | */ | |
438 | if (pg < pgend) | |
439 | free_bootmem_node(NODE_DATA(node), pg, pgend - pg); | |
440 | } | |
441 | ||
442 | /* | |
443 | * The mem_map array can get very big. Free the unused area of the memory map. | |
444 | */ | |
445 | static void __init free_unused_memmap_node(int node, struct meminfo *mi) | |
446 | { | |
447 | unsigned long bank_start, prev_bank_end = 0; | |
448 | unsigned int i; | |
449 | ||
450 | /* | |
451 | * [FIXME] This relies on each bank being in address order. This | |
452 | * may not be the case, especially if the user has provided the | |
453 | * information on the command line. | |
454 | */ | |
90072059 | 455 | for_each_nodebank(i, mi, node) { |
d2a38ef9 RK |
456 | struct membank *bank = &mi->bank[i]; |
457 | ||
458 | bank_start = bank_pfn_start(bank); | |
a013053d RK |
459 | if (bank_start < prev_bank_end) { |
460 | printk(KERN_ERR "MEM: unordered memory banks. " | |
461 | "Not freeing memmap.\n"); | |
462 | break; | |
463 | } | |
464 | ||
465 | /* | |
466 | * If we had a previous bank, and there is a space | |
467 | * between the current bank and the previous, free it. | |
468 | */ | |
469 | if (prev_bank_end && prev_bank_end != bank_start) | |
470 | free_memmap(node, prev_bank_end, bank_start); | |
471 | ||
d2a38ef9 | 472 | prev_bank_end = bank_pfn_end(bank); |
a013053d RK |
473 | } |
474 | } | |
475 | ||
1da177e4 LT |
476 | /* |
477 | * mem_init() marks the free areas in the mem_map and tells us how much | |
478 | * memory is free. This is done after various parts of the system have | |
479 | * claimed their memory after the kernel image. | |
480 | */ | |
481 | void __init mem_init(void) | |
482 | { | |
6db015e4 | 483 | unsigned int codesize, datasize, initsize; |
1da177e4 LT |
484 | int i, node; |
485 | ||
1da177e4 LT |
486 | #ifndef CONFIG_DISCONTIGMEM |
487 | max_mapnr = virt_to_page(high_memory) - mem_map; | |
488 | #endif | |
489 | ||
1da177e4 LT |
490 | /* this will put all unused low memory onto the freelists */ |
491 | for_each_online_node(node) { | |
492 | pg_data_t *pgdat = NODE_DATA(node); | |
493 | ||
a013053d RK |
494 | free_unused_memmap_node(node, &meminfo); |
495 | ||
1da177e4 LT |
496 | if (pgdat->node_spanned_pages != 0) |
497 | totalram_pages += free_all_bootmem_node(pgdat); | |
498 | } | |
499 | ||
500 | #ifdef CONFIG_SA1111 | |
501 | /* now that our DMA memory is actually so designated, we can free it */ | |
6db015e4 NP |
502 | totalram_pages += free_area(PHYS_PFN_OFFSET, |
503 | __phys_to_pfn(__pa(swapper_pg_dir)), NULL); | |
1da177e4 LT |
504 | #endif |
505 | ||
506 | /* | |
507 | * Since our memory may not be contiguous, calculate the | |
508 | * real number of pages we have in this system | |
509 | */ | |
510 | printk(KERN_INFO "Memory:"); | |
1da177e4 LT |
511 | num_physpages = 0; |
512 | for (i = 0; i < meminfo.nr_banks; i++) { | |
d2a38ef9 RK |
513 | num_physpages += bank_pfn_size(&meminfo.bank[i]); |
514 | printk(" %ldMB", bank_phys_size(&meminfo.bank[i]) >> 20); | |
1da177e4 | 515 | } |
1da177e4 | 516 | printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT)); |
6db015e4 NP |
517 | |
518 | codesize = &_etext - &_text; | |
519 | datasize = &_end - &__data_start; | |
520 | initsize = &__init_end - &__init_begin; | |
521 | ||
1da177e4 LT |
522 | printk(KERN_NOTICE "Memory: %luKB available (%dK code, " |
523 | "%dK data, %dK init)\n", | |
524 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), | |
6db015e4 | 525 | codesize >> 10, datasize >> 10, initsize >> 10); |
1da177e4 LT |
526 | |
527 | if (PAGE_SIZE >= 16384 && num_physpages <= 128) { | |
528 | extern int sysctl_overcommit_memory; | |
529 | /* | |
530 | * On a machine this small we won't get | |
531 | * anywhere without overcommit, so turn | |
532 | * it on by default. | |
533 | */ | |
534 | sysctl_overcommit_memory = OVERCOMMIT_ALWAYS; | |
535 | } | |
536 | } | |
537 | ||
538 | void free_initmem(void) | |
539 | { | |
6db015e4 NP |
540 | if (!machine_is_integrator() && !machine_is_cintegrator()) |
541 | totalram_pages += free_area(__phys_to_pfn(__pa(&__init_begin)), | |
542 | __phys_to_pfn(__pa(&__init_end)), | |
543 | "init"); | |
1da177e4 LT |
544 | } |
545 | ||
546 | #ifdef CONFIG_BLK_DEV_INITRD | |
547 | ||
548 | static int keep_initrd; | |
549 | ||
550 | void free_initrd_mem(unsigned long start, unsigned long end) | |
551 | { | |
552 | if (!keep_initrd) | |
6db015e4 NP |
553 | totalram_pages += free_area(__phys_to_pfn(__pa(start)), |
554 | __phys_to_pfn(__pa(end)), | |
555 | "initrd"); | |
1da177e4 LT |
556 | } |
557 | ||
558 | static int __init keepinitrd_setup(char *__unused) | |
559 | { | |
560 | keep_initrd = 1; | |
561 | return 1; | |
562 | } | |
563 | ||
564 | __setup("keepinitrd", keepinitrd_setup); | |
565 | #endif |