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