diff options
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/mmu.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 2d6d682c206a..25d9a11eb617 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -568,6 +568,55 @@ void __init iotable_init(struct map_desc *io_desc, int nr) | |||
568 | create_mapping(io_desc + i); | 568 | create_mapping(io_desc + i); |
569 | } | 569 | } |
570 | 570 | ||
571 | static int __init check_membank_valid(struct membank *mb) | ||
572 | { | ||
573 | /* | ||
574 | * Check whether this memory region has non-zero size. | ||
575 | */ | ||
576 | if (mb->size == 0) | ||
577 | return 0; | ||
578 | |||
579 | /* | ||
580 | * Check whether this memory region would entirely overlap | ||
581 | * the vmalloc area. | ||
582 | */ | ||
583 | if (phys_to_virt(mb->start) >= VMALLOC_MIN) { | ||
584 | printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx " | ||
585 | "(vmalloc region overlap).\n", | ||
586 | mb->start, mb->start + mb->size - 1); | ||
587 | return 0; | ||
588 | } | ||
589 | |||
590 | /* | ||
591 | * Check whether this memory region would partially overlap | ||
592 | * the vmalloc area. | ||
593 | */ | ||
594 | if (phys_to_virt(mb->start + mb->size) < phys_to_virt(mb->start) || | ||
595 | phys_to_virt(mb->start + mb->size) > VMALLOC_MIN) { | ||
596 | unsigned long newsize = VMALLOC_MIN - phys_to_virt(mb->start); | ||
597 | |||
598 | printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx " | ||
599 | "to -%.8lx (vmalloc region overlap).\n", | ||
600 | mb->start, mb->start + mb->size - 1, | ||
601 | mb->start + newsize - 1); | ||
602 | mb->size = newsize; | ||
603 | } | ||
604 | |||
605 | return 1; | ||
606 | } | ||
607 | |||
608 | static void __init sanity_check_meminfo(struct meminfo *mi) | ||
609 | { | ||
610 | int i; | ||
611 | int j; | ||
612 | |||
613 | for (i = 0, j = 0; i < mi->nr_banks; i++) { | ||
614 | if (check_membank_valid(&mi->bank[i])) | ||
615 | mi->bank[j++] = mi->bank[i]; | ||
616 | } | ||
617 | mi->nr_banks = j; | ||
618 | } | ||
619 | |||
571 | static inline void prepare_page_table(struct meminfo *mi) | 620 | static inline void prepare_page_table(struct meminfo *mi) |
572 | { | 621 | { |
573 | unsigned long addr; | 622 | unsigned long addr; |
@@ -753,6 +802,7 @@ void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc) | |||
753 | void *zero_page; | 802 | void *zero_page; |
754 | 803 | ||
755 | build_mem_type_table(); | 804 | build_mem_type_table(); |
805 | sanity_check_meminfo(mi); | ||
756 | prepare_page_table(mi); | 806 | prepare_page_table(mi); |
757 | bootmem_init(mi); | 807 | bootmem_init(mi); |
758 | devicemaps_init(mdesc); | 808 | devicemaps_init(mdesc); |