1 /*
2 ** asm/setup.h -- Definition of the Linux/m68k setup information
3 **
4 ** Copyright 1992 by Greg Harp
5 **
6 ** This file is subject to the terms and conditions of the GNU General Public
7 ** License.  See the file COPYING in the main directory of this archive
8 ** for more details.
9 **
10 ** Created 09/29/92 by Greg Harp
11 **
12 ** 5/2/94 Roman Hodek:
13 **   Added bi_atari part of the machine dependent union bi_un; for now it
14 **   contains just a model field to distinguish between TT and Falcon.
15 ** 26/7/96 Roman Zippel:
16 **   Renamed to setup.h; added some useful macros to allow gcc some
17 **   optimizations if possible.
18 ** 5/10/96 Geert Uytterhoeven:
19 **   Redesign of the boot information structure; moved boot information
20 **   structure to bootinfo.h
21 */
22 
23 #ifndef _M68K_SETUP_H
24 #define _M68K_SETUP_H
25 
26 #include <linux/config.h>
27 
28 
29     /*
30      *  Linux/m68k Architectures
31      */
32 
33 #define MACH_AMIGA    1
34 #define MACH_ATARI    2
35 #define MACH_MAC      3
36 #define MACH_APOLLO   4
37 #define MACH_SUN3     5
38 #define MACH_MVME147  6
39 #define MACH_MVME16x  7
40 #define MACH_BVME6000 8
41 #define MACH_HP300    9
42 #define MACH_Q40     10
43 #define MACH_SUN3X   11
44 
45 #ifdef __KERNEL__
46 
47 #ifndef __ASSEMBLY__
48 extern unsigned long m68k_machtype;
49 #endif /* !__ASSEMBLY__ */
50 
51 #if !defined(CONFIG_AMIGA)
52 #  define MACH_IS_AMIGA (0)
53 #elif defined(CONFIG_ATARI) || defined(CONFIG_MAC) || defined(CONFIG_APOLLO) \
54 	|| defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000)               \
55 	|| defined(CONFIG_HP300) || defined(CONFIG_Q40)                      \
56 	|| defined(CONFIG_SUN3X) || defined(CONFIG_MVME147)
57 #  define MACH_IS_AMIGA (m68k_machtype == MACH_AMIGA)
58 #else
59 #  define MACH_AMIGA_ONLY
60 #  define MACH_IS_AMIGA (1)
61 #  define MACH_TYPE (MACH_AMIGA)
62 #endif
63 
64 #if !defined(CONFIG_ATARI)
65 #  define MACH_IS_ATARI (0)
66 #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_APOLLO) \
67 	|| defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000)               \
68 	|| defined(CONFIG_HP300) || defined(CONFIG_Q40)                      \
69 	|| defined(CONFIG_SUN3X) || defined(CONFIG_MVME147)
70 #  define MACH_IS_ATARI (m68k_machtype == MACH_ATARI)
71 #else
72 #  define MACH_ATARI_ONLY
73 #  define MACH_IS_ATARI (1)
74 #  define MACH_TYPE (MACH_ATARI)
75 #endif
76 
77 #if !defined(CONFIG_MAC)
78 #  define MACH_IS_MAC (0)
79 #elif defined(CONFIG_AMIGA) || defined(CONFIG_ATARI) || defined(CONFIG_APOLLO) \
80 	|| defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000)                 \
81 	|| defined(CONFIG_HP300) || defined(CONFIG_Q40)                        \
82 	|| defined(CONFIG_SUN3X) || defined(CONFIG_MVME147)
83 #  define MACH_IS_MAC (m68k_machtype == MACH_MAC)
84 #else
85 #  define MACH_MAC_ONLY
86 #  define MACH_IS_MAC (1)
87 #  define MACH_TYPE (MACH_MAC)
88 #endif
89 
90 #if defined(CONFIG_SUN3)
91 #define MACH_IS_SUN3 (1)
92 #define MACH_SUN3_ONLY (1)
93 #define MACH_TYPE (MACH_SUN3)
94 #else
95 #define MACH_IS_SUN3 (0)
96 #endif
97 
98 #if !defined (CONFIG_APOLLO)
99 #  define MACH_IS_APOLLO (0)
100 #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \
101 	|| defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000)              \
102 	|| defined(CONFIG_HP300) || defined(CONFIG_Q40)                     \
103 	|| defined(CONFIG_SUN3X) || defined(CONFIG_MVME147)
104 #  define MACH_IS_APOLLO (m68k_machtype == MACH_APOLLO)
105 #else
106 #  define MACH_APOLLO_ONLY
107 #  define MACH_IS_APOLLO (1)
108 #  define MACH_TYPE (MACH_APOLLO)
109 #endif
110 
111 #if !defined (CONFIG_MVME147)
112 #  define MACH_IS_MVME147 (0)
113 #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \
114 	|| defined(CONFIG_APOLLO) || defined(CONFIG_BVME6000)               \
115 	|| defined(CONFIG_HP300) || defined(CONFIG_Q40)                     \
116 	|| defined(CONFIG_SUN3X) || defined(CONFIG_MVME16x)
117 #  define MACH_IS_MVME147 (m68k_machtype == MACH_MVME147)
118 #else
119 #  define MACH_MVME147_ONLY
120 #  define MACH_IS_MVME147 (1)
121 #  define MACH_TYPE (MACH_MVME147)
122 #endif
123 
124 #if !defined (CONFIG_MVME16x)
125 #  define MACH_IS_MVME16x (0)
126 #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \
127 	|| defined(CONFIG_APOLLO) || defined(CONFIG_BVME6000)               \
128 	|| defined(CONFIG_HP300) || defined(CONFIG_Q40)                     \
129 	|| defined(CONFIG_SUN3X) || defined(CONFIG_MVME147)
130 #  define MACH_IS_MVME16x (m68k_machtype == MACH_MVME16x)
131 #else
132 #  define MACH_MVME16x_ONLY
133 #  define MACH_IS_MVME16x (1)
134 #  define MACH_TYPE (MACH_MVME16x)
135 #endif
136 
137 #if !defined (CONFIG_BVME6000)
138 #  define MACH_IS_BVME6000 (0)
139 #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \
140 	|| defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x)                \
141 	|| defined(CONFIG_HP300) || defined(CONFIG_Q40)                     \
142 	|| defined(CONFIG_SUN3X) || defined(CONFIG_MVME147)
143 #  define MACH_IS_BVME6000 (m68k_machtype == MACH_BVME6000)
144 #else
145 #  define MACH_BVME6000_ONLY
146 #  define MACH_IS_BVME6000 (1)
147 #  define MACH_TYPE (MACH_BVME6000)
148 #endif
149 
150 #if !defined (CONFIG_HP300)
151 #  define MACH_IS_HP300 (0)
152 #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \
153 	|| defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \
154 	|| defined(CONFIG_BVME6000) || defined(CONFIG_Q40) \
155 	|| defined(CONFIG_SUN3X) || defined(CONFIG_MVME147)
156 #  define MACH_IS_HP300 (m68k_machtype == MACH_HP300)
157 #else
158 #  define MACH_HP300_ONLY
159 #  define MACH_IS_HP300 (1)
160 #  define MACH_TYPE (MACH_HP300)
161 #endif
162 
163 #if !defined (CONFIG_Q40)
164 #  define MACH_IS_Q40 (0)
165 #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \
166 	|| defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x)                \
167 	|| defined(CONFIG_BVME6000) || defined(CONFIG_HP300)                \
168 	|| defined(CONFIG_SUN3X) || defined(CONFIG_MVME147)
169 #  define MACH_IS_Q40 (m68k_machtype == MACH_Q40)
170 #else
171 #  define MACH_Q40_ONLY
172 #  define MACH_IS_Q40 (1)
173 #  define MACH_TYPE (MACH_Q40)
174 #endif
175 
176 #if !defined (CONFIG_SUN3X)
177 #  define MACH_IS_SUN3X (0)
178 #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \
179 	|| defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x)                \
180 	|| defined(CONFIG_BVME6000) || defined(CONFIG_HP300)                \
181 	|| defined(CONFIG_Q40) || defined(CONFIG_MVME147)
182 #  define MACH_IS_SUN3X (m68k_machtype == MACH_SUN3X)
183 #else
184 #  define CONFIG_SUN3X_ONLY
185 #  define MACH_IS_SUN3X (1)
186 #  define MACH_TYPE (MACH_SUN3X)
187 #endif
188 
189 #ifndef MACH_TYPE
190 #  define MACH_TYPE (m68k_machtype)
191 #endif
192 
193 #endif /* __KERNEL__ */
194 
195 
196     /*
197      *  CPU, FPU and MMU types
198      *
199      *  Note: we may rely on the following equalities:
200      *
201      *      CPU_68020 == MMU_68851
202      *      CPU_68030 == MMU_68030
203      *      CPU_68040 == FPU_68040 == MMU_68040
204      *      CPU_68060 == FPU_68060 == MMU_68060
205      */
206 
207 #define CPUB_68020     0
208 #define CPUB_68030     1
209 #define CPUB_68040     2
210 #define CPUB_68060     3
211 
212 #define CPU_68020      (1<<CPUB_68020)
213 #define CPU_68030      (1<<CPUB_68030)
214 #define CPU_68040      (1<<CPUB_68040)
215 #define CPU_68060      (1<<CPUB_68060)
216 
217 #define FPUB_68881     0
218 #define FPUB_68882     1
219 #define FPUB_68040     2                       /* Internal FPU */
220 #define FPUB_68060     3                       /* Internal FPU */
221 #define FPUB_SUNFPA    4                       /* Sun-3 FPA */
222 
223 #define FPU_68881      (1<<FPUB_68881)
224 #define FPU_68882      (1<<FPUB_68882)
225 #define FPU_68040      (1<<FPUB_68040)
226 #define FPU_68060      (1<<FPUB_68060)
227 #define FPU_SUNFPA     (1<<FPUB_SUNFPA)
228 
229 #define MMUB_68851     0
230 #define MMUB_68030     1                       /* Internal MMU */
231 #define MMUB_68040     2                       /* Internal MMU */
232 #define MMUB_68060     3                       /* Internal MMU */
233 #define MMUB_APOLLO    4                       /* Custom Apollo */
234 #define MMUB_SUN3      5                       /* Custom Sun-3 */
235 
236 #define MMU_68851      (1<<MMUB_68851)
237 #define MMU_68030      (1<<MMUB_68030)
238 #define MMU_68040      (1<<MMUB_68040)
239 #define MMU_68060      (1<<MMUB_68060)
240 #define MMU_SUN3       (1<<MMUB_SUN3)
241 #define MMU_APOLLO     (1<<MMUB_APOLLO)
242 
243 #ifdef __KERNEL__
244 
245 #ifndef __ASSEMBLY__
246 extern unsigned long m68k_cputype;
247 extern unsigned long m68k_fputype;
248 extern unsigned long m68k_mmutype;		/* Not really used yet */
249 #ifdef CONFIG_VME
250 extern unsigned long vme_brdtype;
251 #endif
252 
253     /*
254      *  m68k_is040or060 is != 0 for a '040 or higher;
255      *  used numbers are 4 for 68040 and 6 for 68060.
256      */
257 
258 extern int m68k_is040or060;
259 #endif /* !__ASSEMBLY__ */
260 
261 #if !defined(CONFIG_M68020)
262 #  define CPU_IS_020 (0)
263 #  define MMU_IS_851 (0)
264 #  define MMU_IS_SUN3 (0)
265 #elif defined(CONFIG_M68030) || defined(CONFIG_M68040) || defined(CONFIG_M68060)
266 #  define CPU_IS_020 (m68k_cputype & CPU_68020)
267 #  define MMU_IS_851 (m68k_cputype & MMU_68851)
268 #  define MMU_IS_SUN3 (0)	/* Sun3 not supported with other CPU enabled */
269 #else
270 #  define CPU_M68020_ONLY
271 #  define CPU_IS_020 (1)
272 #ifdef MACH_SUN3_ONLY
273 #  define MMU_IS_SUN3 (1)
274 #  define MMU_IS_851 (0)
275 #else
276 #  define MMU_IS_SUN3 (0)
277 #  define MMU_IS_851 (1)
278 #endif
279 #endif
280 
281 #if !defined(CONFIG_M68030)
282 #  define CPU_IS_030 (0)
283 #  define MMU_IS_030 (0)
284 #elif defined(CONFIG_M68020) || defined(CONFIG_M68040) || defined(CONFIG_M68060)
285 #  define CPU_IS_030 (m68k_cputype & CPU_68030)
286 #  define MMU_IS_030 (m68k_mmutype & MMU_68030)
287 #else
288 #  define CPU_M68030_ONLY
289 #  define CPU_IS_030 (1)
290 #  define MMU_IS_030 (1)
291 #endif
292 
293 #if !defined(CONFIG_M68040)
294 #  define CPU_IS_040 (0)
295 #  define MMU_IS_040 (0)
296 #elif defined(CONFIG_M68020) || defined(CONFIG_M68030) || defined(CONFIG_M68060)
297 #  define CPU_IS_040 (m68k_cputype & CPU_68040)
298 #  define MMU_IS_040 (m68k_mmutype & MMU_68040)
299 #else
300 #  define CPU_M68040_ONLY
301 #  define CPU_IS_040 (1)
302 #  define MMU_IS_040 (1)
303 #endif
304 
305 #if !defined(CONFIG_M68060)
306 #  define CPU_IS_060 (0)
307 #  define MMU_IS_060 (0)
308 #elif defined(CONFIG_M68020) || defined(CONFIG_M68030) || defined(CONFIG_M68040)
309 #  define CPU_IS_060 (m68k_cputype & CPU_68060)
310 #  define MMU_IS_060 (m68k_mmutype & MMU_68060)
311 #else
312 #  define CPU_M68060_ONLY
313 #  define CPU_IS_060 (1)
314 #  define MMU_IS_060 (1)
315 #endif
316 
317 #if !defined(CONFIG_M68020) && !defined(CONFIG_M68030)
318 #  define CPU_IS_020_OR_030 (0)
319 #else
320 #  define CPU_M68020_OR_M68030
321 #  if defined(CONFIG_M68040) || defined(CONFIG_M68060)
322 #    define CPU_IS_020_OR_030 (!m68k_is040or060)
323 #  else
324 #    define CPU_M68020_OR_M68030_ONLY
325 #    define CPU_IS_020_OR_030 (1)
326 #  endif
327 #endif
328 
329 #if !defined(CONFIG_M68040) && !defined(CONFIG_M68060)
330 #  define CPU_IS_040_OR_060 (0)
331 #else
332 #  define CPU_M68040_OR_M68060
333 #  if defined(CONFIG_M68020) || defined(CONFIG_M68030)
334 #    define CPU_IS_040_OR_060 (m68k_is040or060)
335 #  else
336 #    define CPU_M68040_OR_M68060_ONLY
337 #    define CPU_IS_040_OR_060 (1)
338 #  endif
339 #endif
340 
341 #define CPU_TYPE (m68k_cputype)
342 
343 #ifdef CONFIG_M68KFPU_EMU
344 #  ifdef CONFIG_M68KFPU_EMU_ONLY
345 #    define FPU_IS_EMU (1)
346 #  else
347 #    define FPU_IS_EMU (!m68k_fputype)
348 #  endif
349 #else
350 #  define FPU_IS_EMU (0)
351 #endif
352 
353 
354     /*
355      *  Miscellaneous
356      */
357 
358 #define NUM_MEMINFO	4
359 #define CL_SIZE		256
360 
361 #ifndef __ASSEMBLY__
362 extern int m68k_num_memory;		/* # of memory blocks found (and used) */
363 extern int m68k_realnum_memory;		/* real # of memory blocks found */
364 
365 struct mem_info {
366 	unsigned long addr;		/* physical address of memory chunk */
367 	unsigned long size;		/* length of memory chunk (in bytes) */
368 };
369 
370 extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
371 #endif
372 
373 #endif /* __KERNEL__ */
374 
375 #endif /* _M68K_SETUP_H */
376