Linux 3.16-rc2
[linux/fpc-iii.git] / arch / m68k / mac / config.c
bloba471eab1a4dda8d65214df570da554b9be44e378
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 #include <asm/setup.h>
30 #include <asm/bootinfo.h>
31 #include <asm/bootinfo-mac.h>
32 #include <asm/byteorder.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 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)
85 int unknown = 0;
86 const void *data = record->data;
88 switch (be16_to_cpu(record->tag)) {
89 case BI_MAC_MODEL:
90 mac_bi_data.id = be32_to_cpup(data);
91 break;
92 case BI_MAC_VADDR:
93 mac_bi_data.videoaddr = be32_to_cpup(data);
94 break;
95 case BI_MAC_VDEPTH:
96 mac_bi_data.videodepth = be32_to_cpup(data);
97 break;
98 case BI_MAC_VROW:
99 mac_bi_data.videorow = be32_to_cpup(data);
100 break;
101 case BI_MAC_VDIM:
102 mac_bi_data.dimensions = be32_to_cpup(data);
103 break;
104 case BI_MAC_VLOGICAL:
105 mac_orig_videoaddr = be32_to_cpup(data);
106 mac_bi_data.videological =
107 VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
108 break;
109 case BI_MAC_SCCBASE:
110 mac_bi_data.sccbase = be32_to_cpup(data);
111 break;
112 case BI_MAC_BTIME:
113 mac_bi_data.boottime = be32_to_cpup(data);
114 break;
115 case BI_MAC_GMTBIAS:
116 mac_bi_data.gmtbias = be32_to_cpup(data);
117 break;
118 case BI_MAC_MEMSIZE:
119 mac_bi_data.memsize = be32_to_cpup(data);
120 break;
121 case BI_MAC_CPUID:
122 mac_bi_data.cpuid = be32_to_cpup(data);
123 break;
124 case BI_MAC_ROMBASE:
125 mac_bi_data.rombase = be32_to_cpup(data);
126 break;
127 default:
128 unknown = 1;
129 break;
131 return unknown;
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)
142 unsigned long flags;
144 local_irq_save(flags);
145 via_flush_cache();
146 local_irq_restore(flags);
149 void __init config_mac(void)
151 if (!MACH_IS_MAC)
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;
166 #endif
169 * Determine hardware present
172 mac_identify();
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
178 * not.
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,
209 .name = "Unknown",
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,
224 .name = "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,
231 }, {
232 .ident = MAC_MODEL_IIX,
233 .name = "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,
240 }, {
241 .ident = MAC_MODEL_IICX,
242 .name = "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,
249 }, {
250 .ident = MAC_MODEL_SE30,
251 .name = "SE/30",
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,
269 .name = "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,
276 }, {
277 .ident = MAC_MODEL_IIFX,
278 .name = "IIfx",
279 .adb_type = MAC_ADB_IOP,
280 .via_type = MAC_VIA_IICI,
281 .scsi_type = MAC_SCSI_OLD,
282 .scc_type = MAC_SCC_IOP,
283 .nubus_type = MAC_NUBUS,
284 .floppy_type = MAC_FLOPPY_SWIM_IOP,
285 }, {
286 .ident = MAC_MODEL_IISI,
287 .name = "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,
294 }, {
295 .ident = MAC_MODEL_IIVI,
296 .name = "IIvi",
297 .adb_type = MAC_ADB_IISI,
298 .via_type = MAC_VIA_IICI,
299 .scsi_type = MAC_SCSI_OLD,
300 .scc_type = MAC_SCC_II,
301 .nubus_type = MAC_NUBUS,
302 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
303 }, {
304 .ident = MAC_MODEL_IIVX,
305 .name = "IIvx",
306 .adb_type = MAC_ADB_IISI,
307 .via_type = MAC_VIA_IICI,
308 .scsi_type = MAC_SCSI_OLD,
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_OLD,
324 .scc_type = MAC_SCC_II,
325 .nubus_type = MAC_NUBUS,
326 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
327 }, {
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_OLD,
333 .scc_type = MAC_SCC_II,
334 .nubus_type = MAC_NUBUS,
335 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
336 }, {
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_OLD,
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,
353 .name = "LC",
354 .adb_type = MAC_ADB_IISI,
355 .via_type = MAC_VIA_IICI,
356 .scsi_type = MAC_SCSI_OLD,
357 .scc_type = MAC_SCC_II,
358 .nubus_type = MAC_NUBUS,
359 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
360 }, {
361 .ident = MAC_MODEL_LCII,
362 .name = "LC II",
363 .adb_type = MAC_ADB_IISI,
364 .via_type = MAC_VIA_IICI,
365 .scsi_type = MAC_SCSI_OLD,
366 .scc_type = MAC_SCC_II,
367 .nubus_type = MAC_NUBUS,
368 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
369 }, {
370 .ident = MAC_MODEL_LCIII,
371 .name = "LC III",
372 .adb_type = MAC_ADB_IISI,
373 .via_type = MAC_VIA_IICI,
374 .scsi_type = MAC_SCSI_OLD,
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
387 * the 660AV).
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,
399 }, {
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,
408 }, {
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,
418 }, {
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,
429 }, {
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,
451 }, {
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,
461 }, {
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,
471 }, {
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,
481 }, {
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_OLD,
503 .scc_type = MAC_SCC_II,
504 .nubus_type = MAC_NUBUS,
505 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
506 }, {
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,
515 }, {
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,
524 }, {
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_OLD,
530 .scc_type = MAC_SCC_II,
531 .nubus_type = MAC_NUBUS,
532 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
533 }, {
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_OLD,
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,
554 }, {
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,
565 }, {
566 .ident = MAC_MODEL_TV,
567 .name = "TV",
568 .adb_type = MAC_ADB_CUDA,
569 .via_type = MAC_VIA_IICI,
570 .scsi_type = MAC_SCSI_OLD,
571 .scc_type = MAC_SCC_II,
572 .nubus_type = MAC_NUBUS,
573 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
574 }, {
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_OLD,
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,
600 }, {
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,
610 }, {
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,
637 }, {
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,
646 }, {
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,
656 }, {
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,
665 }, {
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,
674 }, {
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,
683 }, {
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,
692 }, {
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,
701 }, {
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,
710 }, {
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_OLD,
716 .ide_type = MAC_IDE_BABOON,
717 .scc_type = MAC_SCC_QUADRA,
718 .nubus_type = MAC_NUBUS,
719 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
720 }, {
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_OLD,
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_OLD,
744 .scc_type = MAC_SCC_QUADRA,
745 .nubus_type = MAC_NUBUS,
746 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
747 }, {
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_OLD,
753 .scc_type = MAC_SCC_QUADRA,
754 .nubus_type = MAC_NUBUS,
755 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
756 }, {
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_OLD,
762 .scc_type = MAC_SCC_QUADRA,
763 .nubus_type = MAC_NUBUS,
764 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
765 }, {
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_OLD,
771 .scc_type = MAC_SCC_QUADRA,
772 .nubus_type = MAC_NUBUS,
773 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
774 }, {
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_OLD,
780 .scc_type = MAC_SCC_QUADRA,
781 .nubus_type = MAC_NUBUS,
782 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
783 }, {
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_OLD,
789 .scc_type = MAC_SCC_QUADRA,
790 .nubus_type = MAC_NUBUS,
791 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
795 * Other stuff?
799 .ident = -1
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 = {
814 .name = "scc",
815 .id = 0,
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 = {
822 .name = "scc",
823 .id = 1,
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)
831 struct mac_model *m;
833 /* Penguin data useful? */
834 int model = mac_bi_data.id;
835 if (!model) {
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;
847 break;
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) {
859 case MAC_SCC_PSC:
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;
862 break;
863 default:
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;
868 } else {
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;
872 break;
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.
880 iop_preinit();
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);
901 iop_init();
902 via_init();
903 oss_init();
904 psc_init();
905 baboon_init();
907 #ifdef CONFIG_ADB_CUDA
908 find_via_cuda();
909 #endif
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 = {
926 .name = "swim",
927 .id = -1,
928 .num_resources = 1,
929 .resource = &swim_rsrc,
932 static struct platform_device esp_0_pdev = {
933 .name = "mac_esp",
934 .id = 0,
937 static struct platform_device esp_1_pdev = {
938 .name = "mac_esp",
939 .id = 1,
942 static struct platform_device sonic_pdev = {
943 .name = "macsonic",
944 .id = -1,
947 static struct platform_device mace_pdev = {
948 .name = "macmace",
949 .id = -1,
952 int __init mac_platform_init(void)
954 u8 *swim_base;
956 if (!MACH_IS_MAC)
957 return -ENODEV;
960 * Serial devices
963 platform_device_register(&scc_a_pdev);
964 platform_device_register(&scc_b_pdev);
967 * Floppy device
970 switch (macintosh_config->floppy_type) {
971 case MAC_FLOPPY_SWIM_ADDR1:
972 swim_base = (u8 *)(VIA1_BASE + 0x1E000);
973 break;
974 case MAC_FLOPPY_SWIM_ADDR2:
975 swim_base = (u8 *)(VIA1_BASE + 0x16000);
976 break;
977 default:
978 swim_base = NULL;
979 break;
982 if (swim_base) {
983 swim_rsrc.start = (resource_size_t) swim_base,
984 swim_rsrc.end = (resource_size_t) swim_base + 0x2000,
985 platform_device_register(&swim_pdev);
989 * SCSI device(s)
992 switch (macintosh_config->scsi_type) {
993 case MAC_SCSI_QUADRA:
994 case MAC_SCSI_QUADRA3:
995 platform_device_register(&esp_0_pdev);
996 break;
997 case MAC_SCSI_QUADRA2:
998 platform_device_register(&esp_0_pdev);
999 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
1000 (macintosh_config->ident == MAC_MODEL_Q950))
1001 platform_device_register(&esp_1_pdev);
1002 break;
1006 * Ethernet device
1009 switch (macintosh_config->ether_type) {
1010 case MAC_ETHER_SONIC:
1011 platform_device_register(&sonic_pdev);
1012 break;
1013 case MAC_ETHER_MACE:
1014 platform_device_register(&mace_pdev);
1015 break;
1018 return 0;
1021 arch_initcall(mac_platform_init);