aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/mm-armv.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-06-27 09:16:47 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-06-27 09:16:47 -0400
commita013053d4965d9a45300938e713a4b512e0257d8 (patch)
treed0a03ece81d34de8df497f23376918ec2472bd1e /arch/arm/mm/mm-armv.c
parenta343e6075a396e07eeff52c0da5629c8fd396be2 (diff)
[PATCH] ARM: Move memmap freeing into init.c
It doesn't make sense for this to be in mm-armv.c now that 26-bit ARM support is no longer integrated into arch/arm. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/mm-armv.c')
-rw-r--r--arch/arm/mm/mm-armv.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
index d79864a0dfa6..052ab443ec4e 100644
--- a/arch/arm/mm/mm-armv.c
+++ b/arch/arm/mm/mm-armv.c
@@ -697,75 +697,3 @@ void __init iotable_init(struct map_desc *io_desc, int nr)
697 for (i = 0; i < nr; i++) 697 for (i = 0; i < nr; i++)
698 create_mapping(io_desc + i); 698 create_mapping(io_desc + i);
699} 699}
700
701static inline void
702free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn)
703{
704 struct page *start_pg, *end_pg;
705 unsigned long pg, pgend;
706
707 /*
708 * Convert start_pfn/end_pfn to a struct page pointer.
709 */
710 start_pg = pfn_to_page(start_pfn);
711 end_pg = pfn_to_page(end_pfn);
712
713 /*
714 * Convert to physical addresses, and
715 * round start upwards and end downwards.
716 */
717 pg = PAGE_ALIGN(__pa(start_pg));
718 pgend = __pa(end_pg) & PAGE_MASK;
719
720 /*
721 * If there are free pages between these,
722 * free the section of the memmap array.
723 */
724 if (pg < pgend)
725 free_bootmem_node(NODE_DATA(node), pg, pgend - pg);
726}
727
728static inline void free_unused_memmap_node(int node, struct meminfo *mi)
729{
730 unsigned long bank_start, prev_bank_end = 0;
731 unsigned int i;
732
733 /*
734 * [FIXME] This relies on each bank being in address order. This
735 * may not be the case, especially if the user has provided the
736 * information on the command line.
737 */
738 for (i = 0; i < mi->nr_banks; i++) {
739 if (mi->bank[i].size == 0 || mi->bank[i].node != node)
740 continue;
741
742 bank_start = mi->bank[i].start >> PAGE_SHIFT;
743 if (bank_start < prev_bank_end) {
744 printk(KERN_ERR "MEM: unordered memory banks. "
745 "Not freeing memmap.\n");
746 break;
747 }
748
749 /*
750 * If we had a previous bank, and there is a space
751 * between the current bank and the previous, free it.
752 */
753 if (prev_bank_end && prev_bank_end != bank_start)
754 free_memmap(node, prev_bank_end, bank_start);
755
756 prev_bank_end = PAGE_ALIGN(mi->bank[i].start +
757 mi->bank[i].size) >> PAGE_SHIFT;
758 }
759}
760
761/*
762 * The mem_map array can get very big. Free
763 * the unused area of the memory map.
764 */
765void __init create_memmap_holes(struct meminfo *mi)
766{
767 int node;
768
769 for_each_online_node(node)
770 free_unused_memmap_node(node, mi);
771}