cpu.h revision 1.1 1 /* $NetBSD: cpu.h,v 1.1 1999/12/09 14:53:10 tsutsui Exp $ */
2
3 /*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1982, 1990, 1993
6 * The Regents of the University of California. 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 8.4 (Berkeley) 1/5/94
43 */
44
45 #ifndef _NEWS68K_CPU_H_
46 #define _NEWS68K_CPU_H_
47
48 /*
49 * Exported definitions unique to news68k cpu support.
50 */
51
52 /*
53 * Get common m68k CPU definitions.
54 */
55 #include <m68k/cpu.h>
56
57 /*
58 * XXX news1700 L2 cache would be corrupted with DC_BE and IC_BE...
59 * XXX Should these be defined in machine/cpu.h?
60 */
61 #undef CACHE_ON
62 #undef CACHE_CLR
63 #undef IC_CLEAR
64 #undef DC_CLEAR
65 #define CACHE_ON (DC_WA|DC_CLR|DC_ENABLE|IC_CLR|IC_ENABLE)
66 #define CACHE_CLR CACHE_ON
67 #define IC_CLEAR (DC_WA|DC_ENABLE|IC_CLR|IC_ENABLE)
68 #define DC_CLEAR (DC_WA|DC_CLR|DC_ENABLE|IC_ENABLE)
69
70 /*
71 * Get interrupt glue.
72 */
73 #include <machine/intr.h>
74
75 #define M68K_MMU_MOTOROLA
76
77 #if defined(news1700)
78 #define CACHE_HAVE_PAC
79 #endif
80
81 /*
82 * definitions of cpu-dependent requirements
83 * referenced in generic code
84 */
85 #define cpu_swapin(p) /* nothing */
86 #define cpu_wait(p) /* nothing */
87 #define cpu_swapout(p) /* nothing */
88 #define cpu_number() 0
89
90 /*
91 * Arguments to hardclock and gatherstats encapsulate the previous
92 * machine state in an opaque clockframe. One the hp300, we use
93 * what the hardware pushes on an interrupt (frame format 0).
94 */
95 struct clockframe {
96 u_short sr; /* sr at time of interrupt */
97 u_long pc; /* pc at time of interrupt */
98 u_short vo; /* vector offset (4-word frame) */
99 };
100
101 #define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0)
102 #define CLKF_BASEPRI(framep) (((framep)->sr & PSL_IPL) == 0)
103 #define CLKF_PC(framep) ((framep)->pc)
104 #if 0
105 /* We would like to do it this way... */
106 #define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0)
107 #else
108 /* but until we start using PSL_M, we have to do this instead */
109 #define CLKF_INTR(framep) (0) /* XXX */
110 #endif
111
112
113 /*
114 * Preempt the current process if in interrupt from user mode,
115 * or after the current trap/syscall if in system mode.
116 */
117 extern int want_resched; /* resched() was called */
118 #define need_resched() { want_resched++; aston(); }
119
120 /*
121 * Give a profiling tick to the current process when the user profiling
122 * buffer pages are invalid. On the hp300, request an ast to send us
123 * through trap, marking the proc as needing a profiling tick.
124 */
125 #define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); }
126
127 /*
128 * Notify the current process (p) that it has a signal pending,
129 * process as soon as possible.
130 */
131 #define signotify(p) aston()
132
133 extern int astpending; /* need to trap before returning to user mode */
134 #define aston() (astpending++)
135
136 /*
137 * CTL_MACHDEP definitions.
138 */
139 #define CPU_CONSDEV 1 /* dev_t: console terminal device */
140 #define CPU_MAXID 2 /* number of valid machdep ids */
141
142 #define CTL_MACHDEP_NAMES { \
143 { 0, 0 }, \
144 { "console_device", CTLTYPE_STRUCT }, \
145 }
146
147 #ifdef _KERNEL
148
149 #if defined(news1700) && !defined(M68030)
150 #define M68030
151 #endif
152
153 #endif
154
155 #ifdef _KERNEL
156 extern int machineid;
157 extern int cpuspeed;
158 extern char *intiobase, *intiolimit;
159 extern u_int intiobase_phys, intiotop_phys;
160 extern u_int extiobase_phys, extiotop_phys;
161 extern u_int intrcnt[];
162
163 extern void (*vectab[]) __P((void));
164
165 struct frame;
166 struct fpframe;
167 struct pcb;
168
169 /* locore.s functions */
170 void m68881_save __P((struct fpframe *));
171 void m68881_restore __P((struct fpframe *));
172 void DCIA __P((void));
173 void DCIS __P((void));
174 void DCIU __P((void));
175 void ICIA __P((void));
176 void ICPA __P((void));
177 void PCIA __P((void));
178 void TBIA __P((void));
179 void TBIS __P((vaddr_t));
180 void TBIAS __P((void));
181 void TBIAU __P((void));
182
183 int suline __P((caddr_t, caddr_t));
184 void savectx __P((struct pcb *));
185 void switch_exit __P((struct proc *));
186 void proc_trampoline __P((void));
187 void loadustp __P((int));
188 void badtrap __P((void));
189 void intrhand_vectored __P((void));
190 int getsr __P((void));
191
192
193 void doboot __P((int))
194 __attribute__((__noreturn__));
195 void nmihand __P((struct frame *));
196 void ecacheon __P((void));
197 void ecacheoff __P((void));
198
199 /* clock.c functions */
200 #if 0 /* XXX not yet */
201 void news68k_calibrate_delay __P((void));
202 #endif
203
204 /* machdep.c functions */
205 int badaddr __P((caddr_t, int));
206 int badbaddr __P((caddr_t));
207
208 /* sys_machdep.c functions */
209 int cachectl1 __P((unsigned long, vaddr_t, size_t, struct proc *));
210
211 /* vm_machdep.c functions */
212 void physaccess __P((caddr_t, caddr_t, int, int));
213 void physunaccess __P((caddr_t, int));
214 int kvtop __P((caddr_t));
215
216 /* trap.c functions */
217 void child_return __P((void *));
218
219 #endif
220
221 /* physical memory sections */
222 #define ROMBASE (0xe0000000)
223 #define INTIOBASE1700 (0xe0c00000)
224 #define INTIOTOP1700 (0xe1d00000) /* XXX */
225 #define EXTIOBASE1700 (0xf0f00000)
226 #define EXTIOTOP1700 (0xf1000000) /* XXX */
227 #define MAXADDR (0xfffff000)
228
229 /*
230 * Internal IO space:
231 *
232 * Internal IO space is mapped in the kernel from ``intiobase'' to
233 * ``intiolimit'' (defined in locore.s). Since it is always mapped,
234 * conversion between physical and kernel virtual addresses is easy.
235 */
236 #define ISIIOVA(va) \
237 ((char *)(va) >= intiobase && (char *)(va) < intiolimit)
238 #define IIOV(pa) (((u_int)(pa) - intiobase_phys) + (u_int)intiobase)
239 #define IIOP(va) (((u_int)(va) - (u_int)intiobase) + intiobase_phys)
240 #define IIOPOFF(pa) ((u_int)(pa) - intiobase_phys)
241
242 #endif /* !_NEWS68K_CPU_H_ */
243