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