/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id$ * * Copyright (C) 2006,2007 by Greg White * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #include "cpu.h" #include "mmu-arm.h" #include "panic.h" #define SECTION_ADDRESS_MASK (-1 << 20) #define MB (1 << 20) void ttb_init(void) { unsigned int* ttbPtr; /* must be 16Kb (0x4000) aligned - clear out the TTB */ for (ttbPtr=TTB_BASE; ttbPtr<(TTB_SIZE+TTB_BASE); ttbPtr++) { *ttbPtr = 0; } /* Set the TTB base address */ asm volatile("mcr p15, 0, %0, c2, c0, 0" : : "r" (TTB_BASE)); /* Set all domains to manager status */ asm volatile("mcr p15, 0, %0, c3, c0, 0" : : "r" (0xFFFFFFFF)); } void map_section(unsigned int pa, unsigned int va, int mb, int cache_flags) { unsigned int* ttbPtr; int i; int section_no; section_no = va >> 20; /* sections are 1Mb size */ ttbPtr = TTB_BASE + section_no; pa &= SECTION_ADDRESS_MASK; /* align to 1Mb */ for(i=0; i