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/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 #include <asm/keyboard.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 = {0,};
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 void mac_gettod (int *, int *, int *, int *, int *, int *);
70 extern unsigned long mac_gettimeoffset (void);
71 extern int mac_hwclk (int, struct rtc_time *);
72 extern int mac_set_clock_mmss (unsigned long);
73 extern int mac_get_irq_list(char *);
74 extern void iop_preinit(void);
75 extern void iop_init(void);
76 extern void via_init(void);
77 extern void via_init_clock(void (*func)(int, void *, struct pt_regs *));
78 extern void via_flush_cache(void);
79 extern void oss_init(void);
80 extern void psc_init(void);
81 extern void baboon_init(void);
82
83 extern void mac_mksound(unsigned int, unsigned int);
84
85 extern void nubus_sweep_video(void);
86
87 /* Mac specific debug functions (in debug.c) */
88 extern void mac_debug_init(void);
89 extern void mac_debugging_long(int, long);
90
91 extern int mackbd_init_hw(void);
92 extern void mackbd_leds(unsigned int leds);
93 extern int mackbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode);
94
95 extern void __init mac_hid_init_hw(void);
96 extern int mac_hid_kbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode);
97
98 #ifdef CONFIG_MAGIC_SYSRQ
99 extern unsigned char mac_hid_kbd_sysrq_xlate[128];
100 extern unsigned char pckbd_sysrq_xlate[128];
101 extern unsigned char mackbd_sysrq_xlate[128];
102 #endif /* CONFIG_MAGIC_SYSRQ */
103
104 static void mac_get_model(char *str);
105
mac_bang(int irq,void * vector,struct pt_regs * p)106 void mac_bang(int irq, void *vector, struct pt_regs *p)
107 {
108 printk(KERN_INFO "Resetting ...\n");
109 mac_reset();
110 }
111
mac_sched_init(void (* vector)(int,void *,struct pt_regs *))112 static void mac_sched_init(void (*vector)(int, void *, struct pt_regs *))
113 {
114 via_init_clock(vector);
115 }
116
117 #if 0
118 void mac_waitbut (void)
119 {
120 ;
121 }
122 #endif
123
124 extern void mac_default_handler(int, void *, struct pt_regs *);
125
126 void (*mac_handlers[8])(int, void *, struct pt_regs *)=
127 {
128 mac_default_handler,
129 mac_default_handler,
130 mac_default_handler,
131 mac_default_handler,
132 mac_default_handler,
133 mac_default_handler,
134 mac_default_handler,
135 mac_default_handler
136 };
137
138 /*
139 * Parse a Macintosh-specific record in the bootinfo
140 */
141
mac_parse_bootinfo(const struct bi_record * record)142 int __init mac_parse_bootinfo(const struct bi_record *record)
143 {
144 int unknown = 0;
145 const u_long *data = record->data;
146
147 switch (record->tag) {
148 case BI_MAC_MODEL:
149 mac_bi_data.id = *data;
150 break;
151 case BI_MAC_VADDR:
152 mac_bi_data.videoaddr = *data;
153 break;
154 case BI_MAC_VDEPTH:
155 mac_bi_data.videodepth = *data;
156 break;
157 case BI_MAC_VROW:
158 mac_bi_data.videorow = *data;
159 break;
160 case BI_MAC_VDIM:
161 mac_bi_data.dimensions = *data;
162 break;
163 case BI_MAC_VLOGICAL:
164 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
165 mac_orig_videoaddr = *data;
166 break;
167 case BI_MAC_SCCBASE:
168 mac_bi_data.sccbase = *data;
169 break;
170 case BI_MAC_BTIME:
171 mac_bi_data.boottime = *data;
172 break;
173 case BI_MAC_GMTBIAS:
174 mac_bi_data.gmtbias = *data;
175 break;
176 case BI_MAC_MEMSIZE:
177 mac_bi_data.memsize = *data;
178 break;
179 case BI_MAC_CPUID:
180 mac_bi_data.cpuid = *data;
181 break;
182 case BI_MAC_ROMBASE:
183 mac_bi_data.rombase = *data;
184 break;
185 default:
186 unknown = 1;
187 }
188 return(unknown);
189 }
190
191 /*
192 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
193 * have to disable interrupts for this. Our IRQ handlers will crap
194 * themselves if they take an IRQ in 24bit mode!
195 */
196
mac_cache_card_flush(int writeback)197 static void mac_cache_card_flush(int writeback)
198 {
199 unsigned long cpu_flags;
200 save_flags(cpu_flags);
201 cli();
202 via_flush_cache();
203 restore_flags(cpu_flags);
204 }
205
206 #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID)
mac_keyb_init(void)207 static int __init mac_keyb_init(void)
208 {
209 mac_hid_init_hw();
210 return 0;
211 }
212 #endif
213
config_mac(void)214 void __init config_mac(void)
215 {
216 if (!MACH_IS_MAC) {
217 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
218 }
219
220 #ifdef CONFIG_VT
221 #ifdef CONFIG_INPUT_ADBHID
222 mach_keyb_init = mac_keyb_init;
223 mach_kbd_translate = mac_hid_kbd_translate;
224 #ifdef CONFIG_MAGIC_SYSRQ
225 #ifdef CONFIG_MAC_ADBKEYCODES
226 if (!keyboard_sends_linux_keycodes) {
227 mach_sysrq_xlate = mac_hid_kbd_sysrq_xlate;
228 SYSRQ_KEY = 0x69;
229 } else
230 #endif /* CONFIG_MAC_ADBKEYCODES */
231 {
232 mach_sysrq_xlate = pckbd_sysrq_xlate;
233 SYSRQ_KEY = 0x54;
234 }
235 #endif /* CONFIG_MAGIC_SYSRQ */
236 #elif defined(CONFIG_ADB_KEYBOARD)
237 mach_keyb_init = mackbd_init_hw;
238 mach_kbd_leds = mackbd_leds;
239 mach_kbd_translate = mackbd_translate;
240 #ifdef CONFIG_MAGIC_SYSRQ
241 mach_sysrq_xlate = mackbd_sysrq_xlate;
242 SYSRQ_KEY = 0x69;
243 #endif /* CONFIG_MAGIC_SYSRQ */
244 #endif /* CONFIG_INPUT_ADBHID */
245 kd_mksound = mac_mksound;
246 #endif /* CONFIG_VT */
247
248 mach_sched_init = mac_sched_init;
249 mach_init_IRQ = mac_init_IRQ;
250 mach_request_irq = mac_request_irq;
251 mach_free_irq = mac_free_irq;
252 enable_irq = mac_enable_irq;
253 disable_irq = mac_disable_irq;
254 mach_get_model = mac_get_model;
255 mach_default_handler = &mac_handlers;
256 mach_get_irq_list = mac_get_irq_list;
257 mach_gettimeoffset = mac_gettimeoffset;
258 mach_gettod = mac_gettod;
259 mach_hwclk = mac_hwclk;
260 mach_set_clock_mmss = mac_set_clock_mmss;
261 #if 0
262 mach_mksound = mac_mksound;
263 #endif
264 mach_reset = mac_reset;
265 mach_halt = mac_poweroff;
266 mach_power_off = mac_poweroff;
267 #ifdef CONFIG_DUMMY_CONSOLE
268 conswitchp = &dummy_con;
269 #endif
270 mach_max_dma_address = 0xffffffff;
271 #if 0
272 mach_debug_init = mac_debug_init;
273 #endif
274 #ifdef CONFIG_HEARTBEAT
275 #if 0
276 mach_heartbeat = mac_heartbeat;
277 mach_heartbeat_irq = IRQ_MAC_TIMER;
278 #endif
279 #endif
280
281 /*
282 * Determine hardware present
283 */
284
285 mac_identify();
286 mac_report_hardware();
287
288 /* AFAIK only the IIci takes a cache card. The IIfx has onboard
289 cache ... someone needs to figure out how to tell if it's on or
290 not. */
291
292 if (macintosh_config->ident == MAC_MODEL_IICI
293 || macintosh_config->ident == MAC_MODEL_IIFX) {
294 mach_l2_flush = mac_cache_card_flush;
295 }
296 #ifdef MAC_DEBUG_SOUND
297 /* goes on forever if timers broken */
298 mac_mksound(1000,10);
299 #endif
300
301 /*
302 * Check for machine specific fixups.
303 */
304
305 #ifdef OLD_NUBUS_CODE
306 nubus_sweep_video();
307 #endif
308 }
309
310
311 /*
312 * Macintosh Table: hardcoded model configuration data.
313 *
314 * Much of this was defined by Alan, based on who knows what docs.
315 * I've added a lot more, and some of that was pure guesswork based
316 * on hardware pages present on the Mac web site. Possibly wildly
317 * inaccurate, so look here if a new Mac model won't run. Example: if
318 * a Mac crashes immediately after the VIA1 registers have been dumped
319 * to the screen, it probably died attempting to read DirB on a RBV.
320 * Meaning it should have MAC_VIA_IIci here :-)
321 */
322
323 struct mac_model *macintosh_config;
324
325 static struct mac_model mac_data_table[]=
326 {
327 /*
328 * We'll pretend to be a Macintosh II, that's pretty safe.
329 */
330
331 { MAC_MODEL_II, "Unknown", MAC_ADB_II, MAC_VIA_II, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
332
333 /*
334 * Original MacII hardware
335 *
336 */
337
338 { MAC_MODEL_II, "II", MAC_ADB_II, MAC_VIA_II, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
339 { MAC_MODEL_IIX, "IIx", MAC_ADB_II, MAC_VIA_II, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
340 { MAC_MODEL_IICX, "IIcx", MAC_ADB_II, MAC_VIA_II, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
341 { MAC_MODEL_SE30, "SE/30", MAC_ADB_II, MAC_VIA_II, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
342
343 /*
344 * Weirdified MacII hardware - all subtley different. Gee thanks
345 * Apple. All these boxes seem to have VIA2 in a different place to
346 * the MacII (+1A000 rather than +4000)
347 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
348 */
349
350 { MAC_MODEL_IICI, "IIci", MAC_ADB_II, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
351 { MAC_MODEL_IIFX, "IIfx", MAC_ADB_IOP, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_IOP, MAC_ETHER_NONE, MAC_NUBUS},
352 { MAC_MODEL_IISI, "IIsi", MAC_ADB_IISI, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
353 { MAC_MODEL_IIVI, "IIvi", MAC_ADB_IISI, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
354 { MAC_MODEL_IIVX, "IIvx", MAC_ADB_IISI, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
355
356 /*
357 * Classic models (guessing: similar to SE/30 ?? Nope, similar to LC ...)
358 */
359
360 { MAC_MODEL_CLII, "Classic II", MAC_ADB_IISI, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
361 { MAC_MODEL_CCL, "Color Classic", MAC_ADB_CUDA, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
362
363 /*
364 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
365 */
366
367 { MAC_MODEL_LC, "LC", MAC_ADB_IISI, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
368 { MAC_MODEL_LCII, "LC II", MAC_ADB_IISI, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
369 { MAC_MODEL_LCIII,"LC III", MAC_ADB_IISI, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
370
371 /*
372 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it differently
373 * as some of the stuff connected to VIA2 seems different. Better SCSI chip and
374 * onboard ethernet using a NatSemi SONIC except the 660AV and 840AV which use an
375 * AMD 79C940 (MACE).
376 * The 700, 900 and 950 have some I/O chips in the wrong place to
377 * confuse us. The 840AV has a SCSI location of its own (same as
378 * the 660AV).
379 */
380
381 { MAC_MODEL_Q605, "Quadra 605", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
382 { MAC_MODEL_Q605_ACC, "Quadra 605", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
383 { MAC_MODEL_Q610, "Quadra 610", MAC_ADB_II, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_SONIC, MAC_NUBUS},
384 { MAC_MODEL_Q630, "Quadra 630", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_QUADRA, MAC_SCC_QUADRA, MAC_ETHER_SONIC, MAC_NUBUS},
385 { MAC_MODEL_Q650, "Quadra 650", MAC_ADB_II, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_SONIC, MAC_NUBUS},
386 /* The Q700 does have a NS Sonic */
387 { MAC_MODEL_Q700, "Quadra 700", MAC_ADB_II, MAC_VIA_QUADRA, MAC_SCSI_QUADRA2, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_SONIC, MAC_NUBUS},
388 { MAC_MODEL_Q800, "Quadra 800", MAC_ADB_II, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_SONIC, MAC_NUBUS},
389 { MAC_MODEL_Q840, "Quadra 840AV", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA3, MAC_IDE_NONE, MAC_SCC_PSC, MAC_ETHER_MACE, MAC_NUBUS},
390 { MAC_MODEL_Q900, "Quadra 900", MAC_ADB_IOP, MAC_VIA_QUADRA, MAC_SCSI_QUADRA2, MAC_IDE_NONE, MAC_SCC_IOP, MAC_ETHER_SONIC, MAC_NUBUS},
391 { MAC_MODEL_Q950, "Quadra 950", MAC_ADB_IOP, MAC_VIA_QUADRA, MAC_SCSI_QUADRA2, MAC_IDE_NONE, MAC_SCC_IOP, MAC_ETHER_SONIC, MAC_NUBUS},
392
393 /*
394 * Performa - more LC type machines
395 */
396
397 { MAC_MODEL_P460, "Performa 460", MAC_ADB_IISI, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
398 { MAC_MODEL_P475, "Performa 475", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
399 { MAC_MODEL_P475F, "Performa 475", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
400 { MAC_MODEL_P520, "Performa 520", MAC_ADB_CUDA, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
401 { MAC_MODEL_P550, "Performa 550", MAC_ADB_CUDA, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
402 /* These have the comm slot, and therefore the possibility of SONIC ethernet */
403 { MAC_MODEL_P575, "Performa 575", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_SONIC, MAC_NUBUS},
404 { MAC_MODEL_P588, "Performa 588", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_QUADRA, MAC_SCC_II, MAC_ETHER_SONIC, MAC_NUBUS},
405 { MAC_MODEL_TV, "TV", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
406 { MAC_MODEL_P600, "Performa 600", MAC_ADB_IISI, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS},
407
408 /*
409 * Centris - just guessing again; maybe like Quadra
410 */
411
412 /* The C610 may or may not have SONIC. We probe to make sure */
413 { MAC_MODEL_C610, "Centris 610", MAC_ADB_II, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_SONIC, MAC_NUBUS},
414 { MAC_MODEL_C650, "Centris 650", MAC_ADB_II, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_SONIC, MAC_NUBUS},
415 { MAC_MODEL_C660, "Centris 660AV", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA3, MAC_IDE_NONE, MAC_SCC_PSC, MAC_ETHER_MACE, MAC_NUBUS},
416
417 /*
418 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
419 * and a PMU (in two variations?) for ADB. Most of them use the
420 * Quadra-style VIAs. A few models also have IDE from hell.
421 */
422
423 { MAC_MODEL_PB140, "PowerBook 140", MAC_ADB_PB1, MAC_VIA_QUADRA, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
424 { MAC_MODEL_PB145, "PowerBook 145", MAC_ADB_PB1, MAC_VIA_QUADRA, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
425 { MAC_MODEL_PB150, "PowerBook 150", MAC_ADB_PB1, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_PB, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
426 { MAC_MODEL_PB160, "PowerBook 160", MAC_ADB_PB1, MAC_VIA_QUADRA, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
427 { MAC_MODEL_PB165, "PowerBook 165", MAC_ADB_PB1, MAC_VIA_QUADRA, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
428 { MAC_MODEL_PB165C, "PowerBook 165c", MAC_ADB_PB1, MAC_VIA_QUADRA, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
429 { MAC_MODEL_PB170, "PowerBook 170", MAC_ADB_PB1, MAC_VIA_QUADRA, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
430 { MAC_MODEL_PB180, "PowerBook 180", MAC_ADB_PB1, MAC_VIA_QUADRA, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
431 { MAC_MODEL_PB180C, "PowerBook 180c", MAC_ADB_PB1, MAC_VIA_QUADRA, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
432 { MAC_MODEL_PB190, "PowerBook 190", MAC_ADB_PB2, MAC_VIA_QUADRA, MAC_SCSI_OLD, MAC_IDE_BABOON, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
433 { MAC_MODEL_PB520, "PowerBook 520", MAC_ADB_PB2, MAC_VIA_QUADRA, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_SONIC, MAC_NUBUS},
434
435 /*
436 * PowerBook Duos are pretty much like normal PowerBooks
437 * All of these probably have onboard SONIC in the Dock which
438 * means we'll have to probe for it eventually.
439 *
440 * Are these reallly MAC_VIA_IIci? The developer notes for the
441 * Duos show pretty much the same custom parts as in most of
442 * the other PowerBooks which would imply MAC_VIA_QUADRA.
443 */
444
445 { MAC_MODEL_PB210, "PowerBook Duo 210", MAC_ADB_PB2, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
446 { MAC_MODEL_PB230, "PowerBook Duo 230", MAC_ADB_PB2, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
447 { MAC_MODEL_PB250, "PowerBook Duo 250", MAC_ADB_PB2, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
448 { MAC_MODEL_PB270C, "PowerBook Duo 270c", MAC_ADB_PB2, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
449 { MAC_MODEL_PB280, "PowerBook Duo 280", MAC_ADB_PB2, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
450 { MAC_MODEL_PB280C, "PowerBook Duo 280c", MAC_ADB_PB2, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_QUADRA, MAC_ETHER_NONE, MAC_NUBUS},
451
452 /*
453 * Other stuff ??
454 */
455 { -1, NULL, 0,0,0,}
456 };
457
mac_identify(void)458 void mac_identify(void)
459 {
460 struct mac_model *m;
461
462 /* Penguin data useful? */
463 int model = mac_bi_data.id;
464 if (!model) {
465 /* no bootinfo model id -> NetBSD booter was used! */
466 /* XXX FIXME: breaks for model > 31 */
467 model=(mac_bi_data.cpuid>>2)&63;
468 printk (KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
469 }
470
471 macintosh_config = mac_data_table;
472 for (m = macintosh_config ; m->ident != -1 ; m++) {
473 if (m->ident == model) {
474 macintosh_config = m;
475 break;
476 }
477 }
478
479 /* We need to pre-init the IOPs, if any. Otherwise */
480 /* the serial console won't work if the user had */
481 /* the serial ports set to "Faster" mode in MacOS. */
482
483 iop_preinit();
484 mac_debug_init();
485
486 printk (KERN_INFO "Detected Macintosh model: %d \n", model);
487
488 /*
489 * Report booter data:
490 */
491 printk (KERN_DEBUG " Penguin bootinfo data:\n");
492 printk (KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
493 mac_bi_data.videoaddr, mac_bi_data.videorow,
494 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
495 mac_bi_data.dimensions >> 16);
496 printk (KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
497 mac_bi_data.videological, mac_orig_videoaddr,
498 mac_bi_data.sccbase);
499 printk (KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
500 mac_bi_data.boottime, mac_bi_data.gmtbias);
501 printk (KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
502 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
503 #if 0
504 printk ("Ramdisk: addr 0x%lx size 0x%lx\n",
505 m68k_ramdisk.addr, m68k_ramdisk.size);
506 #endif
507
508 /*
509 * TODO: set the various fields in macintosh_config->hw_present here!
510 */
511 switch (macintosh_config->scsi_type) {
512 case MAC_SCSI_OLD:
513 MACHW_SET(MAC_SCSI_80);
514 break;
515 case MAC_SCSI_QUADRA:
516 case MAC_SCSI_QUADRA2:
517 case MAC_SCSI_QUADRA3:
518 MACHW_SET(MAC_SCSI_96);
519 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
520 (macintosh_config->ident == MAC_MODEL_Q950))
521 MACHW_SET(MAC_SCSI_96_2);
522 break;
523 default:
524 printk(KERN_WARNING "config.c: wtf: unknown scsi, using 53c80\n");
525 MACHW_SET(MAC_SCSI_80);
526 break;
527
528 }
529 iop_init();
530 via_init();
531 oss_init();
532 psc_init();
533 baboon_init();
534 }
535
mac_report_hardware(void)536 void mac_report_hardware(void)
537 {
538 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
539 }
540
mac_get_model(char * str)541 static void mac_get_model(char *str)
542 {
543 strcpy(str,"Macintosh ");
544 strcat(str, macintosh_config->name);
545 }
546