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>
20 #include <linux/tty.h>
21 #include <linux/console.h>
22 #include <linux/init.h>
23 #include <linux/zorro.h>
25 #include <asm/bootinfo.h>
26 #include <asm/setup.h>
27 #include <asm/system.h>
28 #include <asm/pgtable.h>
29 #include <asm/amigahw.h>
30 #include <asm/amigaints.h>
32 #include <asm/machdep.h>
35 unsigned long amiga_model
;
36 unsigned long amiga_eclock
;
37 unsigned long amiga_masterclock
;
38 unsigned long amiga_colorclock
;
39 unsigned long amiga_chipset
;
40 unsigned char amiga_vblank
;
41 unsigned char amiga_psfreq
;
42 struct amiga_hw_present amiga_hw_present
;
44 static const char *amiga_models
[] = {
45 "A500", "A500+", "A600", "A1000", "A1200", "A2000", "A2500", "A3000",
46 "A3000T", "A3000+", "A4000", "A4000T", "CDTV", "CD32", "Draco"
49 extern char m68k_debug_device
[];
51 static void amiga_sched_init(void (*handler
)(int, void *, struct pt_regs
*));
52 /* amiga specific keyboard functions */
53 extern int amiga_keyb_init(void);
54 extern int amiga_kbdrate (struct kbd_repeat
*);
55 /* amiga specific irq functions */
56 extern void amiga_init_IRQ (void);
57 extern void (*amiga_default_handler
[]) (int, void *, struct pt_regs
*);
58 extern int amiga_request_irq (unsigned int irq
,
59 void (*handler
)(int, void *, struct pt_regs
*),
60 unsigned long flags
, const char *devname
,
62 extern void amiga_free_irq (unsigned int irq
, void *dev_id
);
63 extern void amiga_enable_irq (unsigned int);
64 extern void amiga_disable_irq (unsigned int);
65 static void amiga_get_model(char *model
);
66 static int amiga_get_hardware_list(char *buffer
);
67 extern int amiga_get_irq_list (char *);
68 /* amiga specific timer functions */
69 static unsigned long amiga_gettimeoffset (void);
70 static void a3000_gettod (int *, int *, int *, int *, int *, int *);
71 static void a2000_gettod (int *, int *, int *, int *, int *, int *);
72 static int amiga_hwclk (int, struct hwclk_time
*);
73 static int amiga_set_clock_mmss (unsigned long);
74 extern void amiga_mksound( unsigned int count
, unsigned int ticks
);
75 #ifdef CONFIG_AMIGA_FLOPPY
76 extern void amiga_floppy_setup(char *, int *);
78 static void amiga_reset (void);
79 static int amiga_wait_key (struct console
*co
);
80 extern void amiga_init_sound(void);
81 static void amiga_savekmsg_init(void);
82 static void amiga_mem_console_write(struct console
*co
, const char *b
,
84 void amiga_serial_console_write(struct console
*co
, const char *s
,
86 static void amiga_debug_init(void);
87 #ifdef CONFIG_HEARTBEAT
88 static void amiga_heartbeat(int on
);
91 static struct console amiga_console_driver
= {
96 amiga_wait_key
, /* wait_key */
105 #ifdef CONFIG_MAGIC_SYSRQ
106 static char amiga_sysrq_xlate
[128] =
107 "\0001234567890-=\\\000\000" /* 0x00 - 0x0f */
108 "qwertyuiop[]\000123" /* 0x10 - 0x1f */
109 "asdfghjkl;'\000\000456" /* 0x20 - 0x2f */
110 "\000zxcvbnm,./\000+789" /* 0x30 - 0x3f */
111 " \177\t\r\r\000\177\000\000\000-\000\000\000\000\000" /* 0x40 - 0x4f */
112 "\000\201\202\203\204\205\206\207\210\211()/*+\000" /* 0x50 - 0x5f */
113 "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" /* 0x60 - 0x6f */
114 "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"; /* 0x70 - 0x7f */
117 extern void (*kd_mksound
)(unsigned int, unsigned int);
121 * Motherboard Resources present in all Amiga models
124 static struct resource mb_resource
[] = {
125 { "CIA B", 0x00bfd000, 0x00bfdfff },
126 { "CIA A", 0x00bfe000, 0x00bfefff },
127 { "Custom I/O", 0x00dff000, 0x00dfffff },
128 { "Kickstart ROM", 0x00f80000, 0x00ffffff }
131 static struct resource rtc_resource
= {
132 NULL
, 0x00dc0000, 0x00dcffff
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
) {
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
:
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");
183 case BI_AMIGA_SERPER
:
184 /* serial port period: ignored here */
194 * Identify builtin hardware
197 static void __init
amiga_identify(void)
199 /* Fill in some default values, if necessary */
200 if (amiga_eclock
== 0)
201 amiga_eclock
= 709379;
203 memset(&amiga_hw_present
, 0, sizeof(amiga_hw_present
));
205 printk("Amiga hardware found: ");
206 if (amiga_model
>= AMI_500
&& amiga_model
<= AMI_DRACO
)
207 printk("[%s] ", amiga_models
[amiga_model
-AMI_500
]);
209 switch(amiga_model
) {
215 AMIGAHW_SET(A1200_IDE
);
222 AMIGAHW_SET(A2000_CLK
); /* Is this correct for all models? */
227 AMIGAHW_SET(AMBER_FF
);
228 AMIGAHW_SET(MAGIC_REKICK
);
231 AMIGAHW_SET(A3000_SCSI
);
232 AMIGAHW_SET(A3000_CLK
);
237 AMIGAHW_SET(A4000_SCSI
);
240 AMIGAHW_SET(A4000_IDE
);
241 AMIGAHW_SET(A3000_CLK
);
248 AMIGAHW_SET(A2000_CLK
); /* Is this correct? */
252 AMIGAHW_SET(AMI_VIDEO
);
253 AMIGAHW_SET(AMI_BLITTER
);
254 AMIGAHW_SET(AMI_AUDIO
);
255 AMIGAHW_SET(AMI_FLOPPY
);
256 AMIGAHW_SET(AMI_KEYBOARD
);
257 AMIGAHW_SET(AMI_MOUSE
);
258 AMIGAHW_SET(AMI_SERIAL
);
259 AMIGAHW_SET(AMI_PARALLEL
);
260 AMIGAHW_SET(CHIP_RAM
);
263 switch(amiga_chipset
) {
267 switch (custom
.deniseid
& 0xf) {
269 AMIGAHW_SET(DENISE_HR
);
280 switch ((custom
.vposr
>>8) & 0x7f) {
282 AMIGAHW_SET(AGNUS_PAL
);
285 AMIGAHW_SET(AGNUS_NTSC
);
289 AMIGAHW_SET(AGNUS_HR_PAL
);
293 AMIGAHW_SET(AGNUS_HR_NTSC
);
297 AMIGAHW_SET(ALICE_PAL
);
301 AMIGAHW_SET(ALICE_NTSC
);
308 panic("No support for Draco yet");
311 panic("Unknown Amiga Model");
314 #define AMIGAHW_ANNOUNCE(name, str) \
315 if (AMIGAHW_PRESENT(name)) \
318 AMIGAHW_ANNOUNCE(AMI_VIDEO
, "VIDEO ");
319 AMIGAHW_ANNOUNCE(AMI_BLITTER
, "BLITTER ");
320 AMIGAHW_ANNOUNCE(AMBER_FF
, "AMBER_FF ");
321 AMIGAHW_ANNOUNCE(AMI_AUDIO
, "AUDIO ");
322 AMIGAHW_ANNOUNCE(AMI_FLOPPY
, "FLOPPY ");
323 AMIGAHW_ANNOUNCE(A3000_SCSI
, "A3000_SCSI ");
324 AMIGAHW_ANNOUNCE(A4000_SCSI
, "A4000_SCSI ");
325 AMIGAHW_ANNOUNCE(A1200_IDE
, "A1200_IDE ");
326 AMIGAHW_ANNOUNCE(A4000_IDE
, "A4000_IDE ");
327 AMIGAHW_ANNOUNCE(CD_ROM
, "CD_ROM ");
328 AMIGAHW_ANNOUNCE(AMI_KEYBOARD
, "KEYBOARD ");
329 AMIGAHW_ANNOUNCE(AMI_MOUSE
, "MOUSE ");
330 AMIGAHW_ANNOUNCE(AMI_SERIAL
, "SERIAL ");
331 AMIGAHW_ANNOUNCE(AMI_PARALLEL
, "PARALLEL ");
332 AMIGAHW_ANNOUNCE(A2000_CLK
, "A2000_CLK ");
333 AMIGAHW_ANNOUNCE(A3000_CLK
, "A3000_CLK ");
334 AMIGAHW_ANNOUNCE(CHIP_RAM
, "CHIP_RAM ");
335 AMIGAHW_ANNOUNCE(PAULA
, "PAULA ");
336 AMIGAHW_ANNOUNCE(DENISE
, "DENISE ");
337 AMIGAHW_ANNOUNCE(DENISE_HR
, "DENISE_HR ");
338 AMIGAHW_ANNOUNCE(LISA
, "LISA ");
339 AMIGAHW_ANNOUNCE(AGNUS_PAL
, "AGNUS_PAL ");
340 AMIGAHW_ANNOUNCE(AGNUS_NTSC
, "AGNUS_NTSC ");
341 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL
, "AGNUS_HR_PAL ");
342 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC
, "AGNUS_HR_NTSC ");
343 AMIGAHW_ANNOUNCE(ALICE_PAL
, "ALICE_PAL ");
344 AMIGAHW_ANNOUNCE(ALICE_NTSC
, "ALICE_NTSC ");
345 AMIGAHW_ANNOUNCE(MAGIC_REKICK
, "MAGIC_REKICK ");
346 AMIGAHW_ANNOUNCE(PCMCIA
, "PCMCIA ");
347 if (AMIGAHW_PRESENT(ZORRO
))
348 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3
) ? "3" : "");
351 #undef AMIGAHW_ANNOUNCE
355 * Setup the Amiga configuration info
358 void __init
config_amiga(void)
365 /* Yuk, we don't have PCI memory */
366 iomem_resource
.name
= "Memory";
367 for (i
= 0; i
< sizeof(mb_resource
)/sizeof(mb_resource
[0]); i
++)
368 request_resource(&iomem_resource
, &mb_resource
[i
]);
370 mach_sched_init
= amiga_sched_init
;
371 mach_keyb_init
= amiga_keyb_init
;
372 mach_kbdrate
= amiga_kbdrate
;
373 mach_init_IRQ
= amiga_init_IRQ
;
374 mach_default_handler
= &amiga_default_handler
;
375 mach_request_irq
= amiga_request_irq
;
376 mach_free_irq
= amiga_free_irq
;
377 enable_irq
= amiga_enable_irq
;
378 disable_irq
= amiga_disable_irq
;
379 mach_get_model
= amiga_get_model
;
380 mach_get_hardware_list
= amiga_get_hardware_list
;
381 mach_get_irq_list
= amiga_get_irq_list
;
382 mach_gettimeoffset
= amiga_gettimeoffset
;
383 if (AMIGAHW_PRESENT(A3000_CLK
)){
384 mach_gettod
= a3000_gettod
;
385 rtc_resource
.name
= "A3000 RTC";
386 request_resource(&iomem_resource
, &rtc_resource
);
388 else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */
389 mach_gettod
= a2000_gettod
;
390 rtc_resource
.name
= "A2000 RTC";
391 request_resource(&iomem_resource
, &rtc_resource
);
394 mach_max_dma_address
= 0xffffffff; /*
395 * default MAX_DMA=0xffffffff
396 * on all machines. If we don't
397 * do so, the SCSI code will not
398 * be able to allocate any mem
399 * for transfers, unless we are
400 * dealing with a Z2 mem only
404 mach_hwclk
= amiga_hwclk
;
405 mach_set_clock_mmss
= amiga_set_clock_mmss
;
406 #ifdef CONFIG_AMIGA_FLOPPY
407 mach_floppy_setup
= amiga_floppy_setup
;
409 mach_reset
= amiga_reset
;
410 conswitchp
= &dummy_con
;
411 kd_mksound
= amiga_mksound
;
412 #ifdef CONFIG_MAGIC_SYSRQ
413 mach_sysrq_key
= 0x5f; /* HELP */
414 mach_sysrq_shift_state
= 0x03; /* SHIFT+ALTGR */
415 mach_sysrq_shift_mask
= 0xff; /* all modifiers except CapsLock */
416 mach_sysrq_xlate
= amiga_sysrq_xlate
;
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 custom
.dmacon
= DMAF_ALL
;
428 /* ensure that the DMA master bit is set */
429 custom
.dmacon
= DMAF_SETCLR
| DMAF_MASTER
;
431 /* don't use Z2 RAM as system memory on Z3 capable machines */
432 if (AMIGAHW_PRESENT(ZORRO3
)) {
434 u32 disabled_z2mem
= 0;
435 for (i
= 0; i
< m68k_num_memory
; i
++)
436 if (m68k_memory
[i
].addr
< 16*1024*1024) {
438 /* don't cut off the branch we're sitting on */
439 printk("Warning: kernel runs in Zorro II memory\n");
442 disabled_z2mem
+= m68k_memory
[i
].size
;
444 for (j
= i
; j
< m68k_num_memory
; j
++)
445 m68k_memory
[j
] = m68k_memory
[j
+1];
449 printk("%dK of Zorro II memory will not be used as system memory\n",
453 /* initialize chipram allocator */
456 /* debugging using chipram */
457 if (!strcmp( m68k_debug_device
, "mem" )){
458 if (!AMIGAHW_PRESENT(CHIP_RAM
))
459 printk("Warning: no chipram present for debugging\n");
461 amiga_savekmsg_init();
462 amiga_console_driver
.write
= amiga_mem_console_write
;
463 register_console(&amiga_console_driver
);
467 /* our beloved beeper */
468 if (AMIGAHW_PRESENT(AMI_AUDIO
))
472 * if it is an A3000, set the magic bit that forces
475 if (AMIGAHW_PRESENT(MAGIC_REKICK
))
476 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
479 static unsigned short jiffy_ticks
;
481 static void __init
amiga_sched_init(void (*timer_routine
)(int, void *,
484 jiffy_ticks
= (amiga_eclock
+HZ
/2)/HZ
;
486 ciab
.cra
&= 0xC0; /* turn off timer A, continuous mode, from Eclk */
487 ciab
.talo
= jiffy_ticks
% 256;
488 ciab
.tahi
= jiffy_ticks
/ 256;
490 /* install interrupt service routine for CIAB Timer A
492 * Please don't change this to use ciaa, as it interferes with the
493 * SCSI code. We'll have to take a look at this later
495 request_irq(IRQ_AMIGA_CIAB_TA
, timer_routine
, 0, "timer", NULL
);
500 #define TICK_SIZE 10000
502 /* This is always executed with interrupts disabled. */
503 static unsigned long amiga_gettimeoffset (void)
505 unsigned short hi
, lo
, hi2
;
506 unsigned long ticks
, offset
= 0;
508 /* read CIA B timer A current value */
518 ticks
= hi
<< 8 | lo
;
520 if (ticks
> jiffy_ticks
/ 2)
521 /* check for pending interrupt */
522 if (cia_set_irq(&ciab_base
, 0) & CIA_ICR_TA
)
525 ticks
= jiffy_ticks
- ticks
;
526 ticks
= (10000 * ticks
) / jiffy_ticks
;
528 return ticks
+ offset
;
531 static void a3000_gettod (int *yearp
, int *monp
, int *dayp
,
532 int *hourp
, int *minp
, int *secp
)
534 volatile struct tod3000
*tod
= TOD_3000
;
536 tod
->cntrl1
= TOD3000_CNTRL1_HOLD
;
538 *secp
= tod
->second1
* 10 + tod
->second2
;
539 *minp
= tod
->minute1
* 10 + tod
->minute2
;
540 *hourp
= tod
->hour1
* 10 + tod
->hour2
;
541 *dayp
= tod
->day1
* 10 + tod
->day2
;
542 *monp
= tod
->month1
* 10 + tod
->month2
;
543 *yearp
= tod
->year1
* 10 + tod
->year2
;
545 tod
->cntrl1
= TOD3000_CNTRL1_FREE
;
548 static void a2000_gettod (int *yearp
, int *monp
, int *dayp
,
549 int *hourp
, int *minp
, int *secp
)
551 volatile struct tod2000
*tod
= TOD_2000
;
553 tod
->cntrl1
= TOD2000_CNTRL1_HOLD
;
555 while (tod
->cntrl1
& TOD2000_CNTRL1_BUSY
)
558 *secp
= tod
->second1
* 10 + tod
->second2
;
559 *minp
= tod
->minute1
* 10 + tod
->minute2
;
560 *hourp
= (tod
->hour1
& 3) * 10 + tod
->hour2
;
561 *dayp
= tod
->day1
* 10 + tod
->day2
;
562 *monp
= tod
->month1
* 10 + tod
->month2
;
563 *yearp
= tod
->year1
* 10 + tod
->year2
;
565 if (!(tod
->cntrl3
& TOD2000_CNTRL3_24HMODE
)){
566 if (!(tod
->hour1
& TOD2000_HOUR1_PM
) && *hourp
== 12)
568 else if ((tod
->hour1
& TOD2000_HOUR1_PM
) && *hourp
!= 12)
572 tod
->cntrl1
&= ~TOD2000_CNTRL1_HOLD
;
575 static int amiga_hwclk(int op
, struct hwclk_time
*t
)
577 if (AMIGAHW_PRESENT(A3000_CLK
)) {
578 volatile struct tod3000
*tod
= TOD_3000
;
580 tod
->cntrl1
= TOD3000_CNTRL1_HOLD
;
582 if (!op
) { /* read */
583 t
->sec
= tod
->second1
* 10 + tod
->second2
;
584 t
->min
= tod
->minute1
* 10 + tod
->minute2
;
585 t
->hour
= tod
->hour1
* 10 + tod
->hour2
;
586 t
->day
= tod
->day1
* 10 + tod
->day2
;
587 t
->wday
= tod
->weekday
;
588 t
->mon
= tod
->month1
* 10 + tod
->month2
- 1;
589 t
->year
= tod
->year1
* 10 + tod
->year2
;
591 tod
->second1
= t
->sec
/ 10;
592 tod
->second2
= t
->sec
% 10;
593 tod
->minute1
= t
->min
/ 10;
594 tod
->minute2
= t
->min
% 10;
595 tod
->hour1
= t
->hour
/ 10;
596 tod
->hour2
= t
->hour
% 10;
597 tod
->day1
= t
->day
/ 10;
598 tod
->day2
= t
->day
% 10;
600 tod
->weekday
= t
->wday
;
601 tod
->month1
= (t
->mon
+ 1) / 10;
602 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
;
625 if (!(tod
->cntrl3
& TOD2000_CNTRL3_24HMODE
)){
626 if (!(tod
->hour1
& TOD2000_HOUR1_PM
) && t
->hour
== 12)
628 else if ((tod
->hour1
& TOD2000_HOUR1_PM
) && t
->hour
!= 12)
632 tod
->second1
= t
->sec
/ 10;
633 tod
->second2
= t
->sec
% 10;
634 tod
->minute1
= t
->min
/ 10;
635 tod
->minute2
= t
->min
% 10;
636 if (tod
->cntrl3
& TOD2000_CNTRL3_24HMODE
)
637 tod
->hour1
= t
->hour
/ 10;
638 else if (t
->hour
>= 12)
639 tod
->hour1
= TOD2000_HOUR1_PM
+
642 tod
->hour1
= t
->hour
/ 10;
643 tod
->hour2
= t
->hour
% 10;
644 tod
->day1
= t
->day
/ 10;
645 tod
->day2
= t
->day
% 10;
647 tod
->weekday
= t
->wday
;
648 tod
->month1
= (t
->mon
+ 1) / 10;
649 tod
->month2
= (t
->mon
+ 1) % 10;
650 tod
->year1
= t
->year
/ 10;
651 tod
->year2
= t
->year
% 10;
654 tod
->cntrl1
&= ~TOD2000_CNTRL1_HOLD
;
660 static int amiga_set_clock_mmss (unsigned long nowtime
)
662 short real_seconds
= nowtime
% 60, real_minutes
= (nowtime
/ 60) % 60;
664 if (AMIGAHW_PRESENT(A3000_CLK
)) {
665 volatile struct tod3000
*tod
= TOD_3000
;
667 tod
->cntrl1
= TOD3000_CNTRL1_HOLD
;
669 tod
->second1
= real_seconds
/ 10;
670 tod
->second2
= real_seconds
% 10;
671 tod
->minute1
= real_minutes
/ 10;
672 tod
->minute2
= real_minutes
% 10;
674 tod
->cntrl1
= TOD3000_CNTRL1_FREE
;
675 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
676 volatile struct tod2000
*tod
= TOD_2000
;
678 tod
->cntrl1
= TOD2000_CNTRL1_HOLD
;
680 while (tod
->cntrl1
& TOD2000_CNTRL1_BUSY
)
683 tod
->second1
= real_seconds
/ 10;
684 tod
->second2
= real_seconds
% 10;
685 tod
->minute1
= real_minutes
/ 10;
686 tod
->minute2
= real_minutes
% 10;
688 tod
->cntrl1
&= ~TOD2000_CNTRL1_HOLD
;
694 static int amiga_wait_key (struct console
*co
)
699 while (ciaa
.pra
& 0x40);
702 for (i
= 0; i
< 1000; i
++);
704 if (!(ciaa
.pra
& 0x40))
708 /* wait for button up */
710 while (!(ciaa
.pra
& 0x40));
713 for (i
= 0; i
< 1000; i
++);
721 void dbprintf(const char *fmt
, ...)
723 static char buf
[1024];
725 extern void console_print (const char *str
);
726 extern int vsprintf(char * buf
, const char * fmt
, va_list args
);
729 vsprintf(buf
, fmt
, args
);
735 static NORET_TYPE
void amiga_reset( void )
738 static void amiga_reset (void)
740 unsigned long jmp_addr040
= virt_to_phys(&&jmp_addr_label040
);
741 unsigned long jmp_addr
= virt_to_phys(&&jmp_addr_label
);
744 if (CPU_IS_040_OR_060
)
745 /* Setup transparent translation registers for mapping
746 * of 16 MB kernel segment before disabling translation
750 "andl #0xff000000,%/d0\n\t"
751 "orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */
753 "movec %%d0,%%itt0\n\t"
754 "movec %%d0,%%dtt0\n\t"
758 : "a" (jmp_addr040
));
760 /* for 680[23]0, just disable translation and jump to the physical
761 * address of the label
771 /* disable translation on '040 now */
775 "movec %%d0,%%tc\n\t" /* disable MMU */
782 /* pickup reset address from AmigaOS ROM, reset devices and jump
786 ("movew #0x2700,%/sr\n\t"
787 "leal 0x01000000,%/a0\n\t"
788 "subl %/a0@(-0x14),%/a0\n\t"
789 "movel %/a0@(4),%/a0\n\t"
792 /* align on a longword boundary */
796 "jmp %/a0@" : /* Just that gcc scans it for % escapes */ );
807 #define SAVEKMSG_MAXMEM 128*1024
809 #define SAVEKMSG_MAGIC1 0x53415645 /* 'SAVE' */
810 #define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
813 unsigned long magic1
; /* SAVEKMSG_MAGIC1 */
814 unsigned long magic2
; /* SAVEKMSG_MAGIC2 */
815 unsigned long magicptr
; /* address of magic1 */
820 static struct savekmsg
*savekmsg
= NULL
;
822 static void amiga_mem_console_write(struct console
*co
, const char *s
,
825 if (savekmsg
->size
+count
<= SAVEKMSG_MAXMEM
-sizeof(struct savekmsg
)) {
826 memcpy(savekmsg
->data
+savekmsg
->size
, s
, count
);
827 savekmsg
->size
+= count
;
831 static void amiga_savekmsg_init(void)
833 savekmsg
= (struct savekmsg
*)amiga_chip_alloc(SAVEKMSG_MAXMEM
, "Debug");
834 savekmsg
->magic1
= SAVEKMSG_MAGIC1
;
835 savekmsg
->magic2
= SAVEKMSG_MAGIC2
;
836 savekmsg
->magicptr
= virt_to_phys(savekmsg
);
840 static void amiga_serial_putc(char c
)
842 custom
.serdat
= (unsigned char)c
| 0x100;
843 while (!(custom
.serdatr
& 0x2000))
847 void amiga_serial_console_write(struct console
*co
, const char *s
,
852 amiga_serial_putc('\r');
853 amiga_serial_putc(*s
++);
857 #ifdef CONFIG_SERIAL_CONSOLE
858 void amiga_serial_puts(const char *s
)
860 amiga_serial_console_write(NULL
, s
, strlen(s
));
863 int amiga_serial_console_wait_key(struct console
*co
)
867 while (!(custom
.intreqr
& IF_RBF
))
869 ch
= custom
.serdatr
& 0xff;
870 /* clear the interrupt, so that another character can be read */
871 custom
.intreq
= IF_RBF
;
875 void amiga_serial_gets(struct console
*co
, char *s
, int len
)
880 ch
= amiga_serial_console_wait_key(co
);
882 /* Check for backspace. */
883 if (ch
== 8 || ch
== 127) {
885 amiga_serial_putc('\007');
889 amiga_serial_puts("\010 \010");
893 /* Check for enter. */
894 if (ch
== 10 || ch
== 13)
897 /* See if line is too long. */
898 if (cnt
>= len
+ 1) {
899 amiga_serial_putc(7);
904 /* Store and echo character. */
906 amiga_serial_putc(ch
);
909 amiga_serial_puts("\r\n");
914 static void __init
amiga_debug_init(void)
916 if (!strcmp( m68k_debug_device
, "ser" )) {
917 /* no initialization required (?) */
918 amiga_console_driver
.write
= amiga_serial_console_write
;
919 register_console(&amiga_console_driver
);
923 #ifdef CONFIG_HEARTBEAT
924 static void amiga_heartbeat(int on
)
934 * Amiga specific parts of /proc
937 static void amiga_get_model(char *model
)
939 strcpy(model
, "Amiga ");
940 if (amiga_model
>= AMI_500
&& amiga_model
<= AMI_DRACO
)
941 strcat(model
, amiga_models
[amiga_model
-AMI_500
]);
945 static int amiga_get_hardware_list(char *buffer
)
949 if (AMIGAHW_PRESENT(CHIP_RAM
))
950 len
+= sprintf(buffer
+len
, "Chip RAM:\t%ldK\n", amiga_chip_size
>>10);
951 len
+= sprintf(buffer
+len
, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
952 amiga_psfreq
, amiga_eclock
);
953 if (AMIGAHW_PRESENT(AMI_VIDEO
)) {
955 switch(amiga_chipset
) {
966 type
= "Old or Unknown";
969 len
+= sprintf(buffer
+len
, "Graphics:\t%s\n", type
);
972 #define AMIGAHW_ANNOUNCE(name, str) \
973 if (AMIGAHW_PRESENT(name)) \
974 len += sprintf (buffer+len, "\t%s\n", str)
976 len
+= sprintf (buffer
+ len
, "Detected hardware:\n");
978 AMIGAHW_ANNOUNCE(AMI_VIDEO
, "Amiga Video");
979 AMIGAHW_ANNOUNCE(AMI_BLITTER
, "Blitter");
980 AMIGAHW_ANNOUNCE(AMBER_FF
, "Amber Flicker Fixer");
981 AMIGAHW_ANNOUNCE(AMI_AUDIO
, "Amiga Audio");
982 AMIGAHW_ANNOUNCE(AMI_FLOPPY
, "Floppy Controller");
983 AMIGAHW_ANNOUNCE(A3000_SCSI
, "SCSI Controller WD33C93 (A3000 style)");
984 AMIGAHW_ANNOUNCE(A4000_SCSI
, "SCSI Controller NCR53C710 (A4000T style)");
985 AMIGAHW_ANNOUNCE(A1200_IDE
, "IDE Interface (A1200 style)");
986 AMIGAHW_ANNOUNCE(A4000_IDE
, "IDE Interface (A4000 style)");
987 AMIGAHW_ANNOUNCE(CD_ROM
, "Internal CD ROM drive");
988 AMIGAHW_ANNOUNCE(AMI_KEYBOARD
, "Keyboard");
989 AMIGAHW_ANNOUNCE(AMI_MOUSE
, "Mouse Port");
990 AMIGAHW_ANNOUNCE(AMI_SERIAL
, "Serial Port");
991 AMIGAHW_ANNOUNCE(AMI_PARALLEL
, "Parallel Port");
992 AMIGAHW_ANNOUNCE(A2000_CLK
, "Hardware Clock (A2000 style)");
993 AMIGAHW_ANNOUNCE(A3000_CLK
, "Hardware Clock (A3000 style)");
994 AMIGAHW_ANNOUNCE(CHIP_RAM
, "Chip RAM");
995 AMIGAHW_ANNOUNCE(PAULA
, "Paula 8364");
996 AMIGAHW_ANNOUNCE(DENISE
, "Denise 8362");
997 AMIGAHW_ANNOUNCE(DENISE_HR
, "Denise 8373");
998 AMIGAHW_ANNOUNCE(LISA
, "Lisa 8375");
999 AMIGAHW_ANNOUNCE(AGNUS_PAL
, "Normal/Fat PAL Agnus 8367/8371");
1000 AMIGAHW_ANNOUNCE(AGNUS_NTSC
, "Normal/Fat NTSC Agnus 8361/8370");
1001 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL
, "Fat Hires PAL Agnus 8372");
1002 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC
, "Fat Hires NTSC Agnus 8372");
1003 AMIGAHW_ANNOUNCE(ALICE_PAL
, "PAL Alice 8374");
1004 AMIGAHW_ANNOUNCE(ALICE_NTSC
, "NTSC Alice 8374");
1005 AMIGAHW_ANNOUNCE(MAGIC_REKICK
, "Magic Hard Rekick");
1006 AMIGAHW_ANNOUNCE(PCMCIA
, "PCMCIA Slot");
1007 if (AMIGAHW_PRESENT(ZORRO
))
1008 len
+= sprintf(buffer
+len
, "\tZorro II%s AutoConfig: %d Expansion "
1010 AMIGAHW_PRESENT(ZORRO3
) ? "I" : "",
1011 zorro_num_autocon
, zorro_num_autocon
== 1 ? "" : "s");
1013 #undef AMIGAHW_ANNOUNCE