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/types.h>
17 #include <linux/tty.h>
18 #include <linux/console.h>
19 #include <linux/interrupt.h>
21 #include <linux/random.h>
22 #include <linux/delay.h>
24 #include <linux/init.h>
25 #include <linux/vt_kern.h>
26 #include <linux/platform_device.h>
27 #include <linux/adb.h>
28 #include <linux/cuda.h>
29 #include <linux/pmu.h>
30 #include <linux/rtc.h>
32 #include <asm/setup.h>
33 #include <asm/bootinfo.h>
34 #include <asm/bootinfo-mac.h>
35 #include <asm/byteorder.h>
39 #include <asm/pgtable.h>
40 #include <asm/machdep.h>
42 #include <asm/macintosh.h>
43 #include <asm/macints.h>
44 #include <asm/machw.h>
46 #include <asm/mac_iop.h>
47 #include <asm/mac_via.h>
48 #include <asm/mac_oss.h>
49 #include <asm/mac_psc.h>
51 /* Mac bootinfo struct */
52 struct mac_booter_data mac_bi_data;
54 /* The phys. video addr. - might be bogus on some machines */
55 static unsigned long mac_orig_videoaddr;
57 /* Mac specific timer functions */
58 extern u32 mac_gettimeoffset(void);
59 extern int mac_hwclk(int, struct rtc_time *);
60 extern void iop_preinit(void);
61 extern void iop_init(void);
62 extern void via_init(void);
63 extern void via_init_clock(irq_handler_t func);
64 extern void oss_init(void);
65 extern void psc_init(void);
66 extern void baboon_init(void);
68 extern void mac_mksound(unsigned int, unsigned int);
70 static void mac_get_model(char *str);
71 static void mac_identify(void);
72 static void mac_report_hardware(void);
74 static void __init mac_sched_init(irq_handler_t vector)
76 via_init_clock(vector);
80 * Parse a Macintosh-specific record in the bootinfo
83 int __init mac_parse_bootinfo(const struct bi_record *record)
86 const void *data = record->data;
88 switch (be16_to_cpu(record->tag)) {
90 mac_bi_data.id = be32_to_cpup(data);
93 mac_bi_data.videoaddr = be32_to_cpup(data);
96 mac_bi_data.videodepth = be32_to_cpup(data);
99 mac_bi_data.videorow = be32_to_cpup(data);
102 mac_bi_data.dimensions = be32_to_cpup(data);
104 case BI_MAC_VLOGICAL:
105 mac_orig_videoaddr = be32_to_cpup(data);
106 mac_bi_data.videological =
107 VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
110 mac_bi_data.sccbase = be32_to_cpup(data);
113 mac_bi_data.boottime = be32_to_cpup(data);
116 mac_bi_data.gmtbias = be32_to_cpup(data);
119 mac_bi_data.memsize = be32_to_cpup(data);
122 mac_bi_data.cpuid = be32_to_cpup(data);
125 mac_bi_data.rombase = be32_to_cpup(data);
134 void __init config_mac(void)
137 pr_err("ERROR: no Mac, but config_mac() called!!\n");
139 mach_sched_init = mac_sched_init;
140 mach_init_IRQ = mac_init_IRQ;
141 mach_get_model = mac_get_model;
142 arch_gettimeoffset = mac_gettimeoffset;
143 mach_hwclk = mac_hwclk;
144 mach_reset = mac_reset;
145 mach_halt = mac_poweroff;
146 mach_power_off = mac_poweroff;
147 mach_max_dma_address = 0xffffffff;
148 #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
149 mach_beep = mac_mksound;
153 * Determine hardware present
157 mac_report_hardware();
160 * AFAIK only the IIci takes a cache card. The IIfx has onboard
161 * cache ... someone needs to figure out how to tell if it's on or
165 if (macintosh_config->ident == MAC_MODEL_IICI)
166 mach_l2_flush = via_l2_flush;
171 * Macintosh Table: hardcoded model configuration data.
173 * Much of this was defined by Alan, based on who knows what docs.
174 * I've added a lot more, and some of that was pure guesswork based
175 * on hardware pages present on the Mac web site. Possibly wildly
176 * inaccurate, so look here if a new Mac model won't run. Example: if
177 * a Mac crashes immediately after the VIA1 registers have been dumped
178 * to the screen, it probably died attempting to read DirB on a RBV.
179 * Meaning it should have MAC_VIA_IICI here :-)
182 struct mac_model *macintosh_config;
183 EXPORT_SYMBOL(macintosh_config);
185 static struct mac_model mac_data_table[] = {
187 * We'll pretend to be a Macintosh II, that's pretty safe.
191 .ident = MAC_MODEL_II,
193 .adb_type = MAC_ADB_II,
194 .via_type = MAC_VIA_II,
195 .scsi_type = MAC_SCSI_OLD,
196 .scc_type = MAC_SCC_II,
197 .expansion_type = MAC_EXP_NUBUS,
198 .floppy_type = MAC_FLOPPY_IWM,
202 * Original Mac II hardware
206 .ident = MAC_MODEL_II,
208 .adb_type = MAC_ADB_II,
209 .via_type = MAC_VIA_II,
210 .scsi_type = MAC_SCSI_OLD,
211 .scc_type = MAC_SCC_II,
212 .expansion_type = MAC_EXP_NUBUS,
213 .floppy_type = MAC_FLOPPY_IWM,
215 .ident = MAC_MODEL_IIX,
217 .adb_type = MAC_ADB_II,
218 .via_type = MAC_VIA_II,
219 .scsi_type = MAC_SCSI_OLD,
220 .scc_type = MAC_SCC_II,
221 .expansion_type = MAC_EXP_NUBUS,
222 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
224 .ident = MAC_MODEL_IICX,
226 .adb_type = MAC_ADB_II,
227 .via_type = MAC_VIA_II,
228 .scsi_type = MAC_SCSI_OLD,
229 .scc_type = MAC_SCC_II,
230 .expansion_type = MAC_EXP_NUBUS,
231 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
233 .ident = MAC_MODEL_SE30,
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 .expansion_type = MAC_EXP_PDS,
240 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
244 * Weirdified Mac II hardware - all subtly different. Gee thanks
245 * Apple. All these boxes seem to have VIA2 in a different place to
246 * the Mac II (+1A000 rather than +4000)
247 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
251 .ident = MAC_MODEL_IICI,
253 .adb_type = MAC_ADB_II,
254 .via_type = MAC_VIA_IICI,
255 .scsi_type = MAC_SCSI_OLD,
256 .scc_type = MAC_SCC_II,
257 .expansion_type = MAC_EXP_NUBUS,
258 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
260 .ident = MAC_MODEL_IIFX,
262 .adb_type = MAC_ADB_IOP,
263 .via_type = MAC_VIA_IICI,
264 .scsi_type = MAC_SCSI_IIFX,
265 .scc_type = MAC_SCC_IOP,
266 .expansion_type = MAC_EXP_PDS_NUBUS,
267 .floppy_type = MAC_FLOPPY_SWIM_IOP,
269 .ident = MAC_MODEL_IISI,
271 .adb_type = MAC_ADB_EGRET,
272 .via_type = MAC_VIA_IICI,
273 .scsi_type = MAC_SCSI_OLD,
274 .scc_type = MAC_SCC_II,
275 .expansion_type = MAC_EXP_PDS_NUBUS,
276 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
278 .ident = MAC_MODEL_IIVI,
280 .adb_type = MAC_ADB_EGRET,
281 .via_type = MAC_VIA_IICI,
282 .scsi_type = MAC_SCSI_LC,
283 .scc_type = MAC_SCC_II,
284 .expansion_type = MAC_EXP_NUBUS,
285 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
287 .ident = MAC_MODEL_IIVX,
289 .adb_type = MAC_ADB_EGRET,
290 .via_type = MAC_VIA_IICI,
291 .scsi_type = MAC_SCSI_LC,
292 .scc_type = MAC_SCC_II,
293 .expansion_type = MAC_EXP_NUBUS,
294 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
298 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
302 .ident = MAC_MODEL_CLII,
303 .name = "Classic II",
304 .adb_type = MAC_ADB_EGRET,
305 .via_type = MAC_VIA_IICI,
306 .scsi_type = MAC_SCSI_LC,
307 .scc_type = MAC_SCC_II,
308 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
310 .ident = MAC_MODEL_CCL,
311 .name = "Color Classic",
312 .adb_type = MAC_ADB_CUDA,
313 .via_type = MAC_VIA_IICI,
314 .scsi_type = MAC_SCSI_LC,
315 .scc_type = MAC_SCC_II,
316 .expansion_type = MAC_EXP_PDS,
317 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
319 .ident = MAC_MODEL_CCLII,
320 .name = "Color Classic II",
321 .adb_type = MAC_ADB_CUDA,
322 .via_type = MAC_VIA_IICI,
323 .scsi_type = MAC_SCSI_LC,
324 .scc_type = MAC_SCC_II,
325 .expansion_type = MAC_EXP_PDS,
326 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
330 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
334 .ident = MAC_MODEL_LC,
336 .adb_type = MAC_ADB_EGRET,
337 .via_type = MAC_VIA_IICI,
338 .scsi_type = MAC_SCSI_LC,
339 .scc_type = MAC_SCC_II,
340 .expansion_type = MAC_EXP_PDS,
341 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
343 .ident = MAC_MODEL_LCII,
345 .adb_type = MAC_ADB_EGRET,
346 .via_type = MAC_VIA_IICI,
347 .scsi_type = MAC_SCSI_LC,
348 .scc_type = MAC_SCC_II,
349 .expansion_type = MAC_EXP_PDS,
350 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
352 .ident = MAC_MODEL_LCIII,
354 .adb_type = MAC_ADB_EGRET,
355 .via_type = MAC_VIA_IICI,
356 .scsi_type = MAC_SCSI_LC,
357 .scc_type = MAC_SCC_II,
358 .expansion_type = MAC_EXP_PDS,
359 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
363 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
364 * differently as some of the stuff connected to VIA2 seems different.
365 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
366 * the 660AV and 840AV which use an AMD 79C940 (MACE).
367 * The 700, 900 and 950 have some I/O chips in the wrong place to
368 * confuse us. The 840AV has a SCSI location of its own (same as
373 .ident = MAC_MODEL_Q605,
374 .name = "Quadra 605",
375 .adb_type = MAC_ADB_CUDA,
376 .via_type = MAC_VIA_QUADRA,
377 .scsi_type = MAC_SCSI_QUADRA,
378 .scc_type = MAC_SCC_QUADRA,
379 .expansion_type = MAC_EXP_PDS,
380 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
382 .ident = MAC_MODEL_Q605_ACC,
383 .name = "Quadra 605",
384 .adb_type = MAC_ADB_CUDA,
385 .via_type = MAC_VIA_QUADRA,
386 .scsi_type = MAC_SCSI_QUADRA,
387 .scc_type = MAC_SCC_QUADRA,
388 .expansion_type = MAC_EXP_PDS,
389 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
391 .ident = MAC_MODEL_Q610,
392 .name = "Quadra 610",
393 .adb_type = MAC_ADB_II,
394 .via_type = MAC_VIA_QUADRA,
395 .scsi_type = MAC_SCSI_QUADRA,
396 .scc_type = MAC_SCC_QUADRA,
397 .ether_type = MAC_ETHER_SONIC,
398 .expansion_type = MAC_EXP_PDS_NUBUS,
399 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
401 .ident = MAC_MODEL_Q630,
402 .name = "Quadra 630",
403 .adb_type = MAC_ADB_CUDA,
404 .via_type = MAC_VIA_QUADRA,
405 .scsi_type = MAC_SCSI_QUADRA,
406 .ide_type = MAC_IDE_QUADRA,
407 .scc_type = MAC_SCC_QUADRA,
408 .expansion_type = MAC_EXP_PDS_COMM,
409 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
411 .ident = MAC_MODEL_Q650,
412 .name = "Quadra 650",
413 .adb_type = MAC_ADB_II,
414 .via_type = MAC_VIA_QUADRA,
415 .scsi_type = MAC_SCSI_QUADRA,
416 .scc_type = MAC_SCC_QUADRA,
417 .ether_type = MAC_ETHER_SONIC,
418 .expansion_type = MAC_EXP_PDS_NUBUS,
419 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
421 /* The Q700 does have a NS Sonic */
423 .ident = MAC_MODEL_Q700,
424 .name = "Quadra 700",
425 .adb_type = MAC_ADB_II,
426 .via_type = MAC_VIA_QUADRA,
427 .scsi_type = MAC_SCSI_QUADRA2,
428 .scc_type = MAC_SCC_QUADRA,
429 .ether_type = MAC_ETHER_SONIC,
430 .expansion_type = MAC_EXP_PDS_NUBUS,
431 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
433 .ident = MAC_MODEL_Q800,
434 .name = "Quadra 800",
435 .adb_type = MAC_ADB_II,
436 .via_type = MAC_VIA_QUADRA,
437 .scsi_type = MAC_SCSI_QUADRA,
438 .scc_type = MAC_SCC_QUADRA,
439 .ether_type = MAC_ETHER_SONIC,
440 .expansion_type = MAC_EXP_PDS_NUBUS,
441 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
443 .ident = MAC_MODEL_Q840,
444 .name = "Quadra 840AV",
445 .adb_type = MAC_ADB_CUDA,
446 .via_type = MAC_VIA_QUADRA,
447 .scsi_type = MAC_SCSI_QUADRA3,
448 .scc_type = MAC_SCC_PSC,
449 .ether_type = MAC_ETHER_MACE,
450 .expansion_type = MAC_EXP_NUBUS,
451 .floppy_type = MAC_FLOPPY_AV,
453 .ident = MAC_MODEL_Q900,
454 .name = "Quadra 900",
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,
463 .ident = MAC_MODEL_Q950,
464 .name = "Quadra 950",
465 .adb_type = MAC_ADB_IOP,
466 .via_type = MAC_VIA_QUADRA,
467 .scsi_type = MAC_SCSI_QUADRA2,
468 .scc_type = MAC_SCC_IOP,
469 .ether_type = MAC_ETHER_SONIC,
470 .expansion_type = MAC_EXP_PDS_NUBUS,
471 .floppy_type = MAC_FLOPPY_SWIM_IOP,
475 * Performa - more LC type machines
479 .ident = MAC_MODEL_P460,
480 .name = "Performa 460",
481 .adb_type = MAC_ADB_EGRET,
482 .via_type = MAC_VIA_IICI,
483 .scsi_type = MAC_SCSI_LC,
484 .scc_type = MAC_SCC_II,
485 .expansion_type = MAC_EXP_PDS,
486 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
488 .ident = MAC_MODEL_P475,
489 .name = "Performa 475",
490 .adb_type = MAC_ADB_CUDA,
491 .via_type = MAC_VIA_QUADRA,
492 .scsi_type = MAC_SCSI_QUADRA,
493 .scc_type = MAC_SCC_II,
494 .expansion_type = MAC_EXP_PDS,
495 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
497 .ident = MAC_MODEL_P475F,
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 .expansion_type = MAC_EXP_PDS,
504 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
506 .ident = MAC_MODEL_P520,
507 .name = "Performa 520",
508 .adb_type = MAC_ADB_CUDA,
509 .via_type = MAC_VIA_IICI,
510 .scsi_type = MAC_SCSI_LC,
511 .scc_type = MAC_SCC_II,
512 .expansion_type = MAC_EXP_PDS,
513 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
515 .ident = MAC_MODEL_P550,
516 .name = "Performa 550",
517 .adb_type = MAC_ADB_CUDA,
518 .via_type = MAC_VIA_IICI,
519 .scsi_type = MAC_SCSI_LC,
520 .scc_type = MAC_SCC_II,
521 .expansion_type = MAC_EXP_PDS,
522 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
524 /* These have the comm slot, and therefore possibly SONIC ethernet */
526 .ident = MAC_MODEL_P575,
527 .name = "Performa 575",
528 .adb_type = MAC_ADB_CUDA,
529 .via_type = MAC_VIA_QUADRA,
530 .scsi_type = MAC_SCSI_QUADRA,
531 .scc_type = MAC_SCC_II,
532 .expansion_type = MAC_EXP_PDS_COMM,
533 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
535 .ident = MAC_MODEL_P588,
536 .name = "Performa 588",
537 .adb_type = MAC_ADB_CUDA,
538 .via_type = MAC_VIA_QUADRA,
539 .scsi_type = MAC_SCSI_QUADRA,
540 .ide_type = MAC_IDE_QUADRA,
541 .scc_type = MAC_SCC_II,
542 .expansion_type = MAC_EXP_PDS_COMM,
543 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
545 .ident = MAC_MODEL_TV,
547 .adb_type = MAC_ADB_CUDA,
548 .via_type = MAC_VIA_IICI,
549 .scsi_type = MAC_SCSI_LC,
550 .scc_type = MAC_SCC_II,
551 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
553 .ident = MAC_MODEL_P600,
554 .name = "Performa 600",
555 .adb_type = MAC_ADB_EGRET,
556 .via_type = MAC_VIA_IICI,
557 .scsi_type = MAC_SCSI_LC,
558 .scc_type = MAC_SCC_II,
559 .expansion_type = MAC_EXP_NUBUS,
560 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
564 * Centris - just guessing again; maybe like Quadra.
565 * The C610 may or may not have SONIC. We probe to make sure.
569 .ident = MAC_MODEL_C610,
570 .name = "Centris 610",
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_SWIM_ADDR1,
579 .ident = MAC_MODEL_C650,
580 .name = "Centris 650",
581 .adb_type = MAC_ADB_II,
582 .via_type = MAC_VIA_QUADRA,
583 .scsi_type = MAC_SCSI_QUADRA,
584 .scc_type = MAC_SCC_QUADRA,
585 .ether_type = MAC_ETHER_SONIC,
586 .expansion_type = MAC_EXP_PDS_NUBUS,
587 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
589 .ident = MAC_MODEL_C660,
590 .name = "Centris 660AV",
591 .adb_type = MAC_ADB_CUDA,
592 .via_type = MAC_VIA_QUADRA,
593 .scsi_type = MAC_SCSI_QUADRA3,
594 .scc_type = MAC_SCC_PSC,
595 .ether_type = MAC_ETHER_MACE,
596 .expansion_type = MAC_EXP_PDS_NUBUS,
597 .floppy_type = MAC_FLOPPY_AV,
601 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
602 * and a PMU (in two variations?) for ADB. Most of them use the
603 * Quadra-style VIAs. A few models also have IDE from hell.
607 .ident = MAC_MODEL_PB140,
608 .name = "PowerBook 140",
609 .adb_type = MAC_ADB_PB1,
610 .via_type = MAC_VIA_QUADRA,
611 .scsi_type = MAC_SCSI_OLD,
612 .scc_type = MAC_SCC_QUADRA,
613 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
615 .ident = MAC_MODEL_PB145,
616 .name = "PowerBook 145",
617 .adb_type = MAC_ADB_PB1,
618 .via_type = MAC_VIA_QUADRA,
619 .scsi_type = MAC_SCSI_OLD,
620 .scc_type = MAC_SCC_QUADRA,
621 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
623 .ident = MAC_MODEL_PB150,
624 .name = "PowerBook 150",
625 .adb_type = MAC_ADB_PB2,
626 .via_type = MAC_VIA_IICI,
627 .scsi_type = MAC_SCSI_OLD,
628 .ide_type = MAC_IDE_PB,
629 .scc_type = MAC_SCC_QUADRA,
630 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
632 .ident = MAC_MODEL_PB160,
633 .name = "PowerBook 160",
634 .adb_type = MAC_ADB_PB1,
635 .via_type = MAC_VIA_QUADRA,
636 .scsi_type = MAC_SCSI_OLD,
637 .scc_type = MAC_SCC_QUADRA,
638 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
640 .ident = MAC_MODEL_PB165,
641 .name = "PowerBook 165",
642 .adb_type = MAC_ADB_PB1,
643 .via_type = MAC_VIA_QUADRA,
644 .scsi_type = MAC_SCSI_OLD,
645 .scc_type = MAC_SCC_QUADRA,
646 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
648 .ident = MAC_MODEL_PB165C,
649 .name = "PowerBook 165c",
650 .adb_type = MAC_ADB_PB1,
651 .via_type = MAC_VIA_QUADRA,
652 .scsi_type = MAC_SCSI_OLD,
653 .scc_type = MAC_SCC_QUADRA,
654 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
656 .ident = MAC_MODEL_PB170,
657 .name = "PowerBook 170",
658 .adb_type = MAC_ADB_PB1,
659 .via_type = MAC_VIA_QUADRA,
660 .scsi_type = MAC_SCSI_OLD,
661 .scc_type = MAC_SCC_QUADRA,
662 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
664 .ident = MAC_MODEL_PB180,
665 .name = "PowerBook 180",
666 .adb_type = MAC_ADB_PB1,
667 .via_type = MAC_VIA_QUADRA,
668 .scsi_type = MAC_SCSI_OLD,
669 .scc_type = MAC_SCC_QUADRA,
670 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
672 .ident = MAC_MODEL_PB180C,
673 .name = "PowerBook 180c",
674 .adb_type = MAC_ADB_PB1,
675 .via_type = MAC_VIA_QUADRA,
676 .scsi_type = MAC_SCSI_OLD,
677 .scc_type = MAC_SCC_QUADRA,
678 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
680 .ident = MAC_MODEL_PB190,
681 .name = "PowerBook 190",
682 .adb_type = MAC_ADB_PB2,
683 .via_type = MAC_VIA_QUADRA,
684 .scsi_type = MAC_SCSI_OLD,
685 .ide_type = MAC_IDE_BABOON,
686 .scc_type = MAC_SCC_QUADRA,
687 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
689 .ident = MAC_MODEL_PB520,
690 .name = "PowerBook 520",
691 .adb_type = MAC_ADB_PB2,
692 .via_type = MAC_VIA_QUADRA,
693 .scsi_type = MAC_SCSI_OLD,
694 .scc_type = MAC_SCC_QUADRA,
695 .ether_type = MAC_ETHER_SONIC,
696 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
700 * PowerBook Duos are pretty much like normal PowerBooks
701 * All of these probably have onboard SONIC in the Dock which
702 * means we'll have to probe for it eventually.
706 .ident = MAC_MODEL_PB210,
707 .name = "PowerBook Duo 210",
708 .adb_type = MAC_ADB_PB2,
709 .via_type = MAC_VIA_IICI,
710 .scsi_type = MAC_SCSI_DUO,
711 .scc_type = MAC_SCC_QUADRA,
712 .expansion_type = MAC_EXP_NUBUS,
713 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
715 .ident = MAC_MODEL_PB230,
716 .name = "PowerBook Duo 230",
717 .adb_type = MAC_ADB_PB2,
718 .via_type = MAC_VIA_IICI,
719 .scsi_type = MAC_SCSI_DUO,
720 .scc_type = MAC_SCC_QUADRA,
721 .expansion_type = MAC_EXP_NUBUS,
722 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
724 .ident = MAC_MODEL_PB250,
725 .name = "PowerBook Duo 250",
726 .adb_type = MAC_ADB_PB2,
727 .via_type = MAC_VIA_IICI,
728 .scsi_type = MAC_SCSI_DUO,
729 .scc_type = MAC_SCC_QUADRA,
730 .expansion_type = MAC_EXP_NUBUS,
731 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
733 .ident = MAC_MODEL_PB270C,
734 .name = "PowerBook Duo 270c",
735 .adb_type = MAC_ADB_PB2,
736 .via_type = MAC_VIA_IICI,
737 .scsi_type = MAC_SCSI_DUO,
738 .scc_type = MAC_SCC_QUADRA,
739 .expansion_type = MAC_EXP_NUBUS,
740 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
742 .ident = MAC_MODEL_PB280,
743 .name = "PowerBook Duo 280",
744 .adb_type = MAC_ADB_PB2,
745 .via_type = MAC_VIA_IICI,
746 .scsi_type = MAC_SCSI_DUO,
747 .scc_type = MAC_SCC_QUADRA,
748 .expansion_type = MAC_EXP_NUBUS,
749 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
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_DUO,
756 .scc_type = MAC_SCC_QUADRA,
757 .expansion_type = MAC_EXP_NUBUS,
758 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
770 static struct resource scc_a_rsrcs[] = {
771 { .flags = IORESOURCE_MEM },
772 { .flags = IORESOURCE_IRQ },
775 static struct resource scc_b_rsrcs[] = {
776 { .flags = IORESOURCE_MEM },
777 { .flags = IORESOURCE_IRQ },
780 struct platform_device scc_a_pdev = {
783 .num_resources = ARRAY_SIZE(scc_a_rsrcs),
784 .resource = scc_a_rsrcs,
786 EXPORT_SYMBOL(scc_a_pdev);
788 struct platform_device scc_b_pdev = {
791 .num_resources = ARRAY_SIZE(scc_b_rsrcs),
792 .resource = scc_b_rsrcs,
794 EXPORT_SYMBOL(scc_b_pdev);
796 static void __init mac_identify(void)
800 /* Penguin data useful? */
801 int model = mac_bi_data.id;
803 /* no bootinfo model id -> NetBSD booter was used! */
804 /* XXX FIXME: breaks for model > 31 */
805 model = (mac_bi_data.cpuid >> 2) & 63;
806 pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
809 macintosh_config = mac_data_table;
810 for (m = macintosh_config; m->ident != -1; m++) {
811 if (m->ident == model) {
812 macintosh_config = m;
817 /* Set up serial port resources for the console initcall. */
819 scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
820 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
821 scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
822 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
824 switch (macintosh_config->scc_type) {
826 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
827 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
830 /* On non-PSC machines, the serial ports share an IRQ. */
831 if (macintosh_config->ident == MAC_MODEL_IIFX) {
832 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
833 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
835 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
836 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
842 * We need to pre-init the IOPs, if any. Otherwise
843 * the serial console won't work if the user had
844 * the serial ports set to "Faster" mode in MacOS.
848 pr_info("Detected Macintosh model: %d\n", model);
851 * Report booter data:
853 printk(KERN_DEBUG " Penguin bootinfo data:\n");
854 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
855 mac_bi_data.videoaddr, mac_bi_data.videorow,
856 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
857 mac_bi_data.dimensions >> 16);
858 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
859 mac_bi_data.videological, mac_orig_videoaddr,
860 mac_bi_data.sccbase);
861 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
862 mac_bi_data.boottime, mac_bi_data.gmtbias);
863 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
864 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
872 #ifdef CONFIG_ADB_CUDA
875 #ifdef CONFIG_ADB_PMU
880 static void __init mac_report_hardware(void)
882 pr_info("Apple Macintosh %s\n", macintosh_config->name);
885 static void mac_get_model(char *str)
887 strcpy(str, "Macintosh ");
888 strcat(str, macintosh_config->name);
891 static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
893 .flags = IORESOURCE_IRQ,
894 .start = IRQ_MAC_SCSI,
897 .flags = IORESOURCE_MEM,
903 static const struct resource mac_scsi_duo_rsrc[] __initconst = {
905 .flags = IORESOURCE_MEM,
911 static const struct resource mac_scsi_old_rsrc[] __initconst = {
913 .flags = IORESOURCE_IRQ,
914 .start = IRQ_MAC_SCSI,
917 .flags = IORESOURCE_MEM,
921 .flags = IORESOURCE_MEM,
927 static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
929 .flags = IORESOURCE_IRQ,
930 .start = IRQ_MAC_SCSI,
933 .flags = IORESOURCE_MEM,
937 .flags = IORESOURCE_MEM,
943 int __init mac_platform_init(void)
954 platform_device_register(&scc_a_pdev);
955 platform_device_register(&scc_b_pdev);
961 switch (macintosh_config->floppy_type) {
962 case MAC_FLOPPY_SWIM_ADDR1:
963 swim_base = (u8 *)(VIA1_BASE + 0x1E000);
965 case MAC_FLOPPY_SWIM_ADDR2:
966 swim_base = (u8 *)(VIA1_BASE + 0x16000);
974 struct resource swim_rsrc = {
975 .flags = IORESOURCE_MEM,
976 .start = (resource_size_t)swim_base,
977 .end = (resource_size_t)swim_base + 0x1FFF,
980 platform_device_register_simple("swim", -1, &swim_rsrc, 1);
987 switch (macintosh_config->scsi_type) {
988 case MAC_SCSI_QUADRA:
989 case MAC_SCSI_QUADRA3:
990 platform_device_register_simple("mac_esp", 0, NULL, 0);
992 case MAC_SCSI_QUADRA2:
993 platform_device_register_simple("mac_esp", 0, NULL, 0);
994 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
995 (macintosh_config->ident == MAC_MODEL_Q950))
996 platform_device_register_simple("mac_esp", 1, NULL, 0);
999 /* Addresses from The Guide to Mac Family Hardware.
1000 * $5000 8000 - $5000 9FFF: SCSI DMA
1001 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
1002 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
1003 * The SCSI DMA custom IC embeds the 53C80 core. mac_scsi does
1004 * not make use of its DMA or hardware handshaking logic.
1006 platform_device_register_simple("mac_scsi", 0,
1007 mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
1010 /* Addresses from the Duo Dock II Developer Note.
1011 * $FEE0 2000 - $FEE0 3FFF: normal mode
1012 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
1013 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
1014 * The NetBSD code indicates that both 5380 chips share
1015 * an IRQ (?) which would need careful handling (see mac_esp).
1017 platform_device_register_simple("mac_scsi", 1,
1018 mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
1021 /* Addresses from Developer Notes for Duo System,
1022 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
1023 * and also from The Guide to Mac Family Hardware for
1024 * SE/30, II, IIx, IIcx, IIci.
1025 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
1026 * $5001 0000 - $5001 1FFF: normal mode
1027 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
1028 * GMFH says that $5000 0000 - $50FF FFFF "wraps
1029 * $5000 0000 - $5001 FFFF eight times" (!)
1030 * mess.org says IIci and Color Classic do not alias
1031 * I/O address space.
1033 platform_device_register_simple("mac_scsi", 0,
1034 mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
1037 /* Addresses from Mac LC data in Designing Cards & Drivers 3ed.
1038 * Also from the Developer Notes for Classic II, LC III,
1039 * Color Classic and IIvx.
1040 * $50F0 6000 - $50F0 7FFF: SCSI handshake
1041 * $50F1 0000 - $50F1 1FFF: SCSI
1042 * $50F1 2000 - $50F1 3FFF: SCSI DMA
1044 platform_device_register_simple("mac_scsi", 0,
1045 mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
1053 if (macintosh_config->ether_type == MAC_ETHER_SONIC ||
1054 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1055 platform_device_register_simple("macsonic", -1, NULL, 0);
1057 if (macintosh_config->expansion_type == MAC_EXP_PDS ||
1058 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1059 platform_device_register_simple("mac89x0", -1, NULL, 0);
1061 if (macintosh_config->ether_type == MAC_ETHER_MACE)
1062 platform_device_register_simple("macmace", -1, NULL, 0);
1067 arch_initcall(mac_platform_init);