1 #define m68k_debug_device debug_device
4 * arch/ppc/amiga/config.c
6 * Copyright (C) 1993 Hamish Macdonald
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive
14 * Miscellaneous Amiga stuff
17 #include <linux/config.h>
18 #include <linux/types.h>
19 #include <linux/kernel.h>
22 #include <linux/tty.h>
23 #include <linux/console.h>
24 #include <linux/init.h>
26 #include <linux/zorro.h>
29 #include <asm/bootinfo.h>
30 #include <asm/setup.h>
31 #include <asm/system.h>
32 #include <asm/pgtable.h>
33 #include <asm/amigahw.h>
34 #include <asm/amigaints.h>
36 #include <asm/machdep.h>
39 unsigned long powerup_PCI_present
;
40 unsigned long powerup_BPPCPLUS_present
;
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 s_a500
, s_a500p
, s_a600
, s_a1000
, s_a1200
, s_a2000
, s_a2500
, s_a3000
,
67 s_a3000t
, s_a3000p
, s_a4000
, s_a4000t
, s_cdtv
, s_cd32
, s_draco
,
70 static char amiga_model_name
[13] = "Amiga ";
72 extern char m68k_debug_device
[];
74 static void amiga_sched_init(irqreturn_t (*handler
)(int, void *, struct pt_regs
*));
75 /* amiga specific irq functions */
76 extern void amiga_init_IRQ (void);
77 extern void (*amiga_default_handler
[]) (int, void *, struct pt_regs
*);
78 extern int amiga_request_irq (unsigned int irq
,
79 void (*handler
)(int, void *, struct pt_regs
*),
80 unsigned long flags
, const char *devname
,
82 extern void amiga_free_irq (unsigned int irq
, void *dev_id
);
83 extern void amiga_enable_irq (unsigned int);
84 extern void amiga_disable_irq (unsigned int);
85 static void amiga_get_model(char *model
);
86 static int amiga_get_hardware_list(char *buffer
);
87 /* amiga specific timer functions */
88 static unsigned long amiga_gettimeoffset (void);
89 static void a3000_gettod (int *, int *, int *, int *, int *, int *);
90 static void a2000_gettod (int *, int *, int *, int *, int *, int *);
91 static int amiga_hwclk (int, struct hwclk_time
*);
92 static int amiga_set_clock_mmss (unsigned long);
93 #ifdef CONFIG_AMIGA_FLOPPY
94 extern void amiga_floppy_setup(char *, int *);
96 static void amiga_reset (void);
97 extern void amiga_init_sound(void);
98 static void amiga_savekmsg_init(void);
99 static void amiga_mem_console_write(struct console
*co
, const char *b
,
101 void amiga_serial_console_write(struct console
*co
, const char *s
,
103 static void amiga_debug_init(void);
104 #ifdef CONFIG_HEARTBEAT
105 static void amiga_heartbeat(int on
);
108 static struct console amiga_console_driver
= {
110 .flags
= CON_PRINTBUFFER
,
116 * Motherboard Resources present in all Amiga models
120 struct resource _ciab
, _ciaa
, _custom
, _kickstart
;
122 // { "Ranger Memory", 0x00c00000, 0x00c7ffff },
123 ._ciab
= { "CIA B", 0x00bfd000, 0x00bfdfff },
124 ._ciaa
= { "CIA A", 0x00bfe000, 0x00bfefff },
125 ._custom
= { "Custom I/O", 0x00dff000, 0x00dfffff },
126 ._kickstart
= { "Kickstart ROM", 0x00f80000, 0x00ffffff }
129 static struct resource rtc_resource
= {
130 NULL
, 0x00dc0000, 0x00dcffff
133 static struct resource ram_resource
[NUM_MEMINFO
];
137 * Parse an Amiga-specific record in the bootinfo
140 int amiga_parse_bootinfo(const struct bi_record
*record
)
143 const unsigned long *data
= record
->data
;
145 switch (record
->tag
) {
148 unsigned long d
= *data
;
150 powerup_PCI_present
= d
& 0x100;
151 amiga_model
= d
& 0xff;
155 case BI_AMIGA_ECLOCK
:
156 amiga_eclock
= *data
;
159 case BI_AMIGA_CHIPSET
:
160 amiga_chipset
= *data
;
163 case BI_AMIGA_CHIP_SIZE
:
164 amiga_chip_size
= *(const int *)data
;
167 case BI_AMIGA_VBLANK
:
168 amiga_vblank
= *(const unsigned char *)data
;
171 case BI_AMIGA_PSFREQ
:
172 amiga_psfreq
= *(const unsigned char *)data
;
175 case BI_AMIGA_AUTOCON
:
177 if (zorro_num_autocon
< ZORRO_NUM_AUTO
) {
178 const struct ConfigDev
*cd
= (struct ConfigDev
*)data
;
179 struct zorro_dev
*dev
= &zorro_autocon
[zorro_num_autocon
++];
180 dev
->rom
= cd
->cd_Rom
;
181 dev
->slotaddr
= cd
->cd_SlotAddr
;
182 dev
->slotsize
= cd
->cd_SlotSize
;
183 dev
->resource
.start
= (unsigned long)cd
->cd_BoardAddr
;
184 dev
->resource
.end
= dev
->resource
.start
+cd
->cd_BoardSize
-1;
186 printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
187 #endif /* CONFIG_ZORRO */
190 case BI_AMIGA_SERPER
:
191 /* serial port period: ignored here */
194 case BI_AMIGA_PUP_BRIDGE
:
195 powerup_PCI_present
= *(const unsigned short *)data
;
198 case BI_AMIGA_BPPC_SCSI
:
199 powerup_BPPCPLUS_present
= *(const unsigned short *)data
;
209 * Identify builtin hardware
212 static void __init
amiga_identify(void)
214 /* Fill in some default values, if necessary */
215 if (amiga_eclock
== 0)
216 amiga_eclock
= 709379;
218 memset(&amiga_hw_present
, 0, sizeof(amiga_hw_present
));
220 printk("Amiga hardware found: ");
221 if (amiga_model
>= AMI_500
&& amiga_model
<= AMI_DRACO
) {
222 printk("[%s] ", amiga_models
[amiga_model
-AMI_500
]);
223 strcat(amiga_model_name
, amiga_models
[amiga_model
-AMI_500
]);
226 switch(amiga_model
) {
232 AMIGAHW_SET(A1200_IDE
);
239 AMIGAHW_SET(A2000_CLK
); /* Is this correct for all models? */
244 AMIGAHW_SET(AMBER_FF
);
245 AMIGAHW_SET(MAGIC_REKICK
);
248 AMIGAHW_SET(A3000_SCSI
);
249 AMIGAHW_SET(A3000_CLK
);
254 AMIGAHW_SET(A4000_SCSI
);
257 AMIGAHW_SET(A4000_IDE
);
258 AMIGAHW_SET(A3000_CLK
);
265 AMIGAHW_SET(A2000_CLK
); /* Is this correct? */
269 AMIGAHW_SET(AMI_VIDEO
);
270 AMIGAHW_SET(AMI_BLITTER
);
271 AMIGAHW_SET(AMI_AUDIO
);
272 AMIGAHW_SET(AMI_FLOPPY
);
273 AMIGAHW_SET(AMI_KEYBOARD
);
274 AMIGAHW_SET(AMI_MOUSE
);
275 AMIGAHW_SET(AMI_SERIAL
);
276 AMIGAHW_SET(AMI_PARALLEL
);
277 AMIGAHW_SET(CHIP_RAM
);
280 switch(amiga_chipset
) {
284 switch (custom
.deniseid
& 0xf) {
286 AMIGAHW_SET(DENISE_HR
);
297 switch ((custom
.vposr
>>8) & 0x7f) {
299 AMIGAHW_SET(AGNUS_PAL
);
302 AMIGAHW_SET(AGNUS_NTSC
);
306 AMIGAHW_SET(AGNUS_HR_PAL
);
310 AMIGAHW_SET(AGNUS_HR_NTSC
);
314 AMIGAHW_SET(ALICE_PAL
);
318 AMIGAHW_SET(ALICE_NTSC
);
325 panic("No support for Draco yet");
328 panic("Unknown Amiga Model");
331 #define AMIGAHW_ANNOUNCE(name, str) \
332 if (AMIGAHW_PRESENT(name)) \
335 AMIGAHW_ANNOUNCE(AMI_VIDEO
, "VIDEO ");
336 AMIGAHW_ANNOUNCE(AMI_BLITTER
, "BLITTER ");
337 AMIGAHW_ANNOUNCE(AMBER_FF
, "AMBER_FF ");
338 AMIGAHW_ANNOUNCE(AMI_AUDIO
, "AUDIO ");
339 AMIGAHW_ANNOUNCE(AMI_FLOPPY
, "FLOPPY ");
340 AMIGAHW_ANNOUNCE(A3000_SCSI
, "A3000_SCSI ");
341 AMIGAHW_ANNOUNCE(A4000_SCSI
, "A4000_SCSI ");
342 AMIGAHW_ANNOUNCE(A1200_IDE
, "A1200_IDE ");
343 AMIGAHW_ANNOUNCE(A4000_IDE
, "A4000_IDE ");
344 AMIGAHW_ANNOUNCE(CD_ROM
, "CD_ROM ");
345 AMIGAHW_ANNOUNCE(AMI_KEYBOARD
, "KEYBOARD ");
346 AMIGAHW_ANNOUNCE(AMI_MOUSE
, "MOUSE ");
347 AMIGAHW_ANNOUNCE(AMI_SERIAL
, "SERIAL ");
348 AMIGAHW_ANNOUNCE(AMI_PARALLEL
, "PARALLEL ");
349 AMIGAHW_ANNOUNCE(A2000_CLK
, "A2000_CLK ");
350 AMIGAHW_ANNOUNCE(A3000_CLK
, "A3000_CLK ");
351 AMIGAHW_ANNOUNCE(CHIP_RAM
, "CHIP_RAM ");
352 AMIGAHW_ANNOUNCE(PAULA
, "PAULA ");
353 AMIGAHW_ANNOUNCE(DENISE
, "DENISE ");
354 AMIGAHW_ANNOUNCE(DENISE_HR
, "DENISE_HR ");
355 AMIGAHW_ANNOUNCE(LISA
, "LISA ");
356 AMIGAHW_ANNOUNCE(AGNUS_PAL
, "AGNUS_PAL ");
357 AMIGAHW_ANNOUNCE(AGNUS_NTSC
, "AGNUS_NTSC ");
358 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL
, "AGNUS_HR_PAL ");
359 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC
, "AGNUS_HR_NTSC ");
360 AMIGAHW_ANNOUNCE(ALICE_PAL
, "ALICE_PAL ");
361 AMIGAHW_ANNOUNCE(ALICE_NTSC
, "ALICE_NTSC ");
362 AMIGAHW_ANNOUNCE(MAGIC_REKICK
, "MAGIC_REKICK ");
363 AMIGAHW_ANNOUNCE(PCMCIA
, "PCMCIA ");
364 if (AMIGAHW_PRESENT(ZORRO
))
365 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3
) ? "3" : "");
368 #undef AMIGAHW_ANNOUNCE
372 * Setup the Amiga configuration info
375 void __init
config_amiga(void)
382 /* Some APUS boxes may have PCI memory, but ... */
383 iomem_resource
.name
= "Memory";
384 for (i
= 0; i
< 4; i
++)
385 request_resource(&iomem_resource
, &((struct resource
*)&mb_resources
)[i
]);
387 mach_sched_init
= amiga_sched_init
;
388 mach_init_IRQ
= amiga_init_IRQ
;
390 mach_default_handler
= &amiga_default_handler
;
391 mach_request_irq
= amiga_request_irq
;
392 mach_free_irq
= amiga_free_irq
;
393 enable_irq
= amiga_enable_irq
;
394 disable_irq
= amiga_disable_irq
;
396 mach_get_model
= amiga_get_model
;
397 mach_get_hardware_list
= amiga_get_hardware_list
;
398 mach_gettimeoffset
= amiga_gettimeoffset
;
399 if (AMIGAHW_PRESENT(A3000_CLK
)){
400 mach_gettod
= a3000_gettod
;
401 rtc_resource
.name
= "A3000 RTC";
402 request_resource(&iomem_resource
, &rtc_resource
);
404 else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */
405 mach_gettod
= a2000_gettod
;
406 rtc_resource
.name
= "A2000 RTC";
407 request_resource(&iomem_resource
, &rtc_resource
);
410 mach_max_dma_address
= 0xffffffff; /*
411 * default MAX_DMA=0xffffffff
412 * on all machines. If we don't
413 * do so, the SCSI code will not
414 * be able to allocate any mem
415 * for transfers, unless we are
416 * dealing with a Z2 mem only
420 mach_hwclk
= amiga_hwclk
;
421 mach_set_clock_mmss
= amiga_set_clock_mmss
;
422 #ifdef CONFIG_AMIGA_FLOPPY
423 mach_floppy_setup
= amiga_floppy_setup
;
425 mach_reset
= amiga_reset
;
426 #ifdef CONFIG_HEARTBEAT
427 mach_heartbeat
= amiga_heartbeat
;
430 /* Fill in the clock values (based on the 700 kHz E-Clock) */
431 amiga_masterclock
= 40*amiga_eclock
; /* 28 MHz */
432 amiga_colorclock
= 5*amiga_eclock
; /* 3.5 MHz */
434 /* clear all DMA bits */
435 custom
.dmacon
= DMAF_ALL
;
436 /* ensure that the DMA master bit is set */
437 custom
.dmacon
= DMAF_SETCLR
| DMAF_MASTER
;
439 /* request all RAM */
440 for (i
= 0; i
< m68k_num_memory
; i
++) {
441 ram_resource
[i
].name
=
442 (m68k_memory
[i
].addr
>= 0x01000000) ? "32-bit Fast RAM" :
443 (m68k_memory
[i
].addr
< 0x00c00000) ? "16-bit Fast RAM" :
445 ram_resource
[i
].start
= m68k_memory
[i
].addr
;
446 ram_resource
[i
].end
= m68k_memory
[i
].addr
+m68k_memory
[i
].size
-1;
447 request_resource(&iomem_resource
, &ram_resource
[i
]);
450 /* initialize chipram allocator */
453 /* debugging using chipram */
454 if (!strcmp( m68k_debug_device
, "mem" )){
455 if (!AMIGAHW_PRESENT(CHIP_RAM
))
456 printk("Warning: no chipram present for debugging\n");
458 amiga_savekmsg_init();
459 amiga_console_driver
.write
= amiga_mem_console_write
;
460 register_console(&amiga_console_driver
);
464 /* our beloved beeper */
465 if (AMIGAHW_PRESENT(AMI_AUDIO
))
469 * if it is an A3000, set the magic bit that forces
472 if (AMIGAHW_PRESENT(MAGIC_REKICK
))
473 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
476 static unsigned short jiffy_ticks
;
478 static void __init
amiga_sched_init(irqreturn_t (*timer_routine
)(int, void *,
481 static struct resource sched_res
= {
482 "timer", 0x00bfd400, 0x00bfd5ff,
484 jiffy_ticks
= (amiga_eclock
+HZ
/2)/HZ
;
486 if (request_resource(&mb_resources
._ciab
, &sched_res
))
487 printk("Cannot allocate ciab.ta{lo,hi}\n");
488 ciab
.cra
&= 0xC0; /* turn off timer A, continuous mode, from Eclk */
489 ciab
.talo
= jiffy_ticks
% 256;
490 ciab
.tahi
= jiffy_ticks
/ 256;
492 /* install interrupt service routine for CIAB Timer A
494 * Please don't change this to use ciaa, as it interferes with the
495 * SCSI code. We'll have to take a look at this later
497 request_irq(IRQ_AMIGA_CIAB_TA
, timer_routine
, 0, "timer", NULL
);
502 #define TICK_SIZE 10000
504 extern unsigned char cia_get_irq_mask(unsigned int irq
);
506 /* This is always executed with interrupts disabled. */
507 static unsigned long amiga_gettimeoffset (void)
509 unsigned short hi
, lo
, hi2
;
510 unsigned long ticks
, offset
= 0;
512 /* read CIA B timer A current value */
522 ticks
= hi
<< 8 | lo
;
524 if (ticks
> jiffy_ticks
/ 2)
525 /* check for pending interrupt */
526 if (cia_get_irq_mask(IRQ_AMIGA_CIAB
) & CIA_ICR_TA
)
529 ticks
= jiffy_ticks
- ticks
;
530 ticks
= (10000 * ticks
) / jiffy_ticks
;
532 return ticks
+ offset
;
535 static void a3000_gettod (int *yearp
, int *monp
, int *dayp
,
536 int *hourp
, int *minp
, int *secp
)
538 volatile struct tod3000
*tod
= TOD_3000
;
540 tod
->cntrl1
= TOD3000_CNTRL1_HOLD
;
542 *secp
= tod
->second1
* 10 + tod
->second2
;
543 *minp
= tod
->minute1
* 10 + tod
->minute2
;
544 *hourp
= tod
->hour1
* 10 + tod
->hour2
;
545 *dayp
= tod
->day1
* 10 + tod
->day2
;
546 *monp
= tod
->month1
* 10 + tod
->month2
;
547 *yearp
= tod
->year1
* 10 + tod
->year2
;
549 tod
->cntrl1
= TOD3000_CNTRL1_FREE
;
552 static void a2000_gettod (int *yearp
, int *monp
, int *dayp
,
553 int *hourp
, int *minp
, int *secp
)
555 volatile struct tod2000
*tod
= TOD_2000
;
557 tod
->cntrl1
= TOD2000_CNTRL1_HOLD
;
559 while (tod
->cntrl1
& TOD2000_CNTRL1_BUSY
)
562 *secp
= tod
->second1
* 10 + tod
->second2
;
563 *minp
= tod
->minute1
* 10 + tod
->minute2
;
564 *hourp
= (tod
->hour1
& 3) * 10 + tod
->hour2
;
565 *dayp
= tod
->day1
* 10 + tod
->day2
;
566 *monp
= tod
->month1
* 10 + tod
->month2
;
567 *yearp
= tod
->year1
* 10 + tod
->year2
;
569 if (!(tod
->cntrl3
& TOD2000_CNTRL3_24HMODE
)){
570 if (!(tod
->hour1
& TOD2000_HOUR1_PM
) && *hourp
== 12)
572 else if ((tod
->hour1
& TOD2000_HOUR1_PM
) && *hourp
!= 12)
576 tod
->cntrl1
&= ~TOD2000_CNTRL1_HOLD
;
579 static int amiga_hwclk(int op
, struct hwclk_time
*t
)
581 if (AMIGAHW_PRESENT(A3000_CLK
)) {
582 volatile struct tod3000
*tod
= TOD_3000
;
584 tod
->cntrl1
= TOD3000_CNTRL1_HOLD
;
586 if (!op
) { /* read */
587 t
->sec
= tod
->second1
* 10 + tod
->second2
;
588 t
->min
= tod
->minute1
* 10 + tod
->minute2
;
589 t
->hour
= tod
->hour1
* 10 + tod
->hour2
;
590 t
->day
= tod
->day1
* 10 + tod
->day2
;
591 t
->wday
= tod
->weekday
;
592 t
->mon
= tod
->month1
* 10 + tod
->month2
- 1;
593 t
->year
= tod
->year1
* 10 + tod
->year2
;
597 tod
->second1
= t
->sec
/ 10;
598 tod
->second2
= t
->sec
% 10;
599 tod
->minute1
= t
->min
/ 10;
600 tod
->minute2
= t
->min
% 10;
601 tod
->hour1
= t
->hour
/ 10;
602 tod
->hour2
= t
->hour
% 10;
603 tod
->day1
= t
->day
/ 10;
604 tod
->day2
= t
->day
% 10;
606 tod
->weekday
= t
->wday
;
607 tod
->month1
= (t
->mon
+ 1) / 10;
608 tod
->month2
= (t
->mon
+ 1) % 10;
611 tod
->year1
= t
->year
/ 10;
612 tod
->year2
= t
->year
% 10;
615 tod
->cntrl1
= TOD3000_CNTRL1_FREE
;
616 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
617 volatile struct tod2000
*tod
= TOD_2000
;
619 tod
->cntrl1
= TOD2000_CNTRL1_HOLD
;
621 while (tod
->cntrl1
& TOD2000_CNTRL1_BUSY
)
624 if (!op
) { /* read */
625 t
->sec
= tod
->second1
* 10 + tod
->second2
;
626 t
->min
= tod
->minute1
* 10 + tod
->minute2
;
627 t
->hour
= (tod
->hour1
& 3) * 10 + tod
->hour2
;
628 t
->day
= tod
->day1
* 10 + tod
->day2
;
629 t
->wday
= tod
->weekday
;
630 t
->mon
= tod
->month1
* 10 + tod
->month2
- 1;
631 t
->year
= tod
->year1
* 10 + tod
->year2
;
635 if (!(tod
->cntrl3
& TOD2000_CNTRL3_24HMODE
)){
636 if (!(tod
->hour1
& TOD2000_HOUR1_PM
) && t
->hour
== 12)
638 else if ((tod
->hour1
& TOD2000_HOUR1_PM
) && t
->hour
!= 12)
642 tod
->second1
= t
->sec
/ 10;
643 tod
->second2
= t
->sec
% 10;
644 tod
->minute1
= t
->min
/ 10;
645 tod
->minute2
= t
->min
% 10;
646 if (tod
->cntrl3
& TOD2000_CNTRL3_24HMODE
)
647 tod
->hour1
= t
->hour
/ 10;
648 else if (t
->hour
>= 12)
649 tod
->hour1
= TOD2000_HOUR1_PM
+
652 tod
->hour1
= t
->hour
/ 10;
653 tod
->hour2
= t
->hour
% 10;
654 tod
->day1
= t
->day
/ 10;
655 tod
->day2
= t
->day
% 10;
657 tod
->weekday
= t
->wday
;
658 tod
->month1
= (t
->mon
+ 1) / 10;
659 tod
->month2
= (t
->mon
+ 1) % 10;
662 tod
->year1
= t
->year
/ 10;
663 tod
->year2
= t
->year
% 10;
666 tod
->cntrl1
&= ~TOD2000_CNTRL1_HOLD
;
672 static int amiga_set_clock_mmss (unsigned long nowtime
)
674 short real_seconds
= nowtime
% 60, real_minutes
= (nowtime
/ 60) % 60;
676 if (AMIGAHW_PRESENT(A3000_CLK
)) {
677 volatile struct tod3000
*tod
= TOD_3000
;
679 tod
->cntrl1
= TOD3000_CNTRL1_HOLD
;
681 tod
->second1
= real_seconds
/ 10;
682 tod
->second2
= real_seconds
% 10;
683 tod
->minute1
= real_minutes
/ 10;
684 tod
->minute2
= real_minutes
% 10;
686 tod
->cntrl1
= TOD3000_CNTRL1_FREE
;
687 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
688 volatile struct tod2000
*tod
= TOD_2000
;
690 tod
->cntrl1
= TOD2000_CNTRL1_HOLD
;
692 while (tod
->cntrl1
& TOD2000_CNTRL1_BUSY
)
695 tod
->second1
= real_seconds
/ 10;
696 tod
->second2
= real_seconds
% 10;
697 tod
->minute1
= real_minutes
/ 10;
698 tod
->minute2
= real_minutes
% 10;
700 tod
->cntrl1
&= ~TOD2000_CNTRL1_HOLD
;
706 static NORET_TYPE
void amiga_reset( void )
709 static void amiga_reset (void)
719 #define SAVEKMSG_MAXMEM 128*1024
721 #define SAVEKMSG_MAGIC1 0x53415645 /* 'SAVE' */
722 #define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
725 unsigned long magic1
; /* SAVEKMSG_MAGIC1 */
726 unsigned long magic2
; /* SAVEKMSG_MAGIC2 */
727 unsigned long magicptr
; /* address of magic1 */
732 static struct savekmsg
*savekmsg
= NULL
;
734 static void amiga_mem_console_write(struct console
*co
, const char *s
,
737 if (savekmsg
->size
+count
<= SAVEKMSG_MAXMEM
-sizeof(struct savekmsg
)) {
738 memcpy(savekmsg
->data
+savekmsg
->size
, s
, count
);
739 savekmsg
->size
+= count
;
743 static void amiga_savekmsg_init(void)
745 static struct resource debug_res
= { "Debug" };
747 savekmsg
= amiga_chip_alloc_res(SAVEKMSG_MAXMEM
, &debug_res
);
748 savekmsg
->magic1
= SAVEKMSG_MAGIC1
;
749 savekmsg
->magic2
= SAVEKMSG_MAGIC2
;
750 savekmsg
->magicptr
= virt_to_phys(savekmsg
);
754 static void amiga_serial_putc(char c
)
756 custom
.serdat
= (unsigned char)c
| 0x100;
758 while (!(custom
.serdatr
& 0x2000))
762 void amiga_serial_console_write(struct console
*co
, const char *s
,
765 #if 0 /* def CONFIG_KGDB */
766 /* FIXME:APUS GDB doesn't seem to like O-packages before it is
767 properly connected with the target. */
768 __gdb_output_string (s
, count
);
772 amiga_serial_putc('\r');
773 amiga_serial_putc(*s
++);
778 #ifdef CONFIG_SERIAL_CONSOLE
779 void amiga_serial_puts(const char *s
)
781 amiga_serial_console_write(NULL
, s
, strlen(s
));
784 int amiga_serial_console_wait_key(struct console
*co
)
788 while (!(custom
.intreqr
& IF_RBF
))
790 ch
= custom
.serdatr
& 0xff;
791 /* clear the interrupt, so that another character can be read */
792 custom
.intreq
= IF_RBF
;
796 void amiga_serial_gets(struct console
*co
, char *s
, int len
)
801 ch
= amiga_serial_console_wait_key(co
);
803 /* Check for backspace. */
804 if (ch
== 8 || ch
== 127) {
806 amiga_serial_putc('\007');
810 amiga_serial_puts("\010 \010");
814 /* Check for enter. */
815 if (ch
== 10 || ch
== 13)
818 /* See if line is too long. */
819 if (cnt
>= len
+ 1) {
820 amiga_serial_putc(7);
825 /* Store and echo character. */
827 amiga_serial_putc(ch
);
830 amiga_serial_puts("\r\n");
835 static void __init
amiga_debug_init(void)
837 if (!strcmp( m68k_debug_device
, "ser" )) {
838 /* no initialization required (?) */
839 amiga_console_driver
.write
= amiga_serial_console_write
;
840 register_console(&amiga_console_driver
);
844 #ifdef CONFIG_HEARTBEAT
845 static void amiga_heartbeat(int on
)
855 * Amiga specific parts of /proc
858 static void amiga_get_model(char *model
)
860 strcpy(model
, amiga_model_name
);
864 static int amiga_get_hardware_list(char *buffer
)
868 if (AMIGAHW_PRESENT(CHIP_RAM
))
869 len
+= sprintf(buffer
+len
, "Chip RAM:\t%ldK\n", amiga_chip_size
>>10);
870 len
+= sprintf(buffer
+len
, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
871 amiga_psfreq
, amiga_eclock
);
872 if (AMIGAHW_PRESENT(AMI_VIDEO
)) {
874 switch(amiga_chipset
) {
885 type
= "Old or Unknown";
888 len
+= sprintf(buffer
+len
, "Graphics:\t%s\n", type
);
891 #define AMIGAHW_ANNOUNCE(name, str) \
892 if (AMIGAHW_PRESENT(name)) \
893 len += sprintf (buffer+len, "\t%s\n", str)
895 len
+= sprintf (buffer
+ len
, "Detected hardware:\n");
897 AMIGAHW_ANNOUNCE(AMI_VIDEO
, "Amiga Video");
898 AMIGAHW_ANNOUNCE(AMI_BLITTER
, "Blitter");
899 AMIGAHW_ANNOUNCE(AMBER_FF
, "Amber Flicker Fixer");
900 AMIGAHW_ANNOUNCE(AMI_AUDIO
, "Amiga Audio");
901 AMIGAHW_ANNOUNCE(AMI_FLOPPY
, "Floppy Controller");
902 AMIGAHW_ANNOUNCE(A3000_SCSI
, "SCSI Controller WD33C93 (A3000 style)");
903 AMIGAHW_ANNOUNCE(A4000_SCSI
, "SCSI Controller NCR53C710 (A4000T style)");
904 AMIGAHW_ANNOUNCE(A1200_IDE
, "IDE Interface (A1200 style)");
905 AMIGAHW_ANNOUNCE(A4000_IDE
, "IDE Interface (A4000 style)");
906 AMIGAHW_ANNOUNCE(CD_ROM
, "Internal CD ROM drive");
907 AMIGAHW_ANNOUNCE(AMI_KEYBOARD
, "Keyboard");
908 AMIGAHW_ANNOUNCE(AMI_MOUSE
, "Mouse Port");
909 AMIGAHW_ANNOUNCE(AMI_SERIAL
, "Serial Port");
910 AMIGAHW_ANNOUNCE(AMI_PARALLEL
, "Parallel Port");
911 AMIGAHW_ANNOUNCE(A2000_CLK
, "Hardware Clock (A2000 style)");
912 AMIGAHW_ANNOUNCE(A3000_CLK
, "Hardware Clock (A3000 style)");
913 AMIGAHW_ANNOUNCE(CHIP_RAM
, "Chip RAM");
914 AMIGAHW_ANNOUNCE(PAULA
, "Paula 8364");
915 AMIGAHW_ANNOUNCE(DENISE
, "Denise 8362");
916 AMIGAHW_ANNOUNCE(DENISE_HR
, "Denise 8373");
917 AMIGAHW_ANNOUNCE(LISA
, "Lisa 8375");
918 AMIGAHW_ANNOUNCE(AGNUS_PAL
, "Normal/Fat PAL Agnus 8367/8371");
919 AMIGAHW_ANNOUNCE(AGNUS_NTSC
, "Normal/Fat NTSC Agnus 8361/8370");
920 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL
, "Fat Hires PAL Agnus 8372");
921 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC
, "Fat Hires NTSC Agnus 8372");
922 AMIGAHW_ANNOUNCE(ALICE_PAL
, "PAL Alice 8374");
923 AMIGAHW_ANNOUNCE(ALICE_NTSC
, "NTSC Alice 8374");
924 AMIGAHW_ANNOUNCE(MAGIC_REKICK
, "Magic Hard Rekick");
925 AMIGAHW_ANNOUNCE(PCMCIA
, "PCMCIA Slot");
926 if (AMIGAHW_PRESENT(ZORRO
))
927 len
+= sprintf(buffer
+len
, "\tZorro II%s AutoConfig: %d Expansion "
929 AMIGAHW_PRESENT(ZORRO3
) ? "I" : "",
930 zorro_num_autocon
, zorro_num_autocon
== 1 ? "" : "s");
932 #undef AMIGAHW_ANNOUNCE
938 int get_hardware_list(char *buffer
)
940 extern int get_cpuinfo(char *buffer
);
947 mach_get_model(model
);
949 strcpy(model
, "Unknown PowerPC");
951 len
+= sprintf(buffer
+len
, "Model:\t\t%s\n", model
);
952 len
+= get_cpuinfo(buffer
+len
);
953 for (mem
= 0, i
= 0; i
< m68k_realnum_memory
; i
++)
954 mem
+= m68k_memory
[i
].size
;
955 len
+= sprintf(buffer
+len
, "System Memory:\t%ldK\n", mem
>>10);
957 if (mach_get_hardware_list
)
958 len
+= mach_get_hardware_list(buffer
+len
);