提交 6ff5801a 编写于 作者: R Roman Zippel 提交者: Linus Torvalds

m68k: reformat various m68k files

Reformat various m68k files, so they actually look like Linux sources.
Signed-off-by: NRoman Zippel <zippel@linux-m68k.org>
Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 b3e2fd9c
......@@ -22,9 +22,7 @@
#include <linux/vt_kern.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#ifdef CONFIG_ZORRO
#include <linux/zorro.h>
#endif
#include <asm/bootinfo.h>
#include <asm/setup.h>
......@@ -85,17 +83,17 @@ extern char m68k_debug_device[];
static void amiga_sched_init(irq_handler_t handler);
/* amiga specific irq functions */
extern void amiga_init_IRQ (void);
extern void amiga_init_IRQ(void);
static void amiga_get_model(char *model);
static int amiga_get_hardware_list(char *buffer);
/* amiga specific timer functions */
static unsigned long amiga_gettimeoffset (void);
static int a3000_hwclk (int, struct rtc_time *);
static int a2000_hwclk (int, struct rtc_time *);
static int amiga_set_clock_mmss (unsigned long);
static unsigned int amiga_get_ss (void);
extern void amiga_mksound( unsigned int count, unsigned int ticks );
static void amiga_reset (void);
static unsigned long amiga_gettimeoffset(void);
static int a3000_hwclk(int, struct rtc_time *);
static int a2000_hwclk(int, struct rtc_time *);
static int amiga_set_clock_mmss(unsigned long);
static unsigned int amiga_get_ss(void);
extern void amiga_mksound(unsigned int count, unsigned int ticks);
static void amiga_reset(void);
extern void amiga_init_sound(void);
static void amiga_savekmsg_init(void);
static void amiga_mem_console_write(struct console *co, const char *b,
......@@ -185,7 +183,7 @@ int amiga_parse_bootinfo(const struct bi_record *record)
dev->slotaddr = cd->cd_SlotAddr;
dev->slotsize = cd->cd_SlotSize;
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
printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
#endif /* CONFIG_ZORRO */
......@@ -198,7 +196,7 @@ int amiga_parse_bootinfo(const struct bi_record *record)
default:
unknown = 1;
}
return(unknown);
return unknown;
}
/*
......@@ -219,7 +217,7 @@ static void __init amiga_identify(void)
strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
}
switch(amiga_model) {
switch (amiga_model) {
case AMI_UNKNOWN:
goto Generic;
......@@ -273,7 +271,7 @@ static void __init amiga_identify(void)
AMIGAHW_SET(CHIP_RAM);
AMIGAHW_SET(PAULA);
switch(amiga_chipset) {
switch (amiga_chipset) {
case CS_OCS:
case CS_ECS:
case CS_AGA:
......@@ -385,26 +383,22 @@ void __init config_amiga(void)
mach_get_model = amiga_get_model;
mach_get_hardware_list = amiga_get_hardware_list;
mach_gettimeoffset = amiga_gettimeoffset;
if (AMIGAHW_PRESENT(A3000_CLK)){
if (AMIGAHW_PRESENT(A3000_CLK)) {
mach_hwclk = a3000_hwclk;
rtc_resource.name = "A3000 RTC";
request_resource(&iomem_resource, &rtc_resource);
}
else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */
} else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
mach_hwclk = a2000_hwclk;
rtc_resource.name = "A2000 RTC";
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 code will not
* be able to allocate any mem
* for transfers, unless we are
* dealing with a Z2 mem only
* system. /Jes
/*
* default MAX_DMA=0xffffffff on all machines. If we don't do so, the SCSI
* code will not be able to allocate any mem for transfers, unless we are
* dealing with a Z2 mem only system. /Jes
*/
mach_max_dma_address = 0xffffffff;
mach_set_clock_mmss = amiga_set_clock_mmss;
mach_get_ss = amiga_get_ss;
......@@ -430,7 +424,8 @@ void __init config_amiga(void)
if (AMIGAHW_PRESENT(ZORRO3)) {
int i, j;
u32 disabled_z2mem = 0;
for (i = 0; i < m68k_num_memory; i++)
for (i = 0; i < m68k_num_memory; i++) {
if (m68k_memory[i].addr < 16*1024*1024) {
if (i == 0) {
/* don't cut off the branch we're sitting on */
......@@ -443,6 +438,7 @@ void __init config_amiga(void)
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);
......@@ -460,10 +456,10 @@ void __init config_amiga(void)
}
/* initialize chipram allocator */
amiga_chip_init ();
amiga_chip_init();
/* debugging using chipram */
if (!strcmp( m68k_debug_device, "mem" )){
if (!strcmp(m68k_debug_device, "mem")) {
if (!AMIGAHW_PRESENT(CHIP_RAM))
printk("Warning: no chipram present for debugging\n");
else {
......@@ -513,7 +509,7 @@ static void __init amiga_sched_init(irq_handler_t timer_routine)
#define TICK_SIZE 10000
/* 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 long ticks, offset = 0;
......@@ -585,15 +581,15 @@ static int a2000_hwclk(int op, struct rtc_time *t)
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;
udelay(70);
tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
}
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 */
t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2;
......@@ -606,7 +602,7 @@ static int a2000_hwclk(int op, struct rtc_time *t)
if (t->tm_year <= 69)
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)
t->tm_hour = 0;
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)
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;
......@@ -660,8 +656,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime)
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;
udelay(70);
tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
......@@ -681,7 +676,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime)
return 0;
}
static unsigned int amiga_get_ss( void )
static unsigned int amiga_get_ss(void)
{
unsigned int s;
......@@ -695,10 +690,10 @@ static unsigned int amiga_get_ss( void )
return s;
}
static NORET_TYPE void amiga_reset( void )
static NORET_TYPE void amiga_reset(void)
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_addr = virt_to_phys(&&jmp_addr_label);
......@@ -708,35 +703,36 @@ static void amiga_reset (void)
/* Setup transparent translation registers for mapping
* of 16 MB kernel segment before disabling translation
*/
__asm__ __volatile__
("movel %0,%/d0\n\t"
"andl #0xff000000,%/d0\n\t"
"orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */
".chip 68040\n\t"
"movec %%d0,%%itt0\n\t"
"movec %%d0,%%dtt0\n\t"
".chip 68k\n\t"
"jmp %0@\n\t"
asm volatile ("\n"
" move.l %0,%%d0\n"
" and.l #0xff000000,%%d0\n"
" or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */
" .chip 68040\n"
" movec %%d0,%%itt0\n"
" movec %%d0,%%dtt0\n"
" .chip 68k\n"
" jmp %0@\n"
: /* no outputs */
: "a" (jmp_addr040));
: "a" (jmp_addr040)
: "d0");
else
/* for 680[23]0, just disable translation and jump to the physical
* address of the label
*/
__asm__ __volatile__
("pmove %/tc,%@\n\t"
"bclr #7,%@\n\t"
"pmove %@,%/tc\n\t"
"jmp %0@\n\t"
asm volatile ("\n"
" pmove %%tc,%@\n"
" bclr #7,%@\n"
" pmove %@,%%tc\n"
" jmp %0@\n"
: /* no outputs */
: "a" (jmp_addr));
jmp_addr_label040:
jmp_addr_label040:
/* disable translation on '040 now */
__asm__ __volatile__
("moveq #0,%/d0\n\t"
".chip 68040\n\t"
"movec %%d0,%%tc\n\t" /* disable MMU */
".chip 68k\n\t"
asm volatile ("\n"
" moveq #0,%%d0\n"
" .chip 68040\n"
" movec %%d0,%%tc\n" /* disable MMU */
" .chip 68k\n"
: /* no outputs */
: /* no inputs */
: "d0");
......@@ -745,21 +741,21 @@ static void amiga_reset (void)
/* pickup reset address from AmigaOS ROM, reset devices and jump
* to reset address
*/
__asm__ __volatile__
("movew #0x2700,%/sr\n\t"
"leal 0x01000000,%/a0\n\t"
"subl %/a0@(-0x14),%/a0\n\t"
"movel %/a0@(4),%/a0\n\t"
"subql #2,%/a0\n\t"
"bra 1f\n\t"
asm volatile ("\n"
" move.w #0x2700,%sr\n"
" lea 0x01000000,%a0\n"
" sub.l %a0@(-0x14),%a0\n"
" move.l %a0@(4),%a0\n"
" subq.l #2,%a0\n"
" jra 1f\n"
/* align on a longword boundary */
__ALIGN_STR "\n"
"1:\n\t"
"reset\n\t"
"jmp %/a0@" : /* Just that gcc scans it for % escapes */ );
for (;;);
" " __ALIGN_STR "\n"
"1:\n"
" reset\n"
" jmp %a0@");
for (;;)
;
}
......@@ -785,8 +781,8 @@ static struct savekmsg *savekmsg;
static void amiga_mem_console_write(struct console *co, const char *s,
unsigned int count)
{
if (savekmsg->size+count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
memcpy(savekmsg->data+savekmsg->size, s, count);
if (savekmsg->size + count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
memcpy(savekmsg->data + savekmsg->size, s, count);
savekmsg->size += count;
}
}
......@@ -878,7 +874,7 @@ void amiga_serial_gets(struct console *co, char *s, int len)
static void __init amiga_debug_init(void)
{
if (!strcmp( m68k_debug_device, "ser" )) {
if (!strcmp(m68k_debug_device, "ser" )) {
/* no initialization required (?) */
amiga_console_driver.write = amiga_serial_console_write;
register_console(&amiga_console_driver);
......@@ -915,7 +911,7 @@ static int amiga_get_hardware_list(char *buffer)
amiga_psfreq, amiga_eclock);
if (AMIGAHW_PRESENT(AMI_VIDEO)) {
char *type;
switch(amiga_chipset) {
switch (amiga_chipset) {
case CS_OCS:
type = "OCS";
break;
......@@ -977,5 +973,5 @@ static int amiga_get_hardware_list(char *buffer)
#undef AMIGAHW_ANNOUNCE
return(len);
return len;
}
此差异已折叠。
......@@ -36,24 +36,24 @@ static struct console atari_console_driver = {
};
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 */
barrier ();
barrier();
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)
{
while (count--) {
if (*str == '\n')
ata_mfp_out( '\r' );
ata_mfp_out( *str++ );
ata_mfp_out('\r');
ata_mfp_out(*str++);
}
}
static inline void ata_scc_out (char c)
static inline void ata_scc_out(char c)
{
do {
MFPDELAY();
......@@ -62,42 +62,43 @@ static inline void ata_scc_out (char c)
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)
{
while (count--) {
if (*str == '\n')
ata_scc_out( '\r' );
ata_scc_out( *str++ );
ata_scc_out('\r');
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 */
barrier ();
barrier();
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)
{
while (count--) {
if (*str == '\n')
ata_midi_out( '\r' );
ata_midi_out( *str++ );
ata_midi_out('\r');
ata_midi_out(*str++);
}
}
static int ata_par_out (char c)
static int ata_par_out(char c)
{
unsigned char tmp;
/* This a some-seconds timeout in case no printer is connected */
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 */
......@@ -106,10 +107,10 @@ static int ata_par_out (char c)
sound_ym.wd_data = tmp & ~0x20; /* set strobe L */
MFPDELAY(); /* wait a bit */
sound_ym.wd_data = tmp | 0x20; /* set strobe H */
return( 1 );
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)
{
static int printer_present = 1;
......@@ -118,12 +119,13 @@ static void atari_par_console_write (struct console *co, const char *str,
return;
while (count--) {
if (*str == '\n')
if (!ata_par_out( '\r' )) {
if (*str == '\n') {
if (!ata_par_out('\r')) {
printer_present = 0;
return;
}
if (!ata_par_out( *str++ )) {
}
if (!ata_par_out(*str++)) {
printer_present = 0;
return;
}
......@@ -133,39 +135,43 @@ static void atari_par_console_write (struct console *co, const char *str,
#ifdef CONFIG_SERIAL_CONSOLE
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();
return( mfp.usart_dta );
return mfp.usart_dta;
}
int atari_scc_console_wait_key(struct console *co)
{
do {
MFPDELAY();
} while( !(scc.cha_b_ctrl & 0x01) ); /* wait for rx buf filled */
} while (!(scc.cha_b_ctrl & 0x01)); /* wait for rx buf filled */
MFPDELAY();
return( scc.cha_b_data );
return scc.cha_b_data;
}
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();
return( acia.mid_data );
return acia.mid_data;
}
#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
* serial console code. */
* serial console code.
*/
#ifndef CONFIG_SERIAL_CONSOLE
static void __init atari_init_mfp_port( int cflag )
static void __init atari_init_mfp_port(int cflag)
#else
void atari_init_mfp_port( int cflag )
void atari_init_mfp_port(int cflag)
#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
* bps, resp., and work only correct if there's a RSVE or RSSPEED
*/
static int baud_table[9] = { 16, 11, 8, 4, 2, 1, 175, 143, 128 };
int baud = cflag & CBAUD;
int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x04 : 0x06) : 0;
......@@ -187,27 +193,27 @@ void atari_init_mfp_port( int cflag )
atari_MFP_init_done = 1;
}
#define SCC_WRITE(reg,val) \
#define SCC_WRITE(reg, val) \
do { \
scc.cha_b_ctrl = (reg); \
MFPDELAY(); \
scc.cha_b_ctrl = (val); \
MFPDELAY(); \
} while(0)
} while (0)
/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a
* delay of ~ 60us. */
#define LONG_DELAY() \
do { \
int i; \
for( i = 100; i > 0; --i ) \
for (i = 100; i > 0; --i) \
MFPDELAY(); \
} while(0)
} while (0)
#ifndef CONFIG_SERIAL_CONSOLE
static void __init atari_init_scc_port( int cflag )
static void __init atari_init_scc_port(int cflag)
#else
void atari_init_scc_port( int cflag )
void atari_init_scc_port(int cflag)
#endif
{
extern int atari_SCC_reset_done;
......@@ -249,32 +255,31 @@ void atari_init_scc_port( int cflag )
reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */;
(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 */
SCC_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
0x04 /* 1 stopbit */ |
clkmode );
SCC_WRITE( 3, reg3 );
SCC_WRITE( 5, reg5 );
SCC_WRITE( 9, 0 ); /* no interrupts */
SCC_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03)
: 0 | 0x04 /* 1 stopbit */ | clkmode);
SCC_WRITE(3, reg3);
SCC_WRITE(5, reg5);
SCC_WRITE(9, 0); /* no interrupts */
LONG_DELAY(); /* extra delay after WR9 access */
SCC_WRITE( 10, 0 ); /* NRZ mode */
SCC_WRITE( 11, clksrc ); /* main clock source */
SCC_WRITE( 12, div ); /* BRG value */
SCC_WRITE( 13, 0 ); /* BRG high byte */
SCC_WRITE( 14, brgsrc_table[baud] );
SCC_WRITE( 14, brgsrc_table[baud] | (div ? 1 : 0) );
SCC_WRITE( 3, reg3 | 1 );
SCC_WRITE( 5, reg5 | 8 );
SCC_WRITE(10, 0); /* NRZ mode */
SCC_WRITE(11, clksrc); /* main clock source */
SCC_WRITE(12, div); /* BRG value */
SCC_WRITE(13, 0); /* BRG high byte */
SCC_WRITE(14, brgsrc_table[baud]);
SCC_WRITE(14, brgsrc_table[baud] | (div ? 1 : 0));
SCC_WRITE(3, reg3 | 1);
SCC_WRITE(5, reg5 | 8);
atari_SCC_reset_done = 1;
atari_SCC_init_done = 1;
}
#ifndef CONFIG_SERIAL_CONSOLE
static void __init atari_init_midi_port( int cflag )
static void __init atari_init_midi_port(int cflag)
#else
void atari_init_midi_port( int cflag )
void atari_init_midi_port(int cflag)
#endif
{
int baud = cflag & CBAUD;
......@@ -302,30 +307,26 @@ void atari_init_midi_port( int cflag )
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 */
strcpy( m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1" );
strcpy(m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1");
}
if (!strcmp( m68k_debug_device, "ser1" )) {
if (!strcmp(m68k_debug_device, "ser1")) {
/* ST-MFP Modem1 serial port */
atari_init_mfp_port( B9600|CS8 );
atari_init_mfp_port(B9600|CS8);
atari_console_driver.write = atari_mfp_console_write;
}
else if (!strcmp( m68k_debug_device, "ser2" )) {
} else if (!strcmp(m68k_debug_device, "ser2")) {
/* SCC Modem2 serial port */
atari_init_scc_port( B9600|CS8 );
atari_init_scc_port(B9600|CS8);
atari_console_driver.write = atari_scc_console_write;
}
else if (!strcmp( m68k_debug_device, "midi" )) {
} else if (!strcmp(m68k_debug_device, "midi")) {
/* MIDI port */
atari_init_midi_port( B9600|CS8 );
atari_init_midi_port(B9600|CS8);
atari_console_driver.write = atari_midi_console_write;
}
else if (!strcmp( m68k_debug_device, "par" )) {
} else if (!strcmp(m68k_debug_device, "par")) {
/* parallel printer */
atari_turnoff_irq( IRQ_MFP_BUSY ); /* avoid ints */
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 */
......@@ -337,10 +338,3 @@ void __init atari_debug_init(void)
if (atari_console_driver.write)
register_console(&atari_console_driver);
}
/*
* Local variables:
* c-indent-level: 4
* tab-width: 8
* End:
*/
......@@ -133,9 +133,6 @@ extern void config_hp300(void);
extern void config_q40(void);
extern void config_sun3x(void);
extern void mac_debugging_short (int, short);
extern void mac_debugging_long (int, long);
#define MASK_256K 0xfffc0000
extern void paging_init(void);
......@@ -145,6 +142,7 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
while (record->tag != BI_LAST) {
int unknown = 0;
const unsigned long *data = record->data;
switch (record->tag) {
case BI_MACHTYPE:
case BI_CPUTYPE:
......@@ -168,7 +166,8 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
break;
case BI_COMMAND_LINE:
strlcpy(m68k_command_line, (const char *)data, sizeof(m68k_command_line));
strlcpy(m68k_command_line, (const char *)data,
sizeof(m68k_command_line));
break;
default:
......@@ -194,7 +193,8 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
if (unknown)
printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
record->tag);
record = (struct bi_record *)((unsigned long)record+record->size);
record = (struct bi_record *)((unsigned long)record +
record->size);
}
m68k_realnum_memory = m68k_num_memory;
......@@ -234,7 +234,7 @@ void __init setup_arch(char **cmdline_p)
/* clear the fpu if we have one */
if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) {
volatile int zero = 0;
asm __volatile__ ("frestore %0" : : "m" (zero));
asm volatile ("frestore %0" : : "m" (zero));
}
#endif
......@@ -262,31 +262,34 @@ void __init setup_arch(char **cmdline_p)
* For the m68k, this is currently only "debug=xxx" to enable printing
* certain kernel messages to some machine-specific device.
*/
for( p = *cmdline_p; p && *p; ) {
for (p = *cmdline_p; p && *p;) {
i = 0;
if (!strncmp( p, "debug=", 6 )) {
strlcpy( m68k_debug_device, p+6, sizeof(m68k_debug_device) );
if ((q = strchr( m68k_debug_device, ' ' ))) *q = 0;
if (!strncmp(p, "debug=", 6)) {
strlcpy(m68k_debug_device, p+6, sizeof(m68k_debug_device));
q = strchr(m68k_debug_device, ' ');
if (q)
*q = 0;
i = 1;
}
#ifdef CONFIG_ATARI
/* This option must be parsed very early */
if (!strncmp( p, "switches=", 9 )) {
extern void atari_switches_setup( const char *, int );
atari_switches_setup( p+9, (q = strchr( p+9, ' ' )) ?
(q - (p+9)) : strlen(p+9) );
if (!strncmp(p, "switches=", 9)) {
extern void atari_switches_setup(const char *, int);
q = strchr(p + 9, ' ');
atari_switches_setup(p + 9, q ? (q - (p + 9)) : strlen(p + 9));
i = 1;
}
#endif
if (i) {
/* option processed, delete it */
if ((q = strchr( p, ' ' )))
strcpy( p, q+1 );
if ((q = strchr(p, ' ')))
strcpy(p, q + 1);
else
*p = 0;
} else {
if ((p = strchr( p, ' ' ))) ++p;
if ((p = strchr(p, ' ')))
++p;
}
}
......@@ -351,7 +354,7 @@ void __init setup_arch(char **cmdline_p)
break;
#endif
default:
panic ("No configuration setup");
panic("No configuration setup");
}
#ifndef CONFIG_SUN3
......@@ -380,7 +383,7 @@ void __init setup_arch(char **cmdline_p)
reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size);
initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
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
......@@ -406,12 +409,12 @@ void __init setup_arch(char **cmdline_p)
isa_sex = 0;
}
#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_sex = 0;
}
#elif defined(CONFIG_AMIGA_PCMCIA)
if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)){
if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)) {
isa_type = AG_ISA;
isa_sex = 1;
}
......@@ -447,7 +450,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
}
#ifdef CONFIG_M68KFPU_EMU_ONLY
fpu="none(soft float)";
fpu = "none(soft float)";
#else
if (m68k_fputype & FPU_68881)
fpu = "68881";
......@@ -478,7 +481,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
else
mmu = "unknown";
clockfreq = loops_per_jiffy*HZ*clockfactor;
clockfreq = loops_per_jiffy * HZ * clockfactor;
seq_printf(m, "CPU:\t\t%s\n"
"MMU:\t\t%s\n"
......@@ -524,26 +527,26 @@ int get_hardware_list(char *buffer)
else
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++)
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)
len += mach_get_hardware_list(buffer+len);
len += mach_get_hardware_list(buffer + len);
return(len);
return len;
}
void check_bugs(void)
{
#ifndef CONFIG_M68KFPU_EMU
if (m68k_fputype == 0) {
printk( KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
"WHICH IS REQUIRED BY LINUX/M68K ***\n" );
printk( KERN_EMERG "Upgrade your hardware or join the FPU "
"emulation project\n" );
panic( "no FPU" );
printk(KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
"WHICH IS REQUIRED BY LINUX/M68K ***\n");
printk(KERN_EMERG "Upgrade your hardware or join the FPU "
"emulation project\n");
panic("no FPU");
}
#endif /* !CONFIG_M68KFPU_EMU */
}
......@@ -65,9 +65,9 @@ void *mac_env; /* Loaded by the boot asm */
unsigned long mac_orig_videoaddr;
/* Mac specific timer functions */
extern unsigned long mac_gettimeoffset (void);
extern int mac_hwclk (int, struct rtc_time *);
extern int mac_set_clock_mmss (unsigned long);
extern unsigned long mac_gettimeoffset(void);
extern int mac_hwclk(int, struct rtc_time *);
extern int mac_set_clock_mmss(unsigned long);
extern int show_mac_interrupts(struct seq_file *, void *);
extern void iop_preinit(void);
extern void iop_init(void);
......@@ -142,8 +142,9 @@ int __init mac_parse_bootinfo(const struct bi_record *record)
break;
default:
unknown = 1;
break;
}
return(unknown);
return unknown;
}
/*
......@@ -155,6 +156,7 @@ int __init mac_parse_bootinfo(const struct bi_record *record)
static void mac_cache_card_flush(int writeback)
{
unsigned long flags;
local_irq_save(flags);
via_flush_cache();
local_irq_restore(flags);
......@@ -162,9 +164,8 @@ static void mac_cache_card_flush(int writeback)
void __init config_mac(void)
{
if (!MACH_IS_MAC) {
if (!MACH_IS_MAC)
printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
}
mach_sched_init = mac_sched_init;
mach_init_IRQ = mac_init_IRQ;
......@@ -199,14 +200,15 @@ void __init config_mac(void)
mac_identify();
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
not. */
/*
* 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
* not.
*/
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;
}
/*
* Check for machine specific fixups.
......@@ -233,8 +235,7 @@ void __init config_mac(void)
struct mac_model *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.
*/
......@@ -784,12 +785,12 @@ void mac_identify(void)
if (!model) {
/* no bootinfo model id -> NetBSD booter was used! */
/* XXX FIXME: breaks for model > 31 */
model=(mac_bi_data.cpuid>>2)&63;
printk (KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
model = (mac_bi_data.cpuid >> 2) & 63;
printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
}
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) {
macintosh_config = m;
break;
......@@ -803,25 +804,25 @@ void mac_identify(void)
iop_preinit();
mac_debug_init();
printk (KERN_INFO "Detected Macintosh model: %d \n", model);
printk(KERN_INFO "Detected Macintosh model: %d \n", model);
/*
* Report booter data:
*/
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 " Penguin bootinfo data:\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.videodepth, mac_bi_data.dimensions & 0xFFFF,
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.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);
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);
#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);
#endif
......@@ -844,8 +845,8 @@ void mac_identify(void)
printk(KERN_WARNING "config.c: wtf: unknown scsi, using 53c80\n");
MACHW_SET(MAC_SCSI_80);
break;
}
iop_init();
via_init();
oss_init();
......@@ -860,6 +861,6 @@ void mac_report_hardware(void)
static void mac_get_model(char *str)
{
strcpy(str,"Macintosh ");
strcpy(str, "Macintosh ");
strcat(str, macintosh_config->name);
}
......@@ -52,7 +52,7 @@ extern void mac_serial_print(const char *);
*/
#ifdef DEBUG_SCREEN
static int peng=0, line=0;
static int peng, line;
#endif
void mac_debugging_short(int pos, short num)
......@@ -74,15 +74,14 @@ void mac_debugging_short(int pos, short num)
}
/* calculate current offset */
pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes)
+80*peng;
pengoffset = (unsigned char *)mac_videobase +
(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 */
*pptr++ = (num & ( 1 << (8*sizeof(short)-i-1) ) ? 0xFF : 0x00);
*pptr++ = (num & (1 << (8*sizeof(short)-i-1)) ? 0xFF : 0x00);
}
peng++;
......@@ -115,11 +114,10 @@ void mac_debugging_long(int pos, long addr)
pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes)
+80*peng;
pptr=pengoffset;
pptr = pengoffset;
for(i=0;i<8*sizeof(long);i++) /* # of bits */
{
*pptr++ = (addr & ( 1 << (8*sizeof(long)-i-1) ) ? 0xFF : 0x00);
for (i = 0; i < 8 * sizeof(long); i++) { /* # of bits */
*pptr++ = (addr & (1 << (8*sizeof(long)-i-1)) ? 0xFF : 0x00);
}
peng++;
......@@ -136,8 +134,7 @@ void mac_debugging_long(int pos, long addr)
* TODO: serial debug code
*/
struct mac_SCC
{
struct mac_SCC {
u_char cha_b_ctrl;
u_char char_dummy1;
u_char cha_a_ctrl;
......@@ -145,7 +142,7 @@ struct mac_SCC
u_char cha_b_data;
u_char char_dummy3;
u_char cha_a_data;
};
};
# define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase))
......@@ -178,7 +175,7 @@ static struct console mac_console_driver = {
* 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)
{
mac_serial_print(str);
......@@ -190,47 +187,49 @@ void mac_debug_console_write (struct console *co, const char *str,
#define uSEC 1
static inline void mac_sccb_out (char c)
static inline void mac_sccb_out(char c)
{
int i;
do {
for( i = uSEC; i > 0; --i )
for (i = uSEC; i > 0; --i)
barrier();
} while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */
for( i = uSEC; i > 0; --i )
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;
do {
for( i = uSEC; i > 0; --i )
for (i = uSEC; i > 0; --i)
barrier();
} while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */
for( i = uSEC; i > 0; --i )
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)
{
while (count--) {
if (*str == '\n')
mac_sccb_out( '\r' );
mac_sccb_out( *str++ );
mac_sccb_out('\r');
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)
{
while (count--) {
if (*str == '\n')
mac_scca_out( '\r' );
mac_scca_out( *str++ );
mac_scca_out('\r');
mac_scca_out(*str++);
}
}
......@@ -242,10 +241,10 @@ void mac_scca_console_write (struct console *co, const char *str,
do { \
int i; \
scc.cha_b_ctrl = (reg); \
for( i = uSEC; i > 0; --i ) \
for (i = uSEC; i > 0; --i) \
barrier(); \
scc.cha_b_ctrl = (val); \
for( i = uSEC; i > 0; --i ) \
for (i = uSEC; i > 0; --i) \
barrier(); \
} while(0)
......@@ -253,10 +252,10 @@ void mac_scca_console_write (struct console *co, const char *str,
do { \
int i; \
scc.cha_a_ctrl = (reg); \
for( i = uSEC; i > 0; --i ) \
for (i = uSEC; i > 0; --i) \
barrier(); \
scc.cha_a_ctrl = (val); \
for( i = uSEC; i > 0; --i ) \
for (i = uSEC; i > 0; --i) \
barrier(); \
} while(0)
......@@ -266,14 +265,14 @@ void mac_scca_console_write (struct console *co, const char *str,
#define LONG_DELAY() \
do { \
int i; \
for( i = 60*uSEC; i > 0; --i ) \
for (i = 60*uSEC; i > 0; --i) \
barrier(); \
} while(0)
#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
void mac_init_scc_port( int cflag, int port )
void mac_init_scc_port(int cflag, int port)
#endif
{
extern int mac_SCC_reset_done;
......@@ -310,40 +309,40 @@ void mac_init_scc_port( int cflag, int port )
if (port == 1) {
(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 */
SCCB_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
SCCB_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
0x04 /* 1 stopbit */ |
clkmode );
SCCB_WRITE( 3, reg3 );
SCCB_WRITE( 5, reg5 );
SCCB_WRITE( 9, 0 ); /* no interrupts */
clkmode);
SCCB_WRITE(3, reg3);
SCCB_WRITE(5, reg5);
SCCB_WRITE(9, 0); /* no interrupts */
LONG_DELAY(); /* extra delay after WR9 access */
SCCB_WRITE( 10, 0 ); /* NRZ mode */
SCCB_WRITE( 11, clksrc ); /* main clock source */
SCCB_WRITE( 12, div ); /* BRG value */
SCCB_WRITE( 13, 0 ); /* BRG high byte */
SCCB_WRITE( 14, 1 );
SCCB_WRITE( 3, reg3 | 1 );
SCCB_WRITE( 5, reg5 | 8 );
SCCB_WRITE(10, 0); /* NRZ mode */
SCCB_WRITE(11, clksrc); /* main clock source */
SCCB_WRITE(12, div); /* BRG value */
SCCB_WRITE(13, 0); /* BRG high byte */
SCCB_WRITE(14, 1);
SCCB_WRITE(3, reg3 | 1);
SCCB_WRITE(5, reg5 | 8);
} else if (port == 0) {
(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 */
SCCA_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
SCCA_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
0x04 /* 1 stopbit */ |
clkmode );
SCCA_WRITE( 3, reg3 );
SCCA_WRITE( 5, reg5 );
SCCA_WRITE( 9, 0 ); /* no interrupts */
clkmode);
SCCA_WRITE(3, reg3);
SCCA_WRITE(5, reg5);
SCCA_WRITE(9, 0); /* no interrupts */
LONG_DELAY(); /* extra delay after WR9 access */
SCCA_WRITE( 10, 0 ); /* NRZ mode */
SCCA_WRITE( 11, clksrc ); /* main clock source */
SCCA_WRITE( 12, div ); /* BRG value */
SCCA_WRITE( 13, 0 ); /* BRG high byte */
SCCA_WRITE( 14, 1 );
SCCA_WRITE( 3, reg3 | 1 );
SCCA_WRITE( 5, reg5 | 8 );
SCCA_WRITE(10, 0); /* NRZ mode */
SCCA_WRITE(11, clksrc); /* main clock source */
SCCA_WRITE(12, div); /* BRG value */
SCCA_WRITE(13, 0); /* BRG high byte */
SCCA_WRITE(14, 1);
SCCA_WRITE(3, reg3 | 1);
SCCA_WRITE(5, reg5 | 8);
}
mac_SCC_reset_done = 1;
......@@ -351,12 +350,12 @@ void mac_init_scc_port( int cflag, int port )
}
#endif /* DEBUG_SERIAL */
void mac_init_scca_port( int cflag )
void mac_init_scca_port(int cflag)
{
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);
}
......@@ -364,23 +363,22 @@ void mac_init_sccb_port( int cflag )
void __init mac_debug_init(void)
{
#ifdef DEBUG_SERIAL
if ( !strcmp( m68k_debug_device, "ser" )
|| !strcmp( m68k_debug_device, "ser1" )) {
if (!strcmp(m68k_debug_device, "ser") ||
!strcmp(m68k_debug_device, "ser1")) {
/* 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;
scc_port = 0;
}
else if (!strcmp( m68k_debug_device, "ser2" )) {
} else if (!strcmp(m68k_debug_device, "ser2")) {
/* 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;
scc_port = 1;
}
#endif
#ifdef DEBUG_HEADS
if ( !strcmp( m68k_debug_device, "scn" )
|| !strcmp( m68k_debug_device, "con" )) {
if (!strcmp(m68k_debug_device, "scn") ||
!strcmp(m68k_debug_device, "con")) {
/* display, using head.S console routines */
mac_console_driver.write = mac_debug_console_write;
}
......@@ -388,10 +386,3 @@ void __init mac_debug_init(void)
if (mac_console_driver.write)
register_console(&mac_console_driver);
}
/*
* Local variables:
* c-indent-level: 4
* tab-width: 8
* End:
*/
......@@ -35,24 +35,24 @@
#include <asm/machdep.h>
#include <asm/q40_master.h>
extern irqreturn_t q40_process_int (int level, struct pt_regs *regs);
extern void q40_init_IRQ (void);
extern irqreturn_t q40_process_int(int level, struct pt_regs *regs);
extern void q40_init_IRQ(void);
static void q40_get_model(char *model);
static int q40_get_hardware_list(char *buffer);
extern void q40_sched_init(irq_handler_t handler);
extern unsigned long q40_gettimeoffset (void);
extern int q40_hwclk (int, struct rtc_time *);
extern unsigned int q40_get_ss (void);
extern int q40_set_clock_mmss (unsigned long);
extern unsigned long q40_gettimeoffset(void);
extern int q40_hwclk(int, struct rtc_time *);
extern unsigned int q40_get_ss(void);
extern int q40_set_clock_mmss(unsigned long);
static int q40_get_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);
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[];
static void q40_mem_console_write(struct console *co, const char *b,
......@@ -74,36 +74,38 @@ static int _cpleft;
static void q40_mem_console_write(struct console *co, const char *s,
unsigned int count)
{
char *p=(char *)s;
const char *p = s;
if (count<_cpleft)
while (count-- >0){
*q40_mem_cptr=*p++;
q40_mem_cptr+=4;
if (count < _cpleft) {
while (count-- > 0) {
*q40_mem_cptr = *p++;
q40_mem_cptr += 4;
_cpleft--;
}
}
}
#if 0
void printq40(char *str)
{
int l=strlen(str);
char *p=q40_mem_cptr;
int l = strlen(str);
char *p = q40_mem_cptr;
while (l-- >0 && _cpleft-- >0)
{
*p=*str++;
p+=4;
while (l-- > 0 && _cpleft-- > 0) {
*p = *str++;
p += 4;
}
q40_mem_cptr=p;
q40_mem_cptr = p;
}
#endif
static int halted=0;
static int halted;
#ifdef CONFIG_HEARTBEAT
static void q40_heartbeat(int on)
{
if (halted) return;
if (halted)
return;
if (on)
Q40_LED_ON();
......@@ -114,21 +116,23 @@ static void q40_heartbeat(int on)
void q40_reset(void)
{
halted=1;
printk ("\n\n*******************************************\n"
halted = 1;
printk("\n\n*******************************************\n"
"Called q40_reset : press the RESET button!! \n"
"*******************************************\n");
Q40_LED_ON();
while(1) ;
while (1)
;
}
void q40_halt(void)
{
halted=1;
printk ("\n\n*******************\n"
halted = 1;
printk("\n\n*******************\n"
" Called q40_halt\n"
"*******************\n");
Q40_LED_ON();
while(1) ;
while (1)
;
}
static void q40_get_model(char *model)
......@@ -144,15 +148,19 @@ static int q40_get_hardware_list(char *buffer)
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)
{
unsigned i,j;
unsigned i, j;
j=0;
while((i=serports[j++])) outb(0,i+UART_IER);
master_outb(0,EXT_ENABLE_REG);
master_outb(0,KEY_IRQ_ENABLE_REG);
j = 0;
while ((i = serports[j++]))
outb(0, i + UART_IER);
master_outb(0, EXT_ENABLE_REG);
master_outb(0, KEY_IRQ_ENABLE_REG);
}
void __init config_q40(void)
......@@ -188,10 +196,9 @@ void __init config_q40(void)
mach_max_dma_address = 1024*1024*1024;
/* 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);*/
_cpleft=2000-((long)q40_mem_cptr-0xff020000)/4;
_cpleft = 2000 - ((long)q40_mem_cptr-0xff020000) / 4;
q40_console_driver.write = q40_mem_console_write;
register_console(&q40_console_driver);
}
......@@ -204,20 +211,20 @@ int q40_parse_bootinfo(const struct bi_record *rec)
}
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,8 +245,8 @@ unsigned long q40_gettimeoffset (void)
int q40_hwclk(int op, struct rtc_time *t)
{
if (op)
{ /* Write.... */
if (op) {
/* Write.... */
Q40_RTC_CTRL |= Q40_RTC_WRITE;
Q40_RTC_SECS = bin2bcd(t->tm_sec);
......@@ -252,9 +259,8 @@ int q40_hwclk(int op, struct rtc_time *t)
Q40_RTC_DOW = bin2bcd(t->tm_wday+1);
Q40_RTC_CTRL &= ~(Q40_RTC_WRITE);
}
else
{ /* Read.... */
} else {
/* Read.... */
Q40_RTC_CTRL |= Q40_RTC_READ;
t->tm_year = bcd2bin (Q40_RTC_YEAR);
......@@ -269,7 +275,6 @@ int q40_hwclk(int op, struct rtc_time *t)
if (t->tm_year < 70)
t->tm_year += 100;
t->tm_wday = bcd2bin(Q40_RTC_DOW)-1;
}
return 0;
......@@ -285,29 +290,25 @@ unsigned int q40_get_ss(void)
* 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;
short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
int rtc_minutes;
rtc_minutes = bcd2bin(Q40_RTC_MINS);
rtc_minutes = bcd2bin (Q40_RTC_MINS);
if ((rtc_minutes < real_minutes
? real_minutes - rtc_minutes
: rtc_minutes - real_minutes) < 30)
{
if ((rtc_minutes < real_minutes ?
real_minutes - rtc_minutes :
rtc_minutes - real_minutes) < 30) {
Q40_RTC_CTRL |= Q40_RTC_WRITE;
Q40_RTC_MINS = bin2bcd(real_minutes);
Q40_RTC_SECS = bin2bcd(real_seconds);
Q40_RTC_CTRL &= ~(Q40_RTC_WRITE);
}
else
} else
retval = -1;
return retval;
}
......@@ -318,21 +319,23 @@ int q40_set_clock_mmss (unsigned long nowtime)
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;
if (tmp & Q40_RTC_PLL_SIGN)
pll->pll_value = -pll->pll_value;
pll->pll_max=31;
pll->pll_min=-31;
pll->pll_posmult=512;
pll->pll_negmult=256;
pll->pll_clock=125829120;
pll->pll_max = 31;
pll->pll_min = -31;
pll->pll_posmult = 512;
pll->pll_negmult = 256;
pll->pll_clock = 125829120;
return 0;
}
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 */
/* RTC_WRITE here ... */
int tmp = (pll->pll_value & 31) | (pll->pll_value<0 ? 32 : 0) |
......
......@@ -40,20 +40,20 @@ void sun3x_halt(void)
local_irq_save(flags);
/* 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 */
// sun3x_disable_intreg(5);
sun3_enable_irq(7);
/* Let 'er rip */
__asm__ volatile ("trap #14" : : );
asm volatile ("trap #14");
/* Restore everything */
sun3_disable_irq(7);
sun3_enable_irq(5);
__asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
asm volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
local_irq_restore(flags);
}
......@@ -63,7 +63,7 @@ void sun3x_reboot(void)
local_irq_disable();
/* 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 */
sun3_disable_irq(5);
......@@ -108,7 +108,7 @@ void sun3x_prom_init(void)
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",
idprom->id_machtype);
printk("Pretending it's a 3/80, but very afraid...\n");
......@@ -124,8 +124,6 @@ void sun3x_prom_init(void)
if (!strcmp(m68k_debug_device, "prom"))
register_console(&sun3x_debug);
}
/* some prom functions to export */
......@@ -141,7 +139,6 @@ int prom_getbool (int node, char *prop)
void prom_printf(char *fmt, ...)
{
}
void prom_halt (void)
......@@ -159,7 +156,7 @@ prom_get_idprom(char *idbuf, int num_bytes)
int i;
/* 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];
return idbuf[0];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册