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 static void amiga_reset (void);
109 extern void amiga_init_sound(void);
110 static void amiga_savekmsg_init(void);
111 static void amiga_mem_console_write(struct console *co, const char *b,
113 void amiga_serial_console_write(struct console *co, const char *s,
115 static void amiga_debug_init(void);
116 #ifdef CONFIG_HEARTBEAT
117 static void amiga_heartbeat(int on);
120 static struct console amiga_console_driver = {
122 .flags = CON_PRINTBUFFER,
128 * Motherboard Resources present in all Amiga models
132 struct resource _ciab, _ciaa, _custom, _kickstart;
135 .name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff
138 .name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff
141 .name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff
144 .name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff
148 static struct resource rtc_resource = {
149 .start = 0x00dc0000, .end = 0x00dcffff
152 static struct resource ram_resource[NUM_MEMINFO];
156 * Parse an Amiga-specific record in the bootinfo
159 int amiga_parse_bootinfo(const struct bi_record *record)
162 const unsigned long *data = record->data;
164 switch (record->tag) {
169 case BI_AMIGA_ECLOCK:
170 amiga_eclock = *data;
173 case BI_AMIGA_CHIPSET:
174 amiga_chipset = *data;
177 case BI_AMIGA_CHIP_SIZE:
178 amiga_chip_size = *(const int *)data;
181 case BI_AMIGA_VBLANK:
182 amiga_vblank = *(const unsigned char *)data;
185 case BI_AMIGA_PSFREQ:
186 amiga_psfreq = *(const unsigned char *)data;
189 case BI_AMIGA_AUTOCON:
191 if (zorro_num_autocon < ZORRO_NUM_AUTO) {
192 const struct ConfigDev *cd = (struct ConfigDev *)data;
193 struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
194 dev->rom = cd->cd_Rom;
195 dev->slotaddr = cd->cd_SlotAddr;
196 dev->slotsize = cd->cd_SlotSize;
197 dev->resource.start = (unsigned long)cd->cd_BoardAddr;
198 dev->resource.end = dev->resource.start+cd->cd_BoardSize-1;
200 printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
201 #endif /* CONFIG_ZORRO */
204 case BI_AMIGA_SERPER:
205 /* serial port period: ignored here */
215 * Identify builtin hardware
218 static void __init amiga_identify(void)
220 /* Fill in some default values, if necessary */
221 if (amiga_eclock == 0)
222 amiga_eclock = 709379;
224 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
226 printk("Amiga hardware found: ");
227 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
228 printk("[%s] ", amiga_models[amiga_model-AMI_500]);
229 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
232 switch(amiga_model) {
238 AMIGAHW_SET(A1200_IDE);
245 AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
250 AMIGAHW_SET(AMBER_FF);
251 AMIGAHW_SET(MAGIC_REKICK);
254 AMIGAHW_SET(A3000_SCSI);
255 AMIGAHW_SET(A3000_CLK);
260 AMIGAHW_SET(A4000_SCSI);
263 AMIGAHW_SET(A4000_IDE);
264 AMIGAHW_SET(A3000_CLK);
271 AMIGAHW_SET(A2000_CLK); /* Is this correct? */
275 AMIGAHW_SET(AMI_VIDEO);
276 AMIGAHW_SET(AMI_BLITTER);
277 AMIGAHW_SET(AMI_AUDIO);
278 AMIGAHW_SET(AMI_FLOPPY);
279 AMIGAHW_SET(AMI_KEYBOARD);
280 AMIGAHW_SET(AMI_MOUSE);
281 AMIGAHW_SET(AMI_SERIAL);
282 AMIGAHW_SET(AMI_PARALLEL);
283 AMIGAHW_SET(CHIP_RAM);
286 switch(amiga_chipset) {
290 switch (amiga_custom.deniseid & 0xf) {
292 AMIGAHW_SET(DENISE_HR);
303 switch ((amiga_custom.vposr>>8) & 0x7f) {
305 AMIGAHW_SET(AGNUS_PAL);
308 AMIGAHW_SET(AGNUS_NTSC);
312 AMIGAHW_SET(AGNUS_HR_PAL);
316 AMIGAHW_SET(AGNUS_HR_NTSC);
320 AMIGAHW_SET(ALICE_PAL);
324 AMIGAHW_SET(ALICE_NTSC);
331 panic("No support for Draco yet");
334 panic("Unknown Amiga Model");
337 #define AMIGAHW_ANNOUNCE(name, str) \
338 if (AMIGAHW_PRESENT(name)) \
341 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO ");
342 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER ");
343 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF ");
344 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO ");
345 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY ");
346 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI ");
347 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI ");
348 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE ");
349 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE ");
350 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM ");
351 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD ");
352 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE ");
353 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL ");
354 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL ");
355 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK ");
356 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK ");
357 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM ");
358 AMIGAHW_ANNOUNCE(PAULA, "PAULA ");
359 AMIGAHW_ANNOUNCE(DENISE, "DENISE ");
360 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR ");
361 AMIGAHW_ANNOUNCE(LISA, "LISA ");
362 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL ");
363 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC ");
364 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL ");
365 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC ");
366 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL ");
367 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC ");
368 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK ");
369 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA ");
370 if (AMIGAHW_PRESENT(ZORRO))
371 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
374 #undef AMIGAHW_ANNOUNCE
378 * Setup the Amiga configuration info
381 void __init config_amiga(void)
388 /* Yuk, we don't have PCI memory */
389 iomem_resource.name = "Memory";
390 for (i = 0; i < 4; i++)
391 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
393 mach_sched_init = amiga_sched_init;
394 mach_init_IRQ = amiga_init_IRQ;
395 mach_default_handler = &amiga_default_handler;
396 mach_request_irq = amiga_request_irq;
397 mach_free_irq = amiga_free_irq;
398 enable_irq = amiga_enable_irq;
399 disable_irq = amiga_disable_irq;
400 mach_get_model = amiga_get_model;
401 mach_get_hardware_list = amiga_get_hardware_list;
402 mach_get_irq_list = show_amiga_interrupts;
403 mach_gettimeoffset = amiga_gettimeoffset;
404 if (AMIGAHW_PRESENT(A3000_CLK)){
405 mach_hwclk = a3000_hwclk;
406 rtc_resource.name = "A3000 RTC";
407 request_resource(&iomem_resource, &rtc_resource);
409 else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */
410 mach_hwclk = a2000_hwclk;
411 rtc_resource.name = "A2000 RTC";
412 request_resource(&iomem_resource, &rtc_resource);
415 mach_max_dma_address = 0xffffffff; /*
416 * default MAX_DMA=0xffffffff
417 * on all machines. If we don't
418 * do so, the SCSI code will not
419 * be able to allocate any mem
420 * for transfers, unless we are
421 * dealing with a Z2 mem only
425 mach_set_clock_mmss = amiga_set_clock_mmss;
426 mach_get_ss = amiga_get_ss;
427 mach_reset = amiga_reset;
428 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
429 mach_beep = amiga_mksound;
432 #ifdef CONFIG_HEARTBEAT
433 mach_heartbeat = amiga_heartbeat;
436 /* Fill in the clock values (based on the 700 kHz E-Clock) */
437 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */
438 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
440 /* clear all DMA bits */
441 amiga_custom.dmacon = DMAF_ALL;
442 /* ensure that the DMA master bit is set */
443 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
445 /* don't use Z2 RAM as system memory on Z3 capable machines */
446 if (AMIGAHW_PRESENT(ZORRO3)) {
448 u32 disabled_z2mem = 0;
449 for (i = 0; i < m68k_num_memory; i++)
450 if (m68k_memory[i].addr < 16*1024*1024) {
452 /* don't cut off the branch we're sitting on */
453 printk("Warning: kernel runs in Zorro II memory\n");
456 disabled_z2mem += m68k_memory[i].size;
458 for (j = i; j < m68k_num_memory; j++)
459 m68k_memory[j] = m68k_memory[j+1];
463 printk("%dK of Zorro II memory will not be used as system memory\n",
467 /* request all RAM */
468 for (i = 0; i < m68k_num_memory; i++) {
469 ram_resource[i].name =
470 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
471 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
473 ram_resource[i].start = m68k_memory[i].addr;
474 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
475 request_resource(&iomem_resource, &ram_resource[i]);
478 /* initialize chipram allocator */
481 /* debugging using chipram */
482 if (!strcmp( m68k_debug_device, "mem" )){
483 if (!AMIGAHW_PRESENT(CHIP_RAM))
484 printk("Warning: no chipram present for debugging\n");
486 amiga_savekmsg_init();
487 amiga_console_driver.write = amiga_mem_console_write;
488 register_console(&amiga_console_driver);
492 /* our beloved beeper */
493 if (AMIGAHW_PRESENT(AMI_AUDIO))
497 * if it is an A3000, set the magic bit that forces
500 if (AMIGAHW_PRESENT(MAGIC_REKICK))
501 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
504 static unsigned short jiffy_ticks;
506 static void __init amiga_sched_init(irqreturn_t (*timer_routine)(int, void *,
509 static struct resource sched_res = {
510 .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff,
512 jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
514 if (request_resource(&mb_resources._ciab, &sched_res))
515 printk("Cannot allocate ciab.ta{lo,hi}\n");
516 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */
517 ciab.talo = jiffy_ticks % 256;
518 ciab.tahi = jiffy_ticks / 256;
520 /* install interrupt service routine for CIAB Timer A
522 * Please don't change this to use ciaa, as it interferes with the
523 * SCSI code. We'll have to take a look at this later
525 request_irq(IRQ_AMIGA_CIAB_TA, timer_routine, 0, "timer", NULL);
530 #define TICK_SIZE 10000
532 /* This is always executed with interrupts disabled. */
533 static unsigned long amiga_gettimeoffset (void)
535 unsigned short hi, lo, hi2;
536 unsigned long ticks, offset = 0;
538 /* read CIA B timer A current value */
548 ticks = hi << 8 | lo;
550 if (ticks > jiffy_ticks / 2)
551 /* check for pending interrupt */
552 if (cia_set_irq(&ciab_base, 0) & CIA_ICR_TA)
555 ticks = jiffy_ticks - ticks;
556 ticks = (10000 * ticks) / jiffy_ticks;
558 return ticks + offset;
561 static int a3000_hwclk(int op, struct rtc_time *t)
563 tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
565 if (!op) { /* read */
566 t->tm_sec = tod_3000.second1 * 10 + tod_3000.second2;
567 t->tm_min = tod_3000.minute1 * 10 + tod_3000.minute2;
568 t->tm_hour = tod_3000.hour1 * 10 + tod_3000.hour2;
569 t->tm_mday = tod_3000.day1 * 10 + tod_3000.day2;
570 t->tm_wday = tod_3000.weekday;
571 t->tm_mon = tod_3000.month1 * 10 + tod_3000.month2 - 1;
572 t->tm_year = tod_3000.year1 * 10 + tod_3000.year2;
573 if (t->tm_year <= 69)
576 tod_3000.second1 = t->tm_sec / 10;
577 tod_3000.second2 = t->tm_sec % 10;
578 tod_3000.minute1 = t->tm_min / 10;
579 tod_3000.minute2 = t->tm_min % 10;
580 tod_3000.hour1 = t->tm_hour / 10;
581 tod_3000.hour2 = t->tm_hour % 10;
582 tod_3000.day1 = t->tm_mday / 10;
583 tod_3000.day2 = t->tm_mday % 10;
584 if (t->tm_wday != -1)
585 tod_3000.weekday = t->tm_wday;
586 tod_3000.month1 = (t->tm_mon + 1) / 10;
587 tod_3000.month2 = (t->tm_mon + 1) % 10;
588 if (t->tm_year >= 100)
590 tod_3000.year1 = t->tm_year / 10;
591 tod_3000.year2 = t->tm_year % 10;
594 tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
599 static int a2000_hwclk(int op, struct rtc_time *t)
603 tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD;
605 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--)
607 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
609 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
613 printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1);
615 if (!op) { /* read */
616 t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2;
617 t->tm_min = tod_2000.minute1 * 10 + tod_2000.minute2;
618 t->tm_hour = (tod_2000.hour1 & 3) * 10 + tod_2000.hour2;
619 t->tm_mday = tod_2000.day1 * 10 + tod_2000.day2;
620 t->tm_wday = tod_2000.weekday;
621 t->tm_mon = tod_2000.month1 * 10 + tod_2000.month2 - 1;
622 t->tm_year = tod_2000.year1 * 10 + tod_2000.year2;
623 if (t->tm_year <= 69)
626 if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)){
627 if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12)
629 else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12)
633 tod_2000.second1 = t->tm_sec / 10;
634 tod_2000.second2 = t->tm_sec % 10;
635 tod_2000.minute1 = t->tm_min / 10;
636 tod_2000.minute2 = t->tm_min % 10;
637 if (tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)
638 tod_2000.hour1 = t->tm_hour / 10;
639 else if (t->tm_hour >= 12)
640 tod_2000.hour1 = TOD2000_HOUR1_PM +
641 (t->tm_hour - 12) / 10;
643 tod_2000.hour1 = t->tm_hour / 10;
644 tod_2000.hour2 = t->tm_hour % 10;
645 tod_2000.day1 = t->tm_mday / 10;
646 tod_2000.day2 = t->tm_mday % 10;
647 if (t->tm_wday != -1)
648 tod_2000.weekday = t->tm_wday;
649 tod_2000.month1 = (t->tm_mon + 1) / 10;
650 tod_2000.month2 = (t->tm_mon + 1) % 10;
651 if (t->tm_year >= 100)
653 tod_2000.year1 = t->tm_year / 10;
654 tod_2000.year2 = t->tm_year % 10;
657 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
662 static int amiga_set_clock_mmss (unsigned long nowtime)
664 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
666 if (AMIGAHW_PRESENT(A3000_CLK)) {
667 tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
669 tod_3000.second1 = real_seconds / 10;
670 tod_3000.second2 = real_seconds % 10;
671 tod_3000.minute1 = real_minutes / 10;
672 tod_3000.minute2 = real_minutes % 10;
674 tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
675 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
678 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
680 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--)
682 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
684 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
688 printk(KERN_INFO "set_clock_mmss: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1);
690 tod_2000.second1 = real_seconds / 10;
691 tod_2000.second2 = real_seconds % 10;
692 tod_2000.minute1 = real_minutes / 10;
693 tod_2000.minute2 = real_minutes % 10;
695 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
701 static unsigned int amiga_get_ss( void )
705 if (AMIGAHW_PRESENT(A3000_CLK)) {
706 tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
707 s = tod_3000.second1 * 10 + tod_3000.second2;
708 tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
709 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
710 s = tod_2000.second1 * 10 + tod_2000.second2;
715 static NORET_TYPE void amiga_reset( void )
718 static void amiga_reset (void)
720 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
721 unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label);
724 if (CPU_IS_040_OR_060)
725 /* Setup transparent translation registers for mapping
726 * of 16 MB kernel segment before disabling translation
730 "andl #0xff000000,%/d0\n\t"
731 "orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */
733 "movec %%d0,%%itt0\n\t"
734 "movec %%d0,%%dtt0\n\t"
738 : "a" (jmp_addr040));
740 /* for 680[23]0, just disable translation and jump to the physical
741 * address of the label
751 /* disable translation on '040 now */
755 "movec %%d0,%%tc\n\t" /* disable MMU */
762 /* pickup reset address from AmigaOS ROM, reset devices and jump
766 ("movew #0x2700,%/sr\n\t"
767 "leal 0x01000000,%/a0\n\t"
768 "subl %/a0@(-0x14),%/a0\n\t"
769 "movel %/a0@(4),%/a0\n\t"
772 /* align on a longword boundary */
776 "jmp %/a0@" : /* Just that gcc scans it for % escapes */ );
787 #define SAVEKMSG_MAXMEM 128*1024
789 #define SAVEKMSG_MAGIC1 0x53415645 /* 'SAVE' */
790 #define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
793 unsigned long magic1; /* SAVEKMSG_MAGIC1 */
794 unsigned long magic2; /* SAVEKMSG_MAGIC2 */
795 unsigned long magicptr; /* address of magic1 */
800 static struct savekmsg *savekmsg;
802 static void amiga_mem_console_write(struct console *co, const char *s,
805 if (savekmsg->size+count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
806 memcpy(savekmsg->data+savekmsg->size, s, count);
807 savekmsg->size += count;
811 static void amiga_savekmsg_init(void)
813 static struct resource debug_res = { .name = "Debug" };
815 savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res);
816 savekmsg->magic1 = SAVEKMSG_MAGIC1;
817 savekmsg->magic2 = SAVEKMSG_MAGIC2;
818 savekmsg->magicptr = ZTWO_PADDR(savekmsg);
822 static void amiga_serial_putc(char c)
824 amiga_custom.serdat = (unsigned char)c | 0x100;
825 while (!(amiga_custom.serdatr & 0x2000))
829 void amiga_serial_console_write(struct console *co, const char *s,
834 amiga_serial_putc('\r');
835 amiga_serial_putc(*s++);
839 #ifdef CONFIG_SERIAL_CONSOLE
840 void amiga_serial_puts(const char *s)
842 amiga_serial_console_write(NULL, s, strlen(s));
845 int amiga_serial_console_wait_key(struct console *co)
849 while (!(amiga_custom.intreqr & IF_RBF))
851 ch = amiga_custom.serdatr & 0xff;
852 /* clear the interrupt, so that another character can be read */
853 amiga_custom.intreq = IF_RBF;
857 void amiga_serial_gets(struct console *co, char *s, int len)
862 ch = amiga_serial_console_wait_key(co);
864 /* Check for backspace. */
865 if (ch == 8 || ch == 127) {
867 amiga_serial_putc('\007');
871 amiga_serial_puts("\010 \010");
875 /* Check for enter. */
876 if (ch == 10 || ch == 13)
879 /* See if line is too long. */
880 if (cnt >= len + 1) {
881 amiga_serial_putc(7);
886 /* Store and echo character. */
888 amiga_serial_putc(ch);
891 amiga_serial_puts("\r\n");
896 static void __init amiga_debug_init(void)
898 if (!strcmp( m68k_debug_device, "ser" )) {
899 /* no initialization required (?) */
900 amiga_console_driver.write = amiga_serial_console_write;
901 register_console(&amiga_console_driver);
905 #ifdef CONFIG_HEARTBEAT
906 static void amiga_heartbeat(int on)
916 * Amiga specific parts of /proc
919 static void amiga_get_model(char *model)
921 strcpy(model, amiga_model_name);
925 static int amiga_get_hardware_list(char *buffer)
929 if (AMIGAHW_PRESENT(CHIP_RAM))
930 len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10);
931 len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
932 amiga_psfreq, amiga_eclock);
933 if (AMIGAHW_PRESENT(AMI_VIDEO)) {
935 switch(amiga_chipset) {
946 type = "Old or Unknown";
949 len += sprintf(buffer+len, "Graphics:\t%s\n", type);
952 #define AMIGAHW_ANNOUNCE(name, str) \
953 if (AMIGAHW_PRESENT(name)) \
954 len += sprintf (buffer+len, "\t%s\n", str)
956 len += sprintf (buffer + len, "Detected hardware:\n");
958 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video");
959 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter");
960 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer");
961 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio");
962 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller");
963 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)");
964 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)");
965 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)");
966 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)");
967 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive");
968 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard");
969 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port");
970 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port");
971 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port");
972 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)");
973 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)");
974 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM");
975 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364");
976 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362");
977 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373");
978 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375");
979 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371");
980 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370");
981 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372");
982 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372");
983 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374");
984 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374");
985 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick");
986 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot");
988 if (AMIGAHW_PRESENT(ZORRO))
989 len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion "
991 AMIGAHW_PRESENT(ZORRO3) ? "I" : "",
992 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
993 #endif /* CONFIG_ZORRO */
995 #undef AMIGAHW_ANNOUNCE