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