aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mm/init.c')
-rw-r--r--arch/arm/mm/init.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c19571c40a21..e5ab4362322f 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -212,6 +212,14 @@ static void __init arm_bootmem_init(unsigned long start_pfn,
212} 212}
213 213
214#ifdef CONFIG_ZONE_DMA 214#ifdef CONFIG_ZONE_DMA
215/*
216 * The DMA mask corresponding to the maximum bus address allocatable
217 * using GFP_DMA. The default here places no restriction on DMA
218 * allocations. This must be the smallest DMA mask in the system,
219 * so a successful GFP_DMA allocation will always satisfy this.
220 */
221u32 arm_dma_limit;
222
215static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole, 223static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole,
216 unsigned long dma_size) 224 unsigned long dma_size)
217{ 225{
@@ -278,6 +286,8 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
278 */ 286 */
279 arm_adjust_dma_zone(zone_size, zhole_size, 287 arm_adjust_dma_zone(zone_size, zhole_size,
280 ARM_DMA_ZONE_SIZE >> PAGE_SHIFT); 288 ARM_DMA_ZONE_SIZE >> PAGE_SHIFT);
289
290 arm_dma_limit = PHYS_OFFSET + ARM_DMA_ZONE_SIZE - 1;
281#endif 291#endif
282 292
283 free_area_init_node(0, zone_size, min, zhole_size); 293 free_area_init_node(0, zone_size, min, zhole_size);
@@ -422,6 +432,17 @@ static inline int free_area(unsigned long pfn, unsigned long end, char *s)
422 return pages; 432 return pages;
423} 433}
424 434
435/*
436 * Poison init memory with an undefined instruction (ARM) or a branch to an
437 * undefined instruction (Thumb).
438 */
439static inline void poison_init_mem(void *s, size_t count)
440{
441 u32 *p = (u32 *)s;
442 while ((count = count - 4))
443 *p++ = 0xe7fddef0;
444}
445
425static inline void 446static inline void
426free_memmap(unsigned long start_pfn, unsigned long end_pfn) 447free_memmap(unsigned long start_pfn, unsigned long end_pfn)
427{ 448{
@@ -639,8 +660,8 @@ void __init mem_init(void)
639 " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n" 660 " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n"
640#endif 661#endif
641 " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" 662 " modules : 0x%08lx - 0x%08lx (%4ld MB)\n"
642 " .init : 0x%p" " - 0x%p" " (%4d kB)\n"
643 " .text : 0x%p" " - 0x%p" " (%4d kB)\n" 663 " .text : 0x%p" " - 0x%p" " (%4d kB)\n"
664 " .init : 0x%p" " - 0x%p" " (%4d kB)\n"
644 " .data : 0x%p" " - 0x%p" " (%4d kB)\n" 665 " .data : 0x%p" " - 0x%p" " (%4d kB)\n"
645 " .bss : 0x%p" " - 0x%p" " (%4d kB)\n", 666 " .bss : 0x%p" " - 0x%p" " (%4d kB)\n",
646 667
@@ -662,8 +683,8 @@ void __init mem_init(void)
662#endif 683#endif
663 MLM(MODULES_VADDR, MODULES_END), 684 MLM(MODULES_VADDR, MODULES_END),
664 685
665 MLK_ROUNDUP(__init_begin, __init_end),
666 MLK_ROUNDUP(_text, _etext), 686 MLK_ROUNDUP(_text, _etext),
687 MLK_ROUNDUP(__init_begin, __init_end),
667 MLK_ROUNDUP(_sdata, _edata), 688 MLK_ROUNDUP(_sdata, _edata),
668 MLK_ROUNDUP(__bss_start, __bss_stop)); 689 MLK_ROUNDUP(__bss_start, __bss_stop));
669 690
@@ -704,11 +725,13 @@ void free_initmem(void)
704#ifdef CONFIG_HAVE_TCM 725#ifdef CONFIG_HAVE_TCM
705 extern char __tcm_start, __tcm_end; 726 extern char __tcm_start, __tcm_end;
706 727
728 poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start);
707 totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)), 729 totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)),
708 __phys_to_pfn(__pa(&__tcm_end)), 730 __phys_to_pfn(__pa(&__tcm_end)),
709 "TCM link"); 731 "TCM link");
710#endif 732#endif
711 733
734 poison_init_mem(__init_begin, __init_end - __init_begin);
712 if (!machine_is_integrator() && !machine_is_cintegrator()) 735 if (!machine_is_integrator() && !machine_is_cintegrator())
713 totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), 736 totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)),
714 __phys_to_pfn(__pa(__init_end)), 737 __phys_to_pfn(__pa(__init_end)),
@@ -721,10 +744,12 @@ static int keep_initrd;
721 744
722void free_initrd_mem(unsigned long start, unsigned long end) 745void free_initrd_mem(unsigned long start, unsigned long end)
723{ 746{
724 if (!keep_initrd) 747 if (!keep_initrd) {
748 poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
725 totalram_pages += free_area(__phys_to_pfn(__pa(start)), 749 totalram_pages += free_area(__phys_to_pfn(__pa(start)),
726 __phys_to_pfn(__pa(end)), 750 __phys_to_pfn(__pa(end)),
727 "initrd"); 751 "initrd");
752 }
728} 753}
729 754
730static int __init keepinitrd_setup(char *__unused) 755static int __init keepinitrd_setup(char *__unused)