Home | History | Annotate | Line # | Download | only in include
cpu.h revision 1.11
      1  1.11  leo /*	$NetBSD: cpu.h,v 1.11 1996/04/18 08:52:17 leo Exp $	*/
      2   1.1  leo 
      3   1.1  leo /*
      4   1.1  leo  * Copyright (c) 1988 University of Utah.
      5   1.1  leo  * Copyright (c) 1982, 1990 The Regents of the University of California.
      6   1.1  leo  * All rights reserved.
      7   1.1  leo  *
      8   1.1  leo  * This code is derived from software contributed to Berkeley by
      9   1.1  leo  * the Systems Programming Group of the University of Utah Computer
     10   1.1  leo  * Science Department.
     11   1.1  leo  *
     12   1.1  leo  * Redistribution and use in source and binary forms, with or without
     13   1.1  leo  * modification, are permitted provided that the following conditions
     14   1.1  leo  * are met:
     15   1.1  leo  * 1. Redistributions of source code must retain the above copyright
     16   1.1  leo  *    notice, this list of conditions and the following disclaimer.
     17   1.1  leo  * 2. Redistributions in binary form must reproduce the above copyright
     18   1.1  leo  *    notice, this list of conditions and the following disclaimer in the
     19   1.1  leo  *    documentation and/or other materials provided with the distribution.
     20   1.1  leo  * 3. All advertising materials mentioning features or use of this software
     21   1.1  leo  *    must display the following acknowledgement:
     22   1.1  leo  *	This product includes software developed by the University of
     23   1.1  leo  *	California, Berkeley and its contributors.
     24   1.1  leo  * 4. Neither the name of the University nor the names of its contributors
     25   1.1  leo  *    may be used to endorse or promote products derived from this software
     26   1.1  leo  *    without specific prior written permission.
     27   1.1  leo  *
     28   1.1  leo  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     29   1.1  leo  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     30   1.1  leo  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     31   1.1  leo  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     32   1.1  leo  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     33   1.1  leo  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     34   1.1  leo  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     35   1.1  leo  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     36   1.1  leo  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     37   1.1  leo  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     38   1.1  leo  * SUCH DAMAGE.
     39   1.1  leo  *
     40   1.1  leo  * from: Utah $Hdr: cpu.h 1.16 91/03/25$
     41   1.1  leo  *
     42   1.1  leo  *	@(#)cpu.h	7.7 (Berkeley) 6/27/91
     43   1.1  leo  */
     44   1.1  leo 
     45   1.1  leo #ifndef _MACHINE_CPU_H_
     46   1.1  leo #define _MACHINE_CPU_H_
     47   1.1  leo 
     48   1.1  leo /*
     49   1.1  leo  * Exported definitions unique to atari/68k cpu support.
     50   1.1  leo  */
     51   1.1  leo 
     52   1.1  leo /*
     53   1.1  leo  * definitions of cpu-dependent requirements
     54   1.1  leo  * referenced in generic code
     55   1.1  leo  */
     56   1.1  leo #define	cpu_swapin(p)			/* nothing */
     57   1.1  leo #define	cpu_wait(p)			/* nothing */
     58   1.6  leo #define cpu_swapout(p)			/* nothing */
     59   1.1  leo 
     60   1.1  leo /*
     61   1.1  leo  * Arguments to hardclock and gatherstats encapsulate the previous
     62   1.1  leo  * machine state in an opaque clockframe.  On the hp300, we use
     63   1.1  leo  * what the hardware pushes on an interrupt (frame format 0).
     64   1.1  leo  */
     65   1.1  leo struct clockframe {
     66   1.1  leo 	u_short	sr;		/* sr at time of interrupt */
     67   1.1  leo 	u_long	pc;		/* pc at time of interrupt */
     68   1.1  leo 	u_short	vo;		/* vector offset (4-word frame) */
     69   1.1  leo };
     70   1.1  leo 
     71   1.1  leo #define	CLKF_USERMODE(framep)	(((framep)->sr & PSL_S) == 0)
     72   1.1  leo #define	CLKF_BASEPRI(framep)	(((framep)->sr & PSL_IPL) == 0)
     73   1.1  leo #define	CLKF_PC(framep)		((framep)->pc)
     74   1.1  leo #if 0
     75   1.1  leo /* We would like to do it this way... */
     76   1.1  leo #define	CLKF_INTR(framep)	(((framep)->sr & PSL_M) == 0)
     77   1.1  leo #else
     78   1.1  leo /* but until we start using PSL_M, we have to do this instead */
     79   1.1  leo #define	CLKF_INTR(framep)	(0)	/* XXX */
     80   1.1  leo #endif
     81   1.1  leo 
     82   1.1  leo 
     83   1.1  leo /*
     84   1.1  leo  * Preempt the current process if in interrupt from user mode,
     85   1.1  leo  * or after the current trap/syscall if in system mode.
     86   1.1  leo  */
     87   1.1  leo #define	need_resched()	{want_resched = 1; setsoftast();}
     88   1.1  leo 
     89   1.1  leo /*
     90   1.1  leo  * Give a profiling tick to the current process from the softclock
     91   1.1  leo  * interrupt.  On hp300, request an ast to send us through trap(),
     92   1.1  leo  * marking the proc as needing a profiling tick.
     93   1.1  leo  */
     94   1.1  leo #define	profile_tick(p, framep)	((p)->p_flag |= P_OWEUPC, setsoftast())
     95   1.1  leo #define	need_proftick(p)	((p)->p_flag |= P_OWEUPC, setsoftast())
     96   1.1  leo 
     97   1.1  leo /*
     98   1.1  leo  * Notify the current process (p) that it has a signal pending,
     99   1.1  leo  * process as soon as possible.
    100   1.1  leo  */
    101   1.1  leo #define	signotify(p)	setsoftast()
    102   1.1  leo 
    103   1.1  leo #define setsoftast()	(astpending = 1)
    104   1.1  leo 
    105   1.1  leo extern int	astpending;	/* need trap before returning to user mode */
    106   1.1  leo extern int	want_resched;	/* resched() was called */
    107   1.1  leo 
    108   1.4  leo /* include support for software interrupts */
    109   1.4  leo #include <machine/mtpr.h>
    110   1.1  leo 
    111   1.1  leo /*
    112   1.1  leo  * The rest of this should probably be moved to ../atari/ataricpu.h,
    113   1.1  leo  * although some of it could probably be put into generic 68k headers.
    114   1.1  leo  */
    115   1.1  leo #define	BASEPRI(sr)	((sr & PSL_IPL) == 0)
    116   1.1  leo 
    117   1.1  leo /*
    118   1.1  leo  * Values for machineid.
    119   1.1  leo  */
    120  1.10  leo #define	ATARI_68000	1		/* 68000 CPU			*/
    121  1.10  leo #define	ATARI_68010	(1<<1)		/* 68010 CPU			*/
    122  1.10  leo #define ATARI_68020	(1L<<2)		/* 68020 CPU			*/
    123  1.10  leo #define ATARI_68030	(1L<<3)		/* 68030 CPU			*/
    124  1.10  leo #define ATARI_68040	(1L<<4)		/* 68040 CPU			*/
    125   1.4  leo #define	ATARI_TT	(1L<<11)
    126   1.4  leo #define	ATARI_FALCON	(1L<<12)
    127   1.7  leo 
    128   1.7  leo #define	ATARI_CLKBROKEN	(1L<<16)
    129   1.1  leo 
    130  1.10  leo #define	ATARI_ANYCPU	(ATARI_68000|ATARI_68010|ATARI_68020|ATARI_68030 \
    131  1.10  leo 			|ATARI_68040)
    132   1.1  leo 
    133   1.1  leo /*
    134   1.1  leo  * Values for mmutype (assigned for quick testing)
    135   1.1  leo  */
    136   1.1  leo #define	MMU_68030	-1	/* 68030 on-chip subset of 68851	*/
    137   1.1  leo #define	MMU_68851	 1	/* Motorola 68851			*/
    138   1.1  leo #define MMU_68040	-2	/* 68040 on-chip subsubset		*/
    139   1.1  leo 
    140   1.2  leo #ifdef _KERNEL
    141   1.6  leo extern int machineid, mmutype, cpu040, fputype;
    142   1.1  leo #endif
    143   1.1  leo 
    144   1.1  leo /*
    145   1.1  leo  * 68851 and 68030 MMU
    146   1.1  leo  */
    147   1.1  leo #define	PMMU_LVLMASK	0x0007
    148   1.1  leo #define	PMMU_INV	0x0400
    149   1.1  leo #define	PMMU_WP		0x0800
    150   1.1  leo #define	PMMU_ALV	0x1000
    151   1.1  leo #define	PMMU_SO		0x2000
    152   1.1  leo #define	PMMU_LV		0x4000
    153   1.1  leo #define	PMMU_BE		0x8000
    154   1.1  leo #define	PMMU_FAULT	(PMMU_WP|PMMU_INV)
    155   1.1  leo 
    156   1.1  leo /* 680X0 function codes */
    157   1.1  leo #define	FC_USERD	1	/* user data space */
    158   1.1  leo #define	FC_USERP	2	/* user program space */
    159   1.1  leo #define	FC_SUPERD	5	/* supervisor data space */
    160   1.1  leo #define	FC_SUPERP	6	/* supervisor program space */
    161   1.1  leo #define	FC_CPU		7	/* CPU space */
    162   1.1  leo 
    163   1.1  leo /* fields in the 68020 cache control register */
    164   1.1  leo #define	IC_ENABLE	0x0001	/* enable instruction cache */
    165   1.1  leo #define	IC_FREEZE	0x0002	/* freeze instruction cache */
    166   1.1  leo #define	IC_CE		0x0004	/* clear instruction cache entry */
    167   1.1  leo #define	IC_CLR		0x0008	/* clear entire instruction cache */
    168   1.1  leo 
    169   1.1  leo /* additional fields in the 68030 cache control register */
    170   1.1  leo #define	IC_BE		0x0010	/* instruction burst enable */
    171   1.1  leo #define	DC_ENABLE	0x0100	/* data cache enable */
    172   1.1  leo #define	DC_FREEZE	0x0200	/* data cache freeze */
    173   1.1  leo #define	DC_CE		0x0400	/* clear data cache entry */
    174   1.1  leo #define	DC_CLR		0x0800	/* clear entire data cache */
    175   1.1  leo #define	DC_BE		0x1000	/* data burst enable */
    176   1.1  leo #define	DC_WA		0x2000	/* write allocate */
    177   1.1  leo 
    178   1.1  leo /* fields in the 68040 cache control register */
    179   1.1  leo #define	IC40_ENABLE	0x00008000	/* enable instruction cache */
    180   1.1  leo #define DC40_ENABLE	0x80000000	/* enable data cache */
    181   1.1  leo 
    182   1.1  leo #define	CACHE_ON	(DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
    183   1.1  leo #define	CACHE_OFF	(DC_CLR|IC_CLR)
    184   1.1  leo #define	CACHE_CLR	(CACHE_ON)
    185   1.1  leo #define	IC_CLEAR	(DC_WA|DC_BE|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
    186   1.1  leo #define	DC_CLEAR	(DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_ENABLE)
    187   1.1  leo 
    188   1.1  leo /* 68040 cache control */
    189   1.1  leo #define	CACHE40_ON	(IC40_ENABLE|DC40_ENABLE)
    190   1.1  leo #define	CACHE40_OFF	0x00000000
    191   1.1  leo 
    192   1.1  leo /*
    193   1.1  leo  * CTL_MACHDEP definitions.
    194   1.1  leo  */
    195   1.1  leo #define CPU_CONSDEV	1	/* dev_t: console terminal device */
    196   1.1  leo #define CPU_MAXID	2	/* number of valid machdep ids */
    197   1.1  leo 
    198   1.1  leo #define CTL_MACHDEP_NAMES { \
    199   1.1  leo 	{ 0, 0 }, \
    200   1.1  leo 	{ "console_device", CTLTYPE_STRUCT }, \
    201   1.1  leo }
    202   1.1  leo 
    203  1.11  leo #ifdef _KERNEL
    204  1.11  leo /*
    205  1.11  leo  * Prototypes from atari_init.c
    206  1.11  leo  */
    207  1.11  leo int	cpu_dump __P((int (*)(dev_t, daddr_t, caddr_t, size_t), daddr_t *));
    208  1.11  leo int	cpu_dumpsize __P((void));
    209  1.11  leo 
    210  1.11  leo /*
    211  1.11  leo  * Prototypes from autoconf.c
    212  1.11  leo  */
    213  1.11  leo void	configure __P((void));
    214  1.11  leo void	config_console __P((void));
    215  1.11  leo 
    216  1.11  leo /*
    217  1.11  leo  * Prototypes from clock.c
    218  1.11  leo  */
    219  1.11  leo long	clkread __P((void));
    220  1.11  leo 
    221  1.11  leo /*
    222  1.11  leo  * Prototypes from disksubr.c
    223  1.11  leo  */
    224  1.11  leo struct buf;
    225  1.11  leo struct disklabel;
    226  1.11  leo int	bounds_check_with_label __P((struct buf *, struct disklabel *, int));
    227  1.11  leo 
    228  1.11  leo /*
    229  1.11  leo  * Prototypes from fpu.c
    230  1.11  leo  */
    231  1.11  leo char	*fpu_describe __P((int));
    232  1.11  leo int	fpu_probe __P((void));
    233  1.11  leo 
    234  1.11  leo 
    235  1.11  leo /*
    236  1.11  leo  * Prototypes from grfabs.c
    237  1.11  leo  */
    238  1.11  leo int	grfabs_probe __P((void));
    239  1.11  leo 
    240  1.11  leo 
    241  1.11  leo /*
    242  1.11  leo  * Prototypes from vm_machdep.c
    243  1.11  leo  */
    244  1.11  leo int		badbaddr __P((caddr_t));
    245  1.11  leo void		consinit __P((void));
    246  1.11  leo void		cpu_set_kpc __P((struct proc *, void (*)(struct proc *)));
    247  1.11  leo void		dumpconf __P((void));
    248  1.11  leo vm_offset_t	kvtop __P((caddr_t));
    249  1.11  leo void		physaccess __P((caddr_t, caddr_t, int, int));
    250  1.11  leo void		physunaccess __P((caddr_t, int));
    251  1.11  leo void		setredzone __P((u_int *, caddr_t));
    252  1.11  leo 
    253  1.11  leo /*
    254  1.11  leo  * Prototypes from locore.s
    255  1.11  leo  */
    256  1.11  leo struct fpframe;
    257  1.11  leo struct user;
    258  1.11  leo struct pcb;
    259  1.11  leo 
    260  1.11  leo void	clearseg __P((vm_offset_t));
    261  1.11  leo void	doboot __P((void));
    262  1.11  leo u_long	getdfc __P((void));
    263  1.11  leo u_long	getsfc __P((void));
    264  1.11  leo void	loadustp __P((int));
    265  1.11  leo void	m68881_save __P((struct fpframe *));
    266  1.11  leo void	m68881_restore __P((struct fpframe *));
    267  1.11  leo void	physcopyseg __P((vm_offset_t, vm_offset_t));
    268  1.11  leo u_int	probeva __P((u_int, u_int));
    269  1.11  leo void	proc_trampoline __P((void));
    270  1.11  leo void	savectx __P((struct pcb *));
    271  1.11  leo void	switch_exit __P((struct proc *));
    272  1.11  leo void	DCIS __P((void));
    273  1.11  leo void	DCIU __P((void));
    274  1.11  leo void	ICIA __P((void));
    275  1.11  leo void	ICPA __P((void));
    276  1.11  leo void	PCIA __P((void));
    277  1.11  leo void	TBIA __P((void));
    278  1.11  leo void	TBIS __P((vm_offset_t));
    279  1.11  leo void	TBIAS __P((void));
    280  1.11  leo void	TBIAU __P((void));
    281  1.11  leo 
    282  1.11  leo /*
    283  1.11  leo  * Prototypes from machdep.c:
    284  1.11  leo  */
    285  1.11  leo typedef void (*si_farg)(void *, void *);	/* XXX */
    286  1.11  leo void	add_sicallback __P((si_farg, void *, void *));
    287  1.11  leo void	rem_sicallback __P((si_farg));
    288  1.11  leo struct frame;
    289  1.11  leo void	regdump __P((struct frame *, int));
    290  1.11  leo void	boot __P((int));
    291  1.11  leo void	cpu_startup __P((void));
    292  1.11  leo void	dumpsys __P((void));
    293  1.11  leo vm_offset_t reserve_dumppages __P((vm_offset_t));
    294  1.11  leo void	softint __P((void));
    295  1.11  leo 
    296  1.11  leo 
    297  1.11  leo /*
    298  1.11  leo  * Prototypes from nvram.c:
    299  1.11  leo  */
    300  1.11  leo struct uio;
    301  1.11  leo int	nvram_uio __P((struct uio *));
    302  1.11  leo 
    303  1.11  leo /*
    304  1.11  leo  * Prototypes from sys_machdep.c:
    305  1.11  leo  */
    306  1.11  leo int	cachectl __P((int, caddr_t, int));
    307  1.11  leo int	dma_cachectl __P((caddr_t, int));
    308  1.11  leo 
    309  1.11  leo /*
    310  1.11  leo  * Prototypes from swapgeneric.c:
    311  1.11  leo  */
    312  1.11  leo void	setconf __P((void));
    313  1.11  leo 
    314  1.11  leo /*
    315  1.11  leo  * Prototypes from trap.c:
    316  1.11  leo  */
    317  1.11  leo #ifdef _MACHINE_FRAME_H_ /* XXX: We don't want to include this everywhere */
    318  1.11  leo void  child_return __P((struct proc *, struct frame));
    319  1.11  leo #endif
    320  1.11  leo 
    321  1.11  leo #endif /* _KERNEL */
    322   1.1  leo #endif /* !_MACHINE_CPU_H_ */
    323