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