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 9d4da6ac28eb..69852003675f 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>
@@ -599,7 +600,7 @@ static void __init create_36bit_mapping(struct map_desc *md,
599 * offsets, and we take full advantage of sections and 600 * offsets, and we take full advantage of sections and
600 * supersections. 601 * supersections.
601 */ 602 */
602void __init create_mapping(struct map_desc *md) 603static void __init create_mapping(struct map_desc *md)
603{ 604{
604 unsigned long phys, addr, length, end; 605 unsigned long phys, addr, length, end;
605 const struct mem_type *type; 606 const struct mem_type *type;
@@ -1013,6 +1014,39 @@ static void __init kmap_init(void)
1013#endif 1014#endif
1014} 1015}
1015 1016
1017static inline void map_memory_bank(struct membank *bank)
1018{
1019 struct map_desc map;
1020
1021 map.pfn = bank_pfn_start(bank);
1022 map.virtual = __phys_to_virt(bank_phys_start(bank));
1023 map.length = bank_phys_size(bank);
1024 map.type = MT_MEMORY;
1025
1026 create_mapping(&map);
1027}
1028
1029static void __init map_lowmem(void)
1030{
1031 struct meminfo *mi = &meminfo;
1032 int i;
1033
1034 /* Map all the lowmem memory banks. */
1035 for (i = 0; i < mi->nr_banks; i++) {
1036 struct membank *bank = &mi->bank[i];
1037
1038 if (!bank->highmem)
1039 map_memory_bank(bank);
1040 }
1041}
1042
1043static int __init meminfo_cmp(const void *_a, const void *_b)
1044{
1045 const struct membank *a = _a, *b = _b;
1046 long cmp = bank_pfn_start(a) - bank_pfn_start(b);
1047 return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
1048}
1049
1016/* 1050/*
1017 * paging_init() sets up the page tables, initialises the zone memory 1051 * paging_init() sets up the page tables, initialises the zone memory
1018 * maps, and sets up the zero page, bad page and bad page tables. 1052 * maps, and sets up the zero page, bad page and bad page tables.
@@ -1021,9 +1055,12 @@ void __init paging_init(struct machine_desc *mdesc)
1021{ 1055{
1022 void *zero_page; 1056 void *zero_page;
1023 1057
1058 sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
1059
1024 build_mem_type_table(); 1060 build_mem_type_table();
1025 sanity_check_meminfo(); 1061 sanity_check_meminfo();
1026 prepare_page_table(); 1062 prepare_page_table();
1063 map_lowmem();
1027 bootmem_init(); 1064 bootmem_init();
1028 devicemaps_init(mdesc); 1065 devicemaps_init(mdesc);
1029 kmap_init(); 1066 kmap_init();