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