This source file includes following definitions.
- mac_sched_init
- mac_parse_bootinfo
- mac_cache_card_flush
- config_mac
- mac_identify
- mac_report_hardware
- mac_get_model
- mac_platform_init
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
52 struct mac_booter_data mac_bi_data;
53
54
55 static unsigned long mac_orig_videoaddr;
56
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);
66
67 extern void mac_mksound(unsigned int, unsigned int);
68
69 static void mac_get_model(char *str);
70 static void mac_identify(void);
71 static void mac_report_hardware(void);
72
73 static void __init mac_sched_init(irq_handler_t vector)
74 {
75 via_init_clock(vector);
76 }
77
78
79
80
81
82 int __init mac_parse_bootinfo(const struct bi_record *record)
83 {
84 int unknown = 0;
85 const void *data = record->data;
86
87 switch (be16_to_cpu(record->tag)) {
88 case BI_MAC_MODEL:
89 mac_bi_data.id = be32_to_cpup(data);
90 break;
91 case BI_MAC_VADDR:
92 mac_bi_data.videoaddr = be32_to_cpup(data);
93 break;
94 case BI_MAC_VDEPTH:
95 mac_bi_data.videodepth = be32_to_cpup(data);
96 break;
97 case BI_MAC_VROW:
98 mac_bi_data.videorow = be32_to_cpup(data);
99 break;
100 case BI_MAC_VDIM:
101 mac_bi_data.dimensions = be32_to_cpup(data);
102 break;
103 case BI_MAC_VLOGICAL:
104 mac_orig_videoaddr = be32_to_cpup(data);
105 mac_bi_data.videological =
106 VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
107 break;
108 case BI_MAC_SCCBASE:
109 mac_bi_data.sccbase = be32_to_cpup(data);
110 break;
111 case BI_MAC_BTIME:
112 mac_bi_data.boottime = be32_to_cpup(data);
113 break;
114 case BI_MAC_GMTBIAS:
115 mac_bi_data.gmtbias = be32_to_cpup(data);
116 break;
117 case BI_MAC_MEMSIZE:
118 mac_bi_data.memsize = be32_to_cpup(data);
119 break;
120 case BI_MAC_CPUID:
121 mac_bi_data.cpuid = be32_to_cpup(data);
122 break;
123 case BI_MAC_ROMBASE:
124 mac_bi_data.rombase = be32_to_cpup(data);
125 break;
126 default:
127 unknown = 1;
128 break;
129 }
130 return unknown;
131 }
132
133
134
135
136
137
138
139 static void mac_cache_card_flush(int writeback)
140 {
141 unsigned long flags;
142
143 local_irq_save(flags);
144 via_flush_cache();
145 local_irq_restore(flags);
146 }
147
148 void __init config_mac(void)
149 {
150 if (!MACH_IS_MAC)
151 pr_err("ERROR: no Mac, but config_mac() called!!\n");
152
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;
163 #endif
164
165
166
167
168
169 mac_identify();
170 mac_report_hardware();
171
172
173
174
175
176
177
178 if (macintosh_config->ident == MAC_MODEL_IICI
179 || macintosh_config->ident == MAC_MODEL_IIFX)
180 mach_l2_flush = mac_cache_card_flush;
181 }
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196 struct mac_model *macintosh_config;
197 EXPORT_SYMBOL(macintosh_config);
198
199 static struct mac_model mac_data_table[] = {
200
201
202
203
204 {
205 .ident = MAC_MODEL_II,
206 .name = "Unknown",
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,
213 },
214
215
216
217
218
219 {
220 .ident = MAC_MODEL_II,
221 .name = "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,
228 }, {
229 .ident = MAC_MODEL_IIX,
230 .name = "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,
237 }, {
238 .ident = MAC_MODEL_IICX,
239 .name = "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,
246 }, {
247 .ident = MAC_MODEL_SE30,
248 .name = "SE/30",
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,
255 },
256
257
258
259
260
261
262
263
264 {
265 .ident = MAC_MODEL_IICI,
266 .name = "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,
273 }, {
274 .ident = MAC_MODEL_IIFX,
275 .name = "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,
282 }, {
283 .ident = MAC_MODEL_IISI,
284 .name = "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,
291 }, {
292 .ident = MAC_MODEL_IIVI,
293 .name = "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,
300 }, {
301 .ident = MAC_MODEL_IIVX,
302 .name = "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,
309 },
310
311
312
313
314
315 {
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,
323 }, {
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,
332 }, {
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,
341 },
342
343
344
345
346
347 {
348 .ident = MAC_MODEL_LC,
349 .name = "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,
356 }, {
357 .ident = MAC_MODEL_LCII,
358 .name = "LC II",
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,
365 }, {
366 .ident = MAC_MODEL_LCIII,
367 .name = "LC III",
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,
374 },
375
376
377
378
379
380
381
382
383
384
385
386 {
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,
395 }, {
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,
404 }, {
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,
414 }, {
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,
424 }, {
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,
434 },
435
436 {
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,
446 }, {
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,
456 }, {
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,
466 }, {
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,
476 }, {
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,
486 },
487
488
489
490
491
492 {
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,
501 }, {
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,
510 }, {
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,
519 }, {
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,
528 }, {
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,
537 },
538
539 {
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,
548 }, {
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,
558 }, {
559 .ident = MAC_MODEL_TV,
560 .name = "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,
566 }, {
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,
575 },
576
577
578
579
580
581
582 {
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,
592 }, {
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,
602 }, {
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,
612 },
613
614
615
616
617
618
619
620 {
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,
628 }, {
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,
636 }, {
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,
645 }, {
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,
653 }, {
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,
661 }, {
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,
669 }, {
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,
677 }, {
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,
685 }, {
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,
693 }, {
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,
702 }, {
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,
711 },
712
713
714
715
716
717
718
719 {
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,
728 }, {
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,
737 }, {
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,
746 }, {
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,
755 }, {
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,
764 }, {
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,
773 },
774
775
776
777
778
779 {
780 .ident = -1
781 }
782 };
783
784 static struct resource scc_a_rsrcs[] = {
785 { .flags = IORESOURCE_MEM },
786 { .flags = IORESOURCE_IRQ },
787 };
788
789 static struct resource scc_b_rsrcs[] = {
790 { .flags = IORESOURCE_MEM },
791 { .flags = IORESOURCE_IRQ },
792 };
793
794 struct platform_device scc_a_pdev = {
795 .name = "scc",
796 .id = 0,
797 .num_resources = ARRAY_SIZE(scc_a_rsrcs),
798 .resource = scc_a_rsrcs,
799 };
800 EXPORT_SYMBOL(scc_a_pdev);
801
802 struct platform_device scc_b_pdev = {
803 .name = "scc",
804 .id = 1,
805 .num_resources = ARRAY_SIZE(scc_b_rsrcs),
806 .resource = scc_b_rsrcs,
807 };
808 EXPORT_SYMBOL(scc_b_pdev);
809
810 static void __init mac_identify(void)
811 {
812 struct mac_model *m;
813
814
815 int model = mac_bi_data.id;
816 if (!model) {
817
818
819 model = (mac_bi_data.cpuid >> 2) & 63;
820 pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
821 }
822
823 macintosh_config = mac_data_table;
824 for (m = macintosh_config; m->ident != -1; m++) {
825 if (m->ident == model) {
826 macintosh_config = m;
827 break;
828 }
829 }
830
831
832
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;
837
838 switch (macintosh_config->scc_type) {
839 case MAC_SCC_PSC:
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;
842 break;
843 default:
844
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;
848 } else {
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;
851 }
852 break;
853 }
854
855
856
857
858
859
860 iop_preinit();
861
862 pr_info("Detected Macintosh model: %d\n", model);
863
864
865
866
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);
879
880 iop_init();
881 oss_init();
882 via_init();
883 psc_init();
884 baboon_init();
885
886 #ifdef CONFIG_ADB_CUDA
887 find_via_cuda();
888 #endif
889 #ifdef CONFIG_ADB_PMU
890 find_via_pmu();
891 #endif
892 }
893
894 static void __init mac_report_hardware(void)
895 {
896 pr_info("Apple Macintosh %s\n", macintosh_config->name);
897 }
898
899 static void mac_get_model(char *str)
900 {
901 strcpy(str, "Macintosh ");
902 strcat(str, macintosh_config->name);
903 }
904
905 static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
906 {
907 .flags = IORESOURCE_IRQ,
908 .start = IRQ_MAC_SCSI,
909 .end = IRQ_MAC_SCSI,
910 }, {
911 .flags = IORESOURCE_MEM,
912 .start = 0x50008000,
913 .end = 0x50009FFF,
914 }, {
915 .flags = IORESOURCE_MEM,
916 .start = 0x50008000,
917 .end = 0x50009FFF,
918 },
919 };
920
921 static const struct resource mac_scsi_duo_rsrc[] __initconst = {
922 {
923 .flags = IORESOURCE_MEM,
924 .start = 0xFEE02000,
925 .end = 0xFEE03FFF,
926 },
927 };
928
929 static const struct resource mac_scsi_old_rsrc[] __initconst = {
930 {
931 .flags = IORESOURCE_IRQ,
932 .start = IRQ_MAC_SCSI,
933 .end = IRQ_MAC_SCSI,
934 }, {
935 .flags = IORESOURCE_MEM,
936 .start = 0x50010000,
937 .end = 0x50011FFF,
938 }, {
939 .flags = IORESOURCE_MEM,
940 .start = 0x50006000,
941 .end = 0x50007FFF,
942 },
943 };
944
945 static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
946 {
947 .flags = IORESOURCE_IRQ,
948 .start = IRQ_MAC_SCSI,
949 .end = IRQ_MAC_SCSI,
950 }, {
951 .flags = IORESOURCE_MEM,
952 .start = 0x50F10000,
953 .end = 0x50F11FFF,
954 }, {
955 .flags = IORESOURCE_MEM,
956 .start = 0x50F06000,
957 .end = 0x50F07FFF,
958 },
959 };
960
961 int __init mac_platform_init(void)
962 {
963 phys_addr_t swim_base = 0;
964
965 if (!MACH_IS_MAC)
966 return -ENODEV;
967
968
969
970
971
972 platform_device_register(&scc_a_pdev);
973 platform_device_register(&scc_b_pdev);
974
975
976
977
978
979 switch (macintosh_config->floppy_type) {
980 case MAC_FLOPPY_QUADRA:
981 swim_base = 0x5001E000;
982 break;
983 case MAC_FLOPPY_OLD:
984 swim_base = 0x50016000;
985 break;
986 case MAC_FLOPPY_LC:
987 swim_base = 0x50F16000;
988 break;
989 }
990
991 if (swim_base) {
992 struct resource swim_rsrc = {
993 .flags = IORESOURCE_MEM,
994 .start = swim_base,
995 .end = swim_base + 0x1FFF,
996 };
997
998 platform_device_register_simple("swim", -1, &swim_rsrc, 1);
999 }
1000
1001
1002
1003
1004
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);
1009 break;
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);
1015 break;
1016 case MAC_SCSI_IIFX:
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026 platform_device_register_simple("mac_scsi", 0,
1027 mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
1028 break;
1029 case MAC_SCSI_DUO:
1030
1031
1032
1033
1034
1035
1036
1037 platform_device_register_simple("mac_scsi", 1,
1038 mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
1039
1040 case MAC_SCSI_OLD:
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053 platform_device_register_simple("mac_scsi", 0,
1054 mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
1055 break;
1056 case MAC_SCSI_LC:
1057
1058
1059
1060
1061
1062
1063
1064 platform_device_register_simple("mac_scsi", 0,
1065 mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
1066 break;
1067 }
1068
1069
1070
1071
1072
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);
1076
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);
1080
1081 if (macintosh_config->ether_type == MAC_ETHER_MACE)
1082 platform_device_register_simple("macmace", -1, NULL, 0);
1083
1084 return 0;
1085 }
1086
1087 arch_initcall(mac_platform_init);