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 extern int mac_hwclk(int, struct rtc_time
*);
58 extern void iop_preinit(void);
59 extern void iop_init(void);
60 extern void via_init(void);
61 extern void via_init_clock(irq_handler_t func
);
62 extern void via_flush_cache(void);
63 extern void oss_init(void);
64 extern void psc_init(void);
65 extern void baboon_init(void);
67 extern void mac_mksound(unsigned int, unsigned int);
69 static void mac_get_model(char *str
);
70 static void mac_identify(void);
71 static void mac_report_hardware(void);
73 static void __init
mac_sched_init(irq_handler_t vector
)
75 via_init_clock(vector
);
79 * Parse a Macintosh-specific record in the bootinfo
82 int __init
mac_parse_bootinfo(const struct bi_record
*record
)
85 const void *data
= record
->data
;
87 switch (be16_to_cpu(record
->tag
)) {
89 mac_bi_data
.id
= be32_to_cpup(data
);
92 mac_bi_data
.videoaddr
= be32_to_cpup(data
);
95 mac_bi_data
.videodepth
= be32_to_cpup(data
);
98 mac_bi_data
.videorow
= be32_to_cpup(data
);
101 mac_bi_data
.dimensions
= be32_to_cpup(data
);
103 case BI_MAC_VLOGICAL
:
104 mac_orig_videoaddr
= be32_to_cpup(data
);
105 mac_bi_data
.videological
=
106 VIDEOMEMBASE
+ (mac_orig_videoaddr
& ~VIDEOMEMMASK
);
109 mac_bi_data
.sccbase
= be32_to_cpup(data
);
112 mac_bi_data
.boottime
= be32_to_cpup(data
);
115 mac_bi_data
.gmtbias
= be32_to_cpup(data
);
118 mac_bi_data
.memsize
= be32_to_cpup(data
);
121 mac_bi_data
.cpuid
= be32_to_cpup(data
);
124 mac_bi_data
.rombase
= be32_to_cpup(data
);
134 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
135 * have to disable interrupts for this. Our IRQ handlers will crap
136 * themselves if they take an IRQ in 24bit mode!
139 static void mac_cache_card_flush(int writeback
)
143 local_irq_save(flags
);
145 local_irq_restore(flags
);
148 void __init
config_mac(void)
151 pr_err("ERROR: no Mac, but config_mac() called!!\n");
153 mach_sched_init
= mac_sched_init
;
154 mach_init_IRQ
= mac_init_IRQ
;
155 mach_get_model
= mac_get_model
;
156 mach_hwclk
= mac_hwclk
;
157 mach_reset
= mac_reset
;
158 mach_halt
= mac_poweroff
;
159 mach_power_off
= mac_poweroff
;
160 mach_max_dma_address
= 0xffffffff;
161 #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
162 mach_beep
= mac_mksound
;
166 * Determine hardware present
170 mac_report_hardware();
173 * AFAIK only the IIci takes a cache card. The IIfx has onboard
174 * cache ... someone needs to figure out how to tell if it's on or
178 if (macintosh_config
->ident
== MAC_MODEL_IICI
179 || macintosh_config
->ident
== MAC_MODEL_IIFX
)
180 mach_l2_flush
= mac_cache_card_flush
;
185 * Macintosh Table: hardcoded model configuration data.
187 * Much of this was defined by Alan, based on who knows what docs.
188 * I've added a lot more, and some of that was pure guesswork based
189 * on hardware pages present on the Mac web site. Possibly wildly
190 * inaccurate, so look here if a new Mac model won't run. Example: if
191 * a Mac crashes immediately after the VIA1 registers have been dumped
192 * to the screen, it probably died attempting to read DirB on a RBV.
193 * Meaning it should have MAC_VIA_IICI here :-)
196 struct mac_model
*macintosh_config
;
197 EXPORT_SYMBOL(macintosh_config
);
199 static struct mac_model mac_data_table
[] = {
201 * We'll pretend to be a Macintosh II, that's pretty safe.
205 .ident
= MAC_MODEL_II
,
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_UNSUPPORTED
, /* IWM */
216 * Original Mac II hardware
220 .ident
= MAC_MODEL_II
,
222 .adb_type
= MAC_ADB_II
,
223 .via_type
= MAC_VIA_II
,
224 .scsi_type
= MAC_SCSI_OLD
,
225 .scc_type
= MAC_SCC_II
,
226 .expansion_type
= MAC_EXP_NUBUS
,
227 .floppy_type
= MAC_FLOPPY_UNSUPPORTED
, /* IWM */
229 .ident
= MAC_MODEL_IIX
,
231 .adb_type
= MAC_ADB_II
,
232 .via_type
= MAC_VIA_II
,
233 .scsi_type
= MAC_SCSI_OLD
,
234 .scc_type
= MAC_SCC_II
,
235 .expansion_type
= MAC_EXP_NUBUS
,
236 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
238 .ident
= MAC_MODEL_IICX
,
240 .adb_type
= MAC_ADB_II
,
241 .via_type
= MAC_VIA_II
,
242 .scsi_type
= MAC_SCSI_OLD
,
243 .scc_type
= MAC_SCC_II
,
244 .expansion_type
= MAC_EXP_NUBUS
,
245 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
247 .ident
= MAC_MODEL_SE30
,
249 .adb_type
= MAC_ADB_II
,
250 .via_type
= MAC_VIA_II
,
251 .scsi_type
= MAC_SCSI_OLD
,
252 .scc_type
= MAC_SCC_II
,
253 .expansion_type
= MAC_EXP_PDS
,
254 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
258 * Weirdified Mac II hardware - all subtly different. Gee thanks
259 * Apple. All these boxes seem to have VIA2 in a different place to
260 * the Mac II (+1A000 rather than +4000)
261 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
265 .ident
= MAC_MODEL_IICI
,
267 .adb_type
= MAC_ADB_II
,
268 .via_type
= MAC_VIA_IICI
,
269 .scsi_type
= MAC_SCSI_OLD
,
270 .scc_type
= MAC_SCC_II
,
271 .expansion_type
= MAC_EXP_NUBUS
,
272 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
274 .ident
= MAC_MODEL_IIFX
,
276 .adb_type
= MAC_ADB_IOP
,
277 .via_type
= MAC_VIA_IICI
,
278 .scsi_type
= MAC_SCSI_IIFX
,
279 .scc_type
= MAC_SCC_IOP
,
280 .expansion_type
= MAC_EXP_PDS_NUBUS
,
281 .floppy_type
= MAC_FLOPPY_SWIM_IOP
, /* SWIM */
283 .ident
= MAC_MODEL_IISI
,
285 .adb_type
= MAC_ADB_EGRET
,
286 .via_type
= MAC_VIA_IICI
,
287 .scsi_type
= MAC_SCSI_OLD
,
288 .scc_type
= MAC_SCC_II
,
289 .expansion_type
= MAC_EXP_PDS_NUBUS
,
290 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
292 .ident
= MAC_MODEL_IIVI
,
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 .expansion_type
= MAC_EXP_NUBUS
,
299 .floppy_type
= MAC_FLOPPY_LC
, /* SWIM */
301 .ident
= MAC_MODEL_IIVX
,
303 .adb_type
= MAC_ADB_EGRET
,
304 .via_type
= MAC_VIA_IICI
,
305 .scsi_type
= MAC_SCSI_LC
,
306 .scc_type
= MAC_SCC_II
,
307 .expansion_type
= MAC_EXP_NUBUS
,
308 .floppy_type
= MAC_FLOPPY_LC
, /* SWIM */
312 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
316 .ident
= MAC_MODEL_CLII
,
317 .name
= "Classic II",
318 .adb_type
= MAC_ADB_EGRET
,
319 .via_type
= MAC_VIA_IICI
,
320 .scsi_type
= MAC_SCSI_LC
,
321 .scc_type
= MAC_SCC_II
,
322 .floppy_type
= MAC_FLOPPY_LC
, /* SWIM */
324 .ident
= MAC_MODEL_CCL
,
325 .name
= "Color Classic",
326 .adb_type
= MAC_ADB_CUDA
,
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 2 */
333 .ident
= MAC_MODEL_CCLII
,
334 .name
= "Color Classic II",
335 .adb_type
= MAC_ADB_CUDA
,
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 2 */
344 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
348 .ident
= MAC_MODEL_LC
,
350 .adb_type
= MAC_ADB_EGRET
,
351 .via_type
= MAC_VIA_IICI
,
352 .scsi_type
= MAC_SCSI_LC
,
353 .scc_type
= MAC_SCC_II
,
354 .expansion_type
= MAC_EXP_PDS
,
355 .floppy_type
= MAC_FLOPPY_LC
, /* SWIM */
357 .ident
= MAC_MODEL_LCII
,
359 .adb_type
= MAC_ADB_EGRET
,
360 .via_type
= MAC_VIA_IICI
,
361 .scsi_type
= MAC_SCSI_LC
,
362 .scc_type
= MAC_SCC_II
,
363 .expansion_type
= MAC_EXP_PDS
,
364 .floppy_type
= MAC_FLOPPY_LC
, /* SWIM */
366 .ident
= MAC_MODEL_LCIII
,
368 .adb_type
= MAC_ADB_EGRET
,
369 .via_type
= MAC_VIA_IICI
,
370 .scsi_type
= MAC_SCSI_LC
,
371 .scc_type
= MAC_SCC_II
,
372 .expansion_type
= MAC_EXP_PDS
,
373 .floppy_type
= MAC_FLOPPY_LC
, /* SWIM 2 */
377 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
378 * differently as some of the stuff connected to VIA2 seems different.
379 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
380 * the 660AV and 840AV which use an AMD 79C940 (MACE).
381 * The 700, 900 and 950 have some I/O chips in the wrong place to
382 * confuse us. The 840AV has a SCSI location of its own (same as
387 .ident
= MAC_MODEL_Q605
,
388 .name
= "Quadra 605",
389 .adb_type
= MAC_ADB_CUDA
,
390 .via_type
= MAC_VIA_QUADRA
,
391 .scsi_type
= MAC_SCSI_QUADRA
,
392 .scc_type
= MAC_SCC_QUADRA
,
393 .expansion_type
= MAC_EXP_PDS
,
394 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
396 .ident
= MAC_MODEL_Q605_ACC
,
397 .name
= "Quadra 605",
398 .adb_type
= MAC_ADB_CUDA
,
399 .via_type
= MAC_VIA_QUADRA
,
400 .scsi_type
= MAC_SCSI_QUADRA
,
401 .scc_type
= MAC_SCC_QUADRA
,
402 .expansion_type
= MAC_EXP_PDS
,
403 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
405 .ident
= MAC_MODEL_Q610
,
406 .name
= "Quadra 610",
407 .adb_type
= MAC_ADB_II
,
408 .via_type
= MAC_VIA_QUADRA
,
409 .scsi_type
= MAC_SCSI_QUADRA
,
410 .scc_type
= MAC_SCC_QUADRA
,
411 .ether_type
= MAC_ETHER_SONIC
,
412 .expansion_type
= MAC_EXP_PDS_NUBUS
,
413 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
415 .ident
= MAC_MODEL_Q630
,
416 .name
= "Quadra 630",
417 .adb_type
= MAC_ADB_CUDA
,
418 .via_type
= MAC_VIA_QUADRA
,
419 .scsi_type
= MAC_SCSI_QUADRA
,
420 .ide_type
= MAC_IDE_QUADRA
,
421 .scc_type
= MAC_SCC_QUADRA
,
422 .expansion_type
= MAC_EXP_PDS_COMM
,
423 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
425 .ident
= MAC_MODEL_Q650
,
426 .name
= "Quadra 650",
427 .adb_type
= MAC_ADB_II
,
428 .via_type
= MAC_VIA_QUADRA
,
429 .scsi_type
= MAC_SCSI_QUADRA
,
430 .scc_type
= MAC_SCC_QUADRA
,
431 .ether_type
= MAC_ETHER_SONIC
,
432 .expansion_type
= MAC_EXP_PDS_NUBUS
,
433 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
435 /* The Q700 does have a NS Sonic */
437 .ident
= MAC_MODEL_Q700
,
438 .name
= "Quadra 700",
439 .adb_type
= MAC_ADB_II
,
440 .via_type
= MAC_VIA_QUADRA
,
441 .scsi_type
= MAC_SCSI_QUADRA2
,
442 .scc_type
= MAC_SCC_QUADRA
,
443 .ether_type
= MAC_ETHER_SONIC
,
444 .expansion_type
= MAC_EXP_PDS_NUBUS
,
445 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM */
447 .ident
= MAC_MODEL_Q800
,
448 .name
= "Quadra 800",
449 .adb_type
= MAC_ADB_II
,
450 .via_type
= MAC_VIA_QUADRA
,
451 .scsi_type
= MAC_SCSI_QUADRA
,
452 .scc_type
= MAC_SCC_QUADRA
,
453 .ether_type
= MAC_ETHER_SONIC
,
454 .expansion_type
= MAC_EXP_PDS_NUBUS
,
455 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
457 .ident
= MAC_MODEL_Q840
,
458 .name
= "Quadra 840AV",
459 .adb_type
= MAC_ADB_CUDA
,
460 .via_type
= MAC_VIA_QUADRA
,
461 .scsi_type
= MAC_SCSI_QUADRA3
,
462 .scc_type
= MAC_SCC_PSC
,
463 .ether_type
= MAC_ETHER_MACE
,
464 .expansion_type
= MAC_EXP_NUBUS
,
465 .floppy_type
= MAC_FLOPPY_UNSUPPORTED
, /* New Age */
467 .ident
= MAC_MODEL_Q900
,
468 .name
= "Quadra 900",
469 .adb_type
= MAC_ADB_IOP
,
470 .via_type
= MAC_VIA_QUADRA
,
471 .scsi_type
= MAC_SCSI_QUADRA2
,
472 .scc_type
= MAC_SCC_IOP
,
473 .ether_type
= MAC_ETHER_SONIC
,
474 .expansion_type
= MAC_EXP_PDS_NUBUS
,
475 .floppy_type
= MAC_FLOPPY_SWIM_IOP
, /* SWIM */
477 .ident
= MAC_MODEL_Q950
,
478 .name
= "Quadra 950",
479 .adb_type
= MAC_ADB_IOP
,
480 .via_type
= MAC_VIA_QUADRA
,
481 .scsi_type
= MAC_SCSI_QUADRA2
,
482 .scc_type
= MAC_SCC_IOP
,
483 .ether_type
= MAC_ETHER_SONIC
,
484 .expansion_type
= MAC_EXP_PDS_NUBUS
,
485 .floppy_type
= MAC_FLOPPY_SWIM_IOP
, /* SWIM */
489 * Performa - more LC type machines
493 .ident
= MAC_MODEL_P460
,
494 .name
= "Performa 460",
495 .adb_type
= MAC_ADB_EGRET
,
496 .via_type
= MAC_VIA_IICI
,
497 .scsi_type
= MAC_SCSI_LC
,
498 .scc_type
= MAC_SCC_II
,
499 .expansion_type
= MAC_EXP_PDS
,
500 .floppy_type
= MAC_FLOPPY_LC
, /* SWIM 2 */
502 .ident
= MAC_MODEL_P475
,
503 .name
= "Performa 475",
504 .adb_type
= MAC_ADB_CUDA
,
505 .via_type
= MAC_VIA_QUADRA
,
506 .scsi_type
= MAC_SCSI_QUADRA
,
507 .scc_type
= MAC_SCC_II
,
508 .expansion_type
= MAC_EXP_PDS
,
509 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
511 .ident
= MAC_MODEL_P475F
,
512 .name
= "Performa 475",
513 .adb_type
= MAC_ADB_CUDA
,
514 .via_type
= MAC_VIA_QUADRA
,
515 .scsi_type
= MAC_SCSI_QUADRA
,
516 .scc_type
= MAC_SCC_II
,
517 .expansion_type
= MAC_EXP_PDS
,
518 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
520 .ident
= MAC_MODEL_P520
,
521 .name
= "Performa 520",
522 .adb_type
= MAC_ADB_CUDA
,
523 .via_type
= MAC_VIA_IICI
,
524 .scsi_type
= MAC_SCSI_LC
,
525 .scc_type
= MAC_SCC_II
,
526 .expansion_type
= MAC_EXP_PDS
,
527 .floppy_type
= MAC_FLOPPY_LC
, /* SWIM 2 */
529 .ident
= MAC_MODEL_P550
,
530 .name
= "Performa 550",
531 .adb_type
= MAC_ADB_CUDA
,
532 .via_type
= MAC_VIA_IICI
,
533 .scsi_type
= MAC_SCSI_LC
,
534 .scc_type
= MAC_SCC_II
,
535 .expansion_type
= MAC_EXP_PDS
,
536 .floppy_type
= MAC_FLOPPY_LC
, /* SWIM 2 */
538 /* These have the comm slot, and therefore possibly SONIC ethernet */
540 .ident
= MAC_MODEL_P575
,
541 .name
= "Performa 575",
542 .adb_type
= MAC_ADB_CUDA
,
543 .via_type
= MAC_VIA_QUADRA
,
544 .scsi_type
= MAC_SCSI_QUADRA
,
545 .scc_type
= MAC_SCC_II
,
546 .expansion_type
= MAC_EXP_PDS_COMM
,
547 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
549 .ident
= MAC_MODEL_P588
,
550 .name
= "Performa 588",
551 .adb_type
= MAC_ADB_CUDA
,
552 .via_type
= MAC_VIA_QUADRA
,
553 .scsi_type
= MAC_SCSI_QUADRA
,
554 .ide_type
= MAC_IDE_QUADRA
,
555 .scc_type
= MAC_SCC_II
,
556 .expansion_type
= MAC_EXP_PDS_COMM
,
557 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
559 .ident
= MAC_MODEL_TV
,
561 .adb_type
= MAC_ADB_CUDA
,
562 .via_type
= MAC_VIA_IICI
,
563 .scsi_type
= MAC_SCSI_LC
,
564 .scc_type
= MAC_SCC_II
,
565 .floppy_type
= MAC_FLOPPY_LC
, /* SWIM 2 */
567 .ident
= MAC_MODEL_P600
,
568 .name
= "Performa 600",
569 .adb_type
= MAC_ADB_EGRET
,
570 .via_type
= MAC_VIA_IICI
,
571 .scsi_type
= MAC_SCSI_LC
,
572 .scc_type
= MAC_SCC_II
,
573 .expansion_type
= MAC_EXP_NUBUS
,
574 .floppy_type
= MAC_FLOPPY_LC
, /* SWIM */
578 * Centris - just guessing again; maybe like Quadra.
579 * The C610 may or may not have SONIC. We probe to make sure.
583 .ident
= MAC_MODEL_C610
,
584 .name
= "Centris 610",
585 .adb_type
= MAC_ADB_II
,
586 .via_type
= MAC_VIA_QUADRA
,
587 .scsi_type
= MAC_SCSI_QUADRA
,
588 .scc_type
= MAC_SCC_QUADRA
,
589 .ether_type
= MAC_ETHER_SONIC
,
590 .expansion_type
= MAC_EXP_PDS_NUBUS
,
591 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
593 .ident
= MAC_MODEL_C650
,
594 .name
= "Centris 650",
595 .adb_type
= MAC_ADB_II
,
596 .via_type
= MAC_VIA_QUADRA
,
597 .scsi_type
= MAC_SCSI_QUADRA
,
598 .scc_type
= MAC_SCC_QUADRA
,
599 .ether_type
= MAC_ETHER_SONIC
,
600 .expansion_type
= MAC_EXP_PDS_NUBUS
,
601 .floppy_type
= MAC_FLOPPY_QUADRA
, /* SWIM 2 */
603 .ident
= MAC_MODEL_C660
,
604 .name
= "Centris 660AV",
605 .adb_type
= MAC_ADB_CUDA
,
606 .via_type
= MAC_VIA_QUADRA
,
607 .scsi_type
= MAC_SCSI_QUADRA3
,
608 .scc_type
= MAC_SCC_PSC
,
609 .ether_type
= MAC_ETHER_MACE
,
610 .expansion_type
= MAC_EXP_PDS_NUBUS
,
611 .floppy_type
= MAC_FLOPPY_UNSUPPORTED
, /* New Age */
615 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
616 * and a PMU (in two variations?) for ADB. Most of them use the
617 * Quadra-style VIAs. A few models also have IDE from hell.
621 .ident
= MAC_MODEL_PB140
,
622 .name
= "PowerBook 140",
623 .adb_type
= MAC_ADB_PB1
,
624 .via_type
= MAC_VIA_QUADRA
,
625 .scsi_type
= MAC_SCSI_OLD
,
626 .scc_type
= MAC_SCC_QUADRA
,
627 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
629 .ident
= MAC_MODEL_PB145
,
630 .name
= "PowerBook 145",
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 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
637 .ident
= MAC_MODEL_PB150
,
638 .name
= "PowerBook 150",
639 .adb_type
= MAC_ADB_PB2
,
640 .via_type
= MAC_VIA_IICI
,
641 .scsi_type
= MAC_SCSI_OLD
,
642 .ide_type
= MAC_IDE_PB
,
643 .scc_type
= MAC_SCC_QUADRA
,
644 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
646 .ident
= MAC_MODEL_PB160
,
647 .name
= "PowerBook 160",
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_PB165
,
655 .name
= "PowerBook 165",
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_PB165C
,
663 .name
= "PowerBook 165c",
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_PB170
,
671 .name
= "PowerBook 170",
672 .adb_type
= MAC_ADB_PB1
,
673 .via_type
= MAC_VIA_QUADRA
,
674 .scsi_type
= MAC_SCSI_OLD
,
675 .scc_type
= MAC_SCC_QUADRA
,
676 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
678 .ident
= MAC_MODEL_PB180
,
679 .name
= "PowerBook 180",
680 .adb_type
= MAC_ADB_PB1
,
681 .via_type
= MAC_VIA_QUADRA
,
682 .scsi_type
= MAC_SCSI_OLD
,
683 .scc_type
= MAC_SCC_QUADRA
,
684 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
686 .ident
= MAC_MODEL_PB180C
,
687 .name
= "PowerBook 180c",
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 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
694 .ident
= MAC_MODEL_PB190
,
695 .name
= "PowerBook 190",
696 .adb_type
= MAC_ADB_PB2
,
697 .via_type
= MAC_VIA_QUADRA
,
698 .scsi_type
= MAC_SCSI_OLD
,
699 .ide_type
= MAC_IDE_BABOON
,
700 .scc_type
= MAC_SCC_QUADRA
,
701 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM 2 */
703 .ident
= MAC_MODEL_PB520
,
704 .name
= "PowerBook 520",
705 .adb_type
= MAC_ADB_PB2
,
706 .via_type
= MAC_VIA_QUADRA
,
707 .scsi_type
= MAC_SCSI_OLD
,
708 .scc_type
= MAC_SCC_QUADRA
,
709 .ether_type
= MAC_ETHER_SONIC
,
710 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM 2 */
714 * PowerBook Duos are pretty much like normal PowerBooks
715 * All of these probably have onboard SONIC in the Dock which
716 * means we'll have to probe for it eventually.
720 .ident
= MAC_MODEL_PB210
,
721 .name
= "PowerBook Duo 210",
722 .adb_type
= MAC_ADB_PB2
,
723 .via_type
= MAC_VIA_IICI
,
724 .scsi_type
= MAC_SCSI_DUO
,
725 .scc_type
= MAC_SCC_QUADRA
,
726 .expansion_type
= MAC_EXP_NUBUS
,
727 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
729 .ident
= MAC_MODEL_PB230
,
730 .name
= "PowerBook Duo 230",
731 .adb_type
= MAC_ADB_PB2
,
732 .via_type
= MAC_VIA_IICI
,
733 .scsi_type
= MAC_SCSI_DUO
,
734 .scc_type
= MAC_SCC_QUADRA
,
735 .expansion_type
= MAC_EXP_NUBUS
,
736 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
738 .ident
= MAC_MODEL_PB250
,
739 .name
= "PowerBook Duo 250",
740 .adb_type
= MAC_ADB_PB2
,
741 .via_type
= MAC_VIA_IICI
,
742 .scsi_type
= MAC_SCSI_DUO
,
743 .scc_type
= MAC_SCC_QUADRA
,
744 .expansion_type
= MAC_EXP_NUBUS
,
745 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
747 .ident
= MAC_MODEL_PB270C
,
748 .name
= "PowerBook Duo 270c",
749 .adb_type
= MAC_ADB_PB2
,
750 .via_type
= MAC_VIA_IICI
,
751 .scsi_type
= MAC_SCSI_DUO
,
752 .scc_type
= MAC_SCC_QUADRA
,
753 .expansion_type
= MAC_EXP_NUBUS
,
754 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
756 .ident
= MAC_MODEL_PB280
,
757 .name
= "PowerBook Duo 280",
758 .adb_type
= MAC_ADB_PB2
,
759 .via_type
= MAC_VIA_IICI
,
760 .scsi_type
= MAC_SCSI_DUO
,
761 .scc_type
= MAC_SCC_QUADRA
,
762 .expansion_type
= MAC_EXP_NUBUS
,
763 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
765 .ident
= MAC_MODEL_PB280C
,
766 .name
= "PowerBook Duo 280c",
767 .adb_type
= MAC_ADB_PB2
,
768 .via_type
= MAC_VIA_IICI
,
769 .scsi_type
= MAC_SCSI_DUO
,
770 .scc_type
= MAC_SCC_QUADRA
,
771 .expansion_type
= MAC_EXP_NUBUS
,
772 .floppy_type
= MAC_FLOPPY_OLD
, /* SWIM */
784 static struct resource scc_a_rsrcs
[] = {
785 { .flags
= IORESOURCE_MEM
},
786 { .flags
= IORESOURCE_IRQ
},
789 static struct resource scc_b_rsrcs
[] = {
790 { .flags
= IORESOURCE_MEM
},
791 { .flags
= IORESOURCE_IRQ
},
794 struct platform_device scc_a_pdev
= {
797 .num_resources
= ARRAY_SIZE(scc_a_rsrcs
),
798 .resource
= scc_a_rsrcs
,
800 EXPORT_SYMBOL(scc_a_pdev
);
802 struct platform_device scc_b_pdev
= {
805 .num_resources
= ARRAY_SIZE(scc_b_rsrcs
),
806 .resource
= scc_b_rsrcs
,
808 EXPORT_SYMBOL(scc_b_pdev
);
810 static void __init
mac_identify(void)
814 /* Penguin data useful? */
815 int model
= mac_bi_data
.id
;
817 /* no bootinfo model id -> NetBSD booter was used! */
818 /* XXX FIXME: breaks for model > 31 */
819 model
= (mac_bi_data
.cpuid
>> 2) & 63;
820 pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
823 macintosh_config
= mac_data_table
;
824 for (m
= macintosh_config
; m
->ident
!= -1; m
++) {
825 if (m
->ident
== model
) {
826 macintosh_config
= m
;
831 /* Set up serial port resources for the console initcall. */
833 scc_a_rsrcs
[0].start
= (resource_size_t
) mac_bi_data
.sccbase
+ 2;
834 scc_a_rsrcs
[0].end
= scc_a_rsrcs
[0].start
;
835 scc_b_rsrcs
[0].start
= (resource_size_t
) mac_bi_data
.sccbase
;
836 scc_b_rsrcs
[0].end
= scc_b_rsrcs
[0].start
;
838 switch (macintosh_config
->scc_type
) {
840 scc_a_rsrcs
[1].start
= scc_a_rsrcs
[1].end
= IRQ_MAC_SCC_A
;
841 scc_b_rsrcs
[1].start
= scc_b_rsrcs
[1].end
= IRQ_MAC_SCC_B
;
844 /* On non-PSC machines, the serial ports share an IRQ. */
845 if (macintosh_config
->ident
== MAC_MODEL_IIFX
) {
846 scc_a_rsrcs
[1].start
= scc_a_rsrcs
[1].end
= IRQ_MAC_SCC
;
847 scc_b_rsrcs
[1].start
= scc_b_rsrcs
[1].end
= IRQ_MAC_SCC
;
849 scc_a_rsrcs
[1].start
= scc_a_rsrcs
[1].end
= IRQ_AUTO_4
;
850 scc_b_rsrcs
[1].start
= scc_b_rsrcs
[1].end
= IRQ_AUTO_4
;
856 * We need to pre-init the IOPs, if any. Otherwise
857 * the serial console won't work if the user had
858 * the serial ports set to "Faster" mode in MacOS.
862 pr_info("Detected Macintosh model: %d\n", model
);
865 * Report booter data:
867 printk(KERN_DEBUG
" Penguin bootinfo data:\n");
868 printk(KERN_DEBUG
" Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
869 mac_bi_data
.videoaddr
, mac_bi_data
.videorow
,
870 mac_bi_data
.videodepth
, mac_bi_data
.dimensions
& 0xFFFF,
871 mac_bi_data
.dimensions
>> 16);
872 printk(KERN_DEBUG
" Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
873 mac_bi_data
.videological
, mac_orig_videoaddr
,
874 mac_bi_data
.sccbase
);
875 printk(KERN_DEBUG
" Boottime: 0x%lx GMTBias: 0x%lx\n",
876 mac_bi_data
.boottime
, mac_bi_data
.gmtbias
);
877 printk(KERN_DEBUG
" Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
878 mac_bi_data
.id
, mac_bi_data
.cpuid
, mac_bi_data
.memsize
);
886 #ifdef CONFIG_ADB_CUDA
889 #ifdef CONFIG_ADB_PMU
894 static void __init
mac_report_hardware(void)
896 pr_info("Apple Macintosh %s\n", macintosh_config
->name
);
899 static void mac_get_model(char *str
)
901 strcpy(str
, "Macintosh ");
902 strcat(str
, macintosh_config
->name
);
905 static const struct resource mac_scsi_iifx_rsrc
[] __initconst
= {
907 .flags
= IORESOURCE_IRQ
,
908 .start
= IRQ_MAC_SCSI
,
911 .flags
= IORESOURCE_MEM
,
915 .flags
= IORESOURCE_MEM
,
921 static const struct resource mac_scsi_duo_rsrc
[] __initconst
= {
923 .flags
= IORESOURCE_MEM
,
929 static const struct resource mac_scsi_old_rsrc
[] __initconst
= {
931 .flags
= IORESOURCE_IRQ
,
932 .start
= IRQ_MAC_SCSI
,
935 .flags
= IORESOURCE_MEM
,
939 .flags
= IORESOURCE_MEM
,
945 static const struct resource mac_scsi_ccl_rsrc
[] __initconst
= {
947 .flags
= IORESOURCE_IRQ
,
948 .start
= IRQ_MAC_SCSI
,
951 .flags
= IORESOURCE_MEM
,
955 .flags
= IORESOURCE_MEM
,
961 int __init
mac_platform_init(void)
963 phys_addr_t swim_base
= 0;
972 platform_device_register(&scc_a_pdev
);
973 platform_device_register(&scc_b_pdev
);
979 switch (macintosh_config
->floppy_type
) {
980 case MAC_FLOPPY_QUADRA
:
981 swim_base
= 0x5001E000;
984 swim_base
= 0x50016000;
987 swim_base
= 0x50F16000;
992 struct resource swim_rsrc
= {
993 .flags
= IORESOURCE_MEM
,
995 .end
= swim_base
+ 0x1FFF,
998 platform_device_register_simple("swim", -1, &swim_rsrc
, 1);
1005 switch (macintosh_config
->scsi_type
) {
1006 case MAC_SCSI_QUADRA
:
1007 case MAC_SCSI_QUADRA3
:
1008 platform_device_register_simple("mac_esp", 0, NULL
, 0);
1010 case MAC_SCSI_QUADRA2
:
1011 platform_device_register_simple("mac_esp", 0, NULL
, 0);
1012 if ((macintosh_config
->ident
== MAC_MODEL_Q900
) ||
1013 (macintosh_config
->ident
== MAC_MODEL_Q950
))
1014 platform_device_register_simple("mac_esp", 1, NULL
, 0);
1017 /* Addresses from The Guide to Mac Family Hardware.
1018 * $5000 8000 - $5000 9FFF: SCSI DMA
1019 * $5000 A000 - $5000 BFFF: Alternate SCSI
1020 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
1021 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
1022 * The A/UX header file sys/uconfig.h says $50F0 8000.
1023 * The "SCSI DMA" custom IC embeds the 53C80 core and
1024 * supports Programmed IO, DMA and PDMA (hardware handshake).
1026 platform_device_register_simple("mac_scsi", 0,
1027 mac_scsi_iifx_rsrc
, ARRAY_SIZE(mac_scsi_iifx_rsrc
));
1030 /* Addresses from the Duo Dock II Developer Note.
1031 * $FEE0 2000 - $FEE0 3FFF: normal mode
1032 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
1033 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
1034 * The NetBSD code indicates that both 5380 chips share
1035 * an IRQ (?) which would need careful handling (see mac_esp).
1037 platform_device_register_simple("mac_scsi", 1,
1038 mac_scsi_duo_rsrc
, ARRAY_SIZE(mac_scsi_duo_rsrc
));
1041 /* Addresses from Developer Notes for Duo System,
1042 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
1043 * and also from The Guide to Mac Family Hardware for
1044 * SE/30, II, IIx, IIcx, IIci.
1045 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
1046 * $5001 0000 - $5001 1FFF: normal mode
1047 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
1048 * GMFH says that $5000 0000 - $50FF FFFF "wraps
1049 * $5000 0000 - $5001 FFFF eight times" (!)
1050 * mess.org says IIci and Color Classic do not alias
1051 * I/O address space.
1053 platform_device_register_simple("mac_scsi", 0,
1054 mac_scsi_old_rsrc
, ARRAY_SIZE(mac_scsi_old_rsrc
));
1057 /* Addresses from Mac LC data in Designing Cards & Drivers 3ed.
1058 * Also from the Developer Notes for Classic II, LC III,
1059 * Color Classic and IIvx.
1060 * $50F0 6000 - $50F0 7FFF: SCSI handshake
1061 * $50F1 0000 - $50F1 1FFF: SCSI
1062 * $50F1 2000 - $50F1 3FFF: SCSI DMA
1064 platform_device_register_simple("mac_scsi", 0,
1065 mac_scsi_ccl_rsrc
, ARRAY_SIZE(mac_scsi_ccl_rsrc
));
1073 if (macintosh_config
->ether_type
== MAC_ETHER_SONIC
||
1074 macintosh_config
->expansion_type
== MAC_EXP_PDS_COMM
)
1075 platform_device_register_simple("macsonic", -1, NULL
, 0);
1077 if (macintosh_config
->expansion_type
== MAC_EXP_PDS
||
1078 macintosh_config
->expansion_type
== MAC_EXP_PDS_COMM
)
1079 platform_device_register_simple("mac89x0", -1, NULL
, 0);
1081 if (macintosh_config
->ether_type
== MAC_ETHER_MACE
)
1082 platform_device_register_simple("macmace", -1, NULL
, 0);
1087 arch_initcall(mac_platform_init
);