Home | History | Annotate | Line # | Download | only in include
locore.h revision 1.11
      1  1.11  jonathan /*	$NetBSD: locore.h,v 1.11 1997/06/22 03:17:41 jonathan Exp $	*/
      2   1.1  jonathan 
      3   1.1  jonathan /*
      4   1.1  jonathan  * Copyright 1996 The Board of Trustees of The Leland Stanford
      5   1.1  jonathan  * Junior University. All Rights Reserved.
      6   1.1  jonathan  *
      7   1.1  jonathan  * Permission to use, copy, modify, and distribute this
      8   1.1  jonathan  * software and its documentation for any purpose and without
      9   1.1  jonathan  * fee is hereby granted, provided that the above copyright
     10   1.1  jonathan  * notice appear in all copies.  Stanford University
     11   1.1  jonathan  * makes no representations about the suitability of this
     12   1.1  jonathan  * software for any purpose.  It is provided "as is" without
     13   1.1  jonathan  * express or implied warranty.
     14   1.1  jonathan  */
     15   1.1  jonathan 
     16   1.1  jonathan /*
     17   1.1  jonathan  * Jump table for MIPS cpu locore functions that are implemented
     18   1.1  jonathan  * differently on different generations, or instruction-level
     19   1.1  jonathan  * archtecture (ISA) level, the Mips family.
     20   1.1  jonathan  * The following functions must be provided for each mips ISA level:
     21   1.1  jonathan  *
     22   1.1  jonathan  *
     23   1.1  jonathan  *	MachConfigCache
     24   1.1  jonathan  *	MachFlushCache
     25   1.1  jonathan  *	MachFlushDCache
     26   1.1  jonathan  *	MachFlushICache
     27   1.1  jonathan  *	MachForceCacheUpdate
     28   1.1  jonathan  *	MachSetPID
     29   1.1  jonathan  *	MachTLBFlush
     30   1.1  jonathan  *	MachTLBFlushAddr __P()
     31   1.1  jonathan  *	MachTLBUpdate (u_int, (pt_entry_t?) u_int);
     32   1.5    mhitch  *	wbflush
     33   1.5    mhitch  *	proc_trampoline()
     34   1.9    mhitch  *	switch_exit()
     35   1.9    mhitch  *	cpu_switch_resume()
     36   1.1  jonathan  *
     37   1.1  jonathan  * We currently provide support for:
     38   1.1  jonathan  *
     39   1.1  jonathan  *	r2000 and r3000 (mips ISA-I)
     40   1.1  jonathan  *	r4000 and r4400 in 32-bit mode (mips ISA-III?)
     41   1.1  jonathan  */
     42   1.1  jonathan 
     43   1.1  jonathan #ifndef _MIPS_LOCORE_H
     44   1.1  jonathan #define  _MIPS_LOCORE_H
     45   1.2  jonathan 
     46   1.2  jonathan /*
     47   1.2  jonathan  * locore service routine for exeception vectors. Used outside locore
     48   1.2  jonathan  * only to print them by name in stack tracebacks
     49   1.2  jonathan  */
     50   1.2  jonathan 
     51   1.3  jonathan extern void mips1_ConfigCache  __P((void));
     52   1.3  jonathan extern void mips1_FlushCache  __P((void));
     53   1.3  jonathan extern void mips1_FlushDCache  __P((vm_offset_t addr, vm_offset_t len));
     54   1.3  jonathan extern void mips1_FlushICache  __P((vm_offset_t addr, vm_offset_t len));
     55   1.3  jonathan extern void mips1_ForceCacheUpdate __P((void));
     56   1.3  jonathan extern void mips1_SetPID   __P((int pid));
     57   1.3  jonathan extern void mips1_TLBFlush __P((void));
     58   1.3  jonathan extern void mips1_TLBFlushAddr   __P( /* XXX Really pte highpart ? */
     59   1.1  jonathan 					  (vm_offset_t addr));
     60   1.5    mhitch extern int mips1_TLBUpdate __P((u_int, /*pt_entry_t*/ u_int));
     61   1.3  jonathan extern void mips1_TLBWriteIndexed  __P((u_int index, u_int high,
     62   1.1  jonathan 					    u_int low));
     63   1.5    mhitch extern void mips1_wbflush __P((void));
     64   1.5    mhitch extern void mips1_proc_trampoline __P((void));
     65   1.9    mhitch extern void mips1_switch_exit __P((struct proc *));
     66   1.9    mhitch extern void mips1_cpu_switch_resume __P((void));
     67   1.1  jonathan 
     68   1.3  jonathan extern void mips3_ConfigCache __P((void));
     69   1.3  jonathan extern void mips3_FlushCache  __P((void));
     70   1.3  jonathan extern void mips3_FlushDCache __P((vm_offset_t addr, vm_offset_t len));
     71   1.3  jonathan extern void mips3_FlushICache __P((vm_offset_t addr, vm_offset_t len));
     72   1.3  jonathan extern void mips3_ForceCacheUpdate __P((void));
     73   1.7  jonathan extern void mips3_HitFlushDCache __P((vm_offset_t, int));
     74   1.3  jonathan extern void mips3_SetPID  __P((int pid));
     75   1.3  jonathan extern void mips3_TLBFlush __P((void));
     76   1.3  jonathan extern void mips3_TLBFlushAddr __P( /* XXX Really pte highpart ? */
     77   1.1  jonathan 					  (vm_offset_t addr));
     78   1.5    mhitch extern int mips3_TLBUpdate __P((u_int, /*pt_entry_t*/ u_int));
     79   1.5    mhitch extern void mips3_TLBWriteIndexedVPS __P((u_int index, void *tlb));
     80   1.3  jonathan extern void mips3_TLBWriteIndexed __P((u_int index, u_int high,
     81   1.5    mhitch 					   u_int lo0, u_int lo1));
     82   1.5    mhitch extern void mips3_wbflush __P((void));
     83   1.5    mhitch extern void mips3_proc_trampoline __P((void));
     84   1.9    mhitch extern void mips3_switch_exit __P((struct proc *));
     85   1.9    mhitch extern void mips3_cpu_switch_resume __P((void));
     86   1.1  jonathan 
     87   1.7  jonathan extern void mips3_SetWIRED __P((int));
     88   1.7  jonathan 
     89   1.7  jonathan 
     90   1.1  jonathan /*
     91   1.1  jonathan  *  A vector with an entry for each mips-ISA-level dependent
     92   1.1  jonathan  * locore function, and macros which jump through it.
     93   1.1  jonathan  * XXX the macro names are chosen to be compatible with the old
     94   1.1  jonathan  * Sprite  coding-convention names used in 4.4bsd/pmax.
     95   1.1  jonathan  */
     96   1.1  jonathan typedef struct  {
     97   1.1  jonathan 	void (*configCache) __P((void));
     98   1.1  jonathan 	void (*flushCache)  __P((void));
     99   1.1  jonathan 	void (*flushDCache) __P((vm_offset_t addr, vm_offset_t len));
    100   1.1  jonathan 	void (*flushICache) __P((vm_offset_t addr, vm_offset_t len));
    101   1.1  jonathan 	void (*forceCacheUpdate)  __P((void));
    102   1.1  jonathan 	void (*setTLBpid)  __P((int pid));
    103   1.1  jonathan 	void (*tlbFlush)  __P((void));
    104   1.1  jonathan 	void (*tlbFlushAddr)  __P((vm_offset_t)); /* XXX Really pte highpart ? */
    105   1.5    mhitch 	int (*tlbUpdate)  __P((u_int highreg, u_int lowreg));
    106   1.5    mhitch 	void (*wbflush) __P((void));
    107   1.5    mhitch 	void (*proc_trampoline) __P((void));
    108   1.9    mhitch 	void (*mips_switch_exit) __P((struct proc *));
    109   1.9    mhitch 	void (*cpu_switch_resume) __P((void));
    110   1.1  jonathan } mips_locore_jumpvec_t;
    111   1.1  jonathan 
    112   1.1  jonathan 
    113   1.1  jonathan /*
    114   1.1  jonathan  * The "active" locore-fuction vector, and
    115   1.1  jonathan 
    116   1.1  jonathan  */
    117   1.1  jonathan extern mips_locore_jumpvec_t mips_locore_jumpvec;
    118   1.1  jonathan extern mips_locore_jumpvec_t r2000_locore_vec;
    119   1.1  jonathan extern mips_locore_jumpvec_t r4000_locore_vec;
    120   1.1  jonathan 
    121  1.11  jonathan #if defined(MIPS3) && !defined (MIPS1)
    122  1.11  jonathan #define MachConfigCache		mips3_ConfigCache
    123  1.11  jonathan #define MachFlushCache		mips3_FlushCache
    124  1.11  jonathan #define MachFlushDCache		mips3_FlushDCache
    125  1.11  jonathan #define MachFlushICache		mips3_FlushICache
    126  1.11  jonathan #define MachForceCacheUpdate	mips3_ForceCacheUpdate
    127  1.11  jonathan #define MachSetPID		mips3_SetPID
    128  1.11  jonathan #define MachTLBFlush		mips3_TLBFlush
    129  1.11  jonathan #define MachTLBFlushAddr	mips3_TLBFlushAddr
    130  1.11  jonathan #define MachTLBUpdate		mips3_TLBUpdate
    131  1.11  jonathan #define wbflush			mips3_wbflush
    132  1.11  jonathan #define proc_trampoline		mips3_proc_trampoline
    133  1.11  jonathan #define switch_exit		mips3_mips_switch_exit
    134  1.11  jonathan #endif
    135  1.11  jonathan 
    136  1.11  jonathan #if !defined(MIPS3) && defined (MIPS1)
    137  1.11  jonathan #define MachConfigCache		mips1_ConfigCache
    138  1.11  jonathan #define MachFlushCache		mips1_FlushCache
    139  1.11  jonathan #define MachFlushDCache		mips1_FlushDCache
    140  1.11  jonathan #define MachFlushICache		mips1_FlushICache
    141  1.11  jonathan #define MachForceCacheUpdate	mips1_ForceCacheUpdate
    142  1.11  jonathan #define MachSetPID		mips1_SetPID
    143  1.11  jonathan #define MachTLBFlush		mips1_TLBFlush
    144  1.11  jonathan #define MachTLBFlushAddr	mips1_TLBFlushAddr
    145  1.11  jonathan #define MachTLBUpdate		mips1_TLBUpdate
    146  1.11  jonathan #define wbflush			mips1_wbflush
    147  1.11  jonathan #define proc_trampoline		mips1_proc_trampoline
    148  1.11  jonathan #define switch_exit		mips1_switch_exit
    149  1.11  jonathan #endif
    150  1.11  jonathan 
    151  1.11  jonathan 
    152  1.11  jonathan 
    153  1.11  jonathan #if defined(MIPS3) && defined (MIPS1)
    154   1.1  jonathan #define MachConfigCache		(*(mips_locore_jumpvec.configCache))
    155   1.1  jonathan #define MachFlushCache		(*(mips_locore_jumpvec.flushCache))
    156   1.1  jonathan #define MachFlushDCache		(*(mips_locore_jumpvec.flushDCache))
    157   1.1  jonathan #define MachFlushICache		(*(mips_locore_jumpvec.flushICache))
    158   1.1  jonathan #define MachForceCacheUpdate	(*(mips_locore_jumpvec.forceCacheUpdate))
    159   1.1  jonathan #define MachSetPID		(*(mips_locore_jumpvec.setTLBpid))
    160   1.1  jonathan #define MachTLBFlush		(*(mips_locore_jumpvec.tlbFlush))
    161   1.1  jonathan #define MachTLBFlushAddr	(*(mips_locore_jumpvec.tlbFlushAddr))
    162   1.1  jonathan #define MachTLBUpdate		(*(mips_locore_jumpvec.tlbUpdate))
    163   1.5    mhitch #define wbflush			(*(mips_locore_jumpvec.wbflush))
    164   1.5    mhitch #define proc_trampoline		(mips_locore_jumpvec.proc_trampoline)
    165   1.9    mhitch #define switch_exit		(*(mips_locore_jumpvec.mips_switch_exit))
    166  1.11  jonathan #endif
    167  1.11  jonathan 
    168   1.9    mhitch /* cpu_switch_resume not called directly */
    169   1.7  jonathan 
    170   1.7  jonathan 
    171   1.7  jonathan /*
    172   1.7  jonathan  * CPU identification, from PRID register.
    173   1.7  jonathan  */
    174   1.7  jonathan union cpuprid {
    175   1.7  jonathan 	int	cpuprid;
    176   1.7  jonathan 	struct {
    177   1.7  jonathan #if BYTE_ORDER == BIG_ENDIAN
    178   1.7  jonathan 		u_int	pad1:16;	/* reserved */
    179   1.7  jonathan 		u_int	cp_imp:8;	/* implementation identifier */
    180   1.7  jonathan 		u_int	cp_majrev:4;	/* major revision identifier */
    181   1.7  jonathan 		u_int	cp_minrev:4;	/* minor revision identifier */
    182   1.7  jonathan #else
    183   1.7  jonathan 		u_int	cp_minrev:4;	/* minor revision identifier */
    184   1.7  jonathan 		u_int	cp_majrev:4;	/* major revision identifier */
    185   1.7  jonathan 		u_int	cp_imp:8;	/* implementation identifier */
    186   1.7  jonathan 		u_int	pad1:16;	/* reserved */
    187   1.7  jonathan #endif
    188   1.7  jonathan 	} cpu;
    189   1.7  jonathan };
    190   1.7  jonathan 
    191   1.6  jonathan 
    192   1.6  jonathan #ifdef _KERNEL
    193   1.6  jonathan 
    194   1.6  jonathan /*
    195   1.6  jonathan  * Global variables used to communicate CPU type, and parameters
    196   1.6  jonathan  * such as cache size, from locore to higher-level code (e.g., pmap).
    197   1.6  jonathan  */
    198   1.8  jonathan extern union	cpuprid cpu_id;
    199   1.8  jonathan extern union	cpuprid fpu_id;
    200   1.8  jonathan extern int	cpu_arch;
    201   1.9    mhitch extern u_int	mips_L1DataCacheSize;
    202   1.9    mhitch extern u_int	mips_L1InstCacheSize;
    203   1.9    mhitch extern u_int	mips_L1DataCacheLSize;
    204   1.9    mhitch extern u_int	mips_L1InstCacheLSize;
    205   1.9    mhitch extern u_int	mips_L2CacheSize;
    206   1.9    mhitch extern u_int	mips_L2CacheLSize;
    207   1.9    mhitch extern u_int	mips_CacheAliasMask;
    208   1.6  jonathan extern	struct intr_tab intr_tab[];
    209   1.6  jonathan #endif
    210   1.1  jonathan 
    211   1.1  jonathan #endif	/* _MIPS_LOCORE_H */
    212