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