blob: ad3e3bacae39e6ee3960c2a492c8d532b2484f30 [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;
49int mac_bisize = sizeof mac_bi_data;
50
Linus Torvalds1da177e2005-04-16 15:20:36 -070051/* New m68k bootinfo stuff and videobase */
52
53extern int m68k_num_memory;
54extern struct mem_info m68k_memory[NUM_MEMINFO];
55
56extern struct mem_info m68k_ramdisk;
57
Roman Zippel6ff58012007-05-01 22:32:43 +020058void *mac_env; /* Loaded by the boot asm */
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
60/* The phys. video addr. - might be bogus on some machines */
61unsigned long mac_orig_videoaddr;
62
63/* Mac specific timer functions */
Roman Zippel6ff58012007-05-01 22:32:43 +020064extern unsigned long mac_gettimeoffset(void);
65extern int mac_hwclk(int, struct rtc_time *);
66extern int mac_set_clock_mmss(unsigned long);
Linus Torvalds1da177e2005-04-16 15:20:36 -070067extern int show_mac_interrupts(struct seq_file *, void *);
68extern void iop_preinit(void);
69extern void iop_init(void);
70extern void via_init(void);
David Howells40220c12006-10-09 12:19:47 +010071extern void via_init_clock(irq_handler_t func);
Linus Torvalds1da177e2005-04-16 15:20:36 -070072extern void via_flush_cache(void);
73extern void oss_init(void);
74extern void psc_init(void);
75extern void baboon_init(void);
76
77extern void mac_mksound(unsigned int, unsigned int);
78
79extern void nubus_sweep_video(void);
80
Linus Torvalds1da177e2005-04-16 15:20:36 -070081static void mac_get_model(char *str);
82
Al Viro66a3f822007-07-20 04:33:28 +010083static void __init mac_sched_init(irq_handler_t vector)
Linus Torvalds1da177e2005-04-16 15:20:36 -070084{
85 via_init_clock(vector);
86}
87
Linus Torvalds1da177e2005-04-16 15:20:36 -070088/*
89 * Parse a Macintosh-specific record in the bootinfo
90 */
91
92int __init mac_parse_bootinfo(const struct bi_record *record)
93{
Roman Zippel6ff58012007-05-01 22:32:43 +020094 int unknown = 0;
95 const u_long *data = record->data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070096
Roman Zippel6ff58012007-05-01 22:32:43 +020097 switch (record->tag) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 case BI_MAC_MODEL:
Roman Zippel6ff58012007-05-01 22:32:43 +020099 mac_bi_data.id = *data;
100 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 case BI_MAC_VADDR:
Roman Zippel6ff58012007-05-01 22:32:43 +0200102 mac_bi_data.videoaddr = *data;
103 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 case BI_MAC_VDEPTH:
Roman Zippel6ff58012007-05-01 22:32:43 +0200105 mac_bi_data.videodepth = *data;
106 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 case BI_MAC_VROW:
Roman Zippel6ff58012007-05-01 22:32:43 +0200108 mac_bi_data.videorow = *data;
109 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 case BI_MAC_VDIM:
Roman Zippel6ff58012007-05-01 22:32:43 +0200111 mac_bi_data.dimensions = *data;
112 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113 case BI_MAC_VLOGICAL:
Roman Zippel6ff58012007-05-01 22:32:43 +0200114 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
115 mac_orig_videoaddr = *data;
116 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117 case BI_MAC_SCCBASE:
Roman Zippel6ff58012007-05-01 22:32:43 +0200118 mac_bi_data.sccbase = *data;
119 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 case BI_MAC_BTIME:
Roman Zippel6ff58012007-05-01 22:32:43 +0200121 mac_bi_data.boottime = *data;
122 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 case BI_MAC_GMTBIAS:
Roman Zippel6ff58012007-05-01 22:32:43 +0200124 mac_bi_data.gmtbias = *data;
125 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126 case BI_MAC_MEMSIZE:
Roman Zippel6ff58012007-05-01 22:32:43 +0200127 mac_bi_data.memsize = *data;
128 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 case BI_MAC_CPUID:
Roman Zippel6ff58012007-05-01 22:32:43 +0200130 mac_bi_data.cpuid = *data;
131 break;
132 case BI_MAC_ROMBASE:
133 mac_bi_data.rombase = *data;
134 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 default:
Roman Zippel6ff58012007-05-01 22:32:43 +0200136 unknown = 1;
137 break;
138 }
139 return unknown;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140}
141
142/*
143 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
144 * have to disable interrupts for this. Our IRQ handlers will crap
145 * themselves if they take an IRQ in 24bit mode!
146 */
147
148static void mac_cache_card_flush(int writeback)
149{
150 unsigned long flags;
Roman Zippel6ff58012007-05-01 22:32:43 +0200151
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 local_irq_save(flags);
153 via_flush_cache();
154 local_irq_restore(flags);
155}
156
157void __init config_mac(void)
158{
Roman Zippel6ff58012007-05-01 22:32:43 +0200159 if (!MACH_IS_MAC)
160 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161
Roman Zippel6ff58012007-05-01 22:32:43 +0200162 mach_sched_init = mac_sched_init;
163 mach_init_IRQ = mac_init_IRQ;
164 mach_get_model = mac_get_model;
165 mach_gettimeoffset = mac_gettimeoffset;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166#warning move to adb/via init
167#if 0
Roman Zippel6ff58012007-05-01 22:32:43 +0200168 mach_hwclk = mac_hwclk;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169#endif
Roman Zippel6ff58012007-05-01 22:32:43 +0200170 mach_set_clock_mmss = mac_set_clock_mmss;
171 mach_reset = mac_reset;
172 mach_halt = mac_poweroff;
173 mach_power_off = mac_poweroff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174 mach_max_dma_address = 0xffffffff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
Roman Zippel6ff58012007-05-01 22:32:43 +0200176 mach_beep = mac_mksound;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177#endif
178#ifdef CONFIG_HEARTBEAT
179#if 0
180 mach_heartbeat = mac_heartbeat;
181 mach_heartbeat_irq = IRQ_MAC_TIMER;
182#endif
183#endif
184
185 /*
186 * Determine hardware present
187 */
188
189 mac_identify();
190 mac_report_hardware();
191
Roman Zippel6ff58012007-05-01 22:32:43 +0200192 /*
193 * AFAIK only the IIci takes a cache card. The IIfx has onboard
194 * cache ... someone needs to figure out how to tell if it's on or
195 * not.
196 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197
198 if (macintosh_config->ident == MAC_MODEL_IICI
Roman Zippel6ff58012007-05-01 22:32:43 +0200199 || macintosh_config->ident == MAC_MODEL_IIFX)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 mach_l2_flush = mac_cache_card_flush;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201
202 /*
203 * Check for machine specific fixups.
204 */
205
206#ifdef OLD_NUBUS_CODE
Roman Zippel6ff58012007-05-01 22:32:43 +0200207 nubus_sweep_video();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208#endif
209}
210
211
212/*
213 * Macintosh Table: hardcoded model configuration data.
214 *
215 * Much of this was defined by Alan, based on who knows what docs.
216 * I've added a lot more, and some of that was pure guesswork based
217 * on hardware pages present on the Mac web site. Possibly wildly
218 * inaccurate, so look here if a new Mac model won't run. Example: if
219 * a Mac crashes immediately after the VIA1 registers have been dumped
220 * to the screen, it probably died attempting to read DirB on a RBV.
221 * Meaning it should have MAC_VIA_IIci here :-)
222 */
223
224struct mac_model *macintosh_config;
225EXPORT_SYMBOL(macintosh_config);
226
Roman Zippel6ff58012007-05-01 22:32:43 +0200227static struct mac_model mac_data_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 /*
229 * We'll pretend to be a Macintosh II, that's pretty safe.
230 */
231
232 {
233 .ident = MAC_MODEL_II,
234 .name = "Unknown",
235 .adb_type = MAC_ADB_II,
236 .via_type = MAC_VIA_II,
237 .scsi_type = MAC_SCSI_OLD,
238 .scc_type = MAC_SCC_II,
239 .nubus_type = MAC_NUBUS
240 },
241
242 /*
243 * Original MacII hardware
244 *
245 */
246
247 {
248 .ident = MAC_MODEL_II,
249 .name = "II",
250 .adb_type = MAC_ADB_II,
251 .via_type = MAC_VIA_II,
252 .scsi_type = MAC_SCSI_OLD,
253 .scc_type = MAC_SCC_II,
254 .nubus_type = MAC_NUBUS
255 }, {
256 .ident = MAC_MODEL_IIX,
257 .name = "IIx",
258 .adb_type = MAC_ADB_II,
259 .via_type = MAC_VIA_II,
260 .scsi_type = MAC_SCSI_OLD,
261 .scc_type = MAC_SCC_II,
262 .nubus_type = MAC_NUBUS
263 }, {
264 .ident = MAC_MODEL_IICX,
265 .name = "IIcx",
266 .adb_type = MAC_ADB_II,
267 .via_type = MAC_VIA_II,
268 .scsi_type = MAC_SCSI_OLD,
269 .scc_type = MAC_SCC_II,
270 .nubus_type = MAC_NUBUS
271 }, {
272 .ident = MAC_MODEL_SE30,
273 .name = "SE/30",
274 .adb_type = MAC_ADB_II,
275 .via_type = MAC_VIA_II,
276 .scsi_type = MAC_SCSI_OLD,
277 .scc_type = MAC_SCC_II,
278 .nubus_type = MAC_NUBUS
279 },
280
281 /*
Simon Arlott0c79cf62007-10-20 01:20:32 +0200282 * Weirdified MacII hardware - all subtly different. Gee thanks
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283 * Apple. All these boxes seem to have VIA2 in a different place to
284 * the MacII (+1A000 rather than +4000)
285 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
286 */
287
288 {
289 .ident = MAC_MODEL_IICI,
290 .name = "IIci",
291 .adb_type = MAC_ADB_II,
292 .via_type = MAC_VIA_IIci,
293 .scsi_type = MAC_SCSI_OLD,
294 .scc_type = MAC_SCC_II,
295 .nubus_type = MAC_NUBUS
296 }, {
297 .ident = MAC_MODEL_IIFX,
298 .name = "IIfx",
299 .adb_type = MAC_ADB_IOP,
300 .via_type = MAC_VIA_IIci,
301 .scsi_type = MAC_SCSI_OLD,
302 .scc_type = MAC_SCC_IOP,
303 .nubus_type = MAC_NUBUS
304 }, {
305 .ident = MAC_MODEL_IISI,
306 .name = "IIsi",
307 .adb_type = MAC_ADB_IISI,
308 .via_type = MAC_VIA_IIci,
309 .scsi_type = MAC_SCSI_OLD,
310 .scc_type = MAC_SCC_II,
311 .nubus_type = MAC_NUBUS
312 }, {
313 .ident = MAC_MODEL_IIVI,
314 .name = "IIvi",
315 .adb_type = MAC_ADB_IISI,
316 .via_type = MAC_VIA_IIci,
317 .scsi_type = MAC_SCSI_OLD,
318 .scc_type = MAC_SCC_II,
319 .nubus_type = MAC_NUBUS
320 }, {
321 .ident = MAC_MODEL_IIVX,
322 .name = "IIvx",
323 .adb_type = MAC_ADB_IISI,
324 .via_type = MAC_VIA_IIci,
325 .scsi_type = MAC_SCSI_OLD,
326 .scc_type = MAC_SCC_II,
327 .nubus_type = MAC_NUBUS
328 },
329
330 /*
331 * Classic models (guessing: similar to SE/30 ?? Nope, similar to LC ...)
332 */
333
334 {
335 .ident = MAC_MODEL_CLII,
336 .name = "Classic II",
337 .adb_type = MAC_ADB_IISI,
338 .via_type = MAC_VIA_IIci,
339 .scsi_type = MAC_SCSI_OLD,
340 .scc_type = MAC_SCC_II,
341 .nubus_type = MAC_NUBUS
342 }, {
343 .ident = MAC_MODEL_CCL,
344 .name = "Color Classic",
345 .adb_type = MAC_ADB_CUDA,
346 .via_type = MAC_VIA_IIci,
347 .scsi_type = MAC_SCSI_OLD,
348 .scc_type = MAC_SCC_II,
349 .nubus_type = MAC_NUBUS},
350
351 /*
352 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
353 */
354
355 {
356 .ident = MAC_MODEL_LC,
357 .name = "LC",
358 .adb_type = MAC_ADB_IISI,
359 .via_type = MAC_VIA_IIci,
360 .scsi_type = MAC_SCSI_OLD,
361 .scc_type = MAC_SCC_II,
362 .nubus_type = MAC_NUBUS
363 }, {
364 .ident = MAC_MODEL_LCII,
365 .name = "LC II",
366 .adb_type = MAC_ADB_IISI,
367 .via_type = MAC_VIA_IIci,
368 .scsi_type = MAC_SCSI_OLD,
369 .scc_type = MAC_SCC_II,
370 .nubus_type = MAC_NUBUS
371 }, {
372 .ident = MAC_MODEL_LCIII,
373 .name = "LC III",
374 .adb_type = MAC_ADB_IISI,
375 .via_type = MAC_VIA_IIci,
376 .scsi_type = MAC_SCSI_OLD,
377 .scc_type = MAC_SCC_II,
378 .nubus_type = MAC_NUBUS
379 },
380
381 /*
382 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it differently
383 * as some of the stuff connected to VIA2 seems different. Better SCSI chip and
384 * onboard ethernet using a NatSemi SONIC except the 660AV and 840AV which use an
385 * AMD 79C940 (MACE).
386 * The 700, 900 and 950 have some I/O chips in the wrong place to
387 * confuse us. The 840AV has a SCSI location of its own (same as
388 * the 660AV).
389 */
390
391 {
392 .ident = MAC_MODEL_Q605,
393 .name = "Quadra 605",
394 .adb_type = MAC_ADB_CUDA,
395 .via_type = MAC_VIA_QUADRA,
396 .scsi_type = MAC_SCSI_QUADRA,
397 .scc_type = MAC_SCC_QUADRA,
398 .nubus_type = MAC_NUBUS
399 }, {
400 .ident = MAC_MODEL_Q605_ACC,
401 .name = "Quadra 605",
402 .adb_type = MAC_ADB_CUDA,
403 .via_type = MAC_VIA_QUADRA,
404 .scsi_type = MAC_SCSI_QUADRA,
405 .scc_type = MAC_SCC_QUADRA,
406 .nubus_type = MAC_NUBUS
407 }, {
408 .ident = MAC_MODEL_Q610,
409 .name = "Quadra 610",
410 .adb_type = MAC_ADB_II,
411 .via_type = MAC_VIA_QUADRA,
412 .scsi_type = MAC_SCSI_QUADRA,
413 .scc_type = MAC_SCC_QUADRA,
414 .ether_type = MAC_ETHER_SONIC,
415 .nubus_type = MAC_NUBUS
416 }, {
417 .ident = MAC_MODEL_Q630,
418 .name = "Quadra 630",
419 .adb_type = MAC_ADB_CUDA,
420 .via_type = MAC_VIA_QUADRA,
421 .scsi_type = MAC_SCSI_QUADRA,
422 .ide_type = MAC_IDE_QUADRA,
423 .scc_type = MAC_SCC_QUADRA,
424 .ether_type = MAC_ETHER_SONIC,
425 .nubus_type = MAC_NUBUS
426 }, {
427 .ident = MAC_MODEL_Q650,
428 .name = "Quadra 650",
429 .adb_type = MAC_ADB_II,
430 .via_type = MAC_VIA_QUADRA,
431 .scsi_type = MAC_SCSI_QUADRA,
432 .scc_type = MAC_SCC_QUADRA,
433 .ether_type = MAC_ETHER_SONIC,
434 .nubus_type = MAC_NUBUS
435 },
436 /* The Q700 does have a NS Sonic */
437 {
438 .ident = MAC_MODEL_Q700,
439 .name = "Quadra 700",
440 .adb_type = MAC_ADB_II,
441 .via_type = MAC_VIA_QUADRA,
442 .scsi_type = MAC_SCSI_QUADRA2,
443 .scc_type = MAC_SCC_QUADRA,
444 .ether_type = MAC_ETHER_SONIC,
445 .nubus_type = MAC_NUBUS
446 }, {
447 .ident = MAC_MODEL_Q800,
448 .name = "Quadra 800",
449 .adb_type = MAC_ADB_II,
450 .via_type = MAC_VIA_QUADRA,
451 .scsi_type = MAC_SCSI_QUADRA,
452 .scc_type = MAC_SCC_QUADRA,
453 .ether_type = MAC_ETHER_SONIC,
454 .nubus_type = MAC_NUBUS
455 }, {
456 .ident = MAC_MODEL_Q840,
457 .name = "Quadra 840AV",
458 .adb_type = MAC_ADB_CUDA,
459 .via_type = MAC_VIA_QUADRA,
460 .scsi_type = MAC_SCSI_QUADRA3,
461 .scc_type = MAC_SCC_PSC,
462 .ether_type = MAC_ETHER_MACE,
463 .nubus_type = MAC_NUBUS
464 }, {
465 .ident = MAC_MODEL_Q900,
466 .name = "Quadra 900",
467 .adb_type = MAC_ADB_IOP,
468 .via_type = MAC_VIA_QUADRA,
469 .scsi_type = MAC_SCSI_QUADRA2,
470 .scc_type = MAC_SCC_IOP,
471 .ether_type = MAC_ETHER_SONIC,
472 .nubus_type = MAC_NUBUS
473 }, {
474 .ident = MAC_MODEL_Q950,
475 .name = "Quadra 950",
476 .adb_type = MAC_ADB_IOP,
477 .via_type = MAC_VIA_QUADRA,
478 .scsi_type = MAC_SCSI_QUADRA2,
479 .scc_type = MAC_SCC_IOP,
480 .ether_type = MAC_ETHER_SONIC,
481 .nubus_type = MAC_NUBUS
482 },
483
484 /*
485 * Performa - more LC type machines
486 */
487
488 {
489 .ident = MAC_MODEL_P460,
490 .name = "Performa 460",
491 .adb_type = MAC_ADB_IISI,
492 .via_type = MAC_VIA_IIci,
493 .scsi_type = MAC_SCSI_OLD,
494 .scc_type = MAC_SCC_II,
495 .nubus_type = MAC_NUBUS
496 }, {
497 .ident = MAC_MODEL_P475,
498 .name = "Performa 475",
499 .adb_type = MAC_ADB_CUDA,
500 .via_type = MAC_VIA_QUADRA,
501 .scsi_type = MAC_SCSI_QUADRA,
502 .scc_type = MAC_SCC_II,
503 .nubus_type = MAC_NUBUS
504 }, {
505 .ident = MAC_MODEL_P475F,
506 .name = "Performa 475",
507 .adb_type = MAC_ADB_CUDA,
508 .via_type = MAC_VIA_QUADRA,
509 .scsi_type = MAC_SCSI_QUADRA,
510 .scc_type = MAC_SCC_II,
511 .nubus_type = MAC_NUBUS
512 }, {
513 .ident = MAC_MODEL_P520,
514 .name = "Performa 520",
515 .adb_type = MAC_ADB_CUDA,
516 .via_type = MAC_VIA_IIci,
517 .scsi_type = MAC_SCSI_OLD,
518 .scc_type = MAC_SCC_II,
519 .nubus_type = MAC_NUBUS
520 }, {
521 .ident = MAC_MODEL_P550,
522 .name = "Performa 550",
523 .adb_type = MAC_ADB_CUDA,
524 .via_type = MAC_VIA_IIci,
525 .scsi_type = MAC_SCSI_OLD,
526 .scc_type = MAC_SCC_II,
527 .nubus_type = MAC_NUBUS
528 },
529 /* These have the comm slot, and therefore the possibility of SONIC ethernet */
530 {
531 .ident = MAC_MODEL_P575,
532 .name = "Performa 575",
533 .adb_type = MAC_ADB_CUDA,
534 .via_type = MAC_VIA_QUADRA,
535 .scsi_type = MAC_SCSI_QUADRA,
536 .scc_type = MAC_SCC_II,
537 .ether_type = MAC_ETHER_SONIC,
538 .nubus_type = MAC_NUBUS
539 }, {
540 .ident = MAC_MODEL_P588,
541 .name = "Performa 588",
542 .adb_type = MAC_ADB_CUDA,
543 .via_type = MAC_VIA_QUADRA,
544 .scsi_type = MAC_SCSI_QUADRA,
545 .ide_type = MAC_IDE_QUADRA,
546 .scc_type = MAC_SCC_II,
547 .ether_type = MAC_ETHER_SONIC,
548 .nubus_type = MAC_NUBUS
549 }, {
550 .ident = MAC_MODEL_TV,
551 .name = "TV",
552 .adb_type = MAC_ADB_CUDA,
553 .via_type = MAC_VIA_QUADRA,
554 .scsi_type = MAC_SCSI_OLD,
555 .scc_type = MAC_SCC_II,
556 .nubus_type = MAC_NUBUS
557 }, {
558 .ident = MAC_MODEL_P600,
559 .name = "Performa 600",
560 .adb_type = MAC_ADB_IISI,
561 .via_type = MAC_VIA_IIci,
562 .scsi_type = MAC_SCSI_OLD,
563 .scc_type = MAC_SCC_II,
564 .nubus_type = MAC_NUBUS
565 },
566
567 /*
568 * Centris - just guessing again; maybe like Quadra
569 */
570
571 /* The C610 may or may not have SONIC. We probe to make sure */
572 {
573 .ident = MAC_MODEL_C610,
574 .name = "Centris 610",
575 .adb_type = MAC_ADB_II,
576 .via_type = MAC_VIA_QUADRA,
577 .scsi_type = MAC_SCSI_QUADRA,
578 .scc_type = MAC_SCC_QUADRA,
579 .ether_type = MAC_ETHER_SONIC,
580 .nubus_type = MAC_NUBUS
581 }, {
582 .ident = MAC_MODEL_C650,
583 .name = "Centris 650",
584 .adb_type = MAC_ADB_II,
585 .via_type = MAC_VIA_QUADRA,
586 .scsi_type = MAC_SCSI_QUADRA,
587 .scc_type = MAC_SCC_QUADRA,
588 .ether_type = MAC_ETHER_SONIC,
589 .nubus_type = MAC_NUBUS
590 }, {
591 .ident = MAC_MODEL_C660,
592 .name = "Centris 660AV",
593 .adb_type = MAC_ADB_CUDA,
594 .via_type = MAC_VIA_QUADRA,
595 .scsi_type = MAC_SCSI_QUADRA3,
596 .scc_type = MAC_SCC_PSC,
597 .ether_type = MAC_ETHER_MACE,
598 .nubus_type = MAC_NUBUS
599 },
600
601 /*
602 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
603 * and a PMU (in two variations?) for ADB. Most of them use the
604 * Quadra-style VIAs. A few models also have IDE from hell.
605 */
606
607 {
608 .ident = MAC_MODEL_PB140,
609 .name = "PowerBook 140",
610 .adb_type = MAC_ADB_PB1,
611 .via_type = MAC_VIA_QUADRA,
612 .scsi_type = MAC_SCSI_OLD,
613 .scc_type = MAC_SCC_QUADRA,
614 .nubus_type = MAC_NUBUS
615 }, {
616 .ident = MAC_MODEL_PB145,
617 .name = "PowerBook 145",
618 .adb_type = MAC_ADB_PB1,
619 .via_type = MAC_VIA_QUADRA,
620 .scsi_type = MAC_SCSI_OLD,
621 .scc_type = MAC_SCC_QUADRA,
622 .nubus_type = MAC_NUBUS
623 }, {
624 .ident = MAC_MODEL_PB150,
625 .name = "PowerBook 150",
626 .adb_type = MAC_ADB_PB1,
627 .via_type = MAC_VIA_IIci,
628 .scsi_type = MAC_SCSI_OLD,
629 .ide_type = MAC_IDE_PB,
630 .scc_type = MAC_SCC_QUADRA,
631 .nubus_type = MAC_NUBUS
632 }, {
633 .ident = MAC_MODEL_PB160,
634 .name = "PowerBook 160",
635 .adb_type = MAC_ADB_PB1,
636 .via_type = MAC_VIA_QUADRA,
637 .scsi_type = MAC_SCSI_OLD,
638 .scc_type = MAC_SCC_QUADRA,
639 .nubus_type = MAC_NUBUS
640 }, {
641 .ident = MAC_MODEL_PB165,
642 .name = "PowerBook 165",
643 .adb_type = MAC_ADB_PB1,
644 .via_type = MAC_VIA_QUADRA,
645 .scsi_type = MAC_SCSI_OLD,
646 .scc_type = MAC_SCC_QUADRA,
647 .nubus_type = MAC_NUBUS
648 }, {
649 .ident = MAC_MODEL_PB165C,
650 .name = "PowerBook 165c",
651 .adb_type = MAC_ADB_PB1,
652 .via_type = MAC_VIA_QUADRA,
653 .scsi_type = MAC_SCSI_OLD,
654 .scc_type = MAC_SCC_QUADRA,
655 .nubus_type = MAC_NUBUS
656 }, {
657 .ident = MAC_MODEL_PB170,
658 .name = "PowerBook 170",
659 .adb_type = MAC_ADB_PB1,
660 .via_type = MAC_VIA_QUADRA,
661 .scsi_type = MAC_SCSI_OLD,
662 .scc_type = MAC_SCC_QUADRA,
663 .nubus_type = MAC_NUBUS
664 }, {
665 .ident = MAC_MODEL_PB180,
666 .name = "PowerBook 180",
667 .adb_type = MAC_ADB_PB1,
668 .via_type = MAC_VIA_QUADRA,
669 .scsi_type = MAC_SCSI_OLD,
670 .scc_type = MAC_SCC_QUADRA,
671 .nubus_type = MAC_NUBUS
672 }, {
673 .ident = MAC_MODEL_PB180C,
674 .name = "PowerBook 180c",
675 .adb_type = MAC_ADB_PB1,
676 .via_type = MAC_VIA_QUADRA,
677 .scsi_type = MAC_SCSI_OLD,
678 .scc_type = MAC_SCC_QUADRA,
679 .nubus_type = MAC_NUBUS
680 }, {
681 .ident = MAC_MODEL_PB190,
682 .name = "PowerBook 190",
683 .adb_type = MAC_ADB_PB2,
684 .via_type = MAC_VIA_QUADRA,
685 .scsi_type = MAC_SCSI_OLD,
686 .ide_type = MAC_IDE_BABOON,
687 .scc_type = MAC_SCC_QUADRA,
688 .nubus_type = MAC_NUBUS
689 }, {
690 .ident = MAC_MODEL_PB520,
691 .name = "PowerBook 520",
692 .adb_type = MAC_ADB_PB2,
693 .via_type = MAC_VIA_QUADRA,
694 .scsi_type = MAC_SCSI_OLD,
695 .scc_type = MAC_SCC_QUADRA,
696 .ether_type = MAC_ETHER_SONIC,
697 .nubus_type = MAC_NUBUS
698 },
699
700 /*
701 * PowerBook Duos are pretty much like normal PowerBooks
702 * All of these probably have onboard SONIC in the Dock which
703 * means we'll have to probe for it eventually.
704 *
Simon Arlott0c79cf62007-10-20 01:20:32 +0200705 * Are these really MAC_VIA_IIci? The developer notes for the
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706 * Duos show pretty much the same custom parts as in most of
707 * the other PowerBooks which would imply MAC_VIA_QUADRA.
708 */
709
710 {
711 .ident = MAC_MODEL_PB210,
712 .name = "PowerBook Duo 210",
713 .adb_type = MAC_ADB_PB2,
714 .via_type = MAC_VIA_IIci,
715 .scsi_type = MAC_SCSI_OLD,
716 .scc_type = MAC_SCC_QUADRA,
717 .nubus_type = MAC_NUBUS
718 }, {
719 .ident = MAC_MODEL_PB230,
720 .name = "PowerBook Duo 230",
721 .adb_type = MAC_ADB_PB2,
722 .via_type = MAC_VIA_IIci,
723 .scsi_type = MAC_SCSI_OLD,
724 .scc_type = MAC_SCC_QUADRA,
725 .nubus_type = MAC_NUBUS
726 }, {
727 .ident = MAC_MODEL_PB250,
728 .name = "PowerBook Duo 250",
729 .adb_type = MAC_ADB_PB2,
730 .via_type = MAC_VIA_IIci,
731 .scsi_type = MAC_SCSI_OLD,
732 .scc_type = MAC_SCC_QUADRA,
733 .nubus_type = MAC_NUBUS
734 }, {
735 .ident = MAC_MODEL_PB270C,
736 .name = "PowerBook Duo 270c",
737 .adb_type = MAC_ADB_PB2,
738 .via_type = MAC_VIA_IIci,
739 .scsi_type = MAC_SCSI_OLD,
740 .scc_type = MAC_SCC_QUADRA,
741 .nubus_type = MAC_NUBUS
742 }, {
743 .ident = MAC_MODEL_PB280,
744 .name = "PowerBook Duo 280",
745 .adb_type = MAC_ADB_PB2,
746 .via_type = MAC_VIA_IIci,
747 .scsi_type = MAC_SCSI_OLD,
748 .scc_type = MAC_SCC_QUADRA,
749 .nubus_type = MAC_NUBUS
750 }, {
751 .ident = MAC_MODEL_PB280C,
752 .name = "PowerBook Duo 280c",
753 .adb_type = MAC_ADB_PB2,
754 .via_type = MAC_VIA_IIci,
755 .scsi_type = MAC_SCSI_OLD,
756 .scc_type = MAC_SCC_QUADRA,
757 .nubus_type = MAC_NUBUS
758 },
759
760 /*
761 * Other stuff ??
762 */
763 {
764 .ident = -1
765 }
766};
767
Al Viro66a3f822007-07-20 04:33:28 +0100768void __init mac_identify(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700769{
770 struct mac_model *m;
771
772 /* Penguin data useful? */
773 int model = mac_bi_data.id;
774 if (!model) {
775 /* no bootinfo model id -> NetBSD booter was used! */
776 /* XXX FIXME: breaks for model > 31 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200777 model = (mac_bi_data.cpuid >> 2) & 63;
778 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779 }
780
781 macintosh_config = mac_data_table;
Roman Zippel6ff58012007-05-01 22:32:43 +0200782 for (m = macintosh_config; m->ident != -1; m++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783 if (m->ident == model) {
784 macintosh_config = m;
785 break;
786 }
787 }
788
789 /* We need to pre-init the IOPs, if any. Otherwise */
790 /* the serial console won't work if the user had */
791 /* the serial ports set to "Faster" mode in MacOS. */
792
793 iop_preinit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700794
Roman Zippel6ff58012007-05-01 22:32:43 +0200795 printk(KERN_INFO "Detected Macintosh model: %d \n", model);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700796
797 /*
798 * Report booter data:
799 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200800 printk(KERN_DEBUG " Penguin bootinfo data:\n");
801 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802 mac_bi_data.videoaddr, mac_bi_data.videorow,
803 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
804 mac_bi_data.dimensions >> 16);
Roman Zippel6ff58012007-05-01 22:32:43 +0200805 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806 mac_bi_data.videological, mac_orig_videoaddr,
807 mac_bi_data.sccbase);
Roman Zippel6ff58012007-05-01 22:32:43 +0200808 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700809 mac_bi_data.boottime, mac_bi_data.gmtbias);
Roman Zippel6ff58012007-05-01 22:32:43 +0200810 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700811 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
812#if 0
Roman Zippel6ff58012007-05-01 22:32:43 +0200813 printk("Ramdisk: addr 0x%lx size 0x%lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700814 m68k_ramdisk.addr, m68k_ramdisk.size);
815#endif
816
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817 iop_init();
818 via_init();
819 oss_init();
820 psc_init();
821 baboon_init();
822}
823
Al Viro66a3f822007-07-20 04:33:28 +0100824void __init mac_report_hardware(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700825{
826 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
827}
828
829static void mac_get_model(char *str)
830{
Roman Zippel6ff58012007-05-01 22:32:43 +0200831 strcpy(str, "Macintosh ");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700832 strcat(str, macintosh_config->name);
833}