Commit 6ff5801a authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

m68k: reformat various m68k files

Reformat various m68k files, so they actually look like Linux sources.
Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b3e2fd9c
...@@ -22,9 +22,7 @@ ...@@ -22,9 +22,7 @@
#include <linux/vt_kern.h> #include <linux/vt_kern.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#ifdef CONFIG_ZORRO
#include <linux/zorro.h> #include <linux/zorro.h>
#endif
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/setup.h> #include <asm/setup.h>
...@@ -62,21 +60,21 @@ static char s_cdtv[] __initdata = "CDTV"; ...@@ -62,21 +60,21 @@ static char s_cdtv[] __initdata = "CDTV";
static char s_cd32[] __initdata = "CD32"; static char s_cd32[] __initdata = "CD32";
static char s_draco[] __initdata = "Draco"; static char s_draco[] __initdata = "Draco";
static char *amiga_models[] __initdata = { static char *amiga_models[] __initdata = {
[AMI_500-AMI_500] = s_a500, [AMI_500-AMI_500] = s_a500,
[AMI_500PLUS-AMI_500] = s_a500p, [AMI_500PLUS-AMI_500] = s_a500p,
[AMI_600-AMI_500] = s_a600, [AMI_600-AMI_500] = s_a600,
[AMI_1000-AMI_500] = s_a1000, [AMI_1000-AMI_500] = s_a1000,
[AMI_1200-AMI_500] = s_a1200, [AMI_1200-AMI_500] = s_a1200,
[AMI_2000-AMI_500] = s_a2000, [AMI_2000-AMI_500] = s_a2000,
[AMI_2500-AMI_500] = s_a2500, [AMI_2500-AMI_500] = s_a2500,
[AMI_3000-AMI_500] = s_a3000, [AMI_3000-AMI_500] = s_a3000,
[AMI_3000T-AMI_500] = s_a3000t, [AMI_3000T-AMI_500] = s_a3000t,
[AMI_3000PLUS-AMI_500] = s_a3000p, [AMI_3000PLUS-AMI_500] = s_a3000p,
[AMI_4000-AMI_500] = s_a4000, [AMI_4000-AMI_500] = s_a4000,
[AMI_4000T-AMI_500] = s_a4000t, [AMI_4000T-AMI_500] = s_a4000t,
[AMI_CDTV-AMI_500] = s_cdtv, [AMI_CDTV-AMI_500] = s_cdtv,
[AMI_CD32-AMI_500] = s_cd32, [AMI_CD32-AMI_500] = s_cd32,
[AMI_DRACO-AMI_500] = s_draco, [AMI_DRACO-AMI_500] = s_draco,
}; };
static char amiga_model_name[13] = "Amiga "; static char amiga_model_name[13] = "Amiga ";
...@@ -85,17 +83,17 @@ extern char m68k_debug_device[]; ...@@ -85,17 +83,17 @@ extern char m68k_debug_device[];
static void amiga_sched_init(irq_handler_t handler); static void amiga_sched_init(irq_handler_t handler);
/* amiga specific irq functions */ /* amiga specific irq functions */
extern void amiga_init_IRQ (void); extern void amiga_init_IRQ(void);
static void amiga_get_model(char *model); static void amiga_get_model(char *model);
static int amiga_get_hardware_list(char *buffer); static int amiga_get_hardware_list(char *buffer);
/* amiga specific timer functions */ /* amiga specific timer functions */
static unsigned long amiga_gettimeoffset (void); static unsigned long amiga_gettimeoffset(void);
static int a3000_hwclk (int, struct rtc_time *); static int a3000_hwclk(int, struct rtc_time *);
static int a2000_hwclk (int, struct rtc_time *); static int a2000_hwclk(int, struct rtc_time *);
static int amiga_set_clock_mmss (unsigned long); static int amiga_set_clock_mmss(unsigned long);
static unsigned int amiga_get_ss (void); static unsigned int amiga_get_ss(void);
extern void amiga_mksound( unsigned int count, unsigned int ticks ); extern void amiga_mksound(unsigned int count, unsigned int ticks);
static void amiga_reset (void); static void amiga_reset(void);
extern void amiga_init_sound(void); extern void amiga_init_sound(void);
static void amiga_savekmsg_init(void); static void amiga_savekmsg_init(void);
static void amiga_mem_console_write(struct console *co, const char *b, static void amiga_mem_console_write(struct console *co, const char *b,
...@@ -108,9 +106,9 @@ static void amiga_heartbeat(int on); ...@@ -108,9 +106,9 @@ static void amiga_heartbeat(int on);
#endif #endif
static struct console amiga_console_driver = { static struct console amiga_console_driver = {
.name = "debug", .name = "debug",
.flags = CON_PRINTBUFFER, .flags = CON_PRINTBUFFER,
.index = -1, .index = -1,
}; };
...@@ -119,24 +117,24 @@ static struct console amiga_console_driver = { ...@@ -119,24 +117,24 @@ static struct console amiga_console_driver = {
*/ */
static struct { static struct {
struct resource _ciab, _ciaa, _custom, _kickstart; struct resource _ciab, _ciaa, _custom, _kickstart;
} mb_resources = { } mb_resources = {
._ciab = { ._ciab = {
.name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff .name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff
}, },
._ciaa = { ._ciaa = {
.name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff .name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff
}, },
._custom = { ._custom = {
.name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff .name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff
}, },
._kickstart = { ._kickstart = {
.name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff .name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff
} }
}; };
static struct resource rtc_resource = { static struct resource rtc_resource = {
.start = 0x00dc0000, .end = 0x00dcffff .start = 0x00dc0000, .end = 0x00dcffff
}; };
static struct resource ram_resource[NUM_MEMINFO]; static struct resource ram_resource[NUM_MEMINFO];
...@@ -148,57 +146,57 @@ static struct resource ram_resource[NUM_MEMINFO]; ...@@ -148,57 +146,57 @@ static struct resource ram_resource[NUM_MEMINFO];
int amiga_parse_bootinfo(const struct bi_record *record) int amiga_parse_bootinfo(const struct bi_record *record)
{ {
int unknown = 0; int unknown = 0;
const unsigned long *data = record->data; const unsigned long *data = record->data;
switch (record->tag) { switch (record->tag) {
case BI_AMIGA_MODEL: case BI_AMIGA_MODEL:
amiga_model = *data; amiga_model = *data;
break; break;
case BI_AMIGA_ECLOCK: case BI_AMIGA_ECLOCK:
amiga_eclock = *data; amiga_eclock = *data;
break; break;
case BI_AMIGA_CHIPSET: case BI_AMIGA_CHIPSET:
amiga_chipset = *data; amiga_chipset = *data;
break; break;
case BI_AMIGA_CHIP_SIZE: case BI_AMIGA_CHIP_SIZE:
amiga_chip_size = *(const int *)data; amiga_chip_size = *(const int *)data;
break; break;
case BI_AMIGA_VBLANK: case BI_AMIGA_VBLANK:
amiga_vblank = *(const unsigned char *)data; amiga_vblank = *(const unsigned char *)data;
break; break;
case BI_AMIGA_PSFREQ: case BI_AMIGA_PSFREQ:
amiga_psfreq = *(const unsigned char *)data; amiga_psfreq = *(const unsigned char *)data;
break; break;
case BI_AMIGA_AUTOCON: case BI_AMIGA_AUTOCON:
#ifdef CONFIG_ZORRO #ifdef CONFIG_ZORRO
if (zorro_num_autocon < ZORRO_NUM_AUTO) { if (zorro_num_autocon < ZORRO_NUM_AUTO) {
const struct ConfigDev *cd = (struct ConfigDev *)data; const struct ConfigDev *cd = (struct ConfigDev *)data;
struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++]; struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
dev->rom = cd->cd_Rom; dev->rom = cd->cd_Rom;
dev->slotaddr = cd->cd_SlotAddr; dev->slotaddr = cd->cd_SlotAddr;
dev->slotsize = cd->cd_SlotSize; dev->slotsize = cd->cd_SlotSize;
dev->resource.start = (unsigned long)cd->cd_BoardAddr; dev->resource.start = (unsigned long)cd->cd_BoardAddr;
dev->resource.end = dev->resource.start+cd->cd_BoardSize-1; dev->resource.end = dev->resource.start + cd->cd_BoardSize - 1;
} else } else
printk("amiga_parse_bootinfo: too many AutoConfig devices\n"); printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
#endif /* CONFIG_ZORRO */ #endif /* CONFIG_ZORRO */
break; break;
case BI_AMIGA_SERPER: case BI_AMIGA_SERPER:
/* serial port period: ignored here */ /* serial port period: ignored here */
break; break;
default: default:
unknown = 1; unknown = 1;
} }
return(unknown); return unknown;
} }
/* /*
...@@ -207,159 +205,159 @@ int amiga_parse_bootinfo(const struct bi_record *record) ...@@ -207,159 +205,159 @@ int amiga_parse_bootinfo(const struct bi_record *record)
static void __init amiga_identify(void) static void __init amiga_identify(void)
{ {
/* Fill in some default values, if necessary */ /* Fill in some default values, if necessary */
if (amiga_eclock == 0) if (amiga_eclock == 0)
amiga_eclock = 709379; amiga_eclock = 709379;
memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
printk("Amiga hardware found: ");
if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
printk("[%s] ", amiga_models[amiga_model-AMI_500]);
strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
}
switch(amiga_model) {
case AMI_UNKNOWN:
goto Generic;
case AMI_600:
case AMI_1200:
AMIGAHW_SET(A1200_IDE);
AMIGAHW_SET(PCMCIA);
case AMI_500:
case AMI_500PLUS:
case AMI_1000:
case AMI_2000:
case AMI_2500:
AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
goto Generic;
case AMI_3000:
case AMI_3000T:
AMIGAHW_SET(AMBER_FF);
AMIGAHW_SET(MAGIC_REKICK);
/* fall through */
case AMI_3000PLUS:
AMIGAHW_SET(A3000_SCSI);
AMIGAHW_SET(A3000_CLK);
AMIGAHW_SET(ZORRO3);
goto Generic;
case AMI_4000T:
AMIGAHW_SET(A4000_SCSI);
/* fall through */
case AMI_4000:
AMIGAHW_SET(A4000_IDE);
AMIGAHW_SET(A3000_CLK);
AMIGAHW_SET(ZORRO3);
goto Generic;
case AMI_CDTV:
case AMI_CD32:
AMIGAHW_SET(CD_ROM);
AMIGAHW_SET(A2000_CLK); /* Is this correct? */
goto Generic;
Generic:
AMIGAHW_SET(AMI_VIDEO);
AMIGAHW_SET(AMI_BLITTER);
AMIGAHW_SET(AMI_AUDIO);
AMIGAHW_SET(AMI_FLOPPY);
AMIGAHW_SET(AMI_KEYBOARD);
AMIGAHW_SET(AMI_MOUSE);
AMIGAHW_SET(AMI_SERIAL);
AMIGAHW_SET(AMI_PARALLEL);
AMIGAHW_SET(CHIP_RAM);
AMIGAHW_SET(PAULA);
switch(amiga_chipset) {
case CS_OCS:
case CS_ECS:
case CS_AGA:
switch (amiga_custom.deniseid & 0xf) {
case 0x0c:
AMIGAHW_SET(DENISE_HR);
break;
case 0x08:
AMIGAHW_SET(LISA);
break;
}
break;
default:
AMIGAHW_SET(DENISE);
break;
}
switch ((amiga_custom.vposr>>8) & 0x7f) {
case 0x00:
AMIGAHW_SET(AGNUS_PAL);
break;
case 0x10:
AMIGAHW_SET(AGNUS_NTSC);
break;
case 0x20:
case 0x21:
AMIGAHW_SET(AGNUS_HR_PAL);
break;
case 0x30:
case 0x31:
AMIGAHW_SET(AGNUS_HR_NTSC);
break;
case 0x22:
case 0x23:
AMIGAHW_SET(ALICE_PAL);
break;
case 0x32:
case 0x33:
AMIGAHW_SET(ALICE_NTSC);
break;
}
AMIGAHW_SET(ZORRO);
break;
case AMI_DRACO:
panic("No support for Draco yet");
default:
panic("Unknown Amiga Model");
}
#define AMIGAHW_ANNOUNCE(name, str) \ memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
if (AMIGAHW_PRESENT(name)) \
printk(str) printk("Amiga hardware found: ");
if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO "); printk("[%s] ", amiga_models[amiga_model-AMI_500]);
AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER "); strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF "); }
AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO ");
AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY "); switch (amiga_model) {
AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI "); case AMI_UNKNOWN:
AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI "); goto Generic;
AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE ");
AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE "); case AMI_600:
AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM "); case AMI_1200:
AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD "); AMIGAHW_SET(A1200_IDE);
AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE "); AMIGAHW_SET(PCMCIA);
AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL "); case AMI_500:
AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL "); case AMI_500PLUS:
AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK "); case AMI_1000:
AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK "); case AMI_2000:
AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM "); case AMI_2500:
AMIGAHW_ANNOUNCE(PAULA, "PAULA "); AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
AMIGAHW_ANNOUNCE(DENISE, "DENISE "); goto Generic;
AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR ");
AMIGAHW_ANNOUNCE(LISA, "LISA "); case AMI_3000:
AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL "); case AMI_3000T:
AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC "); AMIGAHW_SET(AMBER_FF);
AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL "); AMIGAHW_SET(MAGIC_REKICK);
AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC "); /* fall through */
AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL "); case AMI_3000PLUS:
AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC "); AMIGAHW_SET(A3000_SCSI);
AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK "); AMIGAHW_SET(A3000_CLK);
AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA "); AMIGAHW_SET(ZORRO3);
if (AMIGAHW_PRESENT(ZORRO)) goto Generic;
printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
printk("\n"); case AMI_4000T:
AMIGAHW_SET(A4000_SCSI);
/* fall through */
case AMI_4000:
AMIGAHW_SET(A4000_IDE);
AMIGAHW_SET(A3000_CLK);
AMIGAHW_SET(ZORRO3);
goto Generic;
case AMI_CDTV:
case AMI_CD32:
AMIGAHW_SET(CD_ROM);
AMIGAHW_SET(A2000_CLK); /* Is this correct? */
goto Generic;
Generic:
AMIGAHW_SET(AMI_VIDEO);
AMIGAHW_SET(AMI_BLITTER);
AMIGAHW_SET(AMI_AUDIO);
AMIGAHW_SET(AMI_FLOPPY);
AMIGAHW_SET(AMI_KEYBOARD);
AMIGAHW_SET(AMI_MOUSE);
AMIGAHW_SET(AMI_SERIAL);
AMIGAHW_SET(AMI_PARALLEL);
AMIGAHW_SET(CHIP_RAM);
AMIGAHW_SET(PAULA);
switch (amiga_chipset) {
case CS_OCS:
case CS_ECS:
case CS_AGA:
switch (amiga_custom.deniseid & 0xf) {
case 0x0c:
AMIGAHW_SET(DENISE_HR);
break;
case 0x08:
AMIGAHW_SET(LISA);
break;
}
break;
default:
AMIGAHW_SET(DENISE);
break;
}
switch ((amiga_custom.vposr>>8) & 0x7f) {
case 0x00:
AMIGAHW_SET(AGNUS_PAL);
break;
case 0x10:
AMIGAHW_SET(AGNUS_NTSC);
break;
case 0x20:
case 0x21:
AMIGAHW_SET(AGNUS_HR_PAL);
break;
case 0x30:
case 0x31:
AMIGAHW_SET(AGNUS_HR_NTSC);
break;
case 0x22:
case 0x23:
AMIGAHW_SET(ALICE_PAL);
break;
case 0x32:
case 0x33:
AMIGAHW_SET(ALICE_NTSC);
break;
}
AMIGAHW_SET(ZORRO);
break;
case AMI_DRACO:
panic("No support for Draco yet");
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 ");
AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA ");
if (AMIGAHW_PRESENT(ZORRO))
printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
printk("\n");
#undef AMIGAHW_ANNOUNCE #undef AMIGAHW_ANNOUNCE
} }
...@@ -370,119 +368,117 @@ static void __init amiga_identify(void) ...@@ -370,119 +368,117 @@ static void __init amiga_identify(void)
void __init config_amiga(void) void __init config_amiga(void)
{ {
int i; int i;
amiga_debug_init(); amiga_debug_init();
amiga_identify(); amiga_identify();
/* Yuk, we don't have PCI memory */ /* Yuk, we don't have PCI memory */
iomem_resource.name = "Memory"; iomem_resource.name = "Memory";
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]); request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
mach_sched_init = amiga_sched_init; mach_sched_init = amiga_sched_init;
mach_init_IRQ = amiga_init_IRQ; mach_init_IRQ = amiga_init_IRQ;
mach_get_model = amiga_get_model; mach_get_model = amiga_get_model;
mach_get_hardware_list = amiga_get_hardware_list; mach_get_hardware_list = amiga_get_hardware_list;
mach_gettimeoffset = amiga_gettimeoffset; mach_gettimeoffset = amiga_gettimeoffset;
if (AMIGAHW_PRESENT(A3000_CLK)){ if (AMIGAHW_PRESENT(A3000_CLK)) {
mach_hwclk = a3000_hwclk; mach_hwclk = a3000_hwclk;
rtc_resource.name = "A3000 RTC"; rtc_resource.name = "A3000 RTC";
request_resource(&iomem_resource, &rtc_resource); request_resource(&iomem_resource, &rtc_resource);
} } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */ mach_hwclk = a2000_hwclk;
mach_hwclk = a2000_hwclk; rtc_resource.name = "A2000 RTC";
rtc_resource.name = "A2000 RTC"; request_resource(&iomem_resource, &rtc_resource);
request_resource(&iomem_resource, &rtc_resource); }
}
/*
mach_max_dma_address = 0xffffffff; /* * default MAX_DMA=0xffffffff on all machines. If we don't do so, the SCSI
* default MAX_DMA=0xffffffff * code will not be able to allocate any mem for transfers, unless we are
* on all machines. If we don't * dealing with a Z2 mem only system. /Jes
* do so, the SCSI code will not */
* be able to allocate any mem mach_max_dma_address = 0xffffffff;
* for transfers, unless we are
* dealing with a Z2 mem only mach_set_clock_mmss = amiga_set_clock_mmss;
* system. /Jes mach_get_ss = amiga_get_ss;
*/ mach_reset = amiga_reset;
mach_set_clock_mmss = amiga_set_clock_mmss;
mach_get_ss = amiga_get_ss;
mach_reset = amiga_reset;
#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
mach_beep = amiga_mksound; mach_beep = amiga_mksound;
#endif #endif
#ifdef CONFIG_HEARTBEAT #ifdef CONFIG_HEARTBEAT
mach_heartbeat = amiga_heartbeat; mach_heartbeat = amiga_heartbeat;
#endif #endif
/* Fill in the clock values (based on the 700 kHz E-Clock) */ /* Fill in the clock values (based on the 700 kHz E-Clock) */
amiga_masterclock = 40*amiga_eclock; /* 28 MHz */ 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 */ /* clear all DMA bits */
amiga_custom.dmacon = DMAF_ALL; amiga_custom.dmacon = DMAF_ALL;
/* ensure that the DMA master bit is set */ /* ensure that the DMA master bit is set */
amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER; amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
/* don't use Z2 RAM as system memory on Z3 capable machines */ /* don't use Z2 RAM as system memory on Z3 capable machines */
if (AMIGAHW_PRESENT(ZORRO3)) { if (AMIGAHW_PRESENT(ZORRO3)) {
int i, j; int i, j;
u32 disabled_z2mem = 0; u32 disabled_z2mem = 0;
for (i = 0; i < m68k_num_memory; i++)
if (m68k_memory[i].addr < 16*1024*1024) { for (i = 0; i < m68k_num_memory; i++) {
if (i == 0) { if (m68k_memory[i].addr < 16*1024*1024) {
/* don't cut off the branch we're sitting on */ if (i == 0) {
printk("Warning: kernel runs in Zorro II memory\n"); /* don't cut off the branch we're sitting on */
continue; printk("Warning: kernel runs in Zorro II memory\n");
continue;
}
disabled_z2mem += m68k_memory[i].size;
m68k_num_memory--;
for (j = i; j < m68k_num_memory; j++)
m68k_memory[j] = m68k_memory[j+1];
i--;
}
}
if (disabled_z2mem)
printk("%dK of Zorro II memory will not be used as system memory\n",
disabled_z2mem>>10);
}
/* request all RAM */
for (i = 0; i < m68k_num_memory; i++) {
ram_resource[i].name =
(m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
(m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
"16-bit Slow RAM";
ram_resource[i].start = m68k_memory[i].addr;
ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
request_resource(&iomem_resource, &ram_resource[i]);
}
/* initialize chipram allocator */
amiga_chip_init();
/* debugging using chipram */
if (!strcmp(m68k_debug_device, "mem")) {
if (!AMIGAHW_PRESENT(CHIP_RAM))
printk("Warning: no chipram present for debugging\n");
else {
amiga_savekmsg_init();
amiga_console_driver.write = amiga_mem_console_write;
register_console(&amiga_console_driver);
}
} }
disabled_z2mem += m68k_memory[i].size;
m68k_num_memory--; /* our beloved beeper */
for (j = i; j < m68k_num_memory; j++) if (AMIGAHW_PRESENT(AMI_AUDIO))
m68k_memory[j] = m68k_memory[j+1]; amiga_init_sound();
i--;
} /*
if (disabled_z2mem) * if it is an A3000, set the magic bit that forces
printk("%dK of Zorro II memory will not be used as system memory\n", * a hard rekick
disabled_z2mem>>10); */
} if (AMIGAHW_PRESENT(MAGIC_REKICK))
*(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
/* request all RAM */
for (i = 0; i < m68k_num_memory; i++) {
ram_resource[i].name =
(m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
(m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
"16-bit Slow RAM";
ram_resource[i].start = m68k_memory[i].addr;
ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
request_resource(&iomem_resource, &ram_resource[i]);
}
/* initialize chipram allocator */
amiga_chip_init ();
/* debugging using chipram */
if (!strcmp( m68k_debug_device, "mem" )){
if (!AMIGAHW_PRESENT(CHIP_RAM))
printk("Warning: no chipram present for debugging\n");
else {
amiga_savekmsg_init();
amiga_console_driver.write = amiga_mem_console_write;
register_console(&amiga_console_driver);
}
}
/* our beloved beeper */
if (AMIGAHW_PRESENT(AMI_AUDIO))
amiga_init_sound();
/*
* if it is an A3000, set the magic bit that forces
* a hard rekick
*/
if (AMIGAHW_PRESENT(MAGIC_REKICK))
*(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
} }
static unsigned short jiffy_ticks; static unsigned short jiffy_ticks;
...@@ -490,12 +486,12 @@ static unsigned short jiffy_ticks; ...@@ -490,12 +486,12 @@ static unsigned short jiffy_ticks;
static void __init amiga_sched_init(irq_handler_t timer_routine) static void __init amiga_sched_init(irq_handler_t timer_routine)
{ {
static struct resource sched_res = { static struct resource sched_res = {
.name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff, .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff,
}; };
jiffy_ticks = (amiga_eclock+HZ/2)/HZ; jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
if (request_resource(&mb_resources._ciab, &sched_res)) if (request_resource(&mb_resources._ciab, &sched_res))
printk("Cannot allocate ciab.ta{lo,hi}\n"); printk("Cannot allocate ciab.ta{lo,hi}\n");
ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */ ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */
ciab.talo = jiffy_ticks % 256; ciab.talo = jiffy_ticks % 256;
ciab.tahi = jiffy_ticks / 256; ciab.tahi = jiffy_ticks / 256;
...@@ -513,7 +509,7 @@ static void __init amiga_sched_init(irq_handler_t timer_routine) ...@@ -513,7 +509,7 @@ static void __init amiga_sched_init(irq_handler_t timer_routine)
#define TICK_SIZE 10000 #define TICK_SIZE 10000
/* This is always executed with interrupts disabled. */ /* This is always executed with interrupts disabled. */
static unsigned long amiga_gettimeoffset (void) static unsigned long amiga_gettimeoffset(void)
{ {
unsigned short hi, lo, hi2; unsigned short hi, lo, hi2;
unsigned long ticks, offset = 0; unsigned long ticks, offset = 0;
...@@ -585,15 +581,15 @@ static int a2000_hwclk(int op, struct rtc_time *t) ...@@ -585,15 +581,15 @@ static int a2000_hwclk(int op, struct rtc_time *t)
tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD; tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD;
while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) {
{ tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; udelay(70);
udelay(70); tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
} }
if (!cnt) if (!cnt)
printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1); printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n",
tod_2000.cntrl1);
if (!op) { /* read */ if (!op) { /* read */
t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2; t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2;
...@@ -606,7 +602,7 @@ static int a2000_hwclk(int op, struct rtc_time *t) ...@@ -606,7 +602,7 @@ static int a2000_hwclk(int op, struct rtc_time *t)
if (t->tm_year <= 69) if (t->tm_year <= 69)
t->tm_year += 100; t->tm_year += 100;
if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)){ if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)) {
if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12) if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12)
t->tm_hour = 0; t->tm_hour = 0;
else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12) else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12)
...@@ -642,7 +638,7 @@ static int a2000_hwclk(int op, struct rtc_time *t) ...@@ -642,7 +638,7 @@ static int a2000_hwclk(int op, struct rtc_time *t)
return 0; return 0;
} }
static 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; short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
...@@ -660,8 +656,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime) ...@@ -660,8 +656,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime)
tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) {
{
tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
udelay(70); udelay(70);
tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
...@@ -681,7 +676,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime) ...@@ -681,7 +676,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime)
return 0; return 0;
} }
static unsigned int amiga_get_ss( void ) static unsigned int amiga_get_ss(void)
{ {
unsigned int s; unsigned int s;
...@@ -695,71 +690,72 @@ static unsigned int amiga_get_ss( void ) ...@@ -695,71 +690,72 @@ static unsigned int amiga_get_ss( void )
return s; return s;
} }
static NORET_TYPE void amiga_reset( void ) static NORET_TYPE void amiga_reset(void)
ATTRIB_NORET; ATTRIB_NORET;
static void amiga_reset (void) static void amiga_reset(void)
{ {
unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label); unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label);
local_irq_disable(); local_irq_disable();
if (CPU_IS_040_OR_060) if (CPU_IS_040_OR_060)
/* Setup transparent translation registers for mapping /* Setup transparent translation registers for mapping
* of 16 MB kernel segment before disabling translation * of 16 MB kernel segment before disabling translation
*/ */
__asm__ __volatile__ asm volatile ("\n"
("movel %0,%/d0\n\t" " move.l %0,%%d0\n"
"andl #0xff000000,%/d0\n\t" " and.l #0xff000000,%%d0\n"
"orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */ " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */
".chip 68040\n\t" " .chip 68040\n"
"movec %%d0,%%itt0\n\t" " movec %%d0,%%itt0\n"
"movec %%d0,%%dtt0\n\t" " movec %%d0,%%dtt0\n"
".chip 68k\n\t" " .chip 68k\n"
"jmp %0@\n\t" " jmp %0@\n"
: /* no outputs */ : /* no outputs */
: "a" (jmp_addr040)); : "a" (jmp_addr040)
else : "d0");
/* for 680[23]0, just disable translation and jump to the physical else
* address of the label /* for 680[23]0, just disable translation and jump to the physical
*/ * address of the label
__asm__ __volatile__ */
("pmove %/tc,%@\n\t" asm volatile ("\n"
"bclr #7,%@\n\t" " pmove %%tc,%@\n"
"pmove %@,%/tc\n\t" " bclr #7,%@\n"
"jmp %0@\n\t" " pmove %@,%%tc\n"
: /* no outputs */ " jmp %0@\n"
: "a" (jmp_addr)); : /* no outputs */
jmp_addr_label040: : "a" (jmp_addr));
/* disable translation on '040 now */ jmp_addr_label040:
__asm__ __volatile__ /* disable translation on '040 now */
("moveq #0,%/d0\n\t" asm volatile ("\n"
".chip 68040\n\t" " moveq #0,%%d0\n"
"movec %%d0,%%tc\n\t" /* disable MMU */ " .chip 68040\n"
".chip 68k\n\t" " movec %%d0,%%tc\n" /* disable MMU */
: /* no outputs */ " .chip 68k\n"
: /* no inputs */ : /* no outputs */
: "d0"); : /* no inputs */
: "d0");
jmp_addr_label:
/* pickup reset address from AmigaOS ROM, reset devices and jump jmp_addr_label:
* to reset address /* pickup reset address from AmigaOS ROM, reset devices and jump
*/ * to reset address
__asm__ __volatile__ */
("movew #0x2700,%/sr\n\t" asm volatile ("\n"
"leal 0x01000000,%/a0\n\t" " move.w #0x2700,%sr\n"
"subl %/a0@(-0x14),%/a0\n\t" " lea 0x01000000,%a0\n"
"movel %/a0@(4),%/a0\n\t" " sub.l %a0@(-0x14),%a0\n"
"subql #2,%/a0\n\t" " move.l %a0@(4),%a0\n"
"bra 1f\n\t" " subq.l #2,%a0\n"
/* align on a longword boundary */ " jra 1f\n"
__ALIGN_STR "\n" /* align on a longword boundary */
"1:\n\t" " " __ALIGN_STR "\n"
"reset\n\t" "1:\n"
"jmp %/a0@" : /* Just that gcc scans it for % escapes */ ); " reset\n"
" jmp %a0@");
for (;;);
for (;;)
;
} }
...@@ -773,11 +769,11 @@ static void amiga_reset (void) ...@@ -773,11 +769,11 @@ static void amiga_reset (void)
#define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */ #define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
struct savekmsg { struct savekmsg {
unsigned long magic1; /* SAVEKMSG_MAGIC1 */ unsigned long magic1; /* SAVEKMSG_MAGIC1 */
unsigned long magic2; /* SAVEKMSG_MAGIC2 */ unsigned long magic2; /* SAVEKMSG_MAGIC2 */
unsigned long magicptr; /* address of magic1 */ unsigned long magicptr; /* address of magic1 */
unsigned long size; unsigned long size;
char data[0]; char data[0];
}; };
static struct savekmsg *savekmsg; static struct savekmsg *savekmsg;
...@@ -785,100 +781,100 @@ static struct savekmsg *savekmsg; ...@@ -785,100 +781,100 @@ static struct savekmsg *savekmsg;
static void amiga_mem_console_write(struct console *co, const char *s, static void amiga_mem_console_write(struct console *co, const char *s,
unsigned int count) unsigned int count)
{ {
if (savekmsg->size+count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) { if (savekmsg->size + count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
memcpy(savekmsg->data+savekmsg->size, s, count); memcpy(savekmsg->data + savekmsg->size, s, count);
savekmsg->size += count; savekmsg->size += count;
} }
} }
static void amiga_savekmsg_init(void) static void amiga_savekmsg_init(void)
{ {
static struct resource debug_res = { .name = "Debug" }; static struct resource debug_res = { .name = "Debug" };
savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res); savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res);
savekmsg->magic1 = SAVEKMSG_MAGIC1; savekmsg->magic1 = SAVEKMSG_MAGIC1;
savekmsg->magic2 = SAVEKMSG_MAGIC2; savekmsg->magic2 = SAVEKMSG_MAGIC2;
savekmsg->magicptr = ZTWO_PADDR(savekmsg); savekmsg->magicptr = ZTWO_PADDR(savekmsg);
savekmsg->size = 0; savekmsg->size = 0;
} }
static void amiga_serial_putc(char c) static void amiga_serial_putc(char c)
{ {
amiga_custom.serdat = (unsigned char)c | 0x100; amiga_custom.serdat = (unsigned char)c | 0x100;
while (!(amiga_custom.serdatr & 0x2000)) while (!(amiga_custom.serdatr & 0x2000))
; ;
} }
void amiga_serial_console_write(struct console *co, const char *s, void amiga_serial_console_write(struct console *co, const char *s,
unsigned int count) unsigned int count)
{ {
while (count--) { while (count--) {
if (*s == '\n') if (*s == '\n')
amiga_serial_putc('\r'); amiga_serial_putc('\r');
amiga_serial_putc(*s++); amiga_serial_putc(*s++);
} }
} }
#ifdef CONFIG_SERIAL_CONSOLE #ifdef CONFIG_SERIAL_CONSOLE
void amiga_serial_puts(const char *s) void amiga_serial_puts(const char *s)
{ {
amiga_serial_console_write(NULL, s, strlen(s)); amiga_serial_console_write(NULL, s, strlen(s));
} }
int amiga_serial_console_wait_key(struct console *co) int amiga_serial_console_wait_key(struct console *co)
{ {
int ch; int ch;
while (!(amiga_custom.intreqr & IF_RBF)) while (!(amiga_custom.intreqr & IF_RBF))
barrier(); barrier();
ch = amiga_custom.serdatr & 0xff; ch = amiga_custom.serdatr & 0xff;
/* clear the interrupt, so that another character can be read */ /* clear the interrupt, so that another character can be read */
amiga_custom.intreq = IF_RBF; amiga_custom.intreq = IF_RBF;
return ch; return ch;
} }
void amiga_serial_gets(struct console *co, char *s, int len) void amiga_serial_gets(struct console *co, char *s, int len)
{ {
int ch, cnt = 0; int ch, cnt = 0;
while (1) { while (1) {
ch = amiga_serial_console_wait_key(co); ch = amiga_serial_console_wait_key(co);
/* Check for backspace. */ /* Check for backspace. */
if (ch == 8 || ch == 127) { if (ch == 8 || ch == 127) {
if (cnt == 0) { if (cnt == 0) {
amiga_serial_putc('\007'); amiga_serial_putc('\007');
continue; continue;
} }
cnt--; cnt--;
amiga_serial_puts("\010 \010"); amiga_serial_puts("\010 \010");
continue; continue;
} }
/* Check for enter. */ /* Check for enter. */
if (ch == 10 || ch == 13) if (ch == 10 || ch == 13)
break; break;
/* See if line is too long. */ /* See if line is too long. */
if (cnt >= len + 1) { if (cnt >= len + 1) {
amiga_serial_putc(7); amiga_serial_putc(7);
cnt--; cnt--;
continue; continue;
} }
/* Store and echo character. */ /* Store and echo character. */
s[cnt++] = ch; s[cnt++] = ch;
amiga_serial_putc(ch); amiga_serial_putc(ch);
} }
/* Print enter. */ /* Print enter. */
amiga_serial_puts("\r\n"); amiga_serial_puts("\r\n");
s[cnt] = 0; s[cnt] = 0;
} }
#endif #endif
static void __init amiga_debug_init(void) static void __init amiga_debug_init(void)
{ {
if (!strcmp( m68k_debug_device, "ser" )) { if (!strcmp(m68k_debug_device, "ser" )) {
/* no initialization required (?) */ /* no initialization required (?) */
amiga_console_driver.write = amiga_serial_console_write; amiga_console_driver.write = amiga_serial_console_write;
register_console(&amiga_console_driver); register_console(&amiga_console_driver);
...@@ -888,10 +884,10 @@ static void __init amiga_debug_init(void) ...@@ -888,10 +884,10 @@ static void __init amiga_debug_init(void)
#ifdef CONFIG_HEARTBEAT #ifdef CONFIG_HEARTBEAT
static void amiga_heartbeat(int on) static void amiga_heartbeat(int on)
{ {
if (on) if (on)
ciaa.pra &= ~2; ciaa.pra &= ~2;
else else
ciaa.pra |= 2; ciaa.pra |= 2;
} }
#endif #endif
...@@ -901,81 +897,81 @@ static void amiga_heartbeat(int on) ...@@ -901,81 +897,81 @@ static void amiga_heartbeat(int on)
static void amiga_get_model(char *model) static void amiga_get_model(char *model)
{ {
strcpy(model, amiga_model_name); strcpy(model, amiga_model_name);
} }
static int amiga_get_hardware_list(char *buffer) static int amiga_get_hardware_list(char *buffer)
{ {
int len = 0; int len = 0;
if (AMIGAHW_PRESENT(CHIP_RAM)) if (AMIGAHW_PRESENT(CHIP_RAM))
len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", 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", len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
amiga_psfreq, amiga_eclock); amiga_psfreq, amiga_eclock);
if (AMIGAHW_PRESENT(AMI_VIDEO)) { if (AMIGAHW_PRESENT(AMI_VIDEO)) {
char *type; char *type;
switch(amiga_chipset) { switch (amiga_chipset) {
case CS_OCS: case CS_OCS:
type = "OCS"; type = "OCS";
break; break;
case CS_ECS: case CS_ECS:
type = "ECS"; type = "ECS";
break; break;
case CS_AGA: case CS_AGA:
type = "AGA"; type = "AGA";
break; break;
default: default:
type = "Old or Unknown"; type = "Old or Unknown";
break; break;
}
len += sprintf(buffer+len, "Graphics:\t%s\n", type);
} }
len += sprintf(buffer+len, "Graphics:\t%s\n", type);
}
#define AMIGAHW_ANNOUNCE(name, str) \ #define AMIGAHW_ANNOUNCE(name, str) \
if (AMIGAHW_PRESENT(name)) \ if (AMIGAHW_PRESENT(name)) \
len += sprintf (buffer+len, "\t%s\n", str) len += sprintf (buffer+len, "\t%s\n", str)
len += sprintf (buffer + len, "Detected hardware:\n"); len += sprintf (buffer + len, "Detected hardware:\n");
AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video"); AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video");
AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter"); AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter");
AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer"); AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer");
AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio"); AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio");
AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller"); AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller");
AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)"); AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)");
AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)"); AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)");
AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)"); AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)");
AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)"); AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)");
AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive"); AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive");
AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard"); AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard");
AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port"); AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port");
AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port"); AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port");
AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port"); AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port");
AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)"); AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)");
AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)"); AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)");
AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM"); AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM");
AMIGAHW_ANNOUNCE(PAULA, "Paula 8364"); AMIGAHW_ANNOUNCE(PAULA, "Paula 8364");
AMIGAHW_ANNOUNCE(DENISE, "Denise 8362"); AMIGAHW_ANNOUNCE(DENISE, "Denise 8362");
AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373"); AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373");
AMIGAHW_ANNOUNCE(LISA, "Lisa 8375"); AMIGAHW_ANNOUNCE(LISA, "Lisa 8375");
AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371"); AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371");
AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370"); AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370");
AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372"); AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372");
AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372"); AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372");
AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374"); AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374");
AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374"); AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374");
AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick"); AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick");
AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot"); AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot");
#ifdef CONFIG_ZORRO #ifdef CONFIG_ZORRO
if (AMIGAHW_PRESENT(ZORRO)) if (AMIGAHW_PRESENT(ZORRO))
len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion " len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion "
"Device%s\n", "Device%s\n",
AMIGAHW_PRESENT(ZORRO3) ? "I" : "", AMIGAHW_PRESENT(ZORRO3) ? "I" : "",
zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s"); zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
#endif /* CONFIG_ZORRO */ #endif /* CONFIG_ZORRO */
#undef AMIGAHW_ANNOUNCE #undef AMIGAHW_ANNOUNCE
return(len); return len;
} }
...@@ -50,19 +50,19 @@ int atari_dont_touch_floppy_select; ...@@ -50,19 +50,19 @@ int atari_dont_touch_floppy_select;
int atari_rtc_year_offset; int atari_rtc_year_offset;
/* local function prototypes */ /* local function prototypes */
static void atari_reset( void ); static void atari_reset(void);
static void atari_get_model(char *model); static void atari_get_model(char *model);
static int atari_get_hardware_list(char *buffer); static int atari_get_hardware_list(char *buffer);
/* atari specific irq functions */ /* atari specific irq functions */
extern void atari_init_IRQ (void); extern void atari_init_IRQ (void);
extern void atari_mksound( unsigned int count, unsigned int ticks ); extern void atari_mksound(unsigned int count, unsigned int ticks);
#ifdef CONFIG_HEARTBEAT #ifdef CONFIG_HEARTBEAT
static void atari_heartbeat( int on ); static void atari_heartbeat(int on);
#endif #endif
/* atari specific timer functions (in time.c) */ /* atari specific timer functions (in time.c) */
extern void atari_sched_init(irq_handler_t ); extern void atari_sched_init(irq_handler_t);
extern unsigned long atari_gettimeoffset (void); extern unsigned long atari_gettimeoffset (void);
extern int atari_mste_hwclk (int, struct rtc_time *); extern int atari_mste_hwclk (int, struct rtc_time *);
extern int atari_tt_hwclk (int, struct rtc_time *); extern int atari_tt_hwclk (int, struct rtc_time *);
...@@ -73,48 +73,6 @@ extern int atari_tt_set_clock_mmss (unsigned long); ...@@ -73,48 +73,6 @@ extern int atari_tt_set_clock_mmss (unsigned long);
extern void atari_debug_init(void); extern void atari_debug_init(void);
/* I've moved hwreg_present() and hwreg_present_bywrite() out into
* mm/hwtest.c, to avoid having multiple copies of the same routine
* in the kernel [I wanted them in hp300 and they were already used
* in the nubus code. NB: I don't have an Atari so this might (just
* conceivably) break something.
* I've preserved the #if 0 version of hwreg_present_bywrite() here
* for posterity.
* -- Peter Maydell <pmaydell@chiark.greenend.org.uk>, 05/1998
*/
#if 0
static int __init
hwreg_present_bywrite(volatile void *regp, unsigned char val)
{
int ret;
long save_sp, save_vbr;
static long tmp_vectors[3] = { [2] = (long)&&after_test };
__asm__ __volatile__
( "movec %/vbr,%2\n\t" /* save vbr value */
"movec %4,%/vbr\n\t" /* set up temporary vectors */
"movel %/sp,%1\n\t" /* save sp */
"moveq #0,%0\n\t" /* assume not present */
"moveb %5,%3@\n\t" /* write the hardware reg */
"cmpb %3@,%5\n\t" /* compare it */
"seq %0" /* comes here only if reg */
/* is present */
: "=d&" (ret), "=r&" (save_sp), "=r&" (save_vbr)
: "a" (regp), "r" (tmp_vectors), "d" (val)
);
after_test:
__asm__ __volatile__
( "movel %0,%/sp\n\t" /* restore sp */
"movec %1,%/vbr" /* restore vbr */
: : "r" (save_sp), "r" (save_vbr) : "sp"
);
return( ret );
}
#endif
/* ++roman: This is a more elaborate test for an SCC chip, since the plain /* ++roman: This is a more elaborate test for an SCC chip, since the plain
* Medusa board generates DTACK at the SCC's standard addresses, but a SCC * Medusa board generates DTACK at the SCC's standard addresses, but a SCC
* board in the Medusa is possible. Also, the addresses where the ST_ESCC * board in the Medusa is possible. Also, the addresses where the ST_ESCC
...@@ -123,26 +81,34 @@ hwreg_present_bywrite(volatile void *regp, unsigned char val) ...@@ -123,26 +81,34 @@ hwreg_present_bywrite(volatile void *regp, unsigned char val)
* should be readable without trouble (from channel A!). * should be readable without trouble (from channel A!).
*/ */
static int __init scc_test( volatile char *ctla ) static int __init scc_test(volatile char *ctla)
{ {
if (!hwreg_present( ctla )) if (!hwreg_present(ctla))
return( 0 ); return 0;
MFPDELAY(); MFPDELAY();
*ctla = 2; MFPDELAY(); *ctla = 2;
*ctla = 0x40; MFPDELAY(); MFPDELAY();
*ctla = 0x40;
MFPDELAY();
*ctla = 2; MFPDELAY(); *ctla = 2;
if (*ctla != 0x40) return( 0 ); MFPDELAY();
if (*ctla != 0x40)
return 0;
MFPDELAY(); MFPDELAY();
*ctla = 2; MFPDELAY(); *ctla = 2;
*ctla = 0x60; MFPDELAY(); MFPDELAY();
*ctla = 0x60;
MFPDELAY();
*ctla = 2; MFPDELAY(); *ctla = 2;
if (*ctla != 0x60) return( 0 ); MFPDELAY();
if (*ctla != 0x60)
return 0;
return( 1 ); return 1;
} }
...@@ -152,59 +118,58 @@ static int __init scc_test( volatile char *ctla ) ...@@ -152,59 +118,58 @@ static int __init scc_test( volatile char *ctla )
int __init atari_parse_bootinfo(const struct bi_record *record) int __init atari_parse_bootinfo(const struct bi_record *record)
{ {
int unknown = 0; int unknown = 0;
const u_long *data = record->data; const u_long *data = record->data;
switch (record->tag) { switch (record->tag) {
case BI_ATARI_MCH_COOKIE: case BI_ATARI_MCH_COOKIE:
atari_mch_cookie = *data; atari_mch_cookie = *data;
break; break;
case BI_ATARI_MCH_TYPE: case BI_ATARI_MCH_TYPE:
atari_mch_type = *data; atari_mch_type = *data;
break; break;
default: default:
unknown = 1; unknown = 1;
} break;
return(unknown); }
return unknown;
} }
/* Parse the Atari-specific switches= option. */ /* Parse the Atari-specific switches= option. */
void __init atari_switches_setup( const char *str, unsigned len ) void __init atari_switches_setup(const char *str, unsigned len)
{ {
char switches[len+1]; char switches[len+1];
char *p; char *p;
int ovsc_shift; int ovsc_shift;
char *args = switches; char *args = switches;
/* copy string to local array, strsep works destructively... */ /* copy string to local array, strsep works destructively... */
strlcpy( switches, str, sizeof(switches) ); strlcpy(switches, str, sizeof(switches));
atari_switches = 0; atari_switches = 0;
/* parse the options */ /* parse the options */
while ((p = strsep(&args, ",")) != NULL) { while ((p = strsep(&args, ",")) != NULL) {
if (!*p) continue; if (!*p)
ovsc_shift = 0; continue;
if (strncmp( p, "ov_", 3 ) == 0) { ovsc_shift = 0;
p += 3; if (strncmp(p, "ov_", 3) == 0) {
ovsc_shift = ATARI_SWITCH_OVSC_SHIFT; p += 3;
} ovsc_shift = ATARI_SWITCH_OVSC_SHIFT;
}
if (strcmp( p, "ikbd" ) == 0) {
/* RTS line of IKBD ACIA */ if (strcmp(p, "ikbd") == 0) {
atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift; /* RTS line of IKBD ACIA */
} atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift;
else if (strcmp( p, "midi" ) == 0) { } else if (strcmp(p, "midi") == 0) {
/* RTS line of MIDI ACIA */ /* RTS line of MIDI ACIA */
atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift; atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift;
} else if (strcmp(p, "snd6") == 0) {
atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift;
} else if (strcmp(p, "snd7") == 0) {
atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
}
} }
else if (strcmp( p, "snd6" ) == 0) {
atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift;
}
else if (strcmp( p, "snd7" ) == 0) {
atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
}
}
} }
...@@ -214,284 +179,283 @@ void __init atari_switches_setup( const char *str, unsigned len ) ...@@ -214,284 +179,283 @@ void __init atari_switches_setup( const char *str, unsigned len )
void __init config_atari(void) void __init config_atari(void)
{ {
unsigned short tos_version; unsigned short tos_version;
memset(&atari_hw_present, 0, sizeof(atari_hw_present)); memset(&atari_hw_present, 0, sizeof(atari_hw_present));
atari_debug_init(); atari_debug_init();
ioport_resource.end = 0xFFFFFFFF; /* Change size of I/O space from 64KB /* Change size of I/O space from 64KB to 4GB. */
to 4GB. */ ioport_resource.end = 0xFFFFFFFF;
mach_sched_init = atari_sched_init; mach_sched_init = atari_sched_init;
mach_init_IRQ = atari_init_IRQ; mach_init_IRQ = atari_init_IRQ;
mach_get_model = atari_get_model; mach_get_model = atari_get_model;
mach_get_hardware_list = atari_get_hardware_list; mach_get_hardware_list = atari_get_hardware_list;
mach_gettimeoffset = atari_gettimeoffset; mach_gettimeoffset = atari_gettimeoffset;
mach_reset = atari_reset; mach_reset = atari_reset;
mach_max_dma_address = 0xffffff; mach_max_dma_address = 0xffffff;
#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
mach_beep = atari_mksound; mach_beep = atari_mksound;
#endif #endif
#ifdef CONFIG_HEARTBEAT #ifdef CONFIG_HEARTBEAT
mach_heartbeat = atari_heartbeat; mach_heartbeat = atari_heartbeat;
#endif #endif
/* Set switches as requested by the user */ /* Set switches as requested by the user */
if (atari_switches & ATARI_SWITCH_IKBD) if (atari_switches & ATARI_SWITCH_IKBD)
acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID; acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID;
if (atari_switches & ATARI_SWITCH_MIDI) if (atari_switches & ATARI_SWITCH_MIDI)
acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID; acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID;
if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) { if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) {
sound_ym.rd_data_reg_sel = 14; sound_ym.rd_data_reg_sel = 14;
sound_ym.wd_data = sound_ym.rd_data_reg_sel | sound_ym.wd_data = sound_ym.rd_data_reg_sel |
((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) | ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) |
((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0); ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0);
} }
/* ++bjoern:
* Determine hardware present
*/
printk( "Atari hardware found: " ); /* ++bjoern:
if (MACH_IS_MEDUSA || MACH_IS_HADES) { * Determine hardware present
/* There's no Atari video hardware on the Medusa, but all the */
* addresses below generate a DTACK so no bus error occurs! */
} printk("Atari hardware found: ");
else if (hwreg_present( f030_xreg )) { if (MACH_IS_MEDUSA || MACH_IS_HADES) {
ATARIHW_SET(VIDEL_SHIFTER); /* There's no Atari video hardware on the Medusa, but all the
printk( "VIDEL " ); * addresses below generate a DTACK so no bus error occurs! */
/* This is a temporary hack: If there is Falcon video } else if (hwreg_present(f030_xreg)) {
* hardware, we assume that the ST-DMA serves SCSI instead of ATARIHW_SET(VIDEL_SHIFTER);
* ACSI. In the future, there should be a better method for printk("VIDEL ");
* this... /* This is a temporary hack: If there is Falcon video
*/ * hardware, we assume that the ST-DMA serves SCSI instead of
ATARIHW_SET(ST_SCSI); * ACSI. In the future, there should be a better method for
printk( "STDMA-SCSI " ); * this...
} */
else if (hwreg_present( tt_palette )) { ATARIHW_SET(ST_SCSI);
ATARIHW_SET(TT_SHIFTER); printk("STDMA-SCSI ");
printk( "TT_SHIFTER " ); } else if (hwreg_present(tt_palette)) {
} ATARIHW_SET(TT_SHIFTER);
else if (hwreg_present( &shifter.bas_hi )) { printk("TT_SHIFTER ");
if (hwreg_present( &shifter.bas_lo ) && } else if (hwreg_present(&shifter.bas_hi)) {
(shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) { if (hwreg_present(&shifter.bas_lo) &&
ATARIHW_SET(EXTD_SHIFTER); (shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) {
printk( "EXTD_SHIFTER " ); ATARIHW_SET(EXTD_SHIFTER);
} printk("EXTD_SHIFTER ");
else { } else {
ATARIHW_SET(STND_SHIFTER); ATARIHW_SET(STND_SHIFTER);
printk( "STND_SHIFTER " ); printk("STND_SHIFTER ");
} }
} }
if (hwreg_present( &mfp.par_dt_reg )) { if (hwreg_present(&mfp.par_dt_reg)) {
ATARIHW_SET(ST_MFP); ATARIHW_SET(ST_MFP);
printk( "ST_MFP " ); printk("ST_MFP ");
} }
if (hwreg_present( &tt_mfp.par_dt_reg )) { if (hwreg_present(&tt_mfp.par_dt_reg)) {
ATARIHW_SET(TT_MFP); ATARIHW_SET(TT_MFP);
printk( "TT_MFP " ); printk("TT_MFP ");
} }
if (hwreg_present( &tt_scsi_dma.dma_addr_hi )) { if (hwreg_present(&tt_scsi_dma.dma_addr_hi)) {
ATARIHW_SET(SCSI_DMA); ATARIHW_SET(SCSI_DMA);
printk( "TT_SCSI_DMA " ); printk("TT_SCSI_DMA ");
} }
if (!MACH_IS_HADES && hwreg_present( &st_dma.dma_hi )) { if (!MACH_IS_HADES && hwreg_present(&st_dma.dma_hi)) {
ATARIHW_SET(STND_DMA); ATARIHW_SET(STND_DMA);
printk( "STND_DMA " ); printk("STND_DMA ");
} }
if (MACH_IS_MEDUSA || /* The ST-DMA address registers aren't readable /*
* on all Medusas, so the test below may fail */ * The ST-DMA address registers aren't readable
(hwreg_present( &st_dma.dma_vhi ) && * on all Medusas, so the test below may fail
(st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) && */
st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa && if (MACH_IS_MEDUSA ||
(st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) && (hwreg_present(&st_dma.dma_vhi) &&
st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) { (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) &&
ATARIHW_SET(EXTD_DMA); st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa &&
printk( "EXTD_DMA " ); (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) &&
} st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) {
if (hwreg_present( &tt_scsi.scsi_data )) { ATARIHW_SET(EXTD_DMA);
ATARIHW_SET(TT_SCSI); printk("EXTD_DMA ");
printk( "TT_SCSI " ); }
} if (hwreg_present(&tt_scsi.scsi_data)) {
if (hwreg_present( &sound_ym.rd_data_reg_sel )) { ATARIHW_SET(TT_SCSI);
ATARIHW_SET(YM_2149); printk("TT_SCSI ");
printk( "YM2149 " ); }
} if (hwreg_present(&sound_ym.rd_data_reg_sel)) {
if (!MACH_IS_MEDUSA && !MACH_IS_HADES && ATARIHW_SET(YM_2149);
hwreg_present( &tt_dmasnd.ctrl )) { printk("YM2149 ");
ATARIHW_SET(PCM_8BIT); }
printk( "PCM " ); if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
} hwreg_present(&tt_dmasnd.ctrl)) {
if (!MACH_IS_HADES && hwreg_present( &falcon_codec.unused5 )) { ATARIHW_SET(PCM_8BIT);
ATARIHW_SET(CODEC); printk("PCM ");
printk( "CODEC " ); }
} if (!MACH_IS_HADES && hwreg_present(&falcon_codec.unused5)) {
if (hwreg_present( &dsp56k_host_interface.icr )) { ATARIHW_SET(CODEC);
ATARIHW_SET(DSP56K); printk("CODEC ");
printk( "DSP56K " ); }
} if (hwreg_present(&dsp56k_host_interface.icr)) {
if (hwreg_present( &tt_scc_dma.dma_ctrl ) && ATARIHW_SET(DSP56K);
printk("DSP56K ");
}
if (hwreg_present(&tt_scc_dma.dma_ctrl) &&
#if 0 #if 0
/* This test sucks! Who knows some better? */ /* This test sucks! Who knows some better? */
(tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) && (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) &&
(tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0) (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0)
#else #else
!MACH_IS_MEDUSA && !MACH_IS_HADES !MACH_IS_MEDUSA && !MACH_IS_HADES
#endif #endif
) { ) {
ATARIHW_SET(SCC_DMA); ATARIHW_SET(SCC_DMA);
printk( "SCC_DMA " ); printk("SCC_DMA ");
} }
if (scc_test( &scc.cha_a_ctrl )) { if (scc_test(&scc.cha_a_ctrl)) {
ATARIHW_SET(SCC); ATARIHW_SET(SCC);
printk( "SCC " ); printk("SCC ");
} }
if (scc_test( &st_escc.cha_b_ctrl )) { if (scc_test(&st_escc.cha_b_ctrl)) {
ATARIHW_SET( ST_ESCC ); ATARIHW_SET(ST_ESCC);
printk( "ST_ESCC " ); printk("ST_ESCC ");
} }
if (MACH_IS_HADES) if (MACH_IS_HADES) {
{ ATARIHW_SET(VME);
ATARIHW_SET( VME ); printk("VME ");
printk( "VME " ); } else if (hwreg_present(&tt_scu.sys_mask)) {
} ATARIHW_SET(SCU);
else if (hwreg_present( &tt_scu.sys_mask )) { /* Assume a VME bus if there's a SCU */
ATARIHW_SET(SCU); ATARIHW_SET(VME);
/* Assume a VME bus if there's a SCU */ printk("VME SCU ");
ATARIHW_SET( VME ); }
printk( "VME SCU " ); if (hwreg_present((void *)(0xffff9210))) {
} ATARIHW_SET(ANALOG_JOY);
if (hwreg_present( (void *)(0xffff9210) )) { printk("ANALOG_JOY ");
ATARIHW_SET(ANALOG_JOY); }
printk( "ANALOG_JOY " ); if (!MACH_IS_HADES && hwreg_present(blitter.halftone)) {
} ATARIHW_SET(BLITTER);
if (!MACH_IS_HADES && hwreg_present( blitter.halftone )) { printk("BLITTER ");
ATARIHW_SET(BLITTER); }
printk( "BLITTER " ); if (hwreg_present((void *)0xfff00039)) {
} ATARIHW_SET(IDE);
if (hwreg_present((void *)0xfff00039)) { printk("IDE ");
ATARIHW_SET(IDE); }
printk( "IDE " );
}
#if 1 /* This maybe wrong */ #if 1 /* This maybe wrong */
if (!MACH_IS_MEDUSA && !MACH_IS_HADES && if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
hwreg_present( &tt_microwire.data ) && hwreg_present(&tt_microwire.data) &&
hwreg_present( &tt_microwire.mask ) && hwreg_present(&tt_microwire.mask) &&
(tt_microwire.mask = 0x7ff, (tt_microwire.mask = 0x7ff,
udelay(1), udelay(1),
tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR, tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR,
udelay(1), udelay(1),
tt_microwire.data != 0)) { tt_microwire.data != 0)) {
ATARIHW_SET(MICROWIRE); ATARIHW_SET(MICROWIRE);
while (tt_microwire.mask != 0x7ff) ; while (tt_microwire.mask != 0x7ff)
printk( "MICROWIRE " ); ;
} printk("MICROWIRE ");
}
#endif #endif
if (hwreg_present( &tt_rtc.regsel )) { if (hwreg_present(&tt_rtc.regsel)) {
ATARIHW_SET(TT_CLK); ATARIHW_SET(TT_CLK);
printk( "TT_CLK " ); printk("TT_CLK ");
mach_hwclk = atari_tt_hwclk; mach_hwclk = atari_tt_hwclk;
mach_set_clock_mmss = atari_tt_set_clock_mmss; mach_set_clock_mmss = atari_tt_set_clock_mmss;
} }
if (!MACH_IS_HADES && hwreg_present( &mste_rtc.sec_ones)) { if (!MACH_IS_HADES && hwreg_present(&mste_rtc.sec_ones)) {
ATARIHW_SET(MSTE_CLK); ATARIHW_SET(MSTE_CLK);
printk( "MSTE_CLK "); printk("MSTE_CLK ");
mach_hwclk = atari_mste_hwclk; mach_hwclk = atari_mste_hwclk;
mach_set_clock_mmss = atari_mste_set_clock_mmss; mach_set_clock_mmss = atari_mste_set_clock_mmss;
} }
if (!MACH_IS_MEDUSA && !MACH_IS_HADES && if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
hwreg_present( &dma_wd.fdc_speed ) && hwreg_present(&dma_wd.fdc_speed) &&
hwreg_write( &dma_wd.fdc_speed, 0 )) { hwreg_write(&dma_wd.fdc_speed, 0)) {
ATARIHW_SET(FDCSPEED); ATARIHW_SET(FDCSPEED);
printk( "FDC_SPEED "); printk("FDC_SPEED ");
} }
if (!MACH_IS_HADES && !ATARIHW_PRESENT(ST_SCSI)) { if (!MACH_IS_HADES && !ATARIHW_PRESENT(ST_SCSI)) {
ATARIHW_SET(ACSI); ATARIHW_SET(ACSI);
printk( "ACSI " ); printk("ACSI ");
} }
printk("\n"); printk("\n");
if (CPU_IS_040_OR_060) if (CPU_IS_040_OR_060)
/* Now it seems to be safe to turn of the tt0 transparent /* Now it seems to be safe to turn of the tt0 transparent
* translation (the one that must not be turned off in * translation (the one that must not be turned off in
* head.S...) * head.S...)
*/ */
__asm__ volatile ("moveq #0,%/d0\n\t" asm volatile ("\n"
".chip 68040\n\t" " moveq #0,%%d0\n"
"movec %%d0,%%itt0\n\t" " .chip 68040\n"
"movec %%d0,%%dtt0\n\t" " movec %%d0,%%itt0\n"
".chip 68k" " movec %%d0,%%dtt0\n"
: /* no outputs */ " .chip 68k"
: /* no inputs */ : /* no outputs */
: "d0"); : /* no inputs */
: "d0");
/* allocator for memory that must reside in st-ram */
atari_stram_init (); /* allocator for memory that must reside in st-ram */
atari_stram_init();
/* Set up a mapping for the VMEbus address region:
* /* Set up a mapping for the VMEbus address region:
* VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff *
* (MegaSTE) In both cases, the whole 16 MB chunk is mapped at * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff
* 0xfe000000 virt., because this can be done with a single * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at
* transparent translation. On the 68040, lots of often unused * 0xfe000000 virt., because this can be done with a single
* page tables would be needed otherwise. On a MegaSTE or similar, * transparent translation. On the 68040, lots of often unused
* the highest byte is stripped off by hardware due to the 24 bit * page tables would be needed otherwise. On a MegaSTE or similar,
* design of the bus. * the highest byte is stripped off by hardware due to the 24 bit
*/ * design of the bus.
*/
if (CPU_IS_020_OR_030) {
unsigned long tt1_val;
tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache
* inhibit, read and write, FDC mask = 3,
* FDC val = 4 -> Supervisor only */
asm volatile ("\n"
" .chip 68030\n"
" pmove %0@,%/tt1\n"
" .chip 68k"
: : "a" (&tt1_val));
} else {
asm volatile ("\n"
" .chip 68040\n"
" movec %0,%%itt1\n"
" movec %0,%%dtt1\n"
" .chip 68k"
:
: "d" (0xfe00a040)); /* Translate 0xfexxxxxx, enable,
* supervisor only, non-cacheable/
* serialized, writable */
}
if (CPU_IS_020_OR_030) { /* Fetch tos version at Physical 2 */
unsigned long tt1_val; /*
tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache * We my not be able to access this address if the kernel is
* inhibit, read and write, FDC mask = 3, * loaded to st ram, since the first page is unmapped. On the
* FDC val = 4 -> Supervisor only */ * Medusa this is always the case and there is nothing we can do
__asm__ __volatile__ ( ".chip 68030\n\t" * about this, so we just assume the smaller offset. For the TT
"pmove %0@,%/tt1\n\t" * we use the fact that in head.S we have set up a mapping
".chip 68k" * 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible
: : "a" (&tt1_val) ); * in the last 16MB of the address space.
} */
else { tos_version = (MACH_IS_MEDUSA || MACH_IS_HADES) ?
__asm__ __volatile__ 0xfff : *(unsigned short *)0xff000002;
( "movel %0,%/d0\n\t" atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68;
".chip 68040\n\t"
"movec %%d0,%%itt1\n\t"
"movec %%d0,%%dtt1\n\t"
".chip 68k"
:
: "g" (0xfe00a040) /* Translate 0xfexxxxxx, enable,
* supervisor only, non-cacheable/
* serialized, writable */
: "d0" );
}
/* Fetch tos version at Physical 2 */
/* We my not be able to access this address if the kernel is
loaded to st ram, since the first page is unmapped. On the
Medusa this is always the case and there is nothing we can do
about this, so we just assume the smaller offset. For the TT
we use the fact that in head.S we have set up a mapping
0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible
in the last 16MB of the address space. */
tos_version = (MACH_IS_MEDUSA || MACH_IS_HADES) ?
0xfff : *(unsigned short *)0xff000002;
atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68;
} }
#ifdef CONFIG_HEARTBEAT #ifdef CONFIG_HEARTBEAT
static void atari_heartbeat( int on ) static void atari_heartbeat(int on)
{ {
unsigned char tmp; unsigned char tmp;
unsigned long flags; unsigned long flags;
if (atari_dont_touch_floppy_select) if (atari_dont_touch_floppy_select)
return; return;
local_irq_save(flags); local_irq_save(flags);
sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */ sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */
tmp = sound_ym.rd_data_reg_sel; tmp = sound_ym.rd_data_reg_sel;
sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02); sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02);
local_irq_restore(flags); local_irq_restore(flags);
} }
#endif #endif
...@@ -526,180 +490,171 @@ static void atari_heartbeat( int on ) ...@@ -526,180 +490,171 @@ static void atari_heartbeat( int on )
/* ++andreas: no need for complicated code, just depend on prefetch */ /* ++andreas: no need for complicated code, just depend on prefetch */
static void atari_reset (void) static void atari_reset(void)
{ {
long tc_val = 0; long tc_val = 0;
long reset_addr; long reset_addr;
/* On the Medusa, phys. 0x4 may contain garbage because it's no /*
ROM. See above for explanation why we cannot use PTOV(4). */ * On the Medusa, phys. 0x4 may contain garbage because it's no
reset_addr = MACH_IS_HADES ? 0x7fe00030 : * ROM. See above for explanation why we cannot use PTOV(4).
MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 : */
*(unsigned long *) 0xff000004; reset_addr = MACH_IS_HADES ? 0x7fe00030 :
MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 :
/* reset ACIA for switch off OverScan, if it's active */ *(unsigned long *) 0xff000004;
if (atari_switches & ATARI_SWITCH_OVSC_IKBD)
acia.key_ctrl = ACIA_RESET; /* reset ACIA for switch off OverScan, if it's active */
if (atari_switches & ATARI_SWITCH_OVSC_MIDI) if (atari_switches & ATARI_SWITCH_OVSC_IKBD)
acia.mid_ctrl = ACIA_RESET; acia.key_ctrl = ACIA_RESET;
if (atari_switches & ATARI_SWITCH_OVSC_MIDI)
/* processor independent: turn off interrupts and reset the VBR; acia.mid_ctrl = ACIA_RESET;
* the caches must be left enabled, else prefetching the final jump
* instruction doesn't work. */ /* processor independent: turn off interrupts and reset the VBR;
local_irq_disable(); * the caches must be left enabled, else prefetching the final jump
__asm__ __volatile__ * instruction doesn't work.
("moveq #0,%/d0\n\t" */
"movec %/d0,%/vbr" local_irq_disable();
: : : "d0" ); asm volatile ("movec %0,%%vbr"
: : "d" (0));
if (CPU_IS_040_OR_060) {
unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); if (CPU_IS_040_OR_060) {
if (CPU_IS_060) { unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
/* 68060: clear PCR to turn off superscalar operation */ if (CPU_IS_060) {
__asm__ __volatile__ /* 68060: clear PCR to turn off superscalar operation */
("moveq #0,%/d0\n\t" asm volatile ("\n"
".chip 68060\n\t" " .chip 68060\n"
"movec %%d0,%%pcr\n\t" " movec %0,%%pcr\n"
".chip 68k" " .chip 68k"
: : : "d0" ); : : "d" (0));
} }
__asm__ __volatile__ asm volatile ("\n"
("movel %0,%/d0\n\t" " move.l %0,%%d0\n"
"andl #0xff000000,%/d0\n\t" " and.l #0xff000000,%%d0\n"
"orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */ " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */
".chip 68040\n\t" " .chip 68040\n"
"movec %%d0,%%itt0\n\t" " movec %%d0,%%itt0\n"
"movec %%d0,%%dtt0\n\t" " movec %%d0,%%dtt0\n"
".chip 68k\n\t" " .chip 68k\n"
"jmp %0@\n\t" " jmp %0@"
: /* no outputs */ : : "a" (jmp_addr040)
: "a" (jmp_addr040) : "d0");
: "d0" ); jmp_addr_label040:
jmp_addr_label040: asm volatile ("\n"
__asm__ __volatile__ " moveq #0,%%d0\n"
("moveq #0,%/d0\n\t" " nop\n"
"nop\n\t" " .chip 68040\n"
".chip 68040\n\t" " cinva %%bc\n"
"cinva %%bc\n\t" " nop\n"
"nop\n\t" " pflusha\n"
"pflusha\n\t" " nop\n"
"nop\n\t" " movec %%d0,%%tc\n"
"movec %%d0,%%tc\n\t" " nop\n"
"nop\n\t" /* the following setup of transparent translations is needed on the
/* the following setup of transparent translations is needed on the * Afterburner040 to successfully reboot. Other machines shouldn't
* Afterburner040 to successfully reboot. Other machines shouldn't * care about a different tt regs setup, they also didn't care in
* care about a different tt regs setup, they also didn't care in * the past that the regs weren't turned off. */
* the past that the regs weren't turned off. */ " move.l #0xffc000,%%d0\n" /* whole insn space cacheable */
"movel #0xffc000,%%d0\n\t" /* whole insn space cacheable */ " movec %%d0,%%itt0\n"
"movec %%d0,%%itt0\n\t" " movec %%d0,%%itt1\n"
"movec %%d0,%%itt1\n\t" " or.w #0x40,%/d0\n" /* whole data space non-cacheable/ser. */
"orw #0x40,%/d0\n\t" /* whole data space non-cacheable/ser. */ " movec %%d0,%%dtt0\n"
"movec %%d0,%%dtt0\n\t" " movec %%d0,%%dtt1\n"
"movec %%d0,%%dtt1\n\t" " .chip 68k\n"
".chip 68k\n\t" " jmp %0@"
"jmp %0@" : /* no outputs */
: /* no outputs */ : "a" (reset_addr)
: "a" (reset_addr) : "d0");
: "d0"); } else
} asm volatile ("\n"
else " pmove %0@,%%tc\n"
__asm__ __volatile__ " jmp %1@"
("pmove %0@,%/tc\n\t" : /* no outputs */
"jmp %1@" : "a" (&tc_val), "a" (reset_addr));
: /* no outputs */
: "a" (&tc_val), "a" (reset_addr));
} }
static void atari_get_model(char *model) static void atari_get_model(char *model)
{ {
strcpy(model, "Atari "); strcpy(model, "Atari ");
switch (atari_mch_cookie >> 16) { switch (atari_mch_cookie >> 16) {
case ATARI_MCH_ST: case ATARI_MCH_ST:
if (ATARIHW_PRESENT(MSTE_CLK)) if (ATARIHW_PRESENT(MSTE_CLK))
strcat (model, "Mega ST"); strcat(model, "Mega ST");
else else
strcat (model, "ST"); strcat(model, "ST");
break; break;
case ATARI_MCH_STE: case ATARI_MCH_STE:
if (MACH_IS_MSTE) if (MACH_IS_MSTE)
strcat (model, "Mega STE"); strcat(model, "Mega STE");
else else
strcat (model, "STE"); strcat(model, "STE");
break; break;
case ATARI_MCH_TT: case ATARI_MCH_TT:
if (MACH_IS_MEDUSA) if (MACH_IS_MEDUSA)
/* Medusa has TT _MCH cookie */ /* Medusa has TT _MCH cookie */
strcat (model, "Medusa"); strcat(model, "Medusa");
else if (MACH_IS_HADES) else if (MACH_IS_HADES)
strcat(model, "Hades"); strcat(model, "Hades");
else else
strcat (model, "TT"); strcat(model, "TT");
break; break;
case ATARI_MCH_FALCON: case ATARI_MCH_FALCON:
strcat (model, "Falcon"); strcat(model, "Falcon");
if (MACH_IS_AB40) if (MACH_IS_AB40)
strcat (model, " (with Afterburner040)"); strcat(model, " (with Afterburner040)");
break; break;
default: default:
sprintf (model + strlen (model), "(unknown mach cookie 0x%lx)", sprintf(model + strlen(model), "(unknown mach cookie 0x%lx)",
atari_mch_cookie); atari_mch_cookie);
break; break;
} }
} }
static int atari_get_hardware_list(char *buffer) static int atari_get_hardware_list(char *buffer)
{ {
int len = 0, i; int len = 0, i;
for (i = 0; i < m68k_num_memory; i++) for (i = 0; i < m68k_num_memory; i++)
len += sprintf (buffer+len, "\t%3ld MB at 0x%08lx (%s)\n", len += sprintf(buffer+len, "\t%3ld MB at 0x%08lx (%s)\n",
m68k_memory[i].size >> 20, m68k_memory[i].addr, m68k_memory[i].size >> 20, m68k_memory[i].addr,
(m68k_memory[i].addr & 0xff000000 ? (m68k_memory[i].addr & 0xff000000 ?
"alternate RAM" : "ST-RAM")); "alternate RAM" : "ST-RAM"));
#define ATARIHW_ANNOUNCE(name,str) \ #define ATARIHW_ANNOUNCE(name, str) \
if (ATARIHW_PRESENT(name)) \ if (ATARIHW_PRESENT(name)) \
len += sprintf (buffer + len, "\t%s\n", str) len += sprintf(buffer + len, "\t%s\n", str)
len += sprintf (buffer + len, "Detected hardware:\n"); len += sprintf(buffer + len, "Detected hardware:\n");
ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter"); ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter");
ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter"); ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter");
ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter"); ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter");
ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter"); ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter");
ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator"); ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator");
ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound"); ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound");
ATARIHW_ANNOUNCE(CODEC, "CODEC Sound"); ATARIHW_ANNOUNCE(CODEC, "CODEC Sound");
ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)"); ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)");
ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)"); ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)");
ATARIHW_ANNOUNCE(ACSI, "ACSI Interface"); ATARIHW_ANNOUNCE(ACSI, "ACSI Interface");
ATARIHW_ANNOUNCE(IDE, "IDE Interface"); ATARIHW_ANNOUNCE(IDE, "IDE Interface");
ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC"); ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC");
ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901"); ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901");
ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901"); ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901");
ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530"); ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530");
ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230"); ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230");
ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface"); ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface");
ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface"); ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface");
ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)"); ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)");
ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)"); ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)");
ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380"); ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380");
ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC"); ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC");
ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A"); ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A");
ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15"); ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15");
ATARIHW_ANNOUNCE(SCU, "System Control Unit"); ATARIHW_ANNOUNCE(SCU, "System Control Unit");
ATARIHW_ANNOUNCE(BLITTER, "Blitter"); ATARIHW_ANNOUNCE(BLITTER, "Blitter");
ATARIHW_ANNOUNCE(VME, "VME Bus"); ATARIHW_ANNOUNCE(VME, "VME Bus");
ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor");
return(len); return len;
} }
/*
* Local variables:
* c-indent-level: 4
* tab-width: 8
* End:
*/
...@@ -30,317 +30,311 @@ int atari_SCC_init_done; ...@@ -30,317 +30,311 @@ int atari_SCC_init_done;
int atari_SCC_reset_done; int atari_SCC_reset_done;
static struct console atari_console_driver = { static struct console atari_console_driver = {
.name = "debug", .name = "debug",
.flags = CON_PRINTBUFFER, .flags = CON_PRINTBUFFER,
.index = -1, .index = -1,
}; };
static inline void ata_mfp_out (char c) static inline void ata_mfp_out(char c)
{ {
while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */ while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */
barrier (); barrier();
mfp.usart_dta = c; mfp.usart_dta = c;
} }
void atari_mfp_console_write (struct console *co, const char *str, void atari_mfp_console_write(struct console *co, const char *str,
unsigned int count) unsigned int count)
{ {
while (count--) { while (count--) {
if (*str == '\n') if (*str == '\n')
ata_mfp_out( '\r' ); ata_mfp_out('\r');
ata_mfp_out( *str++ ); ata_mfp_out(*str++);
} }
} }
static inline void ata_scc_out (char c) static inline void ata_scc_out(char c)
{ {
do { do {
MFPDELAY();
} while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */
MFPDELAY(); MFPDELAY();
} while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ scc.cha_b_data = c;
MFPDELAY();
scc.cha_b_data = c;
} }
void atari_scc_console_write (struct console *co, const char *str, void atari_scc_console_write(struct console *co, const char *str,
unsigned int count) unsigned int count)
{ {
while (count--) { while (count--) {
if (*str == '\n') if (*str == '\n')
ata_scc_out( '\r' ); ata_scc_out('\r');
ata_scc_out( *str++ ); ata_scc_out(*str++);
} }
} }
static inline void ata_midi_out (char c) static inline void ata_midi_out(char c)
{ {
while (!(acia.mid_ctrl & ACIA_TDRE)) /* wait for tx buf empty */ while (!(acia.mid_ctrl & ACIA_TDRE)) /* wait for tx buf empty */
barrier (); barrier();
acia.mid_data = c; acia.mid_data = c;
} }
void atari_midi_console_write (struct console *co, const char *str, void atari_midi_console_write(struct console *co, const char *str,
unsigned int count) unsigned int count)
{ {
while (count--) { while (count--) {
if (*str == '\n') if (*str == '\n')
ata_midi_out( '\r' ); ata_midi_out('\r');
ata_midi_out( *str++ ); ata_midi_out(*str++);
} }
} }
static int ata_par_out (char c) static int ata_par_out(char c)
{ {
unsigned char tmp; unsigned char tmp;
/* This a some-seconds timeout in case no printer is connected */ /* This a some-seconds timeout in case no printer is connected */
unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ; unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ;
while( (mfp.par_dt_reg & 1) && --i ) /* wait for BUSY == L */ while ((mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */
; ;
if (!i) return( 0 ); if (!i)
return 0;
sound_ym.rd_data_reg_sel = 15; /* select port B */
sound_ym.wd_data = c; /* put char onto port */ sound_ym.rd_data_reg_sel = 15; /* select port B */
sound_ym.rd_data_reg_sel = 14; /* select port A */ sound_ym.wd_data = c; /* put char onto port */
tmp = sound_ym.rd_data_reg_sel; sound_ym.rd_data_reg_sel = 14; /* select port A */
sound_ym.wd_data = tmp & ~0x20; /* set strobe L */ tmp = sound_ym.rd_data_reg_sel;
MFPDELAY(); /* wait a bit */ sound_ym.wd_data = tmp & ~0x20; /* set strobe L */
sound_ym.wd_data = tmp | 0x20; /* set strobe H */ MFPDELAY(); /* wait a bit */
return( 1 ); sound_ym.wd_data = tmp | 0x20; /* set strobe H */
return 1;
} }
static void atari_par_console_write (struct console *co, const char *str, static void atari_par_console_write(struct console *co, const char *str,
unsigned int count) unsigned int count)
{ {
static int printer_present = 1; static int printer_present = 1;
if (!printer_present)
return;
while (count--) { if (!printer_present)
if (*str == '\n')
if (!ata_par_out( '\r' )) {
printer_present = 0;
return; return;
}
if (!ata_par_out( *str++ )) { while (count--) {
printer_present = 0; if (*str == '\n') {
return; if (!ata_par_out('\r')) {
printer_present = 0;
return;
}
}
if (!ata_par_out(*str++)) {
printer_present = 0;
return;
}
} }
}
} }
#ifdef CONFIG_SERIAL_CONSOLE #ifdef CONFIG_SERIAL_CONSOLE
int atari_mfp_console_wait_key(struct console *co) int atari_mfp_console_wait_key(struct console *co)
{ {
while( !(mfp.rcv_stat & 0x80) ) /* wait for rx buf filled */ while (!(mfp.rcv_stat & 0x80)) /* wait for rx buf filled */
barrier(); barrier();
return( mfp.usart_dta ); return mfp.usart_dta;
} }
int atari_scc_console_wait_key(struct console *co) int atari_scc_console_wait_key(struct console *co)
{ {
do { do {
MFPDELAY();
} while (!(scc.cha_b_ctrl & 0x01)); /* wait for rx buf filled */
MFPDELAY(); MFPDELAY();
} while( !(scc.cha_b_ctrl & 0x01) ); /* wait for rx buf filled */ return scc.cha_b_data;
MFPDELAY();
return( scc.cha_b_data );
} }
int atari_midi_console_wait_key(struct console *co) int atari_midi_console_wait_key(struct console *co)
{ {
while( !(acia.mid_ctrl & ACIA_RDRF) ) /* wait for rx buf filled */ while (!(acia.mid_ctrl & ACIA_RDRF)) /* wait for rx buf filled */
barrier(); barrier();
return( acia.mid_data ); return acia.mid_data;
} }
#endif #endif
/* The following two functions do a quick'n'dirty initialization of the MFP or /*
* The following two functions do a quick'n'dirty initialization of the MFP or
* SCC serial ports. They're used by the debugging interface, kgdb, and the * SCC serial ports. They're used by the debugging interface, kgdb, and the
* serial console code. */ * serial console code.
*/
#ifndef CONFIG_SERIAL_CONSOLE #ifndef CONFIG_SERIAL_CONSOLE
static void __init atari_init_mfp_port( int cflag ) static void __init atari_init_mfp_port(int cflag)
#else #else
void atari_init_mfp_port( int cflag ) void atari_init_mfp_port(int cflag)
#endif #endif
{ {
/* timer values for 1200...115200 bps; > 38400 select 110, 134, or 150 /*
* bps, resp., and work only correct if there's a RSVE or RSSPEED */ * timer values for 1200...115200 bps; > 38400 select 110, 134, or 150
static int baud_table[9] = { 16, 11, 8, 4, 2, 1, 175, 143, 128 }; * bps, resp., and work only correct if there's a RSVE or RSSPEED
int baud = cflag & CBAUD; */
int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x04 : 0x06) : 0; static int baud_table[9] = { 16, 11, 8, 4, 2, 1, 175, 143, 128 };
int csize = ((cflag & CSIZE) == CS7) ? 0x20 : 0x00; int baud = cflag & CBAUD;
int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x04 : 0x06) : 0;
if (cflag & CBAUDEX) int csize = ((cflag & CSIZE) == CS7) ? 0x20 : 0x00;
baud += B38400;
if (baud < B1200 || baud > B38400+2) if (cflag & CBAUDEX)
baud = B9600; /* use default 9600bps for non-implemented rates */ baud += B38400;
baud -= B1200; /* baud_table[] starts at 1200bps */ if (baud < B1200 || baud > B38400+2)
baud = B9600; /* use default 9600bps for non-implemented rates */
mfp.trn_stat &= ~0x01; /* disable TX */ baud -= B1200; /* baud_table[] starts at 1200bps */
mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */
mfp.tim_ct_cd &= 0x70; /* stop timer D */ mfp.trn_stat &= ~0x01; /* disable TX */
mfp.tim_dt_d = baud_table[baud]; mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */
mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ mfp.tim_ct_cd &= 0x70; /* stop timer D */
mfp.trn_stat |= 0x01; /* enable TX */ mfp.tim_dt_d = baud_table[baud];
mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */
atari_MFP_init_done = 1; mfp.trn_stat |= 0x01; /* enable TX */
atari_MFP_init_done = 1;
} }
#define SCC_WRITE(reg,val) \ #define SCC_WRITE(reg, val) \
do { \ do { \
scc.cha_b_ctrl = (reg); \ scc.cha_b_ctrl = (reg); \
MFPDELAY(); \ MFPDELAY(); \
scc.cha_b_ctrl = (val); \ scc.cha_b_ctrl = (val); \
MFPDELAY(); \ MFPDELAY(); \
} while(0) } while (0)
/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a /* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a
* delay of ~ 60us. */ * delay of ~ 60us. */
#define LONG_DELAY() \ #define LONG_DELAY() \
do { \ do { \
int i; \ int i; \
for( i = 100; i > 0; --i ) \ for (i = 100; i > 0; --i) \
MFPDELAY(); \ MFPDELAY(); \
} while(0) } while (0)
#ifndef CONFIG_SERIAL_CONSOLE #ifndef CONFIG_SERIAL_CONSOLE
static void __init atari_init_scc_port( int cflag ) static void __init atari_init_scc_port(int cflag)
#else #else
void atari_init_scc_port( int cflag ) void atari_init_scc_port(int cflag)
#endif #endif
{ {
extern int atari_SCC_reset_done; extern int atari_SCC_reset_done;
static int clksrc_table[9] = static int clksrc_table[9] =
/* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */ /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */
{ 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 }; { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 };
static int brgsrc_table[9] = static int brgsrc_table[9] =
/* reg 14: 0 = RTxC, 2 = PCLK */ /* reg 14: 0 = RTxC, 2 = PCLK */
{ 2, 2, 2, 2, 2, 2, 0, 2, 2 }; { 2, 2, 2, 2, 2, 2, 0, 2, 2 };
static int clkmode_table[9] = static int clkmode_table[9] =
/* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */ /* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */
{ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 }; { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 };
static int div_table[9] = static int div_table[9] =
/* reg12 (BRG low) */ /* reg12 (BRG low) */
{ 208, 138, 103, 50, 24, 11, 1, 0, 0 }; { 208, 138, 103, 50, 24, 11, 1, 0, 0 };
int baud = cflag & CBAUD; int baud = cflag & CBAUD;
int clksrc, clkmode, div, reg3, reg5; int clksrc, clkmode, div, reg3, reg5;
if (cflag & CBAUDEX) if (cflag & CBAUDEX)
baud += B38400; baud += B38400;
if (baud < B1200 || baud > B38400+2) if (baud < B1200 || baud > B38400+2)
baud = B9600; /* use default 9600bps for non-implemented rates */ baud = B9600; /* use default 9600bps for non-implemented rates */
baud -= B1200; /* tables starts at 1200bps */ baud -= B1200; /* tables starts at 1200bps */
clksrc = clksrc_table[baud]; clksrc = clksrc_table[baud];
clkmode = clkmode_table[baud]; clkmode = clkmode_table[baud];
div = div_table[baud]; div = div_table[baud];
if (ATARIHW_PRESENT(TT_MFP) && baud >= 6) { if (ATARIHW_PRESENT(TT_MFP) && baud >= 6) {
/* special treatment for TT, where rates >= 38400 are done via TRxC */ /* special treatment for TT, where rates >= 38400 are done via TRxC */
clksrc = 0x28; /* TRxC */ clksrc = 0x28; /* TRxC */
clkmode = baud == 6 ? 0xc0 : clkmode = baud == 6 ? 0xc0 :
baud == 7 ? 0x80 : /* really 76800bps */ baud == 7 ? 0x80 : /* really 76800bps */
0x40; /* really 153600bps */ 0x40; /* really 153600bps */
div = 0; div = 0;
} }
reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40; reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40;
reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */; reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */;
(void)scc.cha_b_ctrl; /* reset reg pointer */ (void)scc.cha_b_ctrl; /* reset reg pointer */
SCC_WRITE( 9, 0xc0 ); /* reset */ SCC_WRITE(9, 0xc0); /* reset */
LONG_DELAY(); /* extra delay after WR9 access */ LONG_DELAY(); /* extra delay after WR9 access */
SCC_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | SCC_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03)
0x04 /* 1 stopbit */ | : 0 | 0x04 /* 1 stopbit */ | clkmode);
clkmode ); SCC_WRITE(3, reg3);
SCC_WRITE( 3, reg3 ); SCC_WRITE(5, reg5);
SCC_WRITE( 5, reg5 ); SCC_WRITE(9, 0); /* no interrupts */
SCC_WRITE( 9, 0 ); /* no interrupts */ LONG_DELAY(); /* extra delay after WR9 access */
LONG_DELAY(); /* extra delay after WR9 access */ SCC_WRITE(10, 0); /* NRZ mode */
SCC_WRITE( 10, 0 ); /* NRZ mode */ SCC_WRITE(11, clksrc); /* main clock source */
SCC_WRITE( 11, clksrc ); /* main clock source */ SCC_WRITE(12, div); /* BRG value */
SCC_WRITE( 12, div ); /* BRG value */ SCC_WRITE(13, 0); /* BRG high byte */
SCC_WRITE( 13, 0 ); /* BRG high byte */ SCC_WRITE(14, brgsrc_table[baud]);
SCC_WRITE( 14, brgsrc_table[baud] ); SCC_WRITE(14, brgsrc_table[baud] | (div ? 1 : 0));
SCC_WRITE( 14, brgsrc_table[baud] | (div ? 1 : 0) ); SCC_WRITE(3, reg3 | 1);
SCC_WRITE( 3, reg3 | 1 ); SCC_WRITE(5, reg5 | 8);
SCC_WRITE( 5, reg5 | 8 );
atari_SCC_reset_done = 1;
atari_SCC_reset_done = 1; atari_SCC_init_done = 1;
atari_SCC_init_done = 1;
} }
#ifndef CONFIG_SERIAL_CONSOLE #ifndef CONFIG_SERIAL_CONSOLE
static void __init atari_init_midi_port( int cflag ) static void __init atari_init_midi_port(int cflag)
#else #else
void atari_init_midi_port( int cflag ) void atari_init_midi_port(int cflag)
#endif #endif
{ {
int baud = cflag & CBAUD; int baud = cflag & CBAUD;
int csize = ((cflag & CSIZE) == CS8) ? 0x10 : 0x00; int csize = ((cflag & CSIZE) == CS8) ? 0x10 : 0x00;
/* warning 7N1 isn't possible! (instead 7O2 is used...) */ /* warning 7N1 isn't possible! (instead 7O2 is used...) */
int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x0c : 0x08) : 0x04; int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x0c : 0x08) : 0x04;
int div; int div;
/* 4800 selects 7812.5, 115200 selects 500000, all other (incl. 9600 as /* 4800 selects 7812.5, 115200 selects 500000, all other (incl. 9600 as
* default) the standard MIDI speed 31250. */ * default) the standard MIDI speed 31250. */
if (cflag & CBAUDEX) if (cflag & CBAUDEX)
baud += B38400; baud += B38400;
if (baud == B4800) if (baud == B4800)
div = ACIA_DIV64; /* really 7812.5 bps */ div = ACIA_DIV64; /* really 7812.5 bps */
else if (baud == B38400+2 /* 115200 */) else if (baud == B38400+2 /* 115200 */)
div = ACIA_DIV1; /* really 500 kbps (does that work??) */ div = ACIA_DIV1; /* really 500 kbps (does that work??) */
else else
div = ACIA_DIV16; /* 31250 bps, standard for MIDI */ div = ACIA_DIV16; /* 31250 bps, standard for MIDI */
/* RTS low, ints disabled */ /* RTS low, ints disabled */
acia.mid_ctrl = div | csize | parity | acia.mid_ctrl = div | csize | parity |
((atari_switches & ATARI_SWITCH_MIDI) ? ((atari_switches & ATARI_SWITCH_MIDI) ?
ACIA_RHTID : ACIA_RLTID); ACIA_RHTID : ACIA_RLTID);
} }
void __init atari_debug_init(void) void __init atari_debug_init(void)
{ {
if (!strcmp( m68k_debug_device, "ser" )) { if (!strcmp(m68k_debug_device, "ser")) {
/* defaults to ser2 for a Falcon and ser1 otherwise */ /* defaults to ser2 for a Falcon and ser1 otherwise */
strcpy( m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1" ); strcpy(m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1");
}
}
if (!strcmp( m68k_debug_device, "ser1" )) {
/* ST-MFP Modem1 serial port */
atari_init_mfp_port( B9600|CS8 );
atari_console_driver.write = atari_mfp_console_write;
}
else if (!strcmp( m68k_debug_device, "ser2" )) {
/* SCC Modem2 serial port */
atari_init_scc_port( B9600|CS8 );
atari_console_driver.write = atari_scc_console_write;
}
else if (!strcmp( m68k_debug_device, "midi" )) {
/* MIDI port */
atari_init_midi_port( B9600|CS8 );
atari_console_driver.write = atari_midi_console_write;
}
else if (!strcmp( m68k_debug_device, "par" )) {
/* parallel printer */
atari_turnoff_irq( IRQ_MFP_BUSY ); /* avoid ints */
sound_ym.rd_data_reg_sel = 7; /* select mixer control */
sound_ym.wd_data = 0xff; /* sound off, ports are output */
sound_ym.rd_data_reg_sel = 15; /* select port B */
sound_ym.wd_data = 0; /* no char */
sound_ym.rd_data_reg_sel = 14; /* select port A */
sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */
atari_console_driver.write = atari_par_console_write;
}
if (atari_console_driver.write)
register_console(&atari_console_driver);
}
/* if (!strcmp(m68k_debug_device, "ser1")) {
* Local variables: /* ST-MFP Modem1 serial port */
* c-indent-level: 4 atari_init_mfp_port(B9600|CS8);
* tab-width: 8 atari_console_driver.write = atari_mfp_console_write;
* End: } else if (!strcmp(m68k_debug_device, "ser2")) {
*/ /* SCC Modem2 serial port */
atari_init_scc_port(B9600|CS8);
atari_console_driver.write = atari_scc_console_write;
} else if (!strcmp(m68k_debug_device, "midi")) {
/* MIDI port */
atari_init_midi_port(B9600|CS8);
atari_console_driver.write = atari_midi_console_write;
} else if (!strcmp(m68k_debug_device, "par")) {
/* parallel printer */
atari_turnoff_irq(IRQ_MFP_BUSY); /* avoid ints */
sound_ym.rd_data_reg_sel = 7; /* select mixer control */
sound_ym.wd_data = 0xff; /* sound off, ports are output */
sound_ym.rd_data_reg_sel = 15; /* select port B */
sound_ym.wd_data = 0; /* no char */
sound_ym.rd_data_reg_sel = 14; /* select port A */
sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */
atari_console_driver.write = atari_par_console_write;
}
if (atari_console_driver.write)
register_console(&atari_console_driver);
}
...@@ -692,7 +692,7 @@ sys_call_table: ...@@ -692,7 +692,7 @@ sys_call_table:
.long sys_tgkill /* 265 */ .long sys_tgkill /* 265 */
.long sys_utimes .long sys_utimes
.long sys_fadvise64_64 .long sys_fadvise64_64
.long sys_mbind .long sys_mbind
.long sys_get_mempolicy .long sys_get_mempolicy
.long sys_set_mempolicy /* 270 */ .long sys_set_mempolicy /* 270 */
.long sys_mq_open .long sys_mq_open
......
...@@ -3195,7 +3195,7 @@ func_start serial_putc,%d0/%d1/%a0/%a1 ...@@ -3195,7 +3195,7 @@ func_start serial_putc,%d0/%d1/%a0/%a1
jbra L(serial_putc_done) jbra L(serial_putc_done)
3: 3:
#endif #endif
L(serial_putc_done): L(serial_putc_done):
func_return serial_putc func_return serial_putc
......
...@@ -133,78 +133,78 @@ extern void config_hp300(void); ...@@ -133,78 +133,78 @@ extern void config_hp300(void);
extern void config_q40(void); extern void config_q40(void);
extern void config_sun3x(void); extern void config_sun3x(void);
extern void mac_debugging_short (int, short);
extern void mac_debugging_long (int, long);
#define MASK_256K 0xfffc0000 #define MASK_256K 0xfffc0000
extern void paging_init(void); extern void paging_init(void);
static void __init m68k_parse_bootinfo(const struct bi_record *record) static void __init m68k_parse_bootinfo(const struct bi_record *record)
{ {
while (record->tag != BI_LAST) { while (record->tag != BI_LAST) {
int unknown = 0; int unknown = 0;
const unsigned long *data = record->data; const unsigned long *data = record->data;
switch (record->tag) {
case BI_MACHTYPE: switch (record->tag) {
case BI_CPUTYPE: case BI_MACHTYPE:
case BI_FPUTYPE: case BI_CPUTYPE:
case BI_MMUTYPE: case BI_FPUTYPE:
/* Already set up by head.S */ case BI_MMUTYPE:
break; /* Already set up by head.S */
break;
case BI_MEMCHUNK:
if (m68k_num_memory < NUM_MEMINFO) { case BI_MEMCHUNK:
m68k_memory[m68k_num_memory].addr = data[0]; if (m68k_num_memory < NUM_MEMINFO) {
m68k_memory[m68k_num_memory].size = data[1]; m68k_memory[m68k_num_memory].addr = data[0];
m68k_num_memory++; m68k_memory[m68k_num_memory].size = data[1];
} else m68k_num_memory++;
printk("m68k_parse_bootinfo: too many memory chunks\n"); } else
break; printk("m68k_parse_bootinfo: too many memory chunks\n");
break;
case BI_RAMDISK:
m68k_ramdisk.addr = data[0]; case BI_RAMDISK:
m68k_ramdisk.size = data[1]; m68k_ramdisk.addr = data[0];
break; m68k_ramdisk.size = data[1];
break;
case BI_COMMAND_LINE:
strlcpy(m68k_command_line, (const char *)data, sizeof(m68k_command_line)); case BI_COMMAND_LINE:
break; strlcpy(m68k_command_line, (const char *)data,
sizeof(m68k_command_line));
default: break;
if (MACH_IS_AMIGA)
unknown = amiga_parse_bootinfo(record); default:
else if (MACH_IS_ATARI) if (MACH_IS_AMIGA)
unknown = atari_parse_bootinfo(record); unknown = amiga_parse_bootinfo(record);
else if (MACH_IS_MAC) else if (MACH_IS_ATARI)
unknown = mac_parse_bootinfo(record); unknown = atari_parse_bootinfo(record);
else if (MACH_IS_Q40) else if (MACH_IS_MAC)
unknown = q40_parse_bootinfo(record); unknown = mac_parse_bootinfo(record);
else if (MACH_IS_BVME6000) else if (MACH_IS_Q40)
unknown = bvme6000_parse_bootinfo(record); unknown = q40_parse_bootinfo(record);
else if (MACH_IS_MVME16x) else if (MACH_IS_BVME6000)
unknown = mvme16x_parse_bootinfo(record); unknown = bvme6000_parse_bootinfo(record);
else if (MACH_IS_MVME147) else if (MACH_IS_MVME16x)
unknown = mvme147_parse_bootinfo(record); unknown = mvme16x_parse_bootinfo(record);
else if (MACH_IS_HP300) else if (MACH_IS_MVME147)
unknown = hp300_parse_bootinfo(record); unknown = mvme147_parse_bootinfo(record);
else else if (MACH_IS_HP300)
unknown = 1; unknown = hp300_parse_bootinfo(record);
else
unknown = 1;
}
if (unknown)
printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
record->tag);
record = (struct bi_record *)((unsigned long)record +
record->size);
} }
if (unknown)
printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
record->tag);
record = (struct bi_record *)((unsigned long)record+record->size);
}
m68k_realnum_memory = m68k_num_memory; m68k_realnum_memory = m68k_num_memory;
#ifdef CONFIG_SINGLE_MEMORY_CHUNK #ifdef CONFIG_SINGLE_MEMORY_CHUNK
if (m68k_num_memory > 1) { if (m68k_num_memory > 1) {
printk("Ignoring last %i chunks of physical memory\n", printk("Ignoring last %i chunks of physical memory\n",
(m68k_num_memory - 1)); (m68k_num_memory - 1));
m68k_num_memory = 1; m68k_num_memory = 1;
} }
m68k_memoffset = m68k_memory[0].addr-PAGE_OFFSET; m68k_memoffset = m68k_memory[0].addr-PAGE_OFFSET;
#endif #endif
} }
...@@ -234,7 +234,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -234,7 +234,7 @@ void __init setup_arch(char **cmdline_p)
/* clear the fpu if we have one */ /* clear the fpu if we have one */
if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) { if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) {
volatile int zero = 0; volatile int zero = 0;
asm __volatile__ ("frestore %0" : : "m" (zero)); asm volatile ("frestore %0" : : "m" (zero));
} }
#endif #endif
...@@ -262,32 +262,35 @@ void __init setup_arch(char **cmdline_p) ...@@ -262,32 +262,35 @@ void __init setup_arch(char **cmdline_p)
* For the m68k, this is currently only "debug=xxx" to enable printing * For the m68k, this is currently only "debug=xxx" to enable printing
* certain kernel messages to some machine-specific device. * certain kernel messages to some machine-specific device.
*/ */
for( p = *cmdline_p; p && *p; ) { for (p = *cmdline_p; p && *p;) {
i = 0; i = 0;
if (!strncmp( p, "debug=", 6 )) { if (!strncmp(p, "debug=", 6)) {
strlcpy( m68k_debug_device, p+6, sizeof(m68k_debug_device) ); strlcpy(m68k_debug_device, p+6, sizeof(m68k_debug_device));
if ((q = strchr( m68k_debug_device, ' ' ))) *q = 0; q = strchr(m68k_debug_device, ' ');
i = 1; if (q)
} *q = 0;
i = 1;
}
#ifdef CONFIG_ATARI #ifdef CONFIG_ATARI
/* This option must be parsed very early */ /* This option must be parsed very early */
if (!strncmp( p, "switches=", 9 )) { if (!strncmp(p, "switches=", 9)) {
extern void atari_switches_setup( const char *, int ); extern void atari_switches_setup(const char *, int);
atari_switches_setup( p+9, (q = strchr( p+9, ' ' )) ? q = strchr(p + 9, ' ');
(q - (p+9)) : strlen(p+9) ); atari_switches_setup(p + 9, q ? (q - (p + 9)) : strlen(p + 9));
i = 1; i = 1;
} }
#endif #endif
if (i) { if (i) {
/* option processed, delete it */ /* option processed, delete it */
if ((q = strchr( p, ' ' ))) if ((q = strchr(p, ' ')))
strcpy( p, q+1 ); strcpy(p, q + 1);
else else
*p = 0; *p = 0;
} else { } else {
if ((p = strchr( p, ' ' ))) ++p; if ((p = strchr(p, ' ')))
} ++p;
}
} }
#ifdef CONFIG_DUMMY_CONSOLE #ifdef CONFIG_DUMMY_CONSOLE
...@@ -296,62 +299,62 @@ void __init setup_arch(char **cmdline_p) ...@@ -296,62 +299,62 @@ void __init setup_arch(char **cmdline_p)
switch (m68k_machtype) { switch (m68k_machtype) {
#ifdef CONFIG_AMIGA #ifdef CONFIG_AMIGA
case MACH_AMIGA: case MACH_AMIGA:
config_amiga(); config_amiga();
break; break;
#endif #endif
#ifdef CONFIG_ATARI #ifdef CONFIG_ATARI
case MACH_ATARI: case MACH_ATARI:
config_atari(); config_atari();
break; break;
#endif #endif
#ifdef CONFIG_MAC #ifdef CONFIG_MAC
case MACH_MAC: case MACH_MAC:
config_mac(); config_mac();
break; break;
#endif #endif
#ifdef CONFIG_SUN3 #ifdef CONFIG_SUN3
case MACH_SUN3: case MACH_SUN3:
config_sun3(); config_sun3();
break; break;
#endif #endif
#ifdef CONFIG_APOLLO #ifdef CONFIG_APOLLO
case MACH_APOLLO: case MACH_APOLLO:
config_apollo(); config_apollo();
break; break;
#endif #endif
#ifdef CONFIG_MVME147 #ifdef CONFIG_MVME147
case MACH_MVME147: case MACH_MVME147:
config_mvme147(); config_mvme147();
break; break;
#endif #endif
#ifdef CONFIG_MVME16x #ifdef CONFIG_MVME16x
case MACH_MVME16x: case MACH_MVME16x:
config_mvme16x(); config_mvme16x();
break; break;
#endif #endif
#ifdef CONFIG_BVME6000 #ifdef CONFIG_BVME6000
case MACH_BVME6000: case MACH_BVME6000:
config_bvme6000(); config_bvme6000();
break; break;
#endif #endif
#ifdef CONFIG_HP300 #ifdef CONFIG_HP300
case MACH_HP300: case MACH_HP300:
config_hp300(); config_hp300();
break; break;
#endif #endif
#ifdef CONFIG_Q40 #ifdef CONFIG_Q40
case MACH_Q40: case MACH_Q40:
config_q40(); config_q40();
break; break;
#endif #endif
#ifdef CONFIG_SUN3X #ifdef CONFIG_SUN3X
case MACH_SUN3X: case MACH_SUN3X:
config_sun3x(); config_sun3x();
break; break;
#endif #endif
default: default:
panic ("No configuration setup"); panic("No configuration setup");
} }
#ifndef CONFIG_SUN3 #ifndef CONFIG_SUN3
...@@ -380,7 +383,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -380,7 +383,7 @@ void __init setup_arch(char **cmdline_p)
reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size); reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size);
initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr); initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
initrd_end = initrd_start + m68k_ramdisk.size; initrd_end = initrd_start + m68k_ramdisk.size;
printk ("initrd: %08lx - %08lx\n", initrd_start, initrd_end); printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
} }
#endif #endif
...@@ -402,18 +405,18 @@ void __init setup_arch(char **cmdline_p) ...@@ -402,18 +405,18 @@ void __init setup_arch(char **cmdline_p)
#if defined(CONFIG_ISA) && defined(MULTI_ISA) #if defined(CONFIG_ISA) && defined(MULTI_ISA)
#if defined(CONFIG_Q40) #if defined(CONFIG_Q40)
if (MACH_IS_Q40) { if (MACH_IS_Q40) {
isa_type = Q40_ISA; isa_type = Q40_ISA;
isa_sex = 0; isa_sex = 0;
} }
#elif defined(CONFIG_GG2) #elif defined(CONFIG_GG2)
if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)){ if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)) {
isa_type = GG2_ISA; isa_type = GG2_ISA;
isa_sex = 0; isa_sex = 0;
} }
#elif defined(CONFIG_AMIGA_PCMCIA) #elif defined(CONFIG_AMIGA_PCMCIA)
if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)){ if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)) {
isa_type = AG_ISA; isa_type = AG_ISA;
isa_sex = 1; isa_sex = 1;
} }
#endif #endif
#endif #endif
...@@ -421,66 +424,66 @@ void __init setup_arch(char **cmdline_p) ...@@ -421,66 +424,66 @@ void __init setup_arch(char **cmdline_p)
static int show_cpuinfo(struct seq_file *m, void *v) static int show_cpuinfo(struct seq_file *m, void *v)
{ {
const char *cpu, *mmu, *fpu; const char *cpu, *mmu, *fpu;
unsigned long clockfreq, clockfactor; unsigned long clockfreq, clockfactor;
#define LOOP_CYCLES_68020 (8) #define LOOP_CYCLES_68020 (8)
#define LOOP_CYCLES_68030 (8) #define LOOP_CYCLES_68030 (8)
#define LOOP_CYCLES_68040 (3) #define LOOP_CYCLES_68040 (3)
#define LOOP_CYCLES_68060 (1) #define LOOP_CYCLES_68060 (1)
if (CPU_IS_020) { if (CPU_IS_020) {
cpu = "68020"; cpu = "68020";
clockfactor = LOOP_CYCLES_68020; clockfactor = LOOP_CYCLES_68020;
} else if (CPU_IS_030) { } else if (CPU_IS_030) {
cpu = "68030"; cpu = "68030";
clockfactor = LOOP_CYCLES_68030; clockfactor = LOOP_CYCLES_68030;
} else if (CPU_IS_040) { } else if (CPU_IS_040) {
cpu = "68040"; cpu = "68040";
clockfactor = LOOP_CYCLES_68040; clockfactor = LOOP_CYCLES_68040;
} else if (CPU_IS_060) { } else if (CPU_IS_060) {
cpu = "68060"; cpu = "68060";
clockfactor = LOOP_CYCLES_68060; clockfactor = LOOP_CYCLES_68060;
} else { } else {
cpu = "680x0"; cpu = "680x0";
clockfactor = 0; clockfactor = 0;
} }
#ifdef CONFIG_M68KFPU_EMU_ONLY #ifdef CONFIG_M68KFPU_EMU_ONLY
fpu="none(soft float)"; fpu = "none(soft float)";
#else #else
if (m68k_fputype & FPU_68881) if (m68k_fputype & FPU_68881)
fpu = "68881"; fpu = "68881";
else if (m68k_fputype & FPU_68882) else if (m68k_fputype & FPU_68882)
fpu = "68882"; fpu = "68882";
else if (m68k_fputype & FPU_68040) else if (m68k_fputype & FPU_68040)
fpu = "68040"; fpu = "68040";
else if (m68k_fputype & FPU_68060) else if (m68k_fputype & FPU_68060)
fpu = "68060"; fpu = "68060";
else if (m68k_fputype & FPU_SUNFPA) else if (m68k_fputype & FPU_SUNFPA)
fpu = "Sun FPA"; fpu = "Sun FPA";
else else
fpu = "none"; fpu = "none";
#endif #endif
if (m68k_mmutype & MMU_68851) if (m68k_mmutype & MMU_68851)
mmu = "68851"; mmu = "68851";
else if (m68k_mmutype & MMU_68030) else if (m68k_mmutype & MMU_68030)
mmu = "68030"; mmu = "68030";
else if (m68k_mmutype & MMU_68040) else if (m68k_mmutype & MMU_68040)
mmu = "68040"; mmu = "68040";
else if (m68k_mmutype & MMU_68060) else if (m68k_mmutype & MMU_68060)
mmu = "68060"; mmu = "68060";
else if (m68k_mmutype & MMU_SUN3) else if (m68k_mmutype & MMU_SUN3)
mmu = "Sun-3"; mmu = "Sun-3";
else if (m68k_mmutype & MMU_APOLLO) else if (m68k_mmutype & MMU_APOLLO)
mmu = "Apollo"; mmu = "Apollo";
else else
mmu = "unknown"; mmu = "unknown";
clockfreq = loops_per_jiffy*HZ*clockfactor; clockfreq = loops_per_jiffy * HZ * clockfactor;
seq_printf(m, "CPU:\t\t%s\n" seq_printf(m, "CPU:\t\t%s\n"
"MMU:\t\t%s\n" "MMU:\t\t%s\n"
"FPU:\t\t%s\n" "FPU:\t\t%s\n"
"Clocking:\t%lu.%1luMHz\n" "Clocking:\t%lu.%1luMHz\n"
...@@ -490,7 +493,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -490,7 +493,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
clockfreq/1000000,(clockfreq/100000)%10, clockfreq/1000000,(clockfreq/100000)%10,
loops_per_jiffy/(500000/HZ),(loops_per_jiffy/(5000/HZ))%100, loops_per_jiffy/(500000/HZ),(loops_per_jiffy/(5000/HZ))%100,
loops_per_jiffy); loops_per_jiffy);
return 0; return 0;
} }
static void *c_start(struct seq_file *m, loff_t *pos) static void *c_start(struct seq_file *m, loff_t *pos)
...@@ -506,44 +509,44 @@ static void c_stop(struct seq_file *m, void *v) ...@@ -506,44 +509,44 @@ static void c_stop(struct seq_file *m, void *v)
{ {
} }
struct seq_operations cpuinfo_op = { struct seq_operations cpuinfo_op = {
.start = c_start, .start = c_start,
.next = c_next, .next = c_next,
.stop = c_stop, .stop = c_stop,
.show = show_cpuinfo, .show = show_cpuinfo,
}; };
int get_hardware_list(char *buffer) int get_hardware_list(char *buffer)
{ {
int len = 0; int len = 0;
char model[80]; char model[80];
unsigned long mem; unsigned long mem;
int i; int i;
if (mach_get_model) if (mach_get_model)
mach_get_model(model); mach_get_model(model);
else else
strcpy(model, "Unknown m68k"); strcpy(model, "Unknown m68k");
len += sprintf(buffer+len, "Model:\t\t%s\n", model); len += sprintf(buffer + len, "Model:\t\t%s\n", model);
for (mem = 0, i = 0; i < m68k_num_memory; i++) for (mem = 0, i = 0; i < m68k_num_memory; i++)
mem += m68k_memory[i].size; mem += m68k_memory[i].size;
len += sprintf(buffer+len, "System Memory:\t%ldK\n", mem>>10); len += sprintf(buffer + len, "System Memory:\t%ldK\n", mem >> 10);
if (mach_get_hardware_list) if (mach_get_hardware_list)
len += mach_get_hardware_list(buffer+len); len += mach_get_hardware_list(buffer + len);
return(len); return len;
} }
void check_bugs(void) void check_bugs(void)
{ {
#ifndef CONFIG_M68KFPU_EMU #ifndef CONFIG_M68KFPU_EMU
if (m68k_fputype == 0) { if (m68k_fputype == 0) {
printk( KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, " printk(KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
"WHICH IS REQUIRED BY LINUX/M68K ***\n" ); "WHICH IS REQUIRED BY LINUX/M68K ***\n");
printk( KERN_EMERG "Upgrade your hardware or join the FPU " printk(KERN_EMERG "Upgrade your hardware or join the FPU "
"emulation project\n" ); "emulation project\n");
panic( "no FPU" ); panic("no FPU");
} }
#endif /* !CONFIG_M68KFPU_EMU */ #endif /* !CONFIG_M68KFPU_EMU */
} }
...@@ -59,15 +59,15 @@ extern struct mem_info m68k_ramdisk; ...@@ -59,15 +59,15 @@ extern struct mem_info m68k_ramdisk;
extern char m68k_command_line[CL_SIZE]; extern char m68k_command_line[CL_SIZE];
void *mac_env; /* Loaded by the boot asm */ void *mac_env; /* Loaded by the boot asm */
/* The phys. video addr. - might be bogus on some machines */ /* The phys. video addr. - might be bogus on some machines */
unsigned long mac_orig_videoaddr; unsigned long mac_orig_videoaddr;
/* Mac specific timer functions */ /* Mac specific timer functions */
extern unsigned long mac_gettimeoffset (void); extern unsigned long mac_gettimeoffset(void);
extern int mac_hwclk (int, struct rtc_time *); extern int mac_hwclk(int, struct rtc_time *);
extern int mac_set_clock_mmss (unsigned long); extern int mac_set_clock_mmss(unsigned long);
extern int show_mac_interrupts(struct seq_file *, void *); extern int show_mac_interrupts(struct seq_file *, void *);
extern void iop_preinit(void); extern void iop_preinit(void);
extern void iop_init(void); extern void iop_init(void);
...@@ -99,51 +99,52 @@ static void mac_sched_init(irq_handler_t vector) ...@@ -99,51 +99,52 @@ static void mac_sched_init(irq_handler_t vector)
int __init mac_parse_bootinfo(const struct bi_record *record) int __init mac_parse_bootinfo(const struct bi_record *record)
{ {
int unknown = 0; int unknown = 0;
const u_long *data = record->data; const u_long *data = record->data;
switch (record->tag) { switch (record->tag) {
case BI_MAC_MODEL: case BI_MAC_MODEL:
mac_bi_data.id = *data; mac_bi_data.id = *data;
break; break;
case BI_MAC_VADDR: case BI_MAC_VADDR:
mac_bi_data.videoaddr = *data; mac_bi_data.videoaddr = *data;
break; break;
case BI_MAC_VDEPTH: case BI_MAC_VDEPTH:
mac_bi_data.videodepth = *data; mac_bi_data.videodepth = *data;
break; break;
case BI_MAC_VROW: case BI_MAC_VROW:
mac_bi_data.videorow = *data; mac_bi_data.videorow = *data;
break; break;
case BI_MAC_VDIM: case BI_MAC_VDIM:
mac_bi_data.dimensions = *data; mac_bi_data.dimensions = *data;
break; break;
case BI_MAC_VLOGICAL: case BI_MAC_VLOGICAL:
mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK); mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
mac_orig_videoaddr = *data; mac_orig_videoaddr = *data;
break; break;
case BI_MAC_SCCBASE: case BI_MAC_SCCBASE:
mac_bi_data.sccbase = *data; mac_bi_data.sccbase = *data;
break; break;
case BI_MAC_BTIME: case BI_MAC_BTIME:
mac_bi_data.boottime = *data; mac_bi_data.boottime = *data;
break; break;
case BI_MAC_GMTBIAS: case BI_MAC_GMTBIAS:
mac_bi_data.gmtbias = *data; mac_bi_data.gmtbias = *data;
break; break;
case BI_MAC_MEMSIZE: case BI_MAC_MEMSIZE:
mac_bi_data.memsize = *data; mac_bi_data.memsize = *data;
break; break;
case BI_MAC_CPUID: case BI_MAC_CPUID:
mac_bi_data.cpuid = *data; mac_bi_data.cpuid = *data;
break; break;
case BI_MAC_ROMBASE: case BI_MAC_ROMBASE:
mac_bi_data.rombase = *data; mac_bi_data.rombase = *data;
break; break;
default: default:
unknown = 1; unknown = 1;
} break;
return(unknown); }
return unknown;
} }
/* /*
...@@ -155,6 +156,7 @@ int __init mac_parse_bootinfo(const struct bi_record *record) ...@@ -155,6 +156,7 @@ int __init mac_parse_bootinfo(const struct bi_record *record)
static void mac_cache_card_flush(int writeback) static void mac_cache_card_flush(int writeback)
{ {
unsigned long flags; unsigned long flags;
local_irq_save(flags); local_irq_save(flags);
via_flush_cache(); via_flush_cache();
local_irq_restore(flags); local_irq_restore(flags);
...@@ -162,28 +164,27 @@ static void mac_cache_card_flush(int writeback) ...@@ -162,28 +164,27 @@ static void mac_cache_card_flush(int writeback)
void __init config_mac(void) void __init config_mac(void)
{ {
if (!MACH_IS_MAC) { if (!MACH_IS_MAC)
printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n"); printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
}
mach_sched_init = mac_sched_init; mach_sched_init = mac_sched_init;
mach_init_IRQ = mac_init_IRQ; mach_init_IRQ = mac_init_IRQ;
mach_get_model = mac_get_model; mach_get_model = mac_get_model;
mach_gettimeoffset = mac_gettimeoffset; mach_gettimeoffset = mac_gettimeoffset;
#warning move to adb/via init #warning move to adb/via init
#if 0 #if 0
mach_hwclk = mac_hwclk; mach_hwclk = mac_hwclk;
#endif #endif
mach_set_clock_mmss = mac_set_clock_mmss; mach_set_clock_mmss = mac_set_clock_mmss;
mach_reset = mac_reset; mach_reset = mac_reset;
mach_halt = mac_poweroff; mach_halt = mac_poweroff;
mach_power_off = mac_poweroff; mach_power_off = mac_poweroff;
mach_max_dma_address = 0xffffffff; mach_max_dma_address = 0xffffffff;
#if 0 #if 0
mach_debug_init = mac_debug_init; mach_debug_init = mac_debug_init;
#endif #endif
#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
mach_beep = mac_mksound; mach_beep = mac_mksound;
#endif #endif
#ifdef CONFIG_HEARTBEAT #ifdef CONFIG_HEARTBEAT
#if 0 #if 0
...@@ -199,21 +200,22 @@ void __init config_mac(void) ...@@ -199,21 +200,22 @@ void __init config_mac(void)
mac_identify(); mac_identify();
mac_report_hardware(); mac_report_hardware();
/* AFAIK only the IIci takes a cache card. The IIfx has onboard /*
cache ... someone needs to figure out how to tell if it's on or * AFAIK only the IIci takes a cache card. The IIfx has onboard
not. */ * cache ... someone needs to figure out how to tell if it's on or
* not.
*/
if (macintosh_config->ident == MAC_MODEL_IICI if (macintosh_config->ident == MAC_MODEL_IICI
|| macintosh_config->ident == MAC_MODEL_IIFX) { || macintosh_config->ident == MAC_MODEL_IIFX)
mach_l2_flush = mac_cache_card_flush; mach_l2_flush = mac_cache_card_flush;
}
/* /*
* Check for machine specific fixups. * Check for machine specific fixups.
*/ */
#ifdef OLD_NUBUS_CODE #ifdef OLD_NUBUS_CODE
nubus_sweep_video(); nubus_sweep_video();
#endif #endif
} }
...@@ -233,8 +235,7 @@ void __init config_mac(void) ...@@ -233,8 +235,7 @@ void __init config_mac(void)
struct mac_model *macintosh_config; struct mac_model *macintosh_config;
EXPORT_SYMBOL(macintosh_config); EXPORT_SYMBOL(macintosh_config);
static struct mac_model mac_data_table[]= static struct mac_model mac_data_table[] = {
{
/* /*
* We'll pretend to be a Macintosh II, that's pretty safe. * We'll pretend to be a Macintosh II, that's pretty safe.
*/ */
...@@ -784,12 +785,12 @@ void mac_identify(void) ...@@ -784,12 +785,12 @@ void mac_identify(void)
if (!model) { if (!model) {
/* no bootinfo model id -> NetBSD booter was used! */ /* no bootinfo model id -> NetBSD booter was used! */
/* XXX FIXME: breaks for model > 31 */ /* XXX FIXME: breaks for model > 31 */
model=(mac_bi_data.cpuid>>2)&63; model = (mac_bi_data.cpuid >> 2) & 63;
printk (KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n"); printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
} }
macintosh_config = mac_data_table; macintosh_config = mac_data_table;
for (m = macintosh_config ; m->ident != -1 ; m++) { for (m = macintosh_config; m->ident != -1; m++) {
if (m->ident == model) { if (m->ident == model) {
macintosh_config = m; macintosh_config = m;
break; break;
...@@ -803,25 +804,25 @@ void mac_identify(void) ...@@ -803,25 +804,25 @@ void mac_identify(void)
iop_preinit(); iop_preinit();
mac_debug_init(); mac_debug_init();
printk (KERN_INFO "Detected Macintosh model: %d \n", model); printk(KERN_INFO "Detected Macintosh model: %d \n", model);
/* /*
* Report booter data: * Report booter data:
*/ */
printk (KERN_DEBUG " Penguin bootinfo data:\n"); printk(KERN_DEBUG " Penguin bootinfo data:\n");
printk (KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n", printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
mac_bi_data.videoaddr, mac_bi_data.videorow, mac_bi_data.videoaddr, mac_bi_data.videorow,
mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF, mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
mac_bi_data.dimensions >> 16); mac_bi_data.dimensions >> 16);
printk (KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n", printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
mac_bi_data.videological, mac_orig_videoaddr, mac_bi_data.videological, mac_orig_videoaddr,
mac_bi_data.sccbase); mac_bi_data.sccbase);
printk (KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n", printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
mac_bi_data.boottime, mac_bi_data.gmtbias); mac_bi_data.boottime, mac_bi_data.gmtbias);
printk (KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n", printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize); mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
#if 0 #if 0
printk ("Ramdisk: addr 0x%lx size 0x%lx\n", printk("Ramdisk: addr 0x%lx size 0x%lx\n",
m68k_ramdisk.addr, m68k_ramdisk.size); m68k_ramdisk.addr, m68k_ramdisk.size);
#endif #endif
...@@ -830,22 +831,22 @@ void mac_identify(void) ...@@ -830,22 +831,22 @@ void mac_identify(void)
*/ */
switch (macintosh_config->scsi_type) { switch (macintosh_config->scsi_type) {
case MAC_SCSI_OLD: case MAC_SCSI_OLD:
MACHW_SET(MAC_SCSI_80); MACHW_SET(MAC_SCSI_80);
break; break;
case MAC_SCSI_QUADRA: case MAC_SCSI_QUADRA:
case MAC_SCSI_QUADRA2: case MAC_SCSI_QUADRA2:
case MAC_SCSI_QUADRA3: case MAC_SCSI_QUADRA3:
MACHW_SET(MAC_SCSI_96); MACHW_SET(MAC_SCSI_96);
if ((macintosh_config->ident == MAC_MODEL_Q900) || if ((macintosh_config->ident == MAC_MODEL_Q900) ||
(macintosh_config->ident == MAC_MODEL_Q950)) (macintosh_config->ident == MAC_MODEL_Q950))
MACHW_SET(MAC_SCSI_96_2); MACHW_SET(MAC_SCSI_96_2);
break; break;
default: default:
printk(KERN_WARNING "config.c: wtf: unknown scsi, using 53c80\n"); printk(KERN_WARNING "config.c: wtf: unknown scsi, using 53c80\n");
MACHW_SET(MAC_SCSI_80); MACHW_SET(MAC_SCSI_80);
break; break;
} }
iop_init(); iop_init();
via_init(); via_init();
oss_init(); oss_init();
...@@ -860,6 +861,6 @@ void mac_report_hardware(void) ...@@ -860,6 +861,6 @@ void mac_report_hardware(void)
static void mac_get_model(char *str) static void mac_get_model(char *str)
{ {
strcpy(str,"Macintosh "); strcpy(str, "Macintosh ");
strcat(str, macintosh_config->name); strcat(str, macintosh_config->name);
} }
...@@ -52,7 +52,7 @@ extern void mac_serial_print(const char *); ...@@ -52,7 +52,7 @@ extern void mac_serial_print(const char *);
*/ */
#ifdef DEBUG_SCREEN #ifdef DEBUG_SCREEN
static int peng=0, line=0; static int peng, line;
#endif #endif
void mac_debugging_short(int pos, short num) void mac_debugging_short(int pos, short num)
...@@ -74,15 +74,14 @@ void mac_debugging_short(int pos, short num) ...@@ -74,15 +74,14 @@ void mac_debugging_short(int pos, short num)
} }
/* calculate current offset */ /* calculate current offset */
pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes) pengoffset = (unsigned char *)mac_videobase +
+80*peng; (150+line*2) * mac_rowbytes) + 80 * peng;
pptr=pengoffset; pptr = pengoffset;
for(i=0;i<8*sizeof(short);i++) /* # of bits */ for (i = 0; i < 8 * sizeof(short); i++) { /* # of bits */
{
/* value mask for bit i, reverse order */ /* value mask for bit i, reverse order */
*pptr++ = (num & ( 1 << (8*sizeof(short)-i-1) ) ? 0xFF : 0x00); *pptr++ = (num & (1 << (8*sizeof(short)-i-1)) ? 0xFF : 0x00);
} }
peng++; peng++;
...@@ -115,11 +114,10 @@ void mac_debugging_long(int pos, long addr) ...@@ -115,11 +114,10 @@ void mac_debugging_long(int pos, long addr)
pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes) pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes)
+80*peng; +80*peng;
pptr=pengoffset; pptr = pengoffset;
for(i=0;i<8*sizeof(long);i++) /* # of bits */ for (i = 0; i < 8 * sizeof(long); i++) { /* # of bits */
{ *pptr++ = (addr & (1 << (8*sizeof(long)-i-1)) ? 0xFF : 0x00);
*pptr++ = (addr & ( 1 << (8*sizeof(long)-i-1) ) ? 0xFF : 0x00);
} }
peng++; peng++;
...@@ -136,16 +134,15 @@ void mac_debugging_long(int pos, long addr) ...@@ -136,16 +134,15 @@ void mac_debugging_long(int pos, long addr)
* TODO: serial debug code * TODO: serial debug code
*/ */
struct mac_SCC struct mac_SCC {
{ u_char cha_b_ctrl;
u_char cha_b_ctrl; u_char char_dummy1;
u_char char_dummy1; u_char cha_a_ctrl;
u_char cha_a_ctrl; u_char char_dummy2;
u_char char_dummy2; u_char cha_b_data;
u_char cha_b_data; u_char char_dummy3;
u_char char_dummy3; u_char cha_a_data;
u_char cha_a_data; };
};
# define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase)) # define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase))
...@@ -158,9 +155,9 @@ int mac_SCC_reset_done; ...@@ -158,9 +155,9 @@ int mac_SCC_reset_done;
static int scc_port = -1; static int scc_port = -1;
static struct console mac_console_driver = { static struct console mac_console_driver = {
.name = "debug", .name = "debug",
.flags = CON_PRINTBUFFER, .flags = CON_PRINTBUFFER,
.index = -1, .index = -1,
}; };
/* /*
...@@ -178,8 +175,8 @@ static struct console mac_console_driver = { ...@@ -178,8 +175,8 @@ static struct console mac_console_driver = {
* this driver if Mac. * this driver if Mac.
*/ */
void mac_debug_console_write (struct console *co, const char *str, void mac_debug_console_write(struct console *co, const char *str,
unsigned int count) unsigned int count)
{ {
mac_serial_print(str); mac_serial_print(str);
} }
...@@ -190,48 +187,50 @@ void mac_debug_console_write (struct console *co, const char *str, ...@@ -190,48 +187,50 @@ void mac_debug_console_write (struct console *co, const char *str,
#define uSEC 1 #define uSEC 1
static inline void mac_sccb_out (char c) static inline void mac_sccb_out(char c)
{ {
int i; int i;
do {
for( i = uSEC; i > 0; --i ) do {
for (i = uSEC; i > 0; --i)
barrier();
} while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */
for (i = uSEC; i > 0; --i)
barrier(); barrier();
} while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ scc.cha_b_data = c;
for( i = uSEC; i > 0; --i )
barrier();
scc.cha_b_data = c;
} }
static inline void mac_scca_out (char c) static inline void mac_scca_out(char c)
{ {
int i; int i;
do {
for( i = uSEC; i > 0; --i ) do {
for (i = uSEC; i > 0; --i)
barrier();
} while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */
for (i = uSEC; i > 0; --i)
barrier(); barrier();
} while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */ scc.cha_a_data = c;
for( i = uSEC; i > 0; --i )
barrier();
scc.cha_a_data = c;
} }
void mac_sccb_console_write (struct console *co, const char *str, void mac_sccb_console_write(struct console *co, const char *str,
unsigned int count) unsigned int count)
{ {
while (count--) { while (count--) {
if (*str == '\n') if (*str == '\n')
mac_sccb_out( '\r' ); mac_sccb_out('\r');
mac_sccb_out( *str++ ); mac_sccb_out(*str++);
} }
} }
void mac_scca_console_write (struct console *co, const char *str, void mac_scca_console_write(struct console *co, const char *str,
unsigned int count) unsigned int count)
{ {
while (count--) { while (count--) {
if (*str == '\n') if (*str == '\n')
mac_scca_out( '\r' ); mac_scca_out('\r');
mac_scca_out( *str++ ); mac_scca_out(*str++);
} }
} }
...@@ -239,41 +238,41 @@ void mac_scca_console_write (struct console *co, const char *str, ...@@ -239,41 +238,41 @@ void mac_scca_console_write (struct console *co, const char *str,
* SCC serial ports. They're used by the debugging interface, kgdb, and the * SCC serial ports. They're used by the debugging interface, kgdb, and the
* serial console code. */ * serial console code. */
#define SCCB_WRITE(reg,val) \ #define SCCB_WRITE(reg,val) \
do { \ do { \
int i; \ int i; \
scc.cha_b_ctrl = (reg); \ scc.cha_b_ctrl = (reg); \
for( i = uSEC; i > 0; --i ) \ for (i = uSEC; i > 0; --i) \
barrier(); \ barrier(); \
scc.cha_b_ctrl = (val); \ scc.cha_b_ctrl = (val); \
for( i = uSEC; i > 0; --i ) \ for (i = uSEC; i > 0; --i) \
barrier(); \ barrier(); \
} while(0) } while(0)
#define SCCA_WRITE(reg,val) \ #define SCCA_WRITE(reg,val) \
do { \ do { \
int i; \ int i; \
scc.cha_a_ctrl = (reg); \ scc.cha_a_ctrl = (reg); \
for( i = uSEC; i > 0; --i ) \ for (i = uSEC; i > 0; --i) \
barrier(); \ barrier(); \
scc.cha_a_ctrl = (val); \ scc.cha_a_ctrl = (val); \
for( i = uSEC; i > 0; --i ) \ for (i = uSEC; i > 0; --i) \
barrier(); \ barrier(); \
} while(0) } while(0)
/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a /* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a
* delay of ~ 60us. */ * delay of ~ 60us. */
/* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/ /* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/
#define LONG_DELAY() \ #define LONG_DELAY() \
do { \ do { \
int i; \ int i; \
for( i = 60*uSEC; i > 0; --i ) \ for (i = 60*uSEC; i > 0; --i) \
barrier(); \ barrier(); \
} while(0) } while(0)
#ifndef CONFIG_SERIAL_CONSOLE #ifndef CONFIG_SERIAL_CONSOLE
static void __init mac_init_scc_port( int cflag, int port ) static void __init mac_init_scc_port(int cflag, int port)
#else #else
void mac_init_scc_port( int cflag, int port ) void mac_init_scc_port(int cflag, int port)
#endif #endif
{ {
extern int mac_SCC_reset_done; extern int mac_SCC_reset_done;
...@@ -292,71 +291,71 @@ void mac_init_scc_port( int cflag, int port ) ...@@ -292,71 +291,71 @@ void mac_init_scc_port( int cflag, int port )
/* reg12 (BRG low) */ /* reg12 (BRG low) */
{ 94, 62, 46, 22, 10, 4, 1, 0, 0 }; { 94, 62, 46, 22, 10, 4, 1, 0, 0 };
int baud = cflag & CBAUD; int baud = cflag & CBAUD;
int clksrc, clkmode, div, reg3, reg5; int clksrc, clkmode, div, reg3, reg5;
if (cflag & CBAUDEX) if (cflag & CBAUDEX)
baud += B38400; baud += B38400;
if (baud < B1200 || baud > B38400+2) if (baud < B1200 || baud > B38400+2)
baud = B9600; /* use default 9600bps for non-implemented rates */ baud = B9600; /* use default 9600bps for non-implemented rates */
baud -= B1200; /* tables starts at 1200bps */ baud -= B1200; /* tables starts at 1200bps */
clksrc = clksrc_table[baud]; clksrc = clksrc_table[baud];
clkmode = clkmode_table[baud]; clkmode = clkmode_table[baud];
div = div_table[baud]; div = div_table[baud];
reg3 = (((cflag & CSIZE) == CS8) ? 0xc0 : 0x40); reg3 = (((cflag & CSIZE) == CS8) ? 0xc0 : 0x40);
reg5 = (((cflag & CSIZE) == CS8) ? 0x60 : 0x20) | 0x82 /* assert DTR/RTS */; reg5 = (((cflag & CSIZE) == CS8) ? 0x60 : 0x20) | 0x82 /* assert DTR/RTS */;
if (port == 1) { if (port == 1) {
(void)scc.cha_b_ctrl; /* reset reg pointer */ (void)scc.cha_b_ctrl; /* reset reg pointer */
SCCB_WRITE( 9, 0xc0 ); /* reset */ SCCB_WRITE(9, 0xc0); /* reset */
LONG_DELAY(); /* extra delay after WR9 access */ LONG_DELAY(); /* extra delay after WR9 access */
SCCB_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | SCCB_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
0x04 /* 1 stopbit */ | 0x04 /* 1 stopbit */ |
clkmode ); clkmode);
SCCB_WRITE( 3, reg3 ); SCCB_WRITE(3, reg3);
SCCB_WRITE( 5, reg5 ); SCCB_WRITE(5, reg5);
SCCB_WRITE( 9, 0 ); /* no interrupts */ SCCB_WRITE(9, 0); /* no interrupts */
LONG_DELAY(); /* extra delay after WR9 access */ LONG_DELAY(); /* extra delay after WR9 access */
SCCB_WRITE( 10, 0 ); /* NRZ mode */ SCCB_WRITE(10, 0); /* NRZ mode */
SCCB_WRITE( 11, clksrc ); /* main clock source */ SCCB_WRITE(11, clksrc); /* main clock source */
SCCB_WRITE( 12, div ); /* BRG value */ SCCB_WRITE(12, div); /* BRG value */
SCCB_WRITE( 13, 0 ); /* BRG high byte */ SCCB_WRITE(13, 0); /* BRG high byte */
SCCB_WRITE( 14, 1 ); SCCB_WRITE(14, 1);
SCCB_WRITE( 3, reg3 | 1 ); SCCB_WRITE(3, reg3 | 1);
SCCB_WRITE( 5, reg5 | 8 ); SCCB_WRITE(5, reg5 | 8);
} else if (port == 0) { } else if (port == 0) {
(void)scc.cha_a_ctrl; /* reset reg pointer */ (void)scc.cha_a_ctrl; /* reset reg pointer */
SCCA_WRITE( 9, 0xc0 ); /* reset */ SCCA_WRITE(9, 0xc0); /* reset */
LONG_DELAY(); /* extra delay after WR9 access */ LONG_DELAY(); /* extra delay after WR9 access */
SCCA_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | SCCA_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
0x04 /* 1 stopbit */ | 0x04 /* 1 stopbit */ |
clkmode ); clkmode);
SCCA_WRITE( 3, reg3 ); SCCA_WRITE(3, reg3);
SCCA_WRITE( 5, reg5 ); SCCA_WRITE(5, reg5);
SCCA_WRITE( 9, 0 ); /* no interrupts */ SCCA_WRITE(9, 0); /* no interrupts */
LONG_DELAY(); /* extra delay after WR9 access */ LONG_DELAY(); /* extra delay after WR9 access */
SCCA_WRITE( 10, 0 ); /* NRZ mode */ SCCA_WRITE(10, 0); /* NRZ mode */
SCCA_WRITE( 11, clksrc ); /* main clock source */ SCCA_WRITE(11, clksrc); /* main clock source */
SCCA_WRITE( 12, div ); /* BRG value */ SCCA_WRITE(12, div); /* BRG value */
SCCA_WRITE( 13, 0 ); /* BRG high byte */ SCCA_WRITE(13, 0); /* BRG high byte */
SCCA_WRITE( 14, 1 ); SCCA_WRITE(14, 1);
SCCA_WRITE( 3, reg3 | 1 ); SCCA_WRITE(3, reg3 | 1);
SCCA_WRITE( 5, reg5 | 8 ); SCCA_WRITE(5, reg5 | 8);
} }
mac_SCC_reset_done = 1; mac_SCC_reset_done = 1;
mac_SCC_init_done = 1; mac_SCC_init_done = 1;
} }
#endif /* DEBUG_SERIAL */ #endif /* DEBUG_SERIAL */
void mac_init_scca_port( int cflag ) void mac_init_scca_port(int cflag)
{ {
mac_init_scc_port(cflag, 0); mac_init_scc_port(cflag, 0);
} }
void mac_init_sccb_port( int cflag ) void mac_init_sccb_port(int cflag)
{ {
mac_init_scc_port(cflag, 1); mac_init_scc_port(cflag, 1);
} }
...@@ -364,34 +363,26 @@ void mac_init_sccb_port( int cflag ) ...@@ -364,34 +363,26 @@ void mac_init_sccb_port( int cflag )
void __init mac_debug_init(void) void __init mac_debug_init(void)
{ {
#ifdef DEBUG_SERIAL #ifdef DEBUG_SERIAL
if ( !strcmp( m68k_debug_device, "ser" ) if (!strcmp(m68k_debug_device, "ser") ||
|| !strcmp( m68k_debug_device, "ser1" )) { !strcmp(m68k_debug_device, "ser1")) {
/* Mac modem port */ /* Mac modem port */
mac_init_scc_port( B9600|CS8, 0 ); mac_init_scc_port(B9600|CS8, 0);
mac_console_driver.write = mac_scca_console_write; mac_console_driver.write = mac_scca_console_write;
scc_port = 0; scc_port = 0;
} } else if (!strcmp(m68k_debug_device, "ser2")) {
else if (!strcmp( m68k_debug_device, "ser2" )) { /* Mac printer port */
/* Mac printer port */ mac_init_scc_port(B9600|CS8, 1);
mac_init_scc_port( B9600|CS8, 1 ); mac_console_driver.write = mac_sccb_console_write;
mac_console_driver.write = mac_sccb_console_write; scc_port = 1;
scc_port = 1; }
}
#endif #endif
#ifdef DEBUG_HEADS #ifdef DEBUG_HEADS
if ( !strcmp( m68k_debug_device, "scn" ) if (!strcmp(m68k_debug_device, "scn") ||
|| !strcmp( m68k_debug_device, "con" )) { !strcmp(m68k_debug_device, "con")) {
/* display, using head.S console routines */ /* display, using head.S console routines */
mac_console_driver.write = mac_debug_console_write; mac_console_driver.write = mac_debug_console_write;
} }
#endif #endif
if (mac_console_driver.write) if (mac_console_driver.write)
register_console(&mac_console_driver); register_console(&mac_console_driver);
} }
/*
* Local variables:
* c-indent-level: 4
* tab-width: 8
* End:
*/
...@@ -35,35 +35,35 @@ ...@@ -35,35 +35,35 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/q40_master.h> #include <asm/q40_master.h>
extern irqreturn_t q40_process_int (int level, struct pt_regs *regs); extern irqreturn_t q40_process_int(int level, struct pt_regs *regs);
extern void q40_init_IRQ (void); extern void q40_init_IRQ(void);
static void q40_get_model(char *model); static void q40_get_model(char *model);
static int q40_get_hardware_list(char *buffer); static int q40_get_hardware_list(char *buffer);
extern void q40_sched_init(irq_handler_t handler); extern void q40_sched_init(irq_handler_t handler);
extern unsigned long q40_gettimeoffset (void); extern unsigned long q40_gettimeoffset(void);
extern int q40_hwclk (int, struct rtc_time *); extern int q40_hwclk(int, struct rtc_time *);
extern unsigned int q40_get_ss (void); extern unsigned int q40_get_ss(void);
extern int q40_set_clock_mmss (unsigned long); extern int q40_set_clock_mmss(unsigned long);
static int q40_get_rtc_pll(struct rtc_pll_info *pll); static int q40_get_rtc_pll(struct rtc_pll_info *pll);
static int q40_set_rtc_pll(struct rtc_pll_info *pll); static int q40_set_rtc_pll(struct rtc_pll_info *pll);
extern void q40_reset (void); extern void q40_reset(void);
void q40_halt(void); void q40_halt(void);
extern void q40_waitbut(void); extern void q40_waitbut(void);
void q40_set_vectors (void); void q40_set_vectors(void);
extern void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/ ); extern void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/);
extern char m68k_debug_device[]; extern char m68k_debug_device[];
static void q40_mem_console_write(struct console *co, const char *b, static void q40_mem_console_write(struct console *co, const char *b,
unsigned int count); unsigned int count);
extern int ql_ticks; extern int ql_ticks;
static struct console q40_console_driver = { static struct console q40_console_driver = {
.name = "debug", .name = "debug",
.flags = CON_PRINTBUFFER, .flags = CON_PRINTBUFFER,
.index = -1, .index = -1,
}; };
...@@ -74,150 +74,157 @@ static int _cpleft; ...@@ -74,150 +74,157 @@ static int _cpleft;
static void q40_mem_console_write(struct console *co, const char *s, static void q40_mem_console_write(struct console *co, const char *s,
unsigned int count) unsigned int count)
{ {
char *p=(char *)s; const char *p = s;
if (count<_cpleft) if (count < _cpleft) {
while (count-- >0){ while (count-- > 0) {
*q40_mem_cptr=*p++; *q40_mem_cptr = *p++;
q40_mem_cptr+=4; q40_mem_cptr += 4;
_cpleft--; _cpleft--;
} }
}
} }
#if 0 #if 0
void printq40(char *str) void printq40(char *str)
{ {
int l=strlen(str); int l = strlen(str);
char *p=q40_mem_cptr; char *p = q40_mem_cptr;
while (l-- >0 && _cpleft-- >0) while (l-- > 0 && _cpleft-- > 0) {
{ *p = *str++;
*p=*str++; p += 4;
p+=4; }
} q40_mem_cptr = p;
q40_mem_cptr=p;
} }
#endif #endif
static int halted=0; static int halted;
#ifdef CONFIG_HEARTBEAT #ifdef CONFIG_HEARTBEAT
static void q40_heartbeat(int on) static void q40_heartbeat(int on)
{ {
if (halted) return; if (halted)
return;
if (on) if (on)
Q40_LED_ON(); Q40_LED_ON();
else else
Q40_LED_OFF(); Q40_LED_OFF();
} }
#endif #endif
void q40_reset(void) void q40_reset(void)
{ {
halted=1; halted = 1;
printk ("\n\n*******************************************\n" printk("\n\n*******************************************\n"
"Called q40_reset : press the RESET button!! \n" "Called q40_reset : press the RESET button!! \n"
"*******************************************\n"); "*******************************************\n");
Q40_LED_ON(); Q40_LED_ON();
while(1) ; while (1)
;
} }
void q40_halt(void) void q40_halt(void)
{ {
halted=1; halted = 1;
printk ("\n\n*******************\n" printk("\n\n*******************\n"
" Called q40_halt\n" " Called q40_halt\n"
"*******************\n"); "*******************\n");
Q40_LED_ON(); Q40_LED_ON();
while(1) ; while (1)
;
} }
static void q40_get_model(char *model) static void q40_get_model(char *model)
{ {
sprintf(model, "Q40"); sprintf(model, "Q40");
} }
/* No hardware options on Q40? */ /* No hardware options on Q40? */
static int q40_get_hardware_list(char *buffer) static int q40_get_hardware_list(char *buffer)
{ {
*buffer = '\0'; *buffer = '\0';
return 0; return 0;
} }
static unsigned int serports[]={0x3f8,0x2f8,0x3e8,0x2e8,0}; static unsigned int serports[] =
{
0x3f8,0x2f8,0x3e8,0x2e8,0
};
void q40_disable_irqs(void) void q40_disable_irqs(void)
{ {
unsigned i,j; unsigned i, j;
j=0; j = 0;
while((i=serports[j++])) outb(0,i+UART_IER); while ((i = serports[j++]))
master_outb(0,EXT_ENABLE_REG); outb(0, i + UART_IER);
master_outb(0,KEY_IRQ_ENABLE_REG); master_outb(0, EXT_ENABLE_REG);
master_outb(0, KEY_IRQ_ENABLE_REG);
} }
void __init config_q40(void) void __init config_q40(void)
{ {
mach_sched_init = q40_sched_init; mach_sched_init = q40_sched_init;
mach_init_IRQ = q40_init_IRQ; mach_init_IRQ = q40_init_IRQ;
mach_gettimeoffset = q40_gettimeoffset; mach_gettimeoffset = q40_gettimeoffset;
mach_hwclk = q40_hwclk; mach_hwclk = q40_hwclk;
mach_get_ss = q40_get_ss; mach_get_ss = q40_get_ss;
mach_get_rtc_pll = q40_get_rtc_pll; mach_get_rtc_pll = q40_get_rtc_pll;
mach_set_rtc_pll = q40_set_rtc_pll; mach_set_rtc_pll = q40_set_rtc_pll;
mach_set_clock_mmss = q40_set_clock_mmss; mach_set_clock_mmss = q40_set_clock_mmss;
mach_reset = q40_reset; mach_reset = q40_reset;
mach_get_model = q40_get_model; mach_get_model = q40_get_model;
mach_get_hardware_list = q40_get_hardware_list; mach_get_hardware_list = q40_get_hardware_list;
#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
mach_beep = q40_mksound; mach_beep = q40_mksound;
#endif #endif
#ifdef CONFIG_HEARTBEAT #ifdef CONFIG_HEARTBEAT
mach_heartbeat = q40_heartbeat; mach_heartbeat = q40_heartbeat;
#endif #endif
mach_halt = q40_halt; mach_halt = q40_halt;
/* disable a few things that SMSQ might have left enabled */ /* disable a few things that SMSQ might have left enabled */
q40_disable_irqs(); q40_disable_irqs();
/* no DMA at all, but ide-scsi requires it.. make sure /* no DMA at all, but ide-scsi requires it.. make sure
* all physical RAM fits into the boundary - otherwise * all physical RAM fits into the boundary - otherwise
* allocator may play costly and useless tricks */ * allocator may play costly and useless tricks */
mach_max_dma_address = 1024*1024*1024; mach_max_dma_address = 1024*1024*1024;
/* useful for early debugging stages - writes kernel messages into SRAM */ /* useful for early debugging stages - writes kernel messages into SRAM */
if (!strncmp( m68k_debug_device,"mem",3 )) if (!strncmp( m68k_debug_device,"mem", 3)) {
{ /*printk("using NVRAM debug, q40_mem_cptr=%p\n",q40_mem_cptr);*/
/*printk("using NVRAM debug, q40_mem_cptr=%p\n",q40_mem_cptr);*/ _cpleft = 2000 - ((long)q40_mem_cptr-0xff020000) / 4;
_cpleft=2000-((long)q40_mem_cptr-0xff020000)/4; q40_console_driver.write = q40_mem_console_write;
q40_console_driver.write = q40_mem_console_write; register_console(&q40_console_driver);
register_console(&q40_console_driver); }
}
} }
int q40_parse_bootinfo(const struct bi_record *rec) int q40_parse_bootinfo(const struct bi_record *rec)
{ {
return 1; return 1;
} }
static inline unsigned char bcd2bin (unsigned char b) static inline unsigned char bcd2bin(unsigned char b)
{ {
return ((b>>4)*10 + (b&15)); return (b >> 4) * 10 + (b & 15);
} }
static inline unsigned char bin2bcd (unsigned char b) static inline unsigned char bin2bcd(unsigned char b)
{ {
return (((b/10)*16) + (b%10)); return (b / 10) * 16 + (b % 10);
} }
unsigned long q40_gettimeoffset (void) unsigned long q40_gettimeoffset(void)
{ {
return 5000*(ql_ticks!=0); return 5000 * (ql_ticks != 0);
} }
...@@ -238,9 +245,9 @@ unsigned long q40_gettimeoffset (void) ...@@ -238,9 +245,9 @@ unsigned long q40_gettimeoffset (void)
int q40_hwclk(int op, struct rtc_time *t) int q40_hwclk(int op, struct rtc_time *t)
{ {
if (op) if (op) {
{ /* Write.... */ /* Write.... */
Q40_RTC_CTRL |= Q40_RTC_WRITE; Q40_RTC_CTRL |= Q40_RTC_WRITE;
Q40_RTC_SECS = bin2bcd(t->tm_sec); Q40_RTC_SECS = bin2bcd(t->tm_sec);
Q40_RTC_MINS = bin2bcd(t->tm_min); Q40_RTC_MINS = bin2bcd(t->tm_min);
...@@ -251,25 +258,23 @@ int q40_hwclk(int op, struct rtc_time *t) ...@@ -251,25 +258,23 @@ int q40_hwclk(int op, struct rtc_time *t)
if (t->tm_wday >= 0) if (t->tm_wday >= 0)
Q40_RTC_DOW = bin2bcd(t->tm_wday+1); Q40_RTC_DOW = bin2bcd(t->tm_wday+1);
Q40_RTC_CTRL &= ~(Q40_RTC_WRITE); Q40_RTC_CTRL &= ~(Q40_RTC_WRITE);
} } else {
else /* Read.... */
{ /* Read.... */ Q40_RTC_CTRL |= Q40_RTC_READ;
Q40_RTC_CTRL |= Q40_RTC_READ;
t->tm_year = bcd2bin (Q40_RTC_YEAR);
t->tm_year = bcd2bin (Q40_RTC_YEAR); t->tm_mon = bcd2bin (Q40_RTC_MNTH)-1;
t->tm_mon = bcd2bin (Q40_RTC_MNTH)-1; t->tm_mday = bcd2bin (Q40_RTC_DATE);
t->tm_mday = bcd2bin (Q40_RTC_DATE); t->tm_hour = bcd2bin (Q40_RTC_HOUR);
t->tm_hour = bcd2bin (Q40_RTC_HOUR); t->tm_min = bcd2bin (Q40_RTC_MINS);
t->tm_min = bcd2bin (Q40_RTC_MINS); t->tm_sec = bcd2bin (Q40_RTC_SECS);
t->tm_sec = bcd2bin (Q40_RTC_SECS);
Q40_RTC_CTRL &= ~(Q40_RTC_READ);
Q40_RTC_CTRL &= ~(Q40_RTC_READ);
if (t->tm_year < 70)
if (t->tm_year < 70) t->tm_year += 100;
t->tm_year += 100; t->tm_wday = bcd2bin(Q40_RTC_DOW)-1;
t->tm_wday = bcd2bin(Q40_RTC_DOW)-1;
} }
return 0; return 0;
...@@ -285,29 +290,25 @@ unsigned int q40_get_ss(void) ...@@ -285,29 +290,25 @@ unsigned int q40_get_ss(void)
* clock is out by > 30 minutes. Logic lifted from atari code. * clock is out by > 30 minutes. Logic lifted from atari code.
*/ */
int q40_set_clock_mmss (unsigned long nowtime) int q40_set_clock_mmss(unsigned long nowtime)
{ {
int retval = 0; int retval = 0;
short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
int rtc_minutes; int rtc_minutes;
rtc_minutes = bcd2bin(Q40_RTC_MINS);
rtc_minutes = bcd2bin (Q40_RTC_MINS); if ((rtc_minutes < real_minutes ?
real_minutes - rtc_minutes :
if ((rtc_minutes < real_minutes rtc_minutes - real_minutes) < 30) {
? real_minutes - rtc_minutes Q40_RTC_CTRL |= Q40_RTC_WRITE;
: rtc_minutes - real_minutes) < 30)
{
Q40_RTC_CTRL |= Q40_RTC_WRITE;
Q40_RTC_MINS = bin2bcd(real_minutes); Q40_RTC_MINS = bin2bcd(real_minutes);
Q40_RTC_SECS = bin2bcd(real_seconds); Q40_RTC_SECS = bin2bcd(real_seconds);
Q40_RTC_CTRL &= ~(Q40_RTC_WRITE); Q40_RTC_CTRL &= ~(Q40_RTC_WRITE);
} } else
else
retval = -1; retval = -1;
return retval; return retval;
} }
...@@ -318,21 +319,23 @@ int q40_set_clock_mmss (unsigned long nowtime) ...@@ -318,21 +319,23 @@ int q40_set_clock_mmss (unsigned long nowtime)
static int q40_get_rtc_pll(struct rtc_pll_info *pll) static int q40_get_rtc_pll(struct rtc_pll_info *pll)
{ {
int tmp=Q40_RTC_CTRL; int tmp = Q40_RTC_CTRL;
pll->pll_value = tmp & Q40_RTC_PLL_MASK; pll->pll_value = tmp & Q40_RTC_PLL_MASK;
if (tmp & Q40_RTC_PLL_SIGN) if (tmp & Q40_RTC_PLL_SIGN)
pll->pll_value = -pll->pll_value; pll->pll_value = -pll->pll_value;
pll->pll_max=31; pll->pll_max = 31;
pll->pll_min=-31; pll->pll_min = -31;
pll->pll_posmult=512; pll->pll_posmult = 512;
pll->pll_negmult=256; pll->pll_negmult = 256;
pll->pll_clock=125829120; pll->pll_clock = 125829120;
return 0; return 0;
} }
static int q40_set_rtc_pll(struct rtc_pll_info *pll) static int q40_set_rtc_pll(struct rtc_pll_info *pll)
{ {
if (!pll->pll_ctrl){ if (!pll->pll_ctrl) {
/* the docs are a bit unclear so I am doublesetting */ /* the docs are a bit unclear so I am doublesetting */
/* RTC_WRITE here ... */ /* RTC_WRITE here ... */
int tmp = (pll->pll_value & 31) | (pll->pll_value<0 ? 32 : 0) | int tmp = (pll->pll_value & 31) | (pll->pll_value<0 ? 32 : 0) |
......
...@@ -34,43 +34,43 @@ e_vector *sun3x_prom_vbr; ...@@ -34,43 +34,43 @@ e_vector *sun3x_prom_vbr;
/* Handle returning to the prom */ /* Handle returning to the prom */
void sun3x_halt(void) void sun3x_halt(void)
{ {
unsigned long flags; unsigned long flags;
/* Disable interrupts while we mess with things */ /* Disable interrupts while we mess with things */
local_irq_save(flags); local_irq_save(flags);
/* Restore prom vbr */ /* Restore prom vbr */
__asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr)); asm volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr));
/* Restore prom NMI clock */ /* Restore prom NMI clock */
// sun3x_disable_intreg(5); // sun3x_disable_intreg(5);
sun3_enable_irq(7); sun3_enable_irq(7);
/* Let 'er rip */ /* Let 'er rip */
__asm__ volatile ("trap #14" : : ); asm volatile ("trap #14");
/* Restore everything */ /* Restore everything */
sun3_disable_irq(7); sun3_disable_irq(7);
sun3_enable_irq(5); sun3_enable_irq(5);
__asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors)); asm volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
local_irq_restore(flags); local_irq_restore(flags);
} }
void sun3x_reboot(void) void sun3x_reboot(void)
{ {
/* This never returns, don't bother saving things */ /* This never returns, don't bother saving things */
local_irq_disable(); local_irq_disable();
/* Restore prom vbr */ /* Restore prom vbr */
__asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr)); asm volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr));
/* Restore prom NMI clock */ /* Restore prom NMI clock */
sun3_disable_irq(5); sun3_disable_irq(5);
sun3_enable_irq(7); sun3_enable_irq(7);
/* Let 'er rip */ /* Let 'er rip */
(*romvec->pv_reboot)("vmlinux"); (*romvec->pv_reboot)("vmlinux");
} }
extern char m68k_debug_device[]; extern char m68k_debug_device[];
...@@ -78,54 +78,52 @@ extern char m68k_debug_device[]; ...@@ -78,54 +78,52 @@ extern char m68k_debug_device[];
static void sun3x_prom_write(struct console *co, const char *s, static void sun3x_prom_write(struct console *co, const char *s,
unsigned int count) unsigned int count)
{ {
while (count--) { while (count--) {
if (*s == '\n') if (*s == '\n')
sun3x_putchar('\r'); sun3x_putchar('\r');
sun3x_putchar(*s++); sun3x_putchar(*s++);
} }
} }
/* debug console - write-only */ /* debug console - write-only */
static struct console sun3x_debug = { static struct console sun3x_debug = {
.name = "debug", .name = "debug",
.write = sun3x_prom_write, .write = sun3x_prom_write,
.flags = CON_PRINTBUFFER, .flags = CON_PRINTBUFFER,
.index = -1, .index = -1,
}; };
void sun3x_prom_init(void) void sun3x_prom_init(void)
{ {
/* Read the vector table */ /* Read the vector table */
sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR); sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR);
sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR); sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR);
sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET); sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET);
sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT); sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT);
sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT); sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT);
sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT); sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT);
romvec = (struct linux_romvec *)SUN3X_PROM_BASE; romvec = (struct linux_romvec *)SUN3X_PROM_BASE;
idprom_init(); idprom_init();
if(!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) { if (!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) {
printk("Warning: machine reports strange type %02x\n", printk("Warning: machine reports strange type %02x\n",
idprom->id_machtype); idprom->id_machtype);
printk("Pretending it's a 3/80, but very afraid...\n"); printk("Pretending it's a 3/80, but very afraid...\n");
idprom->id_machtype = SM_SUN3X | SM_3_80; idprom->id_machtype = SM_SUN3X | SM_3_80;
} }
/* point trap #14 at abort. /* point trap #14 at abort.
* XXX this is futile since we restore the vbr first - oops * XXX this is futile since we restore the vbr first - oops
*/ */
vectors[VEC_TRAP14] = sun3x_prom_abort; vectors[VEC_TRAP14] = sun3x_prom_abort;
/* If debug=prom was specified, start the debug console */ /* If debug=prom was specified, start the debug console */
if (!strcmp(m68k_debug_device, "prom")) if (!strcmp(m68k_debug_device, "prom"))
register_console(&sun3x_debug); register_console(&sun3x_debug);
} }
/* some prom functions to export */ /* some prom functions to export */
...@@ -141,7 +139,6 @@ int prom_getbool (int node, char *prop) ...@@ -141,7 +139,6 @@ int prom_getbool (int node, char *prop)
void prom_printf(char *fmt, ...) void prom_printf(char *fmt, ...)
{ {
} }
void prom_halt (void) void prom_halt (void)
...@@ -159,7 +156,7 @@ prom_get_idprom(char *idbuf, int num_bytes) ...@@ -159,7 +156,7 @@ prom_get_idprom(char *idbuf, int num_bytes)
int i; int i;
/* make a copy of the idprom structure */ /* make a copy of the idprom structure */
for(i = 0; i < num_bytes; i++) for (i = 0; i < num_bytes; i++)
idbuf[i] = ((char *)SUN3X_IDPROM)[i]; idbuf[i] = ((char *)SUN3X_IDPROM)[i];
return idbuf[0]; return idbuf[0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment