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/module.h>
14 #include <linux/types.h>
16 #include <linux/tty.h>
17 #include <linux/console.h>
18 #include <linux/interrupt.h>
20 #include <linux/random.h>
21 #include <linux/delay.h>
23 #include <linux/init.h>
24 #include <linux/vt_kern.h>
25 #include <linux/platform_device.h>
26 #include <linux/adb.h>
27 #include <linux/cuda.h>
29 #include <asm/setup.h>
30 #include <asm/bootinfo.h>
31 #include <asm/bootinfo-mac.h>
32 #include <asm/byteorder.h>
36 #include <asm/pgtable.h>
38 #include <asm/machdep.h>
40 #include <asm/macintosh.h>
41 #include <asm/macints.h>
42 #include <asm/machw.h>
44 #include <asm/mac_iop.h>
45 #include <asm/mac_via.h>
46 #include <asm/mac_oss.h>
47 #include <asm/mac_psc.h>
49 /* Mac bootinfo struct */
50 struct mac_booter_data mac_bi_data
;
52 /* The phys. video addr. - might be bogus on some machines */
53 static unsigned long mac_orig_videoaddr
;
55 /* Mac specific timer functions */
56 extern u32
mac_gettimeoffset(void);
57 extern int mac_hwclk(int, struct rtc_time
*);
58 extern int mac_set_clock_mmss(unsigned long);
59 extern void iop_preinit(void);
60 extern void iop_init(void);
61 extern void via_init(void);
62 extern void via_init_clock(irq_handler_t func
);
63 extern void via_flush_cache(void);
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
);
135 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
136 * have to disable interrupts for this. Our IRQ handlers will crap
137 * themselves if they take an IRQ in 24bit mode!
140 static void mac_cache_card_flush(int writeback
)
144 local_irq_save(flags
);
146 local_irq_restore(flags
);
149 void __init
config_mac(void)
152 printk(KERN_ERR
"ERROR: no Mac, but config_mac() called!!\n");
154 mach_sched_init
= mac_sched_init
;
155 mach_init_IRQ
= mac_init_IRQ
;
156 mach_get_model
= mac_get_model
;
157 arch_gettimeoffset
= mac_gettimeoffset
;
158 mach_hwclk
= mac_hwclk
;
159 mach_set_clock_mmss
= mac_set_clock_mmss
;
160 mach_reset
= mac_reset
;
161 mach_halt
= mac_poweroff
;
162 mach_power_off
= mac_poweroff
;
163 mach_max_dma_address
= 0xffffffff;
164 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
165 mach_beep
= mac_mksound
;
169 * Determine hardware present
173 mac_report_hardware();
176 * AFAIK only the IIci takes a cache card. The IIfx has onboard
177 * cache ... someone needs to figure out how to tell if it's on or
181 if (macintosh_config
->ident
== MAC_MODEL_IICI
182 || macintosh_config
->ident
== MAC_MODEL_IIFX
)
183 mach_l2_flush
= mac_cache_card_flush
;
188 * Macintosh Table: hardcoded model configuration data.
190 * Much of this was defined by Alan, based on who knows what docs.
191 * I've added a lot more, and some of that was pure guesswork based
192 * on hardware pages present on the Mac web site. Possibly wildly
193 * inaccurate, so look here if a new Mac model won't run. Example: if
194 * a Mac crashes immediately after the VIA1 registers have been dumped
195 * to the screen, it probably died attempting to read DirB on a RBV.
196 * Meaning it should have MAC_VIA_IICI here :-)
199 struct mac_model
*macintosh_config
;
200 EXPORT_SYMBOL(macintosh_config
);
202 static struct mac_model mac_data_table
[] = {
204 * We'll pretend to be a Macintosh II, that's pretty safe.
208 .ident
= MAC_MODEL_II
,
210 .adb_type
= MAC_ADB_II
,
211 .via_type
= MAC_VIA_II
,
212 .scsi_type
= MAC_SCSI_OLD
,
213 .scc_type
= MAC_SCC_II
,
214 .nubus_type
= MAC_NUBUS
,
215 .floppy_type
= MAC_FLOPPY_IWM
,
219 * Original Mac II hardware
223 .ident
= MAC_MODEL_II
,
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 .nubus_type
= MAC_NUBUS
,
230 .floppy_type
= MAC_FLOPPY_IWM
,
232 .ident
= MAC_MODEL_IIX
,
234 .adb_type
= MAC_ADB_II
,
235 .via_type
= MAC_VIA_II
,
236 .scsi_type
= MAC_SCSI_OLD
,
237 .scc_type
= MAC_SCC_II
,
238 .nubus_type
= MAC_NUBUS
,
239 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
241 .ident
= MAC_MODEL_IICX
,
243 .adb_type
= MAC_ADB_II
,
244 .via_type
= MAC_VIA_II
,
245 .scsi_type
= MAC_SCSI_OLD
,
246 .scc_type
= MAC_SCC_II
,
247 .nubus_type
= MAC_NUBUS
,
248 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
250 .ident
= MAC_MODEL_SE30
,
252 .adb_type
= MAC_ADB_II
,
253 .via_type
= MAC_VIA_II
,
254 .scsi_type
= MAC_SCSI_OLD
,
255 .scc_type
= MAC_SCC_II
,
256 .nubus_type
= MAC_NUBUS
,
257 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
261 * Weirdified Mac II hardware - all subtly different. Gee thanks
262 * Apple. All these boxes seem to have VIA2 in a different place to
263 * the Mac II (+1A000 rather than +4000)
264 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
268 .ident
= MAC_MODEL_IICI
,
270 .adb_type
= MAC_ADB_II
,
271 .via_type
= MAC_VIA_IICI
,
272 .scsi_type
= MAC_SCSI_OLD
,
273 .scc_type
= MAC_SCC_II
,
274 .nubus_type
= MAC_NUBUS
,
275 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
277 .ident
= MAC_MODEL_IIFX
,
279 .adb_type
= MAC_ADB_IOP
,
280 .via_type
= MAC_VIA_IICI
,
281 .scsi_type
= MAC_SCSI_IIFX
,
282 .scc_type
= MAC_SCC_IOP
,
283 .nubus_type
= MAC_NUBUS
,
284 .floppy_type
= MAC_FLOPPY_SWIM_IOP
,
286 .ident
= MAC_MODEL_IISI
,
288 .adb_type
= MAC_ADB_IISI
,
289 .via_type
= MAC_VIA_IICI
,
290 .scsi_type
= MAC_SCSI_OLD
,
291 .scc_type
= MAC_SCC_II
,
292 .nubus_type
= MAC_NUBUS
,
293 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
295 .ident
= MAC_MODEL_IIVI
,
297 .adb_type
= MAC_ADB_IISI
,
298 .via_type
= MAC_VIA_IICI
,
299 .scsi_type
= MAC_SCSI_LC
,
300 .scc_type
= MAC_SCC_II
,
301 .nubus_type
= MAC_NUBUS
,
302 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
304 .ident
= MAC_MODEL_IIVX
,
306 .adb_type
= MAC_ADB_IISI
,
307 .via_type
= MAC_VIA_IICI
,
308 .scsi_type
= MAC_SCSI_LC
,
309 .scc_type
= MAC_SCC_II
,
310 .nubus_type
= MAC_NUBUS
,
311 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
315 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
319 .ident
= MAC_MODEL_CLII
,
320 .name
= "Classic II",
321 .adb_type
= MAC_ADB_IISI
,
322 .via_type
= MAC_VIA_IICI
,
323 .scsi_type
= MAC_SCSI_LC
,
324 .scc_type
= MAC_SCC_II
,
325 .nubus_type
= MAC_NUBUS
,
326 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
328 .ident
= MAC_MODEL_CCL
,
329 .name
= "Color Classic",
330 .adb_type
= MAC_ADB_CUDA
,
331 .via_type
= MAC_VIA_IICI
,
332 .scsi_type
= MAC_SCSI_LC
,
333 .scc_type
= MAC_SCC_II
,
334 .nubus_type
= MAC_NUBUS
,
335 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
337 .ident
= MAC_MODEL_CCLII
,
338 .name
= "Color Classic II",
339 .adb_type
= MAC_ADB_CUDA
,
340 .via_type
= MAC_VIA_IICI
,
341 .scsi_type
= MAC_SCSI_LC
,
342 .scc_type
= MAC_SCC_II
,
343 .nubus_type
= MAC_NUBUS
,
344 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
348 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
352 .ident
= MAC_MODEL_LC
,
354 .adb_type
= MAC_ADB_IISI
,
355 .via_type
= MAC_VIA_IICI
,
356 .scsi_type
= MAC_SCSI_LC
,
357 .scc_type
= MAC_SCC_II
,
358 .nubus_type
= MAC_NUBUS
,
359 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
361 .ident
= MAC_MODEL_LCII
,
363 .adb_type
= MAC_ADB_IISI
,
364 .via_type
= MAC_VIA_IICI
,
365 .scsi_type
= MAC_SCSI_LC
,
366 .scc_type
= MAC_SCC_II
,
367 .nubus_type
= MAC_NUBUS
,
368 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
370 .ident
= MAC_MODEL_LCIII
,
372 .adb_type
= MAC_ADB_IISI
,
373 .via_type
= MAC_VIA_IICI
,
374 .scsi_type
= MAC_SCSI_LC
,
375 .scc_type
= MAC_SCC_II
,
376 .nubus_type
= MAC_NUBUS
,
377 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
381 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
382 * differently as some of the stuff connected to VIA2 seems different.
383 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
384 * the 660AV and 840AV which use an AMD 79C940 (MACE).
385 * The 700, 900 and 950 have some I/O chips in the wrong place to
386 * confuse us. The 840AV has a SCSI location of its own (same as
391 .ident
= MAC_MODEL_Q605
,
392 .name
= "Quadra 605",
393 .adb_type
= MAC_ADB_CUDA
,
394 .via_type
= MAC_VIA_QUADRA
,
395 .scsi_type
= MAC_SCSI_QUADRA
,
396 .scc_type
= MAC_SCC_QUADRA
,
397 .nubus_type
= MAC_NUBUS
,
398 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
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 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
409 .ident
= MAC_MODEL_Q610
,
410 .name
= "Quadra 610",
411 .adb_type
= MAC_ADB_II
,
412 .via_type
= MAC_VIA_QUADRA
,
413 .scsi_type
= MAC_SCSI_QUADRA
,
414 .scc_type
= MAC_SCC_QUADRA
,
415 .ether_type
= MAC_ETHER_SONIC
,
416 .nubus_type
= MAC_NUBUS
,
417 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
419 .ident
= MAC_MODEL_Q630
,
420 .name
= "Quadra 630",
421 .adb_type
= MAC_ADB_CUDA
,
422 .via_type
= MAC_VIA_QUADRA
,
423 .scsi_type
= MAC_SCSI_QUADRA
,
424 .ide_type
= MAC_IDE_QUADRA
,
425 .scc_type
= MAC_SCC_QUADRA
,
426 .ether_type
= MAC_ETHER_SONIC
,
427 .nubus_type
= MAC_NUBUS
,
428 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
430 .ident
= MAC_MODEL_Q650
,
431 .name
= "Quadra 650",
432 .adb_type
= MAC_ADB_II
,
433 .via_type
= MAC_VIA_QUADRA
,
434 .scsi_type
= MAC_SCSI_QUADRA
,
435 .scc_type
= MAC_SCC_QUADRA
,
436 .ether_type
= MAC_ETHER_SONIC
,
437 .nubus_type
= MAC_NUBUS
,
438 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
440 /* The Q700 does have a NS Sonic */
442 .ident
= MAC_MODEL_Q700
,
443 .name
= "Quadra 700",
444 .adb_type
= MAC_ADB_II
,
445 .via_type
= MAC_VIA_QUADRA
,
446 .scsi_type
= MAC_SCSI_QUADRA2
,
447 .scc_type
= MAC_SCC_QUADRA
,
448 .ether_type
= MAC_ETHER_SONIC
,
449 .nubus_type
= MAC_NUBUS
,
450 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
452 .ident
= MAC_MODEL_Q800
,
453 .name
= "Quadra 800",
454 .adb_type
= MAC_ADB_II
,
455 .via_type
= MAC_VIA_QUADRA
,
456 .scsi_type
= MAC_SCSI_QUADRA
,
457 .scc_type
= MAC_SCC_QUADRA
,
458 .ether_type
= MAC_ETHER_SONIC
,
459 .nubus_type
= MAC_NUBUS
,
460 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
462 .ident
= MAC_MODEL_Q840
,
463 .name
= "Quadra 840AV",
464 .adb_type
= MAC_ADB_CUDA
,
465 .via_type
= MAC_VIA_QUADRA
,
466 .scsi_type
= MAC_SCSI_QUADRA3
,
467 .scc_type
= MAC_SCC_PSC
,
468 .ether_type
= MAC_ETHER_MACE
,
469 .nubus_type
= MAC_NUBUS
,
470 .floppy_type
= MAC_FLOPPY_AV
,
472 .ident
= MAC_MODEL_Q900
,
473 .name
= "Quadra 900",
474 .adb_type
= MAC_ADB_IOP
,
475 .via_type
= MAC_VIA_QUADRA
,
476 .scsi_type
= MAC_SCSI_QUADRA2
,
477 .scc_type
= MAC_SCC_IOP
,
478 .ether_type
= MAC_ETHER_SONIC
,
479 .nubus_type
= MAC_NUBUS
,
480 .floppy_type
= MAC_FLOPPY_SWIM_IOP
,
482 .ident
= MAC_MODEL_Q950
,
483 .name
= "Quadra 950",
484 .adb_type
= MAC_ADB_IOP
,
485 .via_type
= MAC_VIA_QUADRA
,
486 .scsi_type
= MAC_SCSI_QUADRA2
,
487 .scc_type
= MAC_SCC_IOP
,
488 .ether_type
= MAC_ETHER_SONIC
,
489 .nubus_type
= MAC_NUBUS
,
490 .floppy_type
= MAC_FLOPPY_SWIM_IOP
,
494 * Performa - more LC type machines
498 .ident
= MAC_MODEL_P460
,
499 .name
= "Performa 460",
500 .adb_type
= MAC_ADB_IISI
,
501 .via_type
= MAC_VIA_IICI
,
502 .scsi_type
= MAC_SCSI_LC
,
503 .scc_type
= MAC_SCC_II
,
504 .nubus_type
= MAC_NUBUS
,
505 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
507 .ident
= MAC_MODEL_P475
,
508 .name
= "Performa 475",
509 .adb_type
= MAC_ADB_CUDA
,
510 .via_type
= MAC_VIA_QUADRA
,
511 .scsi_type
= MAC_SCSI_QUADRA
,
512 .scc_type
= MAC_SCC_II
,
513 .nubus_type
= MAC_NUBUS
,
514 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
516 .ident
= MAC_MODEL_P475F
,
517 .name
= "Performa 475",
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 .nubus_type
= MAC_NUBUS
,
523 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
525 .ident
= MAC_MODEL_P520
,
526 .name
= "Performa 520",
527 .adb_type
= MAC_ADB_CUDA
,
528 .via_type
= MAC_VIA_IICI
,
529 .scsi_type
= MAC_SCSI_LC
,
530 .scc_type
= MAC_SCC_II
,
531 .nubus_type
= MAC_NUBUS
,
532 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
534 .ident
= MAC_MODEL_P550
,
535 .name
= "Performa 550",
536 .adb_type
= MAC_ADB_CUDA
,
537 .via_type
= MAC_VIA_IICI
,
538 .scsi_type
= MAC_SCSI_LC
,
539 .scc_type
= MAC_SCC_II
,
540 .nubus_type
= MAC_NUBUS
,
541 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
543 /* These have the comm slot, and therefore possibly SONIC ethernet */
545 .ident
= MAC_MODEL_P575
,
546 .name
= "Performa 575",
547 .adb_type
= MAC_ADB_CUDA
,
548 .via_type
= MAC_VIA_QUADRA
,
549 .scsi_type
= MAC_SCSI_QUADRA
,
550 .scc_type
= MAC_SCC_II
,
551 .ether_type
= MAC_ETHER_SONIC
,
552 .nubus_type
= MAC_NUBUS
,
553 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
555 .ident
= MAC_MODEL_P588
,
556 .name
= "Performa 588",
557 .adb_type
= MAC_ADB_CUDA
,
558 .via_type
= MAC_VIA_QUADRA
,
559 .scsi_type
= MAC_SCSI_QUADRA
,
560 .ide_type
= MAC_IDE_QUADRA
,
561 .scc_type
= MAC_SCC_II
,
562 .ether_type
= MAC_ETHER_SONIC
,
563 .nubus_type
= MAC_NUBUS
,
564 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
566 .ident
= MAC_MODEL_TV
,
568 .adb_type
= MAC_ADB_CUDA
,
569 .via_type
= MAC_VIA_IICI
,
570 .scsi_type
= MAC_SCSI_LC
,
571 .scc_type
= MAC_SCC_II
,
572 .nubus_type
= MAC_NUBUS
,
573 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
575 .ident
= MAC_MODEL_P600
,
576 .name
= "Performa 600",
577 .adb_type
= MAC_ADB_IISI
,
578 .via_type
= MAC_VIA_IICI
,
579 .scsi_type
= MAC_SCSI_LC
,
580 .scc_type
= MAC_SCC_II
,
581 .nubus_type
= MAC_NUBUS
,
582 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
586 * Centris - just guessing again; maybe like Quadra.
587 * The C610 may or may not have SONIC. We probe to make sure.
591 .ident
= MAC_MODEL_C610
,
592 .name
= "Centris 610",
593 .adb_type
= MAC_ADB_II
,
594 .via_type
= MAC_VIA_QUADRA
,
595 .scsi_type
= MAC_SCSI_QUADRA
,
596 .scc_type
= MAC_SCC_QUADRA
,
597 .ether_type
= MAC_ETHER_SONIC
,
598 .nubus_type
= MAC_NUBUS
,
599 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
601 .ident
= MAC_MODEL_C650
,
602 .name
= "Centris 650",
603 .adb_type
= MAC_ADB_II
,
604 .via_type
= MAC_VIA_QUADRA
,
605 .scsi_type
= MAC_SCSI_QUADRA
,
606 .scc_type
= MAC_SCC_QUADRA
,
607 .ether_type
= MAC_ETHER_SONIC
,
608 .nubus_type
= MAC_NUBUS
,
609 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
611 .ident
= MAC_MODEL_C660
,
612 .name
= "Centris 660AV",
613 .adb_type
= MAC_ADB_CUDA
,
614 .via_type
= MAC_VIA_QUADRA
,
615 .scsi_type
= MAC_SCSI_QUADRA3
,
616 .scc_type
= MAC_SCC_PSC
,
617 .ether_type
= MAC_ETHER_MACE
,
618 .nubus_type
= MAC_NUBUS
,
619 .floppy_type
= MAC_FLOPPY_AV
,
623 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
624 * and a PMU (in two variations?) for ADB. Most of them use the
625 * Quadra-style VIAs. A few models also have IDE from hell.
629 .ident
= MAC_MODEL_PB140
,
630 .name
= "PowerBook 140",
631 .adb_type
= MAC_ADB_PB1
,
632 .via_type
= MAC_VIA_QUADRA
,
633 .scsi_type
= MAC_SCSI_OLD
,
634 .scc_type
= MAC_SCC_QUADRA
,
635 .nubus_type
= MAC_NUBUS
,
636 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
638 .ident
= MAC_MODEL_PB145
,
639 .name
= "PowerBook 145",
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 .nubus_type
= MAC_NUBUS
,
645 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
647 .ident
= MAC_MODEL_PB150
,
648 .name
= "PowerBook 150",
649 .adb_type
= MAC_ADB_PB2
,
650 .via_type
= MAC_VIA_IICI
,
651 .scsi_type
= MAC_SCSI_OLD
,
652 .ide_type
= MAC_IDE_PB
,
653 .scc_type
= MAC_SCC_QUADRA
,
654 .nubus_type
= MAC_NUBUS
,
655 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
657 .ident
= MAC_MODEL_PB160
,
658 .name
= "PowerBook 160",
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 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
666 .ident
= MAC_MODEL_PB165
,
667 .name
= "PowerBook 165",
668 .adb_type
= MAC_ADB_PB1
,
669 .via_type
= MAC_VIA_QUADRA
,
670 .scsi_type
= MAC_SCSI_OLD
,
671 .scc_type
= MAC_SCC_QUADRA
,
672 .nubus_type
= MAC_NUBUS
,
673 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
675 .ident
= MAC_MODEL_PB165C
,
676 .name
= "PowerBook 165c",
677 .adb_type
= MAC_ADB_PB1
,
678 .via_type
= MAC_VIA_QUADRA
,
679 .scsi_type
= MAC_SCSI_OLD
,
680 .scc_type
= MAC_SCC_QUADRA
,
681 .nubus_type
= MAC_NUBUS
,
682 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
684 .ident
= MAC_MODEL_PB170
,
685 .name
= "PowerBook 170",
686 .adb_type
= MAC_ADB_PB1
,
687 .via_type
= MAC_VIA_QUADRA
,
688 .scsi_type
= MAC_SCSI_OLD
,
689 .scc_type
= MAC_SCC_QUADRA
,
690 .nubus_type
= MAC_NUBUS
,
691 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
693 .ident
= MAC_MODEL_PB180
,
694 .name
= "PowerBook 180",
695 .adb_type
= MAC_ADB_PB1
,
696 .via_type
= MAC_VIA_QUADRA
,
697 .scsi_type
= MAC_SCSI_OLD
,
698 .scc_type
= MAC_SCC_QUADRA
,
699 .nubus_type
= MAC_NUBUS
,
700 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
702 .ident
= MAC_MODEL_PB180C
,
703 .name
= "PowerBook 180c",
704 .adb_type
= MAC_ADB_PB1
,
705 .via_type
= MAC_VIA_QUADRA
,
706 .scsi_type
= MAC_SCSI_OLD
,
707 .scc_type
= MAC_SCC_QUADRA
,
708 .nubus_type
= MAC_NUBUS
,
709 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
711 .ident
= MAC_MODEL_PB190
,
712 .name
= "PowerBook 190",
713 .adb_type
= MAC_ADB_PB2
,
714 .via_type
= MAC_VIA_QUADRA
,
715 .scsi_type
= MAC_SCSI_LATE
,
716 .ide_type
= MAC_IDE_BABOON
,
717 .scc_type
= MAC_SCC_QUADRA
,
718 .nubus_type
= MAC_NUBUS
,
719 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
721 .ident
= MAC_MODEL_PB520
,
722 .name
= "PowerBook 520",
723 .adb_type
= MAC_ADB_PB2
,
724 .via_type
= MAC_VIA_QUADRA
,
725 .scsi_type
= MAC_SCSI_LATE
,
726 .scc_type
= MAC_SCC_QUADRA
,
727 .ether_type
= MAC_ETHER_SONIC
,
728 .nubus_type
= MAC_NUBUS
,
729 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
733 * PowerBook Duos are pretty much like normal PowerBooks
734 * All of these probably have onboard SONIC in the Dock which
735 * means we'll have to probe for it eventually.
739 .ident
= MAC_MODEL_PB210
,
740 .name
= "PowerBook Duo 210",
741 .adb_type
= MAC_ADB_PB2
,
742 .via_type
= MAC_VIA_IICI
,
743 .scsi_type
= MAC_SCSI_DUO
,
744 .scc_type
= MAC_SCC_QUADRA
,
745 .nubus_type
= MAC_NUBUS
,
746 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
748 .ident
= MAC_MODEL_PB230
,
749 .name
= "PowerBook Duo 230",
750 .adb_type
= MAC_ADB_PB2
,
751 .via_type
= MAC_VIA_IICI
,
752 .scsi_type
= MAC_SCSI_DUO
,
753 .scc_type
= MAC_SCC_QUADRA
,
754 .nubus_type
= MAC_NUBUS
,
755 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
757 .ident
= MAC_MODEL_PB250
,
758 .name
= "PowerBook Duo 250",
759 .adb_type
= MAC_ADB_PB2
,
760 .via_type
= MAC_VIA_IICI
,
761 .scsi_type
= MAC_SCSI_DUO
,
762 .scc_type
= MAC_SCC_QUADRA
,
763 .nubus_type
= MAC_NUBUS
,
764 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
766 .ident
= MAC_MODEL_PB270C
,
767 .name
= "PowerBook Duo 270c",
768 .adb_type
= MAC_ADB_PB2
,
769 .via_type
= MAC_VIA_IICI
,
770 .scsi_type
= MAC_SCSI_DUO
,
771 .scc_type
= MAC_SCC_QUADRA
,
772 .nubus_type
= MAC_NUBUS
,
773 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
775 .ident
= MAC_MODEL_PB280
,
776 .name
= "PowerBook Duo 280",
777 .adb_type
= MAC_ADB_PB2
,
778 .via_type
= MAC_VIA_IICI
,
779 .scsi_type
= MAC_SCSI_DUO
,
780 .scc_type
= MAC_SCC_QUADRA
,
781 .nubus_type
= MAC_NUBUS
,
782 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
784 .ident
= MAC_MODEL_PB280C
,
785 .name
= "PowerBook Duo 280c",
786 .adb_type
= MAC_ADB_PB2
,
787 .via_type
= MAC_VIA_IICI
,
788 .scsi_type
= MAC_SCSI_DUO
,
789 .scc_type
= MAC_SCC_QUADRA
,
790 .nubus_type
= MAC_NUBUS
,
791 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
803 static struct resource scc_a_rsrcs
[] = {
804 { .flags
= IORESOURCE_MEM
},
805 { .flags
= IORESOURCE_IRQ
},
808 static struct resource scc_b_rsrcs
[] = {
809 { .flags
= IORESOURCE_MEM
},
810 { .flags
= IORESOURCE_IRQ
},
813 struct platform_device scc_a_pdev
= {
816 .num_resources
= ARRAY_SIZE(scc_a_rsrcs
),
817 .resource
= scc_a_rsrcs
,
819 EXPORT_SYMBOL(scc_a_pdev
);
821 struct platform_device scc_b_pdev
= {
824 .num_resources
= ARRAY_SIZE(scc_b_rsrcs
),
825 .resource
= scc_b_rsrcs
,
827 EXPORT_SYMBOL(scc_b_pdev
);
829 static void __init
mac_identify(void)
833 /* Penguin data useful? */
834 int model
= mac_bi_data
.id
;
836 /* no bootinfo model id -> NetBSD booter was used! */
837 /* XXX FIXME: breaks for model > 31 */
838 model
= (mac_bi_data
.cpuid
>> 2) & 63;
839 printk(KERN_WARNING
"No bootinfo model ID, using cpuid instead "
840 "(obsolete bootloader?)\n");
843 macintosh_config
= mac_data_table
;
844 for (m
= macintosh_config
; m
->ident
!= -1; m
++) {
845 if (m
->ident
== model
) {
846 macintosh_config
= m
;
851 /* Set up serial port resources for the console initcall. */
853 scc_a_rsrcs
[0].start
= (resource_size_t
) mac_bi_data
.sccbase
+ 2;
854 scc_a_rsrcs
[0].end
= scc_a_rsrcs
[0].start
;
855 scc_b_rsrcs
[0].start
= (resource_size_t
) mac_bi_data
.sccbase
;
856 scc_b_rsrcs
[0].end
= scc_b_rsrcs
[0].start
;
858 switch (macintosh_config
->scc_type
) {
860 scc_a_rsrcs
[1].start
= scc_a_rsrcs
[1].end
= IRQ_MAC_SCC_A
;
861 scc_b_rsrcs
[1].start
= scc_b_rsrcs
[1].end
= IRQ_MAC_SCC_B
;
864 /* On non-PSC machines, the serial ports share an IRQ. */
865 if (macintosh_config
->ident
== MAC_MODEL_IIFX
) {
866 scc_a_rsrcs
[1].start
= scc_a_rsrcs
[1].end
= IRQ_MAC_SCC
;
867 scc_b_rsrcs
[1].start
= scc_b_rsrcs
[1].end
= IRQ_MAC_SCC
;
869 scc_a_rsrcs
[1].start
= scc_a_rsrcs
[1].end
= IRQ_AUTO_4
;
870 scc_b_rsrcs
[1].start
= scc_b_rsrcs
[1].end
= IRQ_AUTO_4
;
876 * We need to pre-init the IOPs, if any. Otherwise
877 * the serial console won't work if the user had
878 * the serial ports set to "Faster" mode in MacOS.
882 printk(KERN_INFO
"Detected Macintosh model: %d\n", model
);
885 * Report booter data:
887 printk(KERN_DEBUG
" Penguin bootinfo data:\n");
888 printk(KERN_DEBUG
" Video: addr 0x%lx "
889 "row 0x%lx depth %lx dimensions %ld x %ld\n",
890 mac_bi_data
.videoaddr
, mac_bi_data
.videorow
,
891 mac_bi_data
.videodepth
, mac_bi_data
.dimensions
& 0xFFFF,
892 mac_bi_data
.dimensions
>> 16);
893 printk(KERN_DEBUG
" Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
894 mac_bi_data
.videological
, mac_orig_videoaddr
,
895 mac_bi_data
.sccbase
);
896 printk(KERN_DEBUG
" Boottime: 0x%lx GMTBias: 0x%lx\n",
897 mac_bi_data
.boottime
, mac_bi_data
.gmtbias
);
898 printk(KERN_DEBUG
" Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
899 mac_bi_data
.id
, mac_bi_data
.cpuid
, mac_bi_data
.memsize
);
907 #ifdef CONFIG_ADB_CUDA
912 static void __init
mac_report_hardware(void)
914 printk(KERN_INFO
"Apple Macintosh %s\n", macintosh_config
->name
);
917 static void mac_get_model(char *str
)
919 strcpy(str
, "Macintosh ");
920 strcat(str
, macintosh_config
->name
);
923 static struct resource swim_rsrc
= { .flags
= IORESOURCE_MEM
};
925 static struct platform_device swim_pdev
= {
929 .resource
= &swim_rsrc
,
932 static const struct resource mac_scsi_iifx_rsrc
[] __initconst
= {
934 .flags
= IORESOURCE_IRQ
,
935 .start
= IRQ_MAC_SCSI
,
938 .flags
= IORESOURCE_MEM
,
944 static const struct resource mac_scsi_duo_rsrc
[] __initconst
= {
946 .flags
= IORESOURCE_MEM
,
952 static const struct resource mac_scsi_old_rsrc
[] __initconst
= {
954 .flags
= IORESOURCE_IRQ
,
955 .start
= IRQ_MAC_SCSI
,
958 .flags
= IORESOURCE_MEM
,
962 .flags
= IORESOURCE_MEM
,
968 static const struct resource mac_scsi_late_rsrc
[] __initconst
= {
970 .flags
= IORESOURCE_IRQ
,
971 .start
= IRQ_MAC_SCSI
,
974 .flags
= IORESOURCE_MEM
,
980 static const struct resource mac_scsi_ccl_rsrc
[] __initconst
= {
982 .flags
= IORESOURCE_IRQ
,
983 .start
= IRQ_MAC_SCSI
,
986 .flags
= IORESOURCE_MEM
,
990 .flags
= IORESOURCE_MEM
,
996 static struct platform_device esp_0_pdev
= {
1001 static struct platform_device esp_1_pdev
= {
1006 static struct platform_device sonic_pdev
= {
1011 static struct platform_device mace_pdev
= {
1016 int __init
mac_platform_init(void)
1027 platform_device_register(&scc_a_pdev
);
1028 platform_device_register(&scc_b_pdev
);
1034 switch (macintosh_config
->floppy_type
) {
1035 case MAC_FLOPPY_SWIM_ADDR1
:
1036 swim_base
= (u8
*)(VIA1_BASE
+ 0x1E000);
1038 case MAC_FLOPPY_SWIM_ADDR2
:
1039 swim_base
= (u8
*)(VIA1_BASE
+ 0x16000);
1047 swim_rsrc
.start
= (resource_size_t
) swim_base
,
1048 swim_rsrc
.end
= (resource_size_t
) swim_base
+ 0x2000,
1049 platform_device_register(&swim_pdev
);
1056 switch (macintosh_config
->scsi_type
) {
1057 case MAC_SCSI_QUADRA
:
1058 case MAC_SCSI_QUADRA3
:
1059 platform_device_register(&esp_0_pdev
);
1061 case MAC_SCSI_QUADRA2
:
1062 platform_device_register(&esp_0_pdev
);
1063 if ((macintosh_config
->ident
== MAC_MODEL_Q900
) ||
1064 (macintosh_config
->ident
== MAC_MODEL_Q950
))
1065 platform_device_register(&esp_1_pdev
);
1068 /* Addresses from The Guide to Mac Family Hardware.
1069 * $5000 8000 - $5000 9FFF: SCSI DMA
1070 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
1071 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
1072 * The SCSI DMA custom IC embeds the 53C80 core. mac_scsi does
1073 * not make use of its DMA or hardware handshaking logic.
1075 platform_device_register_simple("mac_scsi", 0,
1076 mac_scsi_iifx_rsrc
, ARRAY_SIZE(mac_scsi_iifx_rsrc
));
1079 /* Addresses from the Duo Dock II Developer Note.
1080 * $FEE0 2000 - $FEE0 3FFF: normal mode
1081 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
1082 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
1083 * The NetBSD code indicates that both 5380 chips share
1084 * an IRQ (?) which would need careful handling (see mac_esp).
1086 platform_device_register_simple("mac_scsi", 1,
1087 mac_scsi_duo_rsrc
, ARRAY_SIZE(mac_scsi_duo_rsrc
));
1090 /* Addresses from Developer Notes for Duo System,
1091 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
1092 * and also from The Guide to Mac Family Hardware for
1093 * SE/30, II, IIx, IIcx, IIci.
1094 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
1095 * $5001 0000 - $5001 1FFF: normal mode
1096 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
1097 * GMFH says that $5000 0000 - $50FF FFFF "wraps
1098 * $5000 0000 - $5001 FFFF eight times" (!)
1099 * mess.org says IIci and Color Classic do not alias
1100 * I/O address space.
1102 platform_device_register_simple("mac_scsi", 0,
1103 mac_scsi_old_rsrc
, ARRAY_SIZE(mac_scsi_old_rsrc
));
1106 /* PDMA logic in 68040 PowerBooks is somehow different to
1107 * '030 models. It's probably more like Quadras (see mac_esp).
1109 platform_device_register_simple("mac_scsi", 0,
1110 mac_scsi_late_rsrc
, ARRAY_SIZE(mac_scsi_late_rsrc
));
1113 /* Addresses from Mac LC data in Designing Cards & Drivers 3ed.
1114 * Also from the Developer Notes for Classic II, LC III,
1115 * Color Classic and IIvx.
1116 * $50F0 6000 - $50F0 7FFF: SCSI handshake
1117 * $50F1 0000 - $50F1 1FFF: SCSI
1118 * $50F1 2000 - $50F1 3FFF: SCSI DMA
1120 platform_device_register_simple("mac_scsi", 0,
1121 mac_scsi_ccl_rsrc
, ARRAY_SIZE(mac_scsi_ccl_rsrc
));
1129 switch (macintosh_config
->ether_type
) {
1130 case MAC_ETHER_SONIC
:
1131 platform_device_register(&sonic_pdev
);
1133 case MAC_ETHER_MACE
:
1134 platform_device_register(&mace_pdev
);
1141 arch_initcall(mac_platform_init
);