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