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