1 #define m68k_debug_device debug_device
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>
20 #include <linux/tty.h>
21 #include <linux/console.h>
22 #include <linux/init.h>
24 #include <linux/zorro.h>
27 #include <asm/bootinfo.h>
28 #include <asm/setup.h>
29 #include <asm/system.h>
30 #include <asm/pgtable.h>
31 #include <asm/amigahw.h>
32 #include <asm/amigaints.h>
34 #include <asm/machdep.h>
37 unsigned long powerup_PCI_present;
38 unsigned long powerup_BPPCPLUS_present;
39 unsigned long amiga_model;
40 unsigned long amiga_eclock;
41 unsigned long amiga_masterclock;
42 unsigned long amiga_colorclock;
43 unsigned long amiga_chipset;
44 unsigned char amiga_vblank;
45 unsigned char amiga_psfreq;
46 struct amiga_hw_present amiga_hw_present;
48 static char s_a500[] __initdata = "A500";
49 static char s_a500p[] __initdata = "A500+";
50 static char s_a600[] __initdata = "A600";
51 static char s_a1000[] __initdata = "A1000";
52 static char s_a1200[] __initdata = "A1200";
53 static char s_a2000[] __initdata = "A2000";
54 static char s_a2500[] __initdata = "A2500";
55 static char s_a3000[] __initdata = "A3000";
56 static char s_a3000t[] __initdata = "A3000T";
57 static char s_a3000p[] __initdata = "A3000+";
58 static char s_a4000[] __initdata = "A4000";
59 static char s_a4000t[] __initdata = "A4000T";
60 static char s_cdtv[] __initdata = "CDTV";
61 static char s_cd32[] __initdata = "CD32";
62 static char s_draco[] __initdata = "Draco";
63 static char *amiga_models[] __initdata = {
64 s_a500, s_a500p, s_a600, s_a1000, s_a1200, s_a2000, s_a2500, s_a3000,
65 s_a3000t, s_a3000p, s_a4000, s_a4000t, s_cdtv, s_cd32, s_draco,
68 static char amiga_model_name[13] = "Amiga ";
70 extern char m68k_debug_device[];
72 static void amiga_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
73 /* amiga specific irq functions */
74 extern void amiga_init_IRQ (void);
75 extern void (*amiga_default_handler[]) (int, void *, struct pt_regs *);
76 extern int amiga_request_irq (unsigned int irq,
77 void (*handler)(int, void *, struct pt_regs *),
78 unsigned long flags, const char *devname,
80 extern void amiga_free_irq (unsigned int irq, void *dev_id);
81 extern void amiga_enable_irq (unsigned int);
82 extern void amiga_disable_irq (unsigned int);
83 static void amiga_get_model(char *model);
84 static int amiga_get_hardware_list(char *buffer);
85 /* amiga specific timer functions */
86 static unsigned long amiga_gettimeoffset (void);
87 static void a3000_gettod (int *, int *, int *, int *, int *, int *);
88 static void a2000_gettod (int *, int *, int *, int *, int *, int *);
89 static int amiga_hwclk (int, struct hwclk_time *);
90 static int amiga_set_clock_mmss (unsigned long);
91 static void amiga_reset (void);
92 extern void amiga_init_sound(void);
93 static void amiga_savekmsg_init(void);
94 static void amiga_mem_console_write(struct console *co, const char *b,
96 void amiga_serial_console_write(struct console *co, const char *s,
98 static void amiga_debug_init(void);
99 #ifdef CONFIG_HEARTBEAT
100 static void amiga_heartbeat(int on);
103 static struct console amiga_console_driver = {
105 .flags = CON_PRINTBUFFER,
111 * Motherboard Resources present in all Amiga models
115 struct resource _ciab, _ciaa, _custom, _kickstart;
117 // { "Ranger Memory", 0x00c00000, 0x00c7ffff },
118 ._ciab = { "CIA B", 0x00bfd000, 0x00bfdfff },
119 ._ciaa = { "CIA A", 0x00bfe000, 0x00bfefff },
120 ._custom = { "Custom I/O", 0x00dff000, 0x00dfffff },
121 ._kickstart = { "Kickstart ROM", 0x00f80000, 0x00ffffff }
124 static struct resource rtc_resource = {
125 NULL, 0x00dc0000, 0x00dcffff
128 static struct resource ram_resource[NUM_MEMINFO];
132 * Parse an Amiga-specific record in the bootinfo
135 int amiga_parse_bootinfo(const struct bi_record *record)
138 const unsigned long *data = record->data;
140 switch (record->tag) {
143 unsigned long d = *data;
145 powerup_PCI_present = d & 0x100;
146 amiga_model = d & 0xff;
150 case BI_AMIGA_ECLOCK:
151 amiga_eclock = *data;
154 case BI_AMIGA_CHIPSET:
155 amiga_chipset = *data;
158 case BI_AMIGA_CHIP_SIZE:
159 amiga_chip_size = *(const int *)data;
162 case BI_AMIGA_VBLANK:
163 amiga_vblank = *(const unsigned char *)data;
166 case BI_AMIGA_PSFREQ:
167 amiga_psfreq = *(const unsigned char *)data;
170 case BI_AMIGA_AUTOCON:
172 if (zorro_num_autocon < ZORRO_NUM_AUTO) {
173 const struct ConfigDev *cd = (struct ConfigDev *)data;
174 struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
175 dev->rom = cd->cd_Rom;
176 dev->slotaddr = cd->cd_SlotAddr;
177 dev->slotsize = cd->cd_SlotSize;
178 dev->resource.start = (unsigned long)cd->cd_BoardAddr;
179 dev->resource.end = dev->resource.start+cd->cd_BoardSize-1;
181 printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
182 #endif /* CONFIG_ZORRO */
185 case BI_AMIGA_SERPER:
186 /* serial port period: ignored here */
189 case BI_AMIGA_PUP_BRIDGE:
190 powerup_PCI_present = *(const unsigned short *)data;
193 case BI_AMIGA_BPPC_SCSI:
194 powerup_BPPCPLUS_present = *(const unsigned short *)data;
204 * Identify builtin hardware
207 static void __init amiga_identify(void)
209 /* Fill in some default values, if necessary */
210 if (amiga_eclock == 0)
211 amiga_eclock = 709379;
213 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
215 printk("Amiga hardware found: ");
216 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
217 printk("[%s] ", amiga_models[amiga_model-AMI_500]);
218 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
221 switch(amiga_model) {
227 AMIGAHW_SET(A1200_IDE);
234 AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
239 AMIGAHW_SET(AMBER_FF);
240 AMIGAHW_SET(MAGIC_REKICK);
243 AMIGAHW_SET(A3000_SCSI);
244 AMIGAHW_SET(A3000_CLK);
249 AMIGAHW_SET(A4000_SCSI);
252 AMIGAHW_SET(A4000_IDE);
253 AMIGAHW_SET(A3000_CLK);
260 AMIGAHW_SET(A2000_CLK); /* Is this correct? */
264 AMIGAHW_SET(AMI_VIDEO);
265 AMIGAHW_SET(AMI_BLITTER);
266 AMIGAHW_SET(AMI_AUDIO);
267 AMIGAHW_SET(AMI_FLOPPY);
268 AMIGAHW_SET(AMI_KEYBOARD);
269 AMIGAHW_SET(AMI_MOUSE);
270 AMIGAHW_SET(AMI_SERIAL);
271 AMIGAHW_SET(AMI_PARALLEL);
272 AMIGAHW_SET(CHIP_RAM);
275 switch(amiga_chipset) {
279 switch (amiga_custom.deniseid & 0xf) {
281 AMIGAHW_SET(DENISE_HR);
292 switch ((amiga_custom.vposr>>8) & 0x7f) {
294 AMIGAHW_SET(AGNUS_PAL);
297 AMIGAHW_SET(AGNUS_NTSC);
301 AMIGAHW_SET(AGNUS_HR_PAL);
305 AMIGAHW_SET(AGNUS_HR_NTSC);
309 AMIGAHW_SET(ALICE_PAL);
313 AMIGAHW_SET(ALICE_NTSC);
320 panic("No support for Draco yet");
323 panic("Unknown Amiga Model");
326 #define AMIGAHW_ANNOUNCE(name, str) \
327 if (AMIGAHW_PRESENT(name)) \
330 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO ");
331 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER ");
332 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF ");
333 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO ");
334 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY ");
335 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI ");
336 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI ");
337 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE ");
338 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE ");
339 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM ");
340 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD ");
341 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE ");
342 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL ");
343 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL ");
344 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK ");
345 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK ");
346 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM ");
347 AMIGAHW_ANNOUNCE(PAULA, "PAULA ");
348 AMIGAHW_ANNOUNCE(DENISE, "DENISE ");
349 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR ");
350 AMIGAHW_ANNOUNCE(LISA, "LISA ");
351 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL ");
352 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC ");
353 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL ");
354 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC ");
355 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL ");
356 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC ");
357 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK ");
358 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA ");
359 if (AMIGAHW_PRESENT(ZORRO))
360 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
363 #undef AMIGAHW_ANNOUNCE
367 * Setup the Amiga configuration info
370 void __init config_amiga(void)
377 /* Some APUS boxes may have PCI memory, but ... */
378 iomem_resource.name = "Memory";
379 for (i = 0; i < 4; i++)
380 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
382 mach_sched_init = amiga_sched_init;
383 mach_init_IRQ = amiga_init_IRQ;
385 mach_default_handler = &amiga_default_handler;
386 mach_request_irq = amiga_request_irq;
387 mach_free_irq = amiga_free_irq;
388 enable_irq = amiga_enable_irq;
389 disable_irq = amiga_disable_irq;
391 mach_get_model = amiga_get_model;
392 mach_get_hardware_list = amiga_get_hardware_list;
393 mach_gettimeoffset = amiga_gettimeoffset;
394 if (AMIGAHW_PRESENT(A3000_CLK)){
395 mach_gettod = a3000_gettod;
396 rtc_resource.name = "A3000 RTC";
397 request_resource(&iomem_resource, &rtc_resource);
399 else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */
400 mach_gettod = a2000_gettod;
401 rtc_resource.name = "A2000 RTC";
402 request_resource(&iomem_resource, &rtc_resource);
405 mach_max_dma_address = 0xffffffff; /*
406 * default MAX_DMA=0xffffffff
407 * on all machines. If we don't
408 * do so, the SCSI code will not
409 * be able to allocate any mem
410 * for transfers, unless we are
411 * dealing with a Z2 mem only
415 mach_hwclk = amiga_hwclk;
416 mach_set_clock_mmss = amiga_set_clock_mmss;
417 mach_reset = amiga_reset;
418 #ifdef CONFIG_HEARTBEAT
419 mach_heartbeat = amiga_heartbeat;
422 /* Fill in the clock values (based on the 700 kHz E-Clock) */
423 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */
424 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
426 /* clear all DMA bits */
427 amiga_custom.dmacon = DMAF_ALL;
428 /* ensure that the DMA master bit is set */
429 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
431 /* request all RAM */
432 for (i = 0; i < m68k_num_memory; i++) {
433 ram_resource[i].name =
434 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
435 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
437 ram_resource[i].start = m68k_memory[i].addr;
438 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
439 request_resource(&iomem_resource, &ram_resource[i]);
442 /* initialize chipram allocator */
445 /* debugging using chipram */
446 if (!strcmp( m68k_debug_device, "mem" )){
447 if (!AMIGAHW_PRESENT(CHIP_RAM))
448 printk("Warning: no chipram present for debugging\n");
450 amiga_savekmsg_init();
451 amiga_console_driver.write = amiga_mem_console_write;
452 register_console(&amiga_console_driver);
456 /* our beloved beeper */
457 if (AMIGAHW_PRESENT(AMI_AUDIO))
461 * if it is an A3000, set the magic bit that forces
464 if (AMIGAHW_PRESENT(MAGIC_REKICK))
465 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
468 static unsigned short jiffy_ticks;
470 static void __init amiga_sched_init(irqreturn_t (*timer_routine)(int, void *,
473 static struct resource sched_res = {
474 "timer", 0x00bfd400, 0x00bfd5ff,
476 jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
478 if (request_resource(&mb_resources._ciab, &sched_res))
479 printk("Cannot allocate ciab.ta{lo,hi}\n");
480 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */
481 ciab.talo = jiffy_ticks % 256;
482 ciab.tahi = jiffy_ticks / 256;
484 /* install interrupt service routine for CIAB Timer A
486 * Please don't change this to use ciaa, as it interferes with the
487 * SCSI code. We'll have to take a look at this later
489 request_irq(IRQ_AMIGA_CIAB_TA, timer_routine, 0, "timer", NULL);
494 #define TICK_SIZE 10000
496 extern unsigned char cia_get_irq_mask(unsigned int irq);
498 /* This is always executed with interrupts disabled. */
499 static unsigned long amiga_gettimeoffset (void)
501 unsigned short hi, lo, hi2;
502 unsigned long ticks, offset = 0;
504 /* read CIA B timer A current value */
514 ticks = hi << 8 | lo;
516 if (ticks > jiffy_ticks / 2)
517 /* check for pending interrupt */
518 if (cia_get_irq_mask(IRQ_AMIGA_CIAB) & CIA_ICR_TA)
521 ticks = jiffy_ticks - ticks;
522 ticks = (10000 * ticks) / jiffy_ticks;
524 return ticks + offset;
527 static void a3000_gettod (int *yearp, int *monp, int *dayp,
528 int *hourp, int *minp, int *secp)
530 volatile struct tod3000 *tod = TOD_3000;
532 tod->cntrl1 = TOD3000_CNTRL1_HOLD;
534 *secp = tod->second1 * 10 + tod->second2;
535 *minp = tod->minute1 * 10 + tod->minute2;
536 *hourp = tod->hour1 * 10 + tod->hour2;
537 *dayp = tod->day1 * 10 + tod->day2;
538 *monp = tod->month1 * 10 + tod->month2;
539 *yearp = tod->year1 * 10 + tod->year2;
541 tod->cntrl1 = TOD3000_CNTRL1_FREE;
544 static void a2000_gettod (int *yearp, int *monp, int *dayp,
545 int *hourp, int *minp, int *secp)
547 volatile struct tod2000 *tod = TOD_2000;
549 tod->cntrl1 = TOD2000_CNTRL1_HOLD;
551 while (tod->cntrl1 & TOD2000_CNTRL1_BUSY)
554 *secp = tod->second1 * 10 + tod->second2;
555 *minp = tod->minute1 * 10 + tod->minute2;
556 *hourp = (tod->hour1 & 3) * 10 + tod->hour2;
557 *dayp = tod->day1 * 10 + tod->day2;
558 *monp = tod->month1 * 10 + tod->month2;
559 *yearp = tod->year1 * 10 + tod->year2;
561 if (!(tod->cntrl3 & TOD2000_CNTRL3_24HMODE)){
562 if (!(tod->hour1 & TOD2000_HOUR1_PM) && *hourp == 12)
564 else if ((tod->hour1 & TOD2000_HOUR1_PM) && *hourp != 12)
568 tod->cntrl1 &= ~TOD2000_CNTRL1_HOLD;
571 static int amiga_hwclk(int op, struct hwclk_time *t)
573 if (AMIGAHW_PRESENT(A3000_CLK)) {
574 volatile struct tod3000 *tod = TOD_3000;
576 tod->cntrl1 = TOD3000_CNTRL1_HOLD;
578 if (!op) { /* read */
579 t->sec = tod->second1 * 10 + tod->second2;
580 t->min = tod->minute1 * 10 + tod->minute2;
581 t->hour = tod->hour1 * 10 + tod->hour2;
582 t->day = tod->day1 * 10 + tod->day2;
583 t->wday = tod->weekday;
584 t->mon = tod->month1 * 10 + tod->month2 - 1;
585 t->year = tod->year1 * 10 + tod->year2;
589 tod->second1 = t->sec / 10;
590 tod->second2 = t->sec % 10;
591 tod->minute1 = t->min / 10;
592 tod->minute2 = t->min % 10;
593 tod->hour1 = t->hour / 10;
594 tod->hour2 = t->hour % 10;
595 tod->day1 = t->day / 10;
596 tod->day2 = t->day % 10;
598 tod->weekday = t->wday;
599 tod->month1 = (t->mon + 1) / 10;
600 tod->month2 = (t->mon + 1) % 10;
603 tod->year1 = t->year / 10;
604 tod->year2 = t->year % 10;
607 tod->cntrl1 = TOD3000_CNTRL1_FREE;
608 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
609 volatile struct tod2000 *tod = TOD_2000;
611 tod->cntrl1 = TOD2000_CNTRL1_HOLD;
613 while (tod->cntrl1 & TOD2000_CNTRL1_BUSY)
616 if (!op) { /* read */
617 t->sec = tod->second1 * 10 + tod->second2;
618 t->min = tod->minute1 * 10 + tod->minute2;
619 t->hour = (tod->hour1 & 3) * 10 + tod->hour2;
620 t->day = tod->day1 * 10 + tod->day2;
621 t->wday = tod->weekday;
622 t->mon = tod->month1 * 10 + tod->month2 - 1;
623 t->year = tod->year1 * 10 + tod->year2;
627 if (!(tod->cntrl3 & TOD2000_CNTRL3_24HMODE)){
628 if (!(tod->hour1 & TOD2000_HOUR1_PM) && t->hour == 12)
630 else if ((tod->hour1 & TOD2000_HOUR1_PM) && t->hour != 12)
634 tod->second1 = t->sec / 10;
635 tod->second2 = t->sec % 10;
636 tod->minute1 = t->min / 10;
637 tod->minute2 = t->min % 10;
638 if (tod->cntrl3 & TOD2000_CNTRL3_24HMODE)
639 tod->hour1 = t->hour / 10;
640 else if (t->hour >= 12)
641 tod->hour1 = TOD2000_HOUR1_PM +
644 tod->hour1 = t->hour / 10;
645 tod->hour2 = t->hour % 10;
646 tod->day1 = t->day / 10;
647 tod->day2 = t->day % 10;
649 tod->weekday = t->wday;
650 tod->month1 = (t->mon + 1) / 10;
651 tod->month2 = (t->mon + 1) % 10;
654 tod->year1 = t->year / 10;
655 tod->year2 = t->year % 10;
658 tod->cntrl1 &= ~TOD2000_CNTRL1_HOLD;
664 static int amiga_set_clock_mmss (unsigned long nowtime)
666 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
668 if (AMIGAHW_PRESENT(A3000_CLK)) {
669 volatile struct tod3000 *tod = TOD_3000;
671 tod->cntrl1 = TOD3000_CNTRL1_HOLD;
673 tod->second1 = real_seconds / 10;
674 tod->second2 = real_seconds % 10;
675 tod->minute1 = real_minutes / 10;
676 tod->minute2 = real_minutes % 10;
678 tod->cntrl1 = TOD3000_CNTRL1_FREE;
679 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
680 volatile struct tod2000 *tod = TOD_2000;
682 tod->cntrl1 = TOD2000_CNTRL1_HOLD;
684 while (tod->cntrl1 & TOD2000_CNTRL1_BUSY)
687 tod->second1 = real_seconds / 10;
688 tod->second2 = real_seconds % 10;
689 tod->minute1 = real_minutes / 10;
690 tod->minute2 = real_minutes % 10;
692 tod->cntrl1 &= ~TOD2000_CNTRL1_HOLD;
698 static NORET_TYPE void amiga_reset( void )
701 static void amiga_reset (void)
711 #define SAVEKMSG_MAXMEM 128*1024
713 #define SAVEKMSG_MAGIC1 0x53415645 /* 'SAVE' */
714 #define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
717 unsigned long magic1; /* SAVEKMSG_MAGIC1 */
718 unsigned long magic2; /* SAVEKMSG_MAGIC2 */
719 unsigned long magicptr; /* address of magic1 */
724 static struct savekmsg *savekmsg = NULL;
726 static void amiga_mem_console_write(struct console *co, const char *s,
729 if (savekmsg->size+count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
730 memcpy(savekmsg->data+savekmsg->size, s, count);
731 savekmsg->size += count;
735 static void amiga_savekmsg_init(void)
737 static struct resource debug_res = { "Debug" };
739 savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res);
740 savekmsg->magic1 = SAVEKMSG_MAGIC1;
741 savekmsg->magic2 = SAVEKMSG_MAGIC2;
742 savekmsg->magicptr = virt_to_phys(savekmsg);
746 static void amiga_serial_putc(char c)
748 amiga_custom.serdat = (unsigned char)c | 0x100;
750 while (!(amiga_custom.serdatr & 0x2000))
754 void amiga_serial_console_write(struct console *co, const char *s,
757 #if 0 /* def CONFIG_KGDB */
758 /* FIXME:APUS GDB doesn't seem to like O-packages before it is
759 properly connected with the target. */
760 __gdb_output_string (s, count);
764 amiga_serial_putc('\r');
765 amiga_serial_putc(*s++);
770 #ifdef CONFIG_SERIAL_CONSOLE
771 void amiga_serial_puts(const char *s)
773 amiga_serial_console_write(NULL, s, strlen(s));
776 int amiga_serial_console_wait_key(struct console *co)
780 while (!(amiga_custom.intreqr & IF_RBF))
782 ch = amiga_custom.serdatr & 0xff;
783 /* clear the interrupt, so that another character can be read */
784 amiga_custom.intreq = IF_RBF;
788 void amiga_serial_gets(struct console *co, char *s, int len)
793 ch = amiga_serial_console_wait_key(co);
795 /* Check for backspace. */
796 if (ch == 8 || ch == 127) {
798 amiga_serial_putc('\007');
802 amiga_serial_puts("\010 \010");
806 /* Check for enter. */
807 if (ch == 10 || ch == 13)
810 /* See if line is too long. */
811 if (cnt >= len + 1) {
812 amiga_serial_putc(7);
817 /* Store and echo character. */
819 amiga_serial_putc(ch);
822 amiga_serial_puts("\r\n");
827 static void __init amiga_debug_init(void)
829 if (!strcmp( m68k_debug_device, "ser" )) {
830 /* no initialization required (?) */
831 amiga_console_driver.write = amiga_serial_console_write;
832 register_console(&amiga_console_driver);
836 #ifdef CONFIG_HEARTBEAT
837 static void amiga_heartbeat(int on)
847 * Amiga specific parts of /proc
850 static void amiga_get_model(char *model)
852 strcpy(model, amiga_model_name);
856 static int amiga_get_hardware_list(char *buffer)
860 if (AMIGAHW_PRESENT(CHIP_RAM))
861 len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10);
862 len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
863 amiga_psfreq, amiga_eclock);
864 if (AMIGAHW_PRESENT(AMI_VIDEO)) {
866 switch(amiga_chipset) {
877 type = "Old or Unknown";
880 len += sprintf(buffer+len, "Graphics:\t%s\n", type);
883 #define AMIGAHW_ANNOUNCE(name, str) \
884 if (AMIGAHW_PRESENT(name)) \
885 len += sprintf (buffer+len, "\t%s\n", str)
887 len += sprintf (buffer + len, "Detected hardware:\n");
889 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video");
890 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter");
891 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer");
892 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio");
893 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller");
894 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)");
895 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)");
896 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)");
897 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)");
898 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive");
899 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard");
900 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port");
901 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port");
902 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port");
903 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)");
904 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)");
905 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM");
906 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364");
907 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362");
908 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373");
909 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375");
910 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371");
911 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370");
912 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372");
913 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372");
914 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374");
915 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374");
916 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick");
917 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot");
918 if (AMIGAHW_PRESENT(ZORRO))
919 len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion "
921 AMIGAHW_PRESENT(ZORRO3) ? "I" : "",
922 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
924 #undef AMIGAHW_ANNOUNCE
930 int get_hardware_list(char *buffer)
932 extern int get_cpuinfo(char *buffer);
939 mach_get_model(model);
941 strcpy(model, "Unknown PowerPC");
943 len += sprintf(buffer+len, "Model:\t\t%s\n", model);
944 len += get_cpuinfo(buffer+len);
945 for (mem = 0, i = 0; i < m68k_realnum_memory; i++)
946 mem += m68k_memory[i].size;
947 len += sprintf(buffer+len, "System Memory:\t%ldK\n", mem>>10);
949 if (mach_get_hardware_list)
950 len += mach_get_hardware_list(buffer+len);