parisc: Use vsprintf extention %pf with builtin_return_address
[linux/fpc-iii.git] / arch / m68k / mac / config.c
blobf60ff5f59205c1f2285f53fd2c1ae08bae9d6d93
1 /*
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
6 * for more details.
7 */
9 /*
10 * Miscellaneous linux stuff
13 #include <linux/module.h>
14 #include <linux/types.h>
15 #include <linux/mm.h>
16 #include <linux/tty.h>
17 #include <linux/console.h>
18 #include <linux/interrupt.h>
19 /* keyb */
20 #include <linux/random.h>
21 #include <linux/delay.h>
22 /* keyb */
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 #define BOOTINFO_COMPAT_1_0
30 #include <asm/setup.h>
31 #include <asm/bootinfo.h>
33 #include <asm/system.h>
34 #include <asm/io.h>
35 #include <asm/irq.h>
36 #include <asm/pgtable.h>
37 #include <asm/rtc.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 unsigned long 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 = {
84 .name = "early",
85 .write = mac_early_cons_write,
86 .flags = CON_PRINTBUFFER | CON_BOOT,
87 .index = -1
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);
97 #endif
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)
110 int unknown = 0;
111 const u_long *data = record->data;
113 switch (record->tag) {
114 case BI_MAC_MODEL:
115 mac_bi_data.id = *data;
116 break;
117 case BI_MAC_VADDR:
118 mac_bi_data.videoaddr = *data;
119 break;
120 case BI_MAC_VDEPTH:
121 mac_bi_data.videodepth = *data;
122 break;
123 case BI_MAC_VROW:
124 mac_bi_data.videorow = *data;
125 break;
126 case BI_MAC_VDIM:
127 mac_bi_data.dimensions = *data;
128 break;
129 case BI_MAC_VLOGICAL:
130 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
131 mac_orig_videoaddr = *data;
132 break;
133 case BI_MAC_SCCBASE:
134 mac_bi_data.sccbase = *data;
135 break;
136 case BI_MAC_BTIME:
137 mac_bi_data.boottime = *data;
138 break;
139 case BI_MAC_GMTBIAS:
140 mac_bi_data.gmtbias = *data;
141 break;
142 case BI_MAC_MEMSIZE:
143 mac_bi_data.memsize = *data;
144 break;
145 case BI_MAC_CPUID:
146 mac_bi_data.cpuid = *data;
147 break;
148 case BI_MAC_ROMBASE:
149 mac_bi_data.rombase = *data;
150 break;
151 default:
152 unknown = 1;
153 break;
155 return unknown;
159 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
160 * have to disable interrupts for this. Our IRQ handlers will crap
161 * themselves if they take an IRQ in 24bit mode!
164 static void mac_cache_card_flush(int writeback)
166 unsigned long flags;
168 local_irq_save(flags);
169 via_flush_cache();
170 local_irq_restore(flags);
173 void __init config_mac(void)
175 if (!MACH_IS_MAC)
176 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!!\n");
178 mach_sched_init = mac_sched_init;
179 mach_init_IRQ = mac_init_IRQ;
180 mach_get_model = mac_get_model;
181 mach_gettimeoffset = mac_gettimeoffset;
182 mach_hwclk = mac_hwclk;
183 mach_set_clock_mmss = mac_set_clock_mmss;
184 mach_reset = mac_reset;
185 mach_halt = mac_poweroff;
186 mach_power_off = mac_poweroff;
187 mach_max_dma_address = 0xffffffff;
188 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
189 mach_beep = mac_mksound;
190 #endif
192 #ifdef CONFIG_EARLY_PRINTK
193 register_console(&mac_early_cons);
194 #endif
197 * Determine hardware present
200 mac_identify();
201 mac_report_hardware();
204 * AFAIK only the IIci takes a cache card. The IIfx has onboard
205 * cache ... someone needs to figure out how to tell if it's on or
206 * not.
209 if (macintosh_config->ident == MAC_MODEL_IICI
210 || macintosh_config->ident == MAC_MODEL_IIFX)
211 mach_l2_flush = mac_cache_card_flush;
216 * Macintosh Table: hardcoded model configuration data.
218 * Much of this was defined by Alan, based on who knows what docs.
219 * I've added a lot more, and some of that was pure guesswork based
220 * on hardware pages present on the Mac web site. Possibly wildly
221 * inaccurate, so look here if a new Mac model won't run. Example: if
222 * a Mac crashes immediately after the VIA1 registers have been dumped
223 * to the screen, it probably died attempting to read DirB on a RBV.
224 * Meaning it should have MAC_VIA_IICI here :-)
227 struct mac_model *macintosh_config;
228 EXPORT_SYMBOL(macintosh_config);
230 static struct mac_model mac_data_table[] = {
232 * We'll pretend to be a Macintosh II, that's pretty safe.
236 .ident = MAC_MODEL_II,
237 .name = "Unknown",
238 .adb_type = MAC_ADB_II,
239 .via_type = MAC_VIA_II,
240 .scsi_type = MAC_SCSI_OLD,
241 .scc_type = MAC_SCC_II,
242 .nubus_type = MAC_NUBUS,
243 .floppy_type = MAC_FLOPPY_IWM,
247 * Original Mac II hardware
251 .ident = MAC_MODEL_II,
252 .name = "II",
253 .adb_type = MAC_ADB_II,
254 .via_type = MAC_VIA_II,
255 .scsi_type = MAC_SCSI_OLD,
256 .scc_type = MAC_SCC_II,
257 .nubus_type = MAC_NUBUS,
258 .floppy_type = MAC_FLOPPY_IWM,
259 }, {
260 .ident = MAC_MODEL_IIX,
261 .name = "IIx",
262 .adb_type = MAC_ADB_II,
263 .via_type = MAC_VIA_II,
264 .scsi_type = MAC_SCSI_OLD,
265 .scc_type = MAC_SCC_II,
266 .nubus_type = MAC_NUBUS,
267 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
268 }, {
269 .ident = MAC_MODEL_IICX,
270 .name = "IIcx",
271 .adb_type = MAC_ADB_II,
272 .via_type = MAC_VIA_II,
273 .scsi_type = MAC_SCSI_OLD,
274 .scc_type = MAC_SCC_II,
275 .nubus_type = MAC_NUBUS,
276 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
277 }, {
278 .ident = MAC_MODEL_SE30,
279 .name = "SE/30",
280 .adb_type = MAC_ADB_II,
281 .via_type = MAC_VIA_II,
282 .scsi_type = MAC_SCSI_OLD,
283 .scc_type = MAC_SCC_II,
284 .nubus_type = MAC_NUBUS,
285 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
289 * Weirdified Mac II hardware - all subtly different. Gee thanks
290 * Apple. All these boxes seem to have VIA2 in a different place to
291 * the Mac II (+1A000 rather than +4000)
292 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
296 .ident = MAC_MODEL_IICI,
297 .name = "IIci",
298 .adb_type = MAC_ADB_II,
299 .via_type = MAC_VIA_IICI,
300 .scsi_type = MAC_SCSI_OLD,
301 .scc_type = MAC_SCC_II,
302 .nubus_type = MAC_NUBUS,
303 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
304 }, {
305 .ident = MAC_MODEL_IIFX,
306 .name = "IIfx",
307 .adb_type = MAC_ADB_IOP,
308 .via_type = MAC_VIA_IICI,
309 .scsi_type = MAC_SCSI_OLD,
310 .scc_type = MAC_SCC_IOP,
311 .nubus_type = MAC_NUBUS,
312 .floppy_type = MAC_FLOPPY_SWIM_IOP,
313 }, {
314 .ident = MAC_MODEL_IISI,
315 .name = "IIsi",
316 .adb_type = MAC_ADB_IISI,
317 .via_type = MAC_VIA_IICI,
318 .scsi_type = MAC_SCSI_OLD,
319 .scc_type = MAC_SCC_II,
320 .nubus_type = MAC_NUBUS,
321 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
322 }, {
323 .ident = MAC_MODEL_IIVI,
324 .name = "IIvi",
325 .adb_type = MAC_ADB_IISI,
326 .via_type = MAC_VIA_IICI,
327 .scsi_type = MAC_SCSI_OLD,
328 .scc_type = MAC_SCC_II,
329 .nubus_type = MAC_NUBUS,
330 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
331 }, {
332 .ident = MAC_MODEL_IIVX,
333 .name = "IIvx",
334 .adb_type = MAC_ADB_IISI,
335 .via_type = MAC_VIA_IICI,
336 .scsi_type = MAC_SCSI_OLD,
337 .scc_type = MAC_SCC_II,
338 .nubus_type = MAC_NUBUS,
339 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
343 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
347 .ident = MAC_MODEL_CLII,
348 .name = "Classic II",
349 .adb_type = MAC_ADB_IISI,
350 .via_type = MAC_VIA_IICI,
351 .scsi_type = MAC_SCSI_OLD,
352 .scc_type = MAC_SCC_II,
353 .nubus_type = MAC_NUBUS,
354 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
355 }, {
356 .ident = MAC_MODEL_CCL,
357 .name = "Color Classic",
358 .adb_type = MAC_ADB_CUDA,
359 .via_type = MAC_VIA_IICI,
360 .scsi_type = MAC_SCSI_OLD,
361 .scc_type = MAC_SCC_II,
362 .nubus_type = MAC_NUBUS,
363 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
364 }, {
365 .ident = MAC_MODEL_CCLII,
366 .name = "Color Classic II",
367 .adb_type = MAC_ADB_CUDA,
368 .via_type = MAC_VIA_IICI,
369 .scsi_type = MAC_SCSI_OLD,
370 .scc_type = MAC_SCC_II,
371 .nubus_type = MAC_NUBUS,
372 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
376 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
380 .ident = MAC_MODEL_LC,
381 .name = "LC",
382 .adb_type = MAC_ADB_IISI,
383 .via_type = MAC_VIA_IICI,
384 .scsi_type = MAC_SCSI_OLD,
385 .scc_type = MAC_SCC_II,
386 .nubus_type = MAC_NUBUS,
387 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
388 }, {
389 .ident = MAC_MODEL_LCII,
390 .name = "LC II",
391 .adb_type = MAC_ADB_IISI,
392 .via_type = MAC_VIA_IICI,
393 .scsi_type = MAC_SCSI_OLD,
394 .scc_type = MAC_SCC_II,
395 .nubus_type = MAC_NUBUS,
396 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
397 }, {
398 .ident = MAC_MODEL_LCIII,
399 .name = "LC III",
400 .adb_type = MAC_ADB_IISI,
401 .via_type = MAC_VIA_IICI,
402 .scsi_type = MAC_SCSI_OLD,
403 .scc_type = MAC_SCC_II,
404 .nubus_type = MAC_NUBUS,
405 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
409 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
410 * differently as some of the stuff connected to VIA2 seems different.
411 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
412 * the 660AV and 840AV which use an AMD 79C940 (MACE).
413 * The 700, 900 and 950 have some I/O chips in the wrong place to
414 * confuse us. The 840AV has a SCSI location of its own (same as
415 * the 660AV).
419 .ident = MAC_MODEL_Q605,
420 .name = "Quadra 605",
421 .adb_type = MAC_ADB_CUDA,
422 .via_type = MAC_VIA_QUADRA,
423 .scsi_type = MAC_SCSI_QUADRA,
424 .scc_type = MAC_SCC_QUADRA,
425 .nubus_type = MAC_NUBUS,
426 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
427 }, {
428 .ident = MAC_MODEL_Q605_ACC,
429 .name = "Quadra 605",
430 .adb_type = MAC_ADB_CUDA,
431 .via_type = MAC_VIA_QUADRA,
432 .scsi_type = MAC_SCSI_QUADRA,
433 .scc_type = MAC_SCC_QUADRA,
434 .nubus_type = MAC_NUBUS,
435 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
436 }, {
437 .ident = MAC_MODEL_Q610,
438 .name = "Quadra 610",
439 .adb_type = MAC_ADB_II,
440 .via_type = MAC_VIA_QUADRA,
441 .scsi_type = MAC_SCSI_QUADRA,
442 .scc_type = MAC_SCC_QUADRA,
443 .ether_type = MAC_ETHER_SONIC,
444 .nubus_type = MAC_NUBUS,
445 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
446 }, {
447 .ident = MAC_MODEL_Q630,
448 .name = "Quadra 630",
449 .adb_type = MAC_ADB_CUDA,
450 .via_type = MAC_VIA_QUADRA,
451 .scsi_type = MAC_SCSI_QUADRA,
452 .ide_type = MAC_IDE_QUADRA,
453 .scc_type = MAC_SCC_QUADRA,
454 .ether_type = MAC_ETHER_SONIC,
455 .nubus_type = MAC_NUBUS,
456 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
457 }, {
458 .ident = MAC_MODEL_Q650,
459 .name = "Quadra 650",
460 .adb_type = MAC_ADB_II,
461 .via_type = MAC_VIA_QUADRA,
462 .scsi_type = MAC_SCSI_QUADRA,
463 .scc_type = MAC_SCC_QUADRA,
464 .ether_type = MAC_ETHER_SONIC,
465 .nubus_type = MAC_NUBUS,
466 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
468 /* The Q700 does have a NS Sonic */
470 .ident = MAC_MODEL_Q700,
471 .name = "Quadra 700",
472 .adb_type = MAC_ADB_II,
473 .via_type = MAC_VIA_QUADRA,
474 .scsi_type = MAC_SCSI_QUADRA2,
475 .scc_type = MAC_SCC_QUADRA,
476 .ether_type = MAC_ETHER_SONIC,
477 .nubus_type = MAC_NUBUS,
478 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
479 }, {
480 .ident = MAC_MODEL_Q800,
481 .name = "Quadra 800",
482 .adb_type = MAC_ADB_II,
483 .via_type = MAC_VIA_QUADRA,
484 .scsi_type = MAC_SCSI_QUADRA,
485 .scc_type = MAC_SCC_QUADRA,
486 .ether_type = MAC_ETHER_SONIC,
487 .nubus_type = MAC_NUBUS,
488 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
489 }, {
490 .ident = MAC_MODEL_Q840,
491 .name = "Quadra 840AV",
492 .adb_type = MAC_ADB_CUDA,
493 .via_type = MAC_VIA_QUADRA,
494 .scsi_type = MAC_SCSI_QUADRA3,
495 .scc_type = MAC_SCC_PSC,
496 .ether_type = MAC_ETHER_MACE,
497 .nubus_type = MAC_NUBUS,
498 .floppy_type = MAC_FLOPPY_AV,
499 }, {
500 .ident = MAC_MODEL_Q900,
501 .name = "Quadra 900",
502 .adb_type = MAC_ADB_IOP,
503 .via_type = MAC_VIA_QUADRA,
504 .scsi_type = MAC_SCSI_QUADRA2,
505 .scc_type = MAC_SCC_IOP,
506 .ether_type = MAC_ETHER_SONIC,
507 .nubus_type = MAC_NUBUS,
508 .floppy_type = MAC_FLOPPY_SWIM_IOP,
509 }, {
510 .ident = MAC_MODEL_Q950,
511 .name = "Quadra 950",
512 .adb_type = MAC_ADB_IOP,
513 .via_type = MAC_VIA_QUADRA,
514 .scsi_type = MAC_SCSI_QUADRA2,
515 .scc_type = MAC_SCC_IOP,
516 .ether_type = MAC_ETHER_SONIC,
517 .nubus_type = MAC_NUBUS,
518 .floppy_type = MAC_FLOPPY_SWIM_IOP,
522 * Performa - more LC type machines
526 .ident = MAC_MODEL_P460,
527 .name = "Performa 460",
528 .adb_type = MAC_ADB_IISI,
529 .via_type = MAC_VIA_IICI,
530 .scsi_type = MAC_SCSI_OLD,
531 .scc_type = MAC_SCC_II,
532 .nubus_type = MAC_NUBUS,
533 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
534 }, {
535 .ident = MAC_MODEL_P475,
536 .name = "Performa 475",
537 .adb_type = MAC_ADB_CUDA,
538 .via_type = MAC_VIA_QUADRA,
539 .scsi_type = MAC_SCSI_QUADRA,
540 .scc_type = MAC_SCC_II,
541 .nubus_type = MAC_NUBUS,
542 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
543 }, {
544 .ident = MAC_MODEL_P475F,
545 .name = "Performa 475",
546 .adb_type = MAC_ADB_CUDA,
547 .via_type = MAC_VIA_QUADRA,
548 .scsi_type = MAC_SCSI_QUADRA,
549 .scc_type = MAC_SCC_II,
550 .nubus_type = MAC_NUBUS,
551 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
552 }, {
553 .ident = MAC_MODEL_P520,
554 .name = "Performa 520",
555 .adb_type = MAC_ADB_CUDA,
556 .via_type = MAC_VIA_IICI,
557 .scsi_type = MAC_SCSI_OLD,
558 .scc_type = MAC_SCC_II,
559 .nubus_type = MAC_NUBUS,
560 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
561 }, {
562 .ident = MAC_MODEL_P550,
563 .name = "Performa 550",
564 .adb_type = MAC_ADB_CUDA,
565 .via_type = MAC_VIA_IICI,
566 .scsi_type = MAC_SCSI_OLD,
567 .scc_type = MAC_SCC_II,
568 .nubus_type = MAC_NUBUS,
569 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
571 /* These have the comm slot, and therefore possibly SONIC ethernet */
573 .ident = MAC_MODEL_P575,
574 .name = "Performa 575",
575 .adb_type = MAC_ADB_CUDA,
576 .via_type = MAC_VIA_QUADRA,
577 .scsi_type = MAC_SCSI_QUADRA,
578 .scc_type = MAC_SCC_II,
579 .ether_type = MAC_ETHER_SONIC,
580 .nubus_type = MAC_NUBUS,
581 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
582 }, {
583 .ident = MAC_MODEL_P588,
584 .name = "Performa 588",
585 .adb_type = MAC_ADB_CUDA,
586 .via_type = MAC_VIA_QUADRA,
587 .scsi_type = MAC_SCSI_QUADRA,
588 .ide_type = MAC_IDE_QUADRA,
589 .scc_type = MAC_SCC_II,
590 .ether_type = MAC_ETHER_SONIC,
591 .nubus_type = MAC_NUBUS,
592 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
593 }, {
594 .ident = MAC_MODEL_TV,
595 .name = "TV",
596 .adb_type = MAC_ADB_CUDA,
597 .via_type = MAC_VIA_IICI,
598 .scsi_type = MAC_SCSI_OLD,
599 .scc_type = MAC_SCC_II,
600 .nubus_type = MAC_NUBUS,
601 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
602 }, {
603 .ident = MAC_MODEL_P600,
604 .name = "Performa 600",
605 .adb_type = MAC_ADB_IISI,
606 .via_type = MAC_VIA_IICI,
607 .scsi_type = MAC_SCSI_OLD,
608 .scc_type = MAC_SCC_II,
609 .nubus_type = MAC_NUBUS,
610 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
614 * Centris - just guessing again; maybe like Quadra.
615 * The C610 may or may not have SONIC. We probe to make sure.
619 .ident = MAC_MODEL_C610,
620 .name = "Centris 610",
621 .adb_type = MAC_ADB_II,
622 .via_type = MAC_VIA_QUADRA,
623 .scsi_type = MAC_SCSI_QUADRA,
624 .scc_type = MAC_SCC_QUADRA,
625 .ether_type = MAC_ETHER_SONIC,
626 .nubus_type = MAC_NUBUS,
627 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
628 }, {
629 .ident = MAC_MODEL_C650,
630 .name = "Centris 650",
631 .adb_type = MAC_ADB_II,
632 .via_type = MAC_VIA_QUADRA,
633 .scsi_type = MAC_SCSI_QUADRA,
634 .scc_type = MAC_SCC_QUADRA,
635 .ether_type = MAC_ETHER_SONIC,
636 .nubus_type = MAC_NUBUS,
637 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
638 }, {
639 .ident = MAC_MODEL_C660,
640 .name = "Centris 660AV",
641 .adb_type = MAC_ADB_CUDA,
642 .via_type = MAC_VIA_QUADRA,
643 .scsi_type = MAC_SCSI_QUADRA3,
644 .scc_type = MAC_SCC_PSC,
645 .ether_type = MAC_ETHER_MACE,
646 .nubus_type = MAC_NUBUS,
647 .floppy_type = MAC_FLOPPY_AV,
651 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
652 * and a PMU (in two variations?) for ADB. Most of them use the
653 * Quadra-style VIAs. A few models also have IDE from hell.
657 .ident = MAC_MODEL_PB140,
658 .name = "PowerBook 140",
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,
665 }, {
666 .ident = MAC_MODEL_PB145,
667 .name = "PowerBook 145",
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,
674 }, {
675 .ident = MAC_MODEL_PB150,
676 .name = "PowerBook 150",
677 .adb_type = MAC_ADB_PB2,
678 .via_type = MAC_VIA_IICI,
679 .scsi_type = MAC_SCSI_OLD,
680 .ide_type = MAC_IDE_PB,
681 .scc_type = MAC_SCC_QUADRA,
682 .nubus_type = MAC_NUBUS,
683 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
684 }, {
685 .ident = MAC_MODEL_PB160,
686 .name = "PowerBook 160",
687 .adb_type = MAC_ADB_PB1,
688 .via_type = MAC_VIA_QUADRA,
689 .scsi_type = MAC_SCSI_OLD,
690 .scc_type = MAC_SCC_QUADRA,
691 .nubus_type = MAC_NUBUS,
692 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
693 }, {
694 .ident = MAC_MODEL_PB165,
695 .name = "PowerBook 165",
696 .adb_type = MAC_ADB_PB1,
697 .via_type = MAC_VIA_QUADRA,
698 .scsi_type = MAC_SCSI_OLD,
699 .scc_type = MAC_SCC_QUADRA,
700 .nubus_type = MAC_NUBUS,
701 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
702 }, {
703 .ident = MAC_MODEL_PB165C,
704 .name = "PowerBook 165c",
705 .adb_type = MAC_ADB_PB1,
706 .via_type = MAC_VIA_QUADRA,
707 .scsi_type = MAC_SCSI_OLD,
708 .scc_type = MAC_SCC_QUADRA,
709 .nubus_type = MAC_NUBUS,
710 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
711 }, {
712 .ident = MAC_MODEL_PB170,
713 .name = "PowerBook 170",
714 .adb_type = MAC_ADB_PB1,
715 .via_type = MAC_VIA_QUADRA,
716 .scsi_type = MAC_SCSI_OLD,
717 .scc_type = MAC_SCC_QUADRA,
718 .nubus_type = MAC_NUBUS,
719 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
720 }, {
721 .ident = MAC_MODEL_PB180,
722 .name = "PowerBook 180",
723 .adb_type = MAC_ADB_PB1,
724 .via_type = MAC_VIA_QUADRA,
725 .scsi_type = MAC_SCSI_OLD,
726 .scc_type = MAC_SCC_QUADRA,
727 .nubus_type = MAC_NUBUS,
728 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
729 }, {
730 .ident = MAC_MODEL_PB180C,
731 .name = "PowerBook 180c",
732 .adb_type = MAC_ADB_PB1,
733 .via_type = MAC_VIA_QUADRA,
734 .scsi_type = MAC_SCSI_OLD,
735 .scc_type = MAC_SCC_QUADRA,
736 .nubus_type = MAC_NUBUS,
737 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
738 }, {
739 .ident = MAC_MODEL_PB190,
740 .name = "PowerBook 190",
741 .adb_type = MAC_ADB_PB2,
742 .via_type = MAC_VIA_QUADRA,
743 .scsi_type = MAC_SCSI_OLD,
744 .ide_type = MAC_IDE_BABOON,
745 .scc_type = MAC_SCC_QUADRA,
746 .nubus_type = MAC_NUBUS,
747 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
748 }, {
749 .ident = MAC_MODEL_PB520,
750 .name = "PowerBook 520",
751 .adb_type = MAC_ADB_PB2,
752 .via_type = MAC_VIA_QUADRA,
753 .scsi_type = MAC_SCSI_OLD,
754 .scc_type = MAC_SCC_QUADRA,
755 .ether_type = MAC_ETHER_SONIC,
756 .nubus_type = MAC_NUBUS,
757 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
761 * PowerBook Duos are pretty much like normal PowerBooks
762 * All of these probably have onboard SONIC in the Dock which
763 * means we'll have to probe for it eventually.
767 .ident = MAC_MODEL_PB210,
768 .name = "PowerBook Duo 210",
769 .adb_type = MAC_ADB_PB2,
770 .via_type = MAC_VIA_IICI,
771 .scsi_type = MAC_SCSI_OLD,
772 .scc_type = MAC_SCC_QUADRA,
773 .nubus_type = MAC_NUBUS,
774 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
775 }, {
776 .ident = MAC_MODEL_PB230,
777 .name = "PowerBook Duo 230",
778 .adb_type = MAC_ADB_PB2,
779 .via_type = MAC_VIA_IICI,
780 .scsi_type = MAC_SCSI_OLD,
781 .scc_type = MAC_SCC_QUADRA,
782 .nubus_type = MAC_NUBUS,
783 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
784 }, {
785 .ident = MAC_MODEL_PB250,
786 .name = "PowerBook Duo 250",
787 .adb_type = MAC_ADB_PB2,
788 .via_type = MAC_VIA_IICI,
789 .scsi_type = MAC_SCSI_OLD,
790 .scc_type = MAC_SCC_QUADRA,
791 .nubus_type = MAC_NUBUS,
792 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
793 }, {
794 .ident = MAC_MODEL_PB270C,
795 .name = "PowerBook Duo 270c",
796 .adb_type = MAC_ADB_PB2,
797 .via_type = MAC_VIA_IICI,
798 .scsi_type = MAC_SCSI_OLD,
799 .scc_type = MAC_SCC_QUADRA,
800 .nubus_type = MAC_NUBUS,
801 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
802 }, {
803 .ident = MAC_MODEL_PB280,
804 .name = "PowerBook Duo 280",
805 .adb_type = MAC_ADB_PB2,
806 .via_type = MAC_VIA_IICI,
807 .scsi_type = MAC_SCSI_OLD,
808 .scc_type = MAC_SCC_QUADRA,
809 .nubus_type = MAC_NUBUS,
810 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
811 }, {
812 .ident = MAC_MODEL_PB280C,
813 .name = "PowerBook Duo 280c",
814 .adb_type = MAC_ADB_PB2,
815 .via_type = MAC_VIA_IICI,
816 .scsi_type = MAC_SCSI_OLD,
817 .scc_type = MAC_SCC_QUADRA,
818 .nubus_type = MAC_NUBUS,
819 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
823 * Other stuff?
827 .ident = -1
831 static struct resource scc_a_rsrcs[] = {
832 { .flags = IORESOURCE_MEM },
833 { .flags = IORESOURCE_IRQ },
836 static struct resource scc_b_rsrcs[] = {
837 { .flags = IORESOURCE_MEM },
838 { .flags = IORESOURCE_IRQ },
841 struct platform_device scc_a_pdev = {
842 .name = "scc",
843 .id = 0,
844 .num_resources = ARRAY_SIZE(scc_a_rsrcs),
845 .resource = scc_a_rsrcs,
847 EXPORT_SYMBOL(scc_a_pdev);
849 struct platform_device scc_b_pdev = {
850 .name = "scc",
851 .id = 1,
852 .num_resources = ARRAY_SIZE(scc_b_rsrcs),
853 .resource = scc_b_rsrcs,
855 EXPORT_SYMBOL(scc_b_pdev);
857 static void __init mac_identify(void)
859 struct mac_model *m;
861 /* Penguin data useful? */
862 int model = mac_bi_data.id;
863 if (!model) {
864 /* no bootinfo model id -> NetBSD booter was used! */
865 /* XXX FIXME: breaks for model > 31 */
866 model = (mac_bi_data.cpuid >> 2) & 63;
867 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead "
868 "(obsolete bootloader?)\n");
871 macintosh_config = mac_data_table;
872 for (m = macintosh_config; m->ident != -1; m++) {
873 if (m->ident == model) {
874 macintosh_config = m;
875 break;
879 /* Set up serial port resources for the console initcall. */
881 scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
882 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
883 scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
884 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
886 switch (macintosh_config->scc_type) {
887 case MAC_SCC_PSC:
888 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
889 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
890 break;
891 default:
892 /* On non-PSC machines, the serial ports share an IRQ. */
893 if (macintosh_config->ident == MAC_MODEL_IIFX) {
894 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
895 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
896 } else {
897 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
898 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
900 break;
904 * We need to pre-init the IOPs, if any. Otherwise
905 * the serial console won't work if the user had
906 * the serial ports set to "Faster" mode in MacOS.
908 iop_preinit();
910 printk(KERN_INFO "Detected Macintosh model: %d\n", model);
913 * Report booter data:
915 printk(KERN_DEBUG " Penguin bootinfo data:\n");
916 printk(KERN_DEBUG " Video: addr 0x%lx "
917 "row 0x%lx depth %lx dimensions %ld x %ld\n",
918 mac_bi_data.videoaddr, mac_bi_data.videorow,
919 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
920 mac_bi_data.dimensions >> 16);
921 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
922 mac_bi_data.videological, mac_orig_videoaddr,
923 mac_bi_data.sccbase);
924 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
925 mac_bi_data.boottime, mac_bi_data.gmtbias);
926 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
927 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
929 iop_init();
930 via_init();
931 oss_init();
932 psc_init();
933 baboon_init();
935 #ifdef CONFIG_ADB_CUDA
936 find_via_cuda();
937 #endif
940 static void __init mac_report_hardware(void)
942 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
945 static void mac_get_model(char *str)
947 strcpy(str, "Macintosh ");
948 strcat(str, macintosh_config->name);
951 static struct resource swim_rsrc = { .flags = IORESOURCE_MEM };
953 static struct platform_device swim_pdev = {
954 .name = "swim",
955 .id = -1,
956 .num_resources = 1,
957 .resource = &swim_rsrc,
960 static struct platform_device esp_0_pdev = {
961 .name = "mac_esp",
962 .id = 0,
965 static struct platform_device esp_1_pdev = {
966 .name = "mac_esp",
967 .id = 1,
970 static struct platform_device sonic_pdev = {
971 .name = "macsonic",
972 .id = -1,
975 static struct platform_device mace_pdev = {
976 .name = "macmace",
977 .id = -1,
980 int __init mac_platform_init(void)
982 u8 *swim_base;
985 * Serial devices
988 platform_device_register(&scc_a_pdev);
989 platform_device_register(&scc_b_pdev);
992 * Floppy device
995 switch (macintosh_config->floppy_type) {
996 case MAC_FLOPPY_SWIM_ADDR1:
997 swim_base = (u8 *)(VIA1_BASE + 0x1E000);
998 break;
999 case MAC_FLOPPY_SWIM_ADDR2:
1000 swim_base = (u8 *)(VIA1_BASE + 0x16000);
1001 break;
1002 default:
1003 swim_base = NULL;
1004 break;
1007 if (swim_base) {
1008 swim_rsrc.start = (resource_size_t) swim_base,
1009 swim_rsrc.end = (resource_size_t) swim_base + 0x2000,
1010 platform_device_register(&swim_pdev);
1014 * SCSI device(s)
1017 switch (macintosh_config->scsi_type) {
1018 case MAC_SCSI_QUADRA:
1019 case MAC_SCSI_QUADRA3:
1020 platform_device_register(&esp_0_pdev);
1021 break;
1022 case MAC_SCSI_QUADRA2:
1023 platform_device_register(&esp_0_pdev);
1024 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
1025 (macintosh_config->ident == MAC_MODEL_Q950))
1026 platform_device_register(&esp_1_pdev);
1027 break;
1031 * Ethernet device
1034 switch (macintosh_config->ether_type) {
1035 case MAC_ETHER_SONIC:
1036 platform_device_register(&sonic_pdev);
1037 break;
1038 case MAC_ETHER_MACE:
1039 platform_device_register(&mace_pdev);
1040 break;
1043 return 0;
1046 arch_initcall(mac_platform_init);