armv7: add new dcache and MMU setup functions

This adds new MMU setup code. Most notably, this version uses
cbmem_add() to determine the translation table base address, which
in turn is necessary to ensure payloads which wipe memory can tell
which regions to wipe out.

TODOs:
- Finish cleaning up references to old cache/MMU stuff
- Add L2 setup (from exynos_cache.c)
- Set up ranges dynamically rather than in ramstage's main().

Change-Id: Iba5295a801e8058a3694e4ec5b94bbe9a69d3ee6
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: http://review.coreboot.org/2877
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
David Hendricks
2013-03-21 21:58:50 -07:00
committed by Ronald G. Minnich
parent 04d352db41
commit f9be756b55
10 changed files with 226 additions and 668 deletions

View File

@@ -204,6 +204,28 @@ void dcache_clean_invalidate_by_mva(unsigned long addr, unsigned long len)
dcache_op_mva(addr, len, OP_DCCIMVAC);
}
void dcache_mmu_disable(void)
{
uint32_t sctlr;
sctlr = read_sctlr();
dcache_clean_invalidate_all();
sctlr &= ~(SCTLR_C | SCTLR_M);
write_sctlr(sctlr);
}
void dcache_mmu_enable(void)
{
uint32_t sctlr;
sctlr = read_sctlr();
dcache_clean_invalidate_all();
sctlr |= SCTLR_C | SCTLR_M;
write_sctlr(sctlr);
}
void armv7_invalidate_caches(void)
{
uint32_t clidr;
@@ -252,10 +274,3 @@ void armv7_invalidate_caches(void)
/* Invalidate TLB */
tlb_invalidate_all();
}
/* FIXME: wrapper around imported mmu_setup() for now */
extern void mmu_setup(unsigned long start, unsigned long size);
void mmu_setup_by_mva(unsigned long start, unsigned long size)
{
mmu_setup(start, size);
}