2009-03-04 15:21:31 +00:00
|
|
|
/*
|
|
|
|
* xtensa mmu stuff
|
|
|
|
*
|
|
|
|
* Extracted from init.c
|
|
|
|
*/
|
|
|
|
#include <linux/percpu.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/cache.h>
|
|
|
|
|
|
|
|
#include <asm/tlb.h>
|
|
|
|
#include <asm/tlbflush.h>
|
|
|
|
#include <asm/mmu_context.h>
|
|
|
|
#include <asm/page.h>
|
|
|
|
|
|
|
|
void __init paging_init(void)
|
|
|
|
{
|
|
|
|
memset(swapper_pg_dir, 0, PAGE_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Flush the mmu and reset associated register to default values.
|
|
|
|
*/
|
|
|
|
void __init init_mmu(void)
|
|
|
|
{
|
2012-12-03 11:01:43 +00:00
|
|
|
#if !(XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY)
|
|
|
|
/*
|
|
|
|
* Writing zeros to the instruction and data TLBCFG special
|
|
|
|
* registers ensure that valid values exist in the register.
|
|
|
|
*
|
|
|
|
* For existing PGSZID<w> fields, zero selects the first element
|
|
|
|
* of the page-size array. For nonexistent PGSZID<w> fields,
|
|
|
|
* zero is the best value to write. Also, when changing PGSZID<w>
|
2009-03-04 15:21:31 +00:00
|
|
|
* fields, the corresponding TLB must be flushed.
|
|
|
|
*/
|
|
|
|
set_itlbcfg_register(0);
|
|
|
|
set_dtlbcfg_register(0);
|
2012-12-03 11:01:43 +00:00
|
|
|
#endif
|
2009-03-04 15:21:31 +00:00
|
|
|
flush_tlb_all();
|
|
|
|
|
|
|
|
/* Set rasid register to a known value. */
|
|
|
|
|
2012-12-10 21:26:24 +00:00
|
|
|
set_rasid_register(ASID_INSERT(ASID_USER_FIRST));
|
2009-03-04 15:21:31 +00:00
|
|
|
|
|
|
|
/* Set PTEVADDR special register to the start of the page
|
|
|
|
* table, which is in kernel mappable space (ie. not
|
|
|
|
* statically mapped). This register's value is undefined on
|
|
|
|
* reset.
|
|
|
|
*/
|
|
|
|
set_ptevaddr_register(PGTABLE_START);
|
|
|
|
}
|