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