revert android-tegra-2.6.36-honeycomb-mr1-9001adc to v2.6.36
[firefly-linux-kernel-4.4.55.git] / arch / arm / mm / mmu.c
index 16314854323aac97aa6913b495378b2bee55bc18..cd6ef4facc15a2f6ee97b5b1d681af3761a0439b 100644 (file)
@@ -867,7 +867,6 @@ static void __init sanity_check_meminfo(void)
 static inline void prepare_page_table(void)
 {
        unsigned long addr;
-       phys_addr_t end;
 
        /*
         * Clear out all the mappings below the kernel image.
@@ -882,19 +881,11 @@ static inline void prepare_page_table(void)
        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));
 }
@@ -1011,27 +1002,29 @@ static void __init kmap_init(void)
 #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);
        }
 }