xref: /netbsd-src/sys/arch/amiga/include/cpu.h (revision 2a399c6883d870daece976daec6ffa7bb7f934ce)
1 /*	$NetBSD: cpu.h,v 1.39 1997/10/26 21:41:34 is 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 #ifndef _MACHINE_CPU_H_
45 #define _MACHINE_CPU_H_
46 
47 /*
48  * Exported definitions unique to amiga/68k cpu support.
49  */
50 
51 /*
52  * Get common m68k CPU definitions.
53  */
54 #include <m68k/cpu.h>
55 #define	M68K_MMU_MOTOROLA
56 
57 /*
58  * definitions of cpu-dependent requirements
59  * referenced in generic code
60  */
61 #define	cpu_swapin(p)			/* nothing */
62 #define	cpu_wait(p)			/* nothing */
63 #define	cpu_swapout(p)			/* nothing */
64 
65 /*
66  * Arguments to hardclock and gatherstats encapsulate the previous
67  * machine state in an opaque clockframe.  One the hp300, we use
68  * what the hardware pushes on an interrupt (frame format 0).
69  */
70 struct clockframe {
71 	u_short	sr;		/* sr at time of interrupt */
72 	u_long	pc;		/* pc at time of interrupt */
73 	u_short	vo;		/* vector offset (4-word frame) */
74 };
75 
76 #define	CLKF_USERMODE(framep)	(((framep)->sr & PSL_S) == 0)
77 /*#define	CLKF_BASEPRI(framep)	(((framep)->sr & PSL_IPL) == 0)*/
78 #define	CLKF_BASEPRI(framep)	(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 int	astpending;		/* need trap before returning to user mode */
112 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 ../amiga/amigacpu.h,
119  * although some of it could probably be put into generic 68k headers.
120  */
121 
122 /* values for machineid (happen to be AFF_* settings of AttnFlags) */
123 #define AMIGA_68020	(1L<<1)
124 #define AMIGA_68030	(1L<<2)
125 #define AMIGA_68040	(1L<<3)
126 #define AMIGA_68881	(1L<<4)
127 #define AMIGA_68882	(1L<<5)
128 #define	AMIGA_FPU40	(1L<<6)
129 #define AMIGA_68060	(1L<<7)
130 
131 #ifdef _KERNEL
132 int machineid;
133 #endif
134 
135 /*
136  * CTL_MACHDEP definitions.
137  */
138 #define CPU_CONSDEV	1	/* dev_t: console terminal device */
139 #define CPU_MAXID	2	/* number of valid machdep ids */
140 
141 #define CTL_MACHDEP_NAMES { \
142 	{ 0, 0 }, \
143 	{ "console_device", CTLTYPE_STRUCT }, \
144 }
145 
146 #ifdef _KERNEL
147 /*
148  * Prototypes from amiga_init.c
149  */
150 void	*alloc_z2mem __P((long));
151 
152 /*
153  * Prototypes from autoconf.c
154  */
155 void	configure __P((void));
156 int	is_a1200 __P((void));
157 int	is_a3000 __P((void));
158 int	is_a4000 __P((void));
159 #ifdef DRACO
160 int	is_draco __P((void));
161 #endif
162 
163 /*
164  * Prototypes from clock.c
165  */
166 u_long	clkread __P((void));
167 
168 #ifdef DRACO
169 /*
170  * Prototypes from kbd.c
171  */
172 void	drkbdintr __P((void));
173 
174 /*
175  * Prototypes from drsc.c
176  */
177 void	drsc_handler __P((void));
178 #endif
179 
180 /*
181  * Prototypes from locore.s
182  */
183 struct fpframe;
184 struct user;
185 struct pcb;
186 
187 void	clearseg __P((vm_offset_t));
188 void	doboot __P((void)) __attribute__((__noreturn__));
189 void	loadustp __P((int));
190 #ifdef FPCOPROC
191 void	m68881_save __P((struct fpframe *));
192 void	m68881_restore __P((struct fpframe *));
193 #endif
194 void	physcopyseg __P((vm_offset_t, vm_offset_t));
195 u_int	probeva __P((u_int, u_int));
196 void	proc_trampoline __P((void));
197 void	savectx __P((struct pcb *));
198 void	switch_exit __P((struct proc *));
199 void	DCIAS __P((vm_offset_t));
200 void	DCIA __P((void));
201 void	DCIS __P((void));
202 void	DCIU __P((void));
203 void	ICIA __P((void));
204 void	ICPA __P((void));
205 void	PCIA __P((void));
206 void	TBIA __P((void));
207 void	TBIS __P((vm_offset_t));
208 void	TBIAS __P((void));
209 void	TBIAU __P((void));
210 #if defined(M68040) || defined(M68060)
211 void	DCFA __P((void));
212 void	DCFP __P((vm_offset_t));
213 void	DCFL __P((vm_offset_t));
214 void	DCPL __P((vm_offset_t));
215 void	DCPP __P((vm_offset_t));
216 void	ICPL __P((vm_offset_t));
217 void	ICPP __P((vm_offset_t));
218 #endif
219 
220 /*
221  * Prototypes from machdep.c
222  */
223 int	badaddr __P((caddr_t));
224 int	badbaddr __P((caddr_t));
225 void	bootsync __P((void));
226 void	dumpconf __P((void));
227 
228 /*
229  * Prototypes from sys_machdep.c:
230  */
231 int	cachectl __P((int, caddr_t, int));
232 int	dma_cachectl __P((caddr_t, int));
233 
234 /*
235  * Prototypes from vm_machdep.c
236  */
237 int	kvtop __P((caddr_t));
238 void	physaccess __P((caddr_t,  caddr_t, int, int));
239 void	physunaccess __P((caddr_t, int));
240 void	setredzone __P((u_int *, caddr_t));
241 
242 /*
243  * Prototypes from pmap.c:
244  */
245 void	pmap_bootstrap __P((vm_offset_t, vm_offset_t));
246 
247 #endif /* _KERNEL */
248 
249 #endif /* !_MACHINE_CPU_H_ */
250