aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/mmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mm/mmu.c')
-rw-r--r--arch/arm/mm/mmu.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 241c24a1c18f..e7113d0b8168 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -14,6 +14,7 @@
14#include <linux/bootmem.h> 14#include <linux/bootmem.h>
15#include <linux/mman.h> 15#include <linux/mman.h>
16#include <linux/nodemask.h> 16#include <linux/nodemask.h>
17#include <linux/sort.h>
17 18
18#include <asm/cputype.h> 19#include <asm/cputype.h>
19#include <asm/mach-types.h> 20#include <asm/mach-types.h>
@@ -603,7 +604,7 @@ static void __init create_36bit_mapping(struct map_desc *md,
603 * offsets, and we take full advantage of sections and 604 * offsets, and we take full advantage of sections and
604 * supersections. 605 * supersections.
605 */ 606 */
606void __init create_mapping(struct map_desc *md) 607static void __init create_mapping(struct map_desc *md)
607{ 608{
608 unsigned long phys, addr, length, end; 609 unsigned long phys, addr, length, end;
609 const struct mem_type *type; 610 const struct mem_type *type;
@@ -1017,6 +1018,39 @@ static void __init kmap_init(void)
1017#endif 1018#endif
1018} 1019}
1019 1020
1021static inline void map_memory_bank(struct membank *bank)
1022{
1023 struct map_desc map;
1024
1025 map.pfn = bank_pfn_start(bank);
1026 map.virtual = __phys_to_virt(bank_phys_start(bank));
1027 map.length = bank_phys_size(bank);
1028 map.type = MT_MEMORY;
1029
1030 create_mapping(&map);
1031}
1032
1033static void __init map_lowmem(void)
1034{
1035 struct meminfo *mi = &meminfo;
1036 int i;
1037
1038 /* Map all the lowmem memory banks. */
1039 for (i = 0; i < mi->nr_banks; i++) {
1040 struct membank *bank = &mi->bank[i];
1041
1042 if (!bank->highmem)
1043 map_memory_bank(bank);
1044 }
1045}
1046
1047static int __init meminfo_cmp(const void *_a, const void *_b)
1048{
1049 const struct membank *a = _a, *b = _b;
1050 long cmp = bank_pfn_start(a) - bank_pfn_start(b);
1051 return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
1052}
1053
1020/* 1054/*
1021 * paging_init() sets up the page tables, initialises the zone memory 1055 * paging_init() sets up the page tables, initialises the zone memory
1022 * maps, and sets up the zero page, bad page and bad page tables. 1056 * maps, and sets up the zero page, bad page and bad page tables.
@@ -1025,9 +1059,12 @@ void __init paging_init(struct machine_desc *mdesc)
1025{ 1059{
1026 void *zero_page; 1060 void *zero_page;
1027 1061
1062 sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
1063
1028 build_mem_type_table(); 1064 build_mem_type_table();
1029 sanity_check_meminfo(); 1065 sanity_check_meminfo();
1030 prepare_page_table(); 1066 prepare_page_table();
1067 map_lowmem();
1031 bootmem_init(); 1068 bootmem_init();
1032 devicemaps_init(mdesc); 1069 devicemaps_init(mdesc);
1033 kmap_init(); 1070 kmap_init();