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