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