init.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  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/kernel.h>
  11. #include <linux/errno.h>
  12. #include <linux/swap.h>
  13. #include <linux/init.h>
  14. #include <linux/bootmem.h>
  15. #include <linux/mman.h>
  16. #include <linux/export.h>
  17. #include <linux/nodemask.h>
  18. #include <linux/initrd.h>
  19. #include <linux/of_fdt.h>
  20. #include <linux/highmem.h>
  21. #include <linux/gfp.h>
  22. #include <linux/memblock.h>
  23. #include <linux/dma-contiguous.h>
  24. #include <linux/sizes.h>
  25. #include <asm/mach-types.h>
  26. #include <asm/memblock.h>
  27. #include <asm/prom.h>
  28. #include <asm/sections.h>
  29. #include <asm/setup.h>
  30. #include <asm/tlb.h>
  31. #include <asm/fixmap.h>
  32. #include <asm/mach/arch.h>
  33. #include <asm/mach/map.h>
  34. #include "mm.h"
  35. static phys_addr_t phys_initrd_start __initdata = 0;
  36. static unsigned long phys_initrd_size __initdata = 0;
  37. static int __init early_initrd(char *p)
  38. {
  39. phys_addr_t start;
  40. unsigned long size;
  41. char *endp;
  42. start = memparse(p, &endp);
  43. if (*endp == ',') {
  44. size = memparse(endp + 1, NULL);
  45. phys_initrd_start = start;
  46. phys_initrd_size = size;
  47. }
  48. return 0;
  49. }
  50. early_param("initrd", early_initrd);
  51. static int __init parse_tag_initrd(const struct tag *tag)
  52. {
  53. printk(KERN_WARNING "ATAG_INITRD is deprecated; "
  54. "please update your bootloader.\n");
  55. phys_initrd_start = __virt_to_phys(tag->u.initrd.start);
  56. phys_initrd_size = tag->u.initrd.size;
  57. return 0;
  58. }
  59. __tagtable(ATAG_INITRD, parse_tag_initrd);
  60. static int __init parse_tag_initrd2(const struct tag *tag)
  61. {
  62. phys_initrd_start = tag->u.initrd.start;
  63. phys_initrd_size = tag->u.initrd.size;
  64. return 0;
  65. }
  66. __tagtable(ATAG_INITRD2, parse_tag_initrd2);
  67. /*
  68. * This keeps memory configuration data used by a couple memory
  69. * initialization functions, as well as show_mem() for the skipping
  70. * of holes in the memory map. It is populated by arm_add_memory().
  71. */
  72. struct meminfo meminfo;
  73. void show_mem(unsigned int filter)
  74. {
  75. int free = 0, total = 0, reserved = 0;
  76. int shared = 0, cached = 0, slab = 0, i;
  77. struct meminfo * mi = &meminfo;
  78. printk("Mem-info:\n");
  79. show_free_areas(filter);
  80. for_each_bank (i, mi) {
  81. struct membank *bank = &mi->bank[i];
  82. unsigned int pfn1, pfn2;
  83. struct page *page, *end;
  84. pfn1 = bank_pfn_start(bank);
  85. pfn2 = bank_pfn_end(bank);
  86. page = pfn_to_page(pfn1);
  87. end = pfn_to_page(pfn2 - 1) + 1;
  88. do {
  89. total++;
  90. if (PageReserved(page))
  91. reserved++;
  92. else if (PageSwapCache(page))
  93. cached++;
  94. else if (PageSlab(page))
  95. slab++;
  96. else if (!page_count(page))
  97. free++;
  98. else
  99. shared += page_count(page) - 1;
  100. page++;
  101. } while (page < end);
  102. }
  103. printk("%d pages of RAM\n", total);
  104. printk("%d free pages\n", free);
  105. printk("%d reserved pages\n", reserved);
  106. printk("%d slab pages\n", slab);
  107. printk("%d pages shared\n", shared);
  108. printk("%d pages swap cached\n", cached);
  109. }
  110. static void __init find_limits(unsigned long *min, unsigned long *max_low,
  111. unsigned long *max_high)
  112. {
  113. struct meminfo *mi = &meminfo;
  114. int i;
  115. /* This assumes the meminfo array is properly sorted */
  116. *min = bank_pfn_start(&mi->bank[0]);
  117. for_each_bank (i, mi)
  118. if (mi->bank[i].highmem)
  119. break;
  120. *max_low = bank_pfn_end(&mi->bank[i - 1]);
  121. *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]);
  122. }
  123. #ifdef CONFIG_ZONE_DMA
  124. phys_addr_t arm_dma_zone_size __read_mostly;
  125. EXPORT_SYMBOL(arm_dma_zone_size);
  126. /*
  127. * The DMA mask corresponding to the maximum bus address allocatable
  128. * using GFP_DMA. The default here places no restriction on DMA
  129. * allocations. This must be the smallest DMA mask in the system,
  130. * so a successful GFP_DMA allocation will always satisfy this.
  131. */
  132. phys_addr_t arm_dma_limit;
  133. unsigned long arm_dma_pfn_limit;
  134. static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole,
  135. unsigned long dma_size)
  136. {
  137. if (size[0] <= dma_size)
  138. return;
  139. size[ZONE_NORMAL] = size[0] - dma_size;
  140. size[ZONE_DMA] = dma_size;
  141. hole[ZONE_NORMAL] = hole[0];
  142. hole[ZONE_DMA] = 0;
  143. }
  144. #endif
  145. void __init setup_dma_zone(const struct machine_desc *mdesc)
  146. {
  147. #ifdef CONFIG_ZONE_DMA
  148. if (mdesc->dma_zone_size) {
  149. arm_dma_zone_size = mdesc->dma_zone_size;
  150. arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1;
  151. } else
  152. arm_dma_limit = 0xffffffff;
  153. arm_dma_pfn_limit = arm_dma_limit >> PAGE_SHIFT;
  154. #endif
  155. }
  156. static void __init zone_sizes_init(unsigned long min, unsigned long max_low,
  157. unsigned long max_high)
  158. {
  159. unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
  160. struct memblock_region *reg;
  161. /*
  162. * initialise the zones.
  163. */
  164. memset(zone_size, 0, sizeof(zone_size));
  165. /*
  166. * The memory size has already been determined. If we need
  167. * to do anything fancy with the allocation of this memory
  168. * to the zones, now is the time to do it.
  169. */
  170. zone_size[0] = max_low - min;
  171. #ifdef CONFIG_HIGHMEM
  172. zone_size[ZONE_HIGHMEM] = max_high - max_low;
  173. #endif
  174. /*
  175. * Calculate the size of the holes.
  176. * holes = node_size - sum(bank_sizes)
  177. */
  178. memcpy(zhole_size, zone_size, sizeof(zhole_size));
  179. for_each_memblock(memory, reg) {
  180. unsigned long start = memblock_region_memory_base_pfn(reg);
  181. unsigned long end = memblock_region_memory_end_pfn(reg);
  182. if (start < max_low) {
  183. unsigned long low_end = min(end, max_low);
  184. zhole_size[0] -= low_end - start;
  185. }
  186. #ifdef CONFIG_HIGHMEM
  187. if (end > max_low) {
  188. unsigned long high_start = max(start, max_low);
  189. zhole_size[ZONE_HIGHMEM] -= end - high_start;
  190. }
  191. #endif
  192. }
  193. #ifdef CONFIG_ZONE_DMA
  194. /*
  195. * Adjust the sizes according to any special requirements for
  196. * this machine type.
  197. */
  198. if (arm_dma_zone_size)
  199. arm_adjust_dma_zone(zone_size, zhole_size,
  200. arm_dma_zone_size >> PAGE_SHIFT);
  201. #endif
  202. free_area_init_node(0, zone_size, min, zhole_size);
  203. }
  204. #ifdef CONFIG_HAVE_ARCH_PFN_VALID
  205. int pfn_valid(unsigned long pfn)
  206. {
  207. return memblock_is_memory(__pfn_to_phys(pfn));
  208. }
  209. EXPORT_SYMBOL(pfn_valid);
  210. #endif
  211. #ifndef CONFIG_SPARSEMEM
  212. static void __init arm_memory_present(void)
  213. {
  214. }
  215. #else
  216. static void __init arm_memory_present(void)
  217. {
  218. struct memblock_region *reg;
  219. for_each_memblock(memory, reg)
  220. memory_present(0, memblock_region_memory_base_pfn(reg),
  221. memblock_region_memory_end_pfn(reg));
  222. }
  223. #endif
  224. static bool arm_memblock_steal_permitted = true;
  225. phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
  226. {
  227. phys_addr_t phys;
  228. BUG_ON(!arm_memblock_steal_permitted);
  229. phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE);
  230. memblock_free(phys, size);
  231. memblock_remove(phys, size);
  232. return phys;
  233. }
  234. void __init arm_memblock_init(struct meminfo *mi,
  235. const struct machine_desc *mdesc)
  236. {
  237. int i;
  238. for (i = 0; i < mi->nr_banks; i++)
  239. memblock_add(mi->bank[i].start, mi->bank[i].size);
  240. /* Register the kernel text, kernel data and initrd with memblock. */
  241. #ifdef CONFIG_XIP_KERNEL
  242. memblock_reserve(__pa(_sdata), _end - _sdata);
  243. #else
  244. memblock_reserve(__pa(_stext), _end - _stext);
  245. #endif
  246. #ifdef CONFIG_BLK_DEV_INITRD
  247. /* FDT scan will populate initrd_start */
  248. if (initrd_start && !phys_initrd_size) {
  249. phys_initrd_start = __virt_to_phys(initrd_start);
  250. phys_initrd_size = initrd_end - initrd_start;
  251. }
  252. initrd_start = initrd_end = 0;
  253. if (phys_initrd_size &&
  254. !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) {
  255. pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n",
  256. (u64)phys_initrd_start, phys_initrd_size);
  257. phys_initrd_start = phys_initrd_size = 0;
  258. }
  259. if (phys_initrd_size &&
  260. memblock_is_region_reserved(phys_initrd_start, phys_initrd_size)) {
  261. pr_err("INITRD: 0x%08llx+0x%08lx overlaps in-use memory region - disabling initrd\n",
  262. (u64)phys_initrd_start, phys_initrd_size);
  263. phys_initrd_start = phys_initrd_size = 0;
  264. }
  265. if (phys_initrd_size) {
  266. memblock_reserve(phys_initrd_start, phys_initrd_size);
  267. /* Now convert initrd to virtual addresses */
  268. initrd_start = __phys_to_virt(phys_initrd_start);
  269. initrd_end = initrd_start + phys_initrd_size;
  270. }
  271. #endif
  272. arm_mm_memblock_reserve();
  273. arm_dt_memblock_reserve();
  274. /* reserve any platform specific memblock areas */
  275. if (mdesc->reserve)
  276. mdesc->reserve();
  277. early_init_fdt_scan_reserved_mem();
  278. /*
  279. * reserve memory for DMA contigouos allocations,
  280. * must come from DMA area inside low memory
  281. */
  282. dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit));
  283. arm_memblock_steal_permitted = false;
  284. memblock_dump_all();
  285. }
  286. void __init bootmem_init(void)
  287. {
  288. unsigned long min, max_low, max_high;
  289. memblock_allow_resize();
  290. max_low = max_high = 0;
  291. find_limits(&min, &max_low, &max_high);
  292. /*
  293. * Sparsemem tries to allocate bootmem in memory_present(),
  294. * so must be done after the fixed reservations
  295. */
  296. arm_memory_present();
  297. /*
  298. * sparse_init() needs the bootmem allocator up and running.
  299. */
  300. sparse_init();
  301. /*
  302. * Now free the memory - free_area_init_node needs
  303. * the sparse mem_map arrays initialized by sparse_init()
  304. * for memmap_init_zone(), otherwise all PFNs are invalid.
  305. */
  306. zone_sizes_init(min, max_low, max_high);
  307. /*
  308. * This doesn't seem to be used by the Linux memory manager any
  309. * more, but is used by ll_rw_block. If we can get rid of it, we
  310. * also get rid of some of the stuff above as well.
  311. */
  312. min_low_pfn = min;
  313. max_low_pfn = max_low;
  314. max_pfn = max_high;
  315. }
  316. /*
  317. * Poison init memory with an undefined instruction (ARM) or a branch to an
  318. * undefined instruction (Thumb).
  319. */
  320. static inline void poison_init_mem(void *s, size_t count)
  321. {
  322. u32 *p = (u32 *)s;
  323. for (; count != 0; count -= 4)
  324. *p++ = 0xe7fddef0;
  325. }
  326. static inline void
  327. free_memmap(unsigned long start_pfn, unsigned long end_pfn)
  328. {
  329. struct page *start_pg, *end_pg;
  330. phys_addr_t pg, pgend;
  331. /*
  332. * Convert start_pfn/end_pfn to a struct page pointer.
  333. */
  334. start_pg = pfn_to_page(start_pfn - 1) + 1;
  335. end_pg = pfn_to_page(end_pfn - 1) + 1;
  336. /*
  337. * Convert to physical addresses, and
  338. * round start upwards and end downwards.
  339. */
  340. pg = PAGE_ALIGN(__pa(start_pg));
  341. pgend = __pa(end_pg) & PAGE_MASK;
  342. /*
  343. * If there are free pages between these,
  344. * free the section of the memmap array.
  345. */
  346. if (pg < pgend)
  347. memblock_free_early(pg, pgend - pg);
  348. }
  349. /*
  350. * The mem_map array can get very big. Free the unused area of the memory map.
  351. */
  352. static void __init free_unused_memmap(struct meminfo *mi)
  353. {
  354. unsigned long bank_start, prev_bank_end = 0;
  355. unsigned int i;
  356. /*
  357. * This relies on each bank being in address order.
  358. * The banks are sorted previously in bootmem_init().
  359. */
  360. for_each_bank(i, mi) {
  361. struct membank *bank = &mi->bank[i];
  362. bank_start = bank_pfn_start(bank);
  363. #ifdef CONFIG_SPARSEMEM
  364. /*
  365. * Take care not to free memmap entries that don't exist
  366. * due to SPARSEMEM sections which aren't present.
  367. */
  368. bank_start = min(bank_start,
  369. ALIGN(prev_bank_end, PAGES_PER_SECTION));
  370. #else
  371. /*
  372. * Align down here since the VM subsystem insists that the
  373. * memmap entries are valid from the bank start aligned to
  374. * MAX_ORDER_NR_PAGES.
  375. */
  376. bank_start = round_down(bank_start, MAX_ORDER_NR_PAGES);
  377. #endif
  378. /*
  379. * If we had a previous bank, and there is a space
  380. * between the current bank and the previous, free it.
  381. */
  382. if (prev_bank_end && prev_bank_end < bank_start)
  383. free_memmap(prev_bank_end, bank_start);
  384. /*
  385. * Align up here since the VM subsystem insists that the
  386. * memmap entries are valid from the bank end aligned to
  387. * MAX_ORDER_NR_PAGES.
  388. */
  389. prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES);
  390. }
  391. #ifdef CONFIG_SPARSEMEM
  392. if (!IS_ALIGNED(prev_bank_end, PAGES_PER_SECTION))
  393. free_memmap(prev_bank_end,
  394. ALIGN(prev_bank_end, PAGES_PER_SECTION));
  395. #endif
  396. }
  397. #ifdef CONFIG_HIGHMEM
  398. static inline void free_area_high(unsigned long pfn, unsigned long end)
  399. {
  400. for (; pfn < end; pfn++)
  401. free_highmem_page(pfn_to_page(pfn));
  402. }
  403. #endif
  404. static void __init free_highpages(void)
  405. {
  406. #ifdef CONFIG_HIGHMEM
  407. unsigned long max_low = max_low_pfn;
  408. struct memblock_region *mem, *res;
  409. /* set highmem page free */
  410. for_each_memblock(memory, mem) {
  411. unsigned long start = memblock_region_memory_base_pfn(mem);
  412. unsigned long end = memblock_region_memory_end_pfn(mem);
  413. /* Ignore complete lowmem entries */
  414. if (end <= max_low)
  415. continue;
  416. /* Truncate partial highmem entries */
  417. if (start < max_low)
  418. start = max_low;
  419. /* Find and exclude any reserved regions */
  420. for_each_memblock(reserved, res) {
  421. unsigned long res_start, res_end;
  422. res_start = memblock_region_reserved_base_pfn(res);
  423. res_end = memblock_region_reserved_end_pfn(res);
  424. if (res_end < start)
  425. continue;
  426. if (res_start < start)
  427. res_start = start;
  428. if (res_start > end)
  429. res_start = end;
  430. if (res_end > end)
  431. res_end = end;
  432. if (res_start != start)
  433. free_area_high(start, res_start);
  434. start = res_end;
  435. if (start == end)
  436. break;
  437. }
  438. /* And now free anything which remains */
  439. if (start < end)
  440. free_area_high(start, end);
  441. }
  442. #endif
  443. }
  444. /*
  445. * mem_init() marks the free areas in the mem_map and tells us how much
  446. * memory is free. This is done after various parts of the system have
  447. * claimed their memory after the kernel image.
  448. */
  449. void __init mem_init(void)
  450. {
  451. #ifdef CONFIG_HAVE_TCM
  452. /* These pointers are filled in on TCM detection */
  453. extern u32 dtcm_end;
  454. extern u32 itcm_end;
  455. #endif
  456. set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
  457. /* this will put all unused low memory onto the freelists */
  458. free_unused_memmap(&meminfo);
  459. free_all_bootmem();
  460. #ifdef CONFIG_SA1111
  461. /* now that our DMA memory is actually so designated, we can free it */
  462. free_reserved_area(__va(PHYS_OFFSET), swapper_pg_dir, -1, NULL);
  463. #endif
  464. free_highpages();
  465. mem_init_print_info(NULL);
  466. #define MLK(b, t) b, t, ((t) - (b)) >> 10
  467. #define MLM(b, t) b, t, ((t) - (b)) >> 20
  468. #define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K)
  469. printk(KERN_NOTICE "Virtual kernel memory layout:\n"
  470. " vector : 0x%08lx - 0x%08lx (%4ld kB)\n"
  471. #ifdef CONFIG_HAVE_TCM
  472. " DTCM : 0x%08lx - 0x%08lx (%4ld kB)\n"
  473. " ITCM : 0x%08lx - 0x%08lx (%4ld kB)\n"
  474. #endif
  475. " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
  476. " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
  477. " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
  478. #ifdef CONFIG_HIGHMEM
  479. " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n"
  480. #endif
  481. #ifdef CONFIG_MODULES
  482. " modules : 0x%08lx - 0x%08lx (%4ld MB)\n"
  483. #endif
  484. " .text : 0x%p" " - 0x%p" " (%4d kB)\n"
  485. " .init : 0x%p" " - 0x%p" " (%4d kB)\n"
  486. " .data : 0x%p" " - 0x%p" " (%4d kB)\n"
  487. " .bss : 0x%p" " - 0x%p" " (%4d kB)\n",
  488. MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) +
  489. (PAGE_SIZE)),
  490. #ifdef CONFIG_HAVE_TCM
  491. MLK(DTCM_OFFSET, (unsigned long) dtcm_end),
  492. MLK(ITCM_OFFSET, (unsigned long) itcm_end),
  493. #endif
  494. MLK(FIXADDR_START, FIXADDR_TOP),
  495. MLM(VMALLOC_START, VMALLOC_END),
  496. MLM(PAGE_OFFSET, (unsigned long)high_memory),
  497. #ifdef CONFIG_HIGHMEM
  498. MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP) *
  499. (PAGE_SIZE)),
  500. #endif
  501. #ifdef CONFIG_MODULES
  502. MLM(MODULES_VADDR, MODULES_END),
  503. #endif
  504. MLK_ROUNDUP(_text, _etext),
  505. MLK_ROUNDUP(__init_begin, __init_end),
  506. MLK_ROUNDUP(_sdata, _edata),
  507. MLK_ROUNDUP(__bss_start, __bss_stop));
  508. #undef MLK
  509. #undef MLM
  510. #undef MLK_ROUNDUP
  511. /*
  512. * Check boundaries twice: Some fundamental inconsistencies can
  513. * be detected at build time already.
  514. */
  515. #ifdef CONFIG_MMU
  516. BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
  517. BUG_ON(TASK_SIZE > MODULES_VADDR);
  518. #endif
  519. #ifdef CONFIG_HIGHMEM
  520. BUILD_BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET);
  521. BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET);
  522. #endif
  523. if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) {
  524. extern int sysctl_overcommit_memory;
  525. /*
  526. * On a machine this small we won't get
  527. * anywhere without overcommit, so turn
  528. * it on by default.
  529. */
  530. sysctl_overcommit_memory = OVERCOMMIT_ALWAYS;
  531. }
  532. }
  533. void free_initmem(void)
  534. {
  535. #ifdef CONFIG_HAVE_TCM
  536. extern char __tcm_start, __tcm_end;
  537. poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start);
  538. free_reserved_area(&__tcm_start, &__tcm_end, -1, "TCM link");
  539. #endif
  540. poison_init_mem(__init_begin, __init_end - __init_begin);
  541. if (!machine_is_integrator() && !machine_is_cintegrator())
  542. free_initmem_default(-1);
  543. }
  544. #ifdef CONFIG_BLK_DEV_INITRD
  545. static int keep_initrd;
  546. void free_initrd_mem(unsigned long start, unsigned long end)
  547. {
  548. if (!keep_initrd) {
  549. poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
  550. free_reserved_area((void *)start, (void *)end, -1, "initrd");
  551. }
  552. }
  553. static int __init keepinitrd_setup(char *__unused)
  554. {
  555. keep_initrd = 1;
  556. return 1;
  557. }
  558. __setup("keepinitrd", keepinitrd_setup);
  559. #endif