init.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  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/nodemask.h>
  17. #include <linux/initrd.h>
  18. #include <linux/highmem.h>
  19. #include <linux/gfp.h>
  20. #include <linux/memblock.h>
  21. #include <linux/sort.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/sections.h>
  24. #include <asm/setup.h>
  25. #include <asm/sizes.h>
  26. #include <asm/tlb.h>
  27. #include <asm/fixmap.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/map.h>
  30. #include "mm.h"
  31. static unsigned long phys_initrd_start __initdata = 0;
  32. static unsigned long phys_initrd_size __initdata = 0;
  33. static int __init early_initrd(char *p)
  34. {
  35. unsigned long start, size;
  36. char *endp;
  37. start = memparse(p, &endp);
  38. if (*endp == ',') {
  39. size = memparse(endp + 1, NULL);
  40. phys_initrd_start = start;
  41. phys_initrd_size = size;
  42. }
  43. return 0;
  44. }
  45. early_param("initrd", early_initrd);
  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. __tagtable(ATAG_INITRD, parse_tag_initrd);
  55. static int __init parse_tag_initrd2(const struct tag *tag)
  56. {
  57. phys_initrd_start = tag->u.initrd.start;
  58. phys_initrd_size = tag->u.initrd.size;
  59. return 0;
  60. }
  61. __tagtable(ATAG_INITRD2, parse_tag_initrd2);
  62. /*
  63. * This keeps memory configuration data used by a couple memory
  64. * initialization functions, as well as show_mem() for the skipping
  65. * of holes in the memory map. It is populated by arm_add_memory().
  66. */
  67. struct meminfo meminfo;
  68. void show_mem(void)
  69. {
  70. int free = 0, total = 0, reserved = 0;
  71. int shared = 0, cached = 0, slab = 0, i;
  72. struct meminfo * mi = &meminfo;
  73. printk("Mem-info:\n");
  74. show_free_areas();
  75. for_each_bank (i, mi) {
  76. struct membank *bank = &mi->bank[i];
  77. unsigned int pfn1, pfn2;
  78. struct page *page, *end;
  79. pfn1 = bank_pfn_start(bank);
  80. pfn2 = bank_pfn_end(bank);
  81. page = pfn_to_page(pfn1);
  82. end = pfn_to_page(pfn2 - 1) + 1;
  83. do {
  84. total++;
  85. if (PageReserved(page))
  86. reserved++;
  87. else if (PageSwapCache(page))
  88. cached++;
  89. else if (PageSlab(page))
  90. slab++;
  91. else if (!page_count(page))
  92. free++;
  93. else
  94. shared += page_count(page) - 1;
  95. page++;
  96. } while (page < end);
  97. }
  98. printk("%d pages of RAM\n", total);
  99. printk("%d free pages\n", free);
  100. printk("%d reserved pages\n", reserved);
  101. printk("%d slab pages\n", slab);
  102. printk("%d pages shared\n", shared);
  103. printk("%d pages swap cached\n", cached);
  104. }
  105. static void __init find_limits(struct meminfo *mi,
  106. unsigned long *min, unsigned long *max_low, unsigned long *max_high)
  107. {
  108. int i;
  109. *min = -1UL;
  110. *max_low = *max_high = 0;
  111. for_each_bank (i, mi) {
  112. struct membank *bank = &mi->bank[i];
  113. unsigned long start, end;
  114. start = bank_pfn_start(bank);
  115. end = bank_pfn_end(bank);
  116. if (*min > start)
  117. *min = start;
  118. if (*max_high < end)
  119. *max_high = end;
  120. if (bank->highmem)
  121. continue;
  122. if (*max_low < end)
  123. *max_low = end;
  124. }
  125. }
  126. static void __init arm_bootmem_init(unsigned long start_pfn,
  127. unsigned long end_pfn)
  128. {
  129. struct memblock_region *reg;
  130. unsigned int boot_pages;
  131. phys_addr_t bitmap;
  132. pg_data_t *pgdat;
  133. /*
  134. * Allocate the bootmem bitmap page. This must be in a region
  135. * of memory which has already been mapped.
  136. */
  137. boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
  138. bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES,
  139. __pfn_to_phys(end_pfn));
  140. /*
  141. * Initialise the bootmem allocator, handing the
  142. * memory banks over to bootmem.
  143. */
  144. node_set_online(0);
  145. pgdat = NODE_DATA(0);
  146. init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn);
  147. /* Free the lowmem regions from memblock into bootmem. */
  148. for_each_memblock(memory, reg) {
  149. unsigned long start = memblock_region_memory_base_pfn(reg);
  150. unsigned long end = memblock_region_memory_end_pfn(reg);
  151. if (end >= end_pfn)
  152. end = end_pfn;
  153. if (start >= end)
  154. break;
  155. free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT);
  156. }
  157. /* Reserve the lowmem memblock reserved regions in bootmem. */
  158. for_each_memblock(reserved, reg) {
  159. unsigned long start = memblock_region_reserved_base_pfn(reg);
  160. unsigned long end = memblock_region_reserved_end_pfn(reg);
  161. if (end >= end_pfn)
  162. end = end_pfn;
  163. if (start >= end)
  164. break;
  165. reserve_bootmem(__pfn_to_phys(start),
  166. (end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT);
  167. }
  168. }
  169. static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
  170. unsigned long max_high)
  171. {
  172. unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
  173. struct memblock_region *reg;
  174. /*
  175. * initialise the zones.
  176. */
  177. memset(zone_size, 0, sizeof(zone_size));
  178. /*
  179. * The memory size has already been determined. If we need
  180. * to do anything fancy with the allocation of this memory
  181. * to the zones, now is the time to do it.
  182. */
  183. zone_size[0] = max_low - min;
  184. #ifdef CONFIG_HIGHMEM
  185. zone_size[ZONE_HIGHMEM] = max_high - max_low;
  186. #endif
  187. /*
  188. * Calculate the size of the holes.
  189. * holes = node_size - sum(bank_sizes)
  190. */
  191. memcpy(zhole_size, zone_size, sizeof(zhole_size));
  192. for_each_memblock(memory, reg) {
  193. unsigned long start = memblock_region_memory_base_pfn(reg);
  194. unsigned long end = memblock_region_memory_end_pfn(reg);
  195. if (start < max_low) {
  196. unsigned long low_end = min(end, max_low);
  197. zhole_size[0] -= low_end - start;
  198. }
  199. #ifdef CONFIG_HIGHMEM
  200. if (end > max_low) {
  201. unsigned long high_start = max(start, max_low);
  202. zhole_size[ZONE_HIGHMEM] -= end - high_start;
  203. }
  204. #endif
  205. }
  206. /*
  207. * Adjust the sizes according to any special requirements for
  208. * this machine type.
  209. */
  210. arch_adjust_zones(zone_size, zhole_size);
  211. free_area_init_node(0, zone_size, min, zhole_size);
  212. }
  213. #ifndef CONFIG_SPARSEMEM
  214. int pfn_valid(unsigned long pfn)
  215. {
  216. return memblock_is_memory(pfn << PAGE_SHIFT);
  217. }
  218. EXPORT_SYMBOL(pfn_valid);
  219. static void arm_memory_present(void)
  220. {
  221. }
  222. #else
  223. static void arm_memory_present(void)
  224. {
  225. struct memblock_region *reg;
  226. for_each_memblock(memory, reg)
  227. memory_present(0, memblock_region_memory_base_pfn(reg),
  228. memblock_region_memory_end_pfn(reg));
  229. }
  230. #endif
  231. static int __init meminfo_cmp(const void *_a, const void *_b)
  232. {
  233. const struct membank *a = _a, *b = _b;
  234. long cmp = bank_pfn_start(a) - bank_pfn_start(b);
  235. return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
  236. }
  237. void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
  238. {
  239. int i;
  240. sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
  241. memblock_init();
  242. for (i = 0; i < mi->nr_banks; i++)
  243. memblock_add(mi->bank[i].start, mi->bank[i].size);
  244. /* Register the kernel text, kernel data and initrd with memblock. */
  245. #ifdef CONFIG_XIP_KERNEL
  246. memblock_reserve(__pa(_sdata), _end - _sdata);
  247. #else
  248. memblock_reserve(__pa(_stext), _end - _stext);
  249. #endif
  250. #ifdef CONFIG_BLK_DEV_INITRD
  251. if (phys_initrd_size) {
  252. memblock_reserve(phys_initrd_start, phys_initrd_size);
  253. /* Now convert initrd to virtual addresses */
  254. initrd_start = __phys_to_virt(phys_initrd_start);
  255. initrd_end = initrd_start + phys_initrd_size;
  256. }
  257. #endif
  258. arm_mm_memblock_reserve();
  259. /* reserve any platform specific memblock areas */
  260. if (mdesc->reserve)
  261. mdesc->reserve();
  262. memblock_analyze();
  263. memblock_dump_all();
  264. }
  265. void __init bootmem_init(void)
  266. {
  267. struct meminfo *mi = &meminfo;
  268. unsigned long min, max_low, max_high;
  269. max_low = max_high = 0;
  270. find_limits(mi, &min, &max_low, &max_high);
  271. arm_bootmem_init(min, max_low);
  272. /*
  273. * Sparsemem tries to allocate bootmem in memory_present(),
  274. * so must be done after the fixed reservations
  275. */
  276. arm_memory_present();
  277. /*
  278. * sparse_init() needs the bootmem allocator up and running.
  279. */
  280. sparse_init();
  281. /*
  282. * Now free the memory - free_area_init_node needs
  283. * the sparse mem_map arrays initialized by sparse_init()
  284. * for memmap_init_zone(), otherwise all PFNs are invalid.
  285. */
  286. arm_bootmem_free(min, max_low, max_high);
  287. high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1;
  288. /*
  289. * This doesn't seem to be used by the Linux memory manager any
  290. * more, but is used by ll_rw_block. If we can get rid of it, we
  291. * also get rid of some of the stuff above as well.
  292. *
  293. * Note: max_low_pfn and max_pfn reflect the number of _pages_ in
  294. * the system, not the maximum PFN.
  295. */
  296. max_low_pfn = max_low - PHYS_PFN_OFFSET;
  297. max_pfn = max_high - PHYS_PFN_OFFSET;
  298. }
  299. static inline int free_area(unsigned long pfn, unsigned long end, char *s)
  300. {
  301. unsigned int pages = 0, size = (end - pfn) << (PAGE_SHIFT - 10);
  302. for (; pfn < end; pfn++) {
  303. struct page *page = pfn_to_page(pfn);
  304. ClearPageReserved(page);
  305. init_page_count(page);
  306. __free_page(page);
  307. pages++;
  308. }
  309. if (size && s)
  310. printk(KERN_INFO "Freeing %s memory: %dK\n", s, size);
  311. return pages;
  312. }
  313. static inline void
  314. free_memmap(unsigned long start_pfn, unsigned long end_pfn)
  315. {
  316. struct page *start_pg, *end_pg;
  317. unsigned long pg, pgend;
  318. /*
  319. * Convert start_pfn/end_pfn to a struct page pointer.
  320. */
  321. start_pg = pfn_to_page(start_pfn - 1) + 1;
  322. end_pg = pfn_to_page(end_pfn);
  323. /*
  324. * Convert to physical addresses, and
  325. * round start upwards and end downwards.
  326. */
  327. pg = PAGE_ALIGN(__pa(start_pg));
  328. pgend = __pa(end_pg) & PAGE_MASK;
  329. /*
  330. * If there are free pages between these,
  331. * free the section of the memmap array.
  332. */
  333. if (pg < pgend)
  334. free_bootmem(pg, pgend - pg);
  335. }
  336. /*
  337. * The mem_map array can get very big. Free the unused area of the memory map.
  338. */
  339. static void __init free_unused_memmap(struct meminfo *mi)
  340. {
  341. unsigned long bank_start, prev_bank_end = 0;
  342. unsigned int i;
  343. /*
  344. * This relies on each bank being in address order.
  345. * The banks are sorted previously in bootmem_init().
  346. */
  347. for_each_bank(i, mi) {
  348. struct membank *bank = &mi->bank[i];
  349. bank_start = bank_pfn_start(bank);
  350. /*
  351. * If we had a previous bank, and there is a space
  352. * between the current bank and the previous, free it.
  353. */
  354. if (prev_bank_end && prev_bank_end < bank_start)
  355. free_memmap(prev_bank_end, bank_start);
  356. /*
  357. * Align up here since the VM subsystem insists that the
  358. * memmap entries are valid from the bank end aligned to
  359. * MAX_ORDER_NR_PAGES.
  360. */
  361. prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES);
  362. }
  363. }
  364. static void __init free_highpages(void)
  365. {
  366. #ifdef CONFIG_HIGHMEM
  367. unsigned long max_low = max_low_pfn + PHYS_PFN_OFFSET;
  368. struct memblock_region *mem, *res;
  369. /* set highmem page free */
  370. for_each_memblock(memory, mem) {
  371. unsigned long start = memblock_region_memory_base_pfn(mem);
  372. unsigned long end = memblock_region_memory_end_pfn(mem);
  373. /* Ignore complete lowmem entries */
  374. if (end <= max_low)
  375. continue;
  376. /* Truncate partial highmem entries */
  377. if (start < max_low)
  378. start = max_low;
  379. /* Find and exclude any reserved regions */
  380. for_each_memblock(reserved, res) {
  381. unsigned long res_start, res_end;
  382. res_start = memblock_region_reserved_base_pfn(res);
  383. res_end = memblock_region_reserved_end_pfn(res);
  384. if (res_end < start)
  385. continue;
  386. if (res_start < start)
  387. res_start = start;
  388. if (res_start > end)
  389. res_start = end;
  390. if (res_end > end)
  391. res_end = end;
  392. if (res_start != start)
  393. totalhigh_pages += free_area(start, res_start,
  394. NULL);
  395. start = res_end;
  396. if (start == end)
  397. break;
  398. }
  399. /* And now free anything which remains */
  400. if (start < end)
  401. totalhigh_pages += free_area(start, end, NULL);
  402. }
  403. totalram_pages += totalhigh_pages;
  404. #endif
  405. }
  406. /*
  407. * mem_init() marks the free areas in the mem_map and tells us how much
  408. * memory is free. This is done after various parts of the system have
  409. * claimed their memory after the kernel image.
  410. */
  411. void __init mem_init(void)
  412. {
  413. unsigned long reserved_pages, free_pages;
  414. struct memblock_region *reg;
  415. int i;
  416. #ifdef CONFIG_HAVE_TCM
  417. /* These pointers are filled in on TCM detection */
  418. extern u32 dtcm_end;
  419. extern u32 itcm_end;
  420. #endif
  421. max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
  422. /* this will put all unused low memory onto the freelists */
  423. free_unused_memmap(&meminfo);
  424. totalram_pages += free_all_bootmem();
  425. #ifdef CONFIG_SA1111
  426. /* now that our DMA memory is actually so designated, we can free it */
  427. totalram_pages += free_area(PHYS_PFN_OFFSET,
  428. __phys_to_pfn(__pa(swapper_pg_dir)), NULL);
  429. #endif
  430. free_highpages();
  431. reserved_pages = free_pages = 0;
  432. for_each_bank(i, &meminfo) {
  433. struct membank *bank = &meminfo.bank[i];
  434. unsigned int pfn1, pfn2;
  435. struct page *page, *end;
  436. pfn1 = bank_pfn_start(bank);
  437. pfn2 = bank_pfn_end(bank);
  438. page = pfn_to_page(pfn1);
  439. end = pfn_to_page(pfn2 - 1) + 1;
  440. do {
  441. if (PageReserved(page))
  442. reserved_pages++;
  443. else if (!page_count(page))
  444. free_pages++;
  445. page++;
  446. } while (page < end);
  447. }
  448. /*
  449. * Since our memory may not be contiguous, calculate the
  450. * real number of pages we have in this system
  451. */
  452. printk(KERN_INFO "Memory:");
  453. num_physpages = 0;
  454. for_each_memblock(memory, reg) {
  455. unsigned long pages = memblock_region_memory_end_pfn(reg) -
  456. memblock_region_memory_base_pfn(reg);
  457. num_physpages += pages;
  458. printk(" %ldMB", pages >> (20 - PAGE_SHIFT));
  459. }
  460. printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
  461. printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n",
  462. nr_free_pages() << (PAGE_SHIFT-10),
  463. free_pages << (PAGE_SHIFT-10),
  464. reserved_pages << (PAGE_SHIFT-10),
  465. totalhigh_pages << (PAGE_SHIFT-10));
  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. #ifdef CONFIG_MMU
  477. " DMA : 0x%08lx - 0x%08lx (%4ld MB)\n"
  478. #endif
  479. " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
  480. " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
  481. #ifdef CONFIG_HIGHMEM
  482. " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n"
  483. #endif
  484. " modules : 0x%08lx - 0x%08lx (%4ld MB)\n"
  485. " .init : 0x%p" " - 0x%p" " (%4d kB)\n"
  486. " .text : 0x%p" " - 0x%p" " (%4d kB)\n"
  487. " .data : 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. #ifdef CONFIG_MMU
  496. MLM(CONSISTENT_BASE, CONSISTENT_END),
  497. #endif
  498. MLM(VMALLOC_START, VMALLOC_END),
  499. MLM(PAGE_OFFSET, (unsigned long)high_memory),
  500. #ifdef CONFIG_HIGHMEM
  501. MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP) *
  502. (PAGE_SIZE)),
  503. #endif
  504. MLM(MODULES_VADDR, MODULES_END),
  505. MLK_ROUNDUP(__init_begin, __init_end),
  506. MLK_ROUNDUP(_text, _etext),
  507. MLK_ROUNDUP(_sdata, _edata));
  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(VMALLOC_END > CONSISTENT_BASE);
  517. BUG_ON(VMALLOC_END > CONSISTENT_BASE);
  518. BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
  519. BUG_ON(TASK_SIZE > MODULES_VADDR);
  520. #endif
  521. #ifdef CONFIG_HIGHMEM
  522. BUILD_BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET);
  523. BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET);
  524. #endif
  525. if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
  526. extern int sysctl_overcommit_memory;
  527. /*
  528. * On a machine this small we won't get
  529. * anywhere without overcommit, so turn
  530. * it on by default.
  531. */
  532. sysctl_overcommit_memory = OVERCOMMIT_ALWAYS;
  533. }
  534. }
  535. void free_initmem(void)
  536. {
  537. #ifdef CONFIG_HAVE_TCM
  538. extern char __tcm_start, __tcm_end;
  539. totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)),
  540. __phys_to_pfn(__pa(&__tcm_end)),
  541. "TCM link");
  542. #endif
  543. if (!machine_is_integrator() && !machine_is_cintegrator())
  544. totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)),
  545. __phys_to_pfn(__pa(__init_end)),
  546. "init");
  547. }
  548. #ifdef CONFIG_BLK_DEV_INITRD
  549. static int keep_initrd;
  550. void free_initrd_mem(unsigned long start, unsigned long end)
  551. {
  552. if (!keep_initrd)
  553. totalram_pages += free_area(__phys_to_pfn(__pa(start)),
  554. __phys_to_pfn(__pa(end)),
  555. "initrd");
  556. }
  557. static int __init keepinitrd_setup(char *__unused)
  558. {
  559. keep_initrd = 1;
  560. return 1;
  561. }
  562. __setup("keepinitrd", keepinitrd_setup);
  563. #endif