patch-2.1.17 linux/arch/m68k/amiga/config.c
Next file: linux/arch/m68k/amiga/cyberfb.c
Previous file: linux/arch/m68k/amiga/chipram.c
Back to the patch index
Back to the overall index
- Lines: 585
- Date:
Fri Dec 20 11:19:57 1996
- Orig file:
v2.1.16/linux/arch/m68k/amiga/config.c
- Orig date:
Fri Nov 22 18:28:13 1996
diff -u --recursive --new-file v2.1.16/linux/arch/m68k/amiga/config.c linux/arch/m68k/amiga/config.c
@@ -21,6 +21,7 @@
#include <linux/tty.h>
#include <linux/console.h>
+#include <asm/bootinfo.h>
#include <asm/setup.h>
#include <asm/system.h>
#include <asm/pgtable.h>
@@ -28,13 +29,25 @@
#include <asm/amigaints.h>
#include <asm/irq.h>
#include <asm/machdep.h>
+#include <asm/zorro.h>
+u_long amiga_model;
+u_long amiga_eclock;
u_long amiga_masterclock;
u_long amiga_colorclock;
+u_long amiga_chipset;
+u_char amiga_vblank;
+u_char amiga_psfreq;
+struct amiga_hw_present amiga_hw_present;
+
+static const char *amiga_models[] = {
+ "A500", "A500+", "A600", "A1000", "A1200", "A2000", "A2500", "A3000",
+ "A3000T", "A3000+", "A4000", "A4000T", "CDTV", "CD32", "Draco"
+};
extern char m68k_debug_device[];
-extern void amiga_sched_init(void (*handler)(int, void *, struct pt_regs *));
+static void amiga_sched_init(void (*handler)(int, void *, struct pt_regs *));
/* amiga specific keyboard functions */
extern int amiga_keyb_init(void);
extern int amiga_kbdrate (struct kbd_repeat *);
@@ -46,140 +59,141 @@
extern int amiga_free_irq (unsigned int irq, void *dev_id);
extern void amiga_enable_irq (unsigned int);
extern void amiga_disable_irq (unsigned int);
+static void amiga_get_model(char *model);
+static int amiga_get_hardware_list(char *buffer);
extern int amiga_get_irq_list (char *);
/* amiga specific timer functions */
-extern unsigned long amiga_gettimeoffset (void);
-extern void a3000_gettod (int *, int *, int *, int *, int *, int *);
-extern void a2000_gettod (int *, int *, int *, int *, int *, int *);
-extern int amiga_hwclk (int, struct hwclk_time *);
-extern int amiga_set_clock_mmss (unsigned long);
+static unsigned long amiga_gettimeoffset (void);
+static void a3000_gettod (int *, int *, int *, int *, int *, int *);
+static void a2000_gettod (int *, int *, int *, int *, int *, int *);
+static int amiga_hwclk (int, struct hwclk_time *);
+static int amiga_set_clock_mmss (unsigned long);
extern void amiga_mksound( unsigned int count, unsigned int ticks );
#ifdef CONFIG_BLK_DEV_FD
extern int amiga_floppy_init (void);
extern void amiga_floppy_setup(char *, int *);
#endif
-extern void amiga_reset (void);
-extern void amiga_waitbut(void);
+static void amiga_reset (void);
+static void amiga_waitbut(void);
extern struct consw fb_con;
extern struct fb_info *amiga_fb_init(long *);
extern void zorro_init(void);
static void ami_savekmsg_init(void);
static void ami_mem_print(const char *b);
-extern void amiga_debug_init(void);
+static void amiga_debug_init(void);
extern void amiga_video_setup(char *, int *);
+extern void amiga_syms_export(void);
extern void (*kd_mksound)(unsigned int, unsigned int);
+ /*
+ * Parse an Amiga-specific record in the bootinfo
+ */
+
+int amiga_parse_bootinfo(const struct bi_record *record)
+{
+ int unknown = 0;
+ const u_long *data = record->data;
+
+ switch (record->tag) {
+ case BI_AMIGA_MODEL:
+ amiga_model = *data;
+ break;
+
+ case BI_AMIGA_ECLOCK:
+ amiga_eclock = *data;
+ break;
+
+ case BI_AMIGA_CHIPSET:
+ amiga_chipset = *data;
+ break;
+
+ case BI_AMIGA_CHIP_SIZE:
+ amiga_chip_size = *(const int *)data;
+ break;
+
+ case BI_AMIGA_VBLANK:
+ amiga_vblank = *(const u_char *)data;
+ break;
+
+ case BI_AMIGA_PSFREQ:
+ amiga_psfreq = *(const u_char *)data;
+ break;
+
+ case BI_AMIGA_AUTOCON:
+ if (zorro_num_autocon < ZORRO_NUM_AUTO)
+ memcpy(&zorro_autocon[zorro_num_autocon++],
+ (const struct ConfigDev *)data,
+ sizeof(struct ConfigDev));
+ else
+ printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
+ break;
+
+ case BI_AMIGA_SERPER:
+ /* serial port period: ignored here */
+ break;
+
+ default:
+ unknown = 1;
+ }
+ return(unknown);
+}
+
+ /*
+ * Setup the Amiga configuration info
+ */
+
void config_amiga(void)
{
- char *type = NULL;
+ /* Fill in some default values, if necessary */
+ if (amiga_eclock == 0)
+ amiga_eclock = 709379;
+
+ memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
- switch(boot_info.bi_amiga.model) {
- case AMI_500:
- type = "A500";
- break;
- case AMI_500PLUS:
- type = "A500+";
- break;
- case AMI_600:
- type = "A600";
- break;
- case AMI_1000:
- type = "A1000";
- break;
- case AMI_1200:
- type = "A1200";
- break;
- case AMI_2000:
- type = "A2000";
- break;
- case AMI_2500:
- type = "A2500";
- break;
- case AMI_3000:
- type = "A3000";
- break;
- case AMI_3000T:
- type = "A3000T";
- break;
- case AMI_3000PLUS:
- type = "A3000+";
- break;
- case AMI_4000:
- type = "A4000";
- break;
- case AMI_4000T:
- type = "A4000T";
- break;
- case AMI_CDTV:
- type = "CDTV";
- break;
- case AMI_CD32:
- type = "CD32";
- break;
- case AMI_DRACO:
- type = "Draco";
- break;
- }
printk("Amiga hardware found: ");
- if (type)
- printk("[%s] ", type);
- switch(boot_info.bi_amiga.model) {
- case AMI_UNKNOWN:
- goto Generic;
+ if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO)
+ printk("[%s] ", amiga_models[amiga_model-AMI_500]);
- case AMI_500:
- case AMI_500PLUS:
- case AMI_1000:
- AMIGAHW_SET(A2000_CLK); /* Is this correct? */
- printk("A2000_CLK ");
+ switch(amiga_model) {
+ case AMI_UNKNOWN:
goto Generic;
case AMI_600:
case AMI_1200:
AMIGAHW_SET(A1200_IDE);
- printk("A1200_IDE ");
- AMIGAHW_SET(A2000_CLK); /* Is this correct? */
- printk("A2000_CLK ");
- goto Generic;
-
+ case AMI_500:
+ case AMI_500PLUS:
+ case AMI_1000:
case AMI_2000:
case AMI_2500:
- AMIGAHW_SET(A2000_CLK);
- printk("A2000_CLK ");
+ AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
goto Generic;
case AMI_3000:
case AMI_3000T:
AMIGAHW_SET(AMBER_FF);
- printk("AMBER_FF ");
AMIGAHW_SET(MAGIC_REKICK);
- printk("MAGIC_REKICK ");
/* fall through */
case AMI_3000PLUS:
AMIGAHW_SET(A3000_SCSI);
- printk("A3000_SCSI ");
AMIGAHW_SET(A3000_CLK);
- printk("A3000_CLK ");
+ AMIGAHW_SET(ZORRO3);
goto Generic;
case AMI_4000T:
AMIGAHW_SET(A4000_SCSI);
- printk("A4000_SCSI ");
/* fall through */
case AMI_4000:
AMIGAHW_SET(A4000_IDE);
- printk("A4000_IDE ");
AMIGAHW_SET(A3000_CLK);
- printk("A3000_CLK ");
+ AMIGAHW_SET(ZORRO3);
goto Generic;
case AMI_CDTV:
case AMI_CD32:
AMIGAHW_SET(CD_ROM);
- printk("CD_ROM ");
AMIGAHW_SET(A2000_CLK); /* Is this correct? */
- printk("A2000_CLK ");
goto Generic;
Generic:
@@ -193,61 +207,49 @@
AMIGAHW_SET(AMI_PARALLEL);
AMIGAHW_SET(CHIP_RAM);
AMIGAHW_SET(PAULA);
- printk("VIDEO BLITTER AUDIO FLOPPY KEYBOARD MOUSE SERIAL PARALLEL "
- "CHIP_RAM PAULA ");
- switch(boot_info.bi_amiga.chipset) {
+ switch(amiga_chipset) {
case CS_OCS:
case CS_ECS:
case CS_AGA:
switch (custom.deniseid & 0xf) {
case 0x0c:
AMIGAHW_SET(DENISE_HR);
- printk("DENISE_HR ");
break;
case 0x08:
AMIGAHW_SET(LISA);
- printk("LISA ");
break;
}
break;
default:
AMIGAHW_SET(DENISE);
- printk("DENISE ");
break;
}
switch ((custom.vposr>>8) & 0x7f) {
case 0x00:
AMIGAHW_SET(AGNUS_PAL);
- printk("AGNUS_PAL ");
break;
case 0x10:
AMIGAHW_SET(AGNUS_NTSC);
- printk("AGNUS_NTSC ");
break;
case 0x20:
case 0x21:
AMIGAHW_SET(AGNUS_HR_PAL);
- printk("AGNUS_HR_PAL ");
break;
case 0x30:
case 0x31:
AMIGAHW_SET(AGNUS_HR_NTSC);
- printk("AGNUS_HR_NTSC ");
break;
case 0x22:
case 0x23:
AMIGAHW_SET(ALICE_PAL);
- printk("ALICE_PAL ");
break;
case 0x32:
case 0x33:
AMIGAHW_SET(ALICE_NTSC);
- printk("ALICE_NTSC ");
break;
}
AMIGAHW_SET(ZORRO);
- printk("ZORRO ");
break;
case AMI_DRACO:
@@ -256,8 +258,45 @@
default:
panic("Unknown Amiga Model");
}
+
+#define AMIGAHW_ANNOUNCE(name, str) \
+ if (AMIGAHW_PRESENT(name)) \
+ printk(str)
+
+ AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO ");
+ AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER ");
+ AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF ");
+ AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO ");
+ AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY ");
+ AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI ");
+ AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI ");
+ AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE ");
+ AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE ");
+ AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM ");
+ AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD ");
+ AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE ");
+ AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL ");
+ AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL ");
+ AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK ");
+ AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK ");
+ AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM ");
+ AMIGAHW_ANNOUNCE(PAULA, "PAULA ");
+ AMIGAHW_ANNOUNCE(DENISE, "DENISE ");
+ AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR ");
+ AMIGAHW_ANNOUNCE(LISA, "LISA ");
+ AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL ");
+ AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC ");
+ AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL ");
+ AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC ");
+ AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL ");
+ AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC ");
+ AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK ");
+ if (AMIGAHW_SET(ZORRO))
+ printk("ZORRO%s ", AMIGAHW_SET(ZORRO3) ? "3" : "");
printk("\n");
-
+
+#undef AMIGAHW_ANNOUNCE
+
mach_sched_init = amiga_sched_init;
mach_keyb_init = amiga_keyb_init;
mach_kbdrate = amiga_kbdrate;
@@ -267,6 +306,8 @@
mach_free_irq = amiga_free_irq;
mach_enable_irq = amiga_enable_irq;
mach_disable_irq = amiga_disable_irq;
+ mach_get_model = amiga_get_model;
+ mach_get_hardware_list = amiga_get_hardware_list;
mach_get_irq_list = amiga_get_irq_list;
mach_gettimeoffset = amiga_gettimeoffset;
if (AMIGAHW_PRESENT(A3000_CLK)){
@@ -299,11 +340,12 @@
mach_fb_init = amiga_fb_init;
mach_debug_init = amiga_debug_init;
mach_video_setup = amiga_video_setup;
+ mach_syms_export = amiga_syms_export;
kd_mksound = amiga_mksound;
/* Fill in the clock values (based on the 700 kHz E-Clock) */
amiga_masterclock = 40*amiga_eclock; /* 28 MHz */
- amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
+ amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
/* clear all DMA bits */
custom.dmacon = DMAF_ALL;
@@ -335,7 +377,8 @@
static unsigned short jiffy_ticks;
-void amiga_sched_init(void (*timer_routine)(int, void *, struct pt_regs *))
+static void amiga_sched_init(void (*timer_routine)(int, void *,
+ struct pt_regs *))
{
jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
@@ -356,7 +399,7 @@
#define TICK_SIZE 10000
/* This is always executed with interrupts disabled. */
-unsigned long amiga_gettimeoffset (void)
+static unsigned long amiga_gettimeoffset (void)
{
unsigned short hi, lo, hi2;
unsigned long ticks, offset = 0;
@@ -384,8 +427,8 @@
return ticks + offset;
}
-void a3000_gettod (int *yearp, int *monp, int *dayp,
- int *hourp, int *minp, int *secp)
+static void a3000_gettod (int *yearp, int *monp, int *dayp,
+ int *hourp, int *minp, int *secp)
{
volatile struct tod3000 *tod = TOD_3000;
@@ -401,8 +444,8 @@
tod->cntrl1 = TOD3000_CNTRL1_FREE;
}
-void a2000_gettod (int *yearp, int *monp, int *dayp,
- int *hourp, int *minp, int *secp)
+static void a2000_gettod (int *yearp, int *monp, int *dayp,
+ int *hourp, int *minp, int *secp)
{
volatile struct tod2000 *tod = TOD_2000;
@@ -427,7 +470,7 @@
tod->cntrl1 &= ~TOD2000_CNTRL1_HOLD;
}
-int amiga_hwclk(int op, struct hwclk_time *t)
+static int amiga_hwclk(int op, struct hwclk_time *t)
{
if (AMIGAHW_PRESENT(A3000_CLK)) {
volatile struct tod3000 *tod = TOD_3000;
@@ -511,7 +554,7 @@
return 0;
}
-int amiga_set_clock_mmss (unsigned long nowtime)
+static int amiga_set_clock_mmss (unsigned long nowtime)
{
short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
@@ -545,7 +588,7 @@
return 0;
}
-void amiga_waitbut (void)
+static void amiga_waitbut (void)
{
int i;
@@ -585,7 +628,7 @@
}
}
-void amiga_debug_init (void)
+static void amiga_debug_init (void)
{
extern void (*debug_print_proc)(const char *);
@@ -612,10 +655,10 @@
console_print (buf);
}
-NORET_TYPE void amiga_reset( void )
+static NORET_TYPE void amiga_reset( void )
ATTRIB_NORET;
-void amiga_reset (void)
+static void amiga_reset (void)
{
unsigned long jmp_addr040 = VTOP(&&jmp_addr_label040);
unsigned long jmp_addr = VTOP(&&jmp_addr_label);
@@ -717,71 +760,25 @@
}
-void amiga_get_model(char *model)
+static void amiga_get_model(char *model)
{
strcpy(model, "Amiga ");
- switch (boot_info.bi_amiga.model) {
- case AMI_500:
- strcat(model, "500");
- break;
- case AMI_500PLUS:
- strcat(model, "500+");
- break;
- case AMI_600:
- strcat(model, "600");
- break;
- case AMI_1000:
- strcat(model, "1000");
- break;
- case AMI_1200:
- strcat(model, "1200");
- break;
- case AMI_2000:
- strcat(model, "2000");
- break;
- case AMI_2500:
- strcat(model, "2500");
- break;
- case AMI_3000:
- strcat(model, "3000");
- break;
- case AMI_3000T:
- strcat(model, "3000T");
- break;
- case AMI_3000PLUS:
- strcat(model, "3000+");
- break;
- case AMI_4000:
- strcat(model, "4000");
- break;
- case AMI_4000T:
- strcat(model, "4000T");
- break;
- case AMI_CDTV:
- strcat(model, "CDTV");
- break;
- case AMI_CD32:
- strcat(model, "CD32");
- break;
- case AMI_DRACO:
- strcpy(model, "DRACO");
- break;
- }
+ if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO)
+ strcat(model, amiga_models[amiga_model-AMI_500]);
}
-int amiga_get_hardware_list(char *buffer)
+static int amiga_get_hardware_list(char *buffer)
{
int len = 0;
if (AMIGAHW_PRESENT(CHIP_RAM))
- len += sprintf(buffer+len, "Chip RAM:\t%ldK\n",
- boot_info.bi_amiga.chip_size>>10);
+ len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10);
len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
- boot_info.bi_amiga.psfreq, amiga_eclock);
+ amiga_psfreq, amiga_eclock);
if (AMIGAHW_PRESENT(AMI_VIDEO)) {
char *type;
- switch(boot_info.bi_amiga.chipset) {
+ switch(amiga_chipset) {
case CS_OCS:
type = "OCS";
break;
@@ -798,7 +795,7 @@
len += sprintf(buffer+len, "Graphics:\t%s\n", type);
}
-#define AMIGAHW_ANNOUNCE(name, str) \
+#define AMIGAHW_ANNOUNCE(name, str) \
if (AMIGAHW_PRESENT(name)) \
len += sprintf (buffer+len, "\t%s\n", str)
@@ -833,9 +830,11 @@
AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374");
AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick");
if (AMIGAHW_PRESENT(ZORRO))
- len += sprintf(buffer+len, "\tZorro AutoConfig: %d Expansion Device%s\n",
- boot_info.bi_amiga.num_autocon,
- boot_info.bi_amiga.num_autocon == 1 ? "" : "s");
+ len += sprintf(buffer+len, "\tZorro%s AutoConfig: %d Expansion Device%s\n",
+ AMIGAHW_PRESENT(ZORRO3) ? " III" : "",
+ zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
+
+#undef AMIGAHW_ANNOUNCE
return(len);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov