Loading...
1/*
2 * linux/arch/m68k/mac/config.c
3 *
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 */
8
9/*
10 * Miscellaneous linux stuff
11 */
12
13#include <linux/errno.h>
14#include <linux/module.h>
15#include <linux/reboot.h>
16#include <linux/types.h>
17#include <linux/mm.h>
18#include <linux/tty.h>
19#include <linux/console.h>
20#include <linux/interrupt.h>
21/* keyb */
22#include <linux/random.h>
23#include <linux/delay.h>
24/* keyb */
25#include <linux/init.h>
26#include <linux/vt_kern.h>
27#include <linux/platform_device.h>
28#include <linux/ata_platform.h>
29#include <linux/adb.h>
30#include <linux/cuda.h>
31#include <linux/pmu.h>
32#include <linux/rtc.h>
33
34#include <asm/setup.h>
35#include <asm/bootinfo.h>
36#include <asm/bootinfo-mac.h>
37#include <asm/byteorder.h>
38
39#include <asm/io.h>
40#include <asm/irq.h>
41#include <asm/machdep.h>
42
43#include <asm/macintosh.h>
44#include <asm/macints.h>
45#include <asm/machw.h>
46
47#include <asm/mac_iop.h>
48#include <asm/mac_via.h>
49#include <asm/mac_oss.h>
50#include <asm/mac_psc.h>
51#include <asm/config.h>
52
53/* Mac bootinfo struct */
54struct mac_booter_data mac_bi_data;
55
56/* The phys. video addr. - might be bogus on some machines */
57static unsigned long mac_orig_videoaddr;
58
59extern int mac_hwclk(int, struct rtc_time *);
60extern void iop_init(void);
61extern void via_init(void);
62extern void via_init_clock(void);
63extern void oss_init(void);
64extern void psc_init(void);
65extern void baboon_init(void);
66
67extern void mac_mksound(unsigned int, unsigned int);
68
69static void mac_get_model(char *str);
70static void mac_identify(void);
71static void mac_report_hardware(void);
72
73static void __init mac_sched_init(void)
74{
75 via_init_clock();
76}
77
78/*
79 * Parse a Macintosh-specific record in the bootinfo
80 */
81
82int __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
133void __init config_mac(void)
134{
135 if (!MACH_IS_MAC)
136 pr_err("ERROR: no Mac, but config_mac() called!!\n");
137
138 mach_sched_init = mac_sched_init;
139 mach_init_IRQ = mac_init_IRQ;
140 mach_get_model = mac_get_model;
141 mach_hwclk = mac_hwclk;
142 mach_reset = mac_reset;
143 mach_halt = mac_poweroff;
144#if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
145 mach_beep = mac_mksound;
146#endif
147
148 /*
149 * Determine hardware present
150 */
151
152 mac_identify();
153 mac_report_hardware();
154
155 /*
156 * AFAIK only the IIci takes a cache card. The IIfx has onboard
157 * cache ... someone needs to figure out how to tell if it's on or
158 * not.
159 */
160
161 if (macintosh_config->ident == MAC_MODEL_IICI)
162 mach_l2_flush = via_l2_flush;
163
164 register_platform_power_off(mac_poweroff);
165}
166
167
168/*
169 * Macintosh Table: hardcoded model configuration data.
170 *
171 * Much of this was defined by Alan, based on who knows what docs.
172 * I've added a lot more, and some of that was pure guesswork based
173 * on hardware pages present on the Mac web site. Possibly wildly
174 * inaccurate, so look here if a new Mac model won't run. Example: if
175 * a Mac crashes immediately after the VIA1 registers have been dumped
176 * to the screen, it probably died attempting to read DirB on a RBV.
177 * Meaning it should have MAC_VIA_IICI here :-)
178 */
179
180struct mac_model *macintosh_config;
181EXPORT_SYMBOL(macintosh_config);
182
183static struct mac_model mac_data_table[] = {
184 /*
185 * We'll pretend to be a Macintosh II, that's pretty safe.
186 */
187
188 {
189 .ident = MAC_MODEL_II,
190 .name = "Unknown",
191 .adb_type = MAC_ADB_II,
192 .via_type = MAC_VIA_II,
193 .scsi_type = MAC_SCSI_OLD,
194 .scc_type = MAC_SCC_II,
195 .expansion_type = MAC_EXP_NUBUS,
196 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
197 },
198
199 /*
200 * Original Mac II hardware
201 */
202
203 {
204 .ident = MAC_MODEL_II,
205 .name = "II",
206 .adb_type = MAC_ADB_II,
207 .via_type = MAC_VIA_II,
208 .scsi_type = MAC_SCSI_OLD,
209 .scc_type = MAC_SCC_II,
210 .expansion_type = MAC_EXP_NUBUS,
211 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
212 }, {
213 .ident = MAC_MODEL_IIX,
214 .name = "IIx",
215 .adb_type = MAC_ADB_II,
216 .via_type = MAC_VIA_II,
217 .scsi_type = MAC_SCSI_OLD,
218 .scc_type = MAC_SCC_II,
219 .expansion_type = MAC_EXP_NUBUS,
220 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
221 }, {
222 .ident = MAC_MODEL_IICX,
223 .name = "IIcx",
224 .adb_type = MAC_ADB_II,
225 .via_type = MAC_VIA_II,
226 .scsi_type = MAC_SCSI_OLD,
227 .scc_type = MAC_SCC_II,
228 .expansion_type = MAC_EXP_NUBUS,
229 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
230 }, {
231 .ident = MAC_MODEL_SE30,
232 .name = "SE/30",
233 .adb_type = MAC_ADB_II,
234 .via_type = MAC_VIA_II,
235 .scsi_type = MAC_SCSI_OLD,
236 .scc_type = MAC_SCC_II,
237 .expansion_type = MAC_EXP_PDS,
238 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
239 },
240
241 /*
242 * Weirdified Mac II hardware - all subtly different. Gee thanks
243 * Apple. All these boxes seem to have VIA2 in a different place to
244 * the Mac II (+1A000 rather than +4000)
245 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
246 */
247
248 {
249 .ident = MAC_MODEL_IICI,
250 .name = "IIci",
251 .adb_type = MAC_ADB_II,
252 .via_type = MAC_VIA_IICI,
253 .scsi_type = MAC_SCSI_OLD,
254 .scc_type = MAC_SCC_II,
255 .expansion_type = MAC_EXP_NUBUS,
256 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
257 }, {
258 .ident = MAC_MODEL_IIFX,
259 .name = "IIfx",
260 .adb_type = MAC_ADB_IOP,
261 .via_type = MAC_VIA_IICI,
262 .scsi_type = MAC_SCSI_IIFX,
263 .scc_type = MAC_SCC_IOP,
264 .expansion_type = MAC_EXP_PDS_NUBUS,
265 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
266 }, {
267 .ident = MAC_MODEL_IISI,
268 .name = "IIsi",
269 .adb_type = MAC_ADB_EGRET,
270 .via_type = MAC_VIA_IICI,
271 .scsi_type = MAC_SCSI_OLD,
272 .scc_type = MAC_SCC_II,
273 .expansion_type = MAC_EXP_PDS_NUBUS,
274 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
275 }, {
276 .ident = MAC_MODEL_IIVI,
277 .name = "IIvi",
278 .adb_type = MAC_ADB_EGRET,
279 .via_type = MAC_VIA_IICI,
280 .scsi_type = MAC_SCSI_LC,
281 .scc_type = MAC_SCC_II,
282 .expansion_type = MAC_EXP_NUBUS,
283 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
284 }, {
285 .ident = MAC_MODEL_IIVX,
286 .name = "IIvx",
287 .adb_type = MAC_ADB_EGRET,
288 .via_type = MAC_VIA_IICI,
289 .scsi_type = MAC_SCSI_LC,
290 .scc_type = MAC_SCC_II,
291 .expansion_type = MAC_EXP_NUBUS,
292 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
293 },
294
295 /*
296 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
297 */
298
299 {
300 .ident = MAC_MODEL_CLII,
301 .name = "Classic II",
302 .adb_type = MAC_ADB_EGRET,
303 .via_type = MAC_VIA_IICI,
304 .scsi_type = MAC_SCSI_LC,
305 .scc_type = MAC_SCC_II,
306 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
307 }, {
308 .ident = MAC_MODEL_CCL,
309 .name = "Color Classic",
310 .adb_type = MAC_ADB_CUDA,
311 .via_type = MAC_VIA_IICI,
312 .scsi_type = MAC_SCSI_LC,
313 .scc_type = MAC_SCC_II,
314 .expansion_type = MAC_EXP_PDS,
315 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
316 }, {
317 .ident = MAC_MODEL_CCLII,
318 .name = "Color Classic II",
319 .adb_type = MAC_ADB_CUDA,
320 .via_type = MAC_VIA_IICI,
321 .scsi_type = MAC_SCSI_LC,
322 .scc_type = MAC_SCC_II,
323 .expansion_type = MAC_EXP_PDS,
324 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
325 },
326
327 /*
328 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
329 */
330
331 {
332 .ident = MAC_MODEL_LC,
333 .name = "LC",
334 .adb_type = MAC_ADB_EGRET,
335 .via_type = MAC_VIA_IICI,
336 .scsi_type = MAC_SCSI_LC,
337 .scc_type = MAC_SCC_II,
338 .expansion_type = MAC_EXP_PDS,
339 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
340 }, {
341 .ident = MAC_MODEL_LCII,
342 .name = "LC II",
343 .adb_type = MAC_ADB_EGRET,
344 .via_type = MAC_VIA_IICI,
345 .scsi_type = MAC_SCSI_LC,
346 .scc_type = MAC_SCC_II,
347 .expansion_type = MAC_EXP_PDS,
348 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
349 }, {
350 .ident = MAC_MODEL_LCIII,
351 .name = "LC III",
352 .adb_type = MAC_ADB_EGRET,
353 .via_type = MAC_VIA_IICI,
354 .scsi_type = MAC_SCSI_LC,
355 .scc_type = MAC_SCC_II,
356 .expansion_type = MAC_EXP_PDS,
357 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
358 },
359
360 /*
361 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
362 * differently as some of the stuff connected to VIA2 seems different.
363 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
364 * the 660AV and 840AV which use an AMD 79C940 (MACE).
365 * The 700, 900 and 950 have some I/O chips in the wrong place to
366 * confuse us. The 840AV has a SCSI location of its own (same as
367 * the 660AV).
368 */
369
370 {
371 .ident = MAC_MODEL_Q605,
372 .name = "Quadra 605",
373 .adb_type = MAC_ADB_CUDA,
374 .via_type = MAC_VIA_QUADRA,
375 .scsi_type = MAC_SCSI_QUADRA,
376 .scc_type = MAC_SCC_QUADRA,
377 .expansion_type = MAC_EXP_PDS,
378 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
379 }, {
380 .ident = MAC_MODEL_Q605_ACC,
381 .name = "Quadra 605",
382 .adb_type = MAC_ADB_CUDA,
383 .via_type = MAC_VIA_QUADRA,
384 .scsi_type = MAC_SCSI_QUADRA,
385 .scc_type = MAC_SCC_QUADRA,
386 .expansion_type = MAC_EXP_PDS,
387 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
388 }, {
389 .ident = MAC_MODEL_Q610,
390 .name = "Quadra 610",
391 .adb_type = MAC_ADB_II,
392 .via_type = MAC_VIA_QUADRA,
393 .scsi_type = MAC_SCSI_QUADRA,
394 .scc_type = MAC_SCC_QUADRA,
395 .ether_type = MAC_ETHER_SONIC,
396 .expansion_type = MAC_EXP_PDS_NUBUS,
397 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
398 }, {
399 .ident = MAC_MODEL_Q630,
400 .name = "Quadra 630",
401 .adb_type = MAC_ADB_CUDA,
402 .via_type = MAC_VIA_QUADRA,
403 .scsi_type = MAC_SCSI_QUADRA,
404 .ide_type = MAC_IDE_QUADRA,
405 .scc_type = MAC_SCC_QUADRA,
406 .expansion_type = MAC_EXP_PDS_COMM,
407 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
408 }, {
409 .ident = MAC_MODEL_Q650,
410 .name = "Quadra 650",
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 .expansion_type = MAC_EXP_PDS_NUBUS,
417 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
418 },
419 /* The Q700 does have a NS Sonic */
420 {
421 .ident = MAC_MODEL_Q700,
422 .name = "Quadra 700",
423 .adb_type = MAC_ADB_II,
424 .via_type = MAC_VIA_QUADRA,
425 .scsi_type = MAC_SCSI_QUADRA2,
426 .scc_type = MAC_SCC_QUADRA,
427 .ether_type = MAC_ETHER_SONIC,
428 .expansion_type = MAC_EXP_PDS_NUBUS,
429 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM */
430 }, {
431 .ident = MAC_MODEL_Q800,
432 .name = "Quadra 800",
433 .adb_type = MAC_ADB_II,
434 .via_type = MAC_VIA_QUADRA,
435 .scsi_type = MAC_SCSI_QUADRA,
436 .scc_type = MAC_SCC_QUADRA,
437 .ether_type = MAC_ETHER_SONIC,
438 .expansion_type = MAC_EXP_PDS_NUBUS,
439 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
440 }, {
441 .ident = MAC_MODEL_Q840,
442 .name = "Quadra 840AV",
443 .adb_type = MAC_ADB_CUDA,
444 .via_type = MAC_VIA_QUADRA,
445 .scsi_type = MAC_SCSI_QUADRA3,
446 .scc_type = MAC_SCC_PSC,
447 .ether_type = MAC_ETHER_MACE,
448 .expansion_type = MAC_EXP_NUBUS,
449 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
450 }, {
451 .ident = MAC_MODEL_Q900,
452 .name = "Quadra 900",
453 .adb_type = MAC_ADB_IOP,
454 .via_type = MAC_VIA_QUADRA,
455 .scsi_type = MAC_SCSI_QUADRA2,
456 .scc_type = MAC_SCC_IOP,
457 .ether_type = MAC_ETHER_SONIC,
458 .expansion_type = MAC_EXP_PDS_NUBUS,
459 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
460 }, {
461 .ident = MAC_MODEL_Q950,
462 .name = "Quadra 950",
463 .adb_type = MAC_ADB_IOP,
464 .via_type = MAC_VIA_QUADRA,
465 .scsi_type = MAC_SCSI_QUADRA2,
466 .scc_type = MAC_SCC_IOP,
467 .ether_type = MAC_ETHER_SONIC,
468 .expansion_type = MAC_EXP_PDS_NUBUS,
469 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
470 },
471
472 /*
473 * Performa - more LC type machines
474 */
475
476 {
477 .ident = MAC_MODEL_P460,
478 .name = "Performa 460",
479 .adb_type = MAC_ADB_EGRET,
480 .via_type = MAC_VIA_IICI,
481 .scsi_type = MAC_SCSI_LC,
482 .scc_type = MAC_SCC_II,
483 .expansion_type = MAC_EXP_PDS,
484 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
485 }, {
486 .ident = MAC_MODEL_P475,
487 .name = "Performa 475",
488 .adb_type = MAC_ADB_CUDA,
489 .via_type = MAC_VIA_QUADRA,
490 .scsi_type = MAC_SCSI_QUADRA,
491 .scc_type = MAC_SCC_II,
492 .expansion_type = MAC_EXP_PDS,
493 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
494 }, {
495 .ident = MAC_MODEL_P475F,
496 .name = "Performa 475",
497 .adb_type = MAC_ADB_CUDA,
498 .via_type = MAC_VIA_QUADRA,
499 .scsi_type = MAC_SCSI_QUADRA,
500 .scc_type = MAC_SCC_II,
501 .expansion_type = MAC_EXP_PDS,
502 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
503 }, {
504 .ident = MAC_MODEL_P520,
505 .name = "Performa 520",
506 .adb_type = MAC_ADB_CUDA,
507 .via_type = MAC_VIA_IICI,
508 .scsi_type = MAC_SCSI_LC,
509 .scc_type = MAC_SCC_II,
510 .expansion_type = MAC_EXP_PDS,
511 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
512 }, {
513 .ident = MAC_MODEL_P550,
514 .name = "Performa 550",
515 .adb_type = MAC_ADB_CUDA,
516 .via_type = MAC_VIA_IICI,
517 .scsi_type = MAC_SCSI_LC,
518 .scc_type = MAC_SCC_II,
519 .expansion_type = MAC_EXP_PDS,
520 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
521 },
522 /* These have the comm slot, and therefore possibly SONIC ethernet */
523 {
524 .ident = MAC_MODEL_P575,
525 .name = "Performa 575",
526 .adb_type = MAC_ADB_CUDA,
527 .via_type = MAC_VIA_QUADRA,
528 .scsi_type = MAC_SCSI_QUADRA,
529 .scc_type = MAC_SCC_II,
530 .expansion_type = MAC_EXP_PDS_COMM,
531 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
532 }, {
533 .ident = MAC_MODEL_P588,
534 .name = "Performa 588",
535 .adb_type = MAC_ADB_CUDA,
536 .via_type = MAC_VIA_QUADRA,
537 .scsi_type = MAC_SCSI_QUADRA,
538 .ide_type = MAC_IDE_QUADRA,
539 .scc_type = MAC_SCC_II,
540 .expansion_type = MAC_EXP_PDS_COMM,
541 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
542 }, {
543 .ident = MAC_MODEL_TV,
544 .name = "TV",
545 .adb_type = MAC_ADB_CUDA,
546 .via_type = MAC_VIA_IICI,
547 .scsi_type = MAC_SCSI_LC,
548 .scc_type = MAC_SCC_II,
549 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
550 }, {
551 .ident = MAC_MODEL_P600,
552 .name = "Performa 600",
553 .adb_type = MAC_ADB_EGRET,
554 .via_type = MAC_VIA_IICI,
555 .scsi_type = MAC_SCSI_LC,
556 .scc_type = MAC_SCC_II,
557 .expansion_type = MAC_EXP_NUBUS,
558 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
559 },
560
561 /*
562 * Centris - just guessing again; maybe like Quadra.
563 * The C610 may or may not have SONIC. We probe to make sure.
564 */
565
566 {
567 .ident = MAC_MODEL_C610,
568 .name = "Centris 610",
569 .adb_type = MAC_ADB_II,
570 .via_type = MAC_VIA_QUADRA,
571 .scsi_type = MAC_SCSI_QUADRA,
572 .scc_type = MAC_SCC_QUADRA,
573 .ether_type = MAC_ETHER_SONIC,
574 .expansion_type = MAC_EXP_PDS_NUBUS,
575 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
576 }, {
577 .ident = MAC_MODEL_C650,
578 .name = "Centris 650",
579 .adb_type = MAC_ADB_II,
580 .via_type = MAC_VIA_QUADRA,
581 .scsi_type = MAC_SCSI_QUADRA,
582 .scc_type = MAC_SCC_QUADRA,
583 .ether_type = MAC_ETHER_SONIC,
584 .expansion_type = MAC_EXP_PDS_NUBUS,
585 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
586 }, {
587 .ident = MAC_MODEL_C660,
588 .name = "Centris 660AV",
589 .adb_type = MAC_ADB_CUDA,
590 .via_type = MAC_VIA_QUADRA,
591 .scsi_type = MAC_SCSI_QUADRA3,
592 .scc_type = MAC_SCC_PSC,
593 .ether_type = MAC_ETHER_MACE,
594 .expansion_type = MAC_EXP_PDS_NUBUS,
595 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
596 },
597
598 /*
599 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
600 * and a PMU (in two variations?) for ADB. Most of them use the
601 * Quadra-style VIAs. A few models also have IDE from hell.
602 */
603
604 {
605 .ident = MAC_MODEL_PB140,
606 .name = "PowerBook 140",
607 .adb_type = MAC_ADB_PB1,
608 .via_type = MAC_VIA_QUADRA,
609 .scsi_type = MAC_SCSI_OLD,
610 .scc_type = MAC_SCC_QUADRA,
611 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
612 }, {
613 .ident = MAC_MODEL_PB145,
614 .name = "PowerBook 145",
615 .adb_type = MAC_ADB_PB1,
616 .via_type = MAC_VIA_QUADRA,
617 .scsi_type = MAC_SCSI_OLD,
618 .scc_type = MAC_SCC_QUADRA,
619 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
620 }, {
621 .ident = MAC_MODEL_PB150,
622 .name = "PowerBook 150",
623 .adb_type = MAC_ADB_PB2,
624 .via_type = MAC_VIA_IICI,
625 .scsi_type = MAC_SCSI_OLD,
626 .ide_type = MAC_IDE_PB,
627 .scc_type = MAC_SCC_QUADRA,
628 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
629 }, {
630 .ident = MAC_MODEL_PB160,
631 .name = "PowerBook 160",
632 .adb_type = MAC_ADB_PB1,
633 .via_type = MAC_VIA_QUADRA,
634 .scsi_type = MAC_SCSI_OLD,
635 .scc_type = MAC_SCC_QUADRA,
636 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
637 }, {
638 .ident = MAC_MODEL_PB165,
639 .name = "PowerBook 165",
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 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
645 }, {
646 .ident = MAC_MODEL_PB165C,
647 .name = "PowerBook 165c",
648 .adb_type = MAC_ADB_PB1,
649 .via_type = MAC_VIA_QUADRA,
650 .scsi_type = MAC_SCSI_OLD,
651 .scc_type = MAC_SCC_QUADRA,
652 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
653 }, {
654 .ident = MAC_MODEL_PB170,
655 .name = "PowerBook 170",
656 .adb_type = MAC_ADB_PB1,
657 .via_type = MAC_VIA_QUADRA,
658 .scsi_type = MAC_SCSI_OLD,
659 .scc_type = MAC_SCC_QUADRA,
660 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
661 }, {
662 .ident = MAC_MODEL_PB180,
663 .name = "PowerBook 180",
664 .adb_type = MAC_ADB_PB1,
665 .via_type = MAC_VIA_QUADRA,
666 .scsi_type = MAC_SCSI_OLD,
667 .scc_type = MAC_SCC_QUADRA,
668 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
669 }, {
670 .ident = MAC_MODEL_PB180C,
671 .name = "PowerBook 180c",
672 .adb_type = MAC_ADB_PB1,
673 .via_type = MAC_VIA_QUADRA,
674 .scsi_type = MAC_SCSI_OLD,
675 .scc_type = MAC_SCC_QUADRA,
676 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
677 }, {
678 .ident = MAC_MODEL_PB190,
679 .name = "PowerBook 190",
680 .adb_type = MAC_ADB_PB2,
681 .via_type = MAC_VIA_QUADRA,
682 .scsi_type = MAC_SCSI_OLD,
683 .ide_type = MAC_IDE_BABOON,
684 .scc_type = MAC_SCC_QUADRA,
685 .floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */
686 }, {
687 .ident = MAC_MODEL_PB520,
688 .name = "PowerBook 520",
689 .adb_type = MAC_ADB_PB2,
690 .via_type = MAC_VIA_QUADRA,
691 .scsi_type = MAC_SCSI_OLD,
692 .scc_type = MAC_SCC_QUADRA,
693 .ether_type = MAC_ETHER_SONIC,
694 .floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */
695 },
696
697 /*
698 * PowerBook Duos are pretty much like normal PowerBooks
699 * All of these probably have onboard SONIC in the Dock which
700 * means we'll have to probe for it eventually.
701 */
702
703 {
704 .ident = MAC_MODEL_PB210,
705 .name = "PowerBook Duo 210",
706 .adb_type = MAC_ADB_PB2,
707 .via_type = MAC_VIA_IICI,
708 .scsi_type = MAC_SCSI_DUO,
709 .scc_type = MAC_SCC_QUADRA,
710 .expansion_type = MAC_EXP_NUBUS,
711 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
712 }, {
713 .ident = MAC_MODEL_PB230,
714 .name = "PowerBook Duo 230",
715 .adb_type = MAC_ADB_PB2,
716 .via_type = MAC_VIA_IICI,
717 .scsi_type = MAC_SCSI_DUO,
718 .scc_type = MAC_SCC_QUADRA,
719 .expansion_type = MAC_EXP_NUBUS,
720 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
721 }, {
722 .ident = MAC_MODEL_PB250,
723 .name = "PowerBook Duo 250",
724 .adb_type = MAC_ADB_PB2,
725 .via_type = MAC_VIA_IICI,
726 .scsi_type = MAC_SCSI_DUO,
727 .scc_type = MAC_SCC_QUADRA,
728 .expansion_type = MAC_EXP_NUBUS,
729 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
730 }, {
731 .ident = MAC_MODEL_PB270C,
732 .name = "PowerBook Duo 270c",
733 .adb_type = MAC_ADB_PB2,
734 .via_type = MAC_VIA_IICI,
735 .scsi_type = MAC_SCSI_DUO,
736 .scc_type = MAC_SCC_QUADRA,
737 .expansion_type = MAC_EXP_NUBUS,
738 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
739 }, {
740 .ident = MAC_MODEL_PB280,
741 .name = "PowerBook Duo 280",
742 .adb_type = MAC_ADB_PB2,
743 .via_type = MAC_VIA_IICI,
744 .scsi_type = MAC_SCSI_DUO,
745 .scc_type = MAC_SCC_QUADRA,
746 .expansion_type = MAC_EXP_NUBUS,
747 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
748 }, {
749 .ident = MAC_MODEL_PB280C,
750 .name = "PowerBook Duo 280c",
751 .adb_type = MAC_ADB_PB2,
752 .via_type = MAC_VIA_IICI,
753 .scsi_type = MAC_SCSI_DUO,
754 .scc_type = MAC_SCC_QUADRA,
755 .expansion_type = MAC_EXP_NUBUS,
756 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
757 },
758
759 /*
760 * Other stuff?
761 */
762
763 {
764 .ident = -1
765 }
766};
767
768static struct resource scc_a_rsrcs[] = {
769 { .flags = IORESOURCE_MEM },
770 { .flags = IORESOURCE_IRQ },
771};
772
773static struct resource scc_b_rsrcs[] = {
774 { .flags = IORESOURCE_MEM },
775 { .flags = IORESOURCE_IRQ },
776};
777
778struct platform_device scc_a_pdev = {
779 .name = "scc",
780 .id = 0,
781};
782EXPORT_SYMBOL(scc_a_pdev);
783
784struct platform_device scc_b_pdev = {
785 .name = "scc",
786 .id = 1,
787};
788EXPORT_SYMBOL(scc_b_pdev);
789
790static void __init mac_identify(void)
791{
792 struct mac_model *m;
793
794 /* Penguin data useful? */
795 int model = mac_bi_data.id;
796 if (!model) {
797 /* no bootinfo model id -> NetBSD booter was used! */
798 /* XXX FIXME: breaks for model > 31 */
799 model = (mac_bi_data.cpuid >> 2) & 63;
800 pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
801 }
802
803 macintosh_config = mac_data_table;
804 for (m = macintosh_config; m->ident != -1; m++) {
805 if (m->ident == model) {
806 macintosh_config = m;
807 break;
808 }
809 }
810
811 /* Set up serial port resources for the console initcall. */
812
813 scc_a_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase + 2;
814 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
815 scc_a_pdev.num_resources = ARRAY_SIZE(scc_a_rsrcs);
816 scc_a_pdev.resource = scc_a_rsrcs;
817
818 scc_b_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase;
819 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
820 scc_b_pdev.num_resources = ARRAY_SIZE(scc_b_rsrcs);
821 scc_b_pdev.resource = scc_b_rsrcs;
822
823 switch (macintosh_config->scc_type) {
824 case MAC_SCC_PSC:
825 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
826 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
827 break;
828 default:
829 /* On non-PSC machines, the serial ports share an IRQ. */
830 if (macintosh_config->ident == MAC_MODEL_IIFX) {
831 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
832 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
833 } else {
834 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
835 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
836 }
837 break;
838 }
839
840 pr_info("Detected Macintosh model: %d\n", model);
841
842 /*
843 * Report booter data:
844 */
845 printk(KERN_DEBUG " Penguin bootinfo data:\n");
846 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
847 mac_bi_data.videoaddr, mac_bi_data.videorow,
848 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
849 mac_bi_data.dimensions >> 16);
850 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
851 mac_bi_data.videological, mac_orig_videoaddr,
852 mac_bi_data.sccbase);
853 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
854 mac_bi_data.boottime, mac_bi_data.gmtbias);
855 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
856 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
857
858 iop_init();
859 oss_init();
860 via_init();
861 psc_init();
862 baboon_init();
863
864#ifdef CONFIG_ADB_CUDA
865 find_via_cuda();
866#endif
867#ifdef CONFIG_ADB_PMU
868 find_via_pmu();
869#endif
870}
871
872static void __init mac_report_hardware(void)
873{
874 pr_info("Apple Macintosh %s\n", macintosh_config->name);
875}
876
877static void mac_get_model(char *str)
878{
879 strcpy(str, "Macintosh ");
880 strcat(str, macintosh_config->name);
881}
882
883static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
884 {
885 .flags = IORESOURCE_IRQ,
886 .start = IRQ_MAC_SCSI,
887 .end = IRQ_MAC_SCSI,
888 }, {
889 .flags = IORESOURCE_MEM,
890 .start = 0x50008000,
891 .end = 0x50009FFF,
892 }, {
893 .flags = IORESOURCE_MEM,
894 .start = 0x50008000,
895 .end = 0x50009FFF,
896 },
897};
898
899static const struct resource mac_scsi_duo_rsrc[] __initconst = {
900 {
901 .flags = IORESOURCE_MEM,
902 .start = 0xFEE02000,
903 .end = 0xFEE03FFF,
904 },
905};
906
907static const struct resource mac_scsi_old_rsrc[] __initconst = {
908 {
909 .flags = IORESOURCE_IRQ,
910 .start = IRQ_MAC_SCSI,
911 .end = IRQ_MAC_SCSI,
912 }, {
913 .flags = IORESOURCE_MEM,
914 .start = 0x50010000,
915 .end = 0x50011FFF,
916 }, {
917 .flags = IORESOURCE_MEM,
918 .start = 0x50006000,
919 .end = 0x50007FFF,
920 },
921};
922
923static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
924 {
925 .flags = IORESOURCE_IRQ,
926 .start = IRQ_MAC_SCSI,
927 .end = IRQ_MAC_SCSI,
928 }, {
929 .flags = IORESOURCE_MEM,
930 .start = 0x50F10000,
931 .end = 0x50F11FFF,
932 }, {
933 .flags = IORESOURCE_MEM,
934 .start = 0x50F06000,
935 .end = 0x50F07FFF,
936 },
937};
938
939static const struct resource mac_pata_quadra_rsrc[] __initconst = {
940 DEFINE_RES_MEM(0x50F1A000, 0x38),
941 DEFINE_RES_MEM(0x50F1A038, 0x04),
942 DEFINE_RES_IRQ(IRQ_NUBUS_F),
943};
944
945static const struct resource mac_pata_pb_rsrc[] __initconst = {
946 DEFINE_RES_MEM(0x50F1A000, 0x38),
947 DEFINE_RES_MEM(0x50F1A038, 0x04),
948 DEFINE_RES_IRQ(IRQ_NUBUS_C),
949};
950
951static const struct resource mac_pata_baboon_rsrc[] __initconst = {
952 DEFINE_RES_MEM(0x50F1A000, 0x38),
953 DEFINE_RES_MEM(0x50F1A038, 0x04),
954 DEFINE_RES_IRQ(IRQ_BABOON_1),
955};
956
957static const struct pata_platform_info mac_pata_data __initconst = {
958 .ioport_shift = 2,
959};
960
961int __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 * Serial devices
970 */
971
972 platform_device_register(&scc_a_pdev);
973 platform_device_register(&scc_b_pdev);
974
975 /*
976 * Floppy device
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 * SCSI device(s)
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 /* Addresses from The Guide to Mac Family Hardware.
1018 * $5000 8000 - $5000 9FFF: SCSI DMA
1019 * $5000 A000 - $5000 BFFF: Alternate SCSI
1020 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
1021 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
1022 * The A/UX header file sys/uconfig.h says $50F0 8000.
1023 * The "SCSI DMA" custom IC embeds the 53C80 core and
1024 * supports Programmed IO, DMA and PDMA (hardware handshake).
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 /* Addresses from the Duo Dock II Developer Note.
1031 * $FEE0 2000 - $FEE0 3FFF: normal mode
1032 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
1033 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
1034 * The NetBSD code indicates that both 5380 chips share
1035 * an IRQ (?) which would need careful handling (see mac_esp).
1036 */
1037 platform_device_register_simple("mac_scsi", 1,
1038 mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
1039 fallthrough;
1040 case MAC_SCSI_OLD:
1041 /* Addresses from Developer Notes for Duo System,
1042 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
1043 * and also from The Guide to Mac Family Hardware for
1044 * SE/30, II, IIx, IIcx, IIci.
1045 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
1046 * $5001 0000 - $5001 1FFF: normal mode
1047 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
1048 * GMFH says that $5000 0000 - $50FF FFFF "wraps
1049 * $5000 0000 - $5001 FFFF eight times" (!)
1050 * mess.org says IIci and Color Classic do not alias
1051 * I/O address space.
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 /* Addresses from Mac LC data in Designing Cards & Drivers 3ed.
1058 * Also from the Developer Notes for Classic II, LC III,
1059 * Color Classic and IIvx.
1060 * $50F0 6000 - $50F0 7FFF: SCSI handshake
1061 * $50F1 0000 - $50F1 1FFF: SCSI
1062 * $50F1 2000 - $50F1 3FFF: SCSI DMA
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 * IDE device
1071 */
1072
1073 switch (macintosh_config->ide_type) {
1074 case MAC_IDE_QUADRA:
1075 platform_device_register_resndata(NULL, "pata_platform", -1,
1076 mac_pata_quadra_rsrc, ARRAY_SIZE(mac_pata_quadra_rsrc),
1077 &mac_pata_data, sizeof(mac_pata_data));
1078 break;
1079 case MAC_IDE_PB:
1080 platform_device_register_resndata(NULL, "pata_platform", -1,
1081 mac_pata_pb_rsrc, ARRAY_SIZE(mac_pata_pb_rsrc),
1082 &mac_pata_data, sizeof(mac_pata_data));
1083 break;
1084 case MAC_IDE_BABOON:
1085 platform_device_register_resndata(NULL, "pata_platform", -1,
1086 mac_pata_baboon_rsrc, ARRAY_SIZE(mac_pata_baboon_rsrc),
1087 &mac_pata_data, sizeof(mac_pata_data));
1088 break;
1089 }
1090
1091 /*
1092 * Ethernet device
1093 */
1094
1095 if (macintosh_config->ether_type == MAC_ETHER_SONIC ||
1096 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1097 platform_device_register_simple("macsonic", -1, NULL, 0);
1098
1099 if (macintosh_config->expansion_type == MAC_EXP_PDS ||
1100 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1101 platform_device_register_simple("mac89x0", -1, NULL, 0);
1102
1103 if (macintosh_config->ether_type == MAC_ETHER_MACE)
1104 platform_device_register_simple("macmace", -1, NULL, 0);
1105
1106 return 0;
1107}
1108
1109arch_initcall(mac_platform_init);
1/*
2 * linux/arch/m68k/mac/config.c
3 *
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 */
8
9/*
10 * Miscellaneous linux stuff
11 */
12
13#include <linux/errno.h>
14#include <linux/module.h>
15#include <linux/reboot.h>
16#include <linux/types.h>
17#include <linux/mm.h>
18#include <linux/tty.h>
19#include <linux/console.h>
20#include <linux/interrupt.h>
21/* keyb */
22#include <linux/random.h>
23#include <linux/delay.h>
24/* keyb */
25#include <linux/init.h>
26#include <linux/vt_kern.h>
27#include <linux/platform_device.h>
28#include <linux/ata_platform.h>
29#include <linux/adb.h>
30#include <linux/cuda.h>
31#include <linux/pmu.h>
32#include <linux/rtc.h>
33
34#include <asm/setup.h>
35#include <asm/bootinfo.h>
36#include <asm/bootinfo-mac.h>
37#include <asm/byteorder.h>
38
39#include <asm/io.h>
40#include <asm/irq.h>
41#include <asm/machdep.h>
42
43#include <asm/macintosh.h>
44#include <asm/macints.h>
45#include <asm/machw.h>
46
47#include <asm/mac_iop.h>
48#include <asm/mac_via.h>
49#include <asm/mac_oss.h>
50#include <asm/mac_psc.h>
51#include <asm/config.h>
52
53#include "mac.h"
54
55/* Mac bootinfo struct */
56struct mac_booter_data mac_bi_data;
57
58/* The phys. video addr. - might be bogus on some machines */
59static unsigned long mac_orig_videoaddr;
60
61static void mac_get_model(char *str);
62static void mac_identify(void);
63static void mac_report_hardware(void);
64
65static void __init mac_sched_init(void)
66{
67 via_init_clock();
68}
69
70/*
71 * Parse a Macintosh-specific record in the bootinfo
72 */
73
74int __init mac_parse_bootinfo(const struct bi_record *record)
75{
76 int unknown = 0;
77 const void *data = record->data;
78
79 switch (be16_to_cpu(record->tag)) {
80 case BI_MAC_MODEL:
81 mac_bi_data.id = be32_to_cpup(data);
82 break;
83 case BI_MAC_VADDR:
84 mac_bi_data.videoaddr = be32_to_cpup(data);
85 break;
86 case BI_MAC_VDEPTH:
87 mac_bi_data.videodepth = be32_to_cpup(data);
88 break;
89 case BI_MAC_VROW:
90 mac_bi_data.videorow = be32_to_cpup(data);
91 break;
92 case BI_MAC_VDIM:
93 mac_bi_data.dimensions = be32_to_cpup(data);
94 break;
95 case BI_MAC_VLOGICAL:
96 mac_orig_videoaddr = be32_to_cpup(data);
97 mac_bi_data.videological =
98 VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
99 break;
100 case BI_MAC_SCCBASE:
101 mac_bi_data.sccbase = be32_to_cpup(data);
102 break;
103 case BI_MAC_BTIME:
104 mac_bi_data.boottime = be32_to_cpup(data);
105 break;
106 case BI_MAC_GMTBIAS:
107 mac_bi_data.gmtbias = be32_to_cpup(data);
108 break;
109 case BI_MAC_MEMSIZE:
110 mac_bi_data.memsize = be32_to_cpup(data);
111 break;
112 case BI_MAC_CPUID:
113 mac_bi_data.cpuid = be32_to_cpup(data);
114 break;
115 case BI_MAC_ROMBASE:
116 mac_bi_data.rombase = be32_to_cpup(data);
117 break;
118 default:
119 unknown = 1;
120 break;
121 }
122 return unknown;
123}
124
125void __init config_mac(void)
126{
127 if (!MACH_IS_MAC)
128 pr_err("ERROR: no Mac, but config_mac() called!!\n");
129
130 mach_sched_init = mac_sched_init;
131 mach_init_IRQ = mac_init_IRQ;
132 mach_get_model = mac_get_model;
133 mach_hwclk = mac_hwclk;
134 mach_reset = mac_reset;
135 mach_halt = mac_poweroff;
136#if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
137 mach_beep = mac_mksound;
138#endif
139
140 /*
141 * Determine hardware present
142 */
143
144 mac_identify();
145 mac_report_hardware();
146
147 /*
148 * AFAIK only the IIci takes a cache card. The IIfx has onboard
149 * cache ... someone needs to figure out how to tell if it's on or
150 * not.
151 */
152
153 if (macintosh_config->ident == MAC_MODEL_IICI)
154 mach_l2_flush = via_l2_flush;
155
156 register_platform_power_off(mac_poweroff);
157}
158
159
160/*
161 * Macintosh Table: hardcoded model configuration data.
162 *
163 * Much of this was defined by Alan, based on who knows what docs.
164 * I've added a lot more, and some of that was pure guesswork based
165 * on hardware pages present on the Mac web site. Possibly wildly
166 * inaccurate, so look here if a new Mac model won't run. Example: if
167 * a Mac crashes immediately after the VIA1 registers have been dumped
168 * to the screen, it probably died attempting to read DirB on a RBV.
169 * Meaning it should have MAC_VIA_IICI here :-)
170 */
171
172struct mac_model *macintosh_config;
173EXPORT_SYMBOL(macintosh_config);
174
175static struct mac_model mac_data_table[] = {
176 /*
177 * We'll pretend to be a Macintosh II, that's pretty safe.
178 */
179
180 {
181 .ident = MAC_MODEL_II,
182 .name = "Unknown",
183 .adb_type = MAC_ADB_II,
184 .via_type = MAC_VIA_II,
185 .scsi_type = MAC_SCSI_OLD,
186 .scc_type = MAC_SCC_II,
187 .expansion_type = MAC_EXP_NUBUS,
188 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
189 },
190
191 /*
192 * Original Mac II hardware
193 */
194
195 {
196 .ident = MAC_MODEL_II,
197 .name = "II",
198 .adb_type = MAC_ADB_II,
199 .via_type = MAC_VIA_II,
200 .scsi_type = MAC_SCSI_OLD,
201 .scc_type = MAC_SCC_II,
202 .expansion_type = MAC_EXP_NUBUS,
203 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
204 }, {
205 .ident = MAC_MODEL_IIX,
206 .name = "IIx",
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_OLD, /* SWIM */
213 }, {
214 .ident = MAC_MODEL_IICX,
215 .name = "IIcx",
216 .adb_type = MAC_ADB_II,
217 .via_type = MAC_VIA_II,
218 .scsi_type = MAC_SCSI_OLD,
219 .scc_type = MAC_SCC_II,
220 .expansion_type = MAC_EXP_NUBUS,
221 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
222 }, {
223 .ident = MAC_MODEL_SE30,
224 .name = "SE/30",
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 .expansion_type = MAC_EXP_PDS,
230 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
231 },
232
233 /*
234 * Weirdified Mac II hardware - all subtly different. Gee thanks
235 * Apple. All these boxes seem to have VIA2 in a different place to
236 * the Mac II (+1A000 rather than +4000)
237 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
238 */
239
240 {
241 .ident = MAC_MODEL_IICI,
242 .name = "IIci",
243 .adb_type = MAC_ADB_II,
244 .via_type = MAC_VIA_IICI,
245 .scsi_type = MAC_SCSI_OLD,
246 .scc_type = MAC_SCC_II,
247 .expansion_type = MAC_EXP_NUBUS,
248 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
249 }, {
250 .ident = MAC_MODEL_IIFX,
251 .name = "IIfx",
252 .adb_type = MAC_ADB_IOP,
253 .via_type = MAC_VIA_IICI,
254 .scsi_type = MAC_SCSI_IIFX,
255 .scc_type = MAC_SCC_IOP,
256 .expansion_type = MAC_EXP_PDS_NUBUS,
257 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
258 }, {
259 .ident = MAC_MODEL_IISI,
260 .name = "IIsi",
261 .adb_type = MAC_ADB_EGRET,
262 .via_type = MAC_VIA_IICI,
263 .scsi_type = MAC_SCSI_OLD,
264 .scc_type = MAC_SCC_II,
265 .expansion_type = MAC_EXP_PDS_NUBUS,
266 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
267 }, {
268 .ident = MAC_MODEL_IIVI,
269 .name = "IIvi",
270 .adb_type = MAC_ADB_EGRET,
271 .via_type = MAC_VIA_IICI,
272 .scsi_type = MAC_SCSI_LC,
273 .scc_type = MAC_SCC_II,
274 .expansion_type = MAC_EXP_NUBUS,
275 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
276 }, {
277 .ident = MAC_MODEL_IIVX,
278 .name = "IIvx",
279 .adb_type = MAC_ADB_EGRET,
280 .via_type = MAC_VIA_IICI,
281 .scsi_type = MAC_SCSI_LC,
282 .scc_type = MAC_SCC_II,
283 .expansion_type = MAC_EXP_NUBUS,
284 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
285 },
286
287 /*
288 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
289 */
290
291 {
292 .ident = MAC_MODEL_CLII,
293 .name = "Classic II",
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 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
299 }, {
300 .ident = MAC_MODEL_CCL,
301 .name = "Color Classic",
302 .adb_type = MAC_ADB_CUDA,
303 .via_type = MAC_VIA_IICI,
304 .scsi_type = MAC_SCSI_LC,
305 .scc_type = MAC_SCC_II,
306 .expansion_type = MAC_EXP_PDS,
307 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
308 }, {
309 .ident = MAC_MODEL_CCLII,
310 .name = "Color Classic II",
311 .adb_type = MAC_ADB_CUDA,
312 .via_type = MAC_VIA_IICI,
313 .scsi_type = MAC_SCSI_LC,
314 .scc_type = MAC_SCC_II,
315 .expansion_type = MAC_EXP_PDS,
316 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
317 },
318
319 /*
320 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
321 */
322
323 {
324 .ident = MAC_MODEL_LC,
325 .name = "LC",
326 .adb_type = MAC_ADB_EGRET,
327 .via_type = MAC_VIA_IICI,
328 .scsi_type = MAC_SCSI_LC,
329 .scc_type = MAC_SCC_II,
330 .expansion_type = MAC_EXP_PDS,
331 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
332 }, {
333 .ident = MAC_MODEL_LCII,
334 .name = "LC II",
335 .adb_type = MAC_ADB_EGRET,
336 .via_type = MAC_VIA_IICI,
337 .scsi_type = MAC_SCSI_LC,
338 .scc_type = MAC_SCC_II,
339 .expansion_type = MAC_EXP_PDS,
340 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
341 }, {
342 .ident = MAC_MODEL_LCIII,
343 .name = "LC III",
344 .adb_type = MAC_ADB_EGRET,
345 .via_type = MAC_VIA_IICI,
346 .scsi_type = MAC_SCSI_LC,
347 .scc_type = MAC_SCC_II,
348 .expansion_type = MAC_EXP_PDS,
349 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
350 },
351
352 /*
353 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
354 * differently as some of the stuff connected to VIA2 seems different.
355 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
356 * the 660AV and 840AV which use an AMD 79C940 (MACE).
357 * The 700, 900 and 950 have some I/O chips in the wrong place to
358 * confuse us. The 840AV has a SCSI location of its own (same as
359 * the 660AV).
360 */
361
362 {
363 .ident = MAC_MODEL_Q605,
364 .name = "Quadra 605",
365 .adb_type = MAC_ADB_CUDA,
366 .via_type = MAC_VIA_QUADRA,
367 .scsi_type = MAC_SCSI_QUADRA,
368 .scc_type = MAC_SCC_QUADRA,
369 .expansion_type = MAC_EXP_PDS,
370 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
371 }, {
372 .ident = MAC_MODEL_Q605_ACC,
373 .name = "Quadra 605",
374 .adb_type = MAC_ADB_CUDA,
375 .via_type = MAC_VIA_QUADRA,
376 .scsi_type = MAC_SCSI_QUADRA,
377 .scc_type = MAC_SCC_QUADRA,
378 .expansion_type = MAC_EXP_PDS,
379 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
380 }, {
381 .ident = MAC_MODEL_Q610,
382 .name = "Quadra 610",
383 .adb_type = MAC_ADB_II,
384 .via_type = MAC_VIA_QUADRA,
385 .scsi_type = MAC_SCSI_QUADRA,
386 .scc_type = MAC_SCC_QUADRA,
387 .ether_type = MAC_ETHER_SONIC,
388 .expansion_type = MAC_EXP_PDS_NUBUS,
389 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
390 }, {
391 .ident = MAC_MODEL_Q630,
392 .name = "Quadra 630",
393 .adb_type = MAC_ADB_CUDA,
394 .via_type = MAC_VIA_QUADRA,
395 .scsi_type = MAC_SCSI_QUADRA,
396 .ide_type = MAC_IDE_QUADRA,
397 .scc_type = MAC_SCC_QUADRA,
398 .expansion_type = MAC_EXP_PDS_COMM,
399 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
400 }, {
401 .ident = MAC_MODEL_Q650,
402 .name = "Quadra 650",
403 .adb_type = MAC_ADB_II,
404 .via_type = MAC_VIA_QUADRA,
405 .scsi_type = MAC_SCSI_QUADRA,
406 .scc_type = MAC_SCC_QUADRA,
407 .ether_type = MAC_ETHER_SONIC,
408 .expansion_type = MAC_EXP_PDS_NUBUS,
409 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
410 },
411 /* The Q700 does have a NS Sonic */
412 {
413 .ident = MAC_MODEL_Q700,
414 .name = "Quadra 700",
415 .adb_type = MAC_ADB_II,
416 .via_type = MAC_VIA_QUADRA,
417 .scsi_type = MAC_SCSI_QUADRA2,
418 .scc_type = MAC_SCC_QUADRA,
419 .ether_type = MAC_ETHER_SONIC,
420 .expansion_type = MAC_EXP_PDS_NUBUS,
421 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM */
422 }, {
423 .ident = MAC_MODEL_Q800,
424 .name = "Quadra 800",
425 .adb_type = MAC_ADB_II,
426 .via_type = MAC_VIA_QUADRA,
427 .scsi_type = MAC_SCSI_QUADRA,
428 .scc_type = MAC_SCC_QUADRA,
429 .ether_type = MAC_ETHER_SONIC,
430 .expansion_type = MAC_EXP_PDS_NUBUS,
431 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
432 }, {
433 .ident = MAC_MODEL_Q840,
434 .name = "Quadra 840AV",
435 .adb_type = MAC_ADB_CUDA,
436 .via_type = MAC_VIA_QUADRA,
437 .scsi_type = MAC_SCSI_QUADRA3,
438 .scc_type = MAC_SCC_PSC,
439 .ether_type = MAC_ETHER_MACE,
440 .expansion_type = MAC_EXP_NUBUS,
441 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
442 }, {
443 .ident = MAC_MODEL_Q900,
444 .name = "Quadra 900",
445 .adb_type = MAC_ADB_IOP,
446 .via_type = MAC_VIA_QUADRA,
447 .scsi_type = MAC_SCSI_QUADRA2,
448 .scc_type = MAC_SCC_IOP,
449 .ether_type = MAC_ETHER_SONIC,
450 .expansion_type = MAC_EXP_PDS_NUBUS,
451 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
452 }, {
453 .ident = MAC_MODEL_Q950,
454 .name = "Quadra 950",
455 .adb_type = MAC_ADB_IOP,
456 .via_type = MAC_VIA_QUADRA,
457 .scsi_type = MAC_SCSI_QUADRA2,
458 .scc_type = MAC_SCC_IOP,
459 .ether_type = MAC_ETHER_SONIC,
460 .expansion_type = MAC_EXP_PDS_NUBUS,
461 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
462 },
463
464 /*
465 * Performa - more LC type machines
466 */
467
468 {
469 .ident = MAC_MODEL_P460,
470 .name = "Performa 460",
471 .adb_type = MAC_ADB_EGRET,
472 .via_type = MAC_VIA_IICI,
473 .scsi_type = MAC_SCSI_LC,
474 .scc_type = MAC_SCC_II,
475 .expansion_type = MAC_EXP_PDS,
476 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
477 }, {
478 .ident = MAC_MODEL_P475,
479 .name = "Performa 475",
480 .adb_type = MAC_ADB_CUDA,
481 .via_type = MAC_VIA_QUADRA,
482 .scsi_type = MAC_SCSI_QUADRA,
483 .scc_type = MAC_SCC_II,
484 .expansion_type = MAC_EXP_PDS,
485 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
486 }, {
487 .ident = MAC_MODEL_P475F,
488 .name = "Performa 475",
489 .adb_type = MAC_ADB_CUDA,
490 .via_type = MAC_VIA_QUADRA,
491 .scsi_type = MAC_SCSI_QUADRA,
492 .scc_type = MAC_SCC_II,
493 .expansion_type = MAC_EXP_PDS,
494 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
495 }, {
496 .ident = MAC_MODEL_P520,
497 .name = "Performa 520",
498 .adb_type = MAC_ADB_CUDA,
499 .via_type = MAC_VIA_IICI,
500 .scsi_type = MAC_SCSI_LC,
501 .scc_type = MAC_SCC_II,
502 .expansion_type = MAC_EXP_PDS,
503 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
504 }, {
505 .ident = MAC_MODEL_P550,
506 .name = "Performa 550",
507 .adb_type = MAC_ADB_CUDA,
508 .via_type = MAC_VIA_IICI,
509 .scsi_type = MAC_SCSI_LC,
510 .scc_type = MAC_SCC_II,
511 .expansion_type = MAC_EXP_PDS,
512 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
513 },
514 /* These have the comm slot, and therefore possibly SONIC ethernet */
515 {
516 .ident = MAC_MODEL_P575,
517 .name = "Performa 575",
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_COMM,
523 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
524 }, {
525 .ident = MAC_MODEL_P588,
526 .name = "Performa 588",
527 .adb_type = MAC_ADB_CUDA,
528 .via_type = MAC_VIA_QUADRA,
529 .scsi_type = MAC_SCSI_QUADRA,
530 .ide_type = MAC_IDE_QUADRA,
531 .scc_type = MAC_SCC_II,
532 .expansion_type = MAC_EXP_PDS_COMM,
533 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
534 }, {
535 .ident = MAC_MODEL_TV,
536 .name = "TV",
537 .adb_type = MAC_ADB_CUDA,
538 .via_type = MAC_VIA_IICI,
539 .scsi_type = MAC_SCSI_LC,
540 .scc_type = MAC_SCC_II,
541 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
542 }, {
543 .ident = MAC_MODEL_P600,
544 .name = "Performa 600",
545 .adb_type = MAC_ADB_EGRET,
546 .via_type = MAC_VIA_IICI,
547 .scsi_type = MAC_SCSI_LC,
548 .scc_type = MAC_SCC_II,
549 .expansion_type = MAC_EXP_NUBUS,
550 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
551 },
552
553 /*
554 * Centris - just guessing again; maybe like Quadra.
555 * The C610 may or may not have SONIC. We probe to make sure.
556 */
557
558 {
559 .ident = MAC_MODEL_C610,
560 .name = "Centris 610",
561 .adb_type = MAC_ADB_II,
562 .via_type = MAC_VIA_QUADRA,
563 .scsi_type = MAC_SCSI_QUADRA,
564 .scc_type = MAC_SCC_QUADRA,
565 .ether_type = MAC_ETHER_SONIC,
566 .expansion_type = MAC_EXP_PDS_NUBUS,
567 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
568 }, {
569 .ident = MAC_MODEL_C650,
570 .name = "Centris 650",
571 .adb_type = MAC_ADB_II,
572 .via_type = MAC_VIA_QUADRA,
573 .scsi_type = MAC_SCSI_QUADRA,
574 .scc_type = MAC_SCC_QUADRA,
575 .ether_type = MAC_ETHER_SONIC,
576 .expansion_type = MAC_EXP_PDS_NUBUS,
577 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
578 }, {
579 .ident = MAC_MODEL_C660,
580 .name = "Centris 660AV",
581 .adb_type = MAC_ADB_CUDA,
582 .via_type = MAC_VIA_QUADRA,
583 .scsi_type = MAC_SCSI_QUADRA3,
584 .scc_type = MAC_SCC_PSC,
585 .ether_type = MAC_ETHER_MACE,
586 .expansion_type = MAC_EXP_PDS_NUBUS,
587 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
588 },
589
590 /*
591 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
592 * and a PMU (in two variations?) for ADB. Most of them use the
593 * Quadra-style VIAs. A few models also have IDE from hell.
594 */
595
596 {
597 .ident = MAC_MODEL_PB140,
598 .name = "PowerBook 140",
599 .adb_type = MAC_ADB_PB1,
600 .via_type = MAC_VIA_QUADRA,
601 .scsi_type = MAC_SCSI_OLD,
602 .scc_type = MAC_SCC_QUADRA,
603 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
604 }, {
605 .ident = MAC_MODEL_PB145,
606 .name = "PowerBook 145",
607 .adb_type = MAC_ADB_PB1,
608 .via_type = MAC_VIA_QUADRA,
609 .scsi_type = MAC_SCSI_OLD,
610 .scc_type = MAC_SCC_QUADRA,
611 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
612 }, {
613 .ident = MAC_MODEL_PB150,
614 .name = "PowerBook 150",
615 .adb_type = MAC_ADB_PB2,
616 .via_type = MAC_VIA_IICI,
617 .scsi_type = MAC_SCSI_OLD,
618 .ide_type = MAC_IDE_PB,
619 .scc_type = MAC_SCC_QUADRA,
620 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
621 }, {
622 .ident = MAC_MODEL_PB160,
623 .name = "PowerBook 160",
624 .adb_type = MAC_ADB_PB1,
625 .via_type = MAC_VIA_QUADRA,
626 .scsi_type = MAC_SCSI_OLD,
627 .scc_type = MAC_SCC_QUADRA,
628 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
629 }, {
630 .ident = MAC_MODEL_PB165,
631 .name = "PowerBook 165",
632 .adb_type = MAC_ADB_PB1,
633 .via_type = MAC_VIA_QUADRA,
634 .scsi_type = MAC_SCSI_OLD,
635 .scc_type = MAC_SCC_QUADRA,
636 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
637 }, {
638 .ident = MAC_MODEL_PB165C,
639 .name = "PowerBook 165c",
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 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
645 }, {
646 .ident = MAC_MODEL_PB170,
647 .name = "PowerBook 170",
648 .adb_type = MAC_ADB_PB1,
649 .via_type = MAC_VIA_QUADRA,
650 .scsi_type = MAC_SCSI_OLD,
651 .scc_type = MAC_SCC_QUADRA,
652 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
653 }, {
654 .ident = MAC_MODEL_PB180,
655 .name = "PowerBook 180",
656 .adb_type = MAC_ADB_PB1,
657 .via_type = MAC_VIA_QUADRA,
658 .scsi_type = MAC_SCSI_OLD,
659 .scc_type = MAC_SCC_QUADRA,
660 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
661 }, {
662 .ident = MAC_MODEL_PB180C,
663 .name = "PowerBook 180c",
664 .adb_type = MAC_ADB_PB1,
665 .via_type = MAC_VIA_QUADRA,
666 .scsi_type = MAC_SCSI_OLD,
667 .scc_type = MAC_SCC_QUADRA,
668 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
669 }, {
670 .ident = MAC_MODEL_PB190,
671 .name = "PowerBook 190",
672 .adb_type = MAC_ADB_PB2,
673 .via_type = MAC_VIA_QUADRA,
674 .scsi_type = MAC_SCSI_OLD,
675 .ide_type = MAC_IDE_BABOON,
676 .scc_type = MAC_SCC_QUADRA,
677 .floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */
678 }, {
679 .ident = MAC_MODEL_PB520,
680 .name = "PowerBook 520",
681 .adb_type = MAC_ADB_PB2,
682 .via_type = MAC_VIA_QUADRA,
683 .scsi_type = MAC_SCSI_OLD,
684 .scc_type = MAC_SCC_QUADRA,
685 .ether_type = MAC_ETHER_SONIC,
686 .floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */
687 },
688
689 /*
690 * PowerBook Duos are pretty much like normal PowerBooks
691 * All of these probably have onboard SONIC in the Dock which
692 * means we'll have to probe for it eventually.
693 */
694
695 {
696 .ident = MAC_MODEL_PB210,
697 .name = "PowerBook Duo 210",
698 .adb_type = MAC_ADB_PB2,
699 .via_type = MAC_VIA_IICI,
700 .scsi_type = MAC_SCSI_DUO,
701 .scc_type = MAC_SCC_QUADRA,
702 .expansion_type = MAC_EXP_NUBUS,
703 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
704 }, {
705 .ident = MAC_MODEL_PB230,
706 .name = "PowerBook Duo 230",
707 .adb_type = MAC_ADB_PB2,
708 .via_type = MAC_VIA_IICI,
709 .scsi_type = MAC_SCSI_DUO,
710 .scc_type = MAC_SCC_QUADRA,
711 .expansion_type = MAC_EXP_NUBUS,
712 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
713 }, {
714 .ident = MAC_MODEL_PB250,
715 .name = "PowerBook Duo 250",
716 .adb_type = MAC_ADB_PB2,
717 .via_type = MAC_VIA_IICI,
718 .scsi_type = MAC_SCSI_DUO,
719 .scc_type = MAC_SCC_QUADRA,
720 .expansion_type = MAC_EXP_NUBUS,
721 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
722 }, {
723 .ident = MAC_MODEL_PB270C,
724 .name = "PowerBook Duo 270c",
725 .adb_type = MAC_ADB_PB2,
726 .via_type = MAC_VIA_IICI,
727 .scsi_type = MAC_SCSI_DUO,
728 .scc_type = MAC_SCC_QUADRA,
729 .expansion_type = MAC_EXP_NUBUS,
730 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
731 }, {
732 .ident = MAC_MODEL_PB280,
733 .name = "PowerBook Duo 280",
734 .adb_type = MAC_ADB_PB2,
735 .via_type = MAC_VIA_IICI,
736 .scsi_type = MAC_SCSI_DUO,
737 .scc_type = MAC_SCC_QUADRA,
738 .expansion_type = MAC_EXP_NUBUS,
739 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
740 }, {
741 .ident = MAC_MODEL_PB280C,
742 .name = "PowerBook Duo 280c",
743 .adb_type = MAC_ADB_PB2,
744 .via_type = MAC_VIA_IICI,
745 .scsi_type = MAC_SCSI_DUO,
746 .scc_type = MAC_SCC_QUADRA,
747 .expansion_type = MAC_EXP_NUBUS,
748 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
749 },
750
751 /*
752 * Other stuff?
753 */
754
755 {
756 .ident = -1
757 }
758};
759
760static struct resource scc_a_rsrcs[] = {
761 { .flags = IORESOURCE_MEM },
762 { .flags = IORESOURCE_IRQ },
763};
764
765static struct resource scc_b_rsrcs[] = {
766 { .flags = IORESOURCE_MEM },
767 { .flags = IORESOURCE_IRQ },
768};
769
770struct platform_device scc_a_pdev = {
771 .name = "scc",
772 .id = 0,
773};
774EXPORT_SYMBOL(scc_a_pdev);
775
776struct platform_device scc_b_pdev = {
777 .name = "scc",
778 .id = 1,
779};
780EXPORT_SYMBOL(scc_b_pdev);
781
782static void __init mac_identify(void)
783{
784 struct mac_model *m;
785
786 /* Penguin data useful? */
787 int model = mac_bi_data.id;
788 if (!model) {
789 /* no bootinfo model id -> NetBSD booter was used! */
790 /* XXX FIXME: breaks for model > 31 */
791 model = (mac_bi_data.cpuid >> 2) & 63;
792 pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
793 }
794
795 macintosh_config = mac_data_table;
796 for (m = macintosh_config; m->ident != -1; m++) {
797 if (m->ident == model) {
798 macintosh_config = m;
799 break;
800 }
801 }
802
803 /* Set up serial port resources for the console initcall. */
804
805 scc_a_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase + 2;
806 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
807 scc_a_pdev.num_resources = ARRAY_SIZE(scc_a_rsrcs);
808 scc_a_pdev.resource = scc_a_rsrcs;
809
810 scc_b_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase;
811 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
812 scc_b_pdev.num_resources = ARRAY_SIZE(scc_b_rsrcs);
813 scc_b_pdev.resource = scc_b_rsrcs;
814
815 switch (macintosh_config->scc_type) {
816 case MAC_SCC_PSC:
817 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
818 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
819 break;
820 default:
821 /* On non-PSC machines, the serial ports share an IRQ. */
822 if (macintosh_config->ident == MAC_MODEL_IIFX) {
823 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
824 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
825 } else {
826 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
827 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
828 }
829 break;
830 }
831
832 pr_info("Detected Macintosh model: %d\n", model);
833
834 /*
835 * Report booter data:
836 */
837 printk(KERN_DEBUG " Penguin bootinfo data:\n");
838 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
839 mac_bi_data.videoaddr, mac_bi_data.videorow,
840 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
841 mac_bi_data.dimensions >> 16);
842 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
843 mac_bi_data.videological, mac_orig_videoaddr,
844 mac_bi_data.sccbase);
845 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
846 mac_bi_data.boottime, mac_bi_data.gmtbias);
847 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
848 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
849
850 iop_init();
851 oss_init();
852 via_init();
853 psc_init();
854 baboon_init();
855
856#ifdef CONFIG_ADB_CUDA
857 find_via_cuda();
858#endif
859#ifdef CONFIG_ADB_PMU
860 find_via_pmu();
861#endif
862}
863
864static void __init mac_report_hardware(void)
865{
866 pr_info("Apple Macintosh %s\n", macintosh_config->name);
867}
868
869static void mac_get_model(char *str)
870{
871 strcpy(str, "Macintosh ");
872 strcat(str, macintosh_config->name);
873}
874
875static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
876 {
877 .flags = IORESOURCE_IRQ,
878 .start = IRQ_MAC_SCSI,
879 .end = IRQ_MAC_SCSI,
880 }, {
881 .flags = IORESOURCE_MEM,
882 .start = 0x50008000,
883 .end = 0x50009FFF,
884 }, {
885 .flags = IORESOURCE_MEM,
886 .start = 0x50008000,
887 .end = 0x50009FFF,
888 },
889};
890
891static const struct resource mac_scsi_duo_rsrc[] __initconst = {
892 {
893 .flags = IORESOURCE_MEM,
894 .start = 0xFEE02000,
895 .end = 0xFEE03FFF,
896 },
897};
898
899static const struct resource mac_scsi_old_rsrc[] __initconst = {
900 {
901 .flags = IORESOURCE_IRQ,
902 .start = IRQ_MAC_SCSI,
903 .end = IRQ_MAC_SCSI,
904 }, {
905 .flags = IORESOURCE_MEM,
906 .start = 0x50010000,
907 .end = 0x50011FFF,
908 }, {
909 .flags = IORESOURCE_MEM,
910 .start = 0x50006000,
911 .end = 0x50007FFF,
912 },
913};
914
915static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
916 {
917 .flags = IORESOURCE_IRQ,
918 .start = IRQ_MAC_SCSI,
919 .end = IRQ_MAC_SCSI,
920 }, {
921 .flags = IORESOURCE_MEM,
922 .start = 0x50F10000,
923 .end = 0x50F11FFF,
924 }, {
925 .flags = IORESOURCE_MEM,
926 .start = 0x50F06000,
927 .end = 0x50F07FFF,
928 },
929};
930
931static const struct resource mac_pata_quadra_rsrc[] __initconst = {
932 DEFINE_RES_MEM(0x50F1A000, 0x38),
933 DEFINE_RES_MEM(0x50F1A038, 0x04),
934 DEFINE_RES_IRQ(IRQ_NUBUS_F),
935};
936
937static const struct resource mac_pata_pb_rsrc[] __initconst = {
938 DEFINE_RES_MEM(0x50F1A000, 0x38),
939 DEFINE_RES_MEM(0x50F1A038, 0x04),
940 DEFINE_RES_IRQ(IRQ_NUBUS_C),
941};
942
943static const struct resource mac_pata_baboon_rsrc[] __initconst = {
944 DEFINE_RES_MEM(0x50F1A000, 0x38),
945 DEFINE_RES_MEM(0x50F1A038, 0x04),
946 DEFINE_RES_IRQ(IRQ_BABOON_1),
947};
948
949static const struct pata_platform_info mac_pata_data __initconst = {
950 .ioport_shift = 2,
951};
952
953static int __init mac_platform_init(void)
954{
955 phys_addr_t swim_base = 0;
956
957 if (!MACH_IS_MAC)
958 return -ENODEV;
959
960 /*
961 * Serial devices
962 */
963
964 platform_device_register(&scc_a_pdev);
965 platform_device_register(&scc_b_pdev);
966
967 /*
968 * Floppy device
969 */
970
971 switch (macintosh_config->floppy_type) {
972 case MAC_FLOPPY_QUADRA:
973 swim_base = 0x5001E000;
974 break;
975 case MAC_FLOPPY_OLD:
976 swim_base = 0x50016000;
977 break;
978 case MAC_FLOPPY_LC:
979 swim_base = 0x50F16000;
980 break;
981 }
982
983 if (swim_base) {
984 struct resource swim_rsrc = {
985 .flags = IORESOURCE_MEM,
986 .start = swim_base,
987 .end = swim_base + 0x1FFF,
988 };
989
990 platform_device_register_simple("swim", -1, &swim_rsrc, 1);
991 }
992
993 /*
994 * SCSI device(s)
995 */
996
997 switch (macintosh_config->scsi_type) {
998 case MAC_SCSI_QUADRA:
999 case MAC_SCSI_QUADRA3:
1000 platform_device_register_simple("mac_esp", 0, NULL, 0);
1001 break;
1002 case MAC_SCSI_QUADRA2:
1003 platform_device_register_simple("mac_esp", 0, NULL, 0);
1004 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
1005 (macintosh_config->ident == MAC_MODEL_Q950))
1006 platform_device_register_simple("mac_esp", 1, NULL, 0);
1007 break;
1008 case MAC_SCSI_IIFX:
1009 /* Addresses from The Guide to Mac Family Hardware.
1010 * $5000 8000 - $5000 9FFF: SCSI DMA
1011 * $5000 A000 - $5000 BFFF: Alternate SCSI
1012 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
1013 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
1014 * The A/UX header file sys/uconfig.h says $50F0 8000.
1015 * The "SCSI DMA" custom IC embeds the 53C80 core and
1016 * supports Programmed IO, DMA and PDMA (hardware handshake).
1017 */
1018 platform_device_register_simple("mac_scsi", 0,
1019 mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
1020 break;
1021 case MAC_SCSI_DUO:
1022 /* Addresses from the Duo Dock II Developer Note.
1023 * $FEE0 2000 - $FEE0 3FFF: normal mode
1024 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
1025 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
1026 * The NetBSD code indicates that both 5380 chips share
1027 * an IRQ (?) which would need careful handling (see mac_esp).
1028 */
1029 platform_device_register_simple("mac_scsi", 1,
1030 mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
1031 fallthrough;
1032 case MAC_SCSI_OLD:
1033 /* Addresses from Developer Notes for Duo System,
1034 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
1035 * and also from The Guide to Mac Family Hardware for
1036 * SE/30, II, IIx, IIcx, IIci.
1037 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
1038 * $5001 0000 - $5001 1FFF: normal mode
1039 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
1040 * GMFH says that $5000 0000 - $50FF FFFF "wraps
1041 * $5000 0000 - $5001 FFFF eight times" (!)
1042 * mess.org says IIci and Color Classic do not alias
1043 * I/O address space.
1044 */
1045 platform_device_register_simple("mac_scsi", 0,
1046 mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
1047 break;
1048 case MAC_SCSI_LC:
1049 /* Addresses from Mac LC data in Designing Cards & Drivers 3ed.
1050 * Also from the Developer Notes for Classic II, LC III,
1051 * Color Classic and IIvx.
1052 * $50F0 6000 - $50F0 7FFF: SCSI handshake
1053 * $50F1 0000 - $50F1 1FFF: SCSI
1054 * $50F1 2000 - $50F1 3FFF: SCSI DMA
1055 */
1056 platform_device_register_simple("mac_scsi", 0,
1057 mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
1058 break;
1059 }
1060
1061 /*
1062 * IDE device
1063 */
1064
1065 switch (macintosh_config->ide_type) {
1066 case MAC_IDE_QUADRA:
1067 platform_device_register_resndata(NULL, "pata_platform", -1,
1068 mac_pata_quadra_rsrc, ARRAY_SIZE(mac_pata_quadra_rsrc),
1069 &mac_pata_data, sizeof(mac_pata_data));
1070 break;
1071 case MAC_IDE_PB:
1072 platform_device_register_resndata(NULL, "pata_platform", -1,
1073 mac_pata_pb_rsrc, ARRAY_SIZE(mac_pata_pb_rsrc),
1074 &mac_pata_data, sizeof(mac_pata_data));
1075 break;
1076 case MAC_IDE_BABOON:
1077 platform_device_register_resndata(NULL, "pata_platform", -1,
1078 mac_pata_baboon_rsrc, ARRAY_SIZE(mac_pata_baboon_rsrc),
1079 &mac_pata_data, sizeof(mac_pata_data));
1080 break;
1081 }
1082
1083 /*
1084 * Ethernet device
1085 */
1086
1087 if (macintosh_config->ether_type == MAC_ETHER_SONIC ||
1088 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1089 platform_device_register_simple("macsonic", -1, NULL, 0);
1090
1091 if (macintosh_config->expansion_type == MAC_EXP_PDS ||
1092 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1093 platform_device_register_simple("mac89x0", -1, NULL, 0);
1094
1095 if (macintosh_config->ether_type == MAC_ETHER_MACE)
1096 platform_device_register_simple("macmace", -1, NULL, 0);
1097
1098 return 0;
1099}
1100
1101arch_initcall(mac_platform_init);