2 * linux/arch/m68k/mac/config.c
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
10 * Miscellaneous linux stuff
13 #include <linux/errno.h>
14 #include <linux/module.h>
15 #include <linux/reboot.h>
16 #include <linux/types.h>
18 #include <linux/tty.h>
19 #include <linux/console.h>
20 #include <linux/interrupt.h>
22 #include <linux/random.h>
23 #include <linux/delay.h>
25 #include <linux/init.h>
26 #include <linux/vt_kern.h>
27 #include <linux/platform_device.h>
28 #include <linux/ata_platform.h>
29 #include <linux/adb.h>
30 #include <linux/cuda.h>
31 #include <linux/pmu.h>
32 #include <linux/rtc.h>
34 #include <asm/setup.h>
35 #include <asm/bootinfo.h>
36 #include <asm/bootinfo-mac.h>
37 #include <asm/byteorder.h>
41 #include <asm/machdep.h>
43 #include <asm/macintosh.h>
44 #include <asm/macints.h>
45 #include <asm/machw.h>
47 #include <asm/mac_iop.h>
48 #include <asm/mac_via.h>
49 #include <asm/mac_oss.h>
50 #include <asm/mac_psc.h>
51 #include <asm/config.h>
55 /* Mac bootinfo struct */
56 struct mac_booter_data mac_bi_data;
58 /* The phys. video addr. - might be bogus on some machines */
59 static unsigned long mac_orig_videoaddr;
61 static void mac_get_model(char *str);
62 static void mac_identify(void);
63 static void mac_report_hardware(void);
65 static void __init mac_sched_init(void)
71 * Parse a Macintosh-specific record in the bootinfo
74 int __init mac_parse_bootinfo(const struct bi_record *record)
77 const void *data = record->data;
79 switch (be16_to_cpu(record->tag)) {
81 mac_bi_data.id = be32_to_cpup(data);
84 mac_bi_data.videoaddr = be32_to_cpup(data);
87 mac_bi_data.videodepth = be32_to_cpup(data);
90 mac_bi_data.videorow = be32_to_cpup(data);
93 mac_bi_data.dimensions = be32_to_cpup(data);
96 mac_orig_videoaddr = be32_to_cpup(data);
97 mac_bi_data.videological =
98 VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
101 mac_bi_data.sccbase = be32_to_cpup(data);
104 mac_bi_data.boottime = be32_to_cpup(data);
107 mac_bi_data.gmtbias = be32_to_cpup(data);
110 mac_bi_data.memsize = be32_to_cpup(data);
113 mac_bi_data.cpuid = be32_to_cpup(data);
116 mac_bi_data.rombase = be32_to_cpup(data);
125 void __init config_mac(void)
128 pr_err("ERROR: no Mac, but config_mac() called!!\n");
130 mach_sched_init = mac_sched_init;
131 mach_init_IRQ = mac_init_IRQ;
132 mach_get_model = mac_get_model;
133 mach_hwclk = mac_hwclk;
134 mach_reset = mac_reset;
135 mach_halt = mac_poweroff;
136 #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
137 mach_beep = mac_mksound;
141 * Determine hardware present
145 mac_report_hardware();
148 * AFAIK only the IIci takes a cache card. The IIfx has onboard
149 * cache ... someone needs to figure out how to tell if it's on or
153 if (macintosh_config->ident == MAC_MODEL_IICI)
154 mach_l2_flush = via_l2_flush;
156 register_platform_power_off(mac_poweroff);
161 * Macintosh Table: hardcoded model configuration data.
163 * Much of this was defined by Alan, based on who knows what docs.
164 * I've added a lot more, and some of that was pure guesswork based
165 * on hardware pages present on the Mac web site. Possibly wildly
166 * inaccurate, so look here if a new Mac model won't run. Example: if
167 * a Mac crashes immediately after the VIA1 registers have been dumped
168 * to the screen, it probably died attempting to read DirB on a RBV.
169 * Meaning it should have MAC_VIA_IICI here :-)
172 struct mac_model *macintosh_config;
173 EXPORT_SYMBOL(macintosh_config);
175 static struct mac_model mac_data_table[] = {
177 * We'll pretend to be a Macintosh II, that's pretty safe.
181 .ident = MAC_MODEL_II,
183 .adb_type = MAC_ADB_II,
184 .via_type = MAC_VIA_II,
185 .scsi_type = MAC_SCSI_OLD,
186 .scc_type = MAC_SCC_II,
187 .expansion_type = MAC_EXP_NUBUS,
188 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
192 * Original Mac II hardware
196 .ident = MAC_MODEL_II,
198 .adb_type = MAC_ADB_II,
199 .via_type = MAC_VIA_II,
200 .scsi_type = MAC_SCSI_OLD,
201 .scc_type = MAC_SCC_II,
202 .expansion_type = MAC_EXP_NUBUS,
203 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
205 .ident = MAC_MODEL_IIX,
207 .adb_type = MAC_ADB_II,
208 .via_type = MAC_VIA_II,
209 .scsi_type = MAC_SCSI_OLD,
210 .scc_type = MAC_SCC_II,
211 .expansion_type = MAC_EXP_NUBUS,
212 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
214 .ident = MAC_MODEL_IICX,
216 .adb_type = MAC_ADB_II,
217 .via_type = MAC_VIA_II,
218 .scsi_type = MAC_SCSI_OLD,
219 .scc_type = MAC_SCC_II,
220 .expansion_type = MAC_EXP_NUBUS,
221 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
223 .ident = MAC_MODEL_SE30,
225 .adb_type = MAC_ADB_II,
226 .via_type = MAC_VIA_II,
227 .scsi_type = MAC_SCSI_OLD,
228 .scc_type = MAC_SCC_II,
229 .expansion_type = MAC_EXP_PDS,
230 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
234 * Weirdified Mac II hardware - all subtly different. Gee thanks
235 * Apple. All these boxes seem to have VIA2 in a different place to
236 * the Mac II (+1A000 rather than +4000)
237 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
241 .ident = MAC_MODEL_IICI,
243 .adb_type = MAC_ADB_II,
244 .via_type = MAC_VIA_IICI,
245 .scsi_type = MAC_SCSI_OLD,
246 .scc_type = MAC_SCC_II,
247 .expansion_type = MAC_EXP_NUBUS,
248 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
250 .ident = MAC_MODEL_IIFX,
252 .adb_type = MAC_ADB_IOP,
253 .via_type = MAC_VIA_IICI,
254 .scsi_type = MAC_SCSI_IIFX,
255 .scc_type = MAC_SCC_IOP,
256 .expansion_type = MAC_EXP_PDS_NUBUS,
257 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
259 .ident = MAC_MODEL_IISI,
261 .adb_type = MAC_ADB_EGRET,
262 .via_type = MAC_VIA_IICI,
263 .scsi_type = MAC_SCSI_OLD,
264 .scc_type = MAC_SCC_II,
265 .expansion_type = MAC_EXP_PDS_NUBUS,
266 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
268 .ident = MAC_MODEL_IIVI,
270 .adb_type = MAC_ADB_EGRET,
271 .via_type = MAC_VIA_IICI,
272 .scsi_type = MAC_SCSI_LC,
273 .scc_type = MAC_SCC_II,
274 .expansion_type = MAC_EXP_NUBUS,
275 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
277 .ident = MAC_MODEL_IIVX,
279 .adb_type = MAC_ADB_EGRET,
280 .via_type = MAC_VIA_IICI,
281 .scsi_type = MAC_SCSI_LC,
282 .scc_type = MAC_SCC_II,
283 .expansion_type = MAC_EXP_NUBUS,
284 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
288 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
292 .ident = MAC_MODEL_CLII,
293 .name = "Classic II",
294 .adb_type = MAC_ADB_EGRET,
295 .via_type = MAC_VIA_IICI,
296 .scsi_type = MAC_SCSI_LC,
297 .scc_type = MAC_SCC_II,
298 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
300 .ident = MAC_MODEL_CCL,
301 .name = "Color Classic",
302 .adb_type = MAC_ADB_CUDA,
303 .via_type = MAC_VIA_IICI,
304 .scsi_type = MAC_SCSI_LC,
305 .scc_type = MAC_SCC_II,
306 .expansion_type = MAC_EXP_PDS,
307 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
309 .ident = MAC_MODEL_CCLII,
310 .name = "Color Classic II",
311 .adb_type = MAC_ADB_CUDA,
312 .via_type = MAC_VIA_IICI,
313 .scsi_type = MAC_SCSI_LC,
314 .scc_type = MAC_SCC_II,
315 .expansion_type = MAC_EXP_PDS,
316 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
320 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
324 .ident = MAC_MODEL_LC,
326 .adb_type = MAC_ADB_EGRET,
327 .via_type = MAC_VIA_IICI,
328 .scsi_type = MAC_SCSI_LC,
329 .scc_type = MAC_SCC_II,
330 .expansion_type = MAC_EXP_PDS,
331 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
333 .ident = MAC_MODEL_LCII,
335 .adb_type = MAC_ADB_EGRET,
336 .via_type = MAC_VIA_IICI,
337 .scsi_type = MAC_SCSI_LC,
338 .scc_type = MAC_SCC_II,
339 .expansion_type = MAC_EXP_PDS,
340 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
342 .ident = MAC_MODEL_LCIII,
344 .adb_type = MAC_ADB_EGRET,
345 .via_type = MAC_VIA_IICI,
346 .scsi_type = MAC_SCSI_LC,
347 .scc_type = MAC_SCC_II,
348 .expansion_type = MAC_EXP_PDS,
349 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
353 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
354 * differently as some of the stuff connected to VIA2 seems different.
355 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
356 * the 660AV and 840AV which use an AMD 79C940 (MACE).
357 * The 700, 900 and 950 have some I/O chips in the wrong place to
358 * confuse us. The 840AV has a SCSI location of its own (same as
363 .ident = MAC_MODEL_Q605,
364 .name = "Quadra 605",
365 .adb_type = MAC_ADB_CUDA,
366 .via_type = MAC_VIA_QUADRA,
367 .scsi_type = MAC_SCSI_QUADRA,
368 .scc_type = MAC_SCC_QUADRA,
369 .expansion_type = MAC_EXP_PDS,
370 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
372 .ident = MAC_MODEL_Q605_ACC,
373 .name = "Quadra 605",
374 .adb_type = MAC_ADB_CUDA,
375 .via_type = MAC_VIA_QUADRA,
376 .scsi_type = MAC_SCSI_QUADRA,
377 .scc_type = MAC_SCC_QUADRA,
378 .expansion_type = MAC_EXP_PDS,
379 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
381 .ident = MAC_MODEL_Q610,
382 .name = "Quadra 610",
383 .adb_type = MAC_ADB_II,
384 .via_type = MAC_VIA_QUADRA,
385 .scsi_type = MAC_SCSI_QUADRA,
386 .scc_type = MAC_SCC_QUADRA,
387 .ether_type = MAC_ETHER_SONIC,
388 .expansion_type = MAC_EXP_PDS_NUBUS,
389 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
391 .ident = MAC_MODEL_Q630,
392 .name = "Quadra 630",
393 .adb_type = MAC_ADB_CUDA,
394 .via_type = MAC_VIA_QUADRA,
395 .scsi_type = MAC_SCSI_QUADRA,
396 .ide_type = MAC_IDE_QUADRA,
397 .scc_type = MAC_SCC_QUADRA,
398 .expansion_type = MAC_EXP_PDS_COMM,
399 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
401 .ident = MAC_MODEL_Q650,
402 .name = "Quadra 650",
403 .adb_type = MAC_ADB_II,
404 .via_type = MAC_VIA_QUADRA,
405 .scsi_type = MAC_SCSI_QUADRA,
406 .scc_type = MAC_SCC_QUADRA,
407 .ether_type = MAC_ETHER_SONIC,
408 .expansion_type = MAC_EXP_PDS_NUBUS,
409 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
411 /* The Q700 does have a NS Sonic */
413 .ident = MAC_MODEL_Q700,
414 .name = "Quadra 700",
415 .adb_type = MAC_ADB_II,
416 .via_type = MAC_VIA_QUADRA,
417 .scsi_type = MAC_SCSI_QUADRA2,
418 .scc_type = MAC_SCC_QUADRA,
419 .ether_type = MAC_ETHER_SONIC,
420 .expansion_type = MAC_EXP_PDS_NUBUS,
421 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM */
423 .ident = MAC_MODEL_Q800,
424 .name = "Quadra 800",
425 .adb_type = MAC_ADB_II,
426 .via_type = MAC_VIA_QUADRA,
427 .scsi_type = MAC_SCSI_QUADRA,
428 .scc_type = MAC_SCC_QUADRA,
429 .ether_type = MAC_ETHER_SONIC,
430 .expansion_type = MAC_EXP_PDS_NUBUS,
431 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
433 .ident = MAC_MODEL_Q840,
434 .name = "Quadra 840AV",
435 .adb_type = MAC_ADB_CUDA,
436 .via_type = MAC_VIA_QUADRA,
437 .scsi_type = MAC_SCSI_QUADRA3,
438 .scc_type = MAC_SCC_PSC,
439 .ether_type = MAC_ETHER_MACE,
440 .expansion_type = MAC_EXP_NUBUS,
441 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
443 .ident = MAC_MODEL_Q900,
444 .name = "Quadra 900",
445 .adb_type = MAC_ADB_IOP,
446 .via_type = MAC_VIA_QUADRA,
447 .scsi_type = MAC_SCSI_QUADRA2,
448 .scc_type = MAC_SCC_IOP,
449 .ether_type = MAC_ETHER_SONIC,
450 .expansion_type = MAC_EXP_PDS_NUBUS,
451 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
453 .ident = MAC_MODEL_Q950,
454 .name = "Quadra 950",
455 .adb_type = MAC_ADB_IOP,
456 .via_type = MAC_VIA_QUADRA,
457 .scsi_type = MAC_SCSI_QUADRA2,
458 .scc_type = MAC_SCC_IOP,
459 .ether_type = MAC_ETHER_SONIC,
460 .expansion_type = MAC_EXP_PDS_NUBUS,
461 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
465 * Performa - more LC type machines
469 .ident = MAC_MODEL_P460,
470 .name = "Performa 460",
471 .adb_type = MAC_ADB_EGRET,
472 .via_type = MAC_VIA_IICI,
473 .scsi_type = MAC_SCSI_LC,
474 .scc_type = MAC_SCC_II,
475 .expansion_type = MAC_EXP_PDS,
476 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
478 .ident = MAC_MODEL_P475,
479 .name = "Performa 475",
480 .adb_type = MAC_ADB_CUDA,
481 .via_type = MAC_VIA_QUADRA,
482 .scsi_type = MAC_SCSI_QUADRA,
483 .scc_type = MAC_SCC_II,
484 .expansion_type = MAC_EXP_PDS,
485 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
487 .ident = MAC_MODEL_P475F,
488 .name = "Performa 475",
489 .adb_type = MAC_ADB_CUDA,
490 .via_type = MAC_VIA_QUADRA,
491 .scsi_type = MAC_SCSI_QUADRA,
492 .scc_type = MAC_SCC_II,
493 .expansion_type = MAC_EXP_PDS,
494 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
496 .ident = MAC_MODEL_P520,
497 .name = "Performa 520",
498 .adb_type = MAC_ADB_CUDA,
499 .via_type = MAC_VIA_IICI,
500 .scsi_type = MAC_SCSI_LC,
501 .scc_type = MAC_SCC_II,
502 .expansion_type = MAC_EXP_PDS,
503 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
505 .ident = MAC_MODEL_P550,
506 .name = "Performa 550",
507 .adb_type = MAC_ADB_CUDA,
508 .via_type = MAC_VIA_IICI,
509 .scsi_type = MAC_SCSI_LC,
510 .scc_type = MAC_SCC_II,
511 .expansion_type = MAC_EXP_PDS,
512 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
514 /* These have the comm slot, and therefore possibly SONIC ethernet */
516 .ident = MAC_MODEL_P575,
517 .name = "Performa 575",
518 .adb_type = MAC_ADB_CUDA,
519 .via_type = MAC_VIA_QUADRA,
520 .scsi_type = MAC_SCSI_QUADRA,
521 .scc_type = MAC_SCC_II,
522 .expansion_type = MAC_EXP_PDS_COMM,
523 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
525 .ident = MAC_MODEL_P588,
526 .name = "Performa 588",
527 .adb_type = MAC_ADB_CUDA,
528 .via_type = MAC_VIA_QUADRA,
529 .scsi_type = MAC_SCSI_QUADRA,
530 .ide_type = MAC_IDE_QUADRA,
531 .scc_type = MAC_SCC_II,
532 .expansion_type = MAC_EXP_PDS_COMM,
533 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
535 .ident = MAC_MODEL_TV,
537 .adb_type = MAC_ADB_CUDA,
538 .via_type = MAC_VIA_IICI,
539 .scsi_type = MAC_SCSI_LC,
540 .scc_type = MAC_SCC_II,
541 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
543 .ident = MAC_MODEL_P600,
544 .name = "Performa 600",
545 .adb_type = MAC_ADB_EGRET,
546 .via_type = MAC_VIA_IICI,
547 .scsi_type = MAC_SCSI_LC,
548 .scc_type = MAC_SCC_II,
549 .expansion_type = MAC_EXP_NUBUS,
550 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
554 * Centris - just guessing again; maybe like Quadra.
555 * The C610 may or may not have SONIC. We probe to make sure.
559 .ident = MAC_MODEL_C610,
560 .name = "Centris 610",
561 .adb_type = MAC_ADB_II,
562 .via_type = MAC_VIA_QUADRA,
563 .scsi_type = MAC_SCSI_QUADRA,
564 .scc_type = MAC_SCC_QUADRA,
565 .ether_type = MAC_ETHER_SONIC,
566 .expansion_type = MAC_EXP_PDS_NUBUS,
567 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
569 .ident = MAC_MODEL_C650,
570 .name = "Centris 650",
571 .adb_type = MAC_ADB_II,
572 .via_type = MAC_VIA_QUADRA,
573 .scsi_type = MAC_SCSI_QUADRA,
574 .scc_type = MAC_SCC_QUADRA,
575 .ether_type = MAC_ETHER_SONIC,
576 .expansion_type = MAC_EXP_PDS_NUBUS,
577 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
579 .ident = MAC_MODEL_C660,
580 .name = "Centris 660AV",
581 .adb_type = MAC_ADB_CUDA,
582 .via_type = MAC_VIA_QUADRA,
583 .scsi_type = MAC_SCSI_QUADRA3,
584 .scc_type = MAC_SCC_PSC,
585 .ether_type = MAC_ETHER_MACE,
586 .expansion_type = MAC_EXP_PDS_NUBUS,
587 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
591 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
592 * and a PMU (in two variations?) for ADB. Most of them use the
593 * Quadra-style VIAs. A few models also have IDE from hell.
597 .ident = MAC_MODEL_PB140,
598 .name = "PowerBook 140",
599 .adb_type = MAC_ADB_PB1,
600 .via_type = MAC_VIA_QUADRA,
601 .scsi_type = MAC_SCSI_OLD,
602 .scc_type = MAC_SCC_QUADRA,
603 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
605 .ident = MAC_MODEL_PB145,
606 .name = "PowerBook 145",
607 .adb_type = MAC_ADB_PB1,
608 .via_type = MAC_VIA_QUADRA,
609 .scsi_type = MAC_SCSI_OLD,
610 .scc_type = MAC_SCC_QUADRA,
611 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
613 .ident = MAC_MODEL_PB150,
614 .name = "PowerBook 150",
615 .adb_type = MAC_ADB_PB2,
616 .via_type = MAC_VIA_IICI,
617 .scsi_type = MAC_SCSI_OLD,
618 .ide_type = MAC_IDE_PB,
619 .scc_type = MAC_SCC_QUADRA,
620 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
622 .ident = MAC_MODEL_PB160,
623 .name = "PowerBook 160",
624 .adb_type = MAC_ADB_PB1,
625 .via_type = MAC_VIA_QUADRA,
626 .scsi_type = MAC_SCSI_OLD,
627 .scc_type = MAC_SCC_QUADRA,
628 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
630 .ident = MAC_MODEL_PB165,
631 .name = "PowerBook 165",
632 .adb_type = MAC_ADB_PB1,
633 .via_type = MAC_VIA_QUADRA,
634 .scsi_type = MAC_SCSI_OLD,
635 .scc_type = MAC_SCC_QUADRA,
636 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
638 .ident = MAC_MODEL_PB165C,
639 .name = "PowerBook 165c",
640 .adb_type = MAC_ADB_PB1,
641 .via_type = MAC_VIA_QUADRA,
642 .scsi_type = MAC_SCSI_OLD,
643 .scc_type = MAC_SCC_QUADRA,
644 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
646 .ident = MAC_MODEL_PB170,
647 .name = "PowerBook 170",
648 .adb_type = MAC_ADB_PB1,
649 .via_type = MAC_VIA_QUADRA,
650 .scsi_type = MAC_SCSI_OLD,
651 .scc_type = MAC_SCC_QUADRA,
652 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
654 .ident = MAC_MODEL_PB180,
655 .name = "PowerBook 180",
656 .adb_type = MAC_ADB_PB1,
657 .via_type = MAC_VIA_QUADRA,
658 .scsi_type = MAC_SCSI_OLD,
659 .scc_type = MAC_SCC_QUADRA,
660 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
662 .ident = MAC_MODEL_PB180C,
663 .name = "PowerBook 180c",
664 .adb_type = MAC_ADB_PB1,
665 .via_type = MAC_VIA_QUADRA,
666 .scsi_type = MAC_SCSI_OLD,
667 .scc_type = MAC_SCC_QUADRA,
668 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
670 .ident = MAC_MODEL_PB190,
671 .name = "PowerBook 190",
672 .adb_type = MAC_ADB_PB2,
673 .via_type = MAC_VIA_QUADRA,
674 .scsi_type = MAC_SCSI_OLD,
675 .ide_type = MAC_IDE_BABOON,
676 .scc_type = MAC_SCC_QUADRA,
677 .floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */
679 .ident = MAC_MODEL_PB520,
680 .name = "PowerBook 520",
681 .adb_type = MAC_ADB_PB2,
682 .via_type = MAC_VIA_QUADRA,
683 .scsi_type = MAC_SCSI_OLD,
684 .scc_type = MAC_SCC_QUADRA,
685 .ether_type = MAC_ETHER_SONIC,
686 .floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */
690 * PowerBook Duos are pretty much like normal PowerBooks
691 * All of these probably have onboard SONIC in the Dock which
692 * means we'll have to probe for it eventually.
696 .ident = MAC_MODEL_PB210,
697 .name = "PowerBook Duo 210",
698 .adb_type = MAC_ADB_PB2,
699 .via_type = MAC_VIA_IICI,
700 .scsi_type = MAC_SCSI_DUO,
701 .scc_type = MAC_SCC_QUADRA,
702 .expansion_type = MAC_EXP_NUBUS,
703 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
705 .ident = MAC_MODEL_PB230,
706 .name = "PowerBook Duo 230",
707 .adb_type = MAC_ADB_PB2,
708 .via_type = MAC_VIA_IICI,
709 .scsi_type = MAC_SCSI_DUO,
710 .scc_type = MAC_SCC_QUADRA,
711 .expansion_type = MAC_EXP_NUBUS,
712 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
714 .ident = MAC_MODEL_PB250,
715 .name = "PowerBook Duo 250",
716 .adb_type = MAC_ADB_PB2,
717 .via_type = MAC_VIA_IICI,
718 .scsi_type = MAC_SCSI_DUO,
719 .scc_type = MAC_SCC_QUADRA,
720 .expansion_type = MAC_EXP_NUBUS,
721 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
723 .ident = MAC_MODEL_PB270C,
724 .name = "PowerBook Duo 270c",
725 .adb_type = MAC_ADB_PB2,
726 .via_type = MAC_VIA_IICI,
727 .scsi_type = MAC_SCSI_DUO,
728 .scc_type = MAC_SCC_QUADRA,
729 .expansion_type = MAC_EXP_NUBUS,
730 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
732 .ident = MAC_MODEL_PB280,
733 .name = "PowerBook Duo 280",
734 .adb_type = MAC_ADB_PB2,
735 .via_type = MAC_VIA_IICI,
736 .scsi_type = MAC_SCSI_DUO,
737 .scc_type = MAC_SCC_QUADRA,
738 .expansion_type = MAC_EXP_NUBUS,
739 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
741 .ident = MAC_MODEL_PB280C,
742 .name = "PowerBook Duo 280c",
743 .adb_type = MAC_ADB_PB2,
744 .via_type = MAC_VIA_IICI,
745 .scsi_type = MAC_SCSI_DUO,
746 .scc_type = MAC_SCC_QUADRA,
747 .expansion_type = MAC_EXP_NUBUS,
748 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
760 static struct resource scc_a_rsrcs[] = {
761 { .flags = IORESOURCE_MEM },
762 { .flags = IORESOURCE_IRQ },
765 static struct resource scc_b_rsrcs[] = {
766 { .flags = IORESOURCE_MEM },
767 { .flags = IORESOURCE_IRQ },
770 struct platform_device scc_a_pdev = {
774 EXPORT_SYMBOL(scc_a_pdev);
776 struct platform_device scc_b_pdev = {
780 EXPORT_SYMBOL(scc_b_pdev);
782 static void __init mac_identify(void)
786 /* Penguin data useful? */
787 int model = mac_bi_data.id;
789 /* no bootinfo model id -> NetBSD booter was used! */
790 /* XXX FIXME: breaks for model > 31 */
791 model = (mac_bi_data.cpuid >> 2) & 63;
792 pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
795 macintosh_config = mac_data_table;
796 for (m = macintosh_config; m->ident != -1; m++) {
797 if (m->ident == model) {
798 macintosh_config = m;
803 /* Set up serial port resources for the console initcall. */
805 scc_a_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase + 2;
806 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
807 scc_a_pdev.num_resources = ARRAY_SIZE(scc_a_rsrcs);
808 scc_a_pdev.resource = scc_a_rsrcs;
810 scc_b_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase;
811 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
812 scc_b_pdev.num_resources = ARRAY_SIZE(scc_b_rsrcs);
813 scc_b_pdev.resource = scc_b_rsrcs;
815 switch (macintosh_config->scc_type) {
817 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
818 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
821 /* On non-PSC machines, the serial ports share an IRQ. */
822 if (macintosh_config->ident == MAC_MODEL_IIFX) {
823 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
824 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
826 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
827 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
832 pr_info("Detected Macintosh model: %d\n", model);
835 * Report booter data:
837 printk(KERN_DEBUG " Penguin bootinfo data:\n");
838 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
839 mac_bi_data.videoaddr, mac_bi_data.videorow,
840 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
841 mac_bi_data.dimensions >> 16);
842 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
843 mac_bi_data.videological, mac_orig_videoaddr,
844 mac_bi_data.sccbase);
845 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
846 mac_bi_data.boottime, mac_bi_data.gmtbias);
847 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
848 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
856 #ifdef CONFIG_ADB_CUDA
859 #ifdef CONFIG_ADB_PMU
864 static void __init mac_report_hardware(void)
866 pr_info("Apple Macintosh %s\n", macintosh_config->name);
869 static void mac_get_model(char *str)
871 strcpy(str, "Macintosh ");
872 strcat(str, macintosh_config->name);
875 static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
877 .flags = IORESOURCE_IRQ,
878 .start = IRQ_MAC_SCSI,
881 .flags = IORESOURCE_MEM,
885 .flags = IORESOURCE_MEM,
891 static const struct resource mac_scsi_duo_rsrc[] __initconst = {
893 .flags = IORESOURCE_MEM,
899 static const struct resource mac_scsi_old_rsrc[] __initconst = {
901 .flags = IORESOURCE_IRQ,
902 .start = IRQ_MAC_SCSI,
905 .flags = IORESOURCE_MEM,
909 .flags = IORESOURCE_MEM,
915 static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
917 .flags = IORESOURCE_IRQ,
918 .start = IRQ_MAC_SCSI,
921 .flags = IORESOURCE_MEM,
925 .flags = IORESOURCE_MEM,
931 static const struct resource mac_pata_quadra_rsrc[] __initconst = {
932 DEFINE_RES_MEM(0x50F1A000, 0x38),
933 DEFINE_RES_MEM(0x50F1A038, 0x04),
934 DEFINE_RES_IRQ(IRQ_NUBUS_F),
937 static const struct resource mac_pata_pb_rsrc[] __initconst = {
938 DEFINE_RES_MEM(0x50F1A000, 0x38),
939 DEFINE_RES_MEM(0x50F1A038, 0x04),
940 DEFINE_RES_IRQ(IRQ_NUBUS_C),
943 static const struct resource mac_pata_baboon_rsrc[] __initconst = {
944 DEFINE_RES_MEM(0x50F1A000, 0x38),
945 DEFINE_RES_MEM(0x50F1A038, 0x04),
946 DEFINE_RES_IRQ(IRQ_BABOON_1),
949 static const struct pata_platform_info mac_pata_data __initconst = {
953 static int __init mac_platform_init(void)
955 phys_addr_t swim_base = 0;
964 platform_device_register(&scc_a_pdev);
965 platform_device_register(&scc_b_pdev);
971 switch (macintosh_config->floppy_type) {
972 case MAC_FLOPPY_QUADRA:
973 swim_base = 0x5001E000;
976 swim_base = 0x50016000;
979 swim_base = 0x50F16000;
984 struct resource swim_rsrc = {
985 .flags = IORESOURCE_MEM,
987 .end = swim_base + 0x1FFF,
990 platform_device_register_simple("swim", -1, &swim_rsrc, 1);
997 switch (macintosh_config->scsi_type) {
998 case MAC_SCSI_QUADRA:
999 case MAC_SCSI_QUADRA3:
1000 platform_device_register_simple("mac_esp", 0, NULL, 0);
1002 case MAC_SCSI_QUADRA2:
1003 platform_device_register_simple("mac_esp", 0, NULL, 0);
1004 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
1005 (macintosh_config->ident == MAC_MODEL_Q950))
1006 platform_device_register_simple("mac_esp", 1, NULL, 0);
1009 /* Addresses from The Guide to Mac Family Hardware.
1010 * $5000 8000 - $5000 9FFF: SCSI DMA
1011 * $5000 A000 - $5000 BFFF: Alternate SCSI
1012 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
1013 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
1014 * The A/UX header file sys/uconfig.h says $50F0 8000.
1015 * The "SCSI DMA" custom IC embeds the 53C80 core and
1016 * supports Programmed IO, DMA and PDMA (hardware handshake).
1018 platform_device_register_simple("mac_scsi", 0,
1019 mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
1022 /* Addresses from the Duo Dock II Developer Note.
1023 * $FEE0 2000 - $FEE0 3FFF: normal mode
1024 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
1025 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
1026 * The NetBSD code indicates that both 5380 chips share
1027 * an IRQ (?) which would need careful handling (see mac_esp).
1029 platform_device_register_simple("mac_scsi", 1,
1030 mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
1033 /* Addresses from Developer Notes for Duo System,
1034 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
1035 * and also from The Guide to Mac Family Hardware for
1036 * SE/30, II, IIx, IIcx, IIci.
1037 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
1038 * $5001 0000 - $5001 1FFF: normal mode
1039 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
1040 * GMFH says that $5000 0000 - $50FF FFFF "wraps
1041 * $5000 0000 - $5001 FFFF eight times" (!)
1042 * mess.org says IIci and Color Classic do not alias
1043 * I/O address space.
1045 platform_device_register_simple("mac_scsi", 0,
1046 mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
1049 /* Addresses from Mac LC data in Designing Cards & Drivers 3ed.
1050 * Also from the Developer Notes for Classic II, LC III,
1051 * Color Classic and IIvx.
1052 * $50F0 6000 - $50F0 7FFF: SCSI handshake
1053 * $50F1 0000 - $50F1 1FFF: SCSI
1054 * $50F1 2000 - $50F1 3FFF: SCSI DMA
1056 platform_device_register_simple("mac_scsi", 0,
1057 mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
1065 switch (macintosh_config->ide_type) {
1066 case MAC_IDE_QUADRA:
1067 platform_device_register_resndata(NULL, "pata_platform", -1,
1068 mac_pata_quadra_rsrc, ARRAY_SIZE(mac_pata_quadra_rsrc),
1069 &mac_pata_data, sizeof(mac_pata_data));
1072 platform_device_register_resndata(NULL, "pata_platform", -1,
1073 mac_pata_pb_rsrc, ARRAY_SIZE(mac_pata_pb_rsrc),
1074 &mac_pata_data, sizeof(mac_pata_data));
1076 case MAC_IDE_BABOON:
1077 platform_device_register_resndata(NULL, "pata_platform", -1,
1078 mac_pata_baboon_rsrc, ARRAY_SIZE(mac_pata_baboon_rsrc),
1079 &mac_pata_data, sizeof(mac_pata_data));
1087 if (macintosh_config->ether_type == MAC_ETHER_SONIC ||
1088 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1089 platform_device_register_simple("macsonic", -1, NULL, 0);
1091 if (macintosh_config->expansion_type == MAC_EXP_PDS ||
1092 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1093 platform_device_register_simple("mac89x0", -1, NULL, 0);
1095 if (macintosh_config->ether_type == MAC_ETHER_MACE)
1096 platform_device_register_simple("macmace", -1, NULL, 0);
1101 arch_initcall(mac_platform_init);