diff options
Diffstat (limited to 'arch/arm/mm/init.c')
-rw-r--r-- | arch/arm/mm/init.c | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index c19571c40a21..2fee782077c1 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -212,6 +212,18 @@ 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 | unsigned long arm_dma_zone_size __read_mostly; | ||
217 | EXPORT_SYMBOL(arm_dma_zone_size); | ||
218 | |||
219 | /* | ||
220 | * The DMA mask corresponding to the maximum bus address allocatable | ||
221 | * using GFP_DMA. The default here places no restriction on DMA | ||
222 | * allocations. This must be the smallest DMA mask in the system, | ||
223 | * so a successful GFP_DMA allocation will always satisfy this. | ||
224 | */ | ||
225 | u32 arm_dma_limit; | ||
226 | |||
215 | static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole, | 227 | static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole, |
216 | unsigned long dma_size) | 228 | unsigned long dma_size) |
217 | { | 229 | { |
@@ -267,17 +279,17 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, | |||
267 | #endif | 279 | #endif |
268 | } | 280 | } |
269 | 281 | ||
270 | #ifdef ARM_DMA_ZONE_SIZE | 282 | #ifdef CONFIG_ZONE_DMA |
271 | #ifndef CONFIG_ZONE_DMA | ||
272 | #error ARM_DMA_ZONE_SIZE set but no DMA zone to limit allocations | ||
273 | #endif | ||
274 | |||
275 | /* | 283 | /* |
276 | * Adjust the sizes according to any special requirements for | 284 | * Adjust the sizes according to any special requirements for |
277 | * this machine type. | 285 | * this machine type. |
278 | */ | 286 | */ |
279 | arm_adjust_dma_zone(zone_size, zhole_size, | 287 | if (arm_dma_zone_size) { |
280 | ARM_DMA_ZONE_SIZE >> PAGE_SHIFT); | 288 | arm_adjust_dma_zone(zone_size, zhole_size, |
289 | arm_dma_zone_size >> PAGE_SHIFT); | ||
290 | arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1; | ||
291 | } else | ||
292 | arm_dma_limit = 0xffffffff; | ||
281 | #endif | 293 | #endif |
282 | 294 | ||
283 | free_area_init_node(0, zone_size, min, zhole_size); | 295 | free_area_init_node(0, zone_size, min, zhole_size); |
@@ -422,6 +434,17 @@ static inline int free_area(unsigned long pfn, unsigned long end, char *s) | |||
422 | return pages; | 434 | return pages; |
423 | } | 435 | } |
424 | 436 | ||
437 | /* | ||
438 | * Poison init memory with an undefined instruction (ARM) or a branch to an | ||
439 | * undefined instruction (Thumb). | ||
440 | */ | ||
441 | static inline void poison_init_mem(void *s, size_t count) | ||
442 | { | ||
443 | u32 *p = (u32 *)s; | ||
444 | while ((count = count - 4)) | ||
445 | *p++ = 0xe7fddef0; | ||
446 | } | ||
447 | |||
425 | static inline void | 448 | static inline void |
426 | free_memmap(unsigned long start_pfn, unsigned long end_pfn) | 449 | free_memmap(unsigned long start_pfn, unsigned long end_pfn) |
427 | { | 450 | { |
@@ -639,8 +662,8 @@ void __init mem_init(void) | |||
639 | " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n" | 662 | " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n" |
640 | #endif | 663 | #endif |
641 | " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" | 664 | " 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" | 665 | " .text : 0x%p" " - 0x%p" " (%4d kB)\n" |
666 | " .init : 0x%p" " - 0x%p" " (%4d kB)\n" | ||
644 | " .data : 0x%p" " - 0x%p" " (%4d kB)\n" | 667 | " .data : 0x%p" " - 0x%p" " (%4d kB)\n" |
645 | " .bss : 0x%p" " - 0x%p" " (%4d kB)\n", | 668 | " .bss : 0x%p" " - 0x%p" " (%4d kB)\n", |
646 | 669 | ||
@@ -662,8 +685,8 @@ void __init mem_init(void) | |||
662 | #endif | 685 | #endif |
663 | MLM(MODULES_VADDR, MODULES_END), | 686 | MLM(MODULES_VADDR, MODULES_END), |
664 | 687 | ||
665 | MLK_ROUNDUP(__init_begin, __init_end), | ||
666 | MLK_ROUNDUP(_text, _etext), | 688 | MLK_ROUNDUP(_text, _etext), |
689 | MLK_ROUNDUP(__init_begin, __init_end), | ||
667 | MLK_ROUNDUP(_sdata, _edata), | 690 | MLK_ROUNDUP(_sdata, _edata), |
668 | MLK_ROUNDUP(__bss_start, __bss_stop)); | 691 | MLK_ROUNDUP(__bss_start, __bss_stop)); |
669 | 692 | ||
@@ -704,11 +727,13 @@ void free_initmem(void) | |||
704 | #ifdef CONFIG_HAVE_TCM | 727 | #ifdef CONFIG_HAVE_TCM |
705 | extern char __tcm_start, __tcm_end; | 728 | extern char __tcm_start, __tcm_end; |
706 | 729 | ||
730 | poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start); | ||
707 | totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)), | 731 | totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)), |
708 | __phys_to_pfn(__pa(&__tcm_end)), | 732 | __phys_to_pfn(__pa(&__tcm_end)), |
709 | "TCM link"); | 733 | "TCM link"); |
710 | #endif | 734 | #endif |
711 | 735 | ||
736 | poison_init_mem(__init_begin, __init_end - __init_begin); | ||
712 | if (!machine_is_integrator() && !machine_is_cintegrator()) | 737 | if (!machine_is_integrator() && !machine_is_cintegrator()) |
713 | totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), | 738 | totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), |
714 | __phys_to_pfn(__pa(__init_end)), | 739 | __phys_to_pfn(__pa(__init_end)), |
@@ -721,10 +746,12 @@ static int keep_initrd; | |||
721 | 746 | ||
722 | void free_initrd_mem(unsigned long start, unsigned long end) | 747 | void free_initrd_mem(unsigned long start, unsigned long end) |
723 | { | 748 | { |
724 | if (!keep_initrd) | 749 | if (!keep_initrd) { |
750 | poison_init_mem((void *)start, PAGE_ALIGN(end) - start); | ||
725 | totalram_pages += free_area(__phys_to_pfn(__pa(start)), | 751 | totalram_pages += free_area(__phys_to_pfn(__pa(start)), |
726 | __phys_to_pfn(__pa(end)), | 752 | __phys_to_pfn(__pa(end)), |
727 | "initrd"); | 753 | "initrd"); |
754 | } | ||
728 | } | 755 | } |
729 | 756 | ||
730 | static int __init keepinitrd_setup(char *__unused) | 757 | static int __init keepinitrd_setup(char *__unused) |