cpu.h revision 1.18 1 /* $NetBSD: cpu.h,v 1.18 1997/01/03 22:54:35 leo 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_int cf_regs[4]; /* d0,d1,a0,a1 (see locore.s) */
73 u_short cf_sr; /* sr at time of interrupt */
74 u_long cf_pc; /* pc at time of interrupt */
75 u_short cf_vo; /* vector offset (4-word frame) */
76 };
77
78 #define CLKF_USERMODE(framep) (((framep)->cf_sr & PSL_S) == 0)
79 #define CLKF_BASEPRI(framep) (((framep)->cf_sr & PSL_IPL) == 0)
80 #define CLKF_PC(framep) ((framep)->cf_pc)
81 #if 0
82 /* We would like to do it this way... */
83 #define CLKF_INTR(framep) (((framep)->cf_sr & PSL_M) == 0)
84 #else
85 /* but until we start using PSL_M, we have to do this instead */
86 #define CLKF_INTR(framep) (0) /* XXX */
87 #endif
88
89
90 /*
91 * Preempt the current process if in interrupt from user mode,
92 * or after the current trap/syscall if in system mode.
93 */
94 #define need_resched() {want_resched = 1; setsoftast();}
95
96 /*
97 * Give a profiling tick to the current process from the softclock
98 * interrupt. On hp300, request an ast to send us through trap(),
99 * marking the proc as needing a profiling tick.
100 */
101 #define profile_tick(p, framep) ((p)->p_flag |= P_OWEUPC, setsoftast())
102 #define need_proftick(p) ((p)->p_flag |= P_OWEUPC, setsoftast())
103
104 /*
105 * Notify the current process (p) that it has a signal pending,
106 * process as soon as possible.
107 */
108 #define signotify(p) setsoftast()
109
110 #define setsoftast() (astpending = 1)
111
112 extern int astpending; /* need trap before returning to user mode */
113 extern int want_resched; /* resched() was called */
114
115 /* include support for software interrupts */
116 #include <machine/mtpr.h>
117
118 /*
119 * The rest of this should probably be moved to ../atari/ataricpu.h,
120 * although some of it could probably be put into generic 68k headers.
121 */
122 #define BASEPRI(sr) ((sr & PSL_IPL) == 0)
123
124 /*
125 * Values for machineid.
126 */
127 #define ATARI_68000 1 /* 68000 CPU */
128 #define ATARI_68010 (1<<1) /* 68010 CPU */
129 #define ATARI_68020 (1L<<2) /* 68020 CPU */
130 #define ATARI_68030 (1L<<3) /* 68030 CPU */
131 #define ATARI_68040 (1L<<4) /* 68040 CPU */
132 #define ATARI_TT (1L<<11)
133 #define ATARI_FALCON (1L<<12)
134 #define ATARI_HADES (1L<<13)
135
136 #define ATARI_CLKBROKEN (1L<<16)
137
138 #define ATARI_ANYCPU (ATARI_68000|ATARI_68010|ATARI_68020|ATARI_68030 \
139 |ATARI_68040)
140
141 #define ATARI_ANYMACH (ATARI_TT|ATARI_FALCON|ATARI_HADES)
142
143 #ifdef _KERNEL
144 extern int machineid;
145 #endif
146
147 /*
148 * CTL_MACHDEP definitions.
149 */
150 #define CPU_CONSDEV 1 /* dev_t: console terminal device */
151 #define CPU_MAXID 2 /* number of valid machdep ids */
152
153 #define CTL_MACHDEP_NAMES { \
154 { 0, 0 }, \
155 { "console_device", CTLTYPE_STRUCT }, \
156 }
157
158 #ifdef _KERNEL
159 /*
160 * Prototypes from atari_init.c
161 */
162 int cpu_dump __P((int (*)(dev_t, daddr_t, caddr_t, size_t), daddr_t *));
163 int cpu_dumpsize __P((void));
164
165 /*
166 * Prototypes from autoconf.c
167 */
168 void configure __P((void));
169 void config_console __P((void));
170
171 /*
172 * Prototypes from clock.c
173 */
174 long clkread __P((void));
175
176 /*
177 * Prototypes from disksubr.c
178 */
179 struct buf;
180 struct disklabel;
181 int bounds_check_with_label __P((struct buf *, struct disklabel *, int));
182
183 /*
184 * Prototypes from fpu.c
185 */
186 char *fpu_describe __P((int));
187 int fpu_probe __P((void));
188
189 /*
190 * Prototypes from vm_machdep.c
191 */
192 int badbaddr __P((caddr_t));
193 void consinit __P((void));
194 void cpu_set_kpc __P((struct proc *, void (*)(struct proc *)));
195 void dumpconf __P((void));
196 vm_offset_t kvtop __P((caddr_t));
197 void physaccess __P((caddr_t, caddr_t, int, int));
198 void physunaccess __P((caddr_t, int));
199 void setredzone __P((u_int *, caddr_t));
200
201 /*
202 * Prototypes from locore.s
203 */
204 struct fpframe;
205 struct user;
206 struct pcb;
207
208 void clearseg __P((vm_offset_t));
209 void doboot __P((void));
210 u_long getdfc __P((void));
211 u_long getsfc __P((void));
212 void loadustp __P((int));
213 void m68881_save __P((struct fpframe *));
214 void m68881_restore __P((struct fpframe *));
215 void physcopyseg __P((vm_offset_t, vm_offset_t));
216 u_int probeva __P((u_int, u_int));
217 void proc_trampoline __P((void));
218 void savectx __P((struct pcb *));
219 int suline __P((caddr_t, caddr_t));
220 void switch_exit __P((struct proc *));
221 void DCIAS __P((vm_offset_t));
222 void DCIA __P((void));
223 void DCIS __P((void));
224 void DCIU __P((void));
225 void ICIA __P((void));
226 void ICPA __P((void));
227 void PCIA __P((void));
228 void TBIA __P((void));
229 void TBIS __P((vm_offset_t));
230 void TBIAS __P((void));
231 void TBIAU __P((void));
232
233 #if defined(M68040) || defined(M68060)
234 void DCFA __P((void));
235 void DCFP __P((vm_offset_t));
236 void DCFL __P((vm_offset_t));
237 void DCPL __P((vm_offset_t));
238 void DCPP __P((vm_offset_t));
239 void ICPL __P((vm_offset_t));
240 void ICPP __P((vm_offset_t));
241 #endif
242
243 /*
244 * Prototypes from machdep.c:
245 */
246 typedef void (*si_farg)(void *, void *); /* XXX */
247 void add_sicallback __P((si_farg, void *, void *));
248 void rem_sicallback __P((si_farg));
249 struct frame;
250 void regdump __P((struct frame *, int));
251 void cpu_startup __P((void));
252 void dumpsys __P((void));
253 vm_offset_t reserve_dumppages __P((vm_offset_t));
254 void softint __P((void));
255
256
257 /*
258 * Prototypes from nvram.c:
259 */
260 struct uio;
261 int nvram_uio __P((struct uio *));
262
263 /*
264 * Prototypes from sys_machdep.c:
265 */
266 int cachectl __P((int, caddr_t, int));
267 int dma_cachectl __P((caddr_t, int));
268
269 /*
270 * Prototypes from swapgeneric.c:
271 */
272 void setconf __P((void));
273
274 /*
275 * Prototypes from trap.c:
276 */
277 #ifdef _MACHINE_FRAME_H_ /* XXX: We don't want to include this everywhere */
278 void child_return __P((struct proc *, struct frame));
279 #endif
280
281 #endif /* _KERNEL */
282 #endif /* !_MACHINE_CPU_H_ */
283