1
2
3
4
5
6
7
8
9
10
11
12
13#include <linux/errno.h>
14#include <linux/module.h>
15#include <linux/types.h>
16#include <linux/mm.h>
17#include <linux/tty.h>
18#include <linux/console.h>
19#include <linux/interrupt.h>
20
21#include <linux/random.h>
22#include <linux/delay.h>
23
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>
31
32#include <asm/setup.h>
33#include <asm/bootinfo.h>
34#include <asm/bootinfo-mac.h>
35#include <asm/byteorder.h>
36
37#include <asm/io.h>
38#include <asm/irq.h>
39#include <asm/pgtable.h>
40#include <asm/machdep.h>
41
42#include <asm/macintosh.h>
43#include <asm/macints.h>
44#include <asm/machw.h>
45
46#include <asm/mac_iop.h>
47#include <asm/mac_via.h>
48#include <asm/mac_oss.h>
49#include <asm/mac_psc.h>
50
51
52struct mac_booter_data mac_bi_data;
53
54
55static unsigned long mac_orig_videoaddr;
56
57
58extern u32 mac_gettimeoffset(void);
59extern int mac_hwclk(int, struct rtc_time *);
60extern int mac_set_clock_mmss(unsigned long);
61extern void iop_preinit(void);
62extern void iop_init(void);
63extern void via_init(void);
64extern void via_init_clock(irq_handler_t func);
65extern void via_flush_cache(void);
66extern void oss_init(void);
67extern void psc_init(void);
68extern void baboon_init(void);
69
70extern void mac_mksound(unsigned int, unsigned int);
71
72static void mac_get_model(char *str);
73static void mac_identify(void);
74static void mac_report_hardware(void);
75
76static void __init mac_sched_init(irq_handler_t vector)
77{
78 via_init_clock(vector);
79}
80
81
82
83
84
85int __init mac_parse_bootinfo(const struct bi_record *record)
86{
87 int unknown = 0;
88 const void *data = record->data;
89
90 switch (be16_to_cpu(record->tag)) {
91 case BI_MAC_MODEL:
92 mac_bi_data.id = be32_to_cpup(data);
93 break;
94 case BI_MAC_VADDR:
95 mac_bi_data.videoaddr = be32_to_cpup(data);
96 break;
97 case BI_MAC_VDEPTH:
98 mac_bi_data.videodepth = be32_to_cpup(data);
99 break;
100 case BI_MAC_VROW:
101 mac_bi_data.videorow = be32_to_cpup(data);
102 break;
103 case BI_MAC_VDIM:
104 mac_bi_data.dimensions = be32_to_cpup(data);
105 break;
106 case BI_MAC_VLOGICAL:
107 mac_orig_videoaddr = be32_to_cpup(data);
108 mac_bi_data.videological =
109 VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
110 break;
111 case BI_MAC_SCCBASE:
112 mac_bi_data.sccbase = be32_to_cpup(data);
113 break;
114 case BI_MAC_BTIME:
115 mac_bi_data.boottime = be32_to_cpup(data);
116 break;
117 case BI_MAC_GMTBIAS:
118 mac_bi_data.gmtbias = be32_to_cpup(data);
119 break;
120 case BI_MAC_MEMSIZE:
121 mac_bi_data.memsize = be32_to_cpup(data);
122 break;
123 case BI_MAC_CPUID:
124 mac_bi_data.cpuid = be32_to_cpup(data);
125 break;
126 case BI_MAC_ROMBASE:
127 mac_bi_data.rombase = be32_to_cpup(data);
128 break;
129 default:
130 unknown = 1;
131 break;
132 }
133 return unknown;
134}
135
136
137
138
139
140
141
142static void mac_cache_card_flush(int writeback)
143{
144 unsigned long flags;
145
146 local_irq_save(flags);
147 via_flush_cache();
148 local_irq_restore(flags);
149}
150
151void __init config_mac(void)
152{
153 if (!MACH_IS_MAC)
154 pr_err("ERROR: no Mac, but config_mac() called!!\n");
155
156 mach_sched_init = mac_sched_init;
157 mach_init_IRQ = mac_init_IRQ;
158 mach_get_model = mac_get_model;
159 arch_gettimeoffset = mac_gettimeoffset;
160 mach_hwclk = mac_hwclk;
161 mach_set_clock_mmss = mac_set_clock_mmss;
162 mach_reset = mac_reset;
163 mach_halt = mac_poweroff;
164 mach_power_off = mac_poweroff;
165 mach_max_dma_address = 0xffffffff;
166#if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
167 mach_beep = mac_mksound;
168#endif
169
170
171
172
173
174 mac_identify();
175 mac_report_hardware();
176
177
178
179
180
181
182
183 if (macintosh_config->ident == MAC_MODEL_IICI
184 || macintosh_config->ident == MAC_MODEL_IIFX)
185 mach_l2_flush = mac_cache_card_flush;
186}
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201struct mac_model *macintosh_config;
202EXPORT_SYMBOL(macintosh_config);
203
204static struct mac_model mac_data_table[] = {
205
206
207
208
209 {
210 .ident = MAC_MODEL_II,
211 .name = "Unknown",
212 .adb_type = MAC_ADB_II,
213 .via_type = MAC_VIA_II,
214 .scsi_type = MAC_SCSI_OLD,
215 .scc_type = MAC_SCC_II,
216 .expansion_type = MAC_EXP_NUBUS,
217 .floppy_type = MAC_FLOPPY_IWM,
218 },
219
220
221
222
223
224 {
225 .ident = MAC_MODEL_II,
226 .name = "II",
227 .adb_type = MAC_ADB_II,
228 .via_type = MAC_VIA_II,
229 .scsi_type = MAC_SCSI_OLD,
230 .scc_type = MAC_SCC_II,
231 .expansion_type = MAC_EXP_NUBUS,
232 .floppy_type = MAC_FLOPPY_IWM,
233 }, {
234 .ident = MAC_MODEL_IIX,
235 .name = "IIx",
236 .adb_type = MAC_ADB_II,
237 .via_type = MAC_VIA_II,
238 .scsi_type = MAC_SCSI_OLD,
239 .scc_type = MAC_SCC_II,
240 .expansion_type = MAC_EXP_NUBUS,
241 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
242 }, {
243 .ident = MAC_MODEL_IICX,
244 .name = "IIcx",
245 .adb_type = MAC_ADB_II,
246 .via_type = MAC_VIA_II,
247 .scsi_type = MAC_SCSI_OLD,
248 .scc_type = MAC_SCC_II,
249 .expansion_type = MAC_EXP_NUBUS,
250 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
251 }, {
252 .ident = MAC_MODEL_SE30,
253 .name = "SE/30",
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 .expansion_type = MAC_EXP_PDS,
259 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
260 },
261
262
263
264
265
266
267
268
269 {
270 .ident = MAC_MODEL_IICI,
271 .name = "IIci",
272 .adb_type = MAC_ADB_II,
273 .via_type = MAC_VIA_IICI,
274 .scsi_type = MAC_SCSI_OLD,
275 .scc_type = MAC_SCC_II,
276 .expansion_type = MAC_EXP_NUBUS,
277 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
278 }, {
279 .ident = MAC_MODEL_IIFX,
280 .name = "IIfx",
281 .adb_type = MAC_ADB_IOP,
282 .via_type = MAC_VIA_IICI,
283 .scsi_type = MAC_SCSI_IIFX,
284 .scc_type = MAC_SCC_IOP,
285 .expansion_type = MAC_EXP_PDS_NUBUS,
286 .floppy_type = MAC_FLOPPY_SWIM_IOP,
287 }, {
288 .ident = MAC_MODEL_IISI,
289 .name = "IIsi",
290 .adb_type = MAC_ADB_EGRET,
291 .via_type = MAC_VIA_IICI,
292 .scsi_type = MAC_SCSI_OLD,
293 .scc_type = MAC_SCC_II,
294 .expansion_type = MAC_EXP_PDS_NUBUS,
295 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
296 }, {
297 .ident = MAC_MODEL_IIVI,
298 .name = "IIvi",
299 .adb_type = MAC_ADB_EGRET,
300 .via_type = MAC_VIA_IICI,
301 .scsi_type = MAC_SCSI_LC,
302 .scc_type = MAC_SCC_II,
303 .expansion_type = MAC_EXP_NUBUS,
304 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
305 }, {
306 .ident = MAC_MODEL_IIVX,
307 .name = "IIvx",
308 .adb_type = MAC_ADB_EGRET,
309 .via_type = MAC_VIA_IICI,
310 .scsi_type = MAC_SCSI_LC,
311 .scc_type = MAC_SCC_II,
312 .expansion_type = MAC_EXP_NUBUS,
313 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
314 },
315
316
317
318
319
320 {
321 .ident = MAC_MODEL_CLII,
322 .name = "Classic II",
323 .adb_type = MAC_ADB_EGRET,
324 .via_type = MAC_VIA_IICI,
325 .scsi_type = MAC_SCSI_LC,
326 .scc_type = MAC_SCC_II,
327 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
328 }, {
329 .ident = MAC_MODEL_CCL,
330 .name = "Color Classic",
331 .adb_type = MAC_ADB_CUDA,
332 .via_type = MAC_VIA_IICI,
333 .scsi_type = MAC_SCSI_LC,
334 .scc_type = MAC_SCC_II,
335 .expansion_type = MAC_EXP_PDS,
336 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
337 }, {
338 .ident = MAC_MODEL_CCLII,
339 .name = "Color Classic II",
340 .adb_type = MAC_ADB_CUDA,
341 .via_type = MAC_VIA_IICI,
342 .scsi_type = MAC_SCSI_LC,
343 .scc_type = MAC_SCC_II,
344 .expansion_type = MAC_EXP_PDS,
345 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
346 },
347
348
349
350
351
352 {
353 .ident = MAC_MODEL_LC,
354 .name = "LC",
355 .adb_type = MAC_ADB_EGRET,
356 .via_type = MAC_VIA_IICI,
357 .scsi_type = MAC_SCSI_LC,
358 .scc_type = MAC_SCC_II,
359 .expansion_type = MAC_EXP_PDS,
360 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
361 }, {
362 .ident = MAC_MODEL_LCII,
363 .name = "LC II",
364 .adb_type = MAC_ADB_EGRET,
365 .via_type = MAC_VIA_IICI,
366 .scsi_type = MAC_SCSI_LC,
367 .scc_type = MAC_SCC_II,
368 .expansion_type = MAC_EXP_PDS,
369 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
370 }, {
371 .ident = MAC_MODEL_LCIII,
372 .name = "LC III",
373 .adb_type = MAC_ADB_EGRET,
374 .via_type = MAC_VIA_IICI,
375 .scsi_type = MAC_SCSI_LC,
376 .scc_type = MAC_SCC_II,
377 .expansion_type = MAC_EXP_PDS,
378 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
379 },
380
381
382
383
384
385
386
387
388
389
390
391 {
392 .ident = MAC_MODEL_Q605,
393 .name = "Quadra 605",
394 .adb_type = MAC_ADB_CUDA,
395 .via_type = MAC_VIA_QUADRA,
396 .scsi_type = MAC_SCSI_QUADRA,
397 .scc_type = MAC_SCC_QUADRA,
398 .expansion_type = MAC_EXP_PDS,
399 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
400 }, {
401 .ident = MAC_MODEL_Q605_ACC,
402 .name = "Quadra 605",
403 .adb_type = MAC_ADB_CUDA,
404 .via_type = MAC_VIA_QUADRA,
405 .scsi_type = MAC_SCSI_QUADRA,
406 .scc_type = MAC_SCC_QUADRA,
407 .expansion_type = MAC_EXP_PDS,
408 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
409 }, {
410 .ident = MAC_MODEL_Q610,
411 .name = "Quadra 610",
412 .adb_type = MAC_ADB_II,
413 .via_type = MAC_VIA_QUADRA,
414 .scsi_type = MAC_SCSI_QUADRA,
415 .scc_type = MAC_SCC_QUADRA,
416 .ether_type = MAC_ETHER_SONIC,
417 .expansion_type = MAC_EXP_PDS_NUBUS,
418 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
419 }, {
420 .ident = MAC_MODEL_Q630,
421 .name = "Quadra 630",
422 .adb_type = MAC_ADB_CUDA,
423 .via_type = MAC_VIA_QUADRA,
424 .scsi_type = MAC_SCSI_QUADRA,
425 .ide_type = MAC_IDE_QUADRA,
426 .scc_type = MAC_SCC_QUADRA,
427 .expansion_type = MAC_EXP_PDS_COMM,
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 .expansion_type = MAC_EXP_PDS_NUBUS,
438 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
439 },
440
441 {
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 .expansion_type = MAC_EXP_PDS_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 .expansion_type = MAC_EXP_PDS_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 .expansion_type = MAC_EXP_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 .expansion_type = MAC_EXP_PDS_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 .expansion_type = MAC_EXP_PDS_NUBUS,
490 .floppy_type = MAC_FLOPPY_SWIM_IOP,
491 },
492
493
494
495
496
497 {
498 .ident = MAC_MODEL_P460,
499 .name = "Performa 460",
500 .adb_type = MAC_ADB_EGRET,
501 .via_type = MAC_VIA_IICI,
502 .scsi_type = MAC_SCSI_LC,
503 .scc_type = MAC_SCC_II,
504 .expansion_type = MAC_EXP_PDS,
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 .expansion_type = MAC_EXP_PDS,
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 .expansion_type = MAC_EXP_PDS,
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_LC,
530 .scc_type = MAC_SCC_II,
531 .expansion_type = MAC_EXP_PDS,
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_LC,
539 .scc_type = MAC_SCC_II,
540 .expansion_type = MAC_EXP_PDS,
541 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
542 },
543
544 {
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 .expansion_type = MAC_EXP_PDS_COMM,
552 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
553 }, {
554 .ident = MAC_MODEL_P588,
555 .name = "Performa 588",
556 .adb_type = MAC_ADB_CUDA,
557 .via_type = MAC_VIA_QUADRA,
558 .scsi_type = MAC_SCSI_QUADRA,
559 .ide_type = MAC_IDE_QUADRA,
560 .scc_type = MAC_SCC_II,
561 .expansion_type = MAC_EXP_PDS_COMM,
562 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
563 }, {
564 .ident = MAC_MODEL_TV,
565 .name = "TV",
566 .adb_type = MAC_ADB_CUDA,
567 .via_type = MAC_VIA_IICI,
568 .scsi_type = MAC_SCSI_LC,
569 .scc_type = MAC_SCC_II,
570 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
571 }, {
572 .ident = MAC_MODEL_P600,
573 .name = "Performa 600",
574 .adb_type = MAC_ADB_EGRET,
575 .via_type = MAC_VIA_IICI,
576 .scsi_type = MAC_SCSI_LC,
577 .scc_type = MAC_SCC_II,
578 .expansion_type = MAC_EXP_NUBUS,
579 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
580 },
581
582
583
584
585
586
587 {
588 .ident = MAC_MODEL_C610,
589 .name = "Centris 610",
590 .adb_type = MAC_ADB_II,
591 .via_type = MAC_VIA_QUADRA,
592 .scsi_type = MAC_SCSI_QUADRA,
593 .scc_type = MAC_SCC_QUADRA,
594 .ether_type = MAC_ETHER_SONIC,
595 .expansion_type = MAC_EXP_PDS_NUBUS,
596 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
597 }, {
598 .ident = MAC_MODEL_C650,
599 .name = "Centris 650",
600 .adb_type = MAC_ADB_II,
601 .via_type = MAC_VIA_QUADRA,
602 .scsi_type = MAC_SCSI_QUADRA,
603 .scc_type = MAC_SCC_QUADRA,
604 .ether_type = MAC_ETHER_SONIC,
605 .expansion_type = MAC_EXP_PDS_NUBUS,
606 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
607 }, {
608 .ident = MAC_MODEL_C660,
609 .name = "Centris 660AV",
610 .adb_type = MAC_ADB_CUDA,
611 .via_type = MAC_VIA_QUADRA,
612 .scsi_type = MAC_SCSI_QUADRA3,
613 .scc_type = MAC_SCC_PSC,
614 .ether_type = MAC_ETHER_MACE,
615 .expansion_type = MAC_EXP_PDS_NUBUS,
616 .floppy_type = MAC_FLOPPY_AV,
617 },
618
619
620
621
622
623
624
625 {
626 .ident = MAC_MODEL_PB140,
627 .name = "PowerBook 140",
628 .adb_type = MAC_ADB_PB1,
629 .via_type = MAC_VIA_QUADRA,
630 .scsi_type = MAC_SCSI_OLD,
631 .scc_type = MAC_SCC_QUADRA,
632 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
633 }, {
634 .ident = MAC_MODEL_PB145,
635 .name = "PowerBook 145",
636 .adb_type = MAC_ADB_PB1,
637 .via_type = MAC_VIA_QUADRA,
638 .scsi_type = MAC_SCSI_OLD,
639 .scc_type = MAC_SCC_QUADRA,
640 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
641 }, {
642 .ident = MAC_MODEL_PB150,
643 .name = "PowerBook 150",
644 .adb_type = MAC_ADB_PB2,
645 .via_type = MAC_VIA_IICI,
646 .scsi_type = MAC_SCSI_OLD,
647 .ide_type = MAC_IDE_PB,
648 .scc_type = MAC_SCC_QUADRA,
649 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
650 }, {
651 .ident = MAC_MODEL_PB160,
652 .name = "PowerBook 160",
653 .adb_type = MAC_ADB_PB1,
654 .via_type = MAC_VIA_QUADRA,
655 .scsi_type = MAC_SCSI_OLD,
656 .scc_type = MAC_SCC_QUADRA,
657 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
658 }, {
659 .ident = MAC_MODEL_PB165,
660 .name = "PowerBook 165",
661 .adb_type = MAC_ADB_PB1,
662 .via_type = MAC_VIA_QUADRA,
663 .scsi_type = MAC_SCSI_OLD,
664 .scc_type = MAC_SCC_QUADRA,
665 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
666 }, {
667 .ident = MAC_MODEL_PB165C,
668 .name = "PowerBook 165c",
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 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
674 }, {
675 .ident = MAC_MODEL_PB170,
676 .name = "PowerBook 170",
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 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
682 }, {
683 .ident = MAC_MODEL_PB180,
684 .name = "PowerBook 180",
685 .adb_type = MAC_ADB_PB1,
686 .via_type = MAC_VIA_QUADRA,
687 .scsi_type = MAC_SCSI_OLD,
688 .scc_type = MAC_SCC_QUADRA,
689 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
690 }, {
691 .ident = MAC_MODEL_PB180C,
692 .name = "PowerBook 180c",
693 .adb_type = MAC_ADB_PB1,
694 .via_type = MAC_VIA_QUADRA,
695 .scsi_type = MAC_SCSI_OLD,
696 .scc_type = MAC_SCC_QUADRA,
697 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
698 }, {
699 .ident = MAC_MODEL_PB190,
700 .name = "PowerBook 190",
701 .adb_type = MAC_ADB_PB2,
702 .via_type = MAC_VIA_QUADRA,
703 .scsi_type = MAC_SCSI_OLD,
704 .ide_type = MAC_IDE_BABOON,
705 .scc_type = MAC_SCC_QUADRA,
706 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
707 }, {
708 .ident = MAC_MODEL_PB520,
709 .name = "PowerBook 520",
710 .adb_type = MAC_ADB_PB2,
711 .via_type = MAC_VIA_QUADRA,
712 .scsi_type = MAC_SCSI_LATE,
713 .scc_type = MAC_SCC_QUADRA,
714 .ether_type = MAC_ETHER_SONIC,
715 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
716 },
717
718
719
720
721
722
723
724 {
725 .ident = MAC_MODEL_PB210,
726 .name = "PowerBook Duo 210",
727 .adb_type = MAC_ADB_PB2,
728 .via_type = MAC_VIA_IICI,
729 .scsi_type = MAC_SCSI_DUO,
730 .scc_type = MAC_SCC_QUADRA,
731 .expansion_type = MAC_EXP_NUBUS,
732 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
733 }, {
734 .ident = MAC_MODEL_PB230,
735 .name = "PowerBook Duo 230",
736 .adb_type = MAC_ADB_PB2,
737 .via_type = MAC_VIA_IICI,
738 .scsi_type = MAC_SCSI_DUO,
739 .scc_type = MAC_SCC_QUADRA,
740 .expansion_type = MAC_EXP_NUBUS,
741 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
742 }, {
743 .ident = MAC_MODEL_PB250,
744 .name = "PowerBook Duo 250",
745 .adb_type = MAC_ADB_PB2,
746 .via_type = MAC_VIA_IICI,
747 .scsi_type = MAC_SCSI_DUO,
748 .scc_type = MAC_SCC_QUADRA,
749 .expansion_type = MAC_EXP_NUBUS,
750 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
751 }, {
752 .ident = MAC_MODEL_PB270C,
753 .name = "PowerBook Duo 270c",
754 .adb_type = MAC_ADB_PB2,
755 .via_type = MAC_VIA_IICI,
756 .scsi_type = MAC_SCSI_DUO,
757 .scc_type = MAC_SCC_QUADRA,
758 .expansion_type = MAC_EXP_NUBUS,
759 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
760 }, {
761 .ident = MAC_MODEL_PB280,
762 .name = "PowerBook Duo 280",
763 .adb_type = MAC_ADB_PB2,
764 .via_type = MAC_VIA_IICI,
765 .scsi_type = MAC_SCSI_DUO,
766 .scc_type = MAC_SCC_QUADRA,
767 .expansion_type = MAC_EXP_NUBUS,
768 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
769 }, {
770 .ident = MAC_MODEL_PB280C,
771 .name = "PowerBook Duo 280c",
772 .adb_type = MAC_ADB_PB2,
773 .via_type = MAC_VIA_IICI,
774 .scsi_type = MAC_SCSI_DUO,
775 .scc_type = MAC_SCC_QUADRA,
776 .expansion_type = MAC_EXP_NUBUS,
777 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
778 },
779
780
781
782
783
784 {
785 .ident = -1
786 }
787};
788
789static struct resource scc_a_rsrcs[] = {
790 { .flags = IORESOURCE_MEM },
791 { .flags = IORESOURCE_IRQ },
792};
793
794static struct resource scc_b_rsrcs[] = {
795 { .flags = IORESOURCE_MEM },
796 { .flags = IORESOURCE_IRQ },
797};
798
799struct platform_device scc_a_pdev = {
800 .name = "scc",
801 .id = 0,
802 .num_resources = ARRAY_SIZE(scc_a_rsrcs),
803 .resource = scc_a_rsrcs,
804};
805EXPORT_SYMBOL(scc_a_pdev);
806
807struct platform_device scc_b_pdev = {
808 .name = "scc",
809 .id = 1,
810 .num_resources = ARRAY_SIZE(scc_b_rsrcs),
811 .resource = scc_b_rsrcs,
812};
813EXPORT_SYMBOL(scc_b_pdev);
814
815static void __init mac_identify(void)
816{
817 struct mac_model *m;
818
819
820 int model = mac_bi_data.id;
821 if (!model) {
822
823
824 model = (mac_bi_data.cpuid >> 2) & 63;
825 pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
826 }
827
828 macintosh_config = mac_data_table;
829 for (m = macintosh_config; m->ident != -1; m++) {
830 if (m->ident == model) {
831 macintosh_config = m;
832 break;
833 }
834 }
835
836
837
838 scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
839 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
840 scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
841 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
842
843 switch (macintosh_config->scc_type) {
844 case MAC_SCC_PSC:
845 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
846 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
847 break;
848 default:
849
850 if (macintosh_config->ident == MAC_MODEL_IIFX) {
851 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
852 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
853 } else {
854 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
855 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
856 }
857 break;
858 }
859
860
861
862
863
864
865 iop_preinit();
866
867 pr_info("Detected Macintosh model: %d\n", model);
868
869
870
871
872 printk(KERN_DEBUG " Penguin bootinfo data:\n");
873 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
874 mac_bi_data.videoaddr, mac_bi_data.videorow,
875 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
876 mac_bi_data.dimensions >> 16);
877 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
878 mac_bi_data.videological, mac_orig_videoaddr,
879 mac_bi_data.sccbase);
880 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
881 mac_bi_data.boottime, mac_bi_data.gmtbias);
882 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
883 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
884
885 iop_init();
886 oss_init();
887 via_init();
888 psc_init();
889 baboon_init();
890
891#ifdef CONFIG_ADB_CUDA
892 find_via_cuda();
893#endif
894#ifdef CONFIG_ADB_PMU68K
895 find_via_pmu();
896#endif
897}
898
899static void __init mac_report_hardware(void)
900{
901 pr_info("Apple Macintosh %s\n", macintosh_config->name);
902}
903
904static void mac_get_model(char *str)
905{
906 strcpy(str, "Macintosh ");
907 strcat(str, macintosh_config->name);
908}
909
910static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
911 {
912 .flags = IORESOURCE_IRQ,
913 .start = IRQ_MAC_SCSI,
914 .end = IRQ_MAC_SCSI,
915 }, {
916 .flags = IORESOURCE_MEM,
917 .start = 0x50008000,
918 .end = 0x50009FFF,
919 },
920};
921
922static const struct resource mac_scsi_duo_rsrc[] __initconst = {
923 {
924 .flags = IORESOURCE_MEM,
925 .start = 0xFEE02000,
926 .end = 0xFEE03FFF,
927 },
928};
929
930static const struct resource mac_scsi_old_rsrc[] __initconst = {
931 {
932 .flags = IORESOURCE_IRQ,
933 .start = IRQ_MAC_SCSI,
934 .end = IRQ_MAC_SCSI,
935 }, {
936 .flags = IORESOURCE_MEM,
937 .start = 0x50010000,
938 .end = 0x50011FFF,
939 }, {
940 .flags = IORESOURCE_MEM,
941 .start = 0x50006000,
942 .end = 0x50007FFF,
943 },
944};
945
946static const struct resource mac_scsi_late_rsrc[] __initconst = {
947 {
948 .flags = IORESOURCE_IRQ,
949 .start = IRQ_MAC_SCSI,
950 .end = IRQ_MAC_SCSI,
951 }, {
952 .flags = IORESOURCE_MEM,
953 .start = 0x50010000,
954 .end = 0x50011FFF,
955 },
956};
957
958static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
959 {
960 .flags = IORESOURCE_IRQ,
961 .start = IRQ_MAC_SCSI,
962 .end = IRQ_MAC_SCSI,
963 }, {
964 .flags = IORESOURCE_MEM,
965 .start = 0x50F10000,
966 .end = 0x50F11FFF,
967 }, {
968 .flags = IORESOURCE_MEM,
969 .start = 0x50F06000,
970 .end = 0x50F07FFF,
971 },
972};
973
974int __init mac_platform_init(void)
975{
976 u8 *swim_base;
977
978 if (!MACH_IS_MAC)
979 return -ENODEV;
980
981
982
983
984
985 platform_device_register(&scc_a_pdev);
986 platform_device_register(&scc_b_pdev);
987
988
989
990
991
992 switch (macintosh_config->floppy_type) {
993 case MAC_FLOPPY_SWIM_ADDR1:
994 swim_base = (u8 *)(VIA1_BASE + 0x1E000);
995 break;
996 case MAC_FLOPPY_SWIM_ADDR2:
997 swim_base = (u8 *)(VIA1_BASE + 0x16000);
998 break;
999 default:
1000 swim_base = NULL;
1001 break;
1002 }
1003
1004 if (swim_base) {
1005 struct resource swim_rsrc = {
1006 .flags = IORESOURCE_MEM,
1007 .start = (resource_size_t)swim_base,
1008 .end = (resource_size_t)swim_base + 0x1FFF,
1009 };
1010
1011 platform_device_register_simple("swim", -1, &swim_rsrc, 1);
1012 }
1013
1014
1015
1016
1017
1018 switch (macintosh_config->scsi_type) {
1019 case MAC_SCSI_QUADRA:
1020 case MAC_SCSI_QUADRA3:
1021 platform_device_register_simple("mac_esp", 0, NULL, 0);
1022 break;
1023 case MAC_SCSI_QUADRA2:
1024 platform_device_register_simple("mac_esp", 0, NULL, 0);
1025 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
1026 (macintosh_config->ident == MAC_MODEL_Q950))
1027 platform_device_register_simple("mac_esp", 1, NULL, 0);
1028 break;
1029 case MAC_SCSI_IIFX:
1030
1031
1032
1033
1034
1035
1036
1037 platform_device_register_simple("mac_scsi", 0,
1038 mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
1039 break;
1040 case MAC_SCSI_DUO:
1041
1042
1043
1044
1045
1046
1047
1048 platform_device_register_simple("mac_scsi", 1,
1049 mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
1050
1051 case MAC_SCSI_OLD:
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064 platform_device_register_simple("mac_scsi", 0,
1065 mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
1066 break;
1067 case MAC_SCSI_LATE:
1068
1069 platform_device_register_simple("mac_scsi", 0,
1070 mac_scsi_late_rsrc, ARRAY_SIZE(mac_scsi_late_rsrc));
1071 break;
1072 case MAC_SCSI_LC:
1073
1074
1075
1076
1077
1078
1079
1080 platform_device_register_simple("mac_scsi", 0,
1081 mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
1082 break;
1083 }
1084
1085
1086
1087
1088
1089 if (macintosh_config->ether_type == MAC_ETHER_SONIC ||
1090 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1091 platform_device_register_simple("macsonic", -1, NULL, 0);
1092
1093 if (macintosh_config->expansion_type == MAC_EXP_PDS ||
1094 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1095 platform_device_register_simple("mac89x0", -1, NULL, 0);
1096
1097 if (macintosh_config->ether_type == MAC_ETHER_MACE)
1098 platform_device_register_simple("macmace", -1, NULL, 0);
1099
1100 return 0;
1101}
1102
1103arch_initcall(mac_platform_init);
1104