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