blob: 8819b97be32401b096587de6dcdda41e504a1749 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/module.h>
14#include <linux/types.h>
15#include <linux/mm.h>
16#include <linux/tty.h>
17#include <linux/console.h>
18#include <linux/interrupt.h>
19/* keyb */
20#include <linux/random.h>
21#include <linux/delay.h>
22/* keyb */
23#include <linux/init.h>
24#include <linux/vt_kern.h>
25
26#define BOOTINFO_COMPAT_1_0
27#include <asm/setup.h>
28#include <asm/bootinfo.h>
29
30#include <asm/system.h>
31#include <asm/io.h>
32#include <asm/irq.h>
33#include <asm/pgtable.h>
34#include <asm/rtc.h>
35#include <asm/machdep.h>
36
37#include <asm/macintosh.h>
38#include <asm/macints.h>
39#include <asm/machw.h>
40
41#include <asm/mac_iop.h>
42#include <asm/mac_via.h>
43#include <asm/mac_oss.h>
44#include <asm/mac_psc.h>
45
46/* Mac bootinfo struct */
47
48struct mac_booter_data mac_bi_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Linus Torvalds1da177e2005-04-16 15:20:36 -070050/* New m68k bootinfo stuff and videobase */
51
52extern int m68k_num_memory;
53extern struct mem_info m68k_memory[NUM_MEMINFO];
54
55extern struct mem_info m68k_ramdisk;
56
Linus Torvalds1da177e2005-04-16 15:20:36 -070057/* The phys. video addr. - might be bogus on some machines */
Adrian Bunk8dfbdf42008-07-17 21:16:25 +020058static unsigned long mac_orig_videoaddr;
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
60/* Mac specific timer functions */
Roman Zippel6ff58012007-05-01 22:32:43 +020061extern unsigned long mac_gettimeoffset(void);
62extern int mac_hwclk(int, struct rtc_time *);
63extern int mac_set_clock_mmss(unsigned long);
Linus Torvalds1da177e2005-04-16 15:20:36 -070064extern int show_mac_interrupts(struct seq_file *, void *);
65extern void iop_preinit(void);
66extern void iop_init(void);
67extern void via_init(void);
David Howells40220c12006-10-09 12:19:47 +010068extern void via_init_clock(irq_handler_t func);
Linus Torvalds1da177e2005-04-16 15:20:36 -070069extern void via_flush_cache(void);
70extern void oss_init(void);
71extern void psc_init(void);
72extern void baboon_init(void);
73
74extern void mac_mksound(unsigned int, unsigned int);
75
76extern void nubus_sweep_video(void);
77
Linus Torvalds1da177e2005-04-16 15:20:36 -070078static void mac_get_model(char *str);
Adrian Bunk8dfbdf42008-07-17 21:16:25 +020079static void mac_identify(void);
80static void mac_report_hardware(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
Al Viro66a3f822007-07-20 04:33:28 +010082static void __init mac_sched_init(irq_handler_t vector)
Linus Torvalds1da177e2005-04-16 15:20:36 -070083{
84 via_init_clock(vector);
85}
86
Linus Torvalds1da177e2005-04-16 15:20:36 -070087/*
88 * Parse a Macintosh-specific record in the bootinfo
89 */
90
91int __init mac_parse_bootinfo(const struct bi_record *record)
92{
Roman Zippel6ff58012007-05-01 22:32:43 +020093 int unknown = 0;
94 const u_long *data = record->data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070095
Roman Zippel6ff58012007-05-01 22:32:43 +020096 switch (record->tag) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 case BI_MAC_MODEL:
Roman Zippel6ff58012007-05-01 22:32:43 +020098 mac_bi_data.id = *data;
99 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 case BI_MAC_VADDR:
Roman Zippel6ff58012007-05-01 22:32:43 +0200101 mac_bi_data.videoaddr = *data;
102 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 case BI_MAC_VDEPTH:
Roman Zippel6ff58012007-05-01 22:32:43 +0200104 mac_bi_data.videodepth = *data;
105 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 case BI_MAC_VROW:
Roman Zippel6ff58012007-05-01 22:32:43 +0200107 mac_bi_data.videorow = *data;
108 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 case BI_MAC_VDIM:
Roman Zippel6ff58012007-05-01 22:32:43 +0200110 mac_bi_data.dimensions = *data;
111 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112 case BI_MAC_VLOGICAL:
Roman Zippel6ff58012007-05-01 22:32:43 +0200113 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
114 mac_orig_videoaddr = *data;
115 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 case BI_MAC_SCCBASE:
Roman Zippel6ff58012007-05-01 22:32:43 +0200117 mac_bi_data.sccbase = *data;
118 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 case BI_MAC_BTIME:
Roman Zippel6ff58012007-05-01 22:32:43 +0200120 mac_bi_data.boottime = *data;
121 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 case BI_MAC_GMTBIAS:
Roman Zippel6ff58012007-05-01 22:32:43 +0200123 mac_bi_data.gmtbias = *data;
124 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125 case BI_MAC_MEMSIZE:
Roman Zippel6ff58012007-05-01 22:32:43 +0200126 mac_bi_data.memsize = *data;
127 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128 case BI_MAC_CPUID:
Roman Zippel6ff58012007-05-01 22:32:43 +0200129 mac_bi_data.cpuid = *data;
130 break;
131 case BI_MAC_ROMBASE:
132 mac_bi_data.rombase = *data;
133 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134 default:
Roman Zippel6ff58012007-05-01 22:32:43 +0200135 unknown = 1;
136 break;
137 }
138 return unknown;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139}
140
141/*
142 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
143 * have to disable interrupts for this. Our IRQ handlers will crap
144 * themselves if they take an IRQ in 24bit mode!
145 */
146
147static void mac_cache_card_flush(int writeback)
148{
149 unsigned long flags;
Roman Zippel6ff58012007-05-01 22:32:43 +0200150
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 local_irq_save(flags);
152 via_flush_cache();
153 local_irq_restore(flags);
154}
155
156void __init config_mac(void)
157{
Roman Zippel6ff58012007-05-01 22:32:43 +0200158 if (!MACH_IS_MAC)
159 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160
Roman Zippel6ff58012007-05-01 22:32:43 +0200161 mach_sched_init = mac_sched_init;
162 mach_init_IRQ = mac_init_IRQ;
163 mach_get_model = mac_get_model;
164 mach_gettimeoffset = mac_gettimeoffset;
Roman Zippel6ff58012007-05-01 22:32:43 +0200165 mach_hwclk = mac_hwclk;
Roman Zippel6ff58012007-05-01 22:32:43 +0200166 mach_set_clock_mmss = mac_set_clock_mmss;
167 mach_reset = mac_reset;
168 mach_halt = mac_poweroff;
169 mach_power_off = mac_poweroff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 mach_max_dma_address = 0xffffffff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
Roman Zippel6ff58012007-05-01 22:32:43 +0200172 mach_beep = mac_mksound;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173#endif
174#ifdef CONFIG_HEARTBEAT
175#if 0
176 mach_heartbeat = mac_heartbeat;
177 mach_heartbeat_irq = IRQ_MAC_TIMER;
178#endif
179#endif
180
181 /*
182 * Determine hardware present
183 */
184
185 mac_identify();
186 mac_report_hardware();
187
Roman Zippel6ff58012007-05-01 22:32:43 +0200188 /*
189 * AFAIK only the IIci takes a cache card. The IIfx has onboard
190 * cache ... someone needs to figure out how to tell if it's on or
191 * not.
192 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193
194 if (macintosh_config->ident == MAC_MODEL_IICI
Roman Zippel6ff58012007-05-01 22:32:43 +0200195 || macintosh_config->ident == MAC_MODEL_IIFX)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196 mach_l2_flush = mac_cache_card_flush;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197
198 /*
199 * Check for machine specific fixups.
200 */
201
202#ifdef OLD_NUBUS_CODE
Roman Zippel6ff58012007-05-01 22:32:43 +0200203 nubus_sweep_video();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204#endif
205}
206
207
208/*
209 * Macintosh Table: hardcoded model configuration data.
210 *
211 * Much of this was defined by Alan, based on who knows what docs.
212 * I've added a lot more, and some of that was pure guesswork based
213 * on hardware pages present on the Mac web site. Possibly wildly
214 * inaccurate, so look here if a new Mac model won't run. Example: if
215 * a Mac crashes immediately after the VIA1 registers have been dumped
216 * to the screen, it probably died attempting to read DirB on a RBV.
217 * Meaning it should have MAC_VIA_IIci here :-)
218 */
219
220struct mac_model *macintosh_config;
221EXPORT_SYMBOL(macintosh_config);
222
Roman Zippel6ff58012007-05-01 22:32:43 +0200223static struct mac_model mac_data_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 /*
225 * We'll pretend to be a Macintosh II, that's pretty safe.
226 */
227
228 {
229 .ident = MAC_MODEL_II,
230 .name = "Unknown",
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 .nubus_type = MAC_NUBUS
236 },
237
238 /*
239 * Original MacII hardware
240 *
241 */
242
243 {
244 .ident = MAC_MODEL_II,
245 .name = "II",
246 .adb_type = MAC_ADB_II,
247 .via_type = MAC_VIA_II,
248 .scsi_type = MAC_SCSI_OLD,
249 .scc_type = MAC_SCC_II,
250 .nubus_type = MAC_NUBUS
251 }, {
252 .ident = MAC_MODEL_IIX,
253 .name = "IIx",
254 .adb_type = MAC_ADB_II,
255 .via_type = MAC_VIA_II,
256 .scsi_type = MAC_SCSI_OLD,
257 .scc_type = MAC_SCC_II,
258 .nubus_type = MAC_NUBUS
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,
266 .nubus_type = MAC_NUBUS
267 }, {
268 .ident = MAC_MODEL_SE30,
269 .name = "SE/30",
270 .adb_type = MAC_ADB_II,
271 .via_type = MAC_VIA_II,
272 .scsi_type = MAC_SCSI_OLD,
273 .scc_type = MAC_SCC_II,
274 .nubus_type = MAC_NUBUS
275 },
276
277 /*
Simon Arlott0c79cf62007-10-20 01:20:32 +0200278 * Weirdified MacII hardware - all subtly different. Gee thanks
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 * Apple. All these boxes seem to have VIA2 in a different place to
280 * the MacII (+1A000 rather than +4000)
281 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
282 */
283
284 {
285 .ident = MAC_MODEL_IICI,
286 .name = "IIci",
287 .adb_type = MAC_ADB_II,
288 .via_type = MAC_VIA_IIci,
289 .scsi_type = MAC_SCSI_OLD,
290 .scc_type = MAC_SCC_II,
291 .nubus_type = MAC_NUBUS
292 }, {
293 .ident = MAC_MODEL_IIFX,
294 .name = "IIfx",
295 .adb_type = MAC_ADB_IOP,
296 .via_type = MAC_VIA_IIci,
297 .scsi_type = MAC_SCSI_OLD,
298 .scc_type = MAC_SCC_IOP,
299 .nubus_type = MAC_NUBUS
300 }, {
301 .ident = MAC_MODEL_IISI,
302 .name = "IIsi",
303 .adb_type = MAC_ADB_IISI,
304 .via_type = MAC_VIA_IIci,
305 .scsi_type = MAC_SCSI_OLD,
306 .scc_type = MAC_SCC_II,
307 .nubus_type = MAC_NUBUS
308 }, {
309 .ident = MAC_MODEL_IIVI,
310 .name = "IIvi",
311 .adb_type = MAC_ADB_IISI,
312 .via_type = MAC_VIA_IIci,
313 .scsi_type = MAC_SCSI_OLD,
314 .scc_type = MAC_SCC_II,
315 .nubus_type = MAC_NUBUS
316 }, {
317 .ident = MAC_MODEL_IIVX,
318 .name = "IIvx",
319 .adb_type = MAC_ADB_IISI,
320 .via_type = MAC_VIA_IIci,
321 .scsi_type = MAC_SCSI_OLD,
322 .scc_type = MAC_SCC_II,
323 .nubus_type = MAC_NUBUS
324 },
325
326 /*
327 * Classic models (guessing: similar to SE/30 ?? Nope, similar to LC ...)
328 */
329
330 {
331 .ident = MAC_MODEL_CLII,
332 .name = "Classic II",
333 .adb_type = MAC_ADB_IISI,
334 .via_type = MAC_VIA_IIci,
335 .scsi_type = MAC_SCSI_OLD,
336 .scc_type = MAC_SCC_II,
337 .nubus_type = MAC_NUBUS
338 }, {
339 .ident = MAC_MODEL_CCL,
340 .name = "Color Classic",
341 .adb_type = MAC_ADB_CUDA,
342 .via_type = MAC_VIA_IIci,
343 .scsi_type = MAC_SCSI_OLD,
344 .scc_type = MAC_SCC_II,
345 .nubus_type = MAC_NUBUS},
346
347 /*
348 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
349 */
350
351 {
352 .ident = MAC_MODEL_LC,
353 .name = "LC",
354 .adb_type = MAC_ADB_IISI,
355 .via_type = MAC_VIA_IIci,
356 .scsi_type = MAC_SCSI_OLD,
357 .scc_type = MAC_SCC_II,
358 .nubus_type = MAC_NUBUS
359 }, {
360 .ident = MAC_MODEL_LCII,
361 .name = "LC II",
362 .adb_type = MAC_ADB_IISI,
363 .via_type = MAC_VIA_IIci,
364 .scsi_type = MAC_SCSI_OLD,
365 .scc_type = MAC_SCC_II,
366 .nubus_type = MAC_NUBUS
367 }, {
368 .ident = MAC_MODEL_LCIII,
369 .name = "LC III",
370 .adb_type = MAC_ADB_IISI,
371 .via_type = MAC_VIA_IIci,
372 .scsi_type = MAC_SCSI_OLD,
373 .scc_type = MAC_SCC_II,
374 .nubus_type = MAC_NUBUS
375 },
376
377 /*
378 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it differently
379 * as some of the stuff connected to VIA2 seems different. Better SCSI chip and
380 * onboard ethernet using a NatSemi SONIC except the 660AV and 840AV which use an
381 * AMD 79C940 (MACE).
382 * The 700, 900 and 950 have some I/O chips in the wrong place to
383 * confuse us. The 840AV has a SCSI location of its own (same as
384 * the 660AV).
385 */
386
387 {
388 .ident = MAC_MODEL_Q605,
389 .name = "Quadra 605",
390 .adb_type = MAC_ADB_CUDA,
391 .via_type = MAC_VIA_QUADRA,
392 .scsi_type = MAC_SCSI_QUADRA,
393 .scc_type = MAC_SCC_QUADRA,
394 .nubus_type = MAC_NUBUS
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 .nubus_type = MAC_NUBUS
403 }, {
404 .ident = MAC_MODEL_Q610,
405 .name = "Quadra 610",
406 .adb_type = MAC_ADB_II,
407 .via_type = MAC_VIA_QUADRA,
408 .scsi_type = MAC_SCSI_QUADRA,
409 .scc_type = MAC_SCC_QUADRA,
410 .ether_type = MAC_ETHER_SONIC,
411 .nubus_type = MAC_NUBUS
412 }, {
413 .ident = MAC_MODEL_Q630,
414 .name = "Quadra 630",
415 .adb_type = MAC_ADB_CUDA,
416 .via_type = MAC_VIA_QUADRA,
417 .scsi_type = MAC_SCSI_QUADRA,
418 .ide_type = MAC_IDE_QUADRA,
419 .scc_type = MAC_SCC_QUADRA,
420 .ether_type = MAC_ETHER_SONIC,
421 .nubus_type = MAC_NUBUS
422 }, {
423 .ident = MAC_MODEL_Q650,
424 .name = "Quadra 650",
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 .nubus_type = MAC_NUBUS
431 },
432 /* The Q700 does have a NS Sonic */
433 {
434 .ident = MAC_MODEL_Q700,
435 .name = "Quadra 700",
436 .adb_type = MAC_ADB_II,
437 .via_type = MAC_VIA_QUADRA,
438 .scsi_type = MAC_SCSI_QUADRA2,
439 .scc_type = MAC_SCC_QUADRA,
440 .ether_type = MAC_ETHER_SONIC,
441 .nubus_type = MAC_NUBUS
442 }, {
443 .ident = MAC_MODEL_Q800,
444 .name = "Quadra 800",
445 .adb_type = MAC_ADB_II,
446 .via_type = MAC_VIA_QUADRA,
447 .scsi_type = MAC_SCSI_QUADRA,
448 .scc_type = MAC_SCC_QUADRA,
449 .ether_type = MAC_ETHER_SONIC,
450 .nubus_type = MAC_NUBUS
451 }, {
452 .ident = MAC_MODEL_Q840,
453 .name = "Quadra 840AV",
454 .adb_type = MAC_ADB_CUDA,
455 .via_type = MAC_VIA_QUADRA,
456 .scsi_type = MAC_SCSI_QUADRA3,
457 .scc_type = MAC_SCC_PSC,
458 .ether_type = MAC_ETHER_MACE,
459 .nubus_type = MAC_NUBUS
460 }, {
461 .ident = MAC_MODEL_Q900,
462 .name = "Quadra 900",
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 .nubus_type = MAC_NUBUS
469 }, {
470 .ident = MAC_MODEL_Q950,
471 .name = "Quadra 950",
472 .adb_type = MAC_ADB_IOP,
473 .via_type = MAC_VIA_QUADRA,
474 .scsi_type = MAC_SCSI_QUADRA2,
475 .scc_type = MAC_SCC_IOP,
476 .ether_type = MAC_ETHER_SONIC,
477 .nubus_type = MAC_NUBUS
478 },
479
480 /*
481 * Performa - more LC type machines
482 */
483
484 {
485 .ident = MAC_MODEL_P460,
486 .name = "Performa 460",
487 .adb_type = MAC_ADB_IISI,
488 .via_type = MAC_VIA_IIci,
489 .scsi_type = MAC_SCSI_OLD,
490 .scc_type = MAC_SCC_II,
491 .nubus_type = MAC_NUBUS
492 }, {
493 .ident = MAC_MODEL_P475,
494 .name = "Performa 475",
495 .adb_type = MAC_ADB_CUDA,
496 .via_type = MAC_VIA_QUADRA,
497 .scsi_type = MAC_SCSI_QUADRA,
498 .scc_type = MAC_SCC_II,
499 .nubus_type = MAC_NUBUS
500 }, {
501 .ident = MAC_MODEL_P475F,
502 .name = "Performa 475",
503 .adb_type = MAC_ADB_CUDA,
504 .via_type = MAC_VIA_QUADRA,
505 .scsi_type = MAC_SCSI_QUADRA,
506 .scc_type = MAC_SCC_II,
507 .nubus_type = MAC_NUBUS
508 }, {
509 .ident = MAC_MODEL_P520,
510 .name = "Performa 520",
511 .adb_type = MAC_ADB_CUDA,
512 .via_type = MAC_VIA_IIci,
513 .scsi_type = MAC_SCSI_OLD,
514 .scc_type = MAC_SCC_II,
515 .nubus_type = MAC_NUBUS
516 }, {
517 .ident = MAC_MODEL_P550,
518 .name = "Performa 550",
519 .adb_type = MAC_ADB_CUDA,
520 .via_type = MAC_VIA_IIci,
521 .scsi_type = MAC_SCSI_OLD,
522 .scc_type = MAC_SCC_II,
523 .nubus_type = MAC_NUBUS
524 },
525 /* These have the comm slot, and therefore the possibility of SONIC ethernet */
526 {
527 .ident = MAC_MODEL_P575,
528 .name = "Performa 575",
529 .adb_type = MAC_ADB_CUDA,
530 .via_type = MAC_VIA_QUADRA,
531 .scsi_type = MAC_SCSI_QUADRA,
532 .scc_type = MAC_SCC_II,
533 .ether_type = MAC_ETHER_SONIC,
534 .nubus_type = MAC_NUBUS
535 }, {
536 .ident = MAC_MODEL_P588,
537 .name = "Performa 588",
538 .adb_type = MAC_ADB_CUDA,
539 .via_type = MAC_VIA_QUADRA,
540 .scsi_type = MAC_SCSI_QUADRA,
541 .ide_type = MAC_IDE_QUADRA,
542 .scc_type = MAC_SCC_II,
543 .ether_type = MAC_ETHER_SONIC,
544 .nubus_type = MAC_NUBUS
545 }, {
546 .ident = MAC_MODEL_TV,
547 .name = "TV",
548 .adb_type = MAC_ADB_CUDA,
549 .via_type = MAC_VIA_QUADRA,
550 .scsi_type = MAC_SCSI_OLD,
551 .scc_type = MAC_SCC_II,
552 .nubus_type = MAC_NUBUS
553 }, {
554 .ident = MAC_MODEL_P600,
555 .name = "Performa 600",
556 .adb_type = MAC_ADB_IISI,
557 .via_type = MAC_VIA_IIci,
558 .scsi_type = MAC_SCSI_OLD,
559 .scc_type = MAC_SCC_II,
560 .nubus_type = MAC_NUBUS
561 },
562
563 /*
564 * Centris - just guessing again; maybe like Quadra
565 */
566
567 /* The C610 may or may not have SONIC. We probe to make sure */
568 {
569 .ident = MAC_MODEL_C610,
570 .name = "Centris 610",
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 .nubus_type = MAC_NUBUS
577 }, {
578 .ident = MAC_MODEL_C650,
579 .name = "Centris 650",
580 .adb_type = MAC_ADB_II,
581 .via_type = MAC_VIA_QUADRA,
582 .scsi_type = MAC_SCSI_QUADRA,
583 .scc_type = MAC_SCC_QUADRA,
584 .ether_type = MAC_ETHER_SONIC,
585 .nubus_type = MAC_NUBUS
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 .nubus_type = MAC_NUBUS
595 },
596
597 /*
598 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
599 * and a PMU (in two variations?) for ADB. Most of them use the
600 * Quadra-style VIAs. A few models also have IDE from hell.
601 */
602
603 {
604 .ident = MAC_MODEL_PB140,
605 .name = "PowerBook 140",
606 .adb_type = MAC_ADB_PB1,
607 .via_type = MAC_VIA_QUADRA,
608 .scsi_type = MAC_SCSI_OLD,
609 .scc_type = MAC_SCC_QUADRA,
610 .nubus_type = MAC_NUBUS
611 }, {
612 .ident = MAC_MODEL_PB145,
613 .name = "PowerBook 145",
614 .adb_type = MAC_ADB_PB1,
615 .via_type = MAC_VIA_QUADRA,
616 .scsi_type = MAC_SCSI_OLD,
617 .scc_type = MAC_SCC_QUADRA,
618 .nubus_type = MAC_NUBUS
619 }, {
620 .ident = MAC_MODEL_PB150,
621 .name = "PowerBook 150",
622 .adb_type = MAC_ADB_PB1,
623 .via_type = MAC_VIA_IIci,
624 .scsi_type = MAC_SCSI_OLD,
625 .ide_type = MAC_IDE_PB,
626 .scc_type = MAC_SCC_QUADRA,
627 .nubus_type = MAC_NUBUS
628 }, {
629 .ident = MAC_MODEL_PB160,
630 .name = "PowerBook 160",
631 .adb_type = MAC_ADB_PB1,
632 .via_type = MAC_VIA_QUADRA,
633 .scsi_type = MAC_SCSI_OLD,
634 .scc_type = MAC_SCC_QUADRA,
635 .nubus_type = MAC_NUBUS
636 }, {
637 .ident = MAC_MODEL_PB165,
638 .name = "PowerBook 165",
639 .adb_type = MAC_ADB_PB1,
640 .via_type = MAC_VIA_QUADRA,
641 .scsi_type = MAC_SCSI_OLD,
642 .scc_type = MAC_SCC_QUADRA,
643 .nubus_type = MAC_NUBUS
644 }, {
645 .ident = MAC_MODEL_PB165C,
646 .name = "PowerBook 165c",
647 .adb_type = MAC_ADB_PB1,
648 .via_type = MAC_VIA_QUADRA,
649 .scsi_type = MAC_SCSI_OLD,
650 .scc_type = MAC_SCC_QUADRA,
651 .nubus_type = MAC_NUBUS
652 }, {
653 .ident = MAC_MODEL_PB170,
654 .name = "PowerBook 170",
655 .adb_type = MAC_ADB_PB1,
656 .via_type = MAC_VIA_QUADRA,
657 .scsi_type = MAC_SCSI_OLD,
658 .scc_type = MAC_SCC_QUADRA,
659 .nubus_type = MAC_NUBUS
660 }, {
661 .ident = MAC_MODEL_PB180,
662 .name = "PowerBook 180",
663 .adb_type = MAC_ADB_PB1,
664 .via_type = MAC_VIA_QUADRA,
665 .scsi_type = MAC_SCSI_OLD,
666 .scc_type = MAC_SCC_QUADRA,
667 .nubus_type = MAC_NUBUS
668 }, {
669 .ident = MAC_MODEL_PB180C,
670 .name = "PowerBook 180c",
671 .adb_type = MAC_ADB_PB1,
672 .via_type = MAC_VIA_QUADRA,
673 .scsi_type = MAC_SCSI_OLD,
674 .scc_type = MAC_SCC_QUADRA,
675 .nubus_type = MAC_NUBUS
676 }, {
677 .ident = MAC_MODEL_PB190,
678 .name = "PowerBook 190",
679 .adb_type = MAC_ADB_PB2,
680 .via_type = MAC_VIA_QUADRA,
681 .scsi_type = MAC_SCSI_OLD,
682 .ide_type = MAC_IDE_BABOON,
683 .scc_type = MAC_SCC_QUADRA,
684 .nubus_type = MAC_NUBUS
685 }, {
686 .ident = MAC_MODEL_PB520,
687 .name = "PowerBook 520",
688 .adb_type = MAC_ADB_PB2,
689 .via_type = MAC_VIA_QUADRA,
690 .scsi_type = MAC_SCSI_OLD,
691 .scc_type = MAC_SCC_QUADRA,
692 .ether_type = MAC_ETHER_SONIC,
693 .nubus_type = MAC_NUBUS
694 },
695
696 /*
697 * PowerBook Duos are pretty much like normal PowerBooks
698 * All of these probably have onboard SONIC in the Dock which
699 * means we'll have to probe for it eventually.
700 *
Simon Arlott0c79cf62007-10-20 01:20:32 +0200701 * Are these really MAC_VIA_IIci? The developer notes for the
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 * Duos show pretty much the same custom parts as in most of
703 * the other PowerBooks which would imply MAC_VIA_QUADRA.
704 */
705
706 {
707 .ident = MAC_MODEL_PB210,
708 .name = "PowerBook Duo 210",
709 .adb_type = MAC_ADB_PB2,
710 .via_type = MAC_VIA_IIci,
711 .scsi_type = MAC_SCSI_OLD,
712 .scc_type = MAC_SCC_QUADRA,
713 .nubus_type = MAC_NUBUS
714 }, {
715 .ident = MAC_MODEL_PB230,
716 .name = "PowerBook Duo 230",
717 .adb_type = MAC_ADB_PB2,
718 .via_type = MAC_VIA_IIci,
719 .scsi_type = MAC_SCSI_OLD,
720 .scc_type = MAC_SCC_QUADRA,
721 .nubus_type = MAC_NUBUS
722 }, {
723 .ident = MAC_MODEL_PB250,
724 .name = "PowerBook Duo 250",
725 .adb_type = MAC_ADB_PB2,
726 .via_type = MAC_VIA_IIci,
727 .scsi_type = MAC_SCSI_OLD,
728 .scc_type = MAC_SCC_QUADRA,
729 .nubus_type = MAC_NUBUS
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_OLD,
736 .scc_type = MAC_SCC_QUADRA,
737 .nubus_type = MAC_NUBUS
738 }, {
739 .ident = MAC_MODEL_PB280,
740 .name = "PowerBook Duo 280",
741 .adb_type = MAC_ADB_PB2,
742 .via_type = MAC_VIA_IIci,
743 .scsi_type = MAC_SCSI_OLD,
744 .scc_type = MAC_SCC_QUADRA,
745 .nubus_type = MAC_NUBUS
746 }, {
747 .ident = MAC_MODEL_PB280C,
748 .name = "PowerBook Duo 280c",
749 .adb_type = MAC_ADB_PB2,
750 .via_type = MAC_VIA_IIci,
751 .scsi_type = MAC_SCSI_OLD,
752 .scc_type = MAC_SCC_QUADRA,
753 .nubus_type = MAC_NUBUS
754 },
755
756 /*
757 * Other stuff ??
758 */
759 {
760 .ident = -1
761 }
762};
763
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200764static void __init mac_identify(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765{
766 struct mac_model *m;
767
768 /* Penguin data useful? */
769 int model = mac_bi_data.id;
770 if (!model) {
771 /* no bootinfo model id -> NetBSD booter was used! */
772 /* XXX FIXME: breaks for model > 31 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200773 model = (mac_bi_data.cpuid >> 2) & 63;
774 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700775 }
776
777 macintosh_config = mac_data_table;
Roman Zippel6ff58012007-05-01 22:32:43 +0200778 for (m = macintosh_config; m->ident != -1; m++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779 if (m->ident == model) {
780 macintosh_config = m;
781 break;
782 }
783 }
784
785 /* We need to pre-init the IOPs, if any. Otherwise */
786 /* the serial console won't work if the user had */
787 /* the serial ports set to "Faster" mode in MacOS. */
788
789 iop_preinit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700790
Roman Zippel6ff58012007-05-01 22:32:43 +0200791 printk(KERN_INFO "Detected Macintosh model: %d \n", model);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700792
793 /*
794 * Report booter data:
795 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200796 printk(KERN_DEBUG " Penguin bootinfo data:\n");
797 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700798 mac_bi_data.videoaddr, mac_bi_data.videorow,
799 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
800 mac_bi_data.dimensions >> 16);
Roman Zippel6ff58012007-05-01 22:32:43 +0200801 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802 mac_bi_data.videological, mac_orig_videoaddr,
803 mac_bi_data.sccbase);
Roman Zippel6ff58012007-05-01 22:32:43 +0200804 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700805 mac_bi_data.boottime, mac_bi_data.gmtbias);
Roman Zippel6ff58012007-05-01 22:32:43 +0200806 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
808#if 0
Roman Zippel6ff58012007-05-01 22:32:43 +0200809 printk("Ramdisk: addr 0x%lx size 0x%lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700810 m68k_ramdisk.addr, m68k_ramdisk.size);
811#endif
812
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813 iop_init();
814 via_init();
815 oss_init();
816 psc_init();
817 baboon_init();
818}
819
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200820static void __init mac_report_hardware(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700821{
822 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
823}
824
825static void mac_get_model(char *str)
826{
Roman Zippel6ff58012007-05-01 22:32:43 +0200827 strcpy(str, "Macintosh ");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700828 strcat(str, macintosh_config->name);
829}