cpu.h revision 1.13 1 1.13 jonathan /* $NetBSD: cpu.h,v 1.13 1996/03/19 02:42:28 jonathan Exp $ */
2 1.8 cgd
3 1.1 deraadt /*-
4 1.5 glass * Copyright (c) 1992, 1993
5 1.5 glass * The Regents of the University of California. All rights reserved.
6 1.1 deraadt *
7 1.1 deraadt * This code is derived from software contributed to Berkeley by
8 1.1 deraadt * Ralph Campbell and Rick Macklem.
9 1.1 deraadt *
10 1.1 deraadt * Redistribution and use in source and binary forms, with or without
11 1.1 deraadt * modification, are permitted provided that the following conditions
12 1.1 deraadt * are met:
13 1.1 deraadt * 1. Redistributions of source code must retain the above copyright
14 1.1 deraadt * notice, this list of conditions and the following disclaimer.
15 1.1 deraadt * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 deraadt * notice, this list of conditions and the following disclaimer in the
17 1.1 deraadt * documentation and/or other materials provided with the distribution.
18 1.1 deraadt * 3. All advertising materials mentioning features or use of this software
19 1.1 deraadt * must display the following acknowledgement:
20 1.1 deraadt * This product includes software developed by the University of
21 1.1 deraadt * California, Berkeley and its contributors.
22 1.1 deraadt * 4. Neither the name of the University nor the names of its contributors
23 1.1 deraadt * may be used to endorse or promote products derived from this software
24 1.1 deraadt * without specific prior written permission.
25 1.1 deraadt *
26 1.1 deraadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 1.1 deraadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 1.1 deraadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 1.1 deraadt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 1.1 deraadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 1.1 deraadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 1.1 deraadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 1.1 deraadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 1.1 deraadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 1.1 deraadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 1.1 deraadt * SUCH DAMAGE.
37 1.1 deraadt *
38 1.8 cgd * @(#)cpu.h 8.4 (Berkeley) 1/4/94
39 1.1 deraadt */
40 1.1 deraadt
41 1.1 deraadt #ifndef _CPU_H_
42 1.1 deraadt #define _CPU_H_
43 1.1 deraadt
44 1.1 deraadt #include <machine/machConst.h>
45 1.1 deraadt
46 1.1 deraadt /*
47 1.13 jonathan * Exported definitions unique to NetBSD/mips cpu support.
48 1.1 deraadt */
49 1.1 deraadt
50 1.1 deraadt /*
51 1.1 deraadt * definitions of cpu-dependent requirements
52 1.1 deraadt * referenced in generic code
53 1.1 deraadt */
54 1.11 cgd #define cpu_wait(p) /* nothing */
55 1.11 cgd #define cpu_set_init_frame(p, fp) /* nothing */
56 1.11 cgd #define cpu_swapout(p) panic("cpu_swapout: can't get here");
57 1.1 deraadt
58 1.1 deraadt /*
59 1.1 deraadt * Arguments to hardclock and gatherstats encapsulate the previous
60 1.1 deraadt * machine state in an opaque clockframe.
61 1.1 deraadt */
62 1.5 glass struct clockframe {
63 1.1 deraadt int pc; /* program counter at time of interrupt */
64 1.1 deraadt int sr; /* status register at time of interrupt */
65 1.5 glass };
66 1.1 deraadt
67 1.1 deraadt #define CLKF_USERMODE(framep) ((framep)->sr & MACH_SR_KU_PREV)
68 1.1 deraadt #define CLKF_BASEPRI(framep) \
69 1.1 deraadt ((~(framep)->sr & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == 0)
70 1.1 deraadt #define CLKF_PC(framep) ((framep)->pc)
71 1.1 deraadt #define CLKF_INTR(framep) (0)
72 1.1 deraadt
73 1.1 deraadt /*
74 1.1 deraadt * Preempt the current process if in interrupt from user mode,
75 1.1 deraadt * or after the current trap/syscall if in system mode.
76 1.1 deraadt */
77 1.1 deraadt #define need_resched() { want_resched = 1; aston(); }
78 1.1 deraadt
79 1.1 deraadt /*
80 1.1 deraadt * Give a profiling tick to the current process when the user profiling
81 1.13 jonathan * buffer pages are invalid. On the MIPS, request an ast to send us
82 1.1 deraadt * through trap, marking the proc as needing a profiling tick.
83 1.1 deraadt */
84 1.5 glass #define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); }
85 1.1 deraadt
86 1.1 deraadt /*
87 1.1 deraadt * Notify the current process (p) that it has a signal pending,
88 1.1 deraadt * process as soon as possible.
89 1.1 deraadt */
90 1.1 deraadt #define signotify(p) aston()
91 1.1 deraadt
92 1.1 deraadt #define aston() (astpending = 1)
93 1.1 deraadt
94 1.1 deraadt int astpending; /* need to trap before returning to user mode */
95 1.1 deraadt int want_resched; /* resched() was called */
96 1.1 deraadt
97 1.1 deraadt /*
98 1.1 deraadt * CPU identification, from PRID register.
99 1.1 deraadt */
100 1.1 deraadt union cpuprid {
101 1.1 deraadt int cpuprid;
102 1.1 deraadt struct {
103 1.1 deraadt #if BYTE_ORDER == BIG_ENDIAN
104 1.1 deraadt u_int pad1:16; /* reserved */
105 1.1 deraadt u_int cp_imp:8; /* implementation identifier */
106 1.1 deraadt u_int cp_majrev:4; /* major revision identifier */
107 1.1 deraadt u_int cp_minrev:4; /* minor revision identifier */
108 1.1 deraadt #else
109 1.1 deraadt u_int cp_minrev:4; /* minor revision identifier */
110 1.1 deraadt u_int cp_majrev:4; /* major revision identifier */
111 1.1 deraadt u_int cp_imp:8; /* implementation identifier */
112 1.1 deraadt u_int pad1:16; /* reserved */
113 1.1 deraadt #endif
114 1.1 deraadt } cpu;
115 1.1 deraadt };
116 1.5 glass
117 1.5 glass /*
118 1.5 glass * CTL_MACHDEP definitions.
119 1.5 glass */
120 1.5 glass #define CPU_CONSDEV 1 /* dev_t: console terminal device */
121 1.5 glass #define CPU_MAXID 2 /* number of valid machdep ids */
122 1.5 glass
123 1.5 glass #define CTL_MACHDEP_NAMES { \
124 1.5 glass { 0, 0 }, \
125 1.5 glass { "console_device", CTLTYPE_STRUCT }, \
126 1.5 glass }
127 1.1 deraadt
128 1.13 jonathan
129 1.1 deraadt /*
130 1.1 deraadt * MIPS CPU types (cp_imp).
131 1.1 deraadt */
132 1.13 jonathan #define MIPS_R2000 0x01 /* MIPS R2000 CPU ISA I */
133 1.13 jonathan #define MIPS_R3000 0x02 /* MIPS R3000 CPU ISA I */
134 1.13 jonathan #define MIPS_R6000 0x03 /* MIPS R6000 CPU ISA II */
135 1.13 jonathan #define MIPS_R4000 0x04 /* MIPS R4000/4400 CPU ISA III */
136 1.13 jonathan #define MIPS_R3LSI 0x05 /* LSI Logic R3000 derivate ISA I */
137 1.13 jonathan #define MIPS_R6000A 0x06 /* MIPS R6000A CPU ISA II */
138 1.13 jonathan #define MIPS_R3IDT 0x07 /* IDT R3000 derivate ISA I */
139 1.13 jonathan #define MIPS_R10000 0x09 /* MIPS R10000/T5 CPU ISA IV */
140 1.13 jonathan #define MIPS_R4200 0x0a /* MIPS R4200 CPU (ICE) ISA III */
141 1.13 jonathan #define MIPS_UNKC1 0x0b /* unnanounced product cpu ISA III */
142 1.13 jonathan #define MIPS_UNKC2 0x0c /* unnanounced product cpu ISA III */
143 1.13 jonathan #define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */
144 1.13 jonathan #define MIPS_R4600 0x20 /* QED R4600 Orion ISA III */
145 1.13 jonathan #define MIPS_R3SONY 0x21 /* Sony R3000 based CPU ISA I */
146 1.13 jonathan #define MIPS_R3TOSH 0x22 /* Toshiba R3000 based CPU ISA I */
147 1.13 jonathan #define MIPS_R3NKK 0x23 /* NKK R3000 based CPU ISA I */
148 1.13 jonathan
149 1.1 deraadt
150 1.1 deraadt /*
151 1.1 deraadt * MIPS FPU types
152 1.1 deraadt */
153 1.13 jonathan #define MIPS_SOFT 0x00 /* Software emulation ISA I */
154 1.13 jonathan #define MIPS_R2360 0x01 /* MIPS R2360 FPC ISA I */
155 1.13 jonathan #define MIPS_R2010 0x02 /* MIPS R2010 FPC ISA I */
156 1.13 jonathan #define MIPS_R3010 0x03 /* MIPS R3010 FPC ISA I */
157 1.13 jonathan #define MIPS_R6010 0x04 /* MIPS R6010 FPC ISA II */
158 1.13 jonathan #define MIPS_R4010 0x05 /* MIPS R4000/R4400 FPC ISA II */
159 1.13 jonathan #define MIPS_R31LSI 0x06 /* LSI Logic derivate ISA I */
160 1.13 jonathan #define MIPS_R10010 0x09 /* MIPS R10000/T5 FPU ISA IV */
161 1.13 jonathan #define MIPS_R4210 0x0a /* MIPS R4200 FPC (ICE) ISA III */
162 1.13 jonathan #define MIPS_UNKF1 0x0b /* unnanounced product cpu ISA III */
163 1.13 jonathan #define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */
164 1.13 jonathan #define MIPS_R4600 0x20 /* QED R4600 Orion ISA III */
165 1.13 jonathan #define MIPS_R3SONY 0x21 /* Sony R3000 based FPU ISA I */
166 1.13 jonathan #define MIPS_R3TOSH 0x22 /* Toshiba R3000 based FPU ISA I */
167 1.13 jonathan #define MIPS_R3NKK 0x23 /* NKK R3000 based FPU ISA I */
168 1.13 jonathan
169 1.1 deraadt
170 1.9 jtc #ifdef _KERNEL
171 1.1 deraadt union cpuprid cpu;
172 1.1 deraadt union cpuprid fpu;
173 1.1 deraadt u_int machDataCacheSize;
174 1.1 deraadt u_int machInstCacheSize;
175 1.1 deraadt extern struct intr_tab intr_tab[];
176 1.1 deraadt #endif
177 1.1 deraadt
178 1.1 deraadt /*
179 1.1 deraadt * Enable realtime clock (always enabled).
180 1.1 deraadt */
181 1.1 deraadt #define enablertclock()
182 1.1 deraadt
183 1.1 deraadt #endif /* _CPU_H_ */
184