config.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. /*
  2. * linux/arch/m68k/atari/config.c
  3. *
  4. * Copyright (C) 1994 Bjoern Brauel
  5. *
  6. * 5/2/94 Roman Hodek:
  7. * Added setting of time_adj to get a better clock.
  8. *
  9. * 5/14/94 Roman Hodek:
  10. * gettod() for TT
  11. *
  12. * 5/15/94 Roman Hodek:
  13. * hard_reset_now() for Atari (and others?)
  14. *
  15. * 94/12/30 Andreas Schwab:
  16. * atari_sched_init fixed to get precise clock.
  17. *
  18. * This file is subject to the terms and conditions of the GNU General Public
  19. * License. See the file COPYING in the main directory of this archive
  20. * for more details.
  21. */
  22. /*
  23. * Miscellaneous atari stuff
  24. */
  25. #include <linux/config.h>
  26. #include <linux/types.h>
  27. #include <linux/mm.h>
  28. #include <linux/console.h>
  29. #include <linux/init.h>
  30. #include <linux/delay.h>
  31. #include <linux/ioport.h>
  32. #include <linux/vt_kern.h>
  33. #include <asm/bootinfo.h>
  34. #include <asm/setup.h>
  35. #include <asm/atarihw.h>
  36. #include <asm/atariints.h>
  37. #include <asm/atari_stram.h>
  38. #include <asm/system.h>
  39. #include <asm/machdep.h>
  40. #include <asm/hwtest.h>
  41. #include <asm/io.h>
  42. u_long atari_mch_cookie;
  43. u_long atari_mch_type;
  44. struct atari_hw_present atari_hw_present;
  45. u_long atari_switches;
  46. int atari_dont_touch_floppy_select;
  47. int atari_rtc_year_offset;
  48. /* local function prototypes */
  49. static void atari_reset( void );
  50. #ifdef CONFIG_ATARI_FLOPPY
  51. extern void atari_floppy_setup(char *, int *);
  52. #endif
  53. static void atari_get_model(char *model);
  54. static int atari_get_hardware_list(char *buffer);
  55. /* atari specific irq functions */
  56. extern void atari_init_IRQ (void);
  57. extern int atari_request_irq (unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
  58. unsigned long flags, const char *devname, void *dev_id);
  59. extern void atari_free_irq (unsigned int irq, void *dev_id);
  60. extern void atari_enable_irq (unsigned int);
  61. extern void atari_disable_irq (unsigned int);
  62. extern int show_atari_interrupts (struct seq_file *, void *);
  63. extern void atari_mksound( unsigned int count, unsigned int ticks );
  64. #ifdef CONFIG_HEARTBEAT
  65. static void atari_heartbeat( int on );
  66. #endif
  67. /* atari specific timer functions (in time.c) */
  68. extern void atari_sched_init(irqreturn_t (*)(int, void *, struct pt_regs *));
  69. extern unsigned long atari_gettimeoffset (void);
  70. extern int atari_mste_hwclk (int, struct rtc_time *);
  71. extern int atari_tt_hwclk (int, struct rtc_time *);
  72. extern int atari_mste_set_clock_mmss (unsigned long);
  73. extern int atari_tt_set_clock_mmss (unsigned long);
  74. /* atari specific debug functions (in debug.c) */
  75. extern void atari_debug_init(void);
  76. /* I've moved hwreg_present() and hwreg_present_bywrite() out into
  77. * mm/hwtest.c, to avoid having multiple copies of the same routine
  78. * in the kernel [I wanted them in hp300 and they were already used
  79. * in the nubus code. NB: I don't have an Atari so this might (just
  80. * conceivably) break something.
  81. * I've preserved the #if 0 version of hwreg_present_bywrite() here
  82. * for posterity.
  83. * -- Peter Maydell <pmaydell@chiark.greenend.org.uk>, 05/1998
  84. */
  85. #if 0
  86. static int __init
  87. hwreg_present_bywrite(volatile void *regp, unsigned char val)
  88. {
  89. int ret;
  90. long save_sp, save_vbr;
  91. static long tmp_vectors[3] = { [2] = (long)&&after_test };
  92. __asm__ __volatile__
  93. ( "movec %/vbr,%2\n\t" /* save vbr value */
  94. "movec %4,%/vbr\n\t" /* set up temporary vectors */
  95. "movel %/sp,%1\n\t" /* save sp */
  96. "moveq #0,%0\n\t" /* assume not present */
  97. "moveb %5,%3@\n\t" /* write the hardware reg */
  98. "cmpb %3@,%5\n\t" /* compare it */
  99. "seq %0" /* comes here only if reg */
  100. /* is present */
  101. : "=d&" (ret), "=r&" (save_sp), "=r&" (save_vbr)
  102. : "a" (regp), "r" (tmp_vectors), "d" (val)
  103. );
  104. after_test:
  105. __asm__ __volatile__
  106. ( "movel %0,%/sp\n\t" /* restore sp */
  107. "movec %1,%/vbr" /* restore vbr */
  108. : : "r" (save_sp), "r" (save_vbr) : "sp"
  109. );
  110. return( ret );
  111. }
  112. #endif
  113. /* ++roman: This is a more elaborate test for an SCC chip, since the plain
  114. * Medusa board generates DTACK at the SCC's standard addresses, but a SCC
  115. * board in the Medusa is possible. Also, the addresses where the ST_ESCC
  116. * resides generate DTACK without the chip, too.
  117. * The method is to write values into the interrupt vector register, that
  118. * should be readable without trouble (from channel A!).
  119. */
  120. static int __init scc_test( volatile char *ctla )
  121. {
  122. if (!hwreg_present( ctla ))
  123. return( 0 );
  124. MFPDELAY();
  125. *ctla = 2; MFPDELAY();
  126. *ctla = 0x40; MFPDELAY();
  127. *ctla = 2; MFPDELAY();
  128. if (*ctla != 0x40) return( 0 );
  129. MFPDELAY();
  130. *ctla = 2; MFPDELAY();
  131. *ctla = 0x60; MFPDELAY();
  132. *ctla = 2; MFPDELAY();
  133. if (*ctla != 0x60) return( 0 );
  134. return( 1 );
  135. }
  136. /*
  137. * Parse an Atari-specific record in the bootinfo
  138. */
  139. int __init atari_parse_bootinfo(const struct bi_record *record)
  140. {
  141. int unknown = 0;
  142. const u_long *data = record->data;
  143. switch (record->tag) {
  144. case BI_ATARI_MCH_COOKIE:
  145. atari_mch_cookie = *data;
  146. break;
  147. case BI_ATARI_MCH_TYPE:
  148. atari_mch_type = *data;
  149. break;
  150. default:
  151. unknown = 1;
  152. }
  153. return(unknown);
  154. }
  155. /* Parse the Atari-specific switches= option. */
  156. void __init atari_switches_setup( const char *str, unsigned len )
  157. {
  158. char switches[len+1];
  159. char *p;
  160. int ovsc_shift;
  161. char *args = switches;
  162. /* copy string to local array, strsep works destructively... */
  163. strlcpy( switches, str, sizeof(switches) );
  164. atari_switches = 0;
  165. /* parse the options */
  166. while ((p = strsep(&args, ",")) != NULL) {
  167. if (!*p) continue;
  168. ovsc_shift = 0;
  169. if (strncmp( p, "ov_", 3 ) == 0) {
  170. p += 3;
  171. ovsc_shift = ATARI_SWITCH_OVSC_SHIFT;
  172. }
  173. if (strcmp( p, "ikbd" ) == 0) {
  174. /* RTS line of IKBD ACIA */
  175. atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift;
  176. }
  177. else if (strcmp( p, "midi" ) == 0) {
  178. /* RTS line of MIDI ACIA */
  179. atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift;
  180. }
  181. else if (strcmp( p, "snd6" ) == 0) {
  182. atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift;
  183. }
  184. else if (strcmp( p, "snd7" ) == 0) {
  185. atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
  186. }
  187. }
  188. }
  189. /*
  190. * Setup the Atari configuration info
  191. */
  192. void __init config_atari(void)
  193. {
  194. unsigned short tos_version;
  195. memset(&atari_hw_present, 0, sizeof(atari_hw_present));
  196. atari_debug_init();
  197. ioport_resource.end = 0xFFFFFFFF; /* Change size of I/O space from 64KB
  198. to 4GB. */
  199. mach_sched_init = atari_sched_init;
  200. mach_init_IRQ = atari_init_IRQ;
  201. mach_request_irq = atari_request_irq;
  202. mach_free_irq = atari_free_irq;
  203. enable_irq = atari_enable_irq;
  204. disable_irq = atari_disable_irq;
  205. mach_get_model = atari_get_model;
  206. mach_get_hardware_list = atari_get_hardware_list;
  207. mach_get_irq_list = show_atari_interrupts;
  208. mach_gettimeoffset = atari_gettimeoffset;
  209. mach_reset = atari_reset;
  210. #ifdef CONFIG_ATARI_FLOPPY
  211. mach_floppy_setup = atari_floppy_setup;
  212. #endif
  213. #ifdef CONFIG_DUMMY_CONSOLE
  214. conswitchp = &dummy_con;
  215. #endif
  216. mach_max_dma_address = 0xffffff;
  217. #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
  218. mach_beep = atari_mksound;
  219. #endif
  220. #ifdef CONFIG_HEARTBEAT
  221. mach_heartbeat = atari_heartbeat;
  222. #endif
  223. /* Set switches as requested by the user */
  224. if (atari_switches & ATARI_SWITCH_IKBD)
  225. acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID;
  226. if (atari_switches & ATARI_SWITCH_MIDI)
  227. acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID;
  228. if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) {
  229. sound_ym.rd_data_reg_sel = 14;
  230. sound_ym.wd_data = sound_ym.rd_data_reg_sel |
  231. ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) |
  232. ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0);
  233. }
  234. /* ++bjoern:
  235. * Determine hardware present
  236. */
  237. printk( "Atari hardware found: " );
  238. if (MACH_IS_MEDUSA || MACH_IS_HADES) {
  239. /* There's no Atari video hardware on the Medusa, but all the
  240. * addresses below generate a DTACK so no bus error occurs! */
  241. }
  242. else if (hwreg_present( f030_xreg )) {
  243. ATARIHW_SET(VIDEL_SHIFTER);
  244. printk( "VIDEL " );
  245. /* This is a temporary hack: If there is Falcon video
  246. * hardware, we assume that the ST-DMA serves SCSI instead of
  247. * ACSI. In the future, there should be a better method for
  248. * this...
  249. */
  250. ATARIHW_SET(ST_SCSI);
  251. printk( "STDMA-SCSI " );
  252. }
  253. else if (hwreg_present( tt_palette )) {
  254. ATARIHW_SET(TT_SHIFTER);
  255. printk( "TT_SHIFTER " );
  256. }
  257. else if (hwreg_present( &shifter.bas_hi )) {
  258. if (hwreg_present( &shifter.bas_lo ) &&
  259. (shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) {
  260. ATARIHW_SET(EXTD_SHIFTER);
  261. printk( "EXTD_SHIFTER " );
  262. }
  263. else {
  264. ATARIHW_SET(STND_SHIFTER);
  265. printk( "STND_SHIFTER " );
  266. }
  267. }
  268. if (hwreg_present( &mfp.par_dt_reg )) {
  269. ATARIHW_SET(ST_MFP);
  270. printk( "ST_MFP " );
  271. }
  272. if (hwreg_present( &tt_mfp.par_dt_reg )) {
  273. ATARIHW_SET(TT_MFP);
  274. printk( "TT_MFP " );
  275. }
  276. if (hwreg_present( &tt_scsi_dma.dma_addr_hi )) {
  277. ATARIHW_SET(SCSI_DMA);
  278. printk( "TT_SCSI_DMA " );
  279. }
  280. if (!MACH_IS_HADES && hwreg_present( &st_dma.dma_hi )) {
  281. ATARIHW_SET(STND_DMA);
  282. printk( "STND_DMA " );
  283. }
  284. if (MACH_IS_MEDUSA || /* The ST-DMA address registers aren't readable
  285. * on all Medusas, so the test below may fail */
  286. (hwreg_present( &st_dma.dma_vhi ) &&
  287. (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) &&
  288. st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa &&
  289. (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) &&
  290. st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) {
  291. ATARIHW_SET(EXTD_DMA);
  292. printk( "EXTD_DMA " );
  293. }
  294. if (hwreg_present( &tt_scsi.scsi_data )) {
  295. ATARIHW_SET(TT_SCSI);
  296. printk( "TT_SCSI " );
  297. }
  298. if (hwreg_present( &sound_ym.rd_data_reg_sel )) {
  299. ATARIHW_SET(YM_2149);
  300. printk( "YM2149 " );
  301. }
  302. if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
  303. hwreg_present( &tt_dmasnd.ctrl )) {
  304. ATARIHW_SET(PCM_8BIT);
  305. printk( "PCM " );
  306. }
  307. if (!MACH_IS_HADES && hwreg_present( &falcon_codec.unused5 )) {
  308. ATARIHW_SET(CODEC);
  309. printk( "CODEC " );
  310. }
  311. if (hwreg_present( &dsp56k_host_interface.icr )) {
  312. ATARIHW_SET(DSP56K);
  313. printk( "DSP56K " );
  314. }
  315. if (hwreg_present( &tt_scc_dma.dma_ctrl ) &&
  316. #if 0
  317. /* This test sucks! Who knows some better? */
  318. (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) &&
  319. (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0)
  320. #else
  321. !MACH_IS_MEDUSA && !MACH_IS_HADES
  322. #endif
  323. ) {
  324. ATARIHW_SET(SCC_DMA);
  325. printk( "SCC_DMA " );
  326. }
  327. if (scc_test( &scc.cha_a_ctrl )) {
  328. ATARIHW_SET(SCC);
  329. printk( "SCC " );
  330. }
  331. if (scc_test( &st_escc.cha_b_ctrl )) {
  332. ATARIHW_SET( ST_ESCC );
  333. printk( "ST_ESCC " );
  334. }
  335. if (MACH_IS_HADES)
  336. {
  337. ATARIHW_SET( VME );
  338. printk( "VME " );
  339. }
  340. else if (hwreg_present( &tt_scu.sys_mask )) {
  341. ATARIHW_SET(SCU);
  342. /* Assume a VME bus if there's a SCU */
  343. ATARIHW_SET( VME );
  344. printk( "VME SCU " );
  345. }
  346. if (hwreg_present( (void *)(0xffff9210) )) {
  347. ATARIHW_SET(ANALOG_JOY);
  348. printk( "ANALOG_JOY " );
  349. }
  350. if (!MACH_IS_HADES && hwreg_present( blitter.halftone )) {
  351. ATARIHW_SET(BLITTER);
  352. printk( "BLITTER " );
  353. }
  354. if (hwreg_present((void *)0xfff00039)) {
  355. ATARIHW_SET(IDE);
  356. printk( "IDE " );
  357. }
  358. #if 1 /* This maybe wrong */
  359. if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
  360. hwreg_present( &tt_microwire.data ) &&
  361. hwreg_present( &tt_microwire.mask ) &&
  362. (tt_microwire.mask = 0x7ff,
  363. udelay(1),
  364. tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR,
  365. udelay(1),
  366. tt_microwire.data != 0)) {
  367. ATARIHW_SET(MICROWIRE);
  368. while (tt_microwire.mask != 0x7ff) ;
  369. printk( "MICROWIRE " );
  370. }
  371. #endif
  372. if (hwreg_present( &tt_rtc.regsel )) {
  373. ATARIHW_SET(TT_CLK);
  374. printk( "TT_CLK " );
  375. mach_hwclk = atari_tt_hwclk;
  376. mach_set_clock_mmss = atari_tt_set_clock_mmss;
  377. }
  378. if (!MACH_IS_HADES && hwreg_present( &mste_rtc.sec_ones)) {
  379. ATARIHW_SET(MSTE_CLK);
  380. printk( "MSTE_CLK ");
  381. mach_hwclk = atari_mste_hwclk;
  382. mach_set_clock_mmss = atari_mste_set_clock_mmss;
  383. }
  384. if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
  385. hwreg_present( &dma_wd.fdc_speed ) &&
  386. hwreg_write( &dma_wd.fdc_speed, 0 )) {
  387. ATARIHW_SET(FDCSPEED);
  388. printk( "FDC_SPEED ");
  389. }
  390. if (!MACH_IS_HADES && !ATARIHW_PRESENT(ST_SCSI)) {
  391. ATARIHW_SET(ACSI);
  392. printk( "ACSI " );
  393. }
  394. printk("\n");
  395. if (CPU_IS_040_OR_060)
  396. /* Now it seems to be safe to turn of the tt0 transparent
  397. * translation (the one that must not be turned off in
  398. * head.S...)
  399. */
  400. __asm__ volatile ("moveq #0,%/d0\n\t"
  401. ".chip 68040\n\t"
  402. "movec %%d0,%%itt0\n\t"
  403. "movec %%d0,%%dtt0\n\t"
  404. ".chip 68k"
  405. : /* no outputs */
  406. : /* no inputs */
  407. : "d0");
  408. /* allocator for memory that must reside in st-ram */
  409. atari_stram_init ();
  410. /* Set up a mapping for the VMEbus address region:
  411. *
  412. * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff
  413. * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at
  414. * 0xfe000000 virt., because this can be done with a single
  415. * transparent translation. On the 68040, lots of often unused
  416. * page tables would be needed otherwise. On a MegaSTE or similar,
  417. * the highest byte is stripped off by hardware due to the 24 bit
  418. * design of the bus.
  419. */
  420. if (CPU_IS_020_OR_030) {
  421. unsigned long tt1_val;
  422. tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache
  423. * inhibit, read and write, FDC mask = 3,
  424. * FDC val = 4 -> Supervisor only */
  425. __asm__ __volatile__ ( ".chip 68030\n\t"
  426. "pmove %0@,%/tt1\n\t"
  427. ".chip 68k"
  428. : : "a" (&tt1_val) );
  429. }
  430. else {
  431. __asm__ __volatile__
  432. ( "movel %0,%/d0\n\t"
  433. ".chip 68040\n\t"
  434. "movec %%d0,%%itt1\n\t"
  435. "movec %%d0,%%dtt1\n\t"
  436. ".chip 68k"
  437. :
  438. : "g" (0xfe00a040) /* Translate 0xfexxxxxx, enable,
  439. * supervisor only, non-cacheable/
  440. * serialized, writable */
  441. : "d0" );
  442. }
  443. /* Fetch tos version at Physical 2 */
  444. /* We my not be able to access this address if the kernel is
  445. loaded to st ram, since the first page is unmapped. On the
  446. Medusa this is always the case and there is nothing we can do
  447. about this, so we just assume the smaller offset. For the TT
  448. we use the fact that in head.S we have set up a mapping
  449. 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible
  450. in the last 16MB of the address space. */
  451. tos_version = (MACH_IS_MEDUSA || MACH_IS_HADES) ?
  452. 0xfff : *(unsigned short *)0xff000002;
  453. atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68;
  454. }
  455. #ifdef CONFIG_HEARTBEAT
  456. static void atari_heartbeat( int on )
  457. {
  458. unsigned char tmp;
  459. unsigned long flags;
  460. if (atari_dont_touch_floppy_select)
  461. return;
  462. local_irq_save(flags);
  463. sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */
  464. tmp = sound_ym.rd_data_reg_sel;
  465. sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02);
  466. local_irq_restore(flags);
  467. }
  468. #endif
  469. /* ++roman:
  470. *
  471. * This function does a reset on machines that lack the ability to
  472. * assert the processor's _RESET signal somehow via hardware. It is
  473. * based on the fact that you can find the initial SP and PC values
  474. * after a reset at physical addresses 0 and 4. This works pretty well
  475. * for Atari machines, since the lowest 8 bytes of physical memory are
  476. * really ROM (mapped by hardware). For other 680x0 machines: don't
  477. * know if it works...
  478. *
  479. * To get the values at addresses 0 and 4, the MMU better is turned
  480. * off first. After that, we have to jump into physical address space
  481. * (the PC before the pmove statement points to the virtual address of
  482. * the code). Getting that physical address is not hard, but the code
  483. * becomes a bit complex since I've tried to ensure that the jump
  484. * statement after the pmove is in the cache already (otherwise the
  485. * processor can't fetch it!). For that, the code first jumps to the
  486. * jump statement with the (virtual) address of the pmove section in
  487. * an address register . The jump statement is surely in the cache
  488. * now. After that, that physical address of the reset code is loaded
  489. * into the same address register, pmove is done and the same jump
  490. * statements goes to the reset code. Since there are not many
  491. * statements between the two jumps, I hope it stays in the cache.
  492. *
  493. * The C code makes heavy use of the GCC features that you can get the
  494. * address of a C label. No hope to compile this with another compiler
  495. * than GCC!
  496. */
  497. /* ++andreas: no need for complicated code, just depend on prefetch */
  498. static void atari_reset (void)
  499. {
  500. long tc_val = 0;
  501. long reset_addr;
  502. /* On the Medusa, phys. 0x4 may contain garbage because it's no
  503. ROM. See above for explanation why we cannot use PTOV(4). */
  504. reset_addr = MACH_IS_HADES ? 0x7fe00030 :
  505. MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 :
  506. *(unsigned long *) 0xff000004;
  507. /* reset ACIA for switch off OverScan, if it's active */
  508. if (atari_switches & ATARI_SWITCH_OVSC_IKBD)
  509. acia.key_ctrl = ACIA_RESET;
  510. if (atari_switches & ATARI_SWITCH_OVSC_MIDI)
  511. acia.mid_ctrl = ACIA_RESET;
  512. /* processor independent: turn off interrupts and reset the VBR;
  513. * the caches must be left enabled, else prefetching the final jump
  514. * instruction doesn't work. */
  515. local_irq_disable();
  516. __asm__ __volatile__
  517. ("moveq #0,%/d0\n\t"
  518. "movec %/d0,%/vbr"
  519. : : : "d0" );
  520. if (CPU_IS_040_OR_060) {
  521. unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
  522. if (CPU_IS_060) {
  523. /* 68060: clear PCR to turn off superscalar operation */
  524. __asm__ __volatile__
  525. ("moveq #0,%/d0\n\t"
  526. ".chip 68060\n\t"
  527. "movec %%d0,%%pcr\n\t"
  528. ".chip 68k"
  529. : : : "d0" );
  530. }
  531. __asm__ __volatile__
  532. ("movel %0,%/d0\n\t"
  533. "andl #0xff000000,%/d0\n\t"
  534. "orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */
  535. ".chip 68040\n\t"
  536. "movec %%d0,%%itt0\n\t"
  537. "movec %%d0,%%dtt0\n\t"
  538. ".chip 68k\n\t"
  539. "jmp %0@\n\t"
  540. : /* no outputs */
  541. : "a" (jmp_addr040)
  542. : "d0" );
  543. jmp_addr_label040:
  544. __asm__ __volatile__
  545. ("moveq #0,%/d0\n\t"
  546. "nop\n\t"
  547. ".chip 68040\n\t"
  548. "cinva %%bc\n\t"
  549. "nop\n\t"
  550. "pflusha\n\t"
  551. "nop\n\t"
  552. "movec %%d0,%%tc\n\t"
  553. "nop\n\t"
  554. /* the following setup of transparent translations is needed on the
  555. * Afterburner040 to successfully reboot. Other machines shouldn't
  556. * care about a different tt regs setup, they also didn't care in
  557. * the past that the regs weren't turned off. */
  558. "movel #0xffc000,%%d0\n\t" /* whole insn space cacheable */
  559. "movec %%d0,%%itt0\n\t"
  560. "movec %%d0,%%itt1\n\t"
  561. "orw #0x40,%/d0\n\t" /* whole data space non-cacheable/ser. */
  562. "movec %%d0,%%dtt0\n\t"
  563. "movec %%d0,%%dtt1\n\t"
  564. ".chip 68k\n\t"
  565. "jmp %0@"
  566. : /* no outputs */
  567. : "a" (reset_addr)
  568. : "d0");
  569. }
  570. else
  571. __asm__ __volatile__
  572. ("pmove %0@,%/tc\n\t"
  573. "jmp %1@"
  574. : /* no outputs */
  575. : "a" (&tc_val), "a" (reset_addr));
  576. }
  577. static void atari_get_model(char *model)
  578. {
  579. strcpy(model, "Atari ");
  580. switch (atari_mch_cookie >> 16) {
  581. case ATARI_MCH_ST:
  582. if (ATARIHW_PRESENT(MSTE_CLK))
  583. strcat (model, "Mega ST");
  584. else
  585. strcat (model, "ST");
  586. break;
  587. case ATARI_MCH_STE:
  588. if (MACH_IS_MSTE)
  589. strcat (model, "Mega STE");
  590. else
  591. strcat (model, "STE");
  592. break;
  593. case ATARI_MCH_TT:
  594. if (MACH_IS_MEDUSA)
  595. /* Medusa has TT _MCH cookie */
  596. strcat (model, "Medusa");
  597. else if (MACH_IS_HADES)
  598. strcat(model, "Hades");
  599. else
  600. strcat (model, "TT");
  601. break;
  602. case ATARI_MCH_FALCON:
  603. strcat (model, "Falcon");
  604. if (MACH_IS_AB40)
  605. strcat (model, " (with Afterburner040)");
  606. break;
  607. default:
  608. sprintf (model + strlen (model), "(unknown mach cookie 0x%lx)",
  609. atari_mch_cookie);
  610. break;
  611. }
  612. }
  613. static int atari_get_hardware_list(char *buffer)
  614. {
  615. int len = 0, i;
  616. for (i = 0; i < m68k_num_memory; i++)
  617. len += sprintf (buffer+len, "\t%3ld MB at 0x%08lx (%s)\n",
  618. m68k_memory[i].size >> 20, m68k_memory[i].addr,
  619. (m68k_memory[i].addr & 0xff000000 ?
  620. "alternate RAM" : "ST-RAM"));
  621. #define ATARIHW_ANNOUNCE(name,str) \
  622. if (ATARIHW_PRESENT(name)) \
  623. len += sprintf (buffer + len, "\t%s\n", str)
  624. len += sprintf (buffer + len, "Detected hardware:\n");
  625. ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter");
  626. ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter");
  627. ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter");
  628. ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter");
  629. ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator");
  630. ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound");
  631. ATARIHW_ANNOUNCE(CODEC, "CODEC Sound");
  632. ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)");
  633. ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)");
  634. ATARIHW_ANNOUNCE(ACSI, "ACSI Interface");
  635. ATARIHW_ANNOUNCE(IDE, "IDE Interface");
  636. ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC");
  637. ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901");
  638. ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901");
  639. ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530");
  640. ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230");
  641. ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface");
  642. ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface");
  643. ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)");
  644. ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)");
  645. ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380");
  646. ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC");
  647. ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A");
  648. ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15");
  649. ATARIHW_ANNOUNCE(SCU, "System Control Unit");
  650. ATARIHW_ANNOUNCE(BLITTER, "Blitter");
  651. ATARIHW_ANNOUNCE(VME, "VME Bus");
  652. ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor");
  653. return(len);
  654. }
  655. /*
  656. * Local variables:
  657. * c-indent-level: 4
  658. * tab-width: 8
  659. * End:
  660. */