blob: 3a1c0b2862ed89cae32a4496b4c3df3012545d6f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/m68k/mac/config.c
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file COPYING in the main directory of this archive
6 * for more details.
7 */
8
9/*
10 * Miscellaneous linux stuff
11 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/module.h>
14#include <linux/types.h>
15#include <linux/mm.h>
16#include <linux/tty.h>
17#include <linux/console.h>
18#include <linux/interrupt.h>
19/* keyb */
20#include <linux/random.h>
21#include <linux/delay.h>
22/* keyb */
23#include <linux/init.h>
24#include <linux/vt_kern.h>
25
26#define BOOTINFO_COMPAT_1_0
27#include <asm/setup.h>
28#include <asm/bootinfo.h>
29
30#include <asm/system.h>
31#include <asm/io.h>
32#include <asm/irq.h>
33#include <asm/pgtable.h>
34#include <asm/rtc.h>
35#include <asm/machdep.h>
36
37#include <asm/macintosh.h>
38#include <asm/macints.h>
39#include <asm/machw.h>
40
41#include <asm/mac_iop.h>
42#include <asm/mac_via.h>
43#include <asm/mac_oss.h>
44#include <asm/mac_psc.h>
45
46/* Mac bootinfo struct */
47
48struct mac_booter_data mac_bi_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Linus Torvalds1da177e2005-04-16 15:20:36 -070050/* The phys. video addr. - might be bogus on some machines */
Adrian Bunk8dfbdf42008-07-17 21:16:25 +020051static unsigned long mac_orig_videoaddr;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
53/* Mac specific timer functions */
Roman Zippel6ff58012007-05-01 22:32:43 +020054extern unsigned long mac_gettimeoffset(void);
55extern int mac_hwclk(int, struct rtc_time *);
56extern int mac_set_clock_mmss(unsigned long);
Linus Torvalds1da177e2005-04-16 15:20:36 -070057extern void iop_preinit(void);
58extern void iop_init(void);
59extern void via_init(void);
David Howells40220c12006-10-09 12:19:47 +010060extern void via_init_clock(irq_handler_t func);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061extern void via_flush_cache(void);
62extern void oss_init(void);
63extern void psc_init(void);
64extern void baboon_init(void);
65
66extern void mac_mksound(unsigned int, unsigned int);
67
68extern void nubus_sweep_video(void);
69
Linus Torvalds1da177e2005-04-16 15:20:36 -070070static void mac_get_model(char *str);
Adrian Bunk8dfbdf42008-07-17 21:16:25 +020071static void mac_identify(void);
72static void mac_report_hardware(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070073
Al Viro66a3f822007-07-20 04:33:28 +010074static void __init mac_sched_init(irq_handler_t vector)
Linus Torvalds1da177e2005-04-16 15:20:36 -070075{
76 via_init_clock(vector);
77}
78
Linus Torvalds1da177e2005-04-16 15:20:36 -070079/*
80 * Parse a Macintosh-specific record in the bootinfo
81 */
82
83int __init mac_parse_bootinfo(const struct bi_record *record)
84{
Roman Zippel6ff58012007-05-01 22:32:43 +020085 int unknown = 0;
86 const u_long *data = record->data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
Roman Zippel6ff58012007-05-01 22:32:43 +020088 switch (record->tag) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 case BI_MAC_MODEL:
Roman Zippel6ff58012007-05-01 22:32:43 +020090 mac_bi_data.id = *data;
91 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 case BI_MAC_VADDR:
Roman Zippel6ff58012007-05-01 22:32:43 +020093 mac_bi_data.videoaddr = *data;
94 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 case BI_MAC_VDEPTH:
Roman Zippel6ff58012007-05-01 22:32:43 +020096 mac_bi_data.videodepth = *data;
97 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 case BI_MAC_VROW:
Roman Zippel6ff58012007-05-01 22:32:43 +020099 mac_bi_data.videorow = *data;
100 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 case BI_MAC_VDIM:
Roman Zippel6ff58012007-05-01 22:32:43 +0200102 mac_bi_data.dimensions = *data;
103 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 case BI_MAC_VLOGICAL:
Roman Zippel6ff58012007-05-01 22:32:43 +0200105 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
106 mac_orig_videoaddr = *data;
107 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 case BI_MAC_SCCBASE:
Roman Zippel6ff58012007-05-01 22:32:43 +0200109 mac_bi_data.sccbase = *data;
110 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 case BI_MAC_BTIME:
Roman Zippel6ff58012007-05-01 22:32:43 +0200112 mac_bi_data.boottime = *data;
113 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 case BI_MAC_GMTBIAS:
Roman Zippel6ff58012007-05-01 22:32:43 +0200115 mac_bi_data.gmtbias = *data;
116 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117 case BI_MAC_MEMSIZE:
Roman Zippel6ff58012007-05-01 22:32:43 +0200118 mac_bi_data.memsize = *data;
119 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 case BI_MAC_CPUID:
Roman Zippel6ff58012007-05-01 22:32:43 +0200121 mac_bi_data.cpuid = *data;
122 break;
123 case BI_MAC_ROMBASE:
124 mac_bi_data.rombase = *data;
125 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126 default:
Roman Zippel6ff58012007-05-01 22:32:43 +0200127 unknown = 1;
128 break;
129 }
130 return unknown;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131}
132
133/*
134 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
135 * have to disable interrupts for this. Our IRQ handlers will crap
136 * themselves if they take an IRQ in 24bit mode!
137 */
138
139static void mac_cache_card_flush(int writeback)
140{
141 unsigned long flags;
Roman Zippel6ff58012007-05-01 22:32:43 +0200142
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 local_irq_save(flags);
144 via_flush_cache();
145 local_irq_restore(flags);
146}
147
148void __init config_mac(void)
149{
Roman Zippel6ff58012007-05-01 22:32:43 +0200150 if (!MACH_IS_MAC)
151 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152
Roman Zippel6ff58012007-05-01 22:32:43 +0200153 mach_sched_init = mac_sched_init;
154 mach_init_IRQ = mac_init_IRQ;
155 mach_get_model = mac_get_model;
156 mach_gettimeoffset = mac_gettimeoffset;
Roman Zippel6ff58012007-05-01 22:32:43 +0200157 mach_hwclk = mac_hwclk;
Roman Zippel6ff58012007-05-01 22:32:43 +0200158 mach_set_clock_mmss = mac_set_clock_mmss;
159 mach_reset = mac_reset;
160 mach_halt = mac_poweroff;
161 mach_power_off = mac_poweroff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 mach_max_dma_address = 0xffffffff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
Roman Zippel6ff58012007-05-01 22:32:43 +0200164 mach_beep = mac_mksound;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165#endif
166#ifdef CONFIG_HEARTBEAT
167#if 0
168 mach_heartbeat = mac_heartbeat;
169 mach_heartbeat_irq = IRQ_MAC_TIMER;
170#endif
171#endif
172
173 /*
174 * Determine hardware present
175 */
176
177 mac_identify();
178 mac_report_hardware();
179
Roman Zippel6ff58012007-05-01 22:32:43 +0200180 /*
181 * AFAIK only the IIci takes a cache card. The IIfx has onboard
182 * cache ... someone needs to figure out how to tell if it's on or
183 * not.
184 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185
186 if (macintosh_config->ident == MAC_MODEL_IICI
Roman Zippel6ff58012007-05-01 22:32:43 +0200187 || macintosh_config->ident == MAC_MODEL_IIFX)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 mach_l2_flush = mac_cache_card_flush;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189
190 /*
191 * Check for machine specific fixups.
192 */
193
194#ifdef OLD_NUBUS_CODE
Roman Zippel6ff58012007-05-01 22:32:43 +0200195 nubus_sweep_video();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196#endif
197}
198
199
200/*
201 * Macintosh Table: hardcoded model configuration data.
202 *
203 * Much of this was defined by Alan, based on who knows what docs.
204 * I've added a lot more, and some of that was pure guesswork based
205 * on hardware pages present on the Mac web site. Possibly wildly
206 * inaccurate, so look here if a new Mac model won't run. Example: if
207 * a Mac crashes immediately after the VIA1 registers have been dumped
208 * to the screen, it probably died attempting to read DirB on a RBV.
209 * Meaning it should have MAC_VIA_IIci here :-)
210 */
211
212struct mac_model *macintosh_config;
213EXPORT_SYMBOL(macintosh_config);
214
Roman Zippel6ff58012007-05-01 22:32:43 +0200215static struct mac_model mac_data_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 /*
217 * We'll pretend to be a Macintosh II, that's pretty safe.
218 */
219
220 {
221 .ident = MAC_MODEL_II,
222 .name = "Unknown",
223 .adb_type = MAC_ADB_II,
224 .via_type = MAC_VIA_II,
225 .scsi_type = MAC_SCSI_OLD,
226 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100227 .nubus_type = MAC_NUBUS,
228 .floppy_type = MAC_FLOPPY_IWM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 },
230
231 /*
232 * Original MacII hardware
233 *
234 */
235
236 {
237 .ident = MAC_MODEL_II,
238 .name = "II",
239 .adb_type = MAC_ADB_II,
240 .via_type = MAC_VIA_II,
241 .scsi_type = MAC_SCSI_OLD,
242 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100243 .nubus_type = MAC_NUBUS,
244 .floppy_type = MAC_FLOPPY_IWM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245 }, {
246 .ident = MAC_MODEL_IIX,
247 .name = "IIx",
248 .adb_type = MAC_ADB_II,
249 .via_type = MAC_VIA_II,
250 .scsi_type = MAC_SCSI_OLD,
251 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100252 .nubus_type = MAC_NUBUS,
253 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254 }, {
255 .ident = MAC_MODEL_IICX,
256 .name = "IIcx",
257 .adb_type = MAC_ADB_II,
258 .via_type = MAC_VIA_II,
259 .scsi_type = MAC_SCSI_OLD,
260 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100261 .nubus_type = MAC_NUBUS,
262 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263 }, {
264 .ident = MAC_MODEL_SE30,
265 .name = "SE/30",
266 .adb_type = MAC_ADB_II,
267 .via_type = MAC_VIA_II,
268 .scsi_type = MAC_SCSI_OLD,
269 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100270 .nubus_type = MAC_NUBUS,
271 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 },
273
274 /*
Simon Arlott0c79cf62007-10-20 01:20:32 +0200275 * Weirdified MacII hardware - all subtly different. Gee thanks
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 * Apple. All these boxes seem to have VIA2 in a different place to
277 * the MacII (+1A000 rather than +4000)
278 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
279 */
280
281 {
282 .ident = MAC_MODEL_IICI,
283 .name = "IIci",
284 .adb_type = MAC_ADB_II,
285 .via_type = MAC_VIA_IIci,
286 .scsi_type = MAC_SCSI_OLD,
287 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100288 .nubus_type = MAC_NUBUS,
289 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 }, {
291 .ident = MAC_MODEL_IIFX,
292 .name = "IIfx",
293 .adb_type = MAC_ADB_IOP,
294 .via_type = MAC_VIA_IIci,
295 .scsi_type = MAC_SCSI_OLD,
296 .scc_type = MAC_SCC_IOP,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100297 .nubus_type = MAC_NUBUS,
298 .floppy_type = MAC_FLOPPY_SWIM_IOP
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 }, {
300 .ident = MAC_MODEL_IISI,
301 .name = "IIsi",
302 .adb_type = MAC_ADB_IISI,
303 .via_type = MAC_VIA_IIci,
304 .scsi_type = MAC_SCSI_OLD,
305 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100306 .nubus_type = MAC_NUBUS,
307 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308 }, {
309 .ident = MAC_MODEL_IIVI,
310 .name = "IIvi",
311 .adb_type = MAC_ADB_IISI,
312 .via_type = MAC_VIA_IIci,
313 .scsi_type = MAC_SCSI_OLD,
314 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100315 .nubus_type = MAC_NUBUS,
316 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317 }, {
318 .ident = MAC_MODEL_IIVX,
319 .name = "IIvx",
320 .adb_type = MAC_ADB_IISI,
321 .via_type = MAC_VIA_IIci,
322 .scsi_type = MAC_SCSI_OLD,
323 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100324 .nubus_type = MAC_NUBUS,
325 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326 },
327
328 /*
329 * Classic models (guessing: similar to SE/30 ?? Nope, similar to LC ...)
330 */
331
332 {
333 .ident = MAC_MODEL_CLII,
334 .name = "Classic II",
335 .adb_type = MAC_ADB_IISI,
336 .via_type = MAC_VIA_IIci,
337 .scsi_type = MAC_SCSI_OLD,
338 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100339 .nubus_type = MAC_NUBUS,
340 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341 }, {
342 .ident = MAC_MODEL_CCL,
343 .name = "Color Classic",
344 .adb_type = MAC_ADB_CUDA,
345 .via_type = MAC_VIA_IIci,
346 .scsi_type = MAC_SCSI_OLD,
347 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100348 .nubus_type = MAC_NUBUS,
349 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
350 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351
352 /*
353 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
354 */
355
356 {
357 .ident = MAC_MODEL_LC,
358 .name = "LC",
359 .adb_type = MAC_ADB_IISI,
360 .via_type = MAC_VIA_IIci,
361 .scsi_type = MAC_SCSI_OLD,
362 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100363 .nubus_type = MAC_NUBUS,
364 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365 }, {
366 .ident = MAC_MODEL_LCII,
367 .name = "LC II",
368 .adb_type = MAC_ADB_IISI,
369 .via_type = MAC_VIA_IIci,
370 .scsi_type = MAC_SCSI_OLD,
371 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100372 .nubus_type = MAC_NUBUS,
373 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374 }, {
375 .ident = MAC_MODEL_LCIII,
376 .name = "LC III",
377 .adb_type = MAC_ADB_IISI,
378 .via_type = MAC_VIA_IIci,
379 .scsi_type = MAC_SCSI_OLD,
380 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100381 .nubus_type = MAC_NUBUS,
382 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383 },
384
385 /*
386 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it differently
387 * as some of the stuff connected to VIA2 seems different. Better SCSI chip and
388 * onboard ethernet using a NatSemi SONIC except the 660AV and 840AV which use an
389 * AMD 79C940 (MACE).
390 * The 700, 900 and 950 have some I/O chips in the wrong place to
391 * confuse us. The 840AV has a SCSI location of its own (same as
392 * the 660AV).
393 */
394
395 {
396 .ident = MAC_MODEL_Q605,
397 .name = "Quadra 605",
398 .adb_type = MAC_ADB_CUDA,
399 .via_type = MAC_VIA_QUADRA,
400 .scsi_type = MAC_SCSI_QUADRA,
401 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100402 .nubus_type = MAC_NUBUS,
403 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404 }, {
405 .ident = MAC_MODEL_Q605_ACC,
406 .name = "Quadra 605",
407 .adb_type = MAC_ADB_CUDA,
408 .via_type = MAC_VIA_QUADRA,
409 .scsi_type = MAC_SCSI_QUADRA,
410 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100411 .nubus_type = MAC_NUBUS,
412 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 }, {
414 .ident = MAC_MODEL_Q610,
415 .name = "Quadra 610",
416 .adb_type = MAC_ADB_II,
417 .via_type = MAC_VIA_QUADRA,
418 .scsi_type = MAC_SCSI_QUADRA,
419 .scc_type = MAC_SCC_QUADRA,
420 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100421 .nubus_type = MAC_NUBUS,
422 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423 }, {
424 .ident = MAC_MODEL_Q630,
425 .name = "Quadra 630",
426 .adb_type = MAC_ADB_CUDA,
427 .via_type = MAC_VIA_QUADRA,
428 .scsi_type = MAC_SCSI_QUADRA,
429 .ide_type = MAC_IDE_QUADRA,
430 .scc_type = MAC_SCC_QUADRA,
431 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100432 .nubus_type = MAC_NUBUS,
433 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 }, {
435 .ident = MAC_MODEL_Q650,
436 .name = "Quadra 650",
437 .adb_type = MAC_ADB_II,
438 .via_type = MAC_VIA_QUADRA,
439 .scsi_type = MAC_SCSI_QUADRA,
440 .scc_type = MAC_SCC_QUADRA,
441 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100442 .nubus_type = MAC_NUBUS,
443 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444 },
445 /* The Q700 does have a NS Sonic */
446 {
447 .ident = MAC_MODEL_Q700,
448 .name = "Quadra 700",
449 .adb_type = MAC_ADB_II,
450 .via_type = MAC_VIA_QUADRA,
451 .scsi_type = MAC_SCSI_QUADRA2,
452 .scc_type = MAC_SCC_QUADRA,
453 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100454 .nubus_type = MAC_NUBUS,
455 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456 }, {
457 .ident = MAC_MODEL_Q800,
458 .name = "Quadra 800",
459 .adb_type = MAC_ADB_II,
460 .via_type = MAC_VIA_QUADRA,
461 .scsi_type = MAC_SCSI_QUADRA,
462 .scc_type = MAC_SCC_QUADRA,
463 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100464 .nubus_type = MAC_NUBUS,
465 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466 }, {
467 .ident = MAC_MODEL_Q840,
468 .name = "Quadra 840AV",
469 .adb_type = MAC_ADB_CUDA,
470 .via_type = MAC_VIA_QUADRA,
471 .scsi_type = MAC_SCSI_QUADRA3,
472 .scc_type = MAC_SCC_PSC,
473 .ether_type = MAC_ETHER_MACE,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100474 .nubus_type = MAC_NUBUS,
475 .floppy_type = MAC_FLOPPY_AV
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 }, {
477 .ident = MAC_MODEL_Q900,
478 .name = "Quadra 900",
479 .adb_type = MAC_ADB_IOP,
480 .via_type = MAC_VIA_QUADRA,
481 .scsi_type = MAC_SCSI_QUADRA2,
482 .scc_type = MAC_SCC_IOP,
483 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100484 .nubus_type = MAC_NUBUS,
485 .floppy_type = MAC_FLOPPY_SWIM_IOP
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486 }, {
487 .ident = MAC_MODEL_Q950,
488 .name = "Quadra 950",
489 .adb_type = MAC_ADB_IOP,
490 .via_type = MAC_VIA_QUADRA,
491 .scsi_type = MAC_SCSI_QUADRA2,
492 .scc_type = MAC_SCC_IOP,
493 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100494 .nubus_type = MAC_NUBUS,
495 .floppy_type = MAC_FLOPPY_SWIM_IOP
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496 },
497
498 /*
499 * Performa - more LC type machines
500 */
501
502 {
503 .ident = MAC_MODEL_P460,
504 .name = "Performa 460",
505 .adb_type = MAC_ADB_IISI,
506 .via_type = MAC_VIA_IIci,
507 .scsi_type = MAC_SCSI_OLD,
508 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100509 .nubus_type = MAC_NUBUS,
510 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700511 }, {
512 .ident = MAC_MODEL_P475,
513 .name = "Performa 475",
514 .adb_type = MAC_ADB_CUDA,
515 .via_type = MAC_VIA_QUADRA,
516 .scsi_type = MAC_SCSI_QUADRA,
517 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100518 .nubus_type = MAC_NUBUS,
519 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 }, {
521 .ident = MAC_MODEL_P475F,
522 .name = "Performa 475",
523 .adb_type = MAC_ADB_CUDA,
524 .via_type = MAC_VIA_QUADRA,
525 .scsi_type = MAC_SCSI_QUADRA,
526 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100527 .nubus_type = MAC_NUBUS,
528 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529 }, {
530 .ident = MAC_MODEL_P520,
531 .name = "Performa 520",
532 .adb_type = MAC_ADB_CUDA,
533 .via_type = MAC_VIA_IIci,
534 .scsi_type = MAC_SCSI_OLD,
535 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100536 .nubus_type = MAC_NUBUS,
537 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 }, {
539 .ident = MAC_MODEL_P550,
540 .name = "Performa 550",
541 .adb_type = MAC_ADB_CUDA,
542 .via_type = MAC_VIA_IIci,
543 .scsi_type = MAC_SCSI_OLD,
544 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100545 .nubus_type = MAC_NUBUS,
546 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700547 },
548 /* These have the comm slot, and therefore the possibility of SONIC ethernet */
549 {
550 .ident = MAC_MODEL_P575,
551 .name = "Performa 575",
552 .adb_type = MAC_ADB_CUDA,
553 .via_type = MAC_VIA_QUADRA,
554 .scsi_type = MAC_SCSI_QUADRA,
555 .scc_type = MAC_SCC_II,
556 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100557 .nubus_type = MAC_NUBUS,
558 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 }, {
560 .ident = MAC_MODEL_P588,
561 .name = "Performa 588",
562 .adb_type = MAC_ADB_CUDA,
563 .via_type = MAC_VIA_QUADRA,
564 .scsi_type = MAC_SCSI_QUADRA,
565 .ide_type = MAC_IDE_QUADRA,
566 .scc_type = MAC_SCC_II,
567 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100568 .nubus_type = MAC_NUBUS,
569 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 }, {
571 .ident = MAC_MODEL_TV,
572 .name = "TV",
573 .adb_type = MAC_ADB_CUDA,
574 .via_type = MAC_VIA_QUADRA,
575 .scsi_type = MAC_SCSI_OLD,
576 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100577 .nubus_type = MAC_NUBUS,
578 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700579 }, {
580 .ident = MAC_MODEL_P600,
581 .name = "Performa 600",
582 .adb_type = MAC_ADB_IISI,
583 .via_type = MAC_VIA_IIci,
584 .scsi_type = MAC_SCSI_OLD,
585 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100586 .nubus_type = MAC_NUBUS,
587 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588 },
589
590 /*
591 * Centris - just guessing again; maybe like Quadra
592 */
593
594 /* The C610 may or may not have SONIC. We probe to make sure */
595 {
596 .ident = MAC_MODEL_C610,
597 .name = "Centris 610",
598 .adb_type = MAC_ADB_II,
599 .via_type = MAC_VIA_QUADRA,
600 .scsi_type = MAC_SCSI_QUADRA,
601 .scc_type = MAC_SCC_QUADRA,
602 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100603 .nubus_type = MAC_NUBUS,
604 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700605 }, {
606 .ident = MAC_MODEL_C650,
607 .name = "Centris 650",
608 .adb_type = MAC_ADB_II,
609 .via_type = MAC_VIA_QUADRA,
610 .scsi_type = MAC_SCSI_QUADRA,
611 .scc_type = MAC_SCC_QUADRA,
612 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100613 .nubus_type = MAC_NUBUS,
614 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 }, {
616 .ident = MAC_MODEL_C660,
617 .name = "Centris 660AV",
618 .adb_type = MAC_ADB_CUDA,
619 .via_type = MAC_VIA_QUADRA,
620 .scsi_type = MAC_SCSI_QUADRA3,
621 .scc_type = MAC_SCC_PSC,
622 .ether_type = MAC_ETHER_MACE,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100623 .nubus_type = MAC_NUBUS,
624 .floppy_type = MAC_FLOPPY_AV
Linus Torvalds1da177e2005-04-16 15:20:36 -0700625 },
626
627 /*
628 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
629 * and a PMU (in two variations?) for ADB. Most of them use the
630 * Quadra-style VIAs. A few models also have IDE from hell.
631 */
632
633 {
634 .ident = MAC_MODEL_PB140,
635 .name = "PowerBook 140",
636 .adb_type = MAC_ADB_PB1,
637 .via_type = MAC_VIA_QUADRA,
638 .scsi_type = MAC_SCSI_OLD,
639 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100640 .nubus_type = MAC_NUBUS,
641 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 }, {
643 .ident = MAC_MODEL_PB145,
644 .name = "PowerBook 145",
645 .adb_type = MAC_ADB_PB1,
646 .via_type = MAC_VIA_QUADRA,
647 .scsi_type = MAC_SCSI_OLD,
648 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100649 .nubus_type = MAC_NUBUS,
650 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651 }, {
652 .ident = MAC_MODEL_PB150,
653 .name = "PowerBook 150",
654 .adb_type = MAC_ADB_PB1,
655 .via_type = MAC_VIA_IIci,
656 .scsi_type = MAC_SCSI_OLD,
657 .ide_type = MAC_IDE_PB,
658 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100659 .nubus_type = MAC_NUBUS,
660 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661 }, {
662 .ident = MAC_MODEL_PB160,
663 .name = "PowerBook 160",
664 .adb_type = MAC_ADB_PB1,
665 .via_type = MAC_VIA_QUADRA,
666 .scsi_type = MAC_SCSI_OLD,
667 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100668 .nubus_type = MAC_NUBUS,
669 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670 }, {
671 .ident = MAC_MODEL_PB165,
672 .name = "PowerBook 165",
673 .adb_type = MAC_ADB_PB1,
674 .via_type = MAC_VIA_QUADRA,
675 .scsi_type = MAC_SCSI_OLD,
676 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100677 .nubus_type = MAC_NUBUS,
678 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 }, {
680 .ident = MAC_MODEL_PB165C,
681 .name = "PowerBook 165c",
682 .adb_type = MAC_ADB_PB1,
683 .via_type = MAC_VIA_QUADRA,
684 .scsi_type = MAC_SCSI_OLD,
685 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100686 .nubus_type = MAC_NUBUS,
687 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688 }, {
689 .ident = MAC_MODEL_PB170,
690 .name = "PowerBook 170",
691 .adb_type = MAC_ADB_PB1,
692 .via_type = MAC_VIA_QUADRA,
693 .scsi_type = MAC_SCSI_OLD,
694 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100695 .nubus_type = MAC_NUBUS,
696 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700697 }, {
698 .ident = MAC_MODEL_PB180,
699 .name = "PowerBook 180",
700 .adb_type = MAC_ADB_PB1,
701 .via_type = MAC_VIA_QUADRA,
702 .scsi_type = MAC_SCSI_OLD,
703 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100704 .nubus_type = MAC_NUBUS,
705 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706 }, {
707 .ident = MAC_MODEL_PB180C,
708 .name = "PowerBook 180c",
709 .adb_type = MAC_ADB_PB1,
710 .via_type = MAC_VIA_QUADRA,
711 .scsi_type = MAC_SCSI_OLD,
712 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100713 .nubus_type = MAC_NUBUS,
714 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 }, {
716 .ident = MAC_MODEL_PB190,
717 .name = "PowerBook 190",
718 .adb_type = MAC_ADB_PB2,
719 .via_type = MAC_VIA_QUADRA,
720 .scsi_type = MAC_SCSI_OLD,
721 .ide_type = MAC_IDE_BABOON,
722 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100723 .nubus_type = MAC_NUBUS,
724 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700725 }, {
726 .ident = MAC_MODEL_PB520,
727 .name = "PowerBook 520",
728 .adb_type = MAC_ADB_PB2,
729 .via_type = MAC_VIA_QUADRA,
730 .scsi_type = MAC_SCSI_OLD,
731 .scc_type = MAC_SCC_QUADRA,
732 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100733 .nubus_type = MAC_NUBUS,
734 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700735 },
736
737 /*
738 * PowerBook Duos are pretty much like normal PowerBooks
739 * All of these probably have onboard SONIC in the Dock which
740 * means we'll have to probe for it eventually.
741 *
Simon Arlott0c79cf62007-10-20 01:20:32 +0200742 * Are these really MAC_VIA_IIci? The developer notes for the
Linus Torvalds1da177e2005-04-16 15:20:36 -0700743 * Duos show pretty much the same custom parts as in most of
744 * the other PowerBooks which would imply MAC_VIA_QUADRA.
745 */
746
747 {
748 .ident = MAC_MODEL_PB210,
749 .name = "PowerBook Duo 210",
750 .adb_type = MAC_ADB_PB2,
751 .via_type = MAC_VIA_IIci,
752 .scsi_type = MAC_SCSI_OLD,
753 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100754 .nubus_type = MAC_NUBUS,
755 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756 }, {
757 .ident = MAC_MODEL_PB230,
758 .name = "PowerBook Duo 230",
759 .adb_type = MAC_ADB_PB2,
760 .via_type = MAC_VIA_IIci,
761 .scsi_type = MAC_SCSI_OLD,
762 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100763 .nubus_type = MAC_NUBUS,
764 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765 }, {
766 .ident = MAC_MODEL_PB250,
767 .name = "PowerBook Duo 250",
768 .adb_type = MAC_ADB_PB2,
769 .via_type = MAC_VIA_IIci,
770 .scsi_type = MAC_SCSI_OLD,
771 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100772 .nubus_type = MAC_NUBUS,
773 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774 }, {
775 .ident = MAC_MODEL_PB270C,
776 .name = "PowerBook Duo 270c",
777 .adb_type = MAC_ADB_PB2,
778 .via_type = MAC_VIA_IIci,
779 .scsi_type = MAC_SCSI_OLD,
780 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100781 .nubus_type = MAC_NUBUS,
782 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783 }, {
784 .ident = MAC_MODEL_PB280,
785 .name = "PowerBook Duo 280",
786 .adb_type = MAC_ADB_PB2,
787 .via_type = MAC_VIA_IIci,
788 .scsi_type = MAC_SCSI_OLD,
789 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100790 .nubus_type = MAC_NUBUS,
791 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700792 }, {
793 .ident = MAC_MODEL_PB280C,
794 .name = "PowerBook Duo 280c",
795 .adb_type = MAC_ADB_PB2,
796 .via_type = MAC_VIA_IIci,
797 .scsi_type = MAC_SCSI_OLD,
798 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100799 .nubus_type = MAC_NUBUS,
800 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700801 },
802
803 /*
804 * Other stuff ??
805 */
806 {
807 .ident = -1
808 }
809};
810
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200811static void __init mac_identify(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812{
813 struct mac_model *m;
814
815 /* Penguin data useful? */
816 int model = mac_bi_data.id;
817 if (!model) {
818 /* no bootinfo model id -> NetBSD booter was used! */
819 /* XXX FIXME: breaks for model > 31 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200820 model = (mac_bi_data.cpuid >> 2) & 63;
821 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700822 }
823
824 macintosh_config = mac_data_table;
Roman Zippel6ff58012007-05-01 22:32:43 +0200825 for (m = macintosh_config; m->ident != -1; m++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700826 if (m->ident == model) {
827 macintosh_config = m;
828 break;
829 }
830 }
831
832 /* We need to pre-init the IOPs, if any. Otherwise */
833 /* the serial console won't work if the user had */
834 /* the serial ports set to "Faster" mode in MacOS. */
835
836 iop_preinit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837
Roman Zippel6ff58012007-05-01 22:32:43 +0200838 printk(KERN_INFO "Detected Macintosh model: %d \n", model);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839
840 /*
841 * Report booter data:
842 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200843 printk(KERN_DEBUG " Penguin bootinfo data:\n");
844 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700845 mac_bi_data.videoaddr, mac_bi_data.videorow,
846 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
847 mac_bi_data.dimensions >> 16);
Roman Zippel6ff58012007-05-01 22:32:43 +0200848 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849 mac_bi_data.videological, mac_orig_videoaddr,
850 mac_bi_data.sccbase);
Roman Zippel6ff58012007-05-01 22:32:43 +0200851 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700852 mac_bi_data.boottime, mac_bi_data.gmtbias);
Roman Zippel6ff58012007-05-01 22:32:43 +0200853 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700854 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700855
Linus Torvalds1da177e2005-04-16 15:20:36 -0700856 iop_init();
857 via_init();
858 oss_init();
859 psc_init();
860 baboon_init();
861}
862
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200863static void __init mac_report_hardware(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700864{
865 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
866}
867
868static void mac_get_model(char *str)
869{
Roman Zippel6ff58012007-05-01 22:32:43 +0200870 strcpy(str, "Macintosh ");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700871 strcat(str, macintosh_config->name);
872}