config.c 27 KB

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