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