Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / arch / m68k / mac / config.c
CommitLineData
1da177e4
LT
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
1da177e4
LT
13#include <linux/module.h>
14#include <linux/types.h>
15#include <linux/mm.h>
16#include <linux/tty.h>
17#include <linux/console.h>
18#include <linux/interrupt.h>
19/* keyb */
20#include <linux/random.h>
21#include <linux/delay.h>
22/* keyb */
23#include <linux/init.h>
24#include <linux/vt_kern.h>
8852ecd9 25#include <linux/platform_device.h>
1da177e4
LT
26
27#define BOOTINFO_COMPAT_1_0
28#include <asm/setup.h>
29#include <asm/bootinfo.h>
30
31#include <asm/system.h>
32#include <asm/io.h>
33#include <asm/irq.h>
34#include <asm/pgtable.h>
35#include <asm/rtc.h>
36#include <asm/machdep.h>
37
38#include <asm/macintosh.h>
39#include <asm/macints.h>
40#include <asm/machw.h>
41
42#include <asm/mac_iop.h>
43#include <asm/mac_via.h>
44#include <asm/mac_oss.h>
45#include <asm/mac_psc.h>
46
8852ecd9
LV
47/* platform device info */
48
49#define SWIM_IO_SIZE 0x2000 /* SWIM IO resource size */
50
1da177e4
LT
51/* Mac bootinfo struct */
52
53struct mac_booter_data mac_bi_data;
1da177e4 54
1da177e4 55/* The phys. video addr. - might be bogus on some machines */
8dfbdf4a 56static unsigned long mac_orig_videoaddr;
1da177e4
LT
57
58/* Mac specific timer functions */
6ff5801a
RZ
59extern unsigned long mac_gettimeoffset(void);
60extern int mac_hwclk(int, struct rtc_time *);
61extern int mac_set_clock_mmss(unsigned long);
1da177e4
LT
62extern void iop_preinit(void);
63extern void iop_init(void);
64extern void via_init(void);
40220c1a 65extern void via_init_clock(irq_handler_t func);
1da177e4
LT
66extern void via_flush_cache(void);
67extern void oss_init(void);
68extern void psc_init(void);
69extern void baboon_init(void);
70
71extern void mac_mksound(unsigned int, unsigned int);
72
73extern void nubus_sweep_video(void);
74
1da177e4 75static void mac_get_model(char *str);
8dfbdf4a
AB
76static void mac_identify(void);
77static void mac_report_hardware(void);
1da177e4 78
66a3f820 79static void __init mac_sched_init(irq_handler_t vector)
1da177e4
LT
80{
81 via_init_clock(vector);
82}
83
1da177e4
LT
84/*
85 * Parse a Macintosh-specific record in the bootinfo
86 */
87
88int __init mac_parse_bootinfo(const struct bi_record *record)
89{
6ff5801a
RZ
90 int unknown = 0;
91 const u_long *data = record->data;
1da177e4 92
6ff5801a 93 switch (record->tag) {
1da177e4 94 case BI_MAC_MODEL:
6ff5801a
RZ
95 mac_bi_data.id = *data;
96 break;
1da177e4 97 case BI_MAC_VADDR:
6ff5801a
RZ
98 mac_bi_data.videoaddr = *data;
99 break;
1da177e4 100 case BI_MAC_VDEPTH:
6ff5801a
RZ
101 mac_bi_data.videodepth = *data;
102 break;
1da177e4 103 case BI_MAC_VROW:
6ff5801a
RZ
104 mac_bi_data.videorow = *data;
105 break;
1da177e4 106 case BI_MAC_VDIM:
6ff5801a
RZ
107 mac_bi_data.dimensions = *data;
108 break;
1da177e4 109 case BI_MAC_VLOGICAL:
6ff5801a
RZ
110 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
111 mac_orig_videoaddr = *data;
112 break;
1da177e4 113 case BI_MAC_SCCBASE:
6ff5801a
RZ
114 mac_bi_data.sccbase = *data;
115 break;
1da177e4 116 case BI_MAC_BTIME:
6ff5801a
RZ
117 mac_bi_data.boottime = *data;
118 break;
1da177e4 119 case BI_MAC_GMTBIAS:
6ff5801a
RZ
120 mac_bi_data.gmtbias = *data;
121 break;
1da177e4 122 case BI_MAC_MEMSIZE:
6ff5801a
RZ
123 mac_bi_data.memsize = *data;
124 break;
1da177e4 125 case BI_MAC_CPUID:
6ff5801a
RZ
126 mac_bi_data.cpuid = *data;
127 break;
128 case BI_MAC_ROMBASE:
129 mac_bi_data.rombase = *data;
130 break;
1da177e4 131 default:
6ff5801a
RZ
132 unknown = 1;
133 break;
134 }
135 return unknown;
1da177e4
LT
136}
137
138/*
139 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
140 * have to disable interrupts for this. Our IRQ handlers will crap
141 * themselves if they take an IRQ in 24bit mode!
142 */
143
144static void mac_cache_card_flush(int writeback)
145{
146 unsigned long flags;
6ff5801a 147
1da177e4
LT
148 local_irq_save(flags);
149 via_flush_cache();
150 local_irq_restore(flags);
151}
152
153void __init config_mac(void)
154{
6ff5801a
RZ
155 if (!MACH_IS_MAC)
156 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
1da177e4 157
6ff5801a
RZ
158 mach_sched_init = mac_sched_init;
159 mach_init_IRQ = mac_init_IRQ;
160 mach_get_model = mac_get_model;
161 mach_gettimeoffset = mac_gettimeoffset;
6ff5801a 162 mach_hwclk = mac_hwclk;
6ff5801a
RZ
163 mach_set_clock_mmss = mac_set_clock_mmss;
164 mach_reset = mac_reset;
165 mach_halt = mac_poweroff;
166 mach_power_off = mac_poweroff;
1da177e4 167 mach_max_dma_address = 0xffffffff;
1da177e4 168#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
6ff5801a 169 mach_beep = mac_mksound;
1da177e4
LT
170#endif
171#ifdef CONFIG_HEARTBEAT
172#if 0
173 mach_heartbeat = mac_heartbeat;
174 mach_heartbeat_irq = IRQ_MAC_TIMER;
175#endif
176#endif
177
178 /*
179 * Determine hardware present
180 */
181
182 mac_identify();
183 mac_report_hardware();
184
6ff5801a
RZ
185 /*
186 * AFAIK only the IIci takes a cache card. The IIfx has onboard
187 * cache ... someone needs to figure out how to tell if it's on or
188 * not.
189 */
1da177e4
LT
190
191 if (macintosh_config->ident == MAC_MODEL_IICI
6ff5801a 192 || macintosh_config->ident == MAC_MODEL_IIFX)
1da177e4 193 mach_l2_flush = mac_cache_card_flush;
1da177e4
LT
194
195 /*
196 * Check for machine specific fixups.
197 */
198
199#ifdef OLD_NUBUS_CODE
6ff5801a 200 nubus_sweep_video();
1da177e4
LT
201#endif
202}
203
204
205/*
206 * Macintosh Table: hardcoded model configuration data.
207 *
208 * Much of this was defined by Alan, based on who knows what docs.
209 * I've added a lot more, and some of that was pure guesswork based
210 * on hardware pages present on the Mac web site. Possibly wildly
211 * inaccurate, so look here if a new Mac model won't run. Example: if
212 * a Mac crashes immediately after the VIA1 registers have been dumped
213 * to the screen, it probably died attempting to read DirB on a RBV.
214 * Meaning it should have MAC_VIA_IIci here :-)
215 */
216
217struct mac_model *macintosh_config;
218EXPORT_SYMBOL(macintosh_config);
219
6ff5801a 220static struct mac_model mac_data_table[] = {
1da177e4
LT
221 /*
222 * We'll pretend to be a Macintosh II, that's pretty safe.
223 */
224
225 {
226 .ident = MAC_MODEL_II,
227 .name = "Unknown",
228 .adb_type = MAC_ADB_II,
229 .via_type = MAC_VIA_II,
230 .scsi_type = MAC_SCSI_OLD,
231 .scc_type = MAC_SCC_II,
7ad93b42
LV
232 .nubus_type = MAC_NUBUS,
233 .floppy_type = MAC_FLOPPY_IWM
1da177e4
LT
234 },
235
236 /*
237 * Original MacII hardware
238 *
239 */
240
241 {
242 .ident = MAC_MODEL_II,
243 .name = "II",
244 .adb_type = MAC_ADB_II,
245 .via_type = MAC_VIA_II,
246 .scsi_type = MAC_SCSI_OLD,
247 .scc_type = MAC_SCC_II,
7ad93b42
LV
248 .nubus_type = MAC_NUBUS,
249 .floppy_type = MAC_FLOPPY_IWM
1da177e4
LT
250 }, {
251 .ident = MAC_MODEL_IIX,
252 .name = "IIx",
253 .adb_type = MAC_ADB_II,
254 .via_type = MAC_VIA_II,
255 .scsi_type = MAC_SCSI_OLD,
256 .scc_type = MAC_SCC_II,
7ad93b42
LV
257 .nubus_type = MAC_NUBUS,
258 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
259 }, {
260 .ident = MAC_MODEL_IICX,
261 .name = "IIcx",
262 .adb_type = MAC_ADB_II,
263 .via_type = MAC_VIA_II,
264 .scsi_type = MAC_SCSI_OLD,
265 .scc_type = MAC_SCC_II,
7ad93b42
LV
266 .nubus_type = MAC_NUBUS,
267 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
268 }, {
269 .ident = MAC_MODEL_SE30,
270 .name = "SE/30",
271 .adb_type = MAC_ADB_II,
272 .via_type = MAC_VIA_II,
273 .scsi_type = MAC_SCSI_OLD,
274 .scc_type = MAC_SCC_II,
7ad93b42
LV
275 .nubus_type = MAC_NUBUS,
276 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
277 },
278
279 /*
0c79cf6a 280 * Weirdified MacII hardware - all subtly different. Gee thanks
1da177e4
LT
281 * Apple. All these boxes seem to have VIA2 in a different place to
282 * the MacII (+1A000 rather than +4000)
283 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
284 */
285
286 {
287 .ident = MAC_MODEL_IICI,
288 .name = "IIci",
289 .adb_type = MAC_ADB_II,
290 .via_type = MAC_VIA_IIci,
291 .scsi_type = MAC_SCSI_OLD,
292 .scc_type = MAC_SCC_II,
7ad93b42
LV
293 .nubus_type = MAC_NUBUS,
294 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
295 }, {
296 .ident = MAC_MODEL_IIFX,
297 .name = "IIfx",
298 .adb_type = MAC_ADB_IOP,
299 .via_type = MAC_VIA_IIci,
300 .scsi_type = MAC_SCSI_OLD,
301 .scc_type = MAC_SCC_IOP,
7ad93b42
LV
302 .nubus_type = MAC_NUBUS,
303 .floppy_type = MAC_FLOPPY_SWIM_IOP
1da177e4
LT
304 }, {
305 .ident = MAC_MODEL_IISI,
306 .name = "IIsi",
307 .adb_type = MAC_ADB_IISI,
308 .via_type = MAC_VIA_IIci,
309 .scsi_type = MAC_SCSI_OLD,
310 .scc_type = MAC_SCC_II,
7ad93b42
LV
311 .nubus_type = MAC_NUBUS,
312 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
313 }, {
314 .ident = MAC_MODEL_IIVI,
315 .name = "IIvi",
316 .adb_type = MAC_ADB_IISI,
317 .via_type = MAC_VIA_IIci,
318 .scsi_type = MAC_SCSI_OLD,
319 .scc_type = MAC_SCC_II,
7ad93b42
LV
320 .nubus_type = MAC_NUBUS,
321 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
322 }, {
323 .ident = MAC_MODEL_IIVX,
324 .name = "IIvx",
325 .adb_type = MAC_ADB_IISI,
326 .via_type = MAC_VIA_IIci,
327 .scsi_type = MAC_SCSI_OLD,
328 .scc_type = MAC_SCC_II,
7ad93b42
LV
329 .nubus_type = MAC_NUBUS,
330 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
331 },
332
333 /*
334 * Classic models (guessing: similar to SE/30 ?? Nope, similar to LC ...)
335 */
336
337 {
338 .ident = MAC_MODEL_CLII,
339 .name = "Classic II",
340 .adb_type = MAC_ADB_IISI,
341 .via_type = MAC_VIA_IIci,
342 .scsi_type = MAC_SCSI_OLD,
343 .scc_type = MAC_SCC_II,
7ad93b42
LV
344 .nubus_type = MAC_NUBUS,
345 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
346 }, {
347 .ident = MAC_MODEL_CCL,
348 .name = "Color Classic",
349 .adb_type = MAC_ADB_CUDA,
350 .via_type = MAC_VIA_IIci,
351 .scsi_type = MAC_SCSI_OLD,
352 .scc_type = MAC_SCC_II,
7ad93b42
LV
353 .nubus_type = MAC_NUBUS,
354 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
355 },
1da177e4
LT
356
357 /*
358 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
359 */
360
361 {
362 .ident = MAC_MODEL_LC,
363 .name = "LC",
364 .adb_type = MAC_ADB_IISI,
365 .via_type = MAC_VIA_IIci,
366 .scsi_type = MAC_SCSI_OLD,
367 .scc_type = MAC_SCC_II,
7ad93b42
LV
368 .nubus_type = MAC_NUBUS,
369 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
370 }, {
371 .ident = MAC_MODEL_LCII,
372 .name = "LC II",
373 .adb_type = MAC_ADB_IISI,
374 .via_type = MAC_VIA_IIci,
375 .scsi_type = MAC_SCSI_OLD,
376 .scc_type = MAC_SCC_II,
7ad93b42
LV
377 .nubus_type = MAC_NUBUS,
378 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
379 }, {
380 .ident = MAC_MODEL_LCIII,
381 .name = "LC III",
382 .adb_type = MAC_ADB_IISI,
383 .via_type = MAC_VIA_IIci,
384 .scsi_type = MAC_SCSI_OLD,
385 .scc_type = MAC_SCC_II,
7ad93b42
LV
386 .nubus_type = MAC_NUBUS,
387 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
388 },
389
390 /*
391 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it differently
392 * as some of the stuff connected to VIA2 seems different. Better SCSI chip and
393 * onboard ethernet using a NatSemi SONIC except the 660AV and 840AV which use an
394 * AMD 79C940 (MACE).
395 * The 700, 900 and 950 have some I/O chips in the wrong place to
396 * confuse us. The 840AV has a SCSI location of its own (same as
397 * the 660AV).
398 */
399
400 {
401 .ident = MAC_MODEL_Q605,
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,
7ad93b42
LV
407 .nubus_type = MAC_NUBUS,
408 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
409 }, {
410 .ident = MAC_MODEL_Q605_ACC,
411 .name = "Quadra 605",
412 .adb_type = MAC_ADB_CUDA,
413 .via_type = MAC_VIA_QUADRA,
414 .scsi_type = MAC_SCSI_QUADRA,
415 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
416 .nubus_type = MAC_NUBUS,
417 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
418 }, {
419 .ident = MAC_MODEL_Q610,
420 .name = "Quadra 610",
421 .adb_type = MAC_ADB_II,
422 .via_type = MAC_VIA_QUADRA,
423 .scsi_type = MAC_SCSI_QUADRA,
424 .scc_type = MAC_SCC_QUADRA,
425 .ether_type = MAC_ETHER_SONIC,
7ad93b42
LV
426 .nubus_type = MAC_NUBUS,
427 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
428 }, {
429 .ident = MAC_MODEL_Q630,
430 .name = "Quadra 630",
431 .adb_type = MAC_ADB_CUDA,
432 .via_type = MAC_VIA_QUADRA,
433 .scsi_type = MAC_SCSI_QUADRA,
434 .ide_type = MAC_IDE_QUADRA,
435 .scc_type = MAC_SCC_QUADRA,
436 .ether_type = MAC_ETHER_SONIC,
7ad93b42
LV
437 .nubus_type = MAC_NUBUS,
438 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
439 }, {
440 .ident = MAC_MODEL_Q650,
441 .name = "Quadra 650",
442 .adb_type = MAC_ADB_II,
443 .via_type = MAC_VIA_QUADRA,
444 .scsi_type = MAC_SCSI_QUADRA,
445 .scc_type = MAC_SCC_QUADRA,
446 .ether_type = MAC_ETHER_SONIC,
7ad93b42
LV
447 .nubus_type = MAC_NUBUS,
448 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
449 },
450 /* The Q700 does have a NS Sonic */
451 {
452 .ident = MAC_MODEL_Q700,
453 .name = "Quadra 700",
454 .adb_type = MAC_ADB_II,
455 .via_type = MAC_VIA_QUADRA,
456 .scsi_type = MAC_SCSI_QUADRA2,
457 .scc_type = MAC_SCC_QUADRA,
458 .ether_type = MAC_ETHER_SONIC,
7ad93b42
LV
459 .nubus_type = MAC_NUBUS,
460 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
461 }, {
462 .ident = MAC_MODEL_Q800,
463 .name = "Quadra 800",
464 .adb_type = MAC_ADB_II,
465 .via_type = MAC_VIA_QUADRA,
466 .scsi_type = MAC_SCSI_QUADRA,
467 .scc_type = MAC_SCC_QUADRA,
468 .ether_type = MAC_ETHER_SONIC,
7ad93b42
LV
469 .nubus_type = MAC_NUBUS,
470 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
471 }, {
472 .ident = MAC_MODEL_Q840,
473 .name = "Quadra 840AV",
474 .adb_type = MAC_ADB_CUDA,
475 .via_type = MAC_VIA_QUADRA,
476 .scsi_type = MAC_SCSI_QUADRA3,
477 .scc_type = MAC_SCC_PSC,
478 .ether_type = MAC_ETHER_MACE,
7ad93b42
LV
479 .nubus_type = MAC_NUBUS,
480 .floppy_type = MAC_FLOPPY_AV
1da177e4
LT
481 }, {
482 .ident = MAC_MODEL_Q900,
483 .name = "Quadra 900",
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,
7ad93b42
LV
489 .nubus_type = MAC_NUBUS,
490 .floppy_type = MAC_FLOPPY_SWIM_IOP
1da177e4
LT
491 }, {
492 .ident = MAC_MODEL_Q950,
493 .name = "Quadra 950",
494 .adb_type = MAC_ADB_IOP,
495 .via_type = MAC_VIA_QUADRA,
496 .scsi_type = MAC_SCSI_QUADRA2,
497 .scc_type = MAC_SCC_IOP,
498 .ether_type = MAC_ETHER_SONIC,
7ad93b42
LV
499 .nubus_type = MAC_NUBUS,
500 .floppy_type = MAC_FLOPPY_SWIM_IOP
1da177e4
LT
501 },
502
503 /*
504 * Performa - more LC type machines
505 */
506
507 {
508 .ident = MAC_MODEL_P460,
509 .name = "Performa 460",
510 .adb_type = MAC_ADB_IISI,
511 .via_type = MAC_VIA_IIci,
512 .scsi_type = MAC_SCSI_OLD,
513 .scc_type = MAC_SCC_II,
7ad93b42
LV
514 .nubus_type = MAC_NUBUS,
515 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
516 }, {
517 .ident = MAC_MODEL_P475,
518 .name = "Performa 475",
519 .adb_type = MAC_ADB_CUDA,
520 .via_type = MAC_VIA_QUADRA,
521 .scsi_type = MAC_SCSI_QUADRA,
522 .scc_type = MAC_SCC_II,
7ad93b42
LV
523 .nubus_type = MAC_NUBUS,
524 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
525 }, {
526 .ident = MAC_MODEL_P475F,
527 .name = "Performa 475",
528 .adb_type = MAC_ADB_CUDA,
529 .via_type = MAC_VIA_QUADRA,
530 .scsi_type = MAC_SCSI_QUADRA,
531 .scc_type = MAC_SCC_II,
7ad93b42
LV
532 .nubus_type = MAC_NUBUS,
533 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
534 }, {
535 .ident = MAC_MODEL_P520,
536 .name = "Performa 520",
537 .adb_type = MAC_ADB_CUDA,
538 .via_type = MAC_VIA_IIci,
539 .scsi_type = MAC_SCSI_OLD,
540 .scc_type = MAC_SCC_II,
7ad93b42
LV
541 .nubus_type = MAC_NUBUS,
542 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
543 }, {
544 .ident = MAC_MODEL_P550,
545 .name = "Performa 550",
546 .adb_type = MAC_ADB_CUDA,
547 .via_type = MAC_VIA_IIci,
548 .scsi_type = MAC_SCSI_OLD,
549 .scc_type = MAC_SCC_II,
7ad93b42
LV
550 .nubus_type = MAC_NUBUS,
551 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
552 },
553 /* These have the comm slot, and therefore the possibility of SONIC ethernet */
554 {
555 .ident = MAC_MODEL_P575,
556 .name = "Performa 575",
557 .adb_type = MAC_ADB_CUDA,
558 .via_type = MAC_VIA_QUADRA,
559 .scsi_type = MAC_SCSI_QUADRA,
560 .scc_type = MAC_SCC_II,
561 .ether_type = MAC_ETHER_SONIC,
7ad93b42
LV
562 .nubus_type = MAC_NUBUS,
563 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
564 }, {
565 .ident = MAC_MODEL_P588,
566 .name = "Performa 588",
567 .adb_type = MAC_ADB_CUDA,
568 .via_type = MAC_VIA_QUADRA,
569 .scsi_type = MAC_SCSI_QUADRA,
570 .ide_type = MAC_IDE_QUADRA,
571 .scc_type = MAC_SCC_II,
572 .ether_type = MAC_ETHER_SONIC,
7ad93b42
LV
573 .nubus_type = MAC_NUBUS,
574 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
575 }, {
576 .ident = MAC_MODEL_TV,
577 .name = "TV",
578 .adb_type = MAC_ADB_CUDA,
579 .via_type = MAC_VIA_QUADRA,
580 .scsi_type = MAC_SCSI_OLD,
581 .scc_type = MAC_SCC_II,
7ad93b42
LV
582 .nubus_type = MAC_NUBUS,
583 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
584 }, {
585 .ident = MAC_MODEL_P600,
586 .name = "Performa 600",
587 .adb_type = MAC_ADB_IISI,
588 .via_type = MAC_VIA_IIci,
589 .scsi_type = MAC_SCSI_OLD,
590 .scc_type = MAC_SCC_II,
7ad93b42
LV
591 .nubus_type = MAC_NUBUS,
592 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
593 },
594
595 /*
596 * Centris - just guessing again; maybe like Quadra
597 */
598
599 /* The C610 may or may not have SONIC. We probe to make sure */
600 {
601 .ident = MAC_MODEL_C610,
602 .name = "Centris 610",
603 .adb_type = MAC_ADB_II,
604 .via_type = MAC_VIA_QUADRA,
605 .scsi_type = MAC_SCSI_QUADRA,
606 .scc_type = MAC_SCC_QUADRA,
607 .ether_type = MAC_ETHER_SONIC,
7ad93b42
LV
608 .nubus_type = MAC_NUBUS,
609 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
610 }, {
611 .ident = MAC_MODEL_C650,
612 .name = "Centris 650",
613 .adb_type = MAC_ADB_II,
614 .via_type = MAC_VIA_QUADRA,
615 .scsi_type = MAC_SCSI_QUADRA,
616 .scc_type = MAC_SCC_QUADRA,
617 .ether_type = MAC_ETHER_SONIC,
7ad93b42
LV
618 .nubus_type = MAC_NUBUS,
619 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
1da177e4
LT
620 }, {
621 .ident = MAC_MODEL_C660,
622 .name = "Centris 660AV",
623 .adb_type = MAC_ADB_CUDA,
624 .via_type = MAC_VIA_QUADRA,
625 .scsi_type = MAC_SCSI_QUADRA3,
626 .scc_type = MAC_SCC_PSC,
627 .ether_type = MAC_ETHER_MACE,
7ad93b42
LV
628 .nubus_type = MAC_NUBUS,
629 .floppy_type = MAC_FLOPPY_AV
1da177e4
LT
630 },
631
632 /*
633 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
634 * and a PMU (in two variations?) for ADB. Most of them use the
635 * Quadra-style VIAs. A few models also have IDE from hell.
636 */
637
638 {
639 .ident = MAC_MODEL_PB140,
640 .name = "PowerBook 140",
641 .adb_type = MAC_ADB_PB1,
642 .via_type = MAC_VIA_QUADRA,
643 .scsi_type = MAC_SCSI_OLD,
644 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
645 .nubus_type = MAC_NUBUS,
646 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
647 }, {
648 .ident = MAC_MODEL_PB145,
649 .name = "PowerBook 145",
650 .adb_type = MAC_ADB_PB1,
651 .via_type = MAC_VIA_QUADRA,
652 .scsi_type = MAC_SCSI_OLD,
653 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
654 .nubus_type = MAC_NUBUS,
655 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
656 }, {
657 .ident = MAC_MODEL_PB150,
658 .name = "PowerBook 150",
659 .adb_type = MAC_ADB_PB1,
660 .via_type = MAC_VIA_IIci,
661 .scsi_type = MAC_SCSI_OLD,
662 .ide_type = MAC_IDE_PB,
663 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
664 .nubus_type = MAC_NUBUS,
665 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
666 }, {
667 .ident = MAC_MODEL_PB160,
668 .name = "PowerBook 160",
669 .adb_type = MAC_ADB_PB1,
670 .via_type = MAC_VIA_QUADRA,
671 .scsi_type = MAC_SCSI_OLD,
672 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
673 .nubus_type = MAC_NUBUS,
674 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
675 }, {
676 .ident = MAC_MODEL_PB165,
677 .name = "PowerBook 165",
678 .adb_type = MAC_ADB_PB1,
679 .via_type = MAC_VIA_QUADRA,
680 .scsi_type = MAC_SCSI_OLD,
681 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
682 .nubus_type = MAC_NUBUS,
683 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
684 }, {
685 .ident = MAC_MODEL_PB165C,
686 .name = "PowerBook 165c",
687 .adb_type = MAC_ADB_PB1,
688 .via_type = MAC_VIA_QUADRA,
689 .scsi_type = MAC_SCSI_OLD,
690 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
691 .nubus_type = MAC_NUBUS,
692 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
693 }, {
694 .ident = MAC_MODEL_PB170,
695 .name = "PowerBook 170",
696 .adb_type = MAC_ADB_PB1,
697 .via_type = MAC_VIA_QUADRA,
698 .scsi_type = MAC_SCSI_OLD,
699 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
700 .nubus_type = MAC_NUBUS,
701 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
702 }, {
703 .ident = MAC_MODEL_PB180,
704 .name = "PowerBook 180",
705 .adb_type = MAC_ADB_PB1,
706 .via_type = MAC_VIA_QUADRA,
707 .scsi_type = MAC_SCSI_OLD,
708 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
709 .nubus_type = MAC_NUBUS,
710 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
711 }, {
712 .ident = MAC_MODEL_PB180C,
713 .name = "PowerBook 180c",
714 .adb_type = MAC_ADB_PB1,
715 .via_type = MAC_VIA_QUADRA,
716 .scsi_type = MAC_SCSI_OLD,
717 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
718 .nubus_type = MAC_NUBUS,
719 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
720 }, {
721 .ident = MAC_MODEL_PB190,
722 .name = "PowerBook 190",
723 .adb_type = MAC_ADB_PB2,
724 .via_type = MAC_VIA_QUADRA,
725 .scsi_type = MAC_SCSI_OLD,
726 .ide_type = MAC_IDE_BABOON,
727 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
728 .nubus_type = MAC_NUBUS,
729 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
730 }, {
731 .ident = MAC_MODEL_PB520,
732 .name = "PowerBook 520",
733 .adb_type = MAC_ADB_PB2,
734 .via_type = MAC_VIA_QUADRA,
735 .scsi_type = MAC_SCSI_OLD,
736 .scc_type = MAC_SCC_QUADRA,
737 .ether_type = MAC_ETHER_SONIC,
7ad93b42
LV
738 .nubus_type = MAC_NUBUS,
739 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
740 },
741
742 /*
743 * PowerBook Duos are pretty much like normal PowerBooks
744 * All of these probably have onboard SONIC in the Dock which
745 * means we'll have to probe for it eventually.
746 *
0c79cf6a 747 * Are these really MAC_VIA_IIci? The developer notes for the
1da177e4
LT
748 * Duos show pretty much the same custom parts as in most of
749 * the other PowerBooks which would imply MAC_VIA_QUADRA.
750 */
751
752 {
753 .ident = MAC_MODEL_PB210,
754 .name = "PowerBook Duo 210",
755 .adb_type = MAC_ADB_PB2,
756 .via_type = MAC_VIA_IIci,
757 .scsi_type = MAC_SCSI_OLD,
758 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
759 .nubus_type = MAC_NUBUS,
760 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
761 }, {
762 .ident = MAC_MODEL_PB230,
763 .name = "PowerBook Duo 230",
764 .adb_type = MAC_ADB_PB2,
765 .via_type = MAC_VIA_IIci,
766 .scsi_type = MAC_SCSI_OLD,
767 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
768 .nubus_type = MAC_NUBUS,
769 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
770 }, {
771 .ident = MAC_MODEL_PB250,
772 .name = "PowerBook Duo 250",
773 .adb_type = MAC_ADB_PB2,
774 .via_type = MAC_VIA_IIci,
775 .scsi_type = MAC_SCSI_OLD,
776 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
777 .nubus_type = MAC_NUBUS,
778 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
779 }, {
780 .ident = MAC_MODEL_PB270C,
781 .name = "PowerBook Duo 270c",
782 .adb_type = MAC_ADB_PB2,
783 .via_type = MAC_VIA_IIci,
784 .scsi_type = MAC_SCSI_OLD,
785 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
786 .nubus_type = MAC_NUBUS,
787 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
788 }, {
789 .ident = MAC_MODEL_PB280,
790 .name = "PowerBook Duo 280",
791 .adb_type = MAC_ADB_PB2,
792 .via_type = MAC_VIA_IIci,
793 .scsi_type = MAC_SCSI_OLD,
794 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
795 .nubus_type = MAC_NUBUS,
796 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
797 }, {
798 .ident = MAC_MODEL_PB280C,
799 .name = "PowerBook Duo 280c",
800 .adb_type = MAC_ADB_PB2,
801 .via_type = MAC_VIA_IIci,
802 .scsi_type = MAC_SCSI_OLD,
803 .scc_type = MAC_SCC_QUADRA,
7ad93b42
LV
804 .nubus_type = MAC_NUBUS,
805 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
1da177e4
LT
806 },
807
808 /*
809 * Other stuff ??
810 */
811 {
812 .ident = -1
813 }
814};
815
8dfbdf4a 816static void __init mac_identify(void)
1da177e4
LT
817{
818 struct mac_model *m;
819
820 /* Penguin data useful? */
821 int model = mac_bi_data.id;
822 if (!model) {
823 /* no bootinfo model id -> NetBSD booter was used! */
824 /* XXX FIXME: breaks for model > 31 */
6ff5801a
RZ
825 model = (mac_bi_data.cpuid >> 2) & 63;
826 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
1da177e4
LT
827 }
828
829 macintosh_config = mac_data_table;
6ff5801a 830 for (m = macintosh_config; m->ident != -1; m++) {
1da177e4
LT
831 if (m->ident == model) {
832 macintosh_config = m;
833 break;
834 }
835 }
836
837 /* We need to pre-init the IOPs, if any. Otherwise */
838 /* the serial console won't work if the user had */
839 /* the serial ports set to "Faster" mode in MacOS. */
840
841 iop_preinit();
1da177e4 842
6ff5801a 843 printk(KERN_INFO "Detected Macintosh model: %d \n", model);
1da177e4
LT
844
845 /*
846 * Report booter data:
847 */
6ff5801a
RZ
848 printk(KERN_DEBUG " Penguin bootinfo data:\n");
849 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
1da177e4
LT
850 mac_bi_data.videoaddr, mac_bi_data.videorow,
851 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
852 mac_bi_data.dimensions >> 16);
6ff5801a 853 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
1da177e4
LT
854 mac_bi_data.videological, mac_orig_videoaddr,
855 mac_bi_data.sccbase);
6ff5801a 856 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
1da177e4 857 mac_bi_data.boottime, mac_bi_data.gmtbias);
6ff5801a 858 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
1da177e4 859 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
1da177e4 860
1da177e4
LT
861 iop_init();
862 via_init();
863 oss_init();
864 psc_init();
865 baboon_init();
866}
867
8dfbdf4a 868static void __init mac_report_hardware(void)
1da177e4
LT
869{
870 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
871}
872
873static void mac_get_model(char *str)
874{
6ff5801a 875 strcpy(str, "Macintosh ");
1da177e4
LT
876 strcat(str, macintosh_config->name);
877}
8852ecd9
LV
878
879static struct resource swim_resources[1];
880
881static struct platform_device swim_device = {
882 .name = "swim",
883 .id = -1,
884 .num_resources = ARRAY_SIZE(swim_resources),
885 .resource = swim_resources,
886};
887
888static struct platform_device *mac_platform_devices[] __initdata = {
889 &swim_device
890};
891
892int __init mac_platform_init(void)
893{
894 u8 *swim_base;
895
896 switch (macintosh_config->floppy_type) {
897 case MAC_FLOPPY_SWIM_ADDR1:
898 swim_base = (u8 *)(VIA1_BASE + 0x1E000);
899 break;
900 case MAC_FLOPPY_SWIM_ADDR2:
901 swim_base = (u8 *)(VIA1_BASE + 0x16000);
902 break;
903 default:
904 return 0;
905 }
906
907 swim_resources[0].name = "swim-regs";
908 swim_resources[0].start = (resource_size_t)swim_base;
909 swim_resources[0].end = (resource_size_t)(swim_base + SWIM_IO_SIZE);
910 swim_resources[0].flags = IORESOURCE_MEM;
911
912 return platform_add_devices(mac_platform_devices,
913 ARRAY_SIZE(mac_platform_devices));
914}
915
916arch_initcall(mac_platform_init);
This page took 0.463739 seconds and 5 git commands to generate.