Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/arch/m68k/mac/config.c
26442 views
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/errno.h>
14
#include <linux/module.h>
15
#include <linux/reboot.h>
16
#include <linux/types.h>
17
#include <linux/mm.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/platform_device.h>
26
#include <linux/ata_platform.h>
27
#include <linux/adb.h>
28
#include <linux/cuda.h>
29
#include <linux/pmu.h>
30
#include <linux/rtc.h>
31
32
#include <asm/setup.h>
33
#include <asm/bootinfo.h>
34
#include <asm/bootinfo-mac.h>
35
#include <asm/byteorder.h>
36
37
#include <asm/io.h>
38
#include <asm/irq.h>
39
#include <asm/machdep.h>
40
41
#include <asm/macintosh.h>
42
#include <asm/macints.h>
43
#include <asm/machw.h>
44
45
#include <asm/mac_iop.h>
46
#include <asm/mac_via.h>
47
#include <asm/mac_oss.h>
48
#include <asm/mac_psc.h>
49
#include <asm/config.h>
50
51
#include "mac.h"
52
53
/* Mac bootinfo struct */
54
struct mac_booter_data mac_bi_data;
55
56
/* The phys. video addr. - might be bogus on some machines */
57
static unsigned long mac_orig_videoaddr;
58
59
static void mac_get_model(char *str);
60
static void mac_identify(void);
61
static void mac_report_hardware(void);
62
63
static void __init mac_sched_init(void)
64
{
65
via_init_clock();
66
}
67
68
/*
69
* Parse a Macintosh-specific record in the bootinfo
70
*/
71
72
int __init mac_parse_bootinfo(const struct bi_record *record)
73
{
74
int unknown = 0;
75
const void *data = record->data;
76
77
switch (be16_to_cpu(record->tag)) {
78
case BI_MAC_MODEL:
79
mac_bi_data.id = be32_to_cpup(data);
80
break;
81
case BI_MAC_VADDR:
82
mac_bi_data.videoaddr = be32_to_cpup(data);
83
break;
84
case BI_MAC_VDEPTH:
85
mac_bi_data.videodepth = be32_to_cpup(data);
86
break;
87
case BI_MAC_VROW:
88
mac_bi_data.videorow = be32_to_cpup(data);
89
break;
90
case BI_MAC_VDIM:
91
mac_bi_data.dimensions = be32_to_cpup(data);
92
break;
93
case BI_MAC_VLOGICAL:
94
mac_orig_videoaddr = be32_to_cpup(data);
95
mac_bi_data.videological =
96
VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
97
break;
98
case BI_MAC_SCCBASE:
99
mac_bi_data.sccbase = be32_to_cpup(data);
100
break;
101
case BI_MAC_BTIME:
102
mac_bi_data.boottime = be32_to_cpup(data);
103
break;
104
case BI_MAC_GMTBIAS:
105
mac_bi_data.gmtbias = be32_to_cpup(data);
106
break;
107
case BI_MAC_MEMSIZE:
108
mac_bi_data.memsize = be32_to_cpup(data);
109
break;
110
case BI_MAC_CPUID:
111
mac_bi_data.cpuid = be32_to_cpup(data);
112
break;
113
case BI_MAC_ROMBASE:
114
mac_bi_data.rombase = be32_to_cpup(data);
115
break;
116
default:
117
unknown = 1;
118
break;
119
}
120
return unknown;
121
}
122
123
void __init config_mac(void)
124
{
125
if (!MACH_IS_MAC)
126
pr_err("ERROR: no Mac, but config_mac() called!!\n");
127
128
mach_sched_init = mac_sched_init;
129
mach_init_IRQ = mac_init_IRQ;
130
mach_get_model = mac_get_model;
131
mach_hwclk = mac_hwclk;
132
mach_reset = mac_reset;
133
mach_halt = mac_poweroff;
134
#if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
135
mach_beep = mac_mksound;
136
#endif
137
138
/*
139
* Determine hardware present
140
*/
141
142
mac_identify();
143
mac_report_hardware();
144
145
/*
146
* AFAIK only the IIci takes a cache card. The IIfx has onboard
147
* cache ... someone needs to figure out how to tell if it's on or
148
* not.
149
*/
150
151
if (macintosh_config->ident == MAC_MODEL_IICI)
152
mach_l2_flush = via_l2_flush;
153
154
register_platform_power_off(mac_poweroff);
155
}
156
157
158
/*
159
* Macintosh Table: hardcoded model configuration data.
160
*
161
* Much of this was defined by Alan, based on who knows what docs.
162
* I've added a lot more, and some of that was pure guesswork based
163
* on hardware pages present on the Mac web site. Possibly wildly
164
* inaccurate, so look here if a new Mac model won't run. Example: if
165
* a Mac crashes immediately after the VIA1 registers have been dumped
166
* to the screen, it probably died attempting to read DirB on a RBV.
167
* Meaning it should have MAC_VIA_IICI here :-)
168
*/
169
170
struct mac_model *macintosh_config;
171
EXPORT_SYMBOL(macintosh_config);
172
173
static struct mac_model mac_data_table[] = {
174
/*
175
* We'll pretend to be a Macintosh II, that's pretty safe.
176
*/
177
178
{
179
.ident = MAC_MODEL_II,
180
.name = "Unknown",
181
.adb_type = MAC_ADB_II,
182
.via_type = MAC_VIA_II,
183
.scsi_type = MAC_SCSI_OLD,
184
.scc_type = MAC_SCC_II,
185
.expansion_type = MAC_EXP_NUBUS,
186
.floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
187
},
188
189
/*
190
* Original Mac II hardware
191
*/
192
193
{
194
.ident = MAC_MODEL_II,
195
.name = "II",
196
.adb_type = MAC_ADB_II,
197
.via_type = MAC_VIA_II,
198
.scsi_type = MAC_SCSI_OLD,
199
.scc_type = MAC_SCC_II,
200
.expansion_type = MAC_EXP_NUBUS,
201
.floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
202
}, {
203
.ident = MAC_MODEL_IIX,
204
.name = "IIx",
205
.adb_type = MAC_ADB_II,
206
.via_type = MAC_VIA_II,
207
.scsi_type = MAC_SCSI_OLD,
208
.scc_type = MAC_SCC_II,
209
.expansion_type = MAC_EXP_NUBUS,
210
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
211
}, {
212
.ident = MAC_MODEL_IICX,
213
.name = "IIcx",
214
.adb_type = MAC_ADB_II,
215
.via_type = MAC_VIA_II,
216
.scsi_type = MAC_SCSI_OLD,
217
.scc_type = MAC_SCC_II,
218
.expansion_type = MAC_EXP_NUBUS,
219
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
220
}, {
221
.ident = MAC_MODEL_SE30,
222
.name = "SE/30",
223
.adb_type = MAC_ADB_II,
224
.via_type = MAC_VIA_II,
225
.scsi_type = MAC_SCSI_OLD,
226
.scc_type = MAC_SCC_II,
227
.expansion_type = MAC_EXP_PDS,
228
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
229
},
230
231
/*
232
* Weirdified Mac II hardware - all subtly different. Gee thanks
233
* Apple. All these boxes seem to have VIA2 in a different place to
234
* the Mac II (+1A000 rather than +4000)
235
* CSA: see http://developer.apple.com/technotes/hw/hw_09.html
236
*/
237
238
{
239
.ident = MAC_MODEL_IICI,
240
.name = "IIci",
241
.adb_type = MAC_ADB_II,
242
.via_type = MAC_VIA_IICI,
243
.scsi_type = MAC_SCSI_OLD,
244
.scc_type = MAC_SCC_II,
245
.expansion_type = MAC_EXP_NUBUS,
246
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
247
}, {
248
.ident = MAC_MODEL_IIFX,
249
.name = "IIfx",
250
.adb_type = MAC_ADB_IOP,
251
.via_type = MAC_VIA_IICI,
252
.scsi_type = MAC_SCSI_IIFX,
253
.scc_type = MAC_SCC_IOP,
254
.expansion_type = MAC_EXP_PDS_NUBUS,
255
.floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
256
}, {
257
.ident = MAC_MODEL_IISI,
258
.name = "IIsi",
259
.adb_type = MAC_ADB_EGRET,
260
.via_type = MAC_VIA_IICI,
261
.scsi_type = MAC_SCSI_OLD,
262
.scc_type = MAC_SCC_II,
263
.expansion_type = MAC_EXP_PDS_NUBUS,
264
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
265
}, {
266
.ident = MAC_MODEL_IIVI,
267
.name = "IIvi",
268
.adb_type = MAC_ADB_EGRET,
269
.via_type = MAC_VIA_IICI,
270
.scsi_type = MAC_SCSI_LC,
271
.scc_type = MAC_SCC_II,
272
.expansion_type = MAC_EXP_NUBUS,
273
.floppy_type = MAC_FLOPPY_LC, /* SWIM */
274
}, {
275
.ident = MAC_MODEL_IIVX,
276
.name = "IIvx",
277
.adb_type = MAC_ADB_EGRET,
278
.via_type = MAC_VIA_IICI,
279
.scsi_type = MAC_SCSI_LC,
280
.scc_type = MAC_SCC_II,
281
.expansion_type = MAC_EXP_NUBUS,
282
.floppy_type = MAC_FLOPPY_LC, /* SWIM */
283
},
284
285
/*
286
* Classic models (guessing: similar to SE/30? Nope, similar to LC...)
287
*/
288
289
{
290
.ident = MAC_MODEL_CLII,
291
.name = "Classic II",
292
.adb_type = MAC_ADB_EGRET,
293
.via_type = MAC_VIA_IICI,
294
.scsi_type = MAC_SCSI_LC,
295
.scc_type = MAC_SCC_II,
296
.floppy_type = MAC_FLOPPY_LC, /* SWIM */
297
}, {
298
.ident = MAC_MODEL_CCL,
299
.name = "Color Classic",
300
.adb_type = MAC_ADB_CUDA,
301
.via_type = MAC_VIA_IICI,
302
.scsi_type = MAC_SCSI_LC,
303
.scc_type = MAC_SCC_II,
304
.expansion_type = MAC_EXP_PDS,
305
.floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
306
}, {
307
.ident = MAC_MODEL_CCLII,
308
.name = "Color Classic II",
309
.adb_type = MAC_ADB_CUDA,
310
.via_type = MAC_VIA_IICI,
311
.scsi_type = MAC_SCSI_LC,
312
.scc_type = MAC_SCC_II,
313
.expansion_type = MAC_EXP_PDS,
314
.floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
315
},
316
317
/*
318
* Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
319
*/
320
321
{
322
.ident = MAC_MODEL_LC,
323
.name = "LC",
324
.adb_type = MAC_ADB_EGRET,
325
.via_type = MAC_VIA_IICI,
326
.scsi_type = MAC_SCSI_LC,
327
.scc_type = MAC_SCC_II,
328
.expansion_type = MAC_EXP_PDS,
329
.floppy_type = MAC_FLOPPY_LC, /* SWIM */
330
}, {
331
.ident = MAC_MODEL_LCII,
332
.name = "LC II",
333
.adb_type = MAC_ADB_EGRET,
334
.via_type = MAC_VIA_IICI,
335
.scsi_type = MAC_SCSI_LC,
336
.scc_type = MAC_SCC_II,
337
.expansion_type = MAC_EXP_PDS,
338
.floppy_type = MAC_FLOPPY_LC, /* SWIM */
339
}, {
340
.ident = MAC_MODEL_LCIII,
341
.name = "LC III",
342
.adb_type = MAC_ADB_EGRET,
343
.via_type = MAC_VIA_IICI,
344
.scsi_type = MAC_SCSI_LC,
345
.scc_type = MAC_SCC_II,
346
.expansion_type = MAC_EXP_PDS,
347
.floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
348
},
349
350
/*
351
* Quadra. Video is at 0xF9000000, via is like a MacII. We label it
352
* differently as some of the stuff connected to VIA2 seems different.
353
* Better SCSI chip and onboard ethernet using a NatSemi SONIC except
354
* the 660AV and 840AV which use an AMD 79C940 (MACE).
355
* The 700, 900 and 950 have some I/O chips in the wrong place to
356
* confuse us. The 840AV has a SCSI location of its own (same as
357
* the 660AV).
358
*/
359
360
{
361
.ident = MAC_MODEL_Q605,
362
.name = "Quadra 605",
363
.adb_type = MAC_ADB_CUDA,
364
.via_type = MAC_VIA_QUADRA,
365
.scsi_type = MAC_SCSI_QUADRA,
366
.scc_type = MAC_SCC_QUADRA,
367
.expansion_type = MAC_EXP_PDS,
368
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
369
}, {
370
.ident = MAC_MODEL_Q605_ACC,
371
.name = "Quadra 605",
372
.adb_type = MAC_ADB_CUDA,
373
.via_type = MAC_VIA_QUADRA,
374
.scsi_type = MAC_SCSI_QUADRA,
375
.scc_type = MAC_SCC_QUADRA,
376
.expansion_type = MAC_EXP_PDS,
377
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
378
}, {
379
.ident = MAC_MODEL_Q610,
380
.name = "Quadra 610",
381
.adb_type = MAC_ADB_II,
382
.via_type = MAC_VIA_QUADRA,
383
.scsi_type = MAC_SCSI_QUADRA,
384
.scc_type = MAC_SCC_QUADRA,
385
.ether_type = MAC_ETHER_SONIC,
386
.expansion_type = MAC_EXP_PDS_NUBUS,
387
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
388
}, {
389
.ident = MAC_MODEL_Q630,
390
.name = "Quadra 630",
391
.adb_type = MAC_ADB_CUDA,
392
.via_type = MAC_VIA_QUADRA,
393
.scsi_type = MAC_SCSI_QUADRA,
394
.ide_type = MAC_IDE_QUADRA,
395
.scc_type = MAC_SCC_QUADRA,
396
.expansion_type = MAC_EXP_PDS_COMM,
397
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
398
}, {
399
.ident = MAC_MODEL_Q650,
400
.name = "Quadra 650",
401
.adb_type = MAC_ADB_II,
402
.via_type = MAC_VIA_QUADRA,
403
.scsi_type = MAC_SCSI_QUADRA,
404
.scc_type = MAC_SCC_QUADRA,
405
.ether_type = MAC_ETHER_SONIC,
406
.expansion_type = MAC_EXP_PDS_NUBUS,
407
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
408
},
409
/* The Q700 does have a NS Sonic */
410
{
411
.ident = MAC_MODEL_Q700,
412
.name = "Quadra 700",
413
.adb_type = MAC_ADB_II,
414
.via_type = MAC_VIA_QUADRA,
415
.scsi_type = MAC_SCSI_QUADRA2,
416
.scc_type = MAC_SCC_QUADRA,
417
.ether_type = MAC_ETHER_SONIC,
418
.expansion_type = MAC_EXP_PDS_NUBUS,
419
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM */
420
}, {
421
.ident = MAC_MODEL_Q800,
422
.name = "Quadra 800",
423
.adb_type = MAC_ADB_II,
424
.via_type = MAC_VIA_QUADRA,
425
.scsi_type = MAC_SCSI_QUADRA,
426
.scc_type = MAC_SCC_QUADRA,
427
.ether_type = MAC_ETHER_SONIC,
428
.expansion_type = MAC_EXP_PDS_NUBUS,
429
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
430
}, {
431
.ident = MAC_MODEL_Q840,
432
.name = "Quadra 840AV",
433
.adb_type = MAC_ADB_CUDA,
434
.via_type = MAC_VIA_QUADRA,
435
.scsi_type = MAC_SCSI_QUADRA3,
436
.scc_type = MAC_SCC_PSC,
437
.ether_type = MAC_ETHER_MACE,
438
.expansion_type = MAC_EXP_NUBUS,
439
.floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
440
}, {
441
.ident = MAC_MODEL_Q900,
442
.name = "Quadra 900",
443
.adb_type = MAC_ADB_IOP,
444
.via_type = MAC_VIA_QUADRA,
445
.scsi_type = MAC_SCSI_QUADRA2,
446
.scc_type = MAC_SCC_IOP,
447
.ether_type = MAC_ETHER_SONIC,
448
.expansion_type = MAC_EXP_PDS_NUBUS,
449
.floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
450
}, {
451
.ident = MAC_MODEL_Q950,
452
.name = "Quadra 950",
453
.adb_type = MAC_ADB_IOP,
454
.via_type = MAC_VIA_QUADRA,
455
.scsi_type = MAC_SCSI_QUADRA2,
456
.scc_type = MAC_SCC_IOP,
457
.ether_type = MAC_ETHER_SONIC,
458
.expansion_type = MAC_EXP_PDS_NUBUS,
459
.floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
460
},
461
462
/*
463
* Performa - more LC type machines
464
*/
465
466
{
467
.ident = MAC_MODEL_P460,
468
.name = "Performa 460",
469
.adb_type = MAC_ADB_EGRET,
470
.via_type = MAC_VIA_IICI,
471
.scsi_type = MAC_SCSI_LC,
472
.scc_type = MAC_SCC_II,
473
.expansion_type = MAC_EXP_PDS,
474
.floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
475
}, {
476
.ident = MAC_MODEL_P475,
477
.name = "Performa 475",
478
.adb_type = MAC_ADB_CUDA,
479
.via_type = MAC_VIA_QUADRA,
480
.scsi_type = MAC_SCSI_QUADRA,
481
.scc_type = MAC_SCC_II,
482
.expansion_type = MAC_EXP_PDS,
483
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
484
}, {
485
.ident = MAC_MODEL_P475F,
486
.name = "Performa 475",
487
.adb_type = MAC_ADB_CUDA,
488
.via_type = MAC_VIA_QUADRA,
489
.scsi_type = MAC_SCSI_QUADRA,
490
.scc_type = MAC_SCC_II,
491
.expansion_type = MAC_EXP_PDS,
492
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
493
}, {
494
.ident = MAC_MODEL_P520,
495
.name = "Performa 520",
496
.adb_type = MAC_ADB_CUDA,
497
.via_type = MAC_VIA_IICI,
498
.scsi_type = MAC_SCSI_LC,
499
.scc_type = MAC_SCC_II,
500
.expansion_type = MAC_EXP_PDS,
501
.floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
502
}, {
503
.ident = MAC_MODEL_P550,
504
.name = "Performa 550",
505
.adb_type = MAC_ADB_CUDA,
506
.via_type = MAC_VIA_IICI,
507
.scsi_type = MAC_SCSI_LC,
508
.scc_type = MAC_SCC_II,
509
.expansion_type = MAC_EXP_PDS,
510
.floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
511
},
512
/* These have the comm slot, and therefore possibly SONIC ethernet */
513
{
514
.ident = MAC_MODEL_P575,
515
.name = "Performa 575",
516
.adb_type = MAC_ADB_CUDA,
517
.via_type = MAC_VIA_QUADRA,
518
.scsi_type = MAC_SCSI_QUADRA,
519
.scc_type = MAC_SCC_II,
520
.expansion_type = MAC_EXP_PDS_COMM,
521
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
522
}, {
523
.ident = MAC_MODEL_P588,
524
.name = "Performa 588",
525
.adb_type = MAC_ADB_CUDA,
526
.via_type = MAC_VIA_QUADRA,
527
.scsi_type = MAC_SCSI_QUADRA,
528
.ide_type = MAC_IDE_QUADRA,
529
.scc_type = MAC_SCC_II,
530
.expansion_type = MAC_EXP_PDS_COMM,
531
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
532
}, {
533
.ident = MAC_MODEL_TV,
534
.name = "TV",
535
.adb_type = MAC_ADB_CUDA,
536
.via_type = MAC_VIA_IICI,
537
.scsi_type = MAC_SCSI_LC,
538
.scc_type = MAC_SCC_II,
539
.floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
540
}, {
541
.ident = MAC_MODEL_P600,
542
.name = "Performa 600",
543
.adb_type = MAC_ADB_EGRET,
544
.via_type = MAC_VIA_IICI,
545
.scsi_type = MAC_SCSI_LC,
546
.scc_type = MAC_SCC_II,
547
.expansion_type = MAC_EXP_NUBUS,
548
.floppy_type = MAC_FLOPPY_LC, /* SWIM */
549
},
550
551
/*
552
* Centris - just guessing again; maybe like Quadra.
553
* The C610 may or may not have SONIC. We probe to make sure.
554
*/
555
556
{
557
.ident = MAC_MODEL_C610,
558
.name = "Centris 610",
559
.adb_type = MAC_ADB_II,
560
.via_type = MAC_VIA_QUADRA,
561
.scsi_type = MAC_SCSI_QUADRA,
562
.scc_type = MAC_SCC_QUADRA,
563
.ether_type = MAC_ETHER_SONIC,
564
.expansion_type = MAC_EXP_PDS_NUBUS,
565
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
566
}, {
567
.ident = MAC_MODEL_C650,
568
.name = "Centris 650",
569
.adb_type = MAC_ADB_II,
570
.via_type = MAC_VIA_QUADRA,
571
.scsi_type = MAC_SCSI_QUADRA,
572
.scc_type = MAC_SCC_QUADRA,
573
.ether_type = MAC_ETHER_SONIC,
574
.expansion_type = MAC_EXP_PDS_NUBUS,
575
.floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
576
}, {
577
.ident = MAC_MODEL_C660,
578
.name = "Centris 660AV",
579
.adb_type = MAC_ADB_CUDA,
580
.via_type = MAC_VIA_QUADRA,
581
.scsi_type = MAC_SCSI_QUADRA3,
582
.scc_type = MAC_SCC_PSC,
583
.ether_type = MAC_ETHER_MACE,
584
.expansion_type = MAC_EXP_PDS_NUBUS,
585
.floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
586
},
587
588
/*
589
* The PowerBooks all the same "Combo" custom IC for SCSI and SCC
590
* and a PMU (in two variations?) for ADB. Most of them use the
591
* Quadra-style VIAs. A few models also have IDE from hell.
592
*/
593
594
{
595
.ident = MAC_MODEL_PB140,
596
.name = "PowerBook 140",
597
.adb_type = MAC_ADB_PB1,
598
.via_type = MAC_VIA_QUADRA,
599
.scsi_type = MAC_SCSI_OLD,
600
.scc_type = MAC_SCC_QUADRA,
601
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
602
}, {
603
.ident = MAC_MODEL_PB145,
604
.name = "PowerBook 145",
605
.adb_type = MAC_ADB_PB1,
606
.via_type = MAC_VIA_QUADRA,
607
.scsi_type = MAC_SCSI_OLD,
608
.scc_type = MAC_SCC_QUADRA,
609
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
610
}, {
611
.ident = MAC_MODEL_PB150,
612
.name = "PowerBook 150",
613
.adb_type = MAC_ADB_PB2,
614
.via_type = MAC_VIA_IICI,
615
.scsi_type = MAC_SCSI_OLD,
616
.ide_type = MAC_IDE_PB,
617
.scc_type = MAC_SCC_QUADRA,
618
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
619
}, {
620
.ident = MAC_MODEL_PB160,
621
.name = "PowerBook 160",
622
.adb_type = MAC_ADB_PB1,
623
.via_type = MAC_VIA_QUADRA,
624
.scsi_type = MAC_SCSI_OLD,
625
.scc_type = MAC_SCC_QUADRA,
626
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
627
}, {
628
.ident = MAC_MODEL_PB165,
629
.name = "PowerBook 165",
630
.adb_type = MAC_ADB_PB1,
631
.via_type = MAC_VIA_QUADRA,
632
.scsi_type = MAC_SCSI_OLD,
633
.scc_type = MAC_SCC_QUADRA,
634
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
635
}, {
636
.ident = MAC_MODEL_PB165C,
637
.name = "PowerBook 165c",
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
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
643
}, {
644
.ident = MAC_MODEL_PB170,
645
.name = "PowerBook 170",
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
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
651
}, {
652
.ident = MAC_MODEL_PB180,
653
.name = "PowerBook 180",
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
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
659
}, {
660
.ident = MAC_MODEL_PB180C,
661
.name = "PowerBook 180c",
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
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
667
}, {
668
.ident = MAC_MODEL_PB190,
669
.name = "PowerBook 190",
670
.adb_type = MAC_ADB_PB2,
671
.via_type = MAC_VIA_QUADRA,
672
.scsi_type = MAC_SCSI_OLD,
673
.ide_type = MAC_IDE_BABOON,
674
.scc_type = MAC_SCC_QUADRA,
675
.floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */
676
}, {
677
.ident = MAC_MODEL_PB520,
678
.name = "PowerBook 520",
679
.adb_type = MAC_ADB_PB2,
680
.via_type = MAC_VIA_QUADRA,
681
.scsi_type = MAC_SCSI_OLD,
682
.scc_type = MAC_SCC_QUADRA,
683
.ether_type = MAC_ETHER_SONIC,
684
.floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */
685
},
686
687
/*
688
* PowerBook Duos are pretty much like normal PowerBooks
689
* All of these probably have onboard SONIC in the Dock which
690
* means we'll have to probe for it eventually.
691
*/
692
693
{
694
.ident = MAC_MODEL_PB210,
695
.name = "PowerBook Duo 210",
696
.adb_type = MAC_ADB_PB2,
697
.via_type = MAC_VIA_IICI,
698
.scsi_type = MAC_SCSI_DUO,
699
.scc_type = MAC_SCC_QUADRA,
700
.expansion_type = MAC_EXP_NUBUS,
701
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
702
}, {
703
.ident = MAC_MODEL_PB230,
704
.name = "PowerBook Duo 230",
705
.adb_type = MAC_ADB_PB2,
706
.via_type = MAC_VIA_IICI,
707
.scsi_type = MAC_SCSI_DUO,
708
.scc_type = MAC_SCC_QUADRA,
709
.expansion_type = MAC_EXP_NUBUS,
710
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
711
}, {
712
.ident = MAC_MODEL_PB250,
713
.name = "PowerBook Duo 250",
714
.adb_type = MAC_ADB_PB2,
715
.via_type = MAC_VIA_IICI,
716
.scsi_type = MAC_SCSI_DUO,
717
.scc_type = MAC_SCC_QUADRA,
718
.expansion_type = MAC_EXP_NUBUS,
719
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
720
}, {
721
.ident = MAC_MODEL_PB270C,
722
.name = "PowerBook Duo 270c",
723
.adb_type = MAC_ADB_PB2,
724
.via_type = MAC_VIA_IICI,
725
.scsi_type = MAC_SCSI_DUO,
726
.scc_type = MAC_SCC_QUADRA,
727
.expansion_type = MAC_EXP_NUBUS,
728
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
729
}, {
730
.ident = MAC_MODEL_PB280,
731
.name = "PowerBook Duo 280",
732
.adb_type = MAC_ADB_PB2,
733
.via_type = MAC_VIA_IICI,
734
.scsi_type = MAC_SCSI_DUO,
735
.scc_type = MAC_SCC_QUADRA,
736
.expansion_type = MAC_EXP_NUBUS,
737
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
738
}, {
739
.ident = MAC_MODEL_PB280C,
740
.name = "PowerBook Duo 280c",
741
.adb_type = MAC_ADB_PB2,
742
.via_type = MAC_VIA_IICI,
743
.scsi_type = MAC_SCSI_DUO,
744
.scc_type = MAC_SCC_QUADRA,
745
.expansion_type = MAC_EXP_NUBUS,
746
.floppy_type = MAC_FLOPPY_OLD, /* SWIM */
747
},
748
749
/*
750
* Other stuff?
751
*/
752
753
{
754
.ident = -1
755
}
756
};
757
758
static struct resource scc_a_rsrcs[] = {
759
{ .flags = IORESOURCE_MEM },
760
{ .flags = IORESOURCE_IRQ },
761
};
762
763
static struct resource scc_b_rsrcs[] = {
764
{ .flags = IORESOURCE_MEM },
765
{ .flags = IORESOURCE_IRQ },
766
};
767
768
struct platform_device scc_a_pdev = {
769
.name = "scc",
770
.id = 0,
771
};
772
EXPORT_SYMBOL(scc_a_pdev);
773
774
struct platform_device scc_b_pdev = {
775
.name = "scc",
776
.id = 1,
777
};
778
EXPORT_SYMBOL(scc_b_pdev);
779
780
static void __init mac_identify(void)
781
{
782
struct mac_model *m;
783
784
/* Penguin data useful? */
785
int model = mac_bi_data.id;
786
if (!model) {
787
/* no bootinfo model id -> NetBSD booter was used! */
788
/* XXX FIXME: breaks for model > 31 */
789
model = (mac_bi_data.cpuid >> 2) & 63;
790
pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
791
}
792
793
macintosh_config = mac_data_table;
794
for (m = &mac_data_table[1]; m->ident != -1; m++) {
795
if (m->ident == model) {
796
macintosh_config = m;
797
break;
798
}
799
}
800
801
/* Set up serial port resources for the console initcall. */
802
803
scc_a_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase + 2;
804
scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
805
scc_a_pdev.num_resources = ARRAY_SIZE(scc_a_rsrcs);
806
scc_a_pdev.resource = scc_a_rsrcs;
807
808
scc_b_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase;
809
scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
810
scc_b_pdev.num_resources = ARRAY_SIZE(scc_b_rsrcs);
811
scc_b_pdev.resource = scc_b_rsrcs;
812
813
switch (macintosh_config->scc_type) {
814
case MAC_SCC_PSC:
815
scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
816
scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
817
break;
818
default:
819
/* On non-PSC machines, the serial ports share an IRQ. */
820
if (macintosh_config->ident == MAC_MODEL_IIFX) {
821
scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
822
scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
823
} else {
824
scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
825
scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
826
}
827
break;
828
}
829
830
pr_info("Detected Macintosh model: %d\n", model);
831
832
/*
833
* Report booter data:
834
*/
835
printk(KERN_DEBUG " Penguin bootinfo data:\n");
836
printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
837
mac_bi_data.videoaddr, mac_bi_data.videorow,
838
mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
839
mac_bi_data.dimensions >> 16);
840
printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
841
mac_bi_data.videological, mac_orig_videoaddr,
842
mac_bi_data.sccbase);
843
printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
844
mac_bi_data.boottime, mac_bi_data.gmtbias);
845
printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
846
mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
847
848
iop_init();
849
oss_init();
850
via_init();
851
psc_init();
852
baboon_init();
853
854
#ifdef CONFIG_ADB_CUDA
855
find_via_cuda();
856
#endif
857
#ifdef CONFIG_ADB_PMU
858
find_via_pmu();
859
#endif
860
}
861
862
static void __init mac_report_hardware(void)
863
{
864
pr_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
}
872
873
static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
874
{
875
.flags = IORESOURCE_IRQ,
876
.start = IRQ_MAC_SCSI,
877
.end = IRQ_MAC_SCSI,
878
}, {
879
.flags = IORESOURCE_MEM,
880
.start = 0x50008000,
881
.end = 0x50009FFF,
882
}, {
883
.flags = IORESOURCE_MEM,
884
.start = 0x50008000,
885
.end = 0x50009FFF,
886
},
887
};
888
889
static const struct resource mac_scsi_duo_rsrc[] __initconst = {
890
{
891
.flags = IORESOURCE_MEM,
892
.start = 0xFEE02000,
893
.end = 0xFEE03FFF,
894
},
895
};
896
897
static const struct resource mac_scsi_old_rsrc[] __initconst = {
898
{
899
.flags = IORESOURCE_IRQ,
900
.start = IRQ_MAC_SCSI,
901
.end = IRQ_MAC_SCSI,
902
}, {
903
.flags = IORESOURCE_MEM,
904
.start = 0x50010000,
905
.end = 0x50011FFF,
906
}, {
907
.flags = IORESOURCE_MEM,
908
.start = 0x50006000,
909
.end = 0x50007FFF,
910
},
911
};
912
913
static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
914
{
915
.flags = IORESOURCE_IRQ,
916
.start = IRQ_MAC_SCSI,
917
.end = IRQ_MAC_SCSI,
918
}, {
919
.flags = IORESOURCE_MEM,
920
.start = 0x50F10000,
921
.end = 0x50F11FFF,
922
}, {
923
.flags = IORESOURCE_MEM,
924
.start = 0x50F06000,
925
.end = 0x50F07FFF,
926
},
927
};
928
929
static const struct resource mac_pata_quadra_rsrc[] __initconst = {
930
DEFINE_RES_MEM(0x50F1A000, 0x38),
931
DEFINE_RES_MEM(0x50F1A038, 0x04),
932
DEFINE_RES_IRQ(IRQ_NUBUS_F),
933
};
934
935
static const struct resource mac_pata_pb_rsrc[] __initconst = {
936
DEFINE_RES_MEM(0x50F1A000, 0x38),
937
DEFINE_RES_MEM(0x50F1A038, 0x04),
938
DEFINE_RES_IRQ(IRQ_NUBUS_C),
939
};
940
941
static const struct resource mac_pata_baboon_rsrc[] __initconst = {
942
DEFINE_RES_MEM(0x50F1A000, 0x38),
943
DEFINE_RES_MEM(0x50F1A038, 0x04),
944
DEFINE_RES_IRQ(IRQ_BABOON_1),
945
};
946
947
static const struct pata_platform_info mac_pata_data __initconst = {
948
.ioport_shift = 2,
949
};
950
951
static int __init mac_platform_init(void)
952
{
953
phys_addr_t swim_base = 0;
954
955
if (!MACH_IS_MAC)
956
return -ENODEV;
957
958
/*
959
* Serial devices
960
*/
961
962
platform_device_register(&scc_a_pdev);
963
platform_device_register(&scc_b_pdev);
964
965
/*
966
* Floppy device
967
*/
968
969
switch (macintosh_config->floppy_type) {
970
case MAC_FLOPPY_QUADRA:
971
swim_base = 0x5001E000;
972
break;
973
case MAC_FLOPPY_OLD:
974
swim_base = 0x50016000;
975
break;
976
case MAC_FLOPPY_LC:
977
swim_base = 0x50F16000;
978
break;
979
}
980
981
if (swim_base) {
982
struct resource swim_rsrc = {
983
.flags = IORESOURCE_MEM,
984
.start = swim_base,
985
.end = swim_base + 0x1FFF,
986
};
987
988
platform_device_register_simple("swim", -1, &swim_rsrc, 1);
989
}
990
991
/*
992
* SCSI device(s)
993
*/
994
995
switch (macintosh_config->scsi_type) {
996
case MAC_SCSI_QUADRA:
997
case MAC_SCSI_QUADRA3:
998
platform_device_register_simple("mac_esp", 0, NULL, 0);
999
break;
1000
case MAC_SCSI_QUADRA2:
1001
platform_device_register_simple("mac_esp", 0, NULL, 0);
1002
if ((macintosh_config->ident == MAC_MODEL_Q900) ||
1003
(macintosh_config->ident == MAC_MODEL_Q950))
1004
platform_device_register_simple("mac_esp", 1, NULL, 0);
1005
break;
1006
case MAC_SCSI_IIFX:
1007
/* Addresses from The Guide to Mac Family Hardware.
1008
* $5000 8000 - $5000 9FFF: SCSI DMA
1009
* $5000 A000 - $5000 BFFF: Alternate SCSI
1010
* $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
1011
* $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
1012
* The A/UX header file sys/uconfig.h says $50F0 8000.
1013
* The "SCSI DMA" custom IC embeds the 53C80 core and
1014
* supports Programmed IO, DMA and PDMA (hardware handshake).
1015
*/
1016
platform_device_register_simple("mac_scsi", 0,
1017
mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
1018
break;
1019
case MAC_SCSI_DUO:
1020
/* Addresses from the Duo Dock II Developer Note.
1021
* $FEE0 2000 - $FEE0 3FFF: normal mode
1022
* $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
1023
* $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
1024
* The NetBSD code indicates that both 5380 chips share
1025
* an IRQ (?) which would need careful handling (see mac_esp).
1026
*/
1027
platform_device_register_simple("mac_scsi", 1,
1028
mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
1029
fallthrough;
1030
case MAC_SCSI_OLD:
1031
/* Addresses from Developer Notes for Duo System,
1032
* PowerBook 180 & 160, 140 & 170, Macintosh IIsi
1033
* and also from The Guide to Mac Family Hardware for
1034
* SE/30, II, IIx, IIcx, IIci.
1035
* $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
1036
* $5001 0000 - $5001 1FFF: normal mode
1037
* $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
1038
* GMFH says that $5000 0000 - $50FF FFFF "wraps
1039
* $5000 0000 - $5001 FFFF eight times" (!)
1040
* mess.org says IIci and Color Classic do not alias
1041
* I/O address space.
1042
*/
1043
platform_device_register_simple("mac_scsi", 0,
1044
mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
1045
break;
1046
case MAC_SCSI_LC:
1047
/* Addresses from Mac LC data in Designing Cards & Drivers 3ed.
1048
* Also from the Developer Notes for Classic II, LC III,
1049
* Color Classic and IIvx.
1050
* $50F0 6000 - $50F0 7FFF: SCSI handshake
1051
* $50F1 0000 - $50F1 1FFF: SCSI
1052
* $50F1 2000 - $50F1 3FFF: SCSI DMA
1053
*/
1054
platform_device_register_simple("mac_scsi", 0,
1055
mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
1056
break;
1057
}
1058
1059
/*
1060
* IDE device
1061
*/
1062
1063
switch (macintosh_config->ide_type) {
1064
case MAC_IDE_QUADRA:
1065
platform_device_register_resndata(NULL, "pata_platform", -1,
1066
mac_pata_quadra_rsrc, ARRAY_SIZE(mac_pata_quadra_rsrc),
1067
&mac_pata_data, sizeof(mac_pata_data));
1068
break;
1069
case MAC_IDE_PB:
1070
platform_device_register_resndata(NULL, "pata_platform", -1,
1071
mac_pata_pb_rsrc, ARRAY_SIZE(mac_pata_pb_rsrc),
1072
&mac_pata_data, sizeof(mac_pata_data));
1073
break;
1074
case MAC_IDE_BABOON:
1075
platform_device_register_resndata(NULL, "pata_platform", -1,
1076
mac_pata_baboon_rsrc, ARRAY_SIZE(mac_pata_baboon_rsrc),
1077
&mac_pata_data, sizeof(mac_pata_data));
1078
break;
1079
}
1080
1081
/*
1082
* Ethernet device
1083
*/
1084
1085
if (macintosh_config->ether_type == MAC_ETHER_SONIC ||
1086
macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1087
platform_device_register_simple("macsonic", -1, NULL, 0);
1088
1089
if (macintosh_config->expansion_type == MAC_EXP_PDS ||
1090
macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1091
platform_device_register_simple("mac89x0", -1, NULL, 0);
1092
1093
if (macintosh_config->ether_type == MAC_ETHER_MACE)
1094
platform_device_register_simple("macmace", -1, NULL, 0);
1095
1096
return 0;
1097
}
1098
1099
arch_initcall(mac_platform_init);
1100
1101