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