static inline void prepare_page_table(void)
{
unsigned long addr;
- phys_addr_t end;
/*
* Clear out all the mappings below the kernel image.
for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE)
pmd_clear(pmd_off_k(addr));
- /*
- * Find the end of the first block of lowmem. This is complicated
- * when we use memblock.
- */
- end = memblock.memory.region[0].base + memblock.memory.region[0].size;
- if (end >= lowmem_end_addr)
- end = lowmem_end_addr;
-
/*
* Clear out all the kernel space mappings, except for the first
* memory bank, up to the end of the vmalloc region.
*/
- for (addr = __phys_to_virt(end);
+ for (addr = __phys_to_virt(bank_phys_end(&meminfo.bank[0]));
addr < VMALLOC_END; addr += PGDIR_SIZE)
pmd_clear(pmd_off_k(addr));
}
#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 < memblock.memory.cnt; i++) {
- phys_addr_t start = memblock.memory.region[i].base;
- phys_addr_t end = start + memblock.memory.region[i].size;
- struct map_desc map;
-
- if (end >= lowmem_end_addr)
- end = lowmem_end_addr;
- if (start >= end)
- break;
-
- map.pfn = __phys_to_pfn(start);
- map.virtual = __phys_to_virt(start);
- map.length = end - start;
- map.type = MT_MEMORY;
+ for (i = 0; i < mi->nr_banks; i++) {
+ struct membank *bank = &mi->bank[i];
- create_mapping(&map);
+ if (!bank->highmem)
+ map_memory_bank(bank);
}
}