blob: c45e18449f321b820f08dc12409dfadc0083cf60 [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;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165#warning move to adb/via init
166#if 0
Roman Zippel6ff58012007-05-01 22:32:43 +0200167 mach_hwclk = mac_hwclk;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168#endif
Roman Zippel6ff58012007-05-01 22:32:43 +0200169 mach_set_clock_mmss = mac_set_clock_mmss;
170 mach_reset = mac_reset;
171 mach_halt = mac_poweroff;
172 mach_power_off = mac_poweroff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 mach_max_dma_address = 0xffffffff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
Roman Zippel6ff58012007-05-01 22:32:43 +0200175 mach_beep = mac_mksound;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176#endif
177#ifdef CONFIG_HEARTBEAT
178#if 0
179 mach_heartbeat = mac_heartbeat;
180 mach_heartbeat_irq = IRQ_MAC_TIMER;
181#endif
182#endif
183
184 /*
185 * Determine hardware present
186 */
187
188 mac_identify();
189 mac_report_hardware();
190
Roman Zippel6ff58012007-05-01 22:32:43 +0200191 /*
192 * AFAIK only the IIci takes a cache card. The IIfx has onboard
193 * cache ... someone needs to figure out how to tell if it's on or
194 * not.
195 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196
197 if (macintosh_config->ident == MAC_MODEL_IICI
Roman Zippel6ff58012007-05-01 22:32:43 +0200198 || macintosh_config->ident == MAC_MODEL_IIFX)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199 mach_l2_flush = mac_cache_card_flush;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200
201 /*
202 * Check for machine specific fixups.
203 */
204
205#ifdef OLD_NUBUS_CODE
Roman Zippel6ff58012007-05-01 22:32:43 +0200206 nubus_sweep_video();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207#endif
208}
209
210
211/*
212 * Macintosh Table: hardcoded model configuration data.
213 *
214 * Much of this was defined by Alan, based on who knows what docs.
215 * I've added a lot more, and some of that was pure guesswork based
216 * on hardware pages present on the Mac web site. Possibly wildly
217 * inaccurate, so look here if a new Mac model won't run. Example: if
218 * a Mac crashes immediately after the VIA1 registers have been dumped
219 * to the screen, it probably died attempting to read DirB on a RBV.
220 * Meaning it should have MAC_VIA_IIci here :-)
221 */
222
223struct mac_model *macintosh_config;
224EXPORT_SYMBOL(macintosh_config);
225
Roman Zippel6ff58012007-05-01 22:32:43 +0200226static struct mac_model mac_data_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 /*
228 * We'll pretend to be a Macintosh II, that's pretty safe.
229 */
230
231 {
232 .ident = MAC_MODEL_II,
233 .name = "Unknown",
234 .adb_type = MAC_ADB_II,
235 .via_type = MAC_VIA_II,
236 .scsi_type = MAC_SCSI_OLD,
237 .scc_type = MAC_SCC_II,
238 .nubus_type = MAC_NUBUS
239 },
240
241 /*
242 * Original MacII hardware
243 *
244 */
245
246 {
247 .ident = MAC_MODEL_II,
248 .name = "II",
249 .adb_type = MAC_ADB_II,
250 .via_type = MAC_VIA_II,
251 .scsi_type = MAC_SCSI_OLD,
252 .scc_type = MAC_SCC_II,
253 .nubus_type = MAC_NUBUS
254 }, {
255 .ident = MAC_MODEL_IIX,
256 .name = "IIx",
257 .adb_type = MAC_ADB_II,
258 .via_type = MAC_VIA_II,
259 .scsi_type = MAC_SCSI_OLD,
260 .scc_type = MAC_SCC_II,
261 .nubus_type = MAC_NUBUS
262 }, {
263 .ident = MAC_MODEL_IICX,
264 .name = "IIcx",
265 .adb_type = MAC_ADB_II,
266 .via_type = MAC_VIA_II,
267 .scsi_type = MAC_SCSI_OLD,
268 .scc_type = MAC_SCC_II,
269 .nubus_type = MAC_NUBUS
270 }, {
271 .ident = MAC_MODEL_SE30,
272 .name = "SE/30",
273 .adb_type = MAC_ADB_II,
274 .via_type = MAC_VIA_II,
275 .scsi_type = MAC_SCSI_OLD,
276 .scc_type = MAC_SCC_II,
277 .nubus_type = MAC_NUBUS
278 },
279
280 /*
Simon Arlott0c79cf62007-10-20 01:20:32 +0200281 * Weirdified MacII hardware - all subtly different. Gee thanks
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282 * Apple. All these boxes seem to have VIA2 in a different place to
283 * the MacII (+1A000 rather than +4000)
284 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
285 */
286
287 {
288 .ident = MAC_MODEL_IICI,
289 .name = "IIci",
290 .adb_type = MAC_ADB_II,
291 .via_type = MAC_VIA_IIci,
292 .scsi_type = MAC_SCSI_OLD,
293 .scc_type = MAC_SCC_II,
294 .nubus_type = MAC_NUBUS
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,
302 .nubus_type = MAC_NUBUS
303 }, {
304 .ident = MAC_MODEL_IISI,
305 .name = "IIsi",
306 .adb_type = MAC_ADB_IISI,
307 .via_type = MAC_VIA_IIci,
308 .scsi_type = MAC_SCSI_OLD,
309 .scc_type = MAC_SCC_II,
310 .nubus_type = MAC_NUBUS
311 }, {
312 .ident = MAC_MODEL_IIVI,
313 .name = "IIvi",
314 .adb_type = MAC_ADB_IISI,
315 .via_type = MAC_VIA_IIci,
316 .scsi_type = MAC_SCSI_OLD,
317 .scc_type = MAC_SCC_II,
318 .nubus_type = MAC_NUBUS
319 }, {
320 .ident = MAC_MODEL_IIVX,
321 .name = "IIvx",
322 .adb_type = MAC_ADB_IISI,
323 .via_type = MAC_VIA_IIci,
324 .scsi_type = MAC_SCSI_OLD,
325 .scc_type = MAC_SCC_II,
326 .nubus_type = MAC_NUBUS
327 },
328
329 /*
330 * Classic models (guessing: similar to SE/30 ?? Nope, similar to LC ...)
331 */
332
333 {
334 .ident = MAC_MODEL_CLII,
335 .name = "Classic II",
336 .adb_type = MAC_ADB_IISI,
337 .via_type = MAC_VIA_IIci,
338 .scsi_type = MAC_SCSI_OLD,
339 .scc_type = MAC_SCC_II,
340 .nubus_type = MAC_NUBUS
341 }, {
342 .ident = MAC_MODEL_CCL,
343 .name = "Color Classic",
344 .adb_type = MAC_ADB_CUDA,
345 .via_type = MAC_VIA_IIci,
346 .scsi_type = MAC_SCSI_OLD,
347 .scc_type = MAC_SCC_II,
348 .nubus_type = MAC_NUBUS},
349
350 /*
351 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
352 */
353
354 {
355 .ident = MAC_MODEL_LC,
356 .name = "LC",
357 .adb_type = MAC_ADB_IISI,
358 .via_type = MAC_VIA_IIci,
359 .scsi_type = MAC_SCSI_OLD,
360 .scc_type = MAC_SCC_II,
361 .nubus_type = MAC_NUBUS
362 }, {
363 .ident = MAC_MODEL_LCII,
364 .name = "LC II",
365 .adb_type = MAC_ADB_IISI,
366 .via_type = MAC_VIA_IIci,
367 .scsi_type = MAC_SCSI_OLD,
368 .scc_type = MAC_SCC_II,
369 .nubus_type = MAC_NUBUS
370 }, {
371 .ident = MAC_MODEL_LCIII,
372 .name = "LC III",
373 .adb_type = MAC_ADB_IISI,
374 .via_type = MAC_VIA_IIci,
375 .scsi_type = MAC_SCSI_OLD,
376 .scc_type = MAC_SCC_II,
377 .nubus_type = MAC_NUBUS
378 },
379
380 /*
381 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it differently
382 * as some of the stuff connected to VIA2 seems different. Better SCSI chip and
383 * onboard ethernet using a NatSemi SONIC except the 660AV and 840AV which use an
384 * AMD 79C940 (MACE).
385 * The 700, 900 and 950 have some I/O chips in the wrong place to
386 * confuse us. The 840AV has a SCSI location of its own (same as
387 * the 660AV).
388 */
389
390 {
391 .ident = MAC_MODEL_Q605,
392 .name = "Quadra 605",
393 .adb_type = MAC_ADB_CUDA,
394 .via_type = MAC_VIA_QUADRA,
395 .scsi_type = MAC_SCSI_QUADRA,
396 .scc_type = MAC_SCC_QUADRA,
397 .nubus_type = MAC_NUBUS
398 }, {
399 .ident = MAC_MODEL_Q605_ACC,
400 .name = "Quadra 605",
401 .adb_type = MAC_ADB_CUDA,
402 .via_type = MAC_VIA_QUADRA,
403 .scsi_type = MAC_SCSI_QUADRA,
404 .scc_type = MAC_SCC_QUADRA,
405 .nubus_type = MAC_NUBUS
406 }, {
407 .ident = MAC_MODEL_Q610,
408 .name = "Quadra 610",
409 .adb_type = MAC_ADB_II,
410 .via_type = MAC_VIA_QUADRA,
411 .scsi_type = MAC_SCSI_QUADRA,
412 .scc_type = MAC_SCC_QUADRA,
413 .ether_type = MAC_ETHER_SONIC,
414 .nubus_type = MAC_NUBUS
415 }, {
416 .ident = MAC_MODEL_Q630,
417 .name = "Quadra 630",
418 .adb_type = MAC_ADB_CUDA,
419 .via_type = MAC_VIA_QUADRA,
420 .scsi_type = MAC_SCSI_QUADRA,
421 .ide_type = MAC_IDE_QUADRA,
422 .scc_type = MAC_SCC_QUADRA,
423 .ether_type = MAC_ETHER_SONIC,
424 .nubus_type = MAC_NUBUS
425 }, {
426 .ident = MAC_MODEL_Q650,
427 .name = "Quadra 650",
428 .adb_type = MAC_ADB_II,
429 .via_type = MAC_VIA_QUADRA,
430 .scsi_type = MAC_SCSI_QUADRA,
431 .scc_type = MAC_SCC_QUADRA,
432 .ether_type = MAC_ETHER_SONIC,
433 .nubus_type = MAC_NUBUS
434 },
435 /* The Q700 does have a NS Sonic */
436 {
437 .ident = MAC_MODEL_Q700,
438 .name = "Quadra 700",
439 .adb_type = MAC_ADB_II,
440 .via_type = MAC_VIA_QUADRA,
441 .scsi_type = MAC_SCSI_QUADRA2,
442 .scc_type = MAC_SCC_QUADRA,
443 .ether_type = MAC_ETHER_SONIC,
444 .nubus_type = MAC_NUBUS
445 }, {
446 .ident = MAC_MODEL_Q800,
447 .name = "Quadra 800",
448 .adb_type = MAC_ADB_II,
449 .via_type = MAC_VIA_QUADRA,
450 .scsi_type = MAC_SCSI_QUADRA,
451 .scc_type = MAC_SCC_QUADRA,
452 .ether_type = MAC_ETHER_SONIC,
453 .nubus_type = MAC_NUBUS
454 }, {
455 .ident = MAC_MODEL_Q840,
456 .name = "Quadra 840AV",
457 .adb_type = MAC_ADB_CUDA,
458 .via_type = MAC_VIA_QUADRA,
459 .scsi_type = MAC_SCSI_QUADRA3,
460 .scc_type = MAC_SCC_PSC,
461 .ether_type = MAC_ETHER_MACE,
462 .nubus_type = MAC_NUBUS
463 }, {
464 .ident = MAC_MODEL_Q900,
465 .name = "Quadra 900",
466 .adb_type = MAC_ADB_IOP,
467 .via_type = MAC_VIA_QUADRA,
468 .scsi_type = MAC_SCSI_QUADRA2,
469 .scc_type = MAC_SCC_IOP,
470 .ether_type = MAC_ETHER_SONIC,
471 .nubus_type = MAC_NUBUS
472 }, {
473 .ident = MAC_MODEL_Q950,
474 .name = "Quadra 950",
475 .adb_type = MAC_ADB_IOP,
476 .via_type = MAC_VIA_QUADRA,
477 .scsi_type = MAC_SCSI_QUADRA2,
478 .scc_type = MAC_SCC_IOP,
479 .ether_type = MAC_ETHER_SONIC,
480 .nubus_type = MAC_NUBUS
481 },
482
483 /*
484 * Performa - more LC type machines
485 */
486
487 {
488 .ident = MAC_MODEL_P460,
489 .name = "Performa 460",
490 .adb_type = MAC_ADB_IISI,
491 .via_type = MAC_VIA_IIci,
492 .scsi_type = MAC_SCSI_OLD,
493 .scc_type = MAC_SCC_II,
494 .nubus_type = MAC_NUBUS
495 }, {
496 .ident = MAC_MODEL_P475,
497 .name = "Performa 475",
498 .adb_type = MAC_ADB_CUDA,
499 .via_type = MAC_VIA_QUADRA,
500 .scsi_type = MAC_SCSI_QUADRA,
501 .scc_type = MAC_SCC_II,
502 .nubus_type = MAC_NUBUS
503 }, {
504 .ident = MAC_MODEL_P475F,
505 .name = "Performa 475",
506 .adb_type = MAC_ADB_CUDA,
507 .via_type = MAC_VIA_QUADRA,
508 .scsi_type = MAC_SCSI_QUADRA,
509 .scc_type = MAC_SCC_II,
510 .nubus_type = MAC_NUBUS
511 }, {
512 .ident = MAC_MODEL_P520,
513 .name = "Performa 520",
514 .adb_type = MAC_ADB_CUDA,
515 .via_type = MAC_VIA_IIci,
516 .scsi_type = MAC_SCSI_OLD,
517 .scc_type = MAC_SCC_II,
518 .nubus_type = MAC_NUBUS
519 }, {
520 .ident = MAC_MODEL_P550,
521 .name = "Performa 550",
522 .adb_type = MAC_ADB_CUDA,
523 .via_type = MAC_VIA_IIci,
524 .scsi_type = MAC_SCSI_OLD,
525 .scc_type = MAC_SCC_II,
526 .nubus_type = MAC_NUBUS
527 },
528 /* These have the comm slot, and therefore the possibility of SONIC ethernet */
529 {
530 .ident = MAC_MODEL_P575,
531 .name = "Performa 575",
532 .adb_type = MAC_ADB_CUDA,
533 .via_type = MAC_VIA_QUADRA,
534 .scsi_type = MAC_SCSI_QUADRA,
535 .scc_type = MAC_SCC_II,
536 .ether_type = MAC_ETHER_SONIC,
537 .nubus_type = MAC_NUBUS
538 }, {
539 .ident = MAC_MODEL_P588,
540 .name = "Performa 588",
541 .adb_type = MAC_ADB_CUDA,
542 .via_type = MAC_VIA_QUADRA,
543 .scsi_type = MAC_SCSI_QUADRA,
544 .ide_type = MAC_IDE_QUADRA,
545 .scc_type = MAC_SCC_II,
546 .ether_type = MAC_ETHER_SONIC,
547 .nubus_type = MAC_NUBUS
548 }, {
549 .ident = MAC_MODEL_TV,
550 .name = "TV",
551 .adb_type = MAC_ADB_CUDA,
552 .via_type = MAC_VIA_QUADRA,
553 .scsi_type = MAC_SCSI_OLD,
554 .scc_type = MAC_SCC_II,
555 .nubus_type = MAC_NUBUS
556 }, {
557 .ident = MAC_MODEL_P600,
558 .name = "Performa 600",
559 .adb_type = MAC_ADB_IISI,
560 .via_type = MAC_VIA_IIci,
561 .scsi_type = MAC_SCSI_OLD,
562 .scc_type = MAC_SCC_II,
563 .nubus_type = MAC_NUBUS
564 },
565
566 /*
567 * Centris - just guessing again; maybe like Quadra
568 */
569
570 /* The C610 may or may not have SONIC. We probe to make sure */
571 {
572 .ident = MAC_MODEL_C610,
573 .name = "Centris 610",
574 .adb_type = MAC_ADB_II,
575 .via_type = MAC_VIA_QUADRA,
576 .scsi_type = MAC_SCSI_QUADRA,
577 .scc_type = MAC_SCC_QUADRA,
578 .ether_type = MAC_ETHER_SONIC,
579 .nubus_type = MAC_NUBUS
580 }, {
581 .ident = MAC_MODEL_C650,
582 .name = "Centris 650",
583 .adb_type = MAC_ADB_II,
584 .via_type = MAC_VIA_QUADRA,
585 .scsi_type = MAC_SCSI_QUADRA,
586 .scc_type = MAC_SCC_QUADRA,
587 .ether_type = MAC_ETHER_SONIC,
588 .nubus_type = MAC_NUBUS
589 }, {
590 .ident = MAC_MODEL_C660,
591 .name = "Centris 660AV",
592 .adb_type = MAC_ADB_CUDA,
593 .via_type = MAC_VIA_QUADRA,
594 .scsi_type = MAC_SCSI_QUADRA3,
595 .scc_type = MAC_SCC_PSC,
596 .ether_type = MAC_ETHER_MACE,
597 .nubus_type = MAC_NUBUS
598 },
599
600 /*
601 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
602 * and a PMU (in two variations?) for ADB. Most of them use the
603 * Quadra-style VIAs. A few models also have IDE from hell.
604 */
605
606 {
607 .ident = MAC_MODEL_PB140,
608 .name = "PowerBook 140",
609 .adb_type = MAC_ADB_PB1,
610 .via_type = MAC_VIA_QUADRA,
611 .scsi_type = MAC_SCSI_OLD,
612 .scc_type = MAC_SCC_QUADRA,
613 .nubus_type = MAC_NUBUS
614 }, {
615 .ident = MAC_MODEL_PB145,
616 .name = "PowerBook 145",
617 .adb_type = MAC_ADB_PB1,
618 .via_type = MAC_VIA_QUADRA,
619 .scsi_type = MAC_SCSI_OLD,
620 .scc_type = MAC_SCC_QUADRA,
621 .nubus_type = MAC_NUBUS
622 }, {
623 .ident = MAC_MODEL_PB150,
624 .name = "PowerBook 150",
625 .adb_type = MAC_ADB_PB1,
626 .via_type = MAC_VIA_IIci,
627 .scsi_type = MAC_SCSI_OLD,
628 .ide_type = MAC_IDE_PB,
629 .scc_type = MAC_SCC_QUADRA,
630 .nubus_type = MAC_NUBUS
631 }, {
632 .ident = MAC_MODEL_PB160,
633 .name = "PowerBook 160",
634 .adb_type = MAC_ADB_PB1,
635 .via_type = MAC_VIA_QUADRA,
636 .scsi_type = MAC_SCSI_OLD,
637 .scc_type = MAC_SCC_QUADRA,
638 .nubus_type = MAC_NUBUS
639 }, {
640 .ident = MAC_MODEL_PB165,
641 .name = "PowerBook 165",
642 .adb_type = MAC_ADB_PB1,
643 .via_type = MAC_VIA_QUADRA,
644 .scsi_type = MAC_SCSI_OLD,
645 .scc_type = MAC_SCC_QUADRA,
646 .nubus_type = MAC_NUBUS
647 }, {
648 .ident = MAC_MODEL_PB165C,
649 .name = "PowerBook 165c",
650 .adb_type = MAC_ADB_PB1,
651 .via_type = MAC_VIA_QUADRA,
652 .scsi_type = MAC_SCSI_OLD,
653 .scc_type = MAC_SCC_QUADRA,
654 .nubus_type = MAC_NUBUS
655 }, {
656 .ident = MAC_MODEL_PB170,
657 .name = "PowerBook 170",
658 .adb_type = MAC_ADB_PB1,
659 .via_type = MAC_VIA_QUADRA,
660 .scsi_type = MAC_SCSI_OLD,
661 .scc_type = MAC_SCC_QUADRA,
662 .nubus_type = MAC_NUBUS
663 }, {
664 .ident = MAC_MODEL_PB180,
665 .name = "PowerBook 180",
666 .adb_type = MAC_ADB_PB1,
667 .via_type = MAC_VIA_QUADRA,
668 .scsi_type = MAC_SCSI_OLD,
669 .scc_type = MAC_SCC_QUADRA,
670 .nubus_type = MAC_NUBUS
671 }, {
672 .ident = MAC_MODEL_PB180C,
673 .name = "PowerBook 180c",
674 .adb_type = MAC_ADB_PB1,
675 .via_type = MAC_VIA_QUADRA,
676 .scsi_type = MAC_SCSI_OLD,
677 .scc_type = MAC_SCC_QUADRA,
678 .nubus_type = MAC_NUBUS
679 }, {
680 .ident = MAC_MODEL_PB190,
681 .name = "PowerBook 190",
682 .adb_type = MAC_ADB_PB2,
683 .via_type = MAC_VIA_QUADRA,
684 .scsi_type = MAC_SCSI_OLD,
685 .ide_type = MAC_IDE_BABOON,
686 .scc_type = MAC_SCC_QUADRA,
687 .nubus_type = MAC_NUBUS
688 }, {
689 .ident = MAC_MODEL_PB520,
690 .name = "PowerBook 520",
691 .adb_type = MAC_ADB_PB2,
692 .via_type = MAC_VIA_QUADRA,
693 .scsi_type = MAC_SCSI_OLD,
694 .scc_type = MAC_SCC_QUADRA,
695 .ether_type = MAC_ETHER_SONIC,
696 .nubus_type = MAC_NUBUS
697 },
698
699 /*
700 * PowerBook Duos are pretty much like normal PowerBooks
701 * All of these probably have onboard SONIC in the Dock which
702 * means we'll have to probe for it eventually.
703 *
Simon Arlott0c79cf62007-10-20 01:20:32 +0200704 * Are these really MAC_VIA_IIci? The developer notes for the
Linus Torvalds1da177e2005-04-16 15:20:36 -0700705 * Duos show pretty much the same custom parts as in most of
706 * the other PowerBooks which would imply MAC_VIA_QUADRA.
707 */
708
709 {
710 .ident = MAC_MODEL_PB210,
711 .name = "PowerBook Duo 210",
712 .adb_type = MAC_ADB_PB2,
713 .via_type = MAC_VIA_IIci,
714 .scsi_type = MAC_SCSI_OLD,
715 .scc_type = MAC_SCC_QUADRA,
716 .nubus_type = MAC_NUBUS
717 }, {
718 .ident = MAC_MODEL_PB230,
719 .name = "PowerBook Duo 230",
720 .adb_type = MAC_ADB_PB2,
721 .via_type = MAC_VIA_IIci,
722 .scsi_type = MAC_SCSI_OLD,
723 .scc_type = MAC_SCC_QUADRA,
724 .nubus_type = MAC_NUBUS
725 }, {
726 .ident = MAC_MODEL_PB250,
727 .name = "PowerBook Duo 250",
728 .adb_type = MAC_ADB_PB2,
729 .via_type = MAC_VIA_IIci,
730 .scsi_type = MAC_SCSI_OLD,
731 .scc_type = MAC_SCC_QUADRA,
732 .nubus_type = MAC_NUBUS
733 }, {
734 .ident = MAC_MODEL_PB270C,
735 .name = "PowerBook Duo 270c",
736 .adb_type = MAC_ADB_PB2,
737 .via_type = MAC_VIA_IIci,
738 .scsi_type = MAC_SCSI_OLD,
739 .scc_type = MAC_SCC_QUADRA,
740 .nubus_type = MAC_NUBUS
741 }, {
742 .ident = MAC_MODEL_PB280,
743 .name = "PowerBook Duo 280",
744 .adb_type = MAC_ADB_PB2,
745 .via_type = MAC_VIA_IIci,
746 .scsi_type = MAC_SCSI_OLD,
747 .scc_type = MAC_SCC_QUADRA,
748 .nubus_type = MAC_NUBUS
749 }, {
750 .ident = MAC_MODEL_PB280C,
751 .name = "PowerBook Duo 280c",
752 .adb_type = MAC_ADB_PB2,
753 .via_type = MAC_VIA_IIci,
754 .scsi_type = MAC_SCSI_OLD,
755 .scc_type = MAC_SCC_QUADRA,
756 .nubus_type = MAC_NUBUS
757 },
758
759 /*
760 * Other stuff ??
761 */
762 {
763 .ident = -1
764 }
765};
766
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200767static void __init mac_identify(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768{
769 struct mac_model *m;
770
771 /* Penguin data useful? */
772 int model = mac_bi_data.id;
773 if (!model) {
774 /* no bootinfo model id -> NetBSD booter was used! */
775 /* XXX FIXME: breaks for model > 31 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200776 model = (mac_bi_data.cpuid >> 2) & 63;
777 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778 }
779
780 macintosh_config = mac_data_table;
Roman Zippel6ff58012007-05-01 22:32:43 +0200781 for (m = macintosh_config; m->ident != -1; m++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700782 if (m->ident == model) {
783 macintosh_config = m;
784 break;
785 }
786 }
787
788 /* We need to pre-init the IOPs, if any. Otherwise */
789 /* the serial console won't work if the user had */
790 /* the serial ports set to "Faster" mode in MacOS. */
791
792 iop_preinit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700793
Roman Zippel6ff58012007-05-01 22:32:43 +0200794 printk(KERN_INFO "Detected Macintosh model: %d \n", model);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795
796 /*
797 * Report booter data:
798 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200799 printk(KERN_DEBUG " Penguin bootinfo data:\n");
800 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700801 mac_bi_data.videoaddr, mac_bi_data.videorow,
802 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
803 mac_bi_data.dimensions >> 16);
Roman Zippel6ff58012007-05-01 22:32:43 +0200804 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700805 mac_bi_data.videological, mac_orig_videoaddr,
806 mac_bi_data.sccbase);
Roman Zippel6ff58012007-05-01 22:32:43 +0200807 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700808 mac_bi_data.boottime, mac_bi_data.gmtbias);
Roman Zippel6ff58012007-05-01 22:32:43 +0200809 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700810 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
811#if 0
Roman Zippel6ff58012007-05-01 22:32:43 +0200812 printk("Ramdisk: addr 0x%lx size 0x%lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813 m68k_ramdisk.addr, m68k_ramdisk.size);
814#endif
815
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816 iop_init();
817 via_init();
818 oss_init();
819 psc_init();
820 baboon_init();
821}
822
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200823static void __init mac_report_hardware(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700824{
825 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
826}
827
828static void mac_get_model(char *str)
829{
Roman Zippel6ff58012007-05-01 22:32:43 +0200830 strcpy(str, "Macintosh ");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700831 strcat(str, macintosh_config->name);
832}