2 * linux/arch/m68k/amiga/config.c
4 * Copyright (C) 1993 Hamish Macdonald
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
12 * Miscellaneous Amiga stuff
15 #include <linux/config.h>
16 #include <linux/types.h>
17 #include <linux/kernel.h>
19 #include <linux/tty.h>
20 #include <linux/console.h>
21 #include <linux/rtc.h>
22 #include <linux/init.h>
23 #include <linux/vt_kern.h>
24 #include <linux/delay.h>
25 #include <linux/interrupt.h>
27 #include <linux/zorro.h>
30 #include <asm/bootinfo.h>
31 #include <asm/setup.h>
32 #include <asm/system.h>
33 #include <asm/pgtable.h>
34 #include <asm/amigahw.h>
35 #include <asm/amigaints.h>
38 #include <asm/machdep.h>
41 unsigned long amiga_model;
42 unsigned long amiga_eclock;
43 unsigned long amiga_masterclock;
44 unsigned long amiga_colorclock;
45 unsigned long amiga_chipset;
46 unsigned char amiga_vblank;
47 unsigned char amiga_psfreq;
48 struct amiga_hw_present amiga_hw_present;
50 static char s_a500[] __initdata = "A500";
51 static char s_a500p[] __initdata = "A500+";
52 static char s_a600[] __initdata = "A600";
53 static char s_a1000[] __initdata = "A1000";
54 static char s_a1200[] __initdata = "A1200";
55 static char s_a2000[] __initdata = "A2000";
56 static char s_a2500[] __initdata = "A2500";
57 static char s_a3000[] __initdata = "A3000";
58 static char s_a3000t[] __initdata = "A3000T";
59 static char s_a3000p[] __initdata = "A3000+";
60 static char s_a4000[] __initdata = "A4000";
61 static char s_a4000t[] __initdata = "A4000T";
62 static char s_cdtv[] __initdata = "CDTV";
63 static char s_cd32[] __initdata = "CD32";
64 static char s_draco[] __initdata = "Draco";
65 static char *amiga_models[] __initdata = {
66 [AMI_500-AMI_500] = s_a500,
67 [AMI_500PLUS-AMI_500] = s_a500p,
68 [AMI_600-AMI_500] = s_a600,
69 [AMI_1000-AMI_500] = s_a1000,
70 [AMI_1200-AMI_500] = s_a1200,
71 [AMI_2000-AMI_500] = s_a2000,
72 [AMI_2500-AMI_500] = s_a2500,
73 [AMI_3000-AMI_500] = s_a3000,
74 [AMI_3000T-AMI_500] = s_a3000t,
75 [AMI_3000PLUS-AMI_500] = s_a3000p,
76 [AMI_4000-AMI_500] = s_a4000,
77 [AMI_4000T-AMI_500] = s_a4000t,
78 [AMI_CDTV-AMI_500] = s_cdtv,
79 [AMI_CD32-AMI_500] = s_cd32,
80 [AMI_DRACO-AMI_500] = s_draco,
83 static char amiga_model_name[13] = "Amiga ";
85 extern char m68k_debug_device[];
87 static void amiga_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
88 /* amiga specific irq functions */
89 extern void amiga_init_IRQ (void);
90 extern irqreturn_t (*amiga_default_handler[]) (int, void *, struct pt_regs *);
91 extern int amiga_request_irq (unsigned int irq,
92 irqreturn_t (*handler)(int, void *, struct pt_regs *),
93 unsigned long flags, const char *devname,
95 extern void amiga_free_irq (unsigned int irq, void *dev_id);
96 extern void amiga_enable_irq (unsigned int);
97 extern void amiga_disable_irq (unsigned int);
98 static void amiga_get_model(char *model);
99 static int amiga_get_hardware_list(char *buffer);
100 extern int show_amiga_interrupts (struct seq_file *, void *);
101 /* amiga specific timer functions */
102 static unsigned long amiga_gettimeoffset (void);
103 static int a3000_hwclk (int, struct rtc_time *);
104 static int a2000_hwclk (int, struct rtc_time *);
105 static int amiga_set_clock_mmss (unsigned long);
106 static unsigned int amiga_get_ss (void);
107 extern void amiga_mksound( unsigned int count, unsigned int ticks );
108 #ifdef CONFIG_AMIGA_FLOPPY
109 extern void amiga_floppy_setup(char *, int *);
111 static void amiga_reset (void);
112 extern void amiga_init_sound(void);
113 static void amiga_savekmsg_init(void);
114 static void amiga_mem_console_write(struct console *co, const char *b,
116 void amiga_serial_console_write(struct console *co, const char *s,
118 static void amiga_debug_init(void);
119 #ifdef CONFIG_HEARTBEAT
120 static void amiga_heartbeat(int on);
123 static struct console amiga_console_driver = {
125 .flags = CON_PRINTBUFFER,
131 * Motherboard Resources present in all Amiga models
135 struct resource _ciab, _ciaa, _custom, _kickstart;
138 .name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff
141 .name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff
144 .name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff
147 .name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff
151 static struct resource rtc_resource = {
152 .start = 0x00dc0000, .end = 0x00dcffff
155 static struct resource ram_resource[NUM_MEMINFO];
159 * Parse an Amiga-specific record in the bootinfo
162 int amiga_parse_bootinfo(const struct bi_record *record)
165 const unsigned long *data = record->data;
167 switch (record->tag) {
172 case BI_AMIGA_ECLOCK:
173 amiga_eclock = *data;
176 case BI_AMIGA_CHIPSET:
177 amiga_chipset = *data;
180 case BI_AMIGA_CHIP_SIZE:
181 amiga_chip_size = *(const int *)data;
184 case BI_AMIGA_VBLANK:
185 amiga_vblank = *(const unsigned char *)data;
188 case BI_AMIGA_PSFREQ:
189 amiga_psfreq = *(const unsigned char *)data;
192 case BI_AMIGA_AUTOCON:
194 if (zorro_num_autocon < ZORRO_NUM_AUTO) {
195 const struct ConfigDev *cd = (struct ConfigDev *)data;
196 struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
197 dev->rom = cd->cd_Rom;
198 dev->slotaddr = cd->cd_SlotAddr;
199 dev->slotsize = cd->cd_SlotSize;
200 dev->resource.start = (unsigned long)cd->cd_BoardAddr;
201 dev->resource.end = dev->resource.start+cd->cd_BoardSize-1;
203 printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
204 #endif /* CONFIG_ZORRO */
207 case BI_AMIGA_SERPER:
208 /* serial port period: ignored here */
218 * Identify builtin hardware
221 static void __init amiga_identify(void)
223 /* Fill in some default values, if necessary */
224 if (amiga_eclock == 0)
225 amiga_eclock = 709379;
227 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
229 printk("Amiga hardware found: ");
230 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
231 printk("[%s] ", amiga_models[amiga_model-AMI_500]);
232 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
235 switch(amiga_model) {
241 AMIGAHW_SET(A1200_IDE);
248 AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
253 AMIGAHW_SET(AMBER_FF);
254 AMIGAHW_SET(MAGIC_REKICK);
257 AMIGAHW_SET(A3000_SCSI);
258 AMIGAHW_SET(A3000_CLK);
263 AMIGAHW_SET(A4000_SCSI);
266 AMIGAHW_SET(A4000_IDE);
267 AMIGAHW_SET(A3000_CLK);
274 AMIGAHW_SET(A2000_CLK); /* Is this correct? */
278 AMIGAHW_SET(AMI_VIDEO);
279 AMIGAHW_SET(AMI_BLITTER);
280 AMIGAHW_SET(AMI_AUDIO);
281 AMIGAHW_SET(AMI_FLOPPY);
282 AMIGAHW_SET(AMI_KEYBOARD);
283 AMIGAHW_SET(AMI_MOUSE);
284 AMIGAHW_SET(AMI_SERIAL);
285 AMIGAHW_SET(AMI_PARALLEL);
286 AMIGAHW_SET(CHIP_RAM);
289 switch(amiga_chipset) {
293 switch (custom.deniseid & 0xf) {
295 AMIGAHW_SET(DENISE_HR);
306 switch ((custom.vposr>>8) & 0x7f) {
308 AMIGAHW_SET(AGNUS_PAL);
311 AMIGAHW_SET(AGNUS_NTSC);
315 AMIGAHW_SET(AGNUS_HR_PAL);
319 AMIGAHW_SET(AGNUS_HR_NTSC);
323 AMIGAHW_SET(ALICE_PAL);
327 AMIGAHW_SET(ALICE_NTSC);
334 panic("No support for Draco yet");
337 panic("Unknown Amiga Model");
340 #define AMIGAHW_ANNOUNCE(name, str) \
341 if (AMIGAHW_PRESENT(name)) \
344 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO ");
345 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER ");
346 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF ");
347 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO ");
348 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY ");
349 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI ");
350 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI ");
351 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE ");
352 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE ");
353 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM ");
354 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD ");
355 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE ");
356 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL ");
357 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL ");
358 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK ");
359 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK ");
360 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM ");
361 AMIGAHW_ANNOUNCE(PAULA, "PAULA ");
362 AMIGAHW_ANNOUNCE(DENISE, "DENISE ");
363 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR ");
364 AMIGAHW_ANNOUNCE(LISA, "LISA ");
365 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL ");
366 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC ");
367 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL ");
368 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC ");
369 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL ");
370 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC ");
371 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK ");
372 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA ");
373 if (AMIGAHW_PRESENT(ZORRO))
374 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
377 #undef AMIGAHW_ANNOUNCE
381 * Setup the Amiga configuration info
384 void __init config_amiga(void)
391 /* Yuk, we don't have PCI memory */
392 iomem_resource.name = "Memory";
393 for (i = 0; i < 4; i++)
394 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
396 mach_sched_init = amiga_sched_init;
397 mach_init_IRQ = amiga_init_IRQ;
398 mach_default_handler = &amiga_default_handler;
399 mach_request_irq = amiga_request_irq;
400 mach_free_irq = amiga_free_irq;
401 enable_irq = amiga_enable_irq;
402 disable_irq = amiga_disable_irq;
403 mach_get_model = amiga_get_model;
404 mach_get_hardware_list = amiga_get_hardware_list;
405 mach_get_irq_list = show_amiga_interrupts;
406 mach_gettimeoffset = amiga_gettimeoffset;
407 if (AMIGAHW_PRESENT(A3000_CLK)){
408 mach_hwclk = a3000_hwclk;
409 rtc_resource.name = "A3000 RTC";
410 request_resource(&iomem_resource, &rtc_resource);
412 else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */
413 mach_hwclk = a2000_hwclk;
414 rtc_resource.name = "A2000 RTC";
415 request_resource(&iomem_resource, &rtc_resource);
418 mach_max_dma_address = 0xffffffff; /*
419 * default MAX_DMA=0xffffffff
420 * on all machines. If we don't
421 * do so, the SCSI code will not
422 * be able to allocate any mem
423 * for transfers, unless we are
424 * dealing with a Z2 mem only
428 mach_set_clock_mmss = amiga_set_clock_mmss;
429 mach_get_ss = amiga_get_ss;
430 #ifdef CONFIG_AMIGA_FLOPPY
431 mach_floppy_setup = amiga_floppy_setup;
433 mach_reset = amiga_reset;
434 #ifdef CONFIG_DUMMY_CONSOLE
435 conswitchp = &dummy_con;
437 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
438 mach_beep = amiga_mksound;
441 #ifdef CONFIG_HEARTBEAT
442 mach_heartbeat = amiga_heartbeat;
445 /* Fill in the clock values (based on the 700 kHz E-Clock) */
446 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */
447 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
449 /* clear all DMA bits */
450 custom.dmacon = DMAF_ALL;
451 /* ensure that the DMA master bit is set */
452 custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
454 /* don't use Z2 RAM as system memory on Z3 capable machines */
455 if (AMIGAHW_PRESENT(ZORRO3)) {
457 u32 disabled_z2mem = 0;
458 for (i = 0; i < m68k_num_memory; i++)
459 if (m68k_memory[i].addr < 16*1024*1024) {
461 /* don't cut off the branch we're sitting on */
462 printk("Warning: kernel runs in Zorro II memory\n");
465 disabled_z2mem += m68k_memory[i].size;
467 for (j = i; j < m68k_num_memory; j++)
468 m68k_memory[j] = m68k_memory[j+1];
472 printk("%dK of Zorro II memory will not be used as system memory\n",
476 /* request all RAM */
477 for (i = 0; i < m68k_num_memory; i++) {
478 ram_resource[i].name =
479 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
480 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
482 ram_resource[i].start = m68k_memory[i].addr;
483 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
484 request_resource(&iomem_resource, &ram_resource[i]);
487 /* initialize chipram allocator */
490 /* debugging using chipram */
491 if (!strcmp( m68k_debug_device, "mem" )){
492 if (!AMIGAHW_PRESENT(CHIP_RAM))
493 printk("Warning: no chipram present for debugging\n");
495 amiga_savekmsg_init();
496 amiga_console_driver.write = amiga_mem_console_write;
497 register_console(&amiga_console_driver);
501 /* our beloved beeper */
502 if (AMIGAHW_PRESENT(AMI_AUDIO))
506 * if it is an A3000, set the magic bit that forces
509 if (AMIGAHW_PRESENT(MAGIC_REKICK))
510 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
513 static unsigned short jiffy_ticks;
515 static void __init amiga_sched_init(irqreturn_t (*timer_routine)(int, void *,
518 static struct resource sched_res = {
519 .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff,
521 jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
523 if (request_resource(&mb_resources._ciab, &sched_res))
524 printk("Cannot allocate ciab.ta{lo,hi}\n");
525 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */
526 ciab.talo = jiffy_ticks % 256;
527 ciab.tahi = jiffy_ticks / 256;
529 /* install interrupt service routine for CIAB Timer A
531 * Please don't change this to use ciaa, as it interferes with the
532 * SCSI code. We'll have to take a look at this later
534 request_irq(IRQ_AMIGA_CIAB_TA, timer_routine, 0, "timer", NULL);
539 #define TICK_SIZE 10000
541 /* This is always executed with interrupts disabled. */
542 static unsigned long amiga_gettimeoffset (void)
544 unsigned short hi, lo, hi2;
545 unsigned long ticks, offset = 0;
547 /* read CIA B timer A current value */
557 ticks = hi << 8 | lo;
559 if (ticks > jiffy_ticks / 2)
560 /* check for pending interrupt */
561 if (cia_set_irq(&ciab_base, 0) & CIA_ICR_TA)
564 ticks = jiffy_ticks - ticks;
565 ticks = (10000 * ticks) / jiffy_ticks;
567 return ticks + offset;
570 static int a3000_hwclk(int op, struct rtc_time *t)
572 tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
574 if (!op) { /* read */
575 t->tm_sec = tod_3000.second1 * 10 + tod_3000.second2;
576 t->tm_min = tod_3000.minute1 * 10 + tod_3000.minute2;
577 t->tm_hour = tod_3000.hour1 * 10 + tod_3000.hour2;
578 t->tm_mday = tod_3000.day1 * 10 + tod_3000.day2;
579 t->tm_wday = tod_3000.weekday;
580 t->tm_mon = tod_3000.month1 * 10 + tod_3000.month2 - 1;
581 t->tm_year = tod_3000.year1 * 10 + tod_3000.year2;
582 if (t->tm_year <= 69)
585 tod_3000.second1 = t->tm_sec / 10;
586 tod_3000.second2 = t->tm_sec % 10;
587 tod_3000.minute1 = t->tm_min / 10;
588 tod_3000.minute2 = t->tm_min % 10;
589 tod_3000.hour1 = t->tm_hour / 10;
590 tod_3000.hour2 = t->tm_hour % 10;
591 tod_3000.day1 = t->tm_mday / 10;
592 tod_3000.day2 = t->tm_mday % 10;
593 if (t->tm_wday != -1)
594 tod_3000.weekday = t->tm_wday;
595 tod_3000.month1 = (t->tm_mon + 1) / 10;
596 tod_3000.month2 = (t->tm_mon + 1) % 10;
597 if (t->tm_year >= 100)
599 tod_3000.year1 = t->tm_year / 10;
600 tod_3000.year2 = t->tm_year % 10;
603 tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
608 static int a2000_hwclk(int op, struct rtc_time *t)
612 tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD;
614 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--)
616 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
618 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
622 printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1);
624 if (!op) { /* read */
625 t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2;
626 t->tm_min = tod_2000.minute1 * 10 + tod_2000.minute2;
627 t->tm_hour = (tod_2000.hour1 & 3) * 10 + tod_2000.hour2;
628 t->tm_mday = tod_2000.day1 * 10 + tod_2000.day2;
629 t->tm_wday = tod_2000.weekday;
630 t->tm_mon = tod_2000.month1 * 10 + tod_2000.month2 - 1;
631 t->tm_year = tod_2000.year1 * 10 + tod_2000.year2;
632 if (t->tm_year <= 69)
635 if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)){
636 if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12)
638 else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12)
642 tod_2000.second1 = t->tm_sec / 10;
643 tod_2000.second2 = t->tm_sec % 10;
644 tod_2000.minute1 = t->tm_min / 10;
645 tod_2000.minute2 = t->tm_min % 10;
646 if (tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)
647 tod_2000.hour1 = t->tm_hour / 10;
648 else if (t->tm_hour >= 12)
649 tod_2000.hour1 = TOD2000_HOUR1_PM +
650 (t->tm_hour - 12) / 10;
652 tod_2000.hour1 = t->tm_hour / 10;
653 tod_2000.hour2 = t->tm_hour % 10;
654 tod_2000.day1 = t->tm_mday / 10;
655 tod_2000.day2 = t->tm_mday % 10;
656 if (t->tm_wday != -1)
657 tod_2000.weekday = t->tm_wday;
658 tod_2000.month1 = (t->tm_mon + 1) / 10;
659 tod_2000.month2 = (t->tm_mon + 1) % 10;
660 if (t->tm_year >= 100)
662 tod_2000.year1 = t->tm_year / 10;
663 tod_2000.year2 = t->tm_year % 10;
666 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
671 static int amiga_set_clock_mmss (unsigned long nowtime)
673 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
675 if (AMIGAHW_PRESENT(A3000_CLK)) {
676 tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
678 tod_3000.second1 = real_seconds / 10;
679 tod_3000.second2 = real_seconds % 10;
680 tod_3000.minute1 = real_minutes / 10;
681 tod_3000.minute2 = real_minutes % 10;
683 tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
684 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
687 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
689 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--)
691 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
693 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
697 printk(KERN_INFO "set_clock_mmss: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1);
699 tod_2000.second1 = real_seconds / 10;
700 tod_2000.second2 = real_seconds % 10;
701 tod_2000.minute1 = real_minutes / 10;
702 tod_2000.minute2 = real_minutes % 10;
704 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
710 static unsigned int amiga_get_ss( void )
714 if (AMIGAHW_PRESENT(A3000_CLK)) {
715 tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
716 s = tod_3000.second1 * 10 + tod_3000.second2;
717 tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
718 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
719 s = tod_2000.second1 * 10 + tod_2000.second2;
724 static NORET_TYPE void amiga_reset( void )
727 static void amiga_reset (void)
729 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
730 unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label);
733 if (CPU_IS_040_OR_060)
734 /* Setup transparent translation registers for mapping
735 * of 16 MB kernel segment before disabling translation
739 "andl #0xff000000,%/d0\n\t"
740 "orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */
742 "movec %%d0,%%itt0\n\t"
743 "movec %%d0,%%dtt0\n\t"
747 : "a" (jmp_addr040));
749 /* for 680[23]0, just disable translation and jump to the physical
750 * address of the label
760 /* disable translation on '040 now */
764 "movec %%d0,%%tc\n\t" /* disable MMU */
771 /* pickup reset address from AmigaOS ROM, reset devices and jump
775 ("movew #0x2700,%/sr\n\t"
776 "leal 0x01000000,%/a0\n\t"
777 "subl %/a0@(-0x14),%/a0\n\t"
778 "movel %/a0@(4),%/a0\n\t"
781 /* align on a longword boundary */
785 "jmp %/a0@" : /* Just that gcc scans it for % escapes */ );
796 #define SAVEKMSG_MAXMEM 128*1024
798 #define SAVEKMSG_MAGIC1 0x53415645 /* 'SAVE' */
799 #define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
802 unsigned long magic1; /* SAVEKMSG_MAGIC1 */
803 unsigned long magic2; /* SAVEKMSG_MAGIC2 */
804 unsigned long magicptr; /* address of magic1 */
809 static struct savekmsg *savekmsg;
811 static void amiga_mem_console_write(struct console *co, const char *s,
814 if (savekmsg->size+count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
815 memcpy(savekmsg->data+savekmsg->size, s, count);
816 savekmsg->size += count;
820 static void amiga_savekmsg_init(void)
822 static struct resource debug_res = { .name = "Debug" };
824 savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res);
825 savekmsg->magic1 = SAVEKMSG_MAGIC1;
826 savekmsg->magic2 = SAVEKMSG_MAGIC2;
827 savekmsg->magicptr = ZTWO_PADDR(savekmsg);
831 static void amiga_serial_putc(char c)
833 custom.serdat = (unsigned char)c | 0x100;
834 while (!(custom.serdatr & 0x2000))
838 void amiga_serial_console_write(struct console *co, const char *s,
843 amiga_serial_putc('\r');
844 amiga_serial_putc(*s++);
848 #ifdef CONFIG_SERIAL_CONSOLE
849 void amiga_serial_puts(const char *s)
851 amiga_serial_console_write(NULL, s, strlen(s));
854 int amiga_serial_console_wait_key(struct console *co)
858 while (!(custom.intreqr & IF_RBF))
860 ch = custom.serdatr & 0xff;
861 /* clear the interrupt, so that another character can be read */
862 custom.intreq = IF_RBF;
866 void amiga_serial_gets(struct console *co, char *s, int len)
871 ch = amiga_serial_console_wait_key(co);
873 /* Check for backspace. */
874 if (ch == 8 || ch == 127) {
876 amiga_serial_putc('\007');
880 amiga_serial_puts("\010 \010");
884 /* Check for enter. */
885 if (ch == 10 || ch == 13)
888 /* See if line is too long. */
889 if (cnt >= len + 1) {
890 amiga_serial_putc(7);
895 /* Store and echo character. */
897 amiga_serial_putc(ch);
900 amiga_serial_puts("\r\n");
905 static void __init amiga_debug_init(void)
907 if (!strcmp( m68k_debug_device, "ser" )) {
908 /* no initialization required (?) */
909 amiga_console_driver.write = amiga_serial_console_write;
910 register_console(&amiga_console_driver);
914 #ifdef CONFIG_HEARTBEAT
915 static void amiga_heartbeat(int on)
925 * Amiga specific parts of /proc
928 static void amiga_get_model(char *model)
930 strcpy(model, amiga_model_name);
934 static int amiga_get_hardware_list(char *buffer)
938 if (AMIGAHW_PRESENT(CHIP_RAM))
939 len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10);
940 len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
941 amiga_psfreq, amiga_eclock);
942 if (AMIGAHW_PRESENT(AMI_VIDEO)) {
944 switch(amiga_chipset) {
955 type = "Old or Unknown";
958 len += sprintf(buffer+len, "Graphics:\t%s\n", type);
961 #define AMIGAHW_ANNOUNCE(name, str) \
962 if (AMIGAHW_PRESENT(name)) \
963 len += sprintf (buffer+len, "\t%s\n", str)
965 len += sprintf (buffer + len, "Detected hardware:\n");
967 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video");
968 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter");
969 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer");
970 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio");
971 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller");
972 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)");
973 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)");
974 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)");
975 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)");
976 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive");
977 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard");
978 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port");
979 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port");
980 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port");
981 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)");
982 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)");
983 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM");
984 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364");
985 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362");
986 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373");
987 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375");
988 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371");
989 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370");
990 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372");
991 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372");
992 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374");
993 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374");
994 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick");
995 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot");
997 if (AMIGAHW_PRESENT(ZORRO))
998 len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion "
1000 AMIGAHW_PRESENT(ZORRO3) ? "I" : "",
1001 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
1002 #endif /* CONFIG_ZORRO */
1004 #undef AMIGAHW_ANNOUNCE