config.c 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  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. * Miscellaneous linux stuff
  10. */
  11. #include <linux/module.h>
  12. #include <linux/types.h>
  13. #include <linux/mm.h>
  14. #include <linux/tty.h>
  15. #include <linux/console.h>
  16. #include <linux/interrupt.h>
  17. /* keyb */
  18. #include <linux/random.h>
  19. #include <linux/delay.h>
  20. /* keyb */
  21. #include <linux/init.h>
  22. #include <linux/vt_kern.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/adb.h>
  25. #include <linux/cuda.h>
  26. #define BOOTINFO_COMPAT_1_0
  27. #include <asm/setup.h>
  28. #include <asm/bootinfo.h>
  29. #include <asm/io.h>
  30. #include <asm/irq.h>
  31. #include <asm/pgtable.h>
  32. #include <asm/rtc.h>
  33. #include <asm/machdep.h>
  34. #include <asm/macintosh.h>
  35. #include <asm/macints.h>
  36. #include <asm/machw.h>
  37. #include <asm/mac_iop.h>
  38. #include <asm/mac_via.h>
  39. #include <asm/mac_oss.h>
  40. #include <asm/mac_psc.h>
  41. /* Mac bootinfo struct */
  42. struct mac_booter_data mac_bi_data;
  43. /* The phys. video addr. - might be bogus on some machines */
  44. static unsigned long mac_orig_videoaddr;
  45. /* Mac specific timer functions */
  46. extern unsigned long mac_gettimeoffset(void);
  47. extern int mac_hwclk(int, struct rtc_time *);
  48. extern int mac_set_clock_mmss(unsigned long);
  49. extern void iop_preinit(void);
  50. extern void iop_init(void);
  51. extern void via_init(void);
  52. extern void via_init_clock(irq_handler_t func);
  53. extern void via_flush_cache(void);
  54. extern void oss_init(void);
  55. extern void psc_init(void);
  56. extern void baboon_init(void);
  57. extern void mac_mksound(unsigned int, unsigned int);
  58. static void mac_get_model(char *str);
  59. static void mac_identify(void);
  60. static void mac_report_hardware(void);
  61. #ifdef CONFIG_EARLY_PRINTK
  62. asmlinkage void __init mac_early_print(const char *s, unsigned n);
  63. static void __init mac_early_cons_write(struct console *con,
  64. const char *s, unsigned n)
  65. {
  66. mac_early_print(s, n);
  67. }
  68. static struct console __initdata mac_early_cons = {
  69. .name = "early",
  70. .write = mac_early_cons_write,
  71. .flags = CON_PRINTBUFFER | CON_BOOT,
  72. .index = -1
  73. };
  74. int __init mac_unregister_early_cons(void)
  75. {
  76. /* mac_early_print can't be used after init sections are discarded */
  77. return unregister_console(&mac_early_cons);
  78. }
  79. late_initcall(mac_unregister_early_cons);
  80. #endif
  81. static void __init mac_sched_init(irq_handler_t vector)
  82. {
  83. via_init_clock(vector);
  84. }
  85. /*
  86. * Parse a Macintosh-specific record in the bootinfo
  87. */
  88. int __init mac_parse_bootinfo(const struct bi_record *record)
  89. {
  90. int unknown = 0;
  91. const u_long *data = record->data;
  92. switch (record->tag) {
  93. case BI_MAC_MODEL:
  94. mac_bi_data.id = *data;
  95. break;
  96. case BI_MAC_VADDR:
  97. mac_bi_data.videoaddr = *data;
  98. break;
  99. case BI_MAC_VDEPTH:
  100. mac_bi_data.videodepth = *data;
  101. break;
  102. case BI_MAC_VROW:
  103. mac_bi_data.videorow = *data;
  104. break;
  105. case BI_MAC_VDIM:
  106. mac_bi_data.dimensions = *data;
  107. break;
  108. case BI_MAC_VLOGICAL:
  109. mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
  110. mac_orig_videoaddr = *data;
  111. break;
  112. case BI_MAC_SCCBASE:
  113. mac_bi_data.sccbase = *data;
  114. break;
  115. case BI_MAC_BTIME:
  116. mac_bi_data.boottime = *data;
  117. break;
  118. case BI_MAC_GMTBIAS:
  119. mac_bi_data.gmtbias = *data;
  120. break;
  121. case BI_MAC_MEMSIZE:
  122. mac_bi_data.memsize = *data;
  123. break;
  124. case BI_MAC_CPUID:
  125. mac_bi_data.cpuid = *data;
  126. break;
  127. case BI_MAC_ROMBASE:
  128. mac_bi_data.rombase = *data;
  129. break;
  130. default:
  131. unknown = 1;
  132. break;
  133. }
  134. return unknown;
  135. }
  136. /*
  137. * Flip into 24bit mode for an instant - flushes the L2 cache card. We
  138. * have to disable interrupts for this. Our IRQ handlers will crap
  139. * themselves if they take an IRQ in 24bit mode!
  140. */
  141. static void mac_cache_card_flush(int writeback)
  142. {
  143. unsigned long flags;
  144. local_irq_save(flags);
  145. via_flush_cache();
  146. local_irq_restore(flags);
  147. }
  148. void __init config_mac(void)
  149. {
  150. if (!MACH_IS_MAC)
  151. printk(KERN_ERR "ERROR: no Mac, but config_mac() called!!\n");
  152. mach_sched_init = mac_sched_init;
  153. mach_init_IRQ = mac_init_IRQ;
  154. mach_get_model = mac_get_model;
  155. mach_gettimeoffset = mac_gettimeoffset;
  156. mach_hwclk = mac_hwclk;
  157. mach_set_clock_mmss = mac_set_clock_mmss;
  158. mach_reset = mac_reset;
  159. mach_halt = mac_poweroff;
  160. mach_power_off = mac_poweroff;
  161. mach_max_dma_address = 0xffffffff;
  162. #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
  163. mach_beep = mac_mksound;
  164. #endif
  165. #ifdef CONFIG_EARLY_PRINTK
  166. register_console(&mac_early_cons);
  167. #endif
  168. /*
  169. * Determine hardware present
  170. */
  171. mac_identify();
  172. mac_report_hardware();
  173. /*
  174. * AFAIK only the IIci takes a cache card. The IIfx has onboard
  175. * cache ... someone needs to figure out how to tell if it's on or
  176. * not.
  177. */
  178. if (macintosh_config->ident == MAC_MODEL_IICI
  179. || macintosh_config->ident == MAC_MODEL_IIFX)
  180. mach_l2_flush = mac_cache_card_flush;
  181. }
  182. /*
  183. * Macintosh Table: hardcoded model configuration data.
  184. *
  185. * Much of this was defined by Alan, based on who knows what docs.
  186. * I've added a lot more, and some of that was pure guesswork based
  187. * on hardware pages present on the Mac web site. Possibly wildly
  188. * inaccurate, so look here if a new Mac model won't run. Example: if
  189. * a Mac crashes immediately after the VIA1 registers have been dumped
  190. * to the screen, it probably died attempting to read DirB on a RBV.
  191. * Meaning it should have MAC_VIA_IICI here :-)
  192. */
  193. struct mac_model *macintosh_config;
  194. EXPORT_SYMBOL(macintosh_config);
  195. static struct mac_model mac_data_table[] = {
  196. /*
  197. * We'll pretend to be a Macintosh II, that's pretty safe.
  198. */
  199. {
  200. .ident = MAC_MODEL_II,
  201. .name = "Unknown",
  202. .adb_type = MAC_ADB_II,
  203. .via_type = MAC_VIA_II,
  204. .scsi_type = MAC_SCSI_OLD,
  205. .scc_type = MAC_SCC_II,
  206. .nubus_type = MAC_NUBUS,
  207. .floppy_type = MAC_FLOPPY_IWM,
  208. },
  209. /*
  210. * Original Mac II hardware
  211. */
  212. {
  213. .ident = MAC_MODEL_II,
  214. .name = "II",
  215. .adb_type = MAC_ADB_II,
  216. .via_type = MAC_VIA_II,
  217. .scsi_type = MAC_SCSI_OLD,
  218. .scc_type = MAC_SCC_II,
  219. .nubus_type = MAC_NUBUS,
  220. .floppy_type = MAC_FLOPPY_IWM,
  221. }, {
  222. .ident = MAC_MODEL_IIX,
  223. .name = "IIx",
  224. .adb_type = MAC_ADB_II,
  225. .via_type = MAC_VIA_II,
  226. .scsi_type = MAC_SCSI_OLD,
  227. .scc_type = MAC_SCC_II,
  228. .nubus_type = MAC_NUBUS,
  229. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  230. }, {
  231. .ident = MAC_MODEL_IICX,
  232. .name = "IIcx",
  233. .adb_type = MAC_ADB_II,
  234. .via_type = MAC_VIA_II,
  235. .scsi_type = MAC_SCSI_OLD,
  236. .scc_type = MAC_SCC_II,
  237. .nubus_type = MAC_NUBUS,
  238. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  239. }, {
  240. .ident = MAC_MODEL_SE30,
  241. .name = "SE/30",
  242. .adb_type = MAC_ADB_II,
  243. .via_type = MAC_VIA_II,
  244. .scsi_type = MAC_SCSI_OLD,
  245. .scc_type = MAC_SCC_II,
  246. .nubus_type = MAC_NUBUS,
  247. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  248. },
  249. /*
  250. * Weirdified Mac II hardware - all subtly different. Gee thanks
  251. * Apple. All these boxes seem to have VIA2 in a different place to
  252. * the Mac II (+1A000 rather than +4000)
  253. * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
  254. */
  255. {
  256. .ident = MAC_MODEL_IICI,
  257. .name = "IIci",
  258. .adb_type = MAC_ADB_II,
  259. .via_type = MAC_VIA_IICI,
  260. .scsi_type = MAC_SCSI_OLD,
  261. .scc_type = MAC_SCC_II,
  262. .nubus_type = MAC_NUBUS,
  263. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  264. }, {
  265. .ident = MAC_MODEL_IIFX,
  266. .name = "IIfx",
  267. .adb_type = MAC_ADB_IOP,
  268. .via_type = MAC_VIA_IICI,
  269. .scsi_type = MAC_SCSI_OLD,
  270. .scc_type = MAC_SCC_IOP,
  271. .nubus_type = MAC_NUBUS,
  272. .floppy_type = MAC_FLOPPY_SWIM_IOP,
  273. }, {
  274. .ident = MAC_MODEL_IISI,
  275. .name = "IIsi",
  276. .adb_type = MAC_ADB_IISI,
  277. .via_type = MAC_VIA_IICI,
  278. .scsi_type = MAC_SCSI_OLD,
  279. .scc_type = MAC_SCC_II,
  280. .nubus_type = MAC_NUBUS,
  281. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  282. }, {
  283. .ident = MAC_MODEL_IIVI,
  284. .name = "IIvi",
  285. .adb_type = MAC_ADB_IISI,
  286. .via_type = MAC_VIA_IICI,
  287. .scsi_type = MAC_SCSI_OLD,
  288. .scc_type = MAC_SCC_II,
  289. .nubus_type = MAC_NUBUS,
  290. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  291. }, {
  292. .ident = MAC_MODEL_IIVX,
  293. .name = "IIvx",
  294. .adb_type = MAC_ADB_IISI,
  295. .via_type = MAC_VIA_IICI,
  296. .scsi_type = MAC_SCSI_OLD,
  297. .scc_type = MAC_SCC_II,
  298. .nubus_type = MAC_NUBUS,
  299. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  300. },
  301. /*
  302. * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
  303. */
  304. {
  305. .ident = MAC_MODEL_CLII,
  306. .name = "Classic II",
  307. .adb_type = MAC_ADB_IISI,
  308. .via_type = MAC_VIA_IICI,
  309. .scsi_type = MAC_SCSI_OLD,
  310. .scc_type = MAC_SCC_II,
  311. .nubus_type = MAC_NUBUS,
  312. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  313. }, {
  314. .ident = MAC_MODEL_CCL,
  315. .name = "Color Classic",
  316. .adb_type = MAC_ADB_CUDA,
  317. .via_type = MAC_VIA_IICI,
  318. .scsi_type = MAC_SCSI_OLD,
  319. .scc_type = MAC_SCC_II,
  320. .nubus_type = MAC_NUBUS,
  321. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  322. }, {
  323. .ident = MAC_MODEL_CCLII,
  324. .name = "Color Classic II",
  325. .adb_type = MAC_ADB_CUDA,
  326. .via_type = MAC_VIA_IICI,
  327. .scsi_type = MAC_SCSI_OLD,
  328. .scc_type = MAC_SCC_II,
  329. .nubus_type = MAC_NUBUS,
  330. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  331. },
  332. /*
  333. * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
  334. */
  335. {
  336. .ident = MAC_MODEL_LC,
  337. .name = "LC",
  338. .adb_type = MAC_ADB_IISI,
  339. .via_type = MAC_VIA_IICI,
  340. .scsi_type = MAC_SCSI_OLD,
  341. .scc_type = MAC_SCC_II,
  342. .nubus_type = MAC_NUBUS,
  343. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  344. }, {
  345. .ident = MAC_MODEL_LCII,
  346. .name = "LC II",
  347. .adb_type = MAC_ADB_IISI,
  348. .via_type = MAC_VIA_IICI,
  349. .scsi_type = MAC_SCSI_OLD,
  350. .scc_type = MAC_SCC_II,
  351. .nubus_type = MAC_NUBUS,
  352. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  353. }, {
  354. .ident = MAC_MODEL_LCIII,
  355. .name = "LC III",
  356. .adb_type = MAC_ADB_IISI,
  357. .via_type = MAC_VIA_IICI,
  358. .scsi_type = MAC_SCSI_OLD,
  359. .scc_type = MAC_SCC_II,
  360. .nubus_type = MAC_NUBUS,
  361. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  362. },
  363. /*
  364. * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
  365. * differently as some of the stuff connected to VIA2 seems different.
  366. * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
  367. * the 660AV and 840AV which use an AMD 79C940 (MACE).
  368. * The 700, 900 and 950 have some I/O chips in the wrong place to
  369. * confuse us. The 840AV has a SCSI location of its own (same as
  370. * the 660AV).
  371. */
  372. {
  373. .ident = MAC_MODEL_Q605,
  374. .name = "Quadra 605",
  375. .adb_type = MAC_ADB_CUDA,
  376. .via_type = MAC_VIA_QUADRA,
  377. .scsi_type = MAC_SCSI_QUADRA,
  378. .scc_type = MAC_SCC_QUADRA,
  379. .nubus_type = MAC_NUBUS,
  380. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  381. }, {
  382. .ident = MAC_MODEL_Q605_ACC,
  383. .name = "Quadra 605",
  384. .adb_type = MAC_ADB_CUDA,
  385. .via_type = MAC_VIA_QUADRA,
  386. .scsi_type = MAC_SCSI_QUADRA,
  387. .scc_type = MAC_SCC_QUADRA,
  388. .nubus_type = MAC_NUBUS,
  389. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  390. }, {
  391. .ident = MAC_MODEL_Q610,
  392. .name = "Quadra 610",
  393. .adb_type = MAC_ADB_II,
  394. .via_type = MAC_VIA_QUADRA,
  395. .scsi_type = MAC_SCSI_QUADRA,
  396. .scc_type = MAC_SCC_QUADRA,
  397. .ether_type = MAC_ETHER_SONIC,
  398. .nubus_type = MAC_NUBUS,
  399. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  400. }, {
  401. .ident = MAC_MODEL_Q630,
  402. .name = "Quadra 630",
  403. .adb_type = MAC_ADB_CUDA,
  404. .via_type = MAC_VIA_QUADRA,
  405. .scsi_type = MAC_SCSI_QUADRA,
  406. .ide_type = MAC_IDE_QUADRA,
  407. .scc_type = MAC_SCC_QUADRA,
  408. .ether_type = MAC_ETHER_SONIC,
  409. .nubus_type = MAC_NUBUS,
  410. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  411. }, {
  412. .ident = MAC_MODEL_Q650,
  413. .name = "Quadra 650",
  414. .adb_type = MAC_ADB_II,
  415. .via_type = MAC_VIA_QUADRA,
  416. .scsi_type = MAC_SCSI_QUADRA,
  417. .scc_type = MAC_SCC_QUADRA,
  418. .ether_type = MAC_ETHER_SONIC,
  419. .nubus_type = MAC_NUBUS,
  420. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  421. },
  422. /* The Q700 does have a NS Sonic */
  423. {
  424. .ident = MAC_MODEL_Q700,
  425. .name = "Quadra 700",
  426. .adb_type = MAC_ADB_II,
  427. .via_type = MAC_VIA_QUADRA,
  428. .scsi_type = MAC_SCSI_QUADRA2,
  429. .scc_type = MAC_SCC_QUADRA,
  430. .ether_type = MAC_ETHER_SONIC,
  431. .nubus_type = MAC_NUBUS,
  432. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  433. }, {
  434. .ident = MAC_MODEL_Q800,
  435. .name = "Quadra 800",
  436. .adb_type = MAC_ADB_II,
  437. .via_type = MAC_VIA_QUADRA,
  438. .scsi_type = MAC_SCSI_QUADRA,
  439. .scc_type = MAC_SCC_QUADRA,
  440. .ether_type = MAC_ETHER_SONIC,
  441. .nubus_type = MAC_NUBUS,
  442. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  443. }, {
  444. .ident = MAC_MODEL_Q840,
  445. .name = "Quadra 840AV",
  446. .adb_type = MAC_ADB_CUDA,
  447. .via_type = MAC_VIA_QUADRA,
  448. .scsi_type = MAC_SCSI_QUADRA3,
  449. .scc_type = MAC_SCC_PSC,
  450. .ether_type = MAC_ETHER_MACE,
  451. .nubus_type = MAC_NUBUS,
  452. .floppy_type = MAC_FLOPPY_AV,
  453. }, {
  454. .ident = MAC_MODEL_Q900,
  455. .name = "Quadra 900",
  456. .adb_type = MAC_ADB_IOP,
  457. .via_type = MAC_VIA_QUADRA,
  458. .scsi_type = MAC_SCSI_QUADRA2,
  459. .scc_type = MAC_SCC_IOP,
  460. .ether_type = MAC_ETHER_SONIC,
  461. .nubus_type = MAC_NUBUS,
  462. .floppy_type = MAC_FLOPPY_SWIM_IOP,
  463. }, {
  464. .ident = MAC_MODEL_Q950,
  465. .name = "Quadra 950",
  466. .adb_type = MAC_ADB_IOP,
  467. .via_type = MAC_VIA_QUADRA,
  468. .scsi_type = MAC_SCSI_QUADRA2,
  469. .scc_type = MAC_SCC_IOP,
  470. .ether_type = MAC_ETHER_SONIC,
  471. .nubus_type = MAC_NUBUS,
  472. .floppy_type = MAC_FLOPPY_SWIM_IOP,
  473. },
  474. /*
  475. * Performa - more LC type machines
  476. */
  477. {
  478. .ident = MAC_MODEL_P460,
  479. .name = "Performa 460",
  480. .adb_type = MAC_ADB_IISI,
  481. .via_type = MAC_VIA_IICI,
  482. .scsi_type = MAC_SCSI_OLD,
  483. .scc_type = MAC_SCC_II,
  484. .nubus_type = MAC_NUBUS,
  485. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  486. }, {
  487. .ident = MAC_MODEL_P475,
  488. .name = "Performa 475",
  489. .adb_type = MAC_ADB_CUDA,
  490. .via_type = MAC_VIA_QUADRA,
  491. .scsi_type = MAC_SCSI_QUADRA,
  492. .scc_type = MAC_SCC_II,
  493. .nubus_type = MAC_NUBUS,
  494. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  495. }, {
  496. .ident = MAC_MODEL_P475F,
  497. .name = "Performa 475",
  498. .adb_type = MAC_ADB_CUDA,
  499. .via_type = MAC_VIA_QUADRA,
  500. .scsi_type = MAC_SCSI_QUADRA,
  501. .scc_type = MAC_SCC_II,
  502. .nubus_type = MAC_NUBUS,
  503. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  504. }, {
  505. .ident = MAC_MODEL_P520,
  506. .name = "Performa 520",
  507. .adb_type = MAC_ADB_CUDA,
  508. .via_type = MAC_VIA_IICI,
  509. .scsi_type = MAC_SCSI_OLD,
  510. .scc_type = MAC_SCC_II,
  511. .nubus_type = MAC_NUBUS,
  512. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  513. }, {
  514. .ident = MAC_MODEL_P550,
  515. .name = "Performa 550",
  516. .adb_type = MAC_ADB_CUDA,
  517. .via_type = MAC_VIA_IICI,
  518. .scsi_type = MAC_SCSI_OLD,
  519. .scc_type = MAC_SCC_II,
  520. .nubus_type = MAC_NUBUS,
  521. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  522. },
  523. /* These have the comm slot, and therefore possibly SONIC ethernet */
  524. {
  525. .ident = MAC_MODEL_P575,
  526. .name = "Performa 575",
  527. .adb_type = MAC_ADB_CUDA,
  528. .via_type = MAC_VIA_QUADRA,
  529. .scsi_type = MAC_SCSI_QUADRA,
  530. .scc_type = MAC_SCC_II,
  531. .ether_type = MAC_ETHER_SONIC,
  532. .nubus_type = MAC_NUBUS,
  533. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  534. }, {
  535. .ident = MAC_MODEL_P588,
  536. .name = "Performa 588",
  537. .adb_type = MAC_ADB_CUDA,
  538. .via_type = MAC_VIA_QUADRA,
  539. .scsi_type = MAC_SCSI_QUADRA,
  540. .ide_type = MAC_IDE_QUADRA,
  541. .scc_type = MAC_SCC_II,
  542. .ether_type = MAC_ETHER_SONIC,
  543. .nubus_type = MAC_NUBUS,
  544. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  545. }, {
  546. .ident = MAC_MODEL_TV,
  547. .name = "TV",
  548. .adb_type = MAC_ADB_CUDA,
  549. .via_type = MAC_VIA_IICI,
  550. .scsi_type = MAC_SCSI_OLD,
  551. .scc_type = MAC_SCC_II,
  552. .nubus_type = MAC_NUBUS,
  553. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  554. }, {
  555. .ident = MAC_MODEL_P600,
  556. .name = "Performa 600",
  557. .adb_type = MAC_ADB_IISI,
  558. .via_type = MAC_VIA_IICI,
  559. .scsi_type = MAC_SCSI_OLD,
  560. .scc_type = MAC_SCC_II,
  561. .nubus_type = MAC_NUBUS,
  562. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  563. },
  564. /*
  565. * Centris - just guessing again; maybe like Quadra.
  566. * The C610 may or may not have SONIC. We probe to make sure.
  567. */
  568. {
  569. .ident = MAC_MODEL_C610,
  570. .name = "Centris 610",
  571. .adb_type = MAC_ADB_II,
  572. .via_type = MAC_VIA_QUADRA,
  573. .scsi_type = MAC_SCSI_QUADRA,
  574. .scc_type = MAC_SCC_QUADRA,
  575. .ether_type = MAC_ETHER_SONIC,
  576. .nubus_type = MAC_NUBUS,
  577. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  578. }, {
  579. .ident = MAC_MODEL_C650,
  580. .name = "Centris 650",
  581. .adb_type = MAC_ADB_II,
  582. .via_type = MAC_VIA_QUADRA,
  583. .scsi_type = MAC_SCSI_QUADRA,
  584. .scc_type = MAC_SCC_QUADRA,
  585. .ether_type = MAC_ETHER_SONIC,
  586. .nubus_type = MAC_NUBUS,
  587. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  588. }, {
  589. .ident = MAC_MODEL_C660,
  590. .name = "Centris 660AV",
  591. .adb_type = MAC_ADB_CUDA,
  592. .via_type = MAC_VIA_QUADRA,
  593. .scsi_type = MAC_SCSI_QUADRA3,
  594. .scc_type = MAC_SCC_PSC,
  595. .ether_type = MAC_ETHER_MACE,
  596. .nubus_type = MAC_NUBUS,
  597. .floppy_type = MAC_FLOPPY_AV,
  598. },
  599. /*
  600. * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
  601. * and a PMU (in two variations?) for ADB. Most of them use the
  602. * Quadra-style VIAs. A few models also have IDE from hell.
  603. */
  604. {
  605. .ident = MAC_MODEL_PB140,
  606. .name = "PowerBook 140",
  607. .adb_type = MAC_ADB_PB1,
  608. .via_type = MAC_VIA_QUADRA,
  609. .scsi_type = MAC_SCSI_OLD,
  610. .scc_type = MAC_SCC_QUADRA,
  611. .nubus_type = MAC_NUBUS,
  612. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  613. }, {
  614. .ident = MAC_MODEL_PB145,
  615. .name = "PowerBook 145",
  616. .adb_type = MAC_ADB_PB1,
  617. .via_type = MAC_VIA_QUADRA,
  618. .scsi_type = MAC_SCSI_OLD,
  619. .scc_type = MAC_SCC_QUADRA,
  620. .nubus_type = MAC_NUBUS,
  621. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  622. }, {
  623. .ident = MAC_MODEL_PB150,
  624. .name = "PowerBook 150",
  625. .adb_type = MAC_ADB_PB2,
  626. .via_type = MAC_VIA_IICI,
  627. .scsi_type = MAC_SCSI_OLD,
  628. .ide_type = MAC_IDE_PB,
  629. .scc_type = MAC_SCC_QUADRA,
  630. .nubus_type = MAC_NUBUS,
  631. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  632. }, {
  633. .ident = MAC_MODEL_PB160,
  634. .name = "PowerBook 160",
  635. .adb_type = MAC_ADB_PB1,
  636. .via_type = MAC_VIA_QUADRA,
  637. .scsi_type = MAC_SCSI_OLD,
  638. .scc_type = MAC_SCC_QUADRA,
  639. .nubus_type = MAC_NUBUS,
  640. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  641. }, {
  642. .ident = MAC_MODEL_PB165,
  643. .name = "PowerBook 165",
  644. .adb_type = MAC_ADB_PB1,
  645. .via_type = MAC_VIA_QUADRA,
  646. .scsi_type = MAC_SCSI_OLD,
  647. .scc_type = MAC_SCC_QUADRA,
  648. .nubus_type = MAC_NUBUS,
  649. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  650. }, {
  651. .ident = MAC_MODEL_PB165C,
  652. .name = "PowerBook 165c",
  653. .adb_type = MAC_ADB_PB1,
  654. .via_type = MAC_VIA_QUADRA,
  655. .scsi_type = MAC_SCSI_OLD,
  656. .scc_type = MAC_SCC_QUADRA,
  657. .nubus_type = MAC_NUBUS,
  658. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  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. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  668. }, {
  669. .ident = MAC_MODEL_PB180,
  670. .name = "PowerBook 180",
  671. .adb_type = MAC_ADB_PB1,
  672. .via_type = MAC_VIA_QUADRA,
  673. .scsi_type = MAC_SCSI_OLD,
  674. .scc_type = MAC_SCC_QUADRA,
  675. .nubus_type = MAC_NUBUS,
  676. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  677. }, {
  678. .ident = MAC_MODEL_PB180C,
  679. .name = "PowerBook 180c",
  680. .adb_type = MAC_ADB_PB1,
  681. .via_type = MAC_VIA_QUADRA,
  682. .scsi_type = MAC_SCSI_OLD,
  683. .scc_type = MAC_SCC_QUADRA,
  684. .nubus_type = MAC_NUBUS,
  685. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  686. }, {
  687. .ident = MAC_MODEL_PB190,
  688. .name = "PowerBook 190",
  689. .adb_type = MAC_ADB_PB2,
  690. .via_type = MAC_VIA_QUADRA,
  691. .scsi_type = MAC_SCSI_OLD,
  692. .ide_type = MAC_IDE_BABOON,
  693. .scc_type = MAC_SCC_QUADRA,
  694. .nubus_type = MAC_NUBUS,
  695. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  696. }, {
  697. .ident = MAC_MODEL_PB520,
  698. .name = "PowerBook 520",
  699. .adb_type = MAC_ADB_PB2,
  700. .via_type = MAC_VIA_QUADRA,
  701. .scsi_type = MAC_SCSI_OLD,
  702. .scc_type = MAC_SCC_QUADRA,
  703. .ether_type = MAC_ETHER_SONIC,
  704. .nubus_type = MAC_NUBUS,
  705. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  706. },
  707. /*
  708. * PowerBook Duos are pretty much like normal PowerBooks
  709. * All of these probably have onboard SONIC in the Dock which
  710. * means we'll have to probe for it eventually.
  711. */
  712. {
  713. .ident = MAC_MODEL_PB210,
  714. .name = "PowerBook Duo 210",
  715. .adb_type = MAC_ADB_PB2,
  716. .via_type = MAC_VIA_IICI,
  717. .scsi_type = MAC_SCSI_OLD,
  718. .scc_type = MAC_SCC_QUADRA,
  719. .nubus_type = MAC_NUBUS,
  720. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  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. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  730. }, {
  731. .ident = MAC_MODEL_PB250,
  732. .name = "PowerBook Duo 250",
  733. .adb_type = MAC_ADB_PB2,
  734. .via_type = MAC_VIA_IICI,
  735. .scsi_type = MAC_SCSI_OLD,
  736. .scc_type = MAC_SCC_QUADRA,
  737. .nubus_type = MAC_NUBUS,
  738. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  739. }, {
  740. .ident = MAC_MODEL_PB270C,
  741. .name = "PowerBook Duo 270c",
  742. .adb_type = MAC_ADB_PB2,
  743. .via_type = MAC_VIA_IICI,
  744. .scsi_type = MAC_SCSI_OLD,
  745. .scc_type = MAC_SCC_QUADRA,
  746. .nubus_type = MAC_NUBUS,
  747. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  748. }, {
  749. .ident = MAC_MODEL_PB280,
  750. .name = "PowerBook Duo 280",
  751. .adb_type = MAC_ADB_PB2,
  752. .via_type = MAC_VIA_IICI,
  753. .scsi_type = MAC_SCSI_OLD,
  754. .scc_type = MAC_SCC_QUADRA,
  755. .nubus_type = MAC_NUBUS,
  756. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  757. }, {
  758. .ident = MAC_MODEL_PB280C,
  759. .name = "PowerBook Duo 280c",
  760. .adb_type = MAC_ADB_PB2,
  761. .via_type = MAC_VIA_IICI,
  762. .scsi_type = MAC_SCSI_OLD,
  763. .scc_type = MAC_SCC_QUADRA,
  764. .nubus_type = MAC_NUBUS,
  765. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  766. },
  767. /*
  768. * Other stuff?
  769. */
  770. {
  771. .ident = -1
  772. }
  773. };
  774. static struct resource scc_a_rsrcs[] = {
  775. { .flags = IORESOURCE_MEM },
  776. { .flags = IORESOURCE_IRQ },
  777. };
  778. static struct resource scc_b_rsrcs[] = {
  779. { .flags = IORESOURCE_MEM },
  780. { .flags = IORESOURCE_IRQ },
  781. };
  782. struct platform_device scc_a_pdev = {
  783. .name = "scc",
  784. .id = 0,
  785. .num_resources = ARRAY_SIZE(scc_a_rsrcs),
  786. .resource = scc_a_rsrcs,
  787. };
  788. EXPORT_SYMBOL(scc_a_pdev);
  789. struct platform_device scc_b_pdev = {
  790. .name = "scc",
  791. .id = 1,
  792. .num_resources = ARRAY_SIZE(scc_b_rsrcs),
  793. .resource = scc_b_rsrcs,
  794. };
  795. EXPORT_SYMBOL(scc_b_pdev);
  796. static void __init mac_identify(void)
  797. {
  798. struct mac_model *m;
  799. /* Penguin data useful? */
  800. int model = mac_bi_data.id;
  801. if (!model) {
  802. /* no bootinfo model id -> NetBSD booter was used! */
  803. /* XXX FIXME: breaks for model > 31 */
  804. model = (mac_bi_data.cpuid >> 2) & 63;
  805. printk(KERN_WARNING "No bootinfo model ID, using cpuid instead "
  806. "(obsolete bootloader?)\n");
  807. }
  808. macintosh_config = mac_data_table;
  809. for (m = macintosh_config; m->ident != -1; m++) {
  810. if (m->ident == model) {
  811. macintosh_config = m;
  812. break;
  813. }
  814. }
  815. /* Set up serial port resources for the console initcall. */
  816. scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
  817. scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
  818. scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
  819. scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
  820. switch (macintosh_config->scc_type) {
  821. case MAC_SCC_PSC:
  822. scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
  823. scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
  824. break;
  825. default:
  826. /* On non-PSC machines, the serial ports share an IRQ. */
  827. if (macintosh_config->ident == MAC_MODEL_IIFX) {
  828. scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
  829. scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
  830. } else {
  831. scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
  832. scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
  833. }
  834. break;
  835. }
  836. /*
  837. * We need to pre-init the IOPs, if any. Otherwise
  838. * the serial console won't work if the user had
  839. * the serial ports set to "Faster" mode in MacOS.
  840. */
  841. iop_preinit();
  842. printk(KERN_INFO "Detected Macintosh model: %d\n", model);
  843. /*
  844. * Report booter data:
  845. */
  846. printk(KERN_DEBUG " Penguin bootinfo data:\n");
  847. printk(KERN_DEBUG " Video: addr 0x%lx "
  848. "row 0x%lx depth %lx dimensions %ld x %ld\n",
  849. mac_bi_data.videoaddr, mac_bi_data.videorow,
  850. mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
  851. mac_bi_data.dimensions >> 16);
  852. printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
  853. mac_bi_data.videological, mac_orig_videoaddr,
  854. mac_bi_data.sccbase);
  855. printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
  856. mac_bi_data.boottime, mac_bi_data.gmtbias);
  857. printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
  858. mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
  859. iop_init();
  860. via_init();
  861. oss_init();
  862. psc_init();
  863. baboon_init();
  864. #ifdef CONFIG_ADB_CUDA
  865. find_via_cuda();
  866. #endif
  867. }
  868. static void __init mac_report_hardware(void)
  869. {
  870. printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
  871. }
  872. static void mac_get_model(char *str)
  873. {
  874. strcpy(str, "Macintosh ");
  875. strcat(str, macintosh_config->name);
  876. }
  877. static struct resource swim_rsrc = { .flags = IORESOURCE_MEM };
  878. static struct platform_device swim_pdev = {
  879. .name = "swim",
  880. .id = -1,
  881. .num_resources = 1,
  882. .resource = &swim_rsrc,
  883. };
  884. static struct platform_device esp_0_pdev = {
  885. .name = "mac_esp",
  886. .id = 0,
  887. };
  888. static struct platform_device esp_1_pdev = {
  889. .name = "mac_esp",
  890. .id = 1,
  891. };
  892. static struct platform_device sonic_pdev = {
  893. .name = "macsonic",
  894. .id = -1,
  895. };
  896. static struct platform_device mace_pdev = {
  897. .name = "macmace",
  898. .id = -1,
  899. };
  900. int __init mac_platform_init(void)
  901. {
  902. u8 *swim_base;
  903. if (!MACH_IS_MAC)
  904. return -ENODEV;
  905. /*
  906. * Serial devices
  907. */
  908. platform_device_register(&scc_a_pdev);
  909. platform_device_register(&scc_b_pdev);
  910. /*
  911. * Floppy device
  912. */
  913. switch (macintosh_config->floppy_type) {
  914. case MAC_FLOPPY_SWIM_ADDR1:
  915. swim_base = (u8 *)(VIA1_BASE + 0x1E000);
  916. break;
  917. case MAC_FLOPPY_SWIM_ADDR2:
  918. swim_base = (u8 *)(VIA1_BASE + 0x16000);
  919. break;
  920. default:
  921. swim_base = NULL;
  922. break;
  923. }
  924. if (swim_base) {
  925. swim_rsrc.start = (resource_size_t) swim_base,
  926. swim_rsrc.end = (resource_size_t) swim_base + 0x2000,
  927. platform_device_register(&swim_pdev);
  928. }
  929. /*
  930. * SCSI device(s)
  931. */
  932. switch (macintosh_config->scsi_type) {
  933. case MAC_SCSI_QUADRA:
  934. case MAC_SCSI_QUADRA3:
  935. platform_device_register(&esp_0_pdev);
  936. break;
  937. case MAC_SCSI_QUADRA2:
  938. platform_device_register(&esp_0_pdev);
  939. if ((macintosh_config->ident == MAC_MODEL_Q900) ||
  940. (macintosh_config->ident == MAC_MODEL_Q950))
  941. platform_device_register(&esp_1_pdev);
  942. break;
  943. }
  944. /*
  945. * Ethernet device
  946. */
  947. switch (macintosh_config->ether_type) {
  948. case MAC_ETHER_SONIC:
  949. platform_device_register(&sonic_pdev);
  950. break;
  951. case MAC_ETHER_MACE:
  952. platform_device_register(&mace_pdev);
  953. break;
  954. }
  955. return 0;
  956. }
  957. arch_initcall(mac_platform_init);