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