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