cpu.h revision 1.66 1 /* $NetBSD: cpu.h,v 1.66 2011/02/08 20:20:10 rmind 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. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah $Hdr: cpu.h 1.16 91/03/25$
37 *
38 * @(#)cpu.h 7.7 (Berkeley) 6/27/91
39 */
40
41 #ifndef _MACHINE_CPU_H_
42 #define _MACHINE_CPU_H_
43
44 #if defined(_KERNEL)
45
46 /*
47 * Exported definitions unique to atari/68k cpu support.
48 */
49
50 #if defined(_KERNEL_OPT)
51 #include "opt_lockdebug.h"
52 #endif
53
54 /*
55 * Get common m68k CPU definitions.
56 */
57 #include <m68k/cpu.h>
58 #define M68K_MMU_MOTOROLA
59
60 void cpu_proc_fork(struct proc *, struct proc *);
61
62 /*
63 * Arguments to hardclock and gatherstats encapsulate the previous
64 * machine state in an opaque clockframe. On the hp300, we use
65 * what the hardware pushes on an interrupt (frame format 0).
66 */
67 struct clockframe {
68 u_int cf_regs[4]; /* d0,d1,a0,a1 (see locore.s) */
69 u_short cf_sr; /* sr at time of interrupt */
70 u_long cf_pc; /* pc at time of interrupt */
71 u_short cf_vo; /* vector offset (4-word frame) */
72 } __attribute__((packed));
73
74 #define CLKF_USERMODE(framep) (((framep)->cf_sr & PSL_S) == 0)
75 #define CLKF_PC(framep) ((framep)->cf_pc)
76 #if 0
77 /* We would like to do it this way... */
78 #define CLKF_INTR(framep) (((framep)->cf_sr & PSL_M) == 0)
79 #else
80 /* but until we start using PSL_M, we have to do this instead */
81 #define CLKF_INTR(framep) (0) /* XXX */
82 #endif
83
84
85 /*
86 * Preempt the current process if in interrupt from user mode,
87 * or after the current trap/syscall if in system mode.
88 */
89 #define cpu_need_resched(ci,flags) {ci->ci_want_resched = 1; setsoftast();}
90
91 /*
92 * Give a profiling tick to the current process from the softclock
93 * interrupt. On hp300, request an ast to send us through trap(),
94 * marking the proc as needing a profiling tick.
95 */
96 #define profile_tick(l, framep) ((l)->l_pflag |= LP_OWEUPC, setsoftast())
97 #define cpu_need_proftick(l) ((l)->l_pflag |= LP_OWEUPC, setsoftast())
98
99 /*
100 * Notify the current process (p) that it has a signal pending,
101 * process as soon as possible.
102 */
103 #define cpu_signotify(l) setsoftast()
104
105 #define setsoftast() (astpending = 1)
106
107 extern int astpending; /* need trap before returning to user mode */
108
109 /*
110 * The rest of this should probably be moved to ../atari/ataricpu.h,
111 * although some of it could probably be put into generic 68k headers.
112 */
113 #define BASEPRI(sr) ((sr & PSL_IPL) == 0)
114 #endif /* _KERNEL */
115
116 /*
117 * Values for machineid.
118 */
119 #define ATARI_68000 1 /* 68000 CPU */
120 #define ATARI_68010 (1<<1) /* 68010 CPU */
121 #define ATARI_68020 (1L<<2) /* 68020 CPU */
122 #define ATARI_68030 (1L<<3) /* 68030 CPU */
123 #define ATARI_68040 (1L<<4) /* 68040 CPU */
124 #define ATARI_68060 (1L<<6) /* 68060 CPU */
125 #define ATARI_TT (1L<<11) /* This is a TT030 */
126 #define ATARI_FALCON (1L<<12) /* Falcon */
127 #define ATARI_HADES (1L<<13) /* Hades */
128 #define ATARI_MILAN (1L<<14) /* Milan */
129
130 #define ATARI_CLKBROKEN (1L<<16)
131
132 #define ATARI_ANYCPU (ATARI_68000|ATARI_68010|ATARI_68020|ATARI_68030 \
133 |ATARI_68040|ATARI_68060)
134
135 #define ATARI_ANYMACH (ATARI_TT|ATARI_FALCON|ATARI_HADES|ATARI_MILAN)
136
137 #if defined(_KERNEL)
138 extern int machineid;
139 #endif /* _KERNEL */
140
141 /*
142 * CTL_MACHDEP definitions.
143 */
144 #define CPU_CONSDEV 1 /* dev_t: console terminal device */
145 #define CPU_MAXID 2 /* number of valid machdep ids */
146
147 #ifdef _KERNEL
148 /*
149 * Prototypes from atari_init.c
150 */
151 int cpu_dump(int (*)(dev_t, daddr_t, void *, size_t), daddr_t *);
152 int cpu_dumpsize(void);
153
154 /*
155 * Prototypes from autoconf.c
156 */
157 void config_console(void);
158
159 /*
160 * Prototypes from fpu.c
161 */
162 const char *fpu_describe(int);
163 int fpu_probe(void);
164
165 /*
166 * Prototypes from locore.s
167 */
168 struct fpframe;
169
170 void clearseg(paddr_t);
171 void doboot(void);
172 void loadustp(int);
173 void m68881_save(struct fpframe *);
174 void m68881_restore(struct fpframe *);
175 void physcopyseg(paddr_t, paddr_t);
176 u_int probeva(u_int, u_int);
177 int suline(void *, void *);
178
179 /*
180 * Prototypes from machdep.c:
181 */
182 int badbaddr(void *, int);
183 void consinit(void);
184 typedef void (*si_farg)(void *, void *); /* XXX */
185 void init_sicallback(void); /* XXX */
186 void add_sicallback(si_farg, void *, void *);
187 void rem_sicallback(si_farg);
188 void dumpsys(void);
189 vaddr_t reserve_dumppages(vaddr_t);
190
191
192 /*
193 * Prototypes from nvram.c:
194 */
195 struct uio;
196 int nvram_uio(struct uio *);
197
198 /*
199 * Prototypes from pci_machdep.c
200 */
201 void init_pci_bus(void);
202
203 #endif /* _KERNEL */
204 #endif /* !_MACHINE_CPU_H_ */
205