Commit a2227120 authored by Russell King's avatar Russell King

ARM: Move memory mapping into mmu.c

Acked-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent ceb683d3
...@@ -225,20 +225,6 @@ static int __init check_initrd(struct meminfo *mi) ...@@ -225,20 +225,6 @@ static int __init check_initrd(struct meminfo *mi)
return initrd_node; return initrd_node;
} }
static inline void map_memory_bank(struct membank *bank)
{
#ifdef CONFIG_MMU
struct map_desc map;
map.pfn = bank_pfn_start(bank);
map.virtual = __phys_to_virt(bank_phys_start(bank));
map.length = bank_phys_size(bank);
map.type = MT_MEMORY;
create_mapping(&map);
#endif
}
static void __init bootmem_init_node(int node, struct meminfo *mi, static void __init bootmem_init_node(int node, struct meminfo *mi,
unsigned long start_pfn, unsigned long end_pfn) unsigned long start_pfn, unsigned long end_pfn)
{ {
...@@ -247,16 +233,6 @@ static void __init bootmem_init_node(int node, struct meminfo *mi, ...@@ -247,16 +233,6 @@ static void __init bootmem_init_node(int node, struct meminfo *mi,
pg_data_t *pgdat; pg_data_t *pgdat;
int i; int i;
/*
* Map the memory banks for this node.
*/
for_each_nodebank(i, mi, node) {
struct membank *bank = &mi->bank[i];
if (!bank->highmem)
map_memory_bank(bank);
}
/* /*
* Allocate the bootmem bitmap page. * Allocate the bootmem bitmap page.
*/ */
......
...@@ -28,10 +28,7 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page ...@@ -28,10 +28,7 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page
#endif #endif
struct map_desc;
struct meminfo;
struct pglist_data; struct pglist_data;
void __init create_mapping(struct map_desc *md);
void __init bootmem_init(void); void __init bootmem_init(void);
void reserve_node_zero(struct pglist_data *pgdat); void reserve_node_zero(struct pglist_data *pgdat);
...@@ -600,7 +600,7 @@ static void __init create_36bit_mapping(struct map_desc *md, ...@@ -600,7 +600,7 @@ static void __init create_36bit_mapping(struct map_desc *md,
* offsets, and we take full advantage of sections and * offsets, and we take full advantage of sections and
* supersections. * supersections.
*/ */
void __init create_mapping(struct map_desc *md) static void __init create_mapping(struct map_desc *md)
{ {
unsigned long phys, addr, length, end; unsigned long phys, addr, length, end;
const struct mem_type *type; const struct mem_type *type;
...@@ -1014,6 +1014,32 @@ static void __init kmap_init(void) ...@@ -1014,6 +1014,32 @@ static void __init kmap_init(void)
#endif #endif
} }
static inline void map_memory_bank(struct membank *bank)
{
struct map_desc map;
map.pfn = bank_pfn_start(bank);
map.virtual = __phys_to_virt(bank_phys_start(bank));
map.length = bank_phys_size(bank);
map.type = MT_MEMORY;
create_mapping(&map);
}
static void __init map_lowmem(void)
{
struct meminfo *mi = &meminfo;
int i;
/* Map all the lowmem memory banks. */
for (i = 0; i < mi->nr_banks; i++) {
struct membank *bank = &mi->bank[i];
if (!bank->highmem)
map_memory_bank(bank);
}
}
static int __init meminfo_cmp(const void *_a, const void *_b) static int __init meminfo_cmp(const void *_a, const void *_b)
{ {
const struct membank *a = _a, *b = _b; const struct membank *a = _a, *b = _b;
...@@ -1034,6 +1060,7 @@ void __init paging_init(struct machine_desc *mdesc) ...@@ -1034,6 +1060,7 @@ void __init paging_init(struct machine_desc *mdesc)
build_mem_type_table(); build_mem_type_table();
sanity_check_meminfo(); sanity_check_meminfo();
prepare_page_table(); prepare_page_table();
map_lowmem();
bootmem_init(); bootmem_init();
devicemaps_init(mdesc); devicemaps_init(mdesc);
kmap_init(); kmap_init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment