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/types.h>
16 #include <linux/kernel.h>
19 #include <linux/tty.h>
20 #include <linux/console.h>
21 #include <linux/init.h>
23 #include <linux/zorro.h>
26 #include <asm/bootinfo.h>
27 #include <asm/setup.h>
28 #include <asm/system.h>
29 #include <asm/pgtable.h>
30 #include <asm/amigahw.h>
31 #include <asm/amigaints.h>
33 #include <asm/machdep.h>
36 unsigned long powerup_PCI_present
;
37 unsigned long powerup_BPPCPLUS_present
;
38 unsigned long amiga_model
;
39 unsigned long amiga_eclock
;
40 unsigned long amiga_masterclock
;
41 unsigned long amiga_colorclock
;
42 unsigned long amiga_chipset
;
43 unsigned char amiga_vblank
;
44 unsigned char amiga_psfreq
;
45 struct amiga_hw_present amiga_hw_present
;
47 static char s_a500
[] __initdata
= "A500";
48 static char s_a500p
[] __initdata
= "A500+";
49 static char s_a600
[] __initdata
= "A600";
50 static char s_a1000
[] __initdata
= "A1000";
51 static char s_a1200
[] __initdata
= "A1200";
52 static char s_a2000
[] __initdata
= "A2000";
53 static char s_a2500
[] __initdata
= "A2500";
54 static char s_a3000
[] __initdata
= "A3000";
55 static char s_a3000t
[] __initdata
= "A3000T";
56 static char s_a3000p
[] __initdata
= "A3000+";
57 static char s_a4000
[] __initdata
= "A4000";
58 static char s_a4000t
[] __initdata
= "A4000T";
59 static char s_cdtv
[] __initdata
= "CDTV";
60 static char s_cd32
[] __initdata
= "CD32";
61 static char s_draco
[] __initdata
= "Draco";
62 static char *amiga_models
[] __initdata
= {
63 s_a500
, s_a500p
, s_a600
, s_a1000
, s_a1200
, s_a2000
, s_a2500
, s_a3000
,
64 s_a3000t
, s_a3000p
, s_a4000
, s_a4000t
, s_cdtv
, s_cd32
, s_draco
,
67 static char amiga_model_name
[13] = "Amiga ";
69 extern char m68k_debug_device
[];
71 static void amiga_sched_init(irqreturn_t (*handler
)(int, void *, struct pt_regs
*));
72 /* amiga specific irq functions */
73 extern void amiga_init_IRQ (void);
74 extern void (*amiga_default_handler
[]) (int, void *, struct pt_regs
*);
75 extern int amiga_request_irq (unsigned int irq
,
76 void (*handler
)(int, void *, struct pt_regs
*),
77 unsigned long flags
, const char *devname
,
79 extern void amiga_free_irq (unsigned int irq
, void *dev_id
);
80 extern void amiga_enable_irq (unsigned int);
81 extern void amiga_disable_irq (unsigned int);
82 static void amiga_get_model(char *model
);
83 static int amiga_get_hardware_list(char *buffer
);
84 /* amiga specific timer functions */
85 static unsigned long amiga_gettimeoffset (void);
86 static void a3000_gettod (int *, int *, int *, int *, int *, int *);
87 static void a2000_gettod (int *, int *, int *, int *, int *, int *);
88 static int amiga_hwclk (int, struct hwclk_time
*);
89 static int amiga_set_clock_mmss (unsigned long);
90 static void amiga_reset (void);
91 extern void amiga_init_sound(void);
92 static void amiga_savekmsg_init(void);
93 static void amiga_mem_console_write(struct console
*co
, const char *b
,
95 void amiga_serial_console_write(struct console
*co
, const char *s
,
97 static void amiga_debug_init(void);
98 #ifdef CONFIG_HEARTBEAT
99 static void amiga_heartbeat(int on
);
102 static struct console amiga_console_driver
= {
104 .flags
= CON_PRINTBUFFER
,
110 * Motherboard Resources present in all Amiga models
114 struct resource _ciab
, _ciaa
, _custom
, _kickstart
;
116 // { "Ranger Memory", 0x00c00000, 0x00c7ffff },
117 ._ciab
= { "CIA B", 0x00bfd000, 0x00bfdfff },
118 ._ciaa
= { "CIA A", 0x00bfe000, 0x00bfefff },
119 ._custom
= { "Custom I/O", 0x00dff000, 0x00dfffff },
120 ._kickstart
= { "Kickstart ROM", 0x00f80000, 0x00ffffff }
123 static struct resource rtc_resource
= {
124 NULL
, 0x00dc0000, 0x00dcffff
127 static struct resource ram_resource
[NUM_MEMINFO
];
131 * Parse an Amiga-specific record in the bootinfo
134 int amiga_parse_bootinfo(const struct bi_record
*record
)
137 const unsigned long *data
= record
->data
;
139 switch (record
->tag
) {
142 unsigned long d
= *data
;
144 powerup_PCI_present
= d
& 0x100;
145 amiga_model
= d
& 0xff;
149 case BI_AMIGA_ECLOCK
:
150 amiga_eclock
= *data
;
153 case BI_AMIGA_CHIPSET
:
154 amiga_chipset
= *data
;
157 case BI_AMIGA_CHIP_SIZE
:
158 amiga_chip_size
= *(const int *)data
;
161 case BI_AMIGA_VBLANK
:
162 amiga_vblank
= *(const unsigned char *)data
;
165 case BI_AMIGA_PSFREQ
:
166 amiga_psfreq
= *(const unsigned char *)data
;
169 case BI_AMIGA_AUTOCON
:
171 if (zorro_num_autocon
< ZORRO_NUM_AUTO
) {
172 const struct ConfigDev
*cd
= (struct ConfigDev
*)data
;
173 struct zorro_dev
*dev
= &zorro_autocon
[zorro_num_autocon
++];
174 dev
->rom
= cd
->cd_Rom
;
175 dev
->slotaddr
= cd
->cd_SlotAddr
;
176 dev
->slotsize
= cd
->cd_SlotSize
;
177 dev
->resource
.start
= (unsigned long)cd
->cd_BoardAddr
;
178 dev
->resource
.end
= dev
->resource
.start
+cd
->cd_BoardSize
-1;
180 printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
181 #endif /* CONFIG_ZORRO */
184 case BI_AMIGA_SERPER
:
185 /* serial port period: ignored here */
188 case BI_AMIGA_PUP_BRIDGE
:
189 powerup_PCI_present
= *(const unsigned short *)data
;
192 case BI_AMIGA_BPPC_SCSI
:
193 powerup_BPPCPLUS_present
= *(const unsigned short *)data
;
203 * Identify builtin hardware
206 static void __init
amiga_identify(void)
208 /* Fill in some default values, if necessary */
209 if (amiga_eclock
== 0)
210 amiga_eclock
= 709379;
212 memset(&amiga_hw_present
, 0, sizeof(amiga_hw_present
));
214 printk("Amiga hardware found: ");
215 if (amiga_model
>= AMI_500
&& amiga_model
<= AMI_DRACO
) {
216 printk("[%s] ", amiga_models
[amiga_model
-AMI_500
]);
217 strcat(amiga_model_name
, amiga_models
[amiga_model
-AMI_500
]);
220 switch(amiga_model
) {
226 AMIGAHW_SET(A1200_IDE
);
233 AMIGAHW_SET(A2000_CLK
); /* Is this correct for all models? */
238 AMIGAHW_SET(AMBER_FF
);
239 AMIGAHW_SET(MAGIC_REKICK
);
242 AMIGAHW_SET(A3000_SCSI
);
243 AMIGAHW_SET(A3000_CLK
);
248 AMIGAHW_SET(A4000_SCSI
);
251 AMIGAHW_SET(A4000_IDE
);
252 AMIGAHW_SET(A3000_CLK
);
259 AMIGAHW_SET(A2000_CLK
); /* Is this correct? */
263 AMIGAHW_SET(AMI_VIDEO
);
264 AMIGAHW_SET(AMI_BLITTER
);
265 AMIGAHW_SET(AMI_AUDIO
);
266 AMIGAHW_SET(AMI_FLOPPY
);
267 AMIGAHW_SET(AMI_KEYBOARD
);
268 AMIGAHW_SET(AMI_MOUSE
);
269 AMIGAHW_SET(AMI_SERIAL
);
270 AMIGAHW_SET(AMI_PARALLEL
);
271 AMIGAHW_SET(CHIP_RAM
);
274 switch(amiga_chipset
) {
278 switch (amiga_custom
.deniseid
& 0xf) {
280 AMIGAHW_SET(DENISE_HR
);
291 switch ((amiga_custom
.vposr
>>8) & 0x7f) {
293 AMIGAHW_SET(AGNUS_PAL
);
296 AMIGAHW_SET(AGNUS_NTSC
);
300 AMIGAHW_SET(AGNUS_HR_PAL
);
304 AMIGAHW_SET(AGNUS_HR_NTSC
);
308 AMIGAHW_SET(ALICE_PAL
);
312 AMIGAHW_SET(ALICE_NTSC
);
319 panic("No support for Draco yet");
322 panic("Unknown Amiga Model");
325 #define AMIGAHW_ANNOUNCE(name, str) \
326 if (AMIGAHW_PRESENT(name)) \
329 AMIGAHW_ANNOUNCE(AMI_VIDEO
, "VIDEO ");
330 AMIGAHW_ANNOUNCE(AMI_BLITTER
, "BLITTER ");
331 AMIGAHW_ANNOUNCE(AMBER_FF
, "AMBER_FF ");
332 AMIGAHW_ANNOUNCE(AMI_AUDIO
, "AUDIO ");
333 AMIGAHW_ANNOUNCE(AMI_FLOPPY
, "FLOPPY ");
334 AMIGAHW_ANNOUNCE(A3000_SCSI
, "A3000_SCSI ");
335 AMIGAHW_ANNOUNCE(A4000_SCSI
, "A4000_SCSI ");
336 AMIGAHW_ANNOUNCE(A1200_IDE
, "A1200_IDE ");
337 AMIGAHW_ANNOUNCE(A4000_IDE
, "A4000_IDE ");
338 AMIGAHW_ANNOUNCE(CD_ROM
, "CD_ROM ");
339 AMIGAHW_ANNOUNCE(AMI_KEYBOARD
, "KEYBOARD ");
340 AMIGAHW_ANNOUNCE(AMI_MOUSE
, "MOUSE ");
341 AMIGAHW_ANNOUNCE(AMI_SERIAL
, "SERIAL ");
342 AMIGAHW_ANNOUNCE(AMI_PARALLEL
, "PARALLEL ");
343 AMIGAHW_ANNOUNCE(A2000_CLK
, "A2000_CLK ");
344 AMIGAHW_ANNOUNCE(A3000_CLK
, "A3000_CLK ");
345 AMIGAHW_ANNOUNCE(CHIP_RAM
, "CHIP_RAM ");
346 AMIGAHW_ANNOUNCE(PAULA
, "PAULA ");
347 AMIGAHW_ANNOUNCE(DENISE
, "DENISE ");
348 AMIGAHW_ANNOUNCE(DENISE_HR
, "DENISE_HR ");
349 AMIGAHW_ANNOUNCE(LISA
, "LISA ");
350 AMIGAHW_ANNOUNCE(AGNUS_PAL
, "AGNUS_PAL ");
351 AMIGAHW_ANNOUNCE(AGNUS_NTSC
, "AGNUS_NTSC ");
352 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL
, "AGNUS_HR_PAL ");
353 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC
, "AGNUS_HR_NTSC ");
354 AMIGAHW_ANNOUNCE(ALICE_PAL
, "ALICE_PAL ");
355 AMIGAHW_ANNOUNCE(ALICE_NTSC
, "ALICE_NTSC ");
356 AMIGAHW_ANNOUNCE(MAGIC_REKICK
, "MAGIC_REKICK ");
357 AMIGAHW_ANNOUNCE(PCMCIA
, "PCMCIA ");
358 if (AMIGAHW_PRESENT(ZORRO
))
359 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3
) ? "3" : "");
362 #undef AMIGAHW_ANNOUNCE
366 * Setup the Amiga configuration info
369 void __init
config_amiga(void)
376 /* Some APUS boxes may have PCI memory, but ... */
377 iomem_resource
.name
= "Memory";
378 for (i
= 0; i
< 4; i
++)
379 request_resource(&iomem_resource
, &((struct resource
*)&mb_resources
)[i
]);
381 mach_sched_init
= amiga_sched_init
;
382 mach_init_IRQ
= amiga_init_IRQ
;
384 mach_default_handler
= &amiga_default_handler
;
385 mach_request_irq
= amiga_request_irq
;
386 mach_free_irq
= amiga_free_irq
;
387 enable_irq
= amiga_enable_irq
;
388 disable_irq
= amiga_disable_irq
;
390 mach_get_model
= amiga_get_model
;
391 mach_get_hardware_list
= amiga_get_hardware_list
;
392 mach_gettimeoffset
= amiga_gettimeoffset
;
393 if (AMIGAHW_PRESENT(A3000_CLK
)){
394 mach_gettod
= a3000_gettod
;
395 rtc_resource
.name
= "A3000 RTC";
396 request_resource(&iomem_resource
, &rtc_resource
);
398 else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */
399 mach_gettod
= a2000_gettod
;
400 rtc_resource
.name
= "A2000 RTC";
401 request_resource(&iomem_resource
, &rtc_resource
);
404 mach_max_dma_address
= 0xffffffff; /*
405 * default MAX_DMA=0xffffffff
406 * on all machines. If we don't
407 * do so, the SCSI code will not
408 * be able to allocate any mem
409 * for transfers, unless we are
410 * dealing with a Z2 mem only
414 mach_hwclk
= amiga_hwclk
;
415 mach_set_clock_mmss
= amiga_set_clock_mmss
;
416 mach_reset
= amiga_reset
;
417 #ifdef CONFIG_HEARTBEAT
418 mach_heartbeat
= amiga_heartbeat
;
421 /* Fill in the clock values (based on the 700 kHz E-Clock) */
422 amiga_masterclock
= 40*amiga_eclock
; /* 28 MHz */
423 amiga_colorclock
= 5*amiga_eclock
; /* 3.5 MHz */
425 /* clear all DMA bits */
426 amiga_custom
.dmacon
= DMAF_ALL
;
427 /* ensure that the DMA master bit is set */
428 amiga_custom
.dmacon
= DMAF_SETCLR
| DMAF_MASTER
;
430 /* request all RAM */
431 for (i
= 0; i
< m68k_num_memory
; i
++) {
432 ram_resource
[i
].name
=
433 (m68k_memory
[i
].addr
>= 0x01000000) ? "32-bit Fast RAM" :
434 (m68k_memory
[i
].addr
< 0x00c00000) ? "16-bit Fast RAM" :
436 ram_resource
[i
].start
= m68k_memory
[i
].addr
;
437 ram_resource
[i
].end
= m68k_memory
[i
].addr
+m68k_memory
[i
].size
-1;
438 request_resource(&iomem_resource
, &ram_resource
[i
]);
441 /* initialize chipram allocator */
444 /* debugging using chipram */
445 if (!strcmp( m68k_debug_device
, "mem" )){
446 if (!AMIGAHW_PRESENT(CHIP_RAM
))
447 printk("Warning: no chipram present for debugging\n");
449 amiga_savekmsg_init();
450 amiga_console_driver
.write
= amiga_mem_console_write
;
451 register_console(&amiga_console_driver
);
455 /* our beloved beeper */
456 if (AMIGAHW_PRESENT(AMI_AUDIO
))
460 * if it is an A3000, set the magic bit that forces
463 if (AMIGAHW_PRESENT(MAGIC_REKICK
))
464 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
467 static unsigned short jiffy_ticks
;
469 static void __init
amiga_sched_init(irqreturn_t (*timer_routine
)(int, void *,
472 static struct resource sched_res
= {
473 "timer", 0x00bfd400, 0x00bfd5ff,
475 jiffy_ticks
= (amiga_eclock
+HZ
/2)/HZ
;
477 if (request_resource(&mb_resources
._ciab
, &sched_res
))
478 printk("Cannot allocate ciab.ta{lo,hi}\n");
479 ciab
.cra
&= 0xC0; /* turn off timer A, continuous mode, from Eclk */
480 ciab
.talo
= jiffy_ticks
% 256;
481 ciab
.tahi
= jiffy_ticks
/ 256;
483 /* install interrupt service routine for CIAB Timer A
485 * Please don't change this to use ciaa, as it interferes with the
486 * SCSI code. We'll have to take a look at this later
488 request_irq(IRQ_AMIGA_CIAB_TA
, timer_routine
, 0, "timer", NULL
);
493 #define TICK_SIZE 10000
495 extern unsigned char cia_get_irq_mask(unsigned int irq
);
497 /* This is always executed with interrupts disabled. */
498 static unsigned long amiga_gettimeoffset (void)
500 unsigned short hi
, lo
, hi2
;
501 unsigned long ticks
, offset
= 0;
503 /* read CIA B timer A current value */
513 ticks
= hi
<< 8 | lo
;
515 if (ticks
> jiffy_ticks
/ 2)
516 /* check for pending interrupt */
517 if (cia_get_irq_mask(IRQ_AMIGA_CIAB
) & CIA_ICR_TA
)
520 ticks
= jiffy_ticks
- ticks
;
521 ticks
= (10000 * ticks
) / jiffy_ticks
;
523 return ticks
+ offset
;
526 static void a3000_gettod (int *yearp
, int *monp
, int *dayp
,
527 int *hourp
, int *minp
, int *secp
)
529 volatile struct tod3000
*tod
= TOD_3000
;
531 tod
->cntrl1
= TOD3000_CNTRL1_HOLD
;
533 *secp
= tod
->second1
* 10 + tod
->second2
;
534 *minp
= tod
->minute1
* 10 + tod
->minute2
;
535 *hourp
= tod
->hour1
* 10 + tod
->hour2
;
536 *dayp
= tod
->day1
* 10 + tod
->day2
;
537 *monp
= tod
->month1
* 10 + tod
->month2
;
538 *yearp
= tod
->year1
* 10 + tod
->year2
;
540 tod
->cntrl1
= TOD3000_CNTRL1_FREE
;
543 static void a2000_gettod (int *yearp
, int *monp
, int *dayp
,
544 int *hourp
, int *minp
, int *secp
)
546 volatile struct tod2000
*tod
= TOD_2000
;
548 tod
->cntrl1
= TOD2000_CNTRL1_HOLD
;
550 while (tod
->cntrl1
& TOD2000_CNTRL1_BUSY
)
553 *secp
= tod
->second1
* 10 + tod
->second2
;
554 *minp
= tod
->minute1
* 10 + tod
->minute2
;
555 *hourp
= (tod
->hour1
& 3) * 10 + tod
->hour2
;
556 *dayp
= tod
->day1
* 10 + tod
->day2
;
557 *monp
= tod
->month1
* 10 + tod
->month2
;
558 *yearp
= tod
->year1
* 10 + tod
->year2
;
560 if (!(tod
->cntrl3
& TOD2000_CNTRL3_24HMODE
)){
561 if (!(tod
->hour1
& TOD2000_HOUR1_PM
) && *hourp
== 12)
563 else if ((tod
->hour1
& TOD2000_HOUR1_PM
) && *hourp
!= 12)
567 tod
->cntrl1
&= ~TOD2000_CNTRL1_HOLD
;
570 static int amiga_hwclk(int op
, struct hwclk_time
*t
)
572 if (AMIGAHW_PRESENT(A3000_CLK
)) {
573 volatile struct tod3000
*tod
= TOD_3000
;
575 tod
->cntrl1
= TOD3000_CNTRL1_HOLD
;
577 if (!op
) { /* read */
578 t
->sec
= tod
->second1
* 10 + tod
->second2
;
579 t
->min
= tod
->minute1
* 10 + tod
->minute2
;
580 t
->hour
= tod
->hour1
* 10 + tod
->hour2
;
581 t
->day
= tod
->day1
* 10 + tod
->day2
;
582 t
->wday
= tod
->weekday
;
583 t
->mon
= tod
->month1
* 10 + tod
->month2
- 1;
584 t
->year
= tod
->year1
* 10 + tod
->year2
;
588 tod
->second1
= t
->sec
/ 10;
589 tod
->second2
= t
->sec
% 10;
590 tod
->minute1
= t
->min
/ 10;
591 tod
->minute2
= t
->min
% 10;
592 tod
->hour1
= t
->hour
/ 10;
593 tod
->hour2
= t
->hour
% 10;
594 tod
->day1
= t
->day
/ 10;
595 tod
->day2
= t
->day
% 10;
597 tod
->weekday
= t
->wday
;
598 tod
->month1
= (t
->mon
+ 1) / 10;
599 tod
->month2
= (t
->mon
+ 1) % 10;
602 tod
->year1
= t
->year
/ 10;
603 tod
->year2
= t
->year
% 10;
606 tod
->cntrl1
= TOD3000_CNTRL1_FREE
;
607 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
608 volatile struct tod2000
*tod
= TOD_2000
;
610 tod
->cntrl1
= TOD2000_CNTRL1_HOLD
;
612 while (tod
->cntrl1
& TOD2000_CNTRL1_BUSY
)
615 if (!op
) { /* read */
616 t
->sec
= tod
->second1
* 10 + tod
->second2
;
617 t
->min
= tod
->minute1
* 10 + tod
->minute2
;
618 t
->hour
= (tod
->hour1
& 3) * 10 + tod
->hour2
;
619 t
->day
= tod
->day1
* 10 + tod
->day2
;
620 t
->wday
= tod
->weekday
;
621 t
->mon
= tod
->month1
* 10 + tod
->month2
- 1;
622 t
->year
= tod
->year1
* 10 + tod
->year2
;
626 if (!(tod
->cntrl3
& TOD2000_CNTRL3_24HMODE
)){
627 if (!(tod
->hour1
& TOD2000_HOUR1_PM
) && t
->hour
== 12)
629 else if ((tod
->hour1
& TOD2000_HOUR1_PM
) && t
->hour
!= 12)
633 tod
->second1
= t
->sec
/ 10;
634 tod
->second2
= t
->sec
% 10;
635 tod
->minute1
= t
->min
/ 10;
636 tod
->minute2
= t
->min
% 10;
637 if (tod
->cntrl3
& TOD2000_CNTRL3_24HMODE
)
638 tod
->hour1
= t
->hour
/ 10;
639 else if (t
->hour
>= 12)
640 tod
->hour1
= TOD2000_HOUR1_PM
+
643 tod
->hour1
= t
->hour
/ 10;
644 tod
->hour2
= t
->hour
% 10;
645 tod
->day1
= t
->day
/ 10;
646 tod
->day2
= t
->day
% 10;
648 tod
->weekday
= t
->wday
;
649 tod
->month1
= (t
->mon
+ 1) / 10;
650 tod
->month2
= (t
->mon
+ 1) % 10;
653 tod
->year1
= t
->year
/ 10;
654 tod
->year2
= t
->year
% 10;
657 tod
->cntrl1
&= ~TOD2000_CNTRL1_HOLD
;
663 static int amiga_set_clock_mmss (unsigned long nowtime
)
665 short real_seconds
= nowtime
% 60, real_minutes
= (nowtime
/ 60) % 60;
667 if (AMIGAHW_PRESENT(A3000_CLK
)) {
668 volatile struct tod3000
*tod
= TOD_3000
;
670 tod
->cntrl1
= TOD3000_CNTRL1_HOLD
;
672 tod
->second1
= real_seconds
/ 10;
673 tod
->second2
= real_seconds
% 10;
674 tod
->minute1
= real_minutes
/ 10;
675 tod
->minute2
= real_minutes
% 10;
677 tod
->cntrl1
= TOD3000_CNTRL1_FREE
;
678 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
679 volatile struct tod2000
*tod
= TOD_2000
;
681 tod
->cntrl1
= TOD2000_CNTRL1_HOLD
;
683 while (tod
->cntrl1
& TOD2000_CNTRL1_BUSY
)
686 tod
->second1
= real_seconds
/ 10;
687 tod
->second2
= real_seconds
% 10;
688 tod
->minute1
= real_minutes
/ 10;
689 tod
->minute2
= real_minutes
% 10;
691 tod
->cntrl1
&= ~TOD2000_CNTRL1_HOLD
;
697 static NORET_TYPE
void amiga_reset( void )
700 static void amiga_reset (void)
710 #define SAVEKMSG_MAXMEM 128*1024
712 #define SAVEKMSG_MAGIC1 0x53415645 /* 'SAVE' */
713 #define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
716 unsigned long magic1
; /* SAVEKMSG_MAGIC1 */
717 unsigned long magic2
; /* SAVEKMSG_MAGIC2 */
718 unsigned long magicptr
; /* address of magic1 */
723 static struct savekmsg
*savekmsg
= NULL
;
725 static void amiga_mem_console_write(struct console
*co
, const char *s
,
728 if (savekmsg
->size
+count
<= SAVEKMSG_MAXMEM
-sizeof(struct savekmsg
)) {
729 memcpy(savekmsg
->data
+savekmsg
->size
, s
, count
);
730 savekmsg
->size
+= count
;
734 static void amiga_savekmsg_init(void)
736 static struct resource debug_res
= { "Debug" };
738 savekmsg
= amiga_chip_alloc_res(SAVEKMSG_MAXMEM
, &debug_res
);
739 savekmsg
->magic1
= SAVEKMSG_MAGIC1
;
740 savekmsg
->magic2
= SAVEKMSG_MAGIC2
;
741 savekmsg
->magicptr
= virt_to_phys(savekmsg
);
745 static void amiga_serial_putc(char c
)
747 amiga_custom
.serdat
= (unsigned char)c
| 0x100;
749 while (!(amiga_custom
.serdatr
& 0x2000))
753 void amiga_serial_console_write(struct console
*co
, const char *s
,
756 #if 0 /* def CONFIG_KGDB */
757 /* FIXME:APUS GDB doesn't seem to like O-packages before it is
758 properly connected with the target. */
759 __gdb_output_string (s
, count
);
763 amiga_serial_putc('\r');
764 amiga_serial_putc(*s
++);
769 #ifdef CONFIG_SERIAL_CONSOLE
770 void amiga_serial_puts(const char *s
)
772 amiga_serial_console_write(NULL
, s
, strlen(s
));
775 int amiga_serial_console_wait_key(struct console
*co
)
779 while (!(amiga_custom
.intreqr
& IF_RBF
))
781 ch
= amiga_custom
.serdatr
& 0xff;
782 /* clear the interrupt, so that another character can be read */
783 amiga_custom
.intreq
= IF_RBF
;
787 void amiga_serial_gets(struct console
*co
, char *s
, int len
)
792 ch
= amiga_serial_console_wait_key(co
);
794 /* Check for backspace. */
795 if (ch
== 8 || ch
== 127) {
797 amiga_serial_putc('\007');
801 amiga_serial_puts("\010 \010");
805 /* Check for enter. */
806 if (ch
== 10 || ch
== 13)
809 /* See if line is too long. */
810 if (cnt
>= len
+ 1) {
811 amiga_serial_putc(7);
816 /* Store and echo character. */
818 amiga_serial_putc(ch
);
821 amiga_serial_puts("\r\n");
826 static void __init
amiga_debug_init(void)
828 if (!strcmp( m68k_debug_device
, "ser" )) {
829 /* no initialization required (?) */
830 amiga_console_driver
.write
= amiga_serial_console_write
;
831 register_console(&amiga_console_driver
);
835 #ifdef CONFIG_HEARTBEAT
836 static void amiga_heartbeat(int on
)
846 * Amiga specific parts of /proc
849 static void amiga_get_model(char *model
)
851 strcpy(model
, amiga_model_name
);
855 static int amiga_get_hardware_list(char *buffer
)
859 if (AMIGAHW_PRESENT(CHIP_RAM
))
860 len
+= sprintf(buffer
+len
, "Chip RAM:\t%ldK\n", amiga_chip_size
>>10);
861 len
+= sprintf(buffer
+len
, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
862 amiga_psfreq
, amiga_eclock
);
863 if (AMIGAHW_PRESENT(AMI_VIDEO
)) {
865 switch(amiga_chipset
) {
876 type
= "Old or Unknown";
879 len
+= sprintf(buffer
+len
, "Graphics:\t%s\n", type
);
882 #define AMIGAHW_ANNOUNCE(name, str) \
883 if (AMIGAHW_PRESENT(name)) \
884 len += sprintf (buffer+len, "\t%s\n", str)
886 len
+= sprintf (buffer
+ len
, "Detected hardware:\n");
888 AMIGAHW_ANNOUNCE(AMI_VIDEO
, "Amiga Video");
889 AMIGAHW_ANNOUNCE(AMI_BLITTER
, "Blitter");
890 AMIGAHW_ANNOUNCE(AMBER_FF
, "Amber Flicker Fixer");
891 AMIGAHW_ANNOUNCE(AMI_AUDIO
, "Amiga Audio");
892 AMIGAHW_ANNOUNCE(AMI_FLOPPY
, "Floppy Controller");
893 AMIGAHW_ANNOUNCE(A3000_SCSI
, "SCSI Controller WD33C93 (A3000 style)");
894 AMIGAHW_ANNOUNCE(A4000_SCSI
, "SCSI Controller NCR53C710 (A4000T style)");
895 AMIGAHW_ANNOUNCE(A1200_IDE
, "IDE Interface (A1200 style)");
896 AMIGAHW_ANNOUNCE(A4000_IDE
, "IDE Interface (A4000 style)");
897 AMIGAHW_ANNOUNCE(CD_ROM
, "Internal CD ROM drive");
898 AMIGAHW_ANNOUNCE(AMI_KEYBOARD
, "Keyboard");
899 AMIGAHW_ANNOUNCE(AMI_MOUSE
, "Mouse Port");
900 AMIGAHW_ANNOUNCE(AMI_SERIAL
, "Serial Port");
901 AMIGAHW_ANNOUNCE(AMI_PARALLEL
, "Parallel Port");
902 AMIGAHW_ANNOUNCE(A2000_CLK
, "Hardware Clock (A2000 style)");
903 AMIGAHW_ANNOUNCE(A3000_CLK
, "Hardware Clock (A3000 style)");
904 AMIGAHW_ANNOUNCE(CHIP_RAM
, "Chip RAM");
905 AMIGAHW_ANNOUNCE(PAULA
, "Paula 8364");
906 AMIGAHW_ANNOUNCE(DENISE
, "Denise 8362");
907 AMIGAHW_ANNOUNCE(DENISE_HR
, "Denise 8373");
908 AMIGAHW_ANNOUNCE(LISA
, "Lisa 8375");
909 AMIGAHW_ANNOUNCE(AGNUS_PAL
, "Normal/Fat PAL Agnus 8367/8371");
910 AMIGAHW_ANNOUNCE(AGNUS_NTSC
, "Normal/Fat NTSC Agnus 8361/8370");
911 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL
, "Fat Hires PAL Agnus 8372");
912 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC
, "Fat Hires NTSC Agnus 8372");
913 AMIGAHW_ANNOUNCE(ALICE_PAL
, "PAL Alice 8374");
914 AMIGAHW_ANNOUNCE(ALICE_NTSC
, "NTSC Alice 8374");
915 AMIGAHW_ANNOUNCE(MAGIC_REKICK
, "Magic Hard Rekick");
916 AMIGAHW_ANNOUNCE(PCMCIA
, "PCMCIA Slot");
917 if (AMIGAHW_PRESENT(ZORRO
))
918 len
+= sprintf(buffer
+len
, "\tZorro II%s AutoConfig: %d Expansion "
920 AMIGAHW_PRESENT(ZORRO3
) ? "I" : "",
921 zorro_num_autocon
, zorro_num_autocon
== 1 ? "" : "s");
923 #undef AMIGAHW_ANNOUNCE
929 int get_hardware_list(char *buffer
)
931 extern int get_cpuinfo(char *buffer
);
938 mach_get_model(model
);
940 strcpy(model
, "Unknown PowerPC");
942 len
+= sprintf(buffer
+len
, "Model:\t\t%s\n", model
);
943 len
+= get_cpuinfo(buffer
+len
);
944 for (mem
= 0, i
= 0; i
< m68k_realnum_memory
; i
++)
945 mem
+= m68k_memory
[i
].size
;
946 len
+= sprintf(buffer
+len
, "System Memory:\t%ldK\n", mem
>>10);
948 if (mach_get_hardware_list
)
949 len
+= mach_get_hardware_list(buffer
+len
);