armv8: mmu: house cleaning

Make setup_pgtages() and get_tcr() available for platform code to
customize MMU tables.
Remove unintentional call of create_table().

Signed-off-by: York Sun <york.sun@nxp.com>
master
York Sun 9 years ago
parent 50e93b9565
commit 252cdb46ee
  1. 13
      arch/arm/cpu/armv8/cache_v8.c
  2. 2
      arch/arm/include/asm/armv8/mmu.h

@ -35,7 +35,7 @@ DECLARE_GLOBAL_DATA_PTR;
* off: FFF * off: FFF
*/ */
static u64 get_tcr(int el, u64 *pips, u64 *pva_bits) u64 get_tcr(int el, u64 *pips, u64 *pva_bits)
{ {
u64 max_addr = 0; u64 max_addr = 0;
u64 ips, va_bits; u64 ips, va_bits;
@ -349,10 +349,13 @@ __weak u64 get_page_table_size(void)
return size; return size;
} }
static void setup_pgtables(void) void setup_pgtables(void)
{ {
int i; int i;
if (!gd->arch.tlb_fillptr || !gd->arch.tlb_addr)
panic("Page table pointer not setup.");
/* /*
* Allocate the first level we're on with invalidate entries. * Allocate the first level we're on with invalidate entries.
* If the starting level is 0 (va_bits >= 39), then this is our * If the starting level is 0 (va_bits >= 39), then this is our
@ -363,9 +366,6 @@ static void setup_pgtables(void)
/* Now add all MMU table entries one after another to the table */ /* Now add all MMU table entries one after another to the table */
for (i = 0; mem_map[i].size || mem_map[i].attrs; i++) for (i = 0; mem_map[i].size || mem_map[i].attrs; i++)
add_map(&mem_map[i]); add_map(&mem_map[i]);
/* Create the same thing once more for our emergency page table */
create_table();
} }
static void setup_all_pgtables(void) static void setup_all_pgtables(void)
@ -527,6 +527,9 @@ void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
debug("start=%lx size=%lx\n", (ulong)start, (ulong)size); debug("start=%lx size=%lx\n", (ulong)start, (ulong)size);
if (!gd->arch.tlb_emerg)
panic("Emergency page table not setup.");
/* /*
* We can not modify page tables that we're currently running on, * We can not modify page tables that we're currently running on,
* so we first need to switch to the "emergency" page tables where * so we first need to switch to the "emergency" page tables where

@ -141,6 +141,8 @@ struct mm_region {
}; };
extern struct mm_region *mem_map; extern struct mm_region *mem_map;
void setup_pgtables(void);
u64 get_tcr(int el, u64 *pips, u64 *pva_bits);
#endif #endif
#endif /* _ASM_ARMV8_MMU_H_ */ #endif /* _ASM_ARMV8_MMU_H_ */

Loading…
Cancel
Save