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 #ifdef CONFIG_EARLY_PRINTK
75 asmlinkage
void __init
mac_early_print(const char *s
, unsigned n
);
77 static void __init
mac_early_cons_write(struct console
*con
,
78 const char *s
, unsigned n
)
80 mac_early_print(s
, n
);
83 static struct console __initdata mac_early_cons
= {
85 .write
= mac_early_cons_write
,
86 .flags
= CON_PRINTBUFFER
| CON_BOOT
,
90 int __init
mac_unregister_early_cons(void)
92 /* mac_early_print can't be used after init sections are discarded */
93 return unregister_console(&mac_early_cons
);
96 late_initcall(mac_unregister_early_cons
);
99 static void __init
mac_sched_init(irq_handler_t vector
)
101 via_init_clock(vector
);
105 * Parse a Macintosh-specific record in the bootinfo
108 int __init
mac_parse_bootinfo(const struct bi_record
*record
)
111 const void *data
= record
->data
;
113 switch (be16_to_cpu(record
->tag
)) {
115 mac_bi_data
.id
= be32_to_cpup(data
);
118 mac_bi_data
.videoaddr
= be32_to_cpup(data
);
121 mac_bi_data
.videodepth
= be32_to_cpup(data
);
124 mac_bi_data
.videorow
= be32_to_cpup(data
);
127 mac_bi_data
.dimensions
= be32_to_cpup(data
);
129 case BI_MAC_VLOGICAL
:
130 mac_orig_videoaddr
= be32_to_cpup(data
);
131 mac_bi_data
.videological
=
132 VIDEOMEMBASE
+ (mac_orig_videoaddr
& ~VIDEOMEMMASK
);
135 mac_bi_data
.sccbase
= be32_to_cpup(data
);
138 mac_bi_data
.boottime
= be32_to_cpup(data
);
141 mac_bi_data
.gmtbias
= be32_to_cpup(data
);
144 mac_bi_data
.memsize
= be32_to_cpup(data
);
147 mac_bi_data
.cpuid
= be32_to_cpup(data
);
150 mac_bi_data
.rombase
= be32_to_cpup(data
);
160 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
161 * have to disable interrupts for this. Our IRQ handlers will crap
162 * themselves if they take an IRQ in 24bit mode!
165 static void mac_cache_card_flush(int writeback
)
169 local_irq_save(flags
);
171 local_irq_restore(flags
);
174 void __init
config_mac(void)
177 printk(KERN_ERR
"ERROR: no Mac, but config_mac() called!!\n");
179 mach_sched_init
= mac_sched_init
;
180 mach_init_IRQ
= mac_init_IRQ
;
181 mach_get_model
= mac_get_model
;
182 arch_gettimeoffset
= mac_gettimeoffset
;
183 mach_hwclk
= mac_hwclk
;
184 mach_set_clock_mmss
= mac_set_clock_mmss
;
185 mach_reset
= mac_reset
;
186 mach_halt
= mac_poweroff
;
187 mach_power_off
= mac_poweroff
;
188 mach_max_dma_address
= 0xffffffff;
189 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
190 mach_beep
= mac_mksound
;
193 #ifdef CONFIG_EARLY_PRINTK
194 register_console(&mac_early_cons
);
198 * Determine hardware present
202 mac_report_hardware();
205 * AFAIK only the IIci takes a cache card. The IIfx has onboard
206 * cache ... someone needs to figure out how to tell if it's on or
210 if (macintosh_config
->ident
== MAC_MODEL_IICI
211 || macintosh_config
->ident
== MAC_MODEL_IIFX
)
212 mach_l2_flush
= mac_cache_card_flush
;
217 * Macintosh Table: hardcoded model configuration data.
219 * Much of this was defined by Alan, based on who knows what docs.
220 * I've added a lot more, and some of that was pure guesswork based
221 * on hardware pages present on the Mac web site. Possibly wildly
222 * inaccurate, so look here if a new Mac model won't run. Example: if
223 * a Mac crashes immediately after the VIA1 registers have been dumped
224 * to the screen, it probably died attempting to read DirB on a RBV.
225 * Meaning it should have MAC_VIA_IICI here :-)
228 struct mac_model
*macintosh_config
;
229 EXPORT_SYMBOL(macintosh_config
);
231 static struct mac_model mac_data_table
[] = {
233 * We'll pretend to be a Macintosh II, that's pretty safe.
237 .ident
= MAC_MODEL_II
,
239 .adb_type
= MAC_ADB_II
,
240 .via_type
= MAC_VIA_II
,
241 .scsi_type
= MAC_SCSI_OLD
,
242 .scc_type
= MAC_SCC_II
,
243 .nubus_type
= MAC_NUBUS
,
244 .floppy_type
= MAC_FLOPPY_IWM
,
248 * Original Mac II hardware
252 .ident
= MAC_MODEL_II
,
254 .adb_type
= MAC_ADB_II
,
255 .via_type
= MAC_VIA_II
,
256 .scsi_type
= MAC_SCSI_OLD
,
257 .scc_type
= MAC_SCC_II
,
258 .nubus_type
= MAC_NUBUS
,
259 .floppy_type
= MAC_FLOPPY_IWM
,
261 .ident
= MAC_MODEL_IIX
,
263 .adb_type
= MAC_ADB_II
,
264 .via_type
= MAC_VIA_II
,
265 .scsi_type
= MAC_SCSI_OLD
,
266 .scc_type
= MAC_SCC_II
,
267 .nubus_type
= MAC_NUBUS
,
268 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
270 .ident
= MAC_MODEL_IICX
,
272 .adb_type
= MAC_ADB_II
,
273 .via_type
= MAC_VIA_II
,
274 .scsi_type
= MAC_SCSI_OLD
,
275 .scc_type
= MAC_SCC_II
,
276 .nubus_type
= MAC_NUBUS
,
277 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
279 .ident
= MAC_MODEL_SE30
,
281 .adb_type
= MAC_ADB_II
,
282 .via_type
= MAC_VIA_II
,
283 .scsi_type
= MAC_SCSI_OLD
,
284 .scc_type
= MAC_SCC_II
,
285 .nubus_type
= MAC_NUBUS
,
286 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
290 * Weirdified Mac II hardware - all subtly different. Gee thanks
291 * Apple. All these boxes seem to have VIA2 in a different place to
292 * the Mac II (+1A000 rather than +4000)
293 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
297 .ident
= MAC_MODEL_IICI
,
299 .adb_type
= MAC_ADB_II
,
300 .via_type
= MAC_VIA_IICI
,
301 .scsi_type
= MAC_SCSI_OLD
,
302 .scc_type
= MAC_SCC_II
,
303 .nubus_type
= MAC_NUBUS
,
304 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
306 .ident
= MAC_MODEL_IIFX
,
308 .adb_type
= MAC_ADB_IOP
,
309 .via_type
= MAC_VIA_IICI
,
310 .scsi_type
= MAC_SCSI_OLD
,
311 .scc_type
= MAC_SCC_IOP
,
312 .nubus_type
= MAC_NUBUS
,
313 .floppy_type
= MAC_FLOPPY_SWIM_IOP
,
315 .ident
= MAC_MODEL_IISI
,
317 .adb_type
= MAC_ADB_IISI
,
318 .via_type
= MAC_VIA_IICI
,
319 .scsi_type
= MAC_SCSI_OLD
,
320 .scc_type
= MAC_SCC_II
,
321 .nubus_type
= MAC_NUBUS
,
322 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
324 .ident
= MAC_MODEL_IIVI
,
326 .adb_type
= MAC_ADB_IISI
,
327 .via_type
= MAC_VIA_IICI
,
328 .scsi_type
= MAC_SCSI_OLD
,
329 .scc_type
= MAC_SCC_II
,
330 .nubus_type
= MAC_NUBUS
,
331 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
333 .ident
= MAC_MODEL_IIVX
,
335 .adb_type
= MAC_ADB_IISI
,
336 .via_type
= MAC_VIA_IICI
,
337 .scsi_type
= MAC_SCSI_OLD
,
338 .scc_type
= MAC_SCC_II
,
339 .nubus_type
= MAC_NUBUS
,
340 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
344 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
348 .ident
= MAC_MODEL_CLII
,
349 .name
= "Classic II",
350 .adb_type
= MAC_ADB_IISI
,
351 .via_type
= MAC_VIA_IICI
,
352 .scsi_type
= MAC_SCSI_OLD
,
353 .scc_type
= MAC_SCC_II
,
354 .nubus_type
= MAC_NUBUS
,
355 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
357 .ident
= MAC_MODEL_CCL
,
358 .name
= "Color Classic",
359 .adb_type
= MAC_ADB_CUDA
,
360 .via_type
= MAC_VIA_IICI
,
361 .scsi_type
= MAC_SCSI_OLD
,
362 .scc_type
= MAC_SCC_II
,
363 .nubus_type
= MAC_NUBUS
,
364 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
366 .ident
= MAC_MODEL_CCLII
,
367 .name
= "Color Classic II",
368 .adb_type
= MAC_ADB_CUDA
,
369 .via_type
= MAC_VIA_IICI
,
370 .scsi_type
= MAC_SCSI_OLD
,
371 .scc_type
= MAC_SCC_II
,
372 .nubus_type
= MAC_NUBUS
,
373 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
377 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
381 .ident
= MAC_MODEL_LC
,
383 .adb_type
= MAC_ADB_IISI
,
384 .via_type
= MAC_VIA_IICI
,
385 .scsi_type
= MAC_SCSI_OLD
,
386 .scc_type
= MAC_SCC_II
,
387 .nubus_type
= MAC_NUBUS
,
388 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
390 .ident
= MAC_MODEL_LCII
,
392 .adb_type
= MAC_ADB_IISI
,
393 .via_type
= MAC_VIA_IICI
,
394 .scsi_type
= MAC_SCSI_OLD
,
395 .scc_type
= MAC_SCC_II
,
396 .nubus_type
= MAC_NUBUS
,
397 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
399 .ident
= MAC_MODEL_LCIII
,
401 .adb_type
= MAC_ADB_IISI
,
402 .via_type
= MAC_VIA_IICI
,
403 .scsi_type
= MAC_SCSI_OLD
,
404 .scc_type
= MAC_SCC_II
,
405 .nubus_type
= MAC_NUBUS
,
406 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
410 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
411 * differently as some of the stuff connected to VIA2 seems different.
412 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
413 * the 660AV and 840AV which use an AMD 79C940 (MACE).
414 * The 700, 900 and 950 have some I/O chips in the wrong place to
415 * confuse us. The 840AV has a SCSI location of its own (same as
420 .ident
= MAC_MODEL_Q605
,
421 .name
= "Quadra 605",
422 .adb_type
= MAC_ADB_CUDA
,
423 .via_type
= MAC_VIA_QUADRA
,
424 .scsi_type
= MAC_SCSI_QUADRA
,
425 .scc_type
= MAC_SCC_QUADRA
,
426 .nubus_type
= MAC_NUBUS
,
427 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
429 .ident
= MAC_MODEL_Q605_ACC
,
430 .name
= "Quadra 605",
431 .adb_type
= MAC_ADB_CUDA
,
432 .via_type
= MAC_VIA_QUADRA
,
433 .scsi_type
= MAC_SCSI_QUADRA
,
434 .scc_type
= MAC_SCC_QUADRA
,
435 .nubus_type
= MAC_NUBUS
,
436 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
438 .ident
= MAC_MODEL_Q610
,
439 .name
= "Quadra 610",
440 .adb_type
= MAC_ADB_II
,
441 .via_type
= MAC_VIA_QUADRA
,
442 .scsi_type
= MAC_SCSI_QUADRA
,
443 .scc_type
= MAC_SCC_QUADRA
,
444 .ether_type
= MAC_ETHER_SONIC
,
445 .nubus_type
= MAC_NUBUS
,
446 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
448 .ident
= MAC_MODEL_Q630
,
449 .name
= "Quadra 630",
450 .adb_type
= MAC_ADB_CUDA
,
451 .via_type
= MAC_VIA_QUADRA
,
452 .scsi_type
= MAC_SCSI_QUADRA
,
453 .ide_type
= MAC_IDE_QUADRA
,
454 .scc_type
= MAC_SCC_QUADRA
,
455 .ether_type
= MAC_ETHER_SONIC
,
456 .nubus_type
= MAC_NUBUS
,
457 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
459 .ident
= MAC_MODEL_Q650
,
460 .name
= "Quadra 650",
461 .adb_type
= MAC_ADB_II
,
462 .via_type
= MAC_VIA_QUADRA
,
463 .scsi_type
= MAC_SCSI_QUADRA
,
464 .scc_type
= MAC_SCC_QUADRA
,
465 .ether_type
= MAC_ETHER_SONIC
,
466 .nubus_type
= MAC_NUBUS
,
467 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
469 /* The Q700 does have a NS Sonic */
471 .ident
= MAC_MODEL_Q700
,
472 .name
= "Quadra 700",
473 .adb_type
= MAC_ADB_II
,
474 .via_type
= MAC_VIA_QUADRA
,
475 .scsi_type
= MAC_SCSI_QUADRA2
,
476 .scc_type
= MAC_SCC_QUADRA
,
477 .ether_type
= MAC_ETHER_SONIC
,
478 .nubus_type
= MAC_NUBUS
,
479 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
481 .ident
= MAC_MODEL_Q800
,
482 .name
= "Quadra 800",
483 .adb_type
= MAC_ADB_II
,
484 .via_type
= MAC_VIA_QUADRA
,
485 .scsi_type
= MAC_SCSI_QUADRA
,
486 .scc_type
= MAC_SCC_QUADRA
,
487 .ether_type
= MAC_ETHER_SONIC
,
488 .nubus_type
= MAC_NUBUS
,
489 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
491 .ident
= MAC_MODEL_Q840
,
492 .name
= "Quadra 840AV",
493 .adb_type
= MAC_ADB_CUDA
,
494 .via_type
= MAC_VIA_QUADRA
,
495 .scsi_type
= MAC_SCSI_QUADRA3
,
496 .scc_type
= MAC_SCC_PSC
,
497 .ether_type
= MAC_ETHER_MACE
,
498 .nubus_type
= MAC_NUBUS
,
499 .floppy_type
= MAC_FLOPPY_AV
,
501 .ident
= MAC_MODEL_Q900
,
502 .name
= "Quadra 900",
503 .adb_type
= MAC_ADB_IOP
,
504 .via_type
= MAC_VIA_QUADRA
,
505 .scsi_type
= MAC_SCSI_QUADRA2
,
506 .scc_type
= MAC_SCC_IOP
,
507 .ether_type
= MAC_ETHER_SONIC
,
508 .nubus_type
= MAC_NUBUS
,
509 .floppy_type
= MAC_FLOPPY_SWIM_IOP
,
511 .ident
= MAC_MODEL_Q950
,
512 .name
= "Quadra 950",
513 .adb_type
= MAC_ADB_IOP
,
514 .via_type
= MAC_VIA_QUADRA
,
515 .scsi_type
= MAC_SCSI_QUADRA2
,
516 .scc_type
= MAC_SCC_IOP
,
517 .ether_type
= MAC_ETHER_SONIC
,
518 .nubus_type
= MAC_NUBUS
,
519 .floppy_type
= MAC_FLOPPY_SWIM_IOP
,
523 * Performa - more LC type machines
527 .ident
= MAC_MODEL_P460
,
528 .name
= "Performa 460",
529 .adb_type
= MAC_ADB_IISI
,
530 .via_type
= MAC_VIA_IICI
,
531 .scsi_type
= MAC_SCSI_OLD
,
532 .scc_type
= MAC_SCC_II
,
533 .nubus_type
= MAC_NUBUS
,
534 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
536 .ident
= MAC_MODEL_P475
,
537 .name
= "Performa 475",
538 .adb_type
= MAC_ADB_CUDA
,
539 .via_type
= MAC_VIA_QUADRA
,
540 .scsi_type
= MAC_SCSI_QUADRA
,
541 .scc_type
= MAC_SCC_II
,
542 .nubus_type
= MAC_NUBUS
,
543 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
545 .ident
= MAC_MODEL_P475F
,
546 .name
= "Performa 475",
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 .nubus_type
= MAC_NUBUS
,
552 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
554 .ident
= MAC_MODEL_P520
,
555 .name
= "Performa 520",
556 .adb_type
= MAC_ADB_CUDA
,
557 .via_type
= MAC_VIA_IICI
,
558 .scsi_type
= MAC_SCSI_OLD
,
559 .scc_type
= MAC_SCC_II
,
560 .nubus_type
= MAC_NUBUS
,
561 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
563 .ident
= MAC_MODEL_P550
,
564 .name
= "Performa 550",
565 .adb_type
= MAC_ADB_CUDA
,
566 .via_type
= MAC_VIA_IICI
,
567 .scsi_type
= MAC_SCSI_OLD
,
568 .scc_type
= MAC_SCC_II
,
569 .nubus_type
= MAC_NUBUS
,
570 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
572 /* These have the comm slot, and therefore possibly SONIC ethernet */
574 .ident
= MAC_MODEL_P575
,
575 .name
= "Performa 575",
576 .adb_type
= MAC_ADB_CUDA
,
577 .via_type
= MAC_VIA_QUADRA
,
578 .scsi_type
= MAC_SCSI_QUADRA
,
579 .scc_type
= MAC_SCC_II
,
580 .ether_type
= MAC_ETHER_SONIC
,
581 .nubus_type
= MAC_NUBUS
,
582 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
584 .ident
= MAC_MODEL_P588
,
585 .name
= "Performa 588",
586 .adb_type
= MAC_ADB_CUDA
,
587 .via_type
= MAC_VIA_QUADRA
,
588 .scsi_type
= MAC_SCSI_QUADRA
,
589 .ide_type
= MAC_IDE_QUADRA
,
590 .scc_type
= MAC_SCC_II
,
591 .ether_type
= MAC_ETHER_SONIC
,
592 .nubus_type
= MAC_NUBUS
,
593 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
595 .ident
= MAC_MODEL_TV
,
597 .adb_type
= MAC_ADB_CUDA
,
598 .via_type
= MAC_VIA_IICI
,
599 .scsi_type
= MAC_SCSI_OLD
,
600 .scc_type
= MAC_SCC_II
,
601 .nubus_type
= MAC_NUBUS
,
602 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
604 .ident
= MAC_MODEL_P600
,
605 .name
= "Performa 600",
606 .adb_type
= MAC_ADB_IISI
,
607 .via_type
= MAC_VIA_IICI
,
608 .scsi_type
= MAC_SCSI_OLD
,
609 .scc_type
= MAC_SCC_II
,
610 .nubus_type
= MAC_NUBUS
,
611 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
615 * Centris - just guessing again; maybe like Quadra.
616 * The C610 may or may not have SONIC. We probe to make sure.
620 .ident
= MAC_MODEL_C610
,
621 .name
= "Centris 610",
622 .adb_type
= MAC_ADB_II
,
623 .via_type
= MAC_VIA_QUADRA
,
624 .scsi_type
= MAC_SCSI_QUADRA
,
625 .scc_type
= MAC_SCC_QUADRA
,
626 .ether_type
= MAC_ETHER_SONIC
,
627 .nubus_type
= MAC_NUBUS
,
628 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
630 .ident
= MAC_MODEL_C650
,
631 .name
= "Centris 650",
632 .adb_type
= MAC_ADB_II
,
633 .via_type
= MAC_VIA_QUADRA
,
634 .scsi_type
= MAC_SCSI_QUADRA
,
635 .scc_type
= MAC_SCC_QUADRA
,
636 .ether_type
= MAC_ETHER_SONIC
,
637 .nubus_type
= MAC_NUBUS
,
638 .floppy_type
= MAC_FLOPPY_SWIM_ADDR1
,
640 .ident
= MAC_MODEL_C660
,
641 .name
= "Centris 660AV",
642 .adb_type
= MAC_ADB_CUDA
,
643 .via_type
= MAC_VIA_QUADRA
,
644 .scsi_type
= MAC_SCSI_QUADRA3
,
645 .scc_type
= MAC_SCC_PSC
,
646 .ether_type
= MAC_ETHER_MACE
,
647 .nubus_type
= MAC_NUBUS
,
648 .floppy_type
= MAC_FLOPPY_AV
,
652 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
653 * and a PMU (in two variations?) for ADB. Most of them use the
654 * Quadra-style VIAs. A few models also have IDE from hell.
658 .ident
= MAC_MODEL_PB140
,
659 .name
= "PowerBook 140",
660 .adb_type
= MAC_ADB_PB1
,
661 .via_type
= MAC_VIA_QUADRA
,
662 .scsi_type
= MAC_SCSI_OLD
,
663 .scc_type
= MAC_SCC_QUADRA
,
664 .nubus_type
= MAC_NUBUS
,
665 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
667 .ident
= MAC_MODEL_PB145
,
668 .name
= "PowerBook 145",
669 .adb_type
= MAC_ADB_PB1
,
670 .via_type
= MAC_VIA_QUADRA
,
671 .scsi_type
= MAC_SCSI_OLD
,
672 .scc_type
= MAC_SCC_QUADRA
,
673 .nubus_type
= MAC_NUBUS
,
674 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
676 .ident
= MAC_MODEL_PB150
,
677 .name
= "PowerBook 150",
678 .adb_type
= MAC_ADB_PB2
,
679 .via_type
= MAC_VIA_IICI
,
680 .scsi_type
= MAC_SCSI_OLD
,
681 .ide_type
= MAC_IDE_PB
,
682 .scc_type
= MAC_SCC_QUADRA
,
683 .nubus_type
= MAC_NUBUS
,
684 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
686 .ident
= MAC_MODEL_PB160
,
687 .name
= "PowerBook 160",
688 .adb_type
= MAC_ADB_PB1
,
689 .via_type
= MAC_VIA_QUADRA
,
690 .scsi_type
= MAC_SCSI_OLD
,
691 .scc_type
= MAC_SCC_QUADRA
,
692 .nubus_type
= MAC_NUBUS
,
693 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
695 .ident
= MAC_MODEL_PB165
,
696 .name
= "PowerBook 165",
697 .adb_type
= MAC_ADB_PB1
,
698 .via_type
= MAC_VIA_QUADRA
,
699 .scsi_type
= MAC_SCSI_OLD
,
700 .scc_type
= MAC_SCC_QUADRA
,
701 .nubus_type
= MAC_NUBUS
,
702 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
704 .ident
= MAC_MODEL_PB165C
,
705 .name
= "PowerBook 165c",
706 .adb_type
= MAC_ADB_PB1
,
707 .via_type
= MAC_VIA_QUADRA
,
708 .scsi_type
= MAC_SCSI_OLD
,
709 .scc_type
= MAC_SCC_QUADRA
,
710 .nubus_type
= MAC_NUBUS
,
711 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
713 .ident
= MAC_MODEL_PB170
,
714 .name
= "PowerBook 170",
715 .adb_type
= MAC_ADB_PB1
,
716 .via_type
= MAC_VIA_QUADRA
,
717 .scsi_type
= MAC_SCSI_OLD
,
718 .scc_type
= MAC_SCC_QUADRA
,
719 .nubus_type
= MAC_NUBUS
,
720 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
722 .ident
= MAC_MODEL_PB180
,
723 .name
= "PowerBook 180",
724 .adb_type
= MAC_ADB_PB1
,
725 .via_type
= MAC_VIA_QUADRA
,
726 .scsi_type
= MAC_SCSI_OLD
,
727 .scc_type
= MAC_SCC_QUADRA
,
728 .nubus_type
= MAC_NUBUS
,
729 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
731 .ident
= MAC_MODEL_PB180C
,
732 .name
= "PowerBook 180c",
733 .adb_type
= MAC_ADB_PB1
,
734 .via_type
= MAC_VIA_QUADRA
,
735 .scsi_type
= MAC_SCSI_OLD
,
736 .scc_type
= MAC_SCC_QUADRA
,
737 .nubus_type
= MAC_NUBUS
,
738 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
740 .ident
= MAC_MODEL_PB190
,
741 .name
= "PowerBook 190",
742 .adb_type
= MAC_ADB_PB2
,
743 .via_type
= MAC_VIA_QUADRA
,
744 .scsi_type
= MAC_SCSI_OLD
,
745 .ide_type
= MAC_IDE_BABOON
,
746 .scc_type
= MAC_SCC_QUADRA
,
747 .nubus_type
= MAC_NUBUS
,
748 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
750 .ident
= MAC_MODEL_PB520
,
751 .name
= "PowerBook 520",
752 .adb_type
= MAC_ADB_PB2
,
753 .via_type
= MAC_VIA_QUADRA
,
754 .scsi_type
= MAC_SCSI_OLD
,
755 .scc_type
= MAC_SCC_QUADRA
,
756 .ether_type
= MAC_ETHER_SONIC
,
757 .nubus_type
= MAC_NUBUS
,
758 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
762 * PowerBook Duos are pretty much like normal PowerBooks
763 * All of these probably have onboard SONIC in the Dock which
764 * means we'll have to probe for it eventually.
768 .ident
= MAC_MODEL_PB210
,
769 .name
= "PowerBook Duo 210",
770 .adb_type
= MAC_ADB_PB2
,
771 .via_type
= MAC_VIA_IICI
,
772 .scsi_type
= MAC_SCSI_OLD
,
773 .scc_type
= MAC_SCC_QUADRA
,
774 .nubus_type
= MAC_NUBUS
,
775 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
777 .ident
= MAC_MODEL_PB230
,
778 .name
= "PowerBook Duo 230",
779 .adb_type
= MAC_ADB_PB2
,
780 .via_type
= MAC_VIA_IICI
,
781 .scsi_type
= MAC_SCSI_OLD
,
782 .scc_type
= MAC_SCC_QUADRA
,
783 .nubus_type
= MAC_NUBUS
,
784 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
786 .ident
= MAC_MODEL_PB250
,
787 .name
= "PowerBook Duo 250",
788 .adb_type
= MAC_ADB_PB2
,
789 .via_type
= MAC_VIA_IICI
,
790 .scsi_type
= MAC_SCSI_OLD
,
791 .scc_type
= MAC_SCC_QUADRA
,
792 .nubus_type
= MAC_NUBUS
,
793 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
795 .ident
= MAC_MODEL_PB270C
,
796 .name
= "PowerBook Duo 270c",
797 .adb_type
= MAC_ADB_PB2
,
798 .via_type
= MAC_VIA_IICI
,
799 .scsi_type
= MAC_SCSI_OLD
,
800 .scc_type
= MAC_SCC_QUADRA
,
801 .nubus_type
= MAC_NUBUS
,
802 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
804 .ident
= MAC_MODEL_PB280
,
805 .name
= "PowerBook Duo 280",
806 .adb_type
= MAC_ADB_PB2
,
807 .via_type
= MAC_VIA_IICI
,
808 .scsi_type
= MAC_SCSI_OLD
,
809 .scc_type
= MAC_SCC_QUADRA
,
810 .nubus_type
= MAC_NUBUS
,
811 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
813 .ident
= MAC_MODEL_PB280C
,
814 .name
= "PowerBook Duo 280c",
815 .adb_type
= MAC_ADB_PB2
,
816 .via_type
= MAC_VIA_IICI
,
817 .scsi_type
= MAC_SCSI_OLD
,
818 .scc_type
= MAC_SCC_QUADRA
,
819 .nubus_type
= MAC_NUBUS
,
820 .floppy_type
= MAC_FLOPPY_SWIM_ADDR2
,
832 static struct resource scc_a_rsrcs
[] = {
833 { .flags
= IORESOURCE_MEM
},
834 { .flags
= IORESOURCE_IRQ
},
837 static struct resource scc_b_rsrcs
[] = {
838 { .flags
= IORESOURCE_MEM
},
839 { .flags
= IORESOURCE_IRQ
},
842 struct platform_device scc_a_pdev
= {
845 .num_resources
= ARRAY_SIZE(scc_a_rsrcs
),
846 .resource
= scc_a_rsrcs
,
848 EXPORT_SYMBOL(scc_a_pdev
);
850 struct platform_device scc_b_pdev
= {
853 .num_resources
= ARRAY_SIZE(scc_b_rsrcs
),
854 .resource
= scc_b_rsrcs
,
856 EXPORT_SYMBOL(scc_b_pdev
);
858 static void __init
mac_identify(void)
862 /* Penguin data useful? */
863 int model
= mac_bi_data
.id
;
865 /* no bootinfo model id -> NetBSD booter was used! */
866 /* XXX FIXME: breaks for model > 31 */
867 model
= (mac_bi_data
.cpuid
>> 2) & 63;
868 printk(KERN_WARNING
"No bootinfo model ID, using cpuid instead "
869 "(obsolete bootloader?)\n");
872 macintosh_config
= mac_data_table
;
873 for (m
= macintosh_config
; m
->ident
!= -1; m
++) {
874 if (m
->ident
== model
) {
875 macintosh_config
= m
;
880 /* Set up serial port resources for the console initcall. */
882 scc_a_rsrcs
[0].start
= (resource_size_t
) mac_bi_data
.sccbase
+ 2;
883 scc_a_rsrcs
[0].end
= scc_a_rsrcs
[0].start
;
884 scc_b_rsrcs
[0].start
= (resource_size_t
) mac_bi_data
.sccbase
;
885 scc_b_rsrcs
[0].end
= scc_b_rsrcs
[0].start
;
887 switch (macintosh_config
->scc_type
) {
889 scc_a_rsrcs
[1].start
= scc_a_rsrcs
[1].end
= IRQ_MAC_SCC_A
;
890 scc_b_rsrcs
[1].start
= scc_b_rsrcs
[1].end
= IRQ_MAC_SCC_B
;
893 /* On non-PSC machines, the serial ports share an IRQ. */
894 if (macintosh_config
->ident
== MAC_MODEL_IIFX
) {
895 scc_a_rsrcs
[1].start
= scc_a_rsrcs
[1].end
= IRQ_MAC_SCC
;
896 scc_b_rsrcs
[1].start
= scc_b_rsrcs
[1].end
= IRQ_MAC_SCC
;
898 scc_a_rsrcs
[1].start
= scc_a_rsrcs
[1].end
= IRQ_AUTO_4
;
899 scc_b_rsrcs
[1].start
= scc_b_rsrcs
[1].end
= IRQ_AUTO_4
;
905 * We need to pre-init the IOPs, if any. Otherwise
906 * the serial console won't work if the user had
907 * the serial ports set to "Faster" mode in MacOS.
911 printk(KERN_INFO
"Detected Macintosh model: %d\n", model
);
914 * Report booter data:
916 printk(KERN_DEBUG
" Penguin bootinfo data:\n");
917 printk(KERN_DEBUG
" Video: addr 0x%lx "
918 "row 0x%lx depth %lx dimensions %ld x %ld\n",
919 mac_bi_data
.videoaddr
, mac_bi_data
.videorow
,
920 mac_bi_data
.videodepth
, mac_bi_data
.dimensions
& 0xFFFF,
921 mac_bi_data
.dimensions
>> 16);
922 printk(KERN_DEBUG
" Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
923 mac_bi_data
.videological
, mac_orig_videoaddr
,
924 mac_bi_data
.sccbase
);
925 printk(KERN_DEBUG
" Boottime: 0x%lx GMTBias: 0x%lx\n",
926 mac_bi_data
.boottime
, mac_bi_data
.gmtbias
);
927 printk(KERN_DEBUG
" Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
928 mac_bi_data
.id
, mac_bi_data
.cpuid
, mac_bi_data
.memsize
);
936 #ifdef CONFIG_ADB_CUDA
941 static void __init
mac_report_hardware(void)
943 printk(KERN_INFO
"Apple Macintosh %s\n", macintosh_config
->name
);
946 static void mac_get_model(char *str
)
948 strcpy(str
, "Macintosh ");
949 strcat(str
, macintosh_config
->name
);
952 static struct resource swim_rsrc
= { .flags
= IORESOURCE_MEM
};
954 static struct platform_device swim_pdev
= {
958 .resource
= &swim_rsrc
,
961 static struct platform_device esp_0_pdev
= {
966 static struct platform_device esp_1_pdev
= {
971 static struct platform_device sonic_pdev
= {
976 static struct platform_device mace_pdev
= {
981 int __init
mac_platform_init(void)
992 platform_device_register(&scc_a_pdev
);
993 platform_device_register(&scc_b_pdev
);
999 switch (macintosh_config
->floppy_type
) {
1000 case MAC_FLOPPY_SWIM_ADDR1
:
1001 swim_base
= (u8
*)(VIA1_BASE
+ 0x1E000);
1003 case MAC_FLOPPY_SWIM_ADDR2
:
1004 swim_base
= (u8
*)(VIA1_BASE
+ 0x16000);
1012 swim_rsrc
.start
= (resource_size_t
) swim_base
,
1013 swim_rsrc
.end
= (resource_size_t
) swim_base
+ 0x2000,
1014 platform_device_register(&swim_pdev
);
1021 switch (macintosh_config
->scsi_type
) {
1022 case MAC_SCSI_QUADRA
:
1023 case MAC_SCSI_QUADRA3
:
1024 platform_device_register(&esp_0_pdev
);
1026 case MAC_SCSI_QUADRA2
:
1027 platform_device_register(&esp_0_pdev
);
1028 if ((macintosh_config
->ident
== MAC_MODEL_Q900
) ||
1029 (macintosh_config
->ident
== MAC_MODEL_Q950
))
1030 platform_device_register(&esp_1_pdev
);
1038 switch (macintosh_config
->ether_type
) {
1039 case MAC_ETHER_SONIC
:
1040 platform_device_register(&sonic_pdev
);
1042 case MAC_ETHER_MACE
:
1043 platform_device_register(&mace_pdev
);
1050 arch_initcall(mac_platform_init
);