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.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 241c24a1c18f..285894171186 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;
@@ -869,9 +870,10 @@ void __init reserve_node_zero(pg_data_t *pgdat)
869 if (machine_is_p720t()) 870 if (machine_is_p720t())
870 res_size = 0x00014000; 871 res_size = 0x00014000;
871 872
872 /* H1940 and RX3715 need to reserve this for suspend */ 873 /* H1940, RX3715 and RX1950 need to reserve this for suspend */
873 874
874 if (machine_is_h1940() || machine_is_rx3715()) { 875 if (machine_is_h1940() || machine_is_rx3715()
876 || machine_is_rx1950()) {
875 reserve_bootmem_node(pgdat, 0x30003000, 0x1000, 877 reserve_bootmem_node(pgdat, 0x30003000, 0x1000,
876 BOOTMEM_DEFAULT); 878 BOOTMEM_DEFAULT);
877 reserve_bootmem_node(pgdat, 0x30081000, 0x1000, 879 reserve_bootmem_node(pgdat, 0x30081000, 0x1000,
@@ -1017,6 +1019,39 @@ static void __init kmap_init(void)
1017#endif 1019#endif
1018} 1020}
1019 1021
1022static inline void map_memory_bank(struct membank *bank)
1023{
1024 struct map_desc map;
1025
1026 map.pfn = bank_pfn_start(bank);
1027 map.virtual = __phys_to_virt(bank_phys_start(bank));
1028 map.length = bank_phys_size(bank);
1029 map.type = MT_MEMORY;
1030
1031 create_mapping(&map);
1032}
1033
1034static void __init map_lowmem(void)
1035{
1036 struct meminfo *mi = &meminfo;
1037 int i;
1038
1039 /* Map all the lowmem memory banks. */
1040 for (i = 0; i < mi->nr_banks; i++) {
1041 struct membank *bank = &mi->bank[i];
1042
1043 if (!bank->highmem)
1044 map_memory_bank(bank);
1045 }
1046}
1047
1048static int __init meminfo_cmp(const void *_a, const void *_b)
1049{
1050 const struct membank *a = _a, *b = _b;
1051 long cmp = bank_pfn_start(a) - bank_pfn_start(b);
1052 return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
1053}
1054
1020/* 1055/*
1021 * paging_init() sets up the page tables, initialises the zone memory 1056 * 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. 1057 * maps, and sets up the zero page, bad page and bad page tables.
@@ -1025,9 +1060,12 @@ void __init paging_init(struct machine_desc *mdesc)
1025{ 1060{
1026 void *zero_page; 1061 void *zero_page;
1027 1062
1063 sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
1064
1028 build_mem_type_table(); 1065 build_mem_type_table();
1029 sanity_check_meminfo(); 1066 sanity_check_meminfo();
1030 prepare_page_table(); 1067 prepare_page_table();
1068 map_lowmem();
1031 bootmem_init(); 1069 bootmem_init();
1032 devicemaps_init(mdesc); 1070 devicemaps_init(mdesc);
1033 kmap_init(); 1071 kmap_init();