* finalize 060 stuff.
For locore.s also nuke cacheop-functions now provided in m68k.
This commit is contained in:
parent
327cf04b4b
commit
f796b57669
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: atari_init.c,v 1.29 1997/04/09 19:37:53 thorpej Exp $ */
|
||||
/* $NetBSD: atari_init.c,v 1.30 1997/06/05 19:45:29 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Leo Weppelman
|
||||
|
@ -52,6 +52,7 @@
|
|||
#include <sys/core.h>
|
||||
#include <sys/kcore.h>
|
||||
#include <vm/pmap.h>
|
||||
|
||||
#include <machine/vmparam.h>
|
||||
#include <machine/pte.h>
|
||||
#include <machine/cpu.h>
|
||||
|
@ -60,6 +61,10 @@
|
|||
#include <machine/scu.h>
|
||||
#include <machine/acia.h>
|
||||
#include <machine/kcore.h>
|
||||
|
||||
#include <m68k/cpu.h>
|
||||
#include <m68k/cacheops.h>
|
||||
|
||||
#include <atari/atari/intr.h>
|
||||
#include <atari/atari/stalloc.h>
|
||||
#include <atari/dev/ym2149reg.h>
|
||||
|
@ -67,6 +72,7 @@
|
|||
void start_c __P((int, u_int, u_int, u_int, char *));
|
||||
static void atari_hwinit __P((void));
|
||||
static void cpu_init_kcorehdr __P((u_long));
|
||||
static void initcpu __P((void));
|
||||
static void mmu030_setup __P((st_entry_t *, u_int, pt_entry_t *, u_int,
|
||||
pt_entry_t *, u_int, u_int));
|
||||
static void map_io_areas __P((pt_entry_t *, u_int, u_int));
|
||||
|
@ -137,7 +143,6 @@ u_long st_pool_virt, st_pool_phys;
|
|||
* Some of the code in here is `stolen' from Amiga MACH, and was
|
||||
* written by Bryan Ford and Niklas Hallqvist.
|
||||
*
|
||||
* Very crude 68040 support by Michael L. Hitch.
|
||||
*/
|
||||
|
||||
void
|
||||
|
@ -209,6 +214,11 @@ char *esym_addr; /* Address of kernel '_esym' symbol */
|
|||
*/
|
||||
set_machtype();
|
||||
|
||||
/*
|
||||
* Initialize cpu specific stuff
|
||||
*/
|
||||
initcpu();
|
||||
|
||||
/*
|
||||
* We run the kernel from ST memory at the moment.
|
||||
* The kernel segment table is put just behind the loaded image.
|
||||
|
@ -889,6 +899,57 @@ mmu040_setup(sysseg, kstsize, pt, ptsize, sysptmap, sysptsize, kbase)
|
|||
}
|
||||
#endif /* M68040 */
|
||||
|
||||
#if defined(M68060)
|
||||
int m68060_pcr_init = 0x21; /* make this patchable */
|
||||
#endif
|
||||
|
||||
static void
|
||||
initcpu()
|
||||
{
|
||||
/* XXX should init '40 vecs here, too */
|
||||
#if defined(M68060)
|
||||
extern caddr_t vectab[256];
|
||||
|
||||
#if defined(M060SP)
|
||||
extern u_int8_t FP_CALL_TOP[], I_CALL_TOP[];
|
||||
#else
|
||||
extern u_int8_t illinst;
|
||||
#endif
|
||||
extern u_int8_t fpfault;
|
||||
|
||||
if (cputype == CPU_68060) {
|
||||
asm volatile ("movl %0,d0; .word 0x4e7b,0x0808" : :
|
||||
"d"(m68060_pcr_init):"d0" );
|
||||
|
||||
#if defined(M060SP)
|
||||
/* integer support */
|
||||
vectab[61] = &I_CALL_TOP[128 + 0x00];
|
||||
|
||||
/* floating point support */
|
||||
/*
|
||||
* XXX maybe we really should run-time check for the
|
||||
* stack frame format here:
|
||||
*/
|
||||
vectab[11] = &FP_CALL_TOP[128 + 0x30];
|
||||
|
||||
vectab[55] = &FP_CALL_TOP[128 + 0x38];
|
||||
vectab[60] = &FP_CALL_TOP[128 + 0x40];
|
||||
|
||||
vectab[54] = &FP_CALL_TOP[128 + 0x00];
|
||||
vectab[52] = &FP_CALL_TOP[128 + 0x08];
|
||||
vectab[53] = &FP_CALL_TOP[128 + 0x10];
|
||||
vectab[51] = &FP_CALL_TOP[128 + 0x18];
|
||||
vectab[50] = &FP_CALL_TOP[128 + 0x20];
|
||||
vectab[49] = &FP_CALL_TOP[128 + 0x28];
|
||||
#else
|
||||
vectab[61] = &illinst;
|
||||
#endif
|
||||
vectab[48] = &fpfault;
|
||||
}
|
||||
DCIS();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
dump_segtable(stp)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locore.s,v 1.40 1997/06/02 12:03:41 leo Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.41 1997/06/05 19:45:32 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -760,65 +760,75 @@ Lstart0:
|
|||
*/
|
||||
jmp Lstart2
|
||||
Lstart2:
|
||||
movl a0@+,a5@+ | copy the rest of the kernel
|
||||
movl a0@+,a5@+ | copy the rest of the kernel
|
||||
subl #4, d4
|
||||
jcc Lstart2
|
||||
Lstart3:
|
||||
|
||||
lea tmpstk,sp | give ourselves a temporary stack
|
||||
lea tmpstk,sp | give ourselves a temporary stack
|
||||
|
||||
/*
|
||||
* save the passed parameters. `prepass' them on the stack for
|
||||
* later catch by _start_c
|
||||
*/
|
||||
movl a1,sp@- | pass address of _esym
|
||||
movl d1,sp@- | pass stmem-size
|
||||
movl d0,sp@- | pass fastmem-size
|
||||
movl d5,sp@- | pass fastmem_start
|
||||
movl d2,sp@- | pass machine id
|
||||
movl d3,_boothowto | save reboot flags
|
||||
movl #ATARI_68030,d1 | 68030 type from loader
|
||||
movl a1,sp@- | pass address of _esym
|
||||
movl d1,sp@- | pass stmem-size
|
||||
movl d0,sp@- | pass fastmem-size
|
||||
movl d5,sp@- | pass fastmem_start
|
||||
movl d2,sp@- | pass machine id
|
||||
movl d3,_boothowto | save reboot flags
|
||||
|
||||
|
||||
/*
|
||||
* Set cputype and mmutype dependent on the machine-id passed
|
||||
* in from the loader. Also make sure that all caches are cleared.
|
||||
*/
|
||||
movl #ATARI_68030,d1 | 68030 type from loader
|
||||
andl d2,d1
|
||||
jeq Ltestfor020 | Not an 68030, try 68020
|
||||
movl #MMU_68030,_mmutype | Use 68030 MMU
|
||||
movl #CPU_68030,_cputype | and a 68030 CPU
|
||||
jra Ltestfor040 | skip to init.
|
||||
jeq Ltestfor020 | Not an 68030, try 68020
|
||||
movl #MMU_68030,_mmutype | Use 68030 MMU
|
||||
movl #CPU_68030,_cputype | and a 68030 CPU
|
||||
movl #CACHE_OFF,d0 | 68020/030 cache clear
|
||||
jra Lend_cpuset | skip to init.
|
||||
Ltestfor020:
|
||||
movl #ATARI_68020,d1 | 68020 type from loader
|
||||
movl #ATARI_68020,d1 | 68020 type from loader
|
||||
andl d2,d1
|
||||
jeq Ltestfor040
|
||||
movl #MMU_68851,_mmutype | Assume 68851 with 68020
|
||||
movl #CPU_68020,_cputype | and a 68020 CPU
|
||||
movl #MMU_68851,_mmutype | Assume 68851 with 68020
|
||||
movl #CPU_68020,_cputype | and a 68020 CPU
|
||||
movl #CACHE_OFF,d0 | 68020/030 cache clear
|
||||
jra Lend_cpuset | skip to init.
|
||||
Ltestfor040:
|
||||
movl #CACHE_OFF,d0 | 68020/030 cache
|
||||
movl #CACHE_OFF,d0 | 68020/030 cache
|
||||
movl #ATARI_68040,d1
|
||||
andl d1,d2
|
||||
andl d2,d1
|
||||
jeq Ltestfor060
|
||||
movl #MMU_68040,_mmutype | Use a 68040 MMU
|
||||
movl #CPU_68040,_cputype | and a 68040 CPU
|
||||
.word 0xf4f8 | cpusha bc - push and inval caches
|
||||
movl #CACHE40_OFF,d0 | 68040 cache disable
|
||||
jra Lstartnot060
|
||||
movl #MMU_68040,_mmutype | Use a 68040 MMU
|
||||
movl #CPU_68040,_cputype | and a 68040 CPU
|
||||
.word 0xf4f8 | cpusha bc - push and inval caches
|
||||
movl #CACHE40_OFF,d0 | 68040 cache disable
|
||||
jra Lend_cpuset | skip to init.
|
||||
Ltestfor060:
|
||||
movl #ATARI_68060,d1
|
||||
andl d1,d2
|
||||
jeq Lstartnot060
|
||||
andl d2,d1
|
||||
jeq Lend_cpuset
|
||||
movl #MMU_68040,_mmutype | Use a 68040 MMU
|
||||
movl #CPU_68060,_cputype | and a 68060 CPU
|
||||
.word 0xf4f8 | cpusha bc - push and inval caches
|
||||
movl #CACHE40_OFF,d0 | 68040 cache disable
|
||||
orl #IC60_CABC,d0 | and clear all 060 branch cache
|
||||
Lstartnot060:
|
||||
|
||||
Lend_cpuset:
|
||||
movc d0,cacr | clear and disable on-chip cache(s)
|
||||
movl #Lvectab,a0 | set address of vector table
|
||||
movl #_vectab,a0 | set address of vector table
|
||||
movc a0,vbr
|
||||
|
||||
/*
|
||||
* Initialize source/destination control registers for movs
|
||||
*/
|
||||
moveq #FC_USERD,d0 | user space
|
||||
movc d0,sfc | as source
|
||||
movc d0,dfc | and destination of transfers
|
||||
moveq #FC_USERD,d0 | user space
|
||||
movc d0,sfc | as source
|
||||
movc d0,dfc | and destination of transfers
|
||||
|
||||
/*
|
||||
* let the C function initialize everything and enable the MMU
|
||||
|
@ -1464,162 +1474,6 @@ Ltbisnot060:
|
|||
|
||||
rts
|
||||
|
||||
/*
|
||||
* Invalidate supervisor side of TLB
|
||||
*/
|
||||
ENTRY(TBIAS)
|
||||
#ifdef DEBUG
|
||||
tstl fulltflush | being conservative?
|
||||
jne __TBIA | yes, flush everything
|
||||
#endif
|
||||
cmpl #MMU_68040,_mmutype
|
||||
jeq Ltbias040
|
||||
tstl _mmutype
|
||||
jpl Lmc68851c | 68851?
|
||||
pflush #4,#4 | flush supervisor TLB entries
|
||||
movl #DC_CLEAR,d0
|
||||
movc d0,cacr | invalidate on-chip d-cache
|
||||
rts
|
||||
Lmc68851c:
|
||||
pflushs #4,#4 | flush supervisor TLB entries
|
||||
rts
|
||||
Ltbias040:
|
||||
/* 68040 can't specify supervisor/user on pflusha, so we flush all */
|
||||
.word 0xf518 | pflusha
|
||||
rts
|
||||
|
||||
/*
|
||||
* Invalidate user side of TLB
|
||||
*/
|
||||
ENTRY(TBIAU)
|
||||
#ifdef DEBUG
|
||||
tstl fulltflush | being conservative?
|
||||
jne __TBIA | yes, flush everything
|
||||
#endif
|
||||
cmpl #MMU_68040,_mmutype
|
||||
jeq Ltbiau040
|
||||
tstl _mmutype
|
||||
jpl Lmc68851d | 68851?
|
||||
pflush #0,#4 | flush user TLB entries
|
||||
movl #DC_CLEAR,d0
|
||||
movc d0,cacr | invalidate on-chip d-cache
|
||||
rts
|
||||
Lmc68851d:
|
||||
pflushs #0,#4 | flush user TLB entries
|
||||
rts
|
||||
Ltbiau040:
|
||||
/* 68040 can't specify supervisor/user on pflusha, so we flush all */
|
||||
.word 0xf518 | pflusha
|
||||
rts
|
||||
|
||||
/*
|
||||
* Invalidate instruction cache
|
||||
*/
|
||||
ENTRY(ICIA)
|
||||
ENTRY(ICPA)
|
||||
#if defined(M68030) || defined(M68020)
|
||||
#if defined(M68040) || defined(M68060)
|
||||
cmpl #MMU_68040,_mmutype
|
||||
jeq Licia040
|
||||
#endif
|
||||
movl #IC_CLEAR,d0
|
||||
movc d0,cacr | invalidate i-cache
|
||||
rts
|
||||
Licia040:
|
||||
#endif
|
||||
#if defined(M68040)
|
||||
.word 0xf498 | cinva ic
|
||||
rts
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Invalidate data cache.
|
||||
* NOTE: we do not flush 68030 on-chip cache as there are no aliasing
|
||||
* problems with DC_WA. The only cases we have to worry about are context
|
||||
* switch and TLB changes, both of which are handled "in-line" in resume
|
||||
* and TBI*.
|
||||
*/
|
||||
ENTRY(DCIA)
|
||||
__DCIA:
|
||||
cmpl #MMU_68040,_mmutype
|
||||
jne Ldciax
|
||||
.word 0xf478 | cpusha dc
|
||||
Ldciax:
|
||||
rts
|
||||
|
||||
ENTRY(DCIS)
|
||||
__DCIS:
|
||||
cmpl #MMU_68040,_mmutype
|
||||
jne Ldcisx
|
||||
.word 0xf478 | cpusha dc
|
||||
nop
|
||||
Ldcisx:
|
||||
rts
|
||||
|
||||
ENTRY(DCIU)
|
||||
__DCIU:
|
||||
cmpl #MMU_68040,_mmutype
|
||||
jne Ldciux
|
||||
.word 0xf478 | cpusha dc
|
||||
Ldciux:
|
||||
rts
|
||||
|
||||
/* Invalid single cache line */
|
||||
ENTRY(DCIAS)
|
||||
__DCIAS:
|
||||
cmpl #MMU_68040,_mmutype
|
||||
jne Ldciasx
|
||||
movl sp@(4),a0
|
||||
.word 0xf468 | cpushl dc,a0@
|
||||
Ldciasx:
|
||||
rts
|
||||
#ifdef M68040
|
||||
ENTRY(ICPL) /* invalidate instruction physical cache line */
|
||||
movl sp@(4),a0 | address
|
||||
.word 0xf488 | cinvl ic,a0@
|
||||
rts
|
||||
ENTRY(ICPP) /* invalidate instruction physical cache page */
|
||||
movl sp@(4),a0 | address
|
||||
.word 0xf490 | cinvp ic,a0@
|
||||
rts
|
||||
ENTRY(DCPL) /* invalidate data physical cache line */
|
||||
movl sp@(4),a0 | address
|
||||
.word 0xf448 | cinvl dc,a0@
|
||||
rts
|
||||
ENTRY(DCPP) /* invalidate data physical cache page */
|
||||
movl sp@(4),a0 | address
|
||||
.word 0xf450 | cinvp dc,a0@
|
||||
rts
|
||||
ENTRY(DCPA) /* invalidate data physical all */
|
||||
.word 0xf458 | cinva dc
|
||||
rts
|
||||
ENTRY(DCFL) /* data cache flush line */
|
||||
movl sp@(4),a0 | address
|
||||
.word 0xf468 | cpushl dc,a0@
|
||||
rts
|
||||
ENTRY(DCFP) /* data cache flush page */
|
||||
movl sp@(4),a0 | address
|
||||
.word 0xf470 | cpushp dc,a0@
|
||||
rts
|
||||
#endif /* M68040 */
|
||||
|
||||
ENTRY(PCIA)
|
||||
#if defined(M68030) || defined(M68030)
|
||||
#if defined(M68040) || defined(M68060)
|
||||
cmpl #MMU_68040,_mmutype
|
||||
jeq Lpcia040
|
||||
#endif
|
||||
movl #DC_CLEAR,d0
|
||||
movc d0,cacr | invalidate on-chip d-cache
|
||||
rts
|
||||
#endif
|
||||
#if defined(M68040)
|
||||
ENTRY(DCFA)
|
||||
Lpcia040:
|
||||
.word 0xf478 | cpusha dc
|
||||
rts
|
||||
#endif
|
||||
|
||||
ENTRY(ecacheon)
|
||||
rts
|
||||
|
||||
|
|
Loading…
Reference in New Issue