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