init.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. /*
  2. * linux/arch/arm/mm/init.c
  3. *
  4. * Copyright (C) 1995-2005 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/config.h>
  11. #include <linux/kernel.h>
  12. #include <linux/errno.h>
  13. #include <linux/ptrace.h>
  14. #include <linux/swap.h>
  15. #include <linux/init.h>
  16. #include <linux/bootmem.h>
  17. #include <linux/mman.h>
  18. #include <linux/nodemask.h>
  19. #include <linux/initrd.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/setup.h>
  22. #include <asm/sizes.h>
  23. #include <asm/tlb.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach/map.h>
  26. DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
  27. extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
  28. extern void _stext, _text, _etext, __data_start, _end, __init_begin, __init_end;
  29. extern unsigned long phys_initrd_start;
  30. extern unsigned long phys_initrd_size;
  31. /*
  32. * The sole use of this is to pass memory configuration
  33. * data from paging_init to mem_init.
  34. */
  35. static struct meminfo meminfo __initdata = { 0, };
  36. /*
  37. * empty_zero_page is a special page that is used for
  38. * zero-initialized data and COW.
  39. */
  40. struct page *empty_zero_page;
  41. void show_mem(void)
  42. {
  43. int free = 0, total = 0, reserved = 0;
  44. int shared = 0, cached = 0, slab = 0, node;
  45. printk("Mem-info:\n");
  46. show_free_areas();
  47. printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
  48. for_each_online_node(node) {
  49. struct page *page, *end;
  50. page = NODE_MEM_MAP(node);
  51. end = page + NODE_DATA(node)->node_spanned_pages;
  52. do {
  53. total++;
  54. if (PageReserved(page))
  55. reserved++;
  56. else if (PageSwapCache(page))
  57. cached++;
  58. else if (PageSlab(page))
  59. slab++;
  60. else if (!page_count(page))
  61. free++;
  62. else
  63. shared += page_count(page) - 1;
  64. page++;
  65. } while (page < end);
  66. }
  67. printk("%d pages of RAM\n", total);
  68. printk("%d free pages\n", free);
  69. printk("%d reserved pages\n", reserved);
  70. printk("%d slab pages\n", slab);
  71. printk("%d pages shared\n", shared);
  72. printk("%d pages swap cached\n", cached);
  73. }
  74. static inline pmd_t *pmd_off(pgd_t *pgd, unsigned long virt)
  75. {
  76. return pmd_offset(pgd, virt);
  77. }
  78. static inline pmd_t *pmd_off_k(unsigned long virt)
  79. {
  80. return pmd_off(pgd_offset_k(virt), virt);
  81. }
  82. #define for_each_nodebank(iter,mi,no) \
  83. for (iter = 0; iter < mi->nr_banks; iter++) \
  84. if (mi->bank[iter].node == no)
  85. /*
  86. * FIXME: We really want to avoid allocating the bootmap bitmap
  87. * over the top of the initrd. Hopefully, this is located towards
  88. * the start of a bank, so if we allocate the bootmap bitmap at
  89. * the end, we won't clash.
  90. */
  91. static unsigned int __init
  92. find_bootmap_pfn(int node, struct meminfo *mi, unsigned int bootmap_pages)
  93. {
  94. unsigned int start_pfn, bank, bootmap_pfn;
  95. start_pfn = PAGE_ALIGN(__pa(&_end)) >> PAGE_SHIFT;
  96. bootmap_pfn = 0;
  97. for_each_nodebank(bank, mi, node) {
  98. unsigned int start, end;
  99. start = mi->bank[bank].start >> PAGE_SHIFT;
  100. end = (mi->bank[bank].size +
  101. mi->bank[bank].start) >> PAGE_SHIFT;
  102. if (end < start_pfn)
  103. continue;
  104. if (start < start_pfn)
  105. start = start_pfn;
  106. if (end <= start)
  107. continue;
  108. if (end - start >= bootmap_pages) {
  109. bootmap_pfn = start;
  110. break;
  111. }
  112. }
  113. if (bootmap_pfn == 0)
  114. BUG();
  115. return bootmap_pfn;
  116. }
  117. static int __init check_initrd(struct meminfo *mi)
  118. {
  119. int initrd_node = -2;
  120. #ifdef CONFIG_BLK_DEV_INITRD
  121. unsigned long end = phys_initrd_start + phys_initrd_size;
  122. /*
  123. * Make sure that the initrd is within a valid area of
  124. * memory.
  125. */
  126. if (phys_initrd_size) {
  127. unsigned int i;
  128. initrd_node = -1;
  129. for (i = 0; i < mi->nr_banks; i++) {
  130. unsigned long bank_end;
  131. bank_end = mi->bank[i].start + mi->bank[i].size;
  132. if (mi->bank[i].start <= phys_initrd_start &&
  133. end <= bank_end)
  134. initrd_node = mi->bank[i].node;
  135. }
  136. }
  137. if (initrd_node == -1) {
  138. printk(KERN_ERR "initrd (0x%08lx - 0x%08lx) extends beyond "
  139. "physical memory - disabling initrd\n",
  140. phys_initrd_start, end);
  141. phys_initrd_start = phys_initrd_size = 0;
  142. }
  143. #endif
  144. return initrd_node;
  145. }
  146. /*
  147. * Reserve the various regions of node 0
  148. */
  149. static __init void reserve_node_zero(pg_data_t *pgdat)
  150. {
  151. unsigned long res_size = 0;
  152. /*
  153. * Register the kernel text and data with bootmem.
  154. * Note that this can only be in node 0.
  155. */
  156. #ifdef CONFIG_XIP_KERNEL
  157. reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start);
  158. #else
  159. reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext);
  160. #endif
  161. /*
  162. * Reserve the page tables. These are already in use,
  163. * and can only be in node 0.
  164. */
  165. reserve_bootmem_node(pgdat, __pa(swapper_pg_dir),
  166. PTRS_PER_PGD * sizeof(pgd_t));
  167. /*
  168. * Hmm... This should go elsewhere, but we really really need to
  169. * stop things allocating the low memory; ideally we need a better
  170. * implementation of GFP_DMA which does not assume that DMA-able
  171. * memory starts at zero.
  172. */
  173. if (machine_is_integrator() || machine_is_cintegrator())
  174. res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
  175. /*
  176. * These should likewise go elsewhere. They pre-reserve the
  177. * screen memory region at the start of main system memory.
  178. */
  179. if (machine_is_edb7211())
  180. res_size = 0x00020000;
  181. if (machine_is_p720t())
  182. res_size = 0x00014000;
  183. #ifdef CONFIG_SA1111
  184. /*
  185. * Because of the SA1111 DMA bug, we want to preserve our
  186. * precious DMA-able memory...
  187. */
  188. res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
  189. #endif
  190. if (res_size)
  191. reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size);
  192. }
  193. void __init build_mem_type_table(void);
  194. void __init create_mapping(struct map_desc *md);
  195. static unsigned long __init
  196. bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
  197. {
  198. unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
  199. unsigned long start_pfn, end_pfn, boot_pfn;
  200. unsigned int boot_pages;
  201. pg_data_t *pgdat;
  202. int i;
  203. start_pfn = -1UL;
  204. end_pfn = 0;
  205. /*
  206. * Calculate the pfn range, and map the memory banks for this node.
  207. */
  208. for_each_nodebank(i, mi, node) {
  209. unsigned long start, end;
  210. struct map_desc map;
  211. start = mi->bank[i].start >> PAGE_SHIFT;
  212. end = (mi->bank[i].start + mi->bank[i].size) >> PAGE_SHIFT;
  213. if (start_pfn > start)
  214. start_pfn = start;
  215. if (end_pfn < end)
  216. end_pfn = end;
  217. map.pfn = __phys_to_pfn(mi->bank[i].start);
  218. map.virtual = __phys_to_virt(mi->bank[i].start);
  219. map.length = mi->bank[i].size;
  220. map.type = MT_MEMORY;
  221. create_mapping(&map);
  222. }
  223. /*
  224. * If there is no memory in this node, ignore it.
  225. */
  226. if (end_pfn == 0)
  227. return end_pfn;
  228. /*
  229. * Allocate the bootmem bitmap page.
  230. */
  231. boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
  232. boot_pfn = find_bootmap_pfn(node, mi, boot_pages);
  233. /*
  234. * Initialise the bootmem allocator for this node, handing the
  235. * memory banks over to bootmem.
  236. */
  237. node_set_online(node);
  238. pgdat = NODE_DATA(node);
  239. init_bootmem_node(pgdat, boot_pfn, start_pfn, end_pfn);
  240. for_each_nodebank(i, mi, node)
  241. free_bootmem_node(pgdat, mi->bank[i].start, mi->bank[i].size);
  242. /*
  243. * Reserve the bootmem bitmap for this node.
  244. */
  245. reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT,
  246. boot_pages << PAGE_SHIFT);
  247. #ifdef CONFIG_BLK_DEV_INITRD
  248. /*
  249. * If the initrd is in this node, reserve its memory.
  250. */
  251. if (node == initrd_node) {
  252. reserve_bootmem_node(pgdat, phys_initrd_start,
  253. phys_initrd_size);
  254. initrd_start = __phys_to_virt(phys_initrd_start);
  255. initrd_end = initrd_start + phys_initrd_size;
  256. }
  257. #endif
  258. /*
  259. * Finally, reserve any node zero regions.
  260. */
  261. if (node == 0)
  262. reserve_node_zero(pgdat);
  263. /*
  264. * initialise the zones within this node.
  265. */
  266. memset(zone_size, 0, sizeof(zone_size));
  267. memset(zhole_size, 0, sizeof(zhole_size));
  268. /*
  269. * The size of this node has already been determined. If we need
  270. * to do anything fancy with the allocation of this memory to the
  271. * zones, now is the time to do it.
  272. */
  273. zone_size[0] = end_pfn - start_pfn;
  274. /*
  275. * For each bank in this node, calculate the size of the holes.
  276. * holes = node_size - sum(bank_sizes_in_node)
  277. */
  278. zhole_size[0] = zone_size[0];
  279. for_each_nodebank(i, mi, node)
  280. zhole_size[0] -= mi->bank[i].size >> PAGE_SHIFT;
  281. /*
  282. * Adjust the sizes according to any special requirements for
  283. * this machine type.
  284. */
  285. arch_adjust_zones(node, zone_size, zhole_size);
  286. free_area_init_node(node, pgdat, zone_size, start_pfn, zhole_size);
  287. return end_pfn;
  288. }
  289. static void __init bootmem_init(struct meminfo *mi)
  290. {
  291. unsigned long addr, memend_pfn = 0;
  292. int node, initrd_node, i;
  293. /*
  294. * Invalidate the node number for empty or invalid memory banks
  295. */
  296. for (i = 0; i < mi->nr_banks; i++)
  297. if (mi->bank[i].size == 0 || mi->bank[i].node >= MAX_NUMNODES)
  298. mi->bank[i].node = -1;
  299. memcpy(&meminfo, mi, sizeof(meminfo));
  300. /*
  301. * Clear out all the mappings below the kernel image.
  302. */
  303. for (addr = 0; addr < MODULE_START; addr += PGDIR_SIZE)
  304. pmd_clear(pmd_off_k(addr));
  305. #ifdef CONFIG_XIP_KERNEL
  306. /* The XIP kernel is mapped in the module area -- skip over it */
  307. addr = ((unsigned long)&_etext + PGDIR_SIZE - 1) & PGDIR_MASK;
  308. #endif
  309. for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE)
  310. pmd_clear(pmd_off_k(addr));
  311. /*
  312. * Clear out all the kernel space mappings, except for the first
  313. * memory bank, up to the end of the vmalloc region.
  314. */
  315. for (addr = __phys_to_virt(mi->bank[0].start + mi->bank[0].size);
  316. addr < VMALLOC_END; addr += PGDIR_SIZE)
  317. pmd_clear(pmd_off_k(addr));
  318. /*
  319. * Locate which node contains the ramdisk image, if any.
  320. */
  321. initrd_node = check_initrd(mi);
  322. /*
  323. * Run through each node initialising the bootmem allocator.
  324. */
  325. for_each_node(node) {
  326. unsigned long end_pfn;
  327. end_pfn = bootmem_init_node(node, initrd_node, mi);
  328. /*
  329. * Remember the highest memory PFN.
  330. */
  331. if (end_pfn > memend_pfn)
  332. memend_pfn = end_pfn;
  333. }
  334. high_memory = __va(memend_pfn << PAGE_SHIFT);
  335. /*
  336. * This doesn't seem to be used by the Linux memory manager any
  337. * more, but is used by ll_rw_block. If we can get rid of it, we
  338. * also get rid of some of the stuff above as well.
  339. *
  340. * Note: max_low_pfn and max_pfn reflect the number of _pages_ in
  341. * the system, not the maximum PFN.
  342. */
  343. max_pfn = max_low_pfn = memend_pfn - PHYS_PFN_OFFSET;
  344. }
  345. /*
  346. * Set up device the mappings. Since we clear out the page tables for all
  347. * mappings above VMALLOC_END, we will remove any debug device mappings.
  348. * This means you have to be careful how you debug this function, or any
  349. * called function. This means you can't use any function or debugging
  350. * method which may touch any device, otherwise the kernel _will_ crash.
  351. */
  352. static void __init devicemaps_init(struct machine_desc *mdesc)
  353. {
  354. struct map_desc map;
  355. unsigned long addr;
  356. void *vectors;
  357. /*
  358. * Allocate the vector page early.
  359. */
  360. vectors = alloc_bootmem_low_pages(PAGE_SIZE);
  361. BUG_ON(!vectors);
  362. for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
  363. pmd_clear(pmd_off_k(addr));
  364. /*
  365. * Map the kernel if it is XIP.
  366. * It is always first in the modulearea.
  367. */
  368. #ifdef CONFIG_XIP_KERNEL
  369. map.pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & PGDIR_MASK);
  370. map.virtual = MODULE_START;
  371. map.length = ((unsigned long)&_etext - map.virtual + ~PGDIR_MASK) & PGDIR_MASK;
  372. map.type = MT_ROM;
  373. create_mapping(&map);
  374. #endif
  375. /*
  376. * Map the cache flushing regions.
  377. */
  378. #ifdef FLUSH_BASE
  379. map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS);
  380. map.virtual = FLUSH_BASE;
  381. map.length = SZ_1M;
  382. map.type = MT_CACHECLEAN;
  383. create_mapping(&map);
  384. #endif
  385. #ifdef FLUSH_BASE_MINICACHE
  386. map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS + SZ_1M);
  387. map.virtual = FLUSH_BASE_MINICACHE;
  388. map.length = SZ_1M;
  389. map.type = MT_MINICLEAN;
  390. create_mapping(&map);
  391. #endif
  392. /*
  393. * Create a mapping for the machine vectors at the high-vectors
  394. * location (0xffff0000). If we aren't using high-vectors, also
  395. * create a mapping at the low-vectors virtual address.
  396. */
  397. map.pfn = __phys_to_pfn(virt_to_phys(vectors));
  398. map.virtual = 0xffff0000;
  399. map.length = PAGE_SIZE;
  400. map.type = MT_HIGH_VECTORS;
  401. create_mapping(&map);
  402. if (!vectors_high()) {
  403. map.virtual = 0;
  404. map.type = MT_LOW_VECTORS;
  405. create_mapping(&map);
  406. }
  407. /*
  408. * Ask the machine support to map in the statically mapped devices.
  409. */
  410. if (mdesc->map_io)
  411. mdesc->map_io();
  412. /*
  413. * Finally flush the caches and tlb to ensure that we're in a
  414. * consistent state wrt the writebuffer. This also ensures that
  415. * any write-allocated cache lines in the vector page are written
  416. * back. After this point, we can start to touch devices again.
  417. */
  418. local_flush_tlb_all();
  419. flush_cache_all();
  420. }
  421. /*
  422. * paging_init() sets up the page tables, initialises the zone memory
  423. * maps, and sets up the zero page, bad page and bad page tables.
  424. */
  425. void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc)
  426. {
  427. void *zero_page;
  428. build_mem_type_table();
  429. bootmem_init(mi);
  430. devicemaps_init(mdesc);
  431. top_pmd = pmd_off_k(0xffff0000);
  432. /*
  433. * allocate the zero page. Note that we count on this going ok.
  434. */
  435. zero_page = alloc_bootmem_low_pages(PAGE_SIZE);
  436. memzero(zero_page, PAGE_SIZE);
  437. empty_zero_page = virt_to_page(zero_page);
  438. flush_dcache_page(empty_zero_page);
  439. }
  440. static inline void free_area(unsigned long addr, unsigned long end, char *s)
  441. {
  442. unsigned int size = (end - addr) >> 10;
  443. for (; addr < end; addr += PAGE_SIZE) {
  444. struct page *page = virt_to_page(addr);
  445. ClearPageReserved(page);
  446. init_page_count(page);
  447. free_page(addr);
  448. totalram_pages++;
  449. }
  450. if (size && s)
  451. printk(KERN_INFO "Freeing %s memory: %dK\n", s, size);
  452. }
  453. static inline void
  454. free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn)
  455. {
  456. struct page *start_pg, *end_pg;
  457. unsigned long pg, pgend;
  458. /*
  459. * Convert start_pfn/end_pfn to a struct page pointer.
  460. */
  461. start_pg = pfn_to_page(start_pfn);
  462. end_pg = pfn_to_page(end_pfn);
  463. /*
  464. * Convert to physical addresses, and
  465. * round start upwards and end downwards.
  466. */
  467. pg = PAGE_ALIGN(__pa(start_pg));
  468. pgend = __pa(end_pg) & PAGE_MASK;
  469. /*
  470. * If there are free pages between these,
  471. * free the section of the memmap array.
  472. */
  473. if (pg < pgend)
  474. free_bootmem_node(NODE_DATA(node), pg, pgend - pg);
  475. }
  476. /*
  477. * The mem_map array can get very big. Free the unused area of the memory map.
  478. */
  479. static void __init free_unused_memmap_node(int node, struct meminfo *mi)
  480. {
  481. unsigned long bank_start, prev_bank_end = 0;
  482. unsigned int i;
  483. /*
  484. * [FIXME] This relies on each bank being in address order. This
  485. * may not be the case, especially if the user has provided the
  486. * information on the command line.
  487. */
  488. for_each_nodebank(i, mi, node) {
  489. bank_start = mi->bank[i].start >> PAGE_SHIFT;
  490. if (bank_start < prev_bank_end) {
  491. printk(KERN_ERR "MEM: unordered memory banks. "
  492. "Not freeing memmap.\n");
  493. break;
  494. }
  495. /*
  496. * If we had a previous bank, and there is a space
  497. * between the current bank and the previous, free it.
  498. */
  499. if (prev_bank_end && prev_bank_end != bank_start)
  500. free_memmap(node, prev_bank_end, bank_start);
  501. prev_bank_end = (mi->bank[i].start +
  502. mi->bank[i].size) >> PAGE_SHIFT;
  503. }
  504. }
  505. /*
  506. * mem_init() marks the free areas in the mem_map and tells us how much
  507. * memory is free. This is done after various parts of the system have
  508. * claimed their memory after the kernel image.
  509. */
  510. void __init mem_init(void)
  511. {
  512. unsigned int codepages, datapages, initpages;
  513. int i, node;
  514. codepages = &_etext - &_text;
  515. datapages = &_end - &__data_start;
  516. initpages = &__init_end - &__init_begin;
  517. #ifndef CONFIG_DISCONTIGMEM
  518. max_mapnr = virt_to_page(high_memory) - mem_map;
  519. #endif
  520. /* this will put all unused low memory onto the freelists */
  521. for_each_online_node(node) {
  522. pg_data_t *pgdat = NODE_DATA(node);
  523. free_unused_memmap_node(node, &meminfo);
  524. if (pgdat->node_spanned_pages != 0)
  525. totalram_pages += free_all_bootmem_node(pgdat);
  526. }
  527. #ifdef CONFIG_SA1111
  528. /* now that our DMA memory is actually so designated, we can free it */
  529. free_area(PAGE_OFFSET, (unsigned long)swapper_pg_dir, NULL);
  530. #endif
  531. /*
  532. * Since our memory may not be contiguous, calculate the
  533. * real number of pages we have in this system
  534. */
  535. printk(KERN_INFO "Memory:");
  536. num_physpages = 0;
  537. for (i = 0; i < meminfo.nr_banks; i++) {
  538. num_physpages += meminfo.bank[i].size >> PAGE_SHIFT;
  539. printk(" %ldMB", meminfo.bank[i].size >> 20);
  540. }
  541. printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
  542. printk(KERN_NOTICE "Memory: %luKB available (%dK code, "
  543. "%dK data, %dK init)\n",
  544. (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
  545. codepages >> 10, datapages >> 10, initpages >> 10);
  546. if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
  547. extern int sysctl_overcommit_memory;
  548. /*
  549. * On a machine this small we won't get
  550. * anywhere without overcommit, so turn
  551. * it on by default.
  552. */
  553. sysctl_overcommit_memory = OVERCOMMIT_ALWAYS;
  554. }
  555. }
  556. void free_initmem(void)
  557. {
  558. if (!machine_is_integrator() && !machine_is_cintegrator()) {
  559. free_area((unsigned long)(&__init_begin),
  560. (unsigned long)(&__init_end),
  561. "init");
  562. }
  563. }
  564. #ifdef CONFIG_BLK_DEV_INITRD
  565. static int keep_initrd;
  566. void free_initrd_mem(unsigned long start, unsigned long end)
  567. {
  568. if (!keep_initrd)
  569. free_area(start, end, "initrd");
  570. }
  571. static int __init keepinitrd_setup(char *__unused)
  572. {
  573. keep_initrd = 1;
  574. return 1;
  575. }
  576. __setup("keepinitrd", keepinitrd_setup);
  577. #endif