- Add 040 mmu support
- Set global mmu ops depending on mmu type. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26116 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ac00c6372d
commit
8df3441d64
@ -77,6 +77,7 @@ KernelMergeObject boot_platform_atari_m68k.o :
|
|||||||
boot_platform_atari_m68k_shell.o
|
boot_platform_atari_m68k_shell.o
|
||||||
boot_platform_atari_m68k_other.o
|
boot_platform_atari_m68k_other.o
|
||||||
boot_arch_m68k_030.o
|
boot_arch_m68k_030.o
|
||||||
|
boot_arch_m68k_040.o
|
||||||
;
|
;
|
||||||
|
|
||||||
# AUTO folder PRG target
|
# AUTO folder PRG target
|
||||||
|
@ -568,6 +568,26 @@ extern "C" void
|
|||||||
mmu_init(void)
|
mmu_init(void)
|
||||||
{
|
{
|
||||||
TRACE(("mmu_init\n"));
|
TRACE(("mmu_init\n"));
|
||||||
|
switch (gKernelArgs.arch.mmu_type) {
|
||||||
|
#if 0
|
||||||
|
case 68851:
|
||||||
|
gMMUOps = k851MMUOps;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case 68030:
|
||||||
|
gMMUOps = k030MMUOps;
|
||||||
|
break;
|
||||||
|
case 68040:
|
||||||
|
gMMUOps = k040MMUOps;
|
||||||
|
break;
|
||||||
|
#if 0
|
||||||
|
case 68060:
|
||||||
|
gMMUOps = k060MMUOps;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
panic("unknown mmu type %d\n", gKernelArgs.arch.mmu_type);
|
||||||
|
}
|
||||||
|
|
||||||
gKernelArgs.physical_allocated_range[0].start = sNextPhysicalAddress;
|
gKernelArgs.physical_allocated_range[0].start = sNextPhysicalAddress;
|
||||||
gKernelArgs.physical_allocated_range[0].size = 0;
|
gKernelArgs.physical_allocated_range[0].size = 0;
|
||||||
|
@ -46,7 +46,38 @@ static status_t
|
|||||||
set_tt(int which, addr_t pa, size_t len, uint32 perms)
|
set_tt(int which, addr_t pa, size_t len, uint32 perms)
|
||||||
{
|
{
|
||||||
TRACE(("mmu_040:set_tt(%d, 0x%lx, %ld, 0x%08lx)\n", which, pa, len, perms));
|
TRACE(("mmu_040:set_tt(%d, 0x%lx, %ld, 0x%08lx)\n", which, pa, len, perms));
|
||||||
|
uint32 mask;
|
||||||
|
uint32 ttr = 0;
|
||||||
|
mask = 1;
|
||||||
|
if (len) {
|
||||||
|
while (len >>= 1)
|
||||||
|
mask <<= 1;
|
||||||
|
mask = (mask - 1);
|
||||||
|
// enable, super only, upa=0,
|
||||||
|
// cachable write-through, rw
|
||||||
|
ttr = 0x0a000;
|
||||||
|
ttr |= (pa & 0xff000000);
|
||||||
|
ttr |= ((mask & 0xff000000) >> 8);
|
||||||
|
}
|
||||||
|
TRACE(("mmu_040:set_tt: 0x%08lx\n", ttr));
|
||||||
|
|
||||||
|
|
||||||
|
switch (which) {
|
||||||
|
case 0:
|
||||||
|
asm volatile( \
|
||||||
|
"movec %0,%%dtt0\n" \
|
||||||
|
"movec %0,%%itt0\n" \
|
||||||
|
: : "d"(ttr));
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
asm volatile( \
|
||||||
|
"movec %0,%%dtt1\n" \
|
||||||
|
"movec %0,%%itt1\n" \
|
||||||
|
: : "d"(ttr));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,15 +86,19 @@ static status_t
|
|||||||
load_rp(addr_t pa)
|
load_rp(addr_t pa)
|
||||||
{
|
{
|
||||||
TRACE(("mmu_040:load_rp(0x%lx)\n", pa));
|
TRACE(("mmu_040:load_rp(0x%lx)\n", pa));
|
||||||
long_page_directory_entry entry;
|
// sanity check
|
||||||
*(uint64 *)&entry = DFL_PAGEENT_VAL;
|
if (pa & ((1 << 9) - 1)) {
|
||||||
entry.type = DT_ROOT;
|
panic("mmu root pointer missaligned!");
|
||||||
entry.addr = TA_TO_PREA(((addr_t)pa));
|
return EINVAL;
|
||||||
|
}
|
||||||
asm volatile( \
|
/* mc68040 user's manual, 6-37 */
|
||||||
"pmove (%0),%%srp\n" \
|
/* pflush before... why not after ? */
|
||||||
"pmove (%0),%%crp\n" \
|
asm volatile( \
|
||||||
: : "a"((uint64 *)&entry));
|
"pflusha\n" \
|
||||||
|
"movec %0,%%srp\n" \
|
||||||
|
"movec %0,%%urp\n" \
|
||||||
|
"pflusha\n" \
|
||||||
|
: : "d"(pa));
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,10 +107,12 @@ static status_t
|
|||||||
enable_paging(void)
|
enable_paging(void)
|
||||||
{
|
{
|
||||||
TRACE(("mmu_040:enable_paging\n"));
|
TRACE(("mmu_040:enable_paging\n"));
|
||||||
|
uint16 tcr = 0x80; // Enable, 4K page size
|
||||||
asm volatile( \
|
asm volatile( \
|
||||||
"pmove (%0),%%srp\n" \
|
"pflusha\n" \
|
||||||
"pmove (%0),%%crp\n" \
|
"movec %0,%%tcr\n" \
|
||||||
: : "a"((uint64 *)&entry));
|
"pflusha\n" \
|
||||||
|
: : "d"(tcr));
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user