Date: Wed, 17 Dec 1997 14:00:30 GMT From: Roman Hodek To: linux-m68k@lists.linux-m68k.org In-reply-to: (message from Geert Uytterhoeven on Wed, 17 Dec 1997 11:42:57 +0100 (CET)) Subject: Re: L68K: 2.1.72 Sender: owner-linux-m68k@phil.uni-sb.de Ok, here is my mega-patch that re-introduces lots of missing patches in 2.1.72. Changes are: - Add missing parts of sercons (was only partially applied) - MACH_IS_* and atari_mch_type stuff re-introduced (requires ataboot-3.1 on Medusa/Hades/AB40!) - atari_rtc_year_offset stuff - Make stram.c compile without CONFIG_STRAM_SWAP defined - Heartbeat for Amiga & Atari - one little kgdb change - little acsi + SLM fixes - Only one floppy on Falcon, no ataflop on Hades - Juergen's MFP autodetection + my rewrite of asm's - in atari_MFPser.c, some currMFP(info) -> currMFP rewrites were missing (probably the cause of the compile errors reported) - SCC_chan_a_info, char size fix - mfp.int_pn_[ab] = instead of &= New stuff (not posted before): - Remove undefined reference to dev_tint() in atarilance.c - Maintain stats.{rx,tx}_bytes in atarilance.c The serial console compiles at it is now, but I couldn't test it yet. Maybe another fix follows tomorrow. But I want to put this thing out now, so that Geert can continue to build in the video stuff. Roman ------------------------------------------------------------------------------ diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/arch/m68k/amiga/config.c linux-2.1.72/arch/m68k/amiga/config.c --- linux-2.1.72.orig/arch/m68k/amiga/config.c Fri Dec 12 22:35:44 1997 +++ linux-2.1.72/arch/m68k/amiga/config.c Wed Dec 17 11:27:06 1997 @@ -75,15 +75,13 @@ extern void amiga_floppy_setup(char *, int *); #endif static void amiga_reset (void); -static int amiga_wait_key(struct console *co); extern struct consw fb_con; extern void zorro_init(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, unsigned int count); -static void amiga_serial_console_write(struct console *co, const char *s, - unsigned int count); + void amiga_serial_console_write(const char *s, unsigned int count); static void amiga_debug_init(void); static struct console amiga_console_driver = { @@ -812,7 +810,7 @@ ; } -static 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) { while (count--) { @@ -828,16 +826,24 @@ amiga_serial_console_write(NULL, s, strlen(s)); } +int amiga_serial_console_wait_key(struct console *co) +{ + int ch; + + while (!(custom.intreqr & IF_RBF)) + barrier(); + ch = custom.serdatr & 0xff; + /* clear the interrupt, so that another character can be read */ + custom.intreq = IF_RBF; + return ch; +} + void amiga_serial_gets(char *s, int len) { int ch, cnt = 0; while (1) { - while (!(custom.intreqr & IF_RBF)) - barrier(); - ch = custom.serdatr & 0xff; - /* clear the interrupt, so that another character can be read */ - custom.intreq = IF_RBF; + ch = amiga_serial_console_wait_key(); /* Check for backspace. */ if (ch == 8 || ch == 127) { diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/arch/m68k/atari/ataints.c linux-2.1.72/arch/m68k/atari/ataints.c --- linux-2.1.72.orig/arch/m68k/atari/ataints.c Mon Dec 15 20:37:00 1997 +++ linux-2.1.72/arch/m68k/atari/ataints.c Wed Dec 17 13:19:23 1997 @@ -379,7 +379,7 @@ * gets overruns) */ - if (!is_hades) + if (!MACH_IS_HADES) vectors[VEC_INT2] = falcon_hblhandler; } diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/arch/m68k/atari/atari_ksyms.c linux-2.1.72/arch/m68k/atari/atari_ksyms.c --- linux-2.1.72.orig/arch/m68k/atari/atari_ksyms.c Sat Nov 29 20:32:04 1997 +++ linux-2.1.72/arch/m68k/atari/atari_ksyms.c Tue Dec 16 16:37:03 1997 @@ -15,10 +15,10 @@ extern int atari_SCC_reset_done; EXPORT_SYMBOL(atari_mch_cookie); +EXPORT_SYMBOL(atari_mch_type); EXPORT_SYMBOL(atari_hw_present); EXPORT_SYMBOL(atari_switches); -EXPORT_SYMBOL(is_medusa); -EXPORT_SYMBOL(is_hades); +EXPORT_SYMBOL(atari_dont_touch_floppy_select); EXPORT_SYMBOL(atari_register_vme_int); EXPORT_SYMBOL(atari_unregister_vme_int); EXPORT_SYMBOL(stdma_lock); diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/arch/m68k/atari/config.c linux-2.1.72/arch/m68k/atari/config.c --- linux-2.1.72.orig/arch/m68k/atari/config.c Mon Dec 15 20:37:01 1997 +++ linux-2.1.72/arch/m68k/atari/config.c Wed Dec 17 13:36:38 1997 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -51,8 +52,11 @@ #endif u_long atari_mch_cookie; +u_long atari_mch_type = 0; struct atari_hw_present atari_hw_present; u_long atari_switches = 0; +int atari_dont_touch_floppy_select = 0; +int atari_rtc_year_offset; extern char m68k_debug_device[]; @@ -101,6 +105,10 @@ NULL }; +/* Flag that Modem1 port is already initialized and used */ +int atari_MFP_init_done = 0; +/* Flag that Modem1 port is already initialized and used */ +int atari_SCC_init_done = 0; /* Can be set somewhere, if a SCC master reset has already be done and should * not be repeated; used by kgdb */ int atari_SCC_reset_done = 0; @@ -258,6 +266,9 @@ case BI_ATARI_MCH_COOKIE: atari_mch_cookie = *data; break; + case BI_ATARI_MCH_TYPE: + atari_mch_type = *data; + break; default: unknown = 1; } @@ -309,6 +320,8 @@ __initfunc(void config_atari(void)) { + unsigned short tos_version; + memset(&atari_hw_present, 0, sizeof(atari_hw_present)); atari_debug_init(); @@ -357,7 +370,7 @@ */ printk( "Atari hardware found: " ); - if (is_medusa || is_hades) { + if (MACH_IS_MEDUSA || MACH_IS_HADES) { /* There's no Atari video hardware on the Medusa, but all the * addresses below generate a DTACK so no bus error occurs! */ } @@ -399,12 +412,12 @@ ATARIHW_SET(SCSI_DMA); printk( "TT_SCSI_DMA " ); } - if (!is_hades && hwreg_present( &st_dma.dma_hi )) { + if (!MACH_IS_HADES && hwreg_present( &st_dma.dma_hi )) { ATARIHW_SET(STND_DMA); printk( "STND_DMA " ); } - if (is_medusa || /* The ST-DMA address registers aren't readable - * on all Medusas, so the test below may fail */ + if (MACH_IS_MEDUSA || /* The ST-DMA address registers aren't readable + * on all Medusas, so the test below may fail */ (hwreg_present( &st_dma.dma_vhi ) && (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) && st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa && @@ -421,11 +434,12 @@ ATARIHW_SET(YM_2149); printk( "YM2149 " ); } - if (!is_medusa && !is_hades && hwreg_present( &tt_dmasnd.ctrl )) { + if (!MACH_IS_MEDUSA && !MACH_IS_HADES && + hwreg_present( &tt_dmasnd.ctrl )) { ATARIHW_SET(PCM_8BIT); printk( "PCM " ); } - if (!is_hades && hwreg_present( &codec.unused5 )) { + if (!MACH_IS_HADES && hwreg_present( &codec.unused5 )) { ATARIHW_SET(CODEC); printk( "CODEC " ); } @@ -439,7 +453,7 @@ (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) #else - !is_medusa && !is_hades + !MACH_IS_MEDUSA && !MACH_IS_HADES #endif ) { ATARIHW_SET(SCC_DMA); @@ -453,7 +467,7 @@ ATARIHW_SET( ST_ESCC ); printk( "ST_ESCC " ); } - if (is_hades) + if (MACH_IS_HADES) { ATARIHW_SET( VME ); printk( "VME " ); @@ -468,7 +482,7 @@ ATARIHW_SET(ANALOG_JOY); printk( "ANALOG_JOY " ); } - if (!is_hades && hwreg_present( blitter.halftone )) { + if (!MACH_IS_HADES && hwreg_present( blitter.halftone )) { ATARIHW_SET(BLITTER); printk( "BLITTER " ); } @@ -477,7 +491,7 @@ printk( "IDE " ); } #if 1 /* This maybe wrong */ - if (!is_medusa && !is_hades && + if (!MACH_IS_MEDUSA && !MACH_IS_HADES && hwreg_present( &tt_microwire.data ) && hwreg_present( &tt_microwire.mask ) && (tt_microwire.mask = 0x7ff, @@ -495,20 +509,20 @@ mach_hwclk = atari_hwclk; mach_set_clock_mmss = atari_set_clock_mmss; } - if (!is_hades && hwreg_present( &mste_rtc.sec_ones)) { + if (!MACH_IS_HADES && hwreg_present( &mste_rtc.sec_ones)) { ATARIHW_SET(MSTE_CLK); printk( "MSTE_CLK "); mach_gettod = atari_mste_gettod; mach_hwclk = atari_mste_hwclk; mach_set_clock_mmss = atari_mste_set_clock_mmss; } - if (!is_medusa && !is_hades && + if (!MACH_IS_MEDUSA && !MACH_IS_HADES && hwreg_present( &dma_wd.fdc_speed ) && hwreg_write( &dma_wd.fdc_speed, 0 )) { ATARIHW_SET(FDCSPEED); printk( "FDC_SPEED "); } - if (!is_hades && !ATARIHW_PRESENT(ST_SCSI)) { + if (!MACH_IS_HADES && !ATARIHW_PRESENT(ST_SCSI)) { ATARIHW_SET(ACSI); printk( "ACSI " ); } @@ -574,7 +588,7 @@ * Settings: supervisor only, non-cacheable, serialized, read and write. */ - if (is_hades) { + if (MACH_IS_HADES) { __asm__ __volatile__ ("movel %0,%/d0\n\t" ".chip 68040\n\t" "movec %%d0,%%itt0\n\t" @@ -584,6 +598,18 @@ : "g" (0x803fa040) : "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; } __initfunc(static void @@ -697,7 +723,6 @@ int *hourp, int *minp, int *secp) { unsigned char ctrl; - unsigned short tos_version; int hour, pm; while (!(RTC_READ(RTC_FREQ_SELECT) & RTC_UIP)) ; @@ -731,17 +756,7 @@ *hourp = hour; /* Adjust values (let the setup valid) */ - - /* 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 = (is_medusa || is_hades) ? 0xfff : *(unsigned short *)0xFF000002; - *yearp += (tos_version < 0x306) ? 70 : 68; + *yearp += atari_rtc_year_offset; } #define HWCLK_POLL_INTERVAL 5 @@ -809,14 +824,9 @@ { int sec=0, min=0, hour=0, day=0, mon=0, year=0, wday=0; unsigned long flags; - unsigned short tos_version; unsigned char ctrl; int pm = 0; - /* Tos version at Physical 2. See above for explanation why we - cannot use PTOV(2). */ - tos_version = (is_medusa || is_hades) ? 0xfff : *(unsigned short *)0xff000002; - ctrl = RTC_READ(RTC_CONTROL); /* control registers are * independent from the UIP */ @@ -828,7 +838,7 @@ hour = t->hour; day = t->day; mon = t->mon + 1; - year = t->year - ((tos_version < 0x306) ? 70 : 68); + year = t->year - atari_rtc_year_offset; wday = t->wday + (t->wday >= 0); if (!(ctrl & RTC_24H)) { @@ -924,7 +934,7 @@ t->hour = hour; t->day = day; t->mon = mon - 1; - t->year = year + ((tos_version < 0x306) ? 70 : 68); + t->year = year + atari_rtc_year_offset; t->wday = wday - 1; } @@ -1002,8 +1012,8 @@ mfp.usart_dta = c; } -static void atari_mfp_console_write (struct console *co, const char *str, - unsigned int count) +void atari_mfp_console_write (struct console *co, const char *str, + unsigned int count) { while (count--) { if (*str == '\n') @@ -1021,8 +1031,8 @@ scc.cha_b_data = c; } -static void atari_scc_console_write (struct console *co, const char *str, - unsigned int count) +void atari_scc_console_write (struct console *co, const char *str, + unsigned int count) { while (count--) { if (*str == '\n') @@ -1038,7 +1048,8 @@ acia.mid_data = c; } -void atari_midi_console_write (const char *str, unsigned int count) +void atari_midi_console_write (struct console *co, const char *str, + unsigned int count) { while (count--) { if (*str == '\n') @@ -1049,7 +1060,6 @@ static int ata_par_out (char c) { - extern unsigned long loops_per_sec; unsigned char tmp; /* This a some-seconds timeout in case no printer is connected */ unsigned long i = loops_per_sec > 1 ? loops_per_sec : 10000000; @@ -1089,55 +1099,196 @@ } } +#ifdef CONFIG_SERIAL_CONSOLE +int atari_mfp_console_wait_key(struct console *co) +{ + while( !(mfp.rcv_stat & 0x80) ) /* wait for rx buf filled */ + barrier(); + 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 */ + MFPDELAY(); + 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 */ + barrier(); + return( acia.mid_data ); +} +#endif + +/* 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. */ +#ifndef CONFIG_SERIAL_CONSOLE +__initfunc(static void atari_init_mfp_port( int cflag )) +#else +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 */ + 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; + int csize = ((cflag & CSIZE) == CS7) ? 0x20 : 0x00; + + if (cflag & CBAUDEX) + baud += B38400; + if (baud < B1200 || baud > B38400+2) + baud = B9600; /* use default 9600bps for non-implemented rates */ + baud -= B1200; /* baud_table[] starts at 1200bps */ + + mfp.trn_stat &= ~0x01; /* disable TX */ + mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */ + mfp.tim_ct_cd &= 0x70; /* stop timer D */ + mfp.tim_dt_d = baud_table[baud]; + mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ + mfp.trn_stat |= 0x01; /* enable TX */ + + atari_MFP_init_done = 1; +} + +#define SCC_WRITE(reg,val) \ + do { \ + scc.cha_b_ctrl = (reg); \ + MFPDELAY(); \ + scc.cha_b_ctrl = (val); \ + MFPDELAY(); \ + } while(0) + +/* loops_per_sec 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 ) \ + MFPDELAY(); \ + } while(0) + +#ifndef CONFIG_SERIAL_CONSOLE +__initfunc(static void atari_init_scc_port( int cflag )) +#else +void atari_init_scc_port( int cflag ) +#endif +{ + extern int atari_SCC_reset_done; + static int clksrc_table[9] = + /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */ + { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 }; + static int brgsrc_table[9] = + /* reg 14: 0 = RTxC, 2 = PCLK */ + { 2, 2, 2, 2, 2, 2, 0, 2, 2 }; + static int clkmode_table[9] = + /* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */ + { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 }; + static int div_table[9] = + /* reg12 (BRG low) */ + { 208, 138, 103, 50, 24, 11, 1, 0, 0 }; + + int baud = cflag & CBAUD; + int clksrc, clkmode, div, reg3, reg5; + + if (cflag & CBAUDEX) + baud += B38400; + if (baud < B1200 || baud > B38400+2) + baud = B9600; /* use default 9600bps for non-implemented rates */ + baud -= B1200; /* tables starts at 1200bps */ + + clksrc = clksrc_table[baud]; + clkmode = clkmode_table[baud]; + div = div_table[baud]; + if (ATARIHW_PRESENT(TT_MFP) && baud >= 6) { + /* special treatment for TT, where rates >= 38400 are done via TRxC */ + clksrc = 0x28; /* TRxC */ + clkmode = baud == 6 ? 0xc0 : + baud == 7 ? 0x80 : /* really 76800bps */ + 0x40; /* really 153600bps */ + div = 0; + } + + reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40; + reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */; + + (void)scc.cha_b_ctrl; /* reset reg pointer */ + 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 */ + 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 ); + + atari_SCC_reset_done = 1; + atari_SCC_init_done = 1; +} + +#ifndef CONFIG_SERIAL_CONSOLE +__initfunc(static void atari_init_midi_port( int cflag )) +#else +void atari_init_midi_port( int cflag ) +#endif +{ + int baud = cflag & CBAUD; + int csize = ((cflag & CSIZE) == CS8) ? 0x10 : 0x00; + /* warning 7N1 isn't possible! (instead 7O2 is used...) */ + int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x0c : 0x08) : 0x04; + int div; + + /* 4800 selects 7812.5, 115200 selects 500000, all other (incl. 9600 as + * default) the standard MIDI speed 31250. */ + if (cflag & CBAUDEX) + baud += B38400; + if (baud == B4800) + div = ACIA_DIV64; /* really 7812.5 bps */ + else if (baud == B38400+2 /* 115200 */) + div = ACIA_DIV1; /* really 500 kbps (does that work??) */ + else + div = ACIA_DIV16; /* 31250 bps, standard for MIDI */ + + /* RTS low, ints disabled */ + acia.mid_ctrl = div | csize | parity | + ((atari_switches & ATARI_SWITCH_MIDI) ? + ACIA_RHTID : ACIA_RLTID); +} __initfunc(static void atari_debug_init(void)) { #ifdef CONFIG_KGDB /* the m68k_debug_device is used by the GDB stub, do nothing here */ return; -#else +#endif if (!strcmp( m68k_debug_device, "ser" )) { /* defaults to ser2 for a Falcon and ser1 otherwise */ - strcpy( m68k_debug_device, - ((atari_mch_cookie >> 16) == ATARI_MCH_FALCON) ? - "ser2" : "ser1" ); + strcpy( m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1" ); } if (!strcmp( m68k_debug_device, "ser1" )) { /* ST-MFP Modem1 serial port */ - mfp.trn_stat &= ~0x01; /* disable TX */ - mfp.usart_ctr = 0x88; /* clk 1:16, 8N1 */ - mfp.tim_ct_cd &= 0x70; /* stop timer D */ - mfp.tim_dt_d = 2; /* 9600 bps */ - mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ - mfp.trn_stat |= 0x01; /* enable TX */ + 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 */ - static unsigned char *p, scc_table[] = { - 9, 12, /* Reset */ - 4, 0x44, /* x16, 1 stopbit, no parity */ - 3, 0xc0, /* receiver: 8 bpc */ - 5, 0xe2, /* transmitter: 8 bpc, assert dtr/rts */ - 9, 0, /* no interrupts */ - 10, 0, /* NRZ */ - 11, 0x50, /* use baud rate generator */ - 12, 24, 13, 0, /* 9600 baud */ - 14, 2, 14, 3, /* use master clock for BRG, enable */ - 3, 0xc1, /* enable receiver */ - 5, 0xea, /* enable transmitter */ - 0 - }; - - (void)scc.cha_b_ctrl; /* reset reg pointer */ - for( p = scc_table; *p != 0; ) { - scc.cha_b_ctrl = *p++; - MFPDELAY(); - scc.cha_b_ctrl = *p++; - MFPDELAY(); - } + atari_init_scc_port( B9600|CS8 ); atari_console_driver.write = atari_scc_console_write; } else if (!strcmp( m68k_debug_device, "midi" )) { @@ -1158,7 +1309,6 @@ } if (atari_console_driver.write) register_console(&atari_console_driver); -#endif } /* ++roman: @@ -1199,8 +1349,9 @@ /* On the Medusa, phys. 0x4 may contain garbage because it's no ROM. See above for explanation why we cannot use PTOV(4). */ - reset_addr = is_hades ? 0x7fe00030 : - (is_medusa ? 0xe00030 : *(unsigned long *) 0xff000004); + reset_addr = MACH_IS_HADES ? 0x7fe00030 : + MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 : + *(unsigned long *) 0xff000004; /* reset ACIA for switch off OverScan, if it's active */ if (atari_switches & ATARI_SWITCH_OVSC_IKBD) @@ -1288,22 +1439,24 @@ strcat (model, "ST"); break; case ATARI_MCH_STE: - if ((atari_mch_cookie & 0xffff) == 0x10) + if (MACH_IS_MSTE) strcat (model, "Mega STE"); else strcat (model, "STE"); break; case ATARI_MCH_TT: - if (is_medusa) + if (MACH_IS_MEDUSA) /* Medusa has TT _MCH cookie */ strcat (model, "Medusa"); - else if (is_hades) + else if (MACH_IS_HADES) strcat(model, "Hades"); else strcat (model, "TT"); break; case ATARI_MCH_FALCON: strcat (model, "Falcon"); + if (MACH_IS_AB40) + strcat (model, " (with Afterburner040)"); break; default: sprintf (model + strlen (model), "(unknown mach cookie 0x%lx)", diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/arch/m68k/atari/stram.c linux-2.1.72/arch/m68k/atari/stram.c --- linux-2.1.72.orig/arch/m68k/atari/stram.c Mon Dec 15 20:10:11 1997 +++ linux-2.1.72/arch/m68k/atari/stram.c Wed Dec 17 14:35:28 1997 @@ -152,23 +152,6 @@ /* set if kernel is in ST-RAM */ static int kernel_in_stram; -#ifdef CONFIG_STRAM_SWAP -/* max. number of bytes to use for swapping - * 0 = no ST-RAM swapping - * -1 = do swapping (to whole ST-RAM) if it's less than MAX_STRAM_FRACTION of - * total memory - */ -static int max_swap_size = -1; - -/* start and end of swapping area */ -static unsigned long swap_start, swap_end; - -/* The ST-RAM's swap info structure */ -static struct swap_info_struct *stram_swap_info; - -/* The ST-RAM's swap type */ -static int stram_swap_type; - typedef struct stram_block { struct stram_block *next; unsigned long start; @@ -194,6 +177,23 @@ #define N_STATIC_BLOCKS 20 static BLOCK static_blocks[N_STATIC_BLOCKS]; +#ifdef CONFIG_STRAM_SWAP +/* max. number of bytes to use for swapping + * 0 = no ST-RAM swapping + * -1 = do swapping (to whole ST-RAM) if it's less than MAX_STRAM_FRACTION of + * total memory + */ +static int max_swap_size = -1; + +/* start and end of swapping area */ +static unsigned long swap_start, swap_end; + +/* The ST-RAM's swap info structure */ +static struct swap_info_struct *stram_swap_info; + +/* The ST-RAM's swap type */ +static int stram_swap_type; + /* major and minor device number of the ST-RAM device; for the major, we use * the same as Amiga z2ram, which is really similar and impossible on Atari, * and for the minor a relatively odd number to avoid the user creating and @@ -398,6 +398,12 @@ * You just will get non-DMA-able memory... */ mach_max_dma_address = 0xffffffff; + + /* + * Ok, num_physpages needs not be really exact, but it's better to + * subtract the pages set aside for swapping. + */ + num_physpages -= SWAP_NR(swap_end)-1; } #endif diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/arch/m68k/config.in linux-2.1.72/arch/m68k/config.in --- linux-2.1.72.orig/arch/m68k/config.in Mon Dec 15 22:08:28 1997 +++ linux-2.1.72/arch/m68k/config.in Tue Dec 16 17:03:22 1997 @@ -85,6 +85,9 @@ bool 'Support for ST-RAM as swap space' CONFIG_STRAM_SWAP bool 'ST-RAM statistics in /proc' CONFIG_STRAM_PROC fi +if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_ATARI" = "y" ]; then + bool 'Use power LED as a heartbeat' CONFIG_HEARTBEAT +fi endmenu # @@ -241,10 +244,10 @@ tristate 'Apollo 3c505 support' CONFIG_APOLLO_ELPLUS fi if [ "$CONFIG_ATARI" = "y" ]; then - bool 'Atari Lance support' CONFIG_ATARILANCE -if [ "$CONFIG_ATARI_ACSI" = "y" ]; then - bool 'BioNet-100 support' CONFIG_ATARI_BIONET - bool 'PAMsNet support' CONFIG_ATARI_PAMSNET + tristate 'Atari Lance support' CONFIG_ATARILANCE +if [ "$CONFIG_ATARI_ACSI" != "n" ]; then + tristate 'BioNet-100 support' CONFIG_ATARI_BIONET + tristate 'PAMsNet support' CONFIG_ATARI_PAMSNET fi fi if [ "$CONFIG_MVME16x" = "y" ]; then @@ -280,7 +283,9 @@ if [ "$CONFIG_VME" = "n" ]; then define_bool CONFIG_VT y - define_bool CONFIG_VT_CONSOLE y + if [ "$CONFIG_VT" = "y" ]; then + bool 'Support for console on virtual terminal' CONFIG_VT_CONSOLE + fi define_bool CONFIG_FB_CONSOLE y fi @@ -322,7 +327,7 @@ if [ "$CONFIG_ATARI_MFPSER" = "y" -o "$CONFIG_ATARI_SCC" = "y" -o \ "$CONFIG_ATARI_MIDI" = "y" -o "$CONFIG_AMIGA_BUILTIN_SERIAL" = "y" -o \ "$CONFIG_GVPIOEXT" = "y" -o "$CONFIG_MULTIFACE_III_TTY" = "y" ]; then - bool 'Serial console support' CONFIG_SERIAL_CONSOLE + bool 'Support for serial port console' CONFIG_SERIAL_CONSOLE fi fi if [ "$CONFIG_VME" = "y" ]; then diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/arch/m68k/kernel/console.c linux-2.1.72/arch/m68k/kernel/console.c --- linux-2.1.72.orig/arch/m68k/kernel/console.c Fri Dec 12 22:35:46 1997 +++ linux-2.1.72/arch/m68k/kernel/console.c Tue Dec 16 16:57:39 1997 @@ -165,6 +165,7 @@ extern void compute_shiftstate(void); extern void reset_palette(int currcons); extern void set_palette(void); +extern int con_is_present(void); void poke_blanked_console(void); void do_blank_screen(int); @@ -2329,6 +2330,7 @@ const char *display_desc = "????"; unsigned int currcons = 0; extern int serial_debug; + extern int num_registered_fb; memset(&console_driver, 0, sizeof(struct tty_driver)); console_driver.magic = TTY_DRIVER_MAGIC; @@ -2404,8 +2406,10 @@ printable = 1; /* If "serdebug" cmd line option was present, don't register for printk */ - if (!serial_debug) +#ifdef CONFIG_VT_CONSOLE + if (!serial_debug && num_registered_fb) register_console(&vt_console_driver); +#endif printk("Console: %s %s %ldx%ld, %d virtual console%s (max %d)\n", can_do_color ? "colour":"mono", display_desc, diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/arch/m68k/kernel/head.S linux-2.1.72/arch/m68k/kernel/head.S --- linux-2.1.72.orig/arch/m68k/kernel/head.S Sun Dec 14 17:34:49 1997 +++ linux-2.1.72/arch/m68k/kernel/head.S Tue Dec 16 16:34:43 1997 @@ -73,8 +73,7 @@ #include .globl SYMBOL_NAME(kernel_pg_dir), SYMBOL_NAME(kpt) -.globl SYMBOL_NAME(availmem), SYMBOL_NAME(is_medusa) -.globl SYMBOL_NAME(is_hades) +.globl SYMBOL_NAME(availmem) .globl SYMBOL_NAME(m68k_pgtable_cachemode) .globl SYMBOL_NAME(kernel_pmd_table), SYMBOL_NAME(swapper_pg_dir) @@ -253,33 +252,25 @@ #ifdef CONFIG_ATARI is_not_atari(Lnotypetest) - moveq #0,%d3 /* base addr for others: 0x00000000 */ - moveq #0,%d2 /* no Hades */ - movec %d3,%vbr - lea %pc@(Ltest_berr),%a0 - movel %a0,0x8 - movel %sp,%a0 - moveb 0x0,%d1 - clrb 0x0 - nop - moveb %d1,0x0 - nop - tstb 0x00ff82fe - nop - movel #0xff000000,%d3 /* Medusa base addr: 0xff000000 */ - tstb 0xb0000000 - nop - movel #0xff000000,%d2 /* Computer is a Hades */ - moveq #0,%d3 -Ltest_berr: - movel %a0,%sp - lea %pc@(SYMBOL_NAME(is_hades)),%a0 - movel %d2,%a0@ - lea %pc@(SYMBOL_NAME(is_medusa)),%a0 - movel %d3,%a0@ - lea %pc@(Liobase),%a0 - movel %d2,%a0@ /* On a Hades the iobase must be set - before opening the serial port. */ + /* get special machine type (Medusa/Hades/AB40) */ + moveq #0,%d3 /* default if tag doesn't exist */ + movew #BI_ATARI_MCH_TYPE,%d0 + jbsr Lget_bi_record + tstl %d0 + jbne 1f + movel %a0@,%d3 +1: + /* %d3 is not clobbered until Atari page tables are set up, + * where it is used again. */ + + /* On the Hades, the iobase must be set up before opening the + * serial port. There are no I/O regs at 0x00ffxxxx at all. */ + moveq #0,%d0 + cmpl #ATARI_MACH_HADES,%d3 + jbne 1f + movel #0xff000000,%d0 /* Hades I/O base addr: 0xff000000 */ +1: lea %pc@(Liobase),%a0 + movel %d0,%a0@ Lnotypetest: #endif @@ -547,10 +538,15 @@ area. */ - movel %pc@(is_medusa),%d3 - bne 1f - movel %pc@(is_hades),%d3 -1: + /* I/O base addr for non-Medusa, non-Hades: 0x00000000 */ + moveq #0,%d0 + cmpl #ATARI_MACH_MEDUSA,%d3 + jbeq 2f + cmpl #ATARI_MACH_HADES,%d3 + jbne 1f +2: movel #0xff000000,%d0 /* Medusa/Hades base addr: 0xff000000 */ +1: movel %d0,%d3 + /* Let the root table point to the new pointer table */ lea %a4@(PTR_TABLE_SIZE<<2),%a4 movel %a4,%a0 @@ -916,6 +912,7 @@ /* jump to the kernel start */ putr() + subl %a6,%a6 /* clear a6 for gdb */ jbsr SYMBOL_NAME(start_kernel) /* @@ -1198,10 +1195,6 @@ SYMBOL_NAME_LABEL(kpt) .long 0 SYMBOL_NAME_LABEL(availmem) - .long 0 -SYMBOL_NAME_LABEL(is_medusa) - .long 0 -SYMBOL_NAME_LABEL(is_hades) .long 0 SYMBOL_NAME_LABEL(m68k_pgtable_cachemode) .long 0 diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/arch/m68k/kernel/kgdb.c linux-2.1.72/arch/m68k/kernel/kgdb.c --- linux-2.1.72.orig/arch/m68k/kernel/kgdb.c Mon Dec 15 20:11:36 1997 +++ linux-2.1.72/arch/m68k/kernel/kgdb.c Tue Dec 16 16:35:16 1997 @@ -670,7 +670,10 @@ #ifdef CONFIG_ATARI if (!serial_in || !serial_out) { - printk( "kgdb_init failed: no valid serial device!\n" ); + if (*m68k_debug_device) + printk( "kgdb_init failed: no valid serial device!\n" ); + else + printk( "kgdb not enabled\n" ); return; } #endif diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/arch/m68k/kernel/signal.c linux-2.1.72/arch/m68k/kernel/signal.c --- linux-2.1.72.orig/arch/m68k/kernel/signal.c Fri Dec 12 22:35:49 1997 +++ linux-2.1.72/arch/m68k/kernel/signal.c Wed Dec 17 14:45:50 1997 @@ -19,8 +19,8 @@ /* * ++roman (07/09/96): implemented signal stacks (specially for tosemu on * Atari :-) Current limitation: Only one sigstack can be active at one time. - * If a second signal with SA_STACK set arrives while working on a sigstack, - * SA_STACK is ignored. This behaviour avoids lots of trouble with nested + * If a second signal with SA_ONSTACK set arrives while working on a sigstack, + * SA_ONSTACK is ignored. This behaviour avoids lots of trouble with nested * signal handlers! */ diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/arch/m68k/kernel/time.c linux-2.1.72/arch/m68k/kernel/time.c --- linux-2.1.72.orig/arch/m68k/kernel/time.c Mon Nov 10 15:10:05 1997 +++ linux-2.1.72/arch/m68k/kernel/time.c Tue Dec 16 16:20:09 1997 @@ -17,6 +17,19 @@ #include #include +#ifdef CONFIG_HEARTBEAT +#include +#include +#ifdef CONFIG_AMIGA +#include +#include +#endif +#ifdef CONFIG_ATARI +#include +#include +#endif +#endif /* CONFIG_HEARTBEAT */ + #include @@ -72,6 +85,45 @@ else last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ } +#ifdef CONFIG_HEARTBEAT + /* use power LED as a heartbeat instead -- much more useful + for debugging -- based on the version for PReP by Cort */ + /* acts like an actual heart beat -- ie thump-thump-pause... */ +#ifdef CONFIG_AMIGA + if (MACH_IS_AMIGA) { + switch(kstat.interrupts[SYS_IRQS + IRQ_AMIGA_CIAB_TA] % 101) { + case 0: + case 20: + ciaa.pra &= ~2; + break; + case 7: + case 27: + ciaa.pra |= 2; + break; + } + } +#endif +#ifdef CONFIG_ATARI + if (MACH_IS_ATARI && !atari_dont_touch_floppy_select) { + unsigned long flags, tmp; + save_flags(flags); + cli(); + sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */ + tmp = sound_ym.rd_data_reg_sel; + switch(kstat.interrupts[IRQ_MFP_TIMC] % 101) { + case 0: + case 20: + sound_ym.wd_data = tmp & ~0x02; + break; + case 7: + case 27: + sound_ym.wd_data = tmp | 0x02; + break; + } + restore_flags(flags); + } +#endif +#endif /* CONFIG_HEARTBEAT */ } /* Converts Gregorian date to seconds since 1970-01-01 00:00:00. diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/block/acsi.c linux-2.1.72/drivers/block/acsi.c --- linux-2.1.72.orig/drivers/block/acsi.c Sun Dec 14 22:14:05 1997 +++ linux-2.1.72/drivers/block/acsi.c Tue Dec 16 16:35:36 1997 @@ -1885,7 +1885,7 @@ static int revalidate_acsidisk( int dev, int maxusage ) { - int device, major; + int device; struct gendisk * gdev; int max_p, start, i; struct acsi_info_struct *aip; diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/block/acsi_slm.c linux-2.1.72/drivers/block/acsi_slm.c --- linux-2.1.72.orig/drivers/block/acsi_slm.c Sat Nov 29 20:32:10 1997 +++ linux-2.1.72/drivers/block/acsi_slm.c Tue Dec 16 16:36:56 1997 @@ -253,15 +253,15 @@ static char *slm_errstr( int stat ); static int slm_getstats( char *buffer, int device ); -static long slm_read( struct inode *node, struct file* file, char *buf, - unsigned long count ); +static ssize_t slm_read( struct file* file, char *buf, size_t count, loff_t + *ppos ); static void start_print( int device ); static void slm_interrupt(int irc, void *data, struct pt_regs *fp); static void slm_test_ready( unsigned long dummy ); static void set_dma_addr( unsigned long paddr ); static unsigned long get_dma_addr( void ); -static long slm_write( struct inode *node, struct file *file, const char *buf, - unsigned long count ); +static ssize_t slm_write( struct file *file, const char *buf, size_t count, + loff_t *ppos ); static int slm_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg ); static int slm_open( struct inode *inode, struct file *file ); @@ -373,10 +373,12 @@ } -static long slm_read( struct inode *node, struct file* file, - char *buf, unsigned long count ) +static ssize_t slm_read( struct file *file, char *buf, size_t count, + loff_t *ppos ) -{ unsigned long page; +{ + struct inode *node = file->f_dentry->d_inode; + unsigned long page; int length; int end; @@ -626,10 +628,12 @@ } -static long slm_write( struct inode *node, struct file *file, - const char *buf, unsigned long count ) +static ssize_t slm_write( struct file *file, const char *buf, size_t count, + loff_t *ppos ) -{ int device = MINOR( node->i_rdev ); +{ + struct inode *node = file->f_dentry->d_inode; + int device = MINOR( node->i_rdev ); int n, filled, w, h; while( SLMState == PRINTING || diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/block/ataflop.c linux-2.1.72/drivers/block/ataflop.c --- linux-2.1.72.orig/drivers/block/ataflop.c Sat Nov 29 20:32:11 1997 +++ linux-2.1.72/drivers/block/ataflop.c Tue Dec 16 16:38:17 1997 @@ -460,6 +460,7 @@ sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */ tmp = sound_ym.rd_data_reg_sel; sound_ym.wd_data = (tmp | DSKDRVNONE) & ~(drive == 0 ? DSKDRV0 : DSKDRV1); + atari_dont_touch_floppy_select = 1; restore_flags(flags); /* restore track register to saved value */ @@ -483,8 +484,12 @@ save_flags(flags); cli(); /* protect against various other ints mucking around with the PSG */ + atari_dont_touch_floppy_select = 0; sound_ym.rd_data_reg_sel=14; /* Select PSG Port A */ - sound_ym.wd_data = sound_ym.rd_data_reg_sel | 7; /* no drives selected */ + sound_ym.wd_data = sound_ym.rd_data_reg_sel | + MACH_IS_FALCON ? 3 : 7; /* no drives selected */ + /* On Falcon, the drive B select line is used on the printer port, so + * leave it alone... */ SelectedDrive = -1; restore_flags(flags); } @@ -1803,7 +1808,7 @@ UD.steprate = FDCSTEP_12; break; default: /* should be -1 for "not set by user" */ - if (ATARIHW_PRESENT( FDCSPEED ) || is_medusa) + if (ATARIHW_PRESENT( FDCSPEED ) || MACH_IS_MEDUSA) UD.steprate = FDCSTEP_3; else UD.steprate = FDCSTEP_6; @@ -1828,7 +1833,7 @@ unsigned char status; int ok; - if (drive > 1) return( 0 ); + if (drive >= (MACH_IS_FALCON ? 1 : 2)) return( 0 ); fd_select_drive( drive ); /* disable interrupt temporarily */ @@ -2020,6 +2025,10 @@ { int i; + if (MACH_IS_HADES) + /* Hades doesn't have Atari-compatible floppy */ + return -ENXIO; + if (register_blkdev(MAJOR_NR,"fd",&floppy_fops)) { printk(KERN_ERR "Unable to get major %d for floppy\n",MAJOR_NR); return -EBUSY; @@ -2030,7 +2039,7 @@ track buffering off for all Medusas, though it could be used with ones that have a counter card. But the test is too hard :-( */ - UseTrackbuffer = !is_medusa; + UseTrackbuffer = !MACH_IS_MEDUSA; /* initialize variables */ SelectedDrive = -1; diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/char/atari_MFPser.c linux-2.1.72/drivers/char/atari_MFPser.c --- linux-2.1.72.orig/drivers/char/atari_MFPser.c Sun Dec 14 22:22:57 1997 +++ linux-2.1.72/drivers/char/atari_MFPser.c Wed Dec 17 13:53:36 1997 @@ -4,6 +4,9 @@ * Copyright 1994 Roman Hodek * Partially based on PC-Linux serial.c by Linus Torvalds and Theodore Ts'o * + * Special thanks to Harun Scheutzow (developer of RSVE, RSFI, ST_ESCC and + * author of hsmoda-package) for the code to detect RSVE/RSFI. + * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details. @@ -29,6 +32,14 @@ * used to implement Serial1 for the TT and the (not connected) MFP * port of the Falcon. * + * Juergen: changes based on Harun Scheutzows code + * o added detection of RSVE, RSFI and possible PLL's + * o set info->hub6 to identify speeder-hardware + * o changed Tx output-level when transmitter is disabled + * o no need for CONFIG_ATARI_MFPSER_EXT + * + * + * o add delays for baudrate-setting to lock PLLs (RSFI, RSVE) */ #include @@ -49,7 +60,8 @@ #include "atari_MFPser.h" - +#define RSFI_DEBUG /* undefine to get rid of "detect_MFP_speeder: clock[x] = y" */ +#define RSFI_PLL_LOCK_DELAY /* use delay to allow PLL settling */ /***************************** Prototypes *****************************/ @@ -109,7 +121,6 @@ NULL }; - /* MFP Timer Modes divided by 2 (this already done in the BAUD_BASE * The real 68901 prescaler factors are twice these values! * prescaler_factor[] = {4, 10, 16, 50, 64, 100, 200} @@ -119,8 +130,8 @@ /* RSVE or RSSPEED will only recognize the 3 frequencies for * 110, 134, 150 Baud, if the prescaler is 4 and the counter value does * the rest. The divisors 350 and 256 can be built in multiple ways. - * This driver tryes to use the largest presscaler factor possible and - * uses small counter values. TOS uses a presscaler factor of 4 + * This driver tries to use the largest prescaler factor possible and + * uses small counter values. TOS uses a prescaler factor of 4 * ==> MFP_timer_mode = 2 ==> Index 0. Then RSVE replaces the clock * correctly. Since the absolute frequencies don't have to be so accurate * but the the prescaler factor has to be 4 we have to make sure that the @@ -131,7 +142,33 @@ * the values by ignoring the lower 3 bits. */ -int MFP_baud_table[20] = { /* Divisors for standard speeds & RSVE */ + /* Added support for RSFI + * RSFI is a hardware-FIFO with the following features: + * o 2048bit Rx-FIFO + * o baudrates: 38400, 57600, 76800, 115200, 153600, 230400 + * baudrate-selection and FIFO-enable is done by setting + * the effective baudrate to 50 .. 200. In contrast to the + * RSVE the clockselection is independend from the prescale- + * factor. Instead, the MFP must be in x1 clockmode. + * o the FIFO is only enabled when speeds are above 19k2 + * + * Relationship between MFP-baudrate and RSFI-baudrate + * MFP mode RSFI + * 50 x1 76.8K *) + * 75 x1 153.6K *) + * 110 x1 38.4K + * 134 x1 57.6K + * 150 x1 115.2K + * 200 x1 230.4K + * + * *) Non-standard baudrates, not supported. + * + * We keep the speeder-type in info->hub6. This flag is unused on + * non-Intel architectures. + * + */ + +int MFP_baud_table[22] = { /* Divisors for standard speeds, RSVE & RSFI */ /* B0 */ 0, /* B50 */ 768, /* B75 */ 512, @@ -147,11 +184,12 @@ /* B4800 */ 8, /* B9600 */ 4, /* B19200 */ 2, - /* B38400 */ 348, /* 38.4K with RSVE, prescaler 4 = MFP_mode 2 */ - /* B57600 */ 286, /* 57.6K with RSVE, prescaler 4 = MFP_mode 2 */ - /* B115200 */ 258, /* 115.2K with RSVE, prescaler 4 = MFP_mode 2 */ - /* B230400 */ 0, /* invalid */ - /* B460800 */ 0 /* invalid */ + /* B38400 */ 348, /* 38.4K with RSVE/RSFI, prescaler 4 = MFP_mode 2 */ + /* B57600 */ 286, /* 57.6K with RSVE/RSFI, prescaler 4 = MFP_mode 2 */ + /* B115200 */ 258, /* 115.2K with RSVE/RSFI, prescaler 4 = MFP_mode 2 */ + /* --------------- the following values are ignored in RSVE-mode */ + /* B230400 */ 192, /* 230.4K with RSFI */ + /* B460800 */ 0, /* illegal */ }; @@ -160,6 +198,8 @@ static int stmfp_line = -1, ttmfp_line = -1; +extern int atari_MFP_init_done; + int atari_MFPser_init( void ) @@ -201,10 +241,173 @@ return( nr > 0 ? 0 : -ENODEV ); } +static void __inline__ set_timer_D(volatile struct MFP *thismfp, + int baud, int prescale) { +/* set timer d to given value, prescale 4 + * allow PLL-settling (3 bit-times) + */ + + int count; + + thismfp->tim_ct_cd &= 0xf8; /* disable timer D */ + thismfp->tim_dt_d = baud; /* preset baudrate */ + thismfp->tim_ct_cd |= prescale; /* enable timer D, prescale N */ + + for( count = 6; count; --count ) { + thismfp->int_pn_b = ~0x10; + while( !(thismfp->int_pn_b & 0x10) ) + ; + } +} + +static int detect_MFP_speeder(volatile struct MFP *currMFP) { +/* try to autodetect RSVE, RSFI or similiar RS232 speeders + * + * (c) Harun Scheutzow + * developer of RSVE, RSFI, ST_ESCC and author of hsmoda-package + * + * integrated by Juergen Orschiedt + * + * noise-free detection of Tx/Rx baudrate + * - set MFP to loopback, syncmode, 8bpc, syncchar=0xff + * - enable transmitter and measure time between syncdetect + * depending on the relationship between measured time and + * timer-d setting we can tell which (if any) speeder we have. + * + * returncodes: + * 0 something wrong (1200 too slow) + * 1 no speeder detected + * 2 RSVE detected + * 3 RSFI detected + * 4 PLL or fixed Baudrate (Hardware-hack) + */ + + int count, speeder; + unsigned int flags; + int imra, imrb; + + /* prepare IRQ registers for measurement */ + + save_flags(flags); + cli(); + + imra = currMFP->int_mk_a; + imrb = currMFP->int_mk_b; + + currMFP->int_mk_a = imra & 0xe1; /* mask off all Rx/Tx ints */ + currMFP->int_mk_b = imrb & 0xef; /* disable timer d int in IMRB */ + currMFP->int_en_b |= 0x10; /* enable in IERB (to see pending ints) */ + restore_flags(flags); + + (void)currMFP->par_dt_reg; /* consume some cycles */ + (void)currMFP->par_dt_reg; + + /* initialize MFP */ + currMFP->rcv_stat = 0x00; /* disable Rx */ + currMFP->trn_stat = TSR_SOMODE_HIGH; /* disable Tx, output-level high */ + currMFP->sync_char= 0xff; /* syncchar = 0xff */ + currMFP->usart_ctr= (UCR_PARITY_OFF | UCR_SYNC_MODE | UCR_CHSIZE_8); + currMFP->trn_stat = (TSR_TX_ENAB | TSR_SOMODE_LOOP); + + /* look at 1200 baud setting (== effective 19200 in syncmode) */ + set_timer_D(currMFP, 0x10, 0x01); + save_flags(flags); + cli(); + + /* check for fixed speed / bad speed */ + currMFP->rcv_stat = RSR_RX_ENAB; + count = -1; + do { + continue_outer: + ++count; + currMFP->int_pn_b = ~0x10; + do { + if (currMFP->int_pn_b & 0x10) + goto continue_outer; + } while( !(currMFP->rcv_stat & RSR_SYNC_SEARCH) && count <= 22 ); + } while(0); + restore_flags(flags); + + /* for RSxx or standard MFP we have 8 bittimes (count=16) */ +#ifdef RSFI_DEBUG + printk(KERN_INFO " detect_MFP_speeder: count[1200]=%d\n", count); +#endif + + if (count < 10) + speeder = MFP_WITH_PLL; /* less than 5 bittimes: primitive speeder */ + else + if (count >22) + speeder = MFP_WITH_WEIRED_CLOCK; /* something wrong - too slow! */ + else { + /* 1200 baud is working, we neither have fixed clock nor simple PLL */ + set_timer_D(currMFP, 0xaf, 0x01); + save_flags(flags); + cli(); + + /* check for RSxx or Standard MFP with 110 baud + * timer D toggles each 290us + * bps sync char count + * RSVE: 614400 22.33 13uS + * RSFI: 38400 1.39 208us + * Standard: 1720 0.06 + * + */ + currMFP->int_pn_b = ~0x10; + /* syncronize to timer D */ + while( !(currMFP->int_pn_b & 0x10) ) + ; + currMFP->int_pn_b = ~0x10; + count = -1; + do { + continue_outer2: + currMFP->rcv_stat = 0; /* disable Rx */ + ++count; + (void)currMFP->par_dt_reg; /* delay */ + currMFP->rcv_stat = RSR_RX_ENAB; /* enable Rx */ + nop(); + do { + /* increment counter if sync char detected */ + if (currMFP->rcv_stat & RSR_SYNC_SEARCH) + goto continue_outer2; + } while( !(currMFP->int_pn_b & 0x10) ); + } while(0); + +#ifdef RSFI_DEBUG + printk(KERN_INFO " detect_MFP_speeder: count[110]=%d\n", count); +#endif + + if (count < 1) speeder = MFP_STANDARD; /* no speeder detected */ + else + if (count > 4) speeder = MFP_WITH_RSVE; + else + speeder = MFP_WITH_RSFI; + } + + restore_flags(flags); + currMFP->rcv_stat = 0x00; /* disable Rx */ + currMFP->trn_stat = TSR_SOMODE_HIGH; /* disable Tx, output-level high */ + currMFP->usart_ctr= (UCR_PARITY_OFF | UCR_ASYNC_2 | UCR_CHSIZE_8); + currMFP->int_mk_a = imra; + currMFP->int_mk_b = imrb; + currMFP->int_en_b &= 0xef; + currMFP->int_pn_a = 0xe1; /* mask off pending Rx/Tx */ + currMFP->int_pn_b = 0xef; /* mask off pending Timer D */ + return speeder; + +} static void MFPser_init_port( struct m68k_async_struct *info, int type, int tt_flag) { INIT_currMFP(info); + int speeder; + static char *speeder_name[]= {"", "", "PLL or fixed clock", "RSVE", "RSFI" }; + + /* look for possible speeders */ + info->hub6 = speeder = detect_MFP_speeder((struct MFP *)currMFP); + if (speeder > MFP_STANDARD) + printk(KERN_INFO "ttyS%d: Detected %s extension\n", + info->line, speeder_name[speeder]); + /* set ISRs, but don't enable interrupts yet (done in init()); * all ints are choosen of type FAST, and they're really quite fast. @@ -235,7 +438,9 @@ request_irq(IRQ_MFP_RI, MFPctrl_ri_int, IRQ_TYPE_SLOW, "ST-MFP RI", info); /* clear RTS and DTR */ - GIACCESS( GI_RTS | GI_DTR ); + if (!atari_MFP_init_done) + /* clear RTS and DTR */ + GIACCESS( GI_RTS | GI_DTR ); } info->sw = (type == SER_MFP_CTRL ? &MFPctrl_switch : &MFPbare_switch); @@ -243,8 +448,10 @@ info->custom_divisor = 4; /* 9600 Baud */ info->baud_base = MFP_BAUD_BASE; - currMFP(info)->rcv_stat = 0; /* disable Rx */ - currMFP(info)->trn_stat = 0; /* disable Tx */ + if (tt_flag || !atari_MFP_init_done) { + currMFP->rcv_stat = 0; /* disable Rx */ + currMFP->trn_stat = TSR_SOMODE_HIGH; /* disable Tx */ + } } @@ -321,11 +528,12 @@ static void MFPctrl_dcd_int( int irq, void *data, struct pt_regs *fp) { struct m68k_async_struct *info = data; + INIT_currMFP(info); /* Toggle active edge to get next change of DCD! */ - currMFP(info)->active_edge ^= GPIP_DCD; + currMFP->active_edge ^= GPIP_DCD; - rs_dcd_changed( info, !(currMFP(info)->par_dt_reg & GPIP_DCD) ); + rs_dcd_changed( info, !(currMFP->par_dt_reg & GPIP_DCD) ); } @@ -335,9 +543,9 @@ INIT_currMFP(info); /* Toggle active edge to get next change of CTS! */ - currMFP(info)->active_edge ^= GPIP_CTS; + currMFP->active_edge ^= GPIP_CTS; - rs_check_cts( info, !(currMFP(info)->par_dt_reg & GPIP_CTS) ); + rs_check_cts( info, !(currMFP->par_dt_reg & GPIP_CTS) ); } @@ -355,14 +563,15 @@ INIT_currMFP(info); /* base value for UCR */ - currMFP->usart_ctr = (UCR_PARITY_OFF | UCR_ASYNC_1 | - UCR_CHSIZE_8 | UCR_PREDIV); + if (info->type != SER_MFP_CTRL || !atari_MFP_init_done) + currMFP->usart_ctr = (UCR_PARITY_OFF | UCR_ASYNC_1 | + UCR_CHSIZE_8 | UCR_PREDIV); /* enable Rx and clear any error conditions */ currMFP->rcv_stat = RSR_RX_ENAB; /* enable Tx */ - currMFP->trn_stat = TSR_TX_ENAB; + currMFP->trn_stat = (TSR_TX_ENAB | TSR_SOMODE_HIGH); /* enable Rx, RxErr and Tx interrupts */ currMFP->int_en_a |= 0x1c; @@ -409,7 +618,7 @@ static void MFPser_deinit( struct m68k_async_struct *info, int leave_dtr ) { INIT_currMFP(info); - + /* disable Rx, RxErr and Tx interrupts */ currMFP->int_en_a &= ~0x1c; @@ -420,7 +629,7 @@ /* disable Rx and Tx */ currMFP->rcv_stat = 0; - currMFP->trn_stat = 0; + currMFP->trn_stat = TSR_SOMODE_HIGH; /* wait for last byte to be completely shifted out */ while( !(currMFP->trn_stat & TSR_LAST_BYTE_SENT) ) @@ -510,9 +719,11 @@ if (baud < 1 || baud > 4) info->tty->termios->c_cflag &= ~CBAUDEX; else - baud += 15; + if (info->hub6 > MFP_WITH_PLL) /* speeder detected? */ + baud += 15; } - if (baud == 15) { + if ((info->hub6 > MFP_WITH_PLL) && (baud == 15)) { + /* only for speeders... */ switch (aflags) { case ASYNC_SPD_HI: baud += 1; /* 134 Baud, with RSVE = 57600 */ @@ -521,7 +732,7 @@ baud += 2; /* 150 Baud, with RSVE = 115200 */ break; case ASYNC_SPD_SHI: - baud += 3; + baud += 3; /* with RSFI: 230400 Baud */ break; case ASYNC_SPD_WARP: baud += 4; @@ -532,12 +743,10 @@ } } if (!div) { -#ifdef CONFIG_ATARI_MFPSER_EXT - /* Maximum MFP speed is 115200 */ - if (baud > 17) baud = 17; -#else - if (baud > 14) baud = 14; -#endif + /* max. tableentries depending on speeder type */ + static int maxbaud[] = { 14, 14, 14, 17, 18}; + if (baud > maxbaud[info->hub6]) + baud = maxbaud[info->hub6]; div = MFP_baud_table[baud]; } @@ -563,27 +772,37 @@ cli(); /* disable Rx and Tx while changing parameters */ currMFP->rcv_stat = 0; - currMFP->trn_stat = 0; + currMFP->trn_stat = TSR_SOMODE_HIGH; +#ifdef RSFI_PLL_LOCK_DELAY + currMFP->int_en_b |= 0x10; + set_timer_D(currMFP, timer_val, timer_mode+1); + currMFP->int_en_b &= 0xef; +#else /* stop timer D to set new timer value immediatly after re-enabling */ currMFP->tim_ct_cd &= ~0x07; currMFP->tim_dt_d = timer_val; currMFP->tim_ct_cd |= (timer_mode+1); +#endif + { + unsigned shadow_ctr; - currMFP->usart_ctr = - ( (parity & PARENB) ? - ((parity & PARODD) ? UCR_PARITY_ODD : UCR_PARITY_EVEN) : - UCR_PARITY_OFF ) | - ( chsize == CS5 ? UCR_CHSIZE_5 : - chsize == CS6 ? UCR_CHSIZE_6 : - chsize == CS7 ? UCR_CHSIZE_7 : - UCR_CHSIZE_8 ) | - ( stopb ? UCR_ASYNC_2 : UCR_ASYNC_1 ) | - UCR_PREDIV; + shadow_ctr = ((parity & PARENB) ? + ((parity & PARODD) ? UCR_PARITY_ODD : UCR_PARITY_EVEN) : + UCR_PARITY_OFF ) | + ( chsize == CS5 ? UCR_CHSIZE_5 : + chsize == CS6 ? UCR_CHSIZE_6 : + chsize == CS7 ? UCR_CHSIZE_7 : UCR_CHSIZE_8 ) | + ( stopb ? UCR_ASYNC_2 : UCR_ASYNC_1 ); + + if ((baud < 15) || (info->hub6 != MFP_WITH_RSFI)) + shadow_ctr |= UCR_PREDIV; + currMFP->usart_ctr = shadow_ctr; + } /* re-enable Rx and Tx */ currMFP->rcv_stat = RSR_RX_ENAB; - currMFP->trn_stat = TSR_TX_ENAB; + currMFP->trn_stat = (TSR_TX_ENAB | TSR_SOMODE_HIGH); restore_flags (ipl); } @@ -699,7 +918,7 @@ /* disable receiver */ currMFP->rcv_stat = 0; /* disable transmitter */ - currMFP->trn_stat = 0; + currMFP->trn_stat = TSR_SOMODE_HIGH; } static int MFPser_trans_empty (struct m68k_async_struct *info) diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/char/atari_MFPser.h linux-2.1.72/drivers/char/atari_MFPser.h --- linux-2.1.72.orig/drivers/char/atari_MFPser.h Sun Dec 14 22:22:57 1997 +++ linux-2.1.72/drivers/char/atari_MFPser.h Wed Dec 17 14:40:37 1997 @@ -80,6 +80,13 @@ #define GPIP_CTS 0x04 #define GPIP_RI 0x40 +/* MFP speeders */ +#define MFP_WITH_WEIRED_CLOCK 0x00 +#define MFP_STANDARD 0x01 +#define MFP_WITH_PLL 0x02 +#define MFP_WITH_RSVE 0x03 +#define MFP_WITH_RSFI 0x04 + /* Convenience routine to access RTS and DTR in the Soundchip: It sets * the register to (oldvalue & mask) if mask is negative or (oldvalue diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/char/atari_SCC.c linux-2.1.72/drivers/char/atari_SCC.c --- linux-2.1.72.orig/drivers/char/atari_SCC.c Sun Dec 14 22:22:58 1997 +++ linux-2.1.72/drivers/char/atari_SCC.c Wed Dec 17 12:02:19 1997 @@ -281,7 +281,7 @@ static int SCC_chan_a_line; /* info pointer for SCC_chan_a_line */ -static struct async_struct *SCC_chan_a_info; +static struct m68k_async_struct *SCC_chan_a_info; /* Are the register addresses for the channels reversed? (B before A). This is * the case for the ST_ESCC. */ @@ -377,6 +377,9 @@ SCC_check_open }; +extern int atari_SCC_init_done; +extern int atari_SCC_reset_done; + int atari_SCC_init( void ) { @@ -401,11 +404,9 @@ * channel A is fixed to a RS-232 Serial2, add code to set to * SCCA_SWITCH_SERIAL2_ONLY. */ - if ((atari_mch_cookie >> 16) == ATARI_MCH_FALCON) + if (MACH_IS_FALCON) SCC_chan_a_switchable = SCCA_SWITCH_LAN_ONLY; - else if (ATARIHW_PRESENT(TT_MFP) || - ((atari_mch_cookie >> 16) == ATARI_MCH_STE && - (atari_mch_cookie & 0xffff))) + else if (ATARIHW_PRESENT(TT_MFP) || MACH_IS_MSTE) SCC_chan_a_switchable = SCCA_SWITCH_BOTH; else SCC_chan_a_switchable = SCCA_SWITCH_SERIAL2_ONLY; @@ -533,7 +534,7 @@ scca_dma_buf[i].pbuf = (char *)VTOP((int)scca_dma_buf[i].buf); tt_mfp.int_en_a &= ~0x20; - tt_mfp.int_pn_a &= ~0x20; + tt_mfp.int_pn_a = ~0x20; tt_mfp.tim_ct_a = 0x00; tt_mfp.tim_dt_a = 0x00; request_irq (IRQ_TT_MFP_TIMA, SCC_timer_int, IRQ_TYPE_SLOW, @@ -556,8 +557,6 @@ /* Hardware initialization */ if (!called) { - extern int atari_SCC_reset_done; - /* Before accessing the SCC the first time, do a read to the * control register to reset the internal pointers */ @@ -627,7 +626,7 @@ #ifdef CONFIG_ATARI_SCC_DMA if (channel == CHANNEL_A && scca_dma) { tt_mfp.int_en_a &= ~0x20; - tt_mfp.int_pn_a &= ~0x20; + tt_mfp.int_pn_a = ~0x20; tt_mfp.int_mk_a &= ~0x20; free_irq(IRQ_TT_MFP_SCC, info); free_irq(IRQ_TT_MFP_TIMA, info); @@ -1359,7 +1358,7 @@ */ tt_mfp.int_en_b &= ~4; tt_mfp.active_edge |= 4; - tt_mfp.int_pn_b &= ~4; + tt_mfp.int_pn_b = ~4; tt_mfp.int_mk_b |= 4; tt_mfp.int_en_b |= 4; @@ -1528,8 +1527,10 @@ static void SCC_change_speed( struct m68k_async_struct *info ) { - unsigned cflag, baud, chsize, aflags; - unsigned channel, div = 0, clkmode, brgmode, brgval; + /* the SCC has char sizes 5,7,6,8 in that order! */ + static int chsize_map[4] = { 0, 2, 1, 3 }; + unsigned cflag, baud, chsize, aflags; + unsigned channel, div = 0, clkmode, brgmode, brgval; int clksrc = 0; unsigned long flags; SCC_ACCESS_INIT(info); @@ -1635,7 +1636,7 @@ #endif /* receiver's character size */ - SCCmod( RX_CTRL_REG, ~RCR_CHSIZE_MASK, chsize << 6 ); + SCCmod( RX_CTRL_REG, ~RCR_CHSIZE_MASK, chsize_map[chsize] << 6 ); #if DEBUG & DEBUG_SPEED printk( " RX_CTRL_REG <- %02x\n", SCCread( RX_CTRL_REG ) ); #endif @@ -1654,7 +1655,7 @@ /* sender's character size */ /* Set DTR for valid baud rates! Tnx to jds@kom.auc.dk */ - SCCmod( TX_CTRL_REG, ~TCR_CHSIZE_MASK, chsize << 5 | TCR_DTR ); + SCCmod( TX_CTRL_REG, ~TCR_CHSIZE_MASK, chsize_map[chsize] << 5 | TCR_DTR ); #if DEBUG & DEBUG_SPEED printk( " TX_CTRL_REG <- %02x\n", SCCread( TX_CTRL_REG ) ); #endif diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/char/m68kserial.c linux-2.1.72/drivers/char/m68kserial.c --- linux-2.1.72.orig/drivers/char/m68kserial.c Mon Dec 15 20:37:05 1997 +++ linux-2.1.72/drivers/char/m68kserial.c Wed Dec 17 11:49:09 1997 @@ -74,6 +74,9 @@ #ifdef CONFIG_PROC_FS #include #endif +#ifdef CONFIG_SERIAL_CONSOLE +#include +#endif #include #include @@ -137,7 +140,6 @@ static struct termios *serial_termios_locked[NR_PORTS]; #ifdef CONFIG_SERIAL_CONSOLE static struct console sercons; -static int serial_console_cflag; #endif #ifndef MIN @@ -1246,6 +1248,13 @@ *tty->termios = info->callout_termios; info->sw->change_speed(info); } +#ifdef CONFIG_SERIAL_CONSOLE + if (sercons.cflag && sercons.index == line) { + tty->termios->c_cflag = sercons.cflag; + sercons.cflag = 0; + info->sw->change_speed(info); + } +#endif info->session = current->session; info->pgrp = current->pgrp; @@ -1339,6 +1348,18 @@ init_bh(SERIAL_BH, do_serial_bh); +#ifdef CONFIG_SERIAL_CONSOLE + /* + * The interrupt of the serial console port + * can't be shared. + */ + if (sercons.flags & CON_FIRST) { + for(i = 0; i < NR_PORTS; i++) + if (i != sercons.index && + rs_table[i].irq == rs_table[sercons.index].irq) + rs_table[i].irq = 0; + } +#endif show_serial_version(); /* Initialize the tty_driver structure */ @@ -1465,16 +1486,6 @@ return 0; } -extern void amiga_serial_console_write(const char *s, unsigned int count); -extern int amiga_serial_console_wait_key(void); -extern void amiga_init_serial_console(struct async_struct *info, int cflag); -extern void atari_mfp_console_write (const char *str, unsigned int count); -extern int atari_mfp_console_wait_key(void); -extern void atari_init_mfp_port( int cflag ); -extern void atari_scc_console_write (const char *str, unsigned int count); -extern int atari_scc_console_wait_key(void); -extern void atari_init_scc_port( int cflag ); - /* * register_serial and unregister_serial allows for serial ports to be * configured at run-time, to support PCMCIA modems. @@ -1586,3 +1597,168 @@ printk("SERIAL: failed to unregister callout driver\n"); } #endif /* MODULE */ + + +/* + * ------------------------------------------------------------ + * Serial console driver + * ------------------------------------------------------------ + */ +#ifdef CONFIG_SERIAL_CONSOLE + +static kdev_t serial_console_device(struct console *c) +{ + return MKDEV(TTY_MAJOR, 64 + c->index); +} + +extern void amiga_serial_console_write(struct console *co, const char *s, + unsigned int count); +extern int amiga_serial_console_wait_key(struct console *co); +extern void amiga_init_serial_console(struct async_struct *info, int cflag); +extern void atari_mfp_console_write (struct console *co, const char *str, + unsigned int count); +extern int atari_mfp_console_wait_key(struct console *co); +extern void atari_init_mfp_port( int cflag ); +extern void atari_scc_console_write (struct console *co, const char *str, + unsigned int count); +extern int atari_scc_console_wait_key(struct console *co); +extern void atari_init_scc_port( int cflag ); +extern void atari_midi_console_write (struct console *co, const char *str, + unsigned int count); +extern int atari_midi_console_wait_key(struct console *co); +extern void atari_init_midi_port( int cflag ); + +/* + * Setup initial baud/bits/parity. + */ +__initfunc(static void serial_console_setup(struct console *co, char *options)) +{ + char *s; + int baud = 0, bits, parity; + int cflag = CREAD | HUPCL | CLOCAL; + + bits = 8; + parity = 'n'; + + if (options) { + baud = simple_strtoul(options, NULL, 10); + s = options; + while(*s >= '0' && *s <= '9') + s++; + if (*s) parity = *s++; + if (*s) bits = *s - '0'; + } + + /* Now construct a cflag setting. */ + switch(baud) { + case 1200: + cflag |= B1200; + break; + case 2400: + cflag |= B2400; + break; + case 4800: + cflag |= B4800; + break; + case 19200: + cflag |= B19200; + break; + case 38400: + cflag |= B38400; + break; + case 57600: + cflag |= B57600; + break; + case 9600: + default: + cflag |= B9600; + break; + } + switch(bits) { + case 7: + cflag |= CS7; + break; + default: + case 8: + cflag |= CS8; + break; + } + switch(parity) { + case 'o': case 'O': + cflag |= PARENB|PARODD; + break; + case 'e': case 'E': + cflag |= PARENB; + break; + } + co->cflag = cflag; + + /* Initialization of the port and filling in the missing fields of the + * sercons struct must happen here, since register_console() already uses + * write to print the log buffer. */ + + /* Currently this supports the Amiga builtin port only */ + if (MACH_IS_AMIGA && co->index == 0) { + co->write = amiga_serial_console_write; + co->wait_key = amiga_serial_console_wait_key; + /* no initialization yet */ + /* amiga_init_serial_console(rs_table+co->index, */ + /* serial_console_cflag); */ + } + /* On Atari, Modem1 (ttyS0), Modem2 (ttyS1) and MIDI (ttyS5) are supported + * Note: On a TT, 57.6 and 115.2 kbps are not possible and are replaced by + * 76.8 and 153.6 kbps. + * Note2: On MIDI, 7812.5 bps is selected by 4800 on the command line, and + * 500 kbps by 115200. All other rates give standard 31250bps. Mode 7N is + * not possible and replaced by 7O2 ... */ + else if (MACH_IS_ATARI && co->index == 0) { + co->write = atari_mfp_console_write; + co->wait_key = atari_mfp_console_wait_key; + atari_init_mfp_port( cflag ); + } + else if (MACH_IS_ATARI && co->index == 1) { + co->write = atari_scc_console_write; + co->wait_key = atari_scc_console_wait_key; + atari_init_scc_port( cflag ); + } + else if (MACH_IS_ATARI && co->index == 5) { + co->write = atari_midi_console_write; + co->wait_key = atari_midi_console_wait_key; + atari_init_midi_port( cflag ); + } +} + +static void dummy_console_write( struct console *co, const char *str, + unsigned int count ) +{ +} + +static int dummy_wait_key( struct console *co ) +{ + return( '\r' ); +} + +static struct console sercons = { + "ttyS", + dummy_console_write, /* filled in by serial_console_setup */ + NULL, + serial_console_device, + dummy_wait_key, /* filled in by serial_console_setup */ + NULL, + serial_console_setup, + CON_PRINTBUFFER, + -1, + 0, + NULL +}; + +/* + * This is here to set the speed etc. for a non-initialized + * line. We have no termios struct yet, so we just use "cflag". + */ +long serial_console_init(long kmem_start, long kmem_end) +{ + register_console(&sercons); + return kmem_start; +} +#endif diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/char/nvram.c linux-2.1.72/drivers/char/nvram.c --- linux-2.1.72.orig/drivers/char/nvram.c Mon Dec 15 20:08:20 1997 +++ linux-2.1.72/drivers/char/nvram.c Tue Dec 16 16:42:38 1997 @@ -675,7 +675,7 @@ PRINT_PROC( "n/a\n" ); /* the following entries are defined only for the Falcon */ - if ((atari_mch_cookie >> 16) != ATARI_MCH_FALCON) + if (!MACH_IS_FALCON) return 1; PRINT_PROC( "OS language : " ); diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/char/tty_io.c linux-2.1.72/drivers/char/tty_io.c --- linux-2.1.72.orig/drivers/char/tty_io.c Sun Dec 14 17:34:56 1997 +++ linux-2.1.72/drivers/char/tty_io.c Wed Dec 17 11:32:59 1997 @@ -519,6 +519,8 @@ void wait_for_keypress(void) { struct console *c = console_drivers; + while(c && !c->wait_key) + c = c->next; if (c) c->wait_key(c); } diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/char/vga.c linux-2.1.72/drivers/char/vga.c --- linux-2.1.72.orig/drivers/char/vga.c Fri Dec 12 22:36:06 1997 +++ linux-2.1.72/drivers/char/vga.c Tue Dec 16 17:12:40 1997 @@ -150,7 +150,7 @@ if (deccm) { write_vga(14, (pos - video_mem_base)>>1); } else - hide_cursor(); + hide_cursor(currcons); } __initfunc(int con_is_present(void)) diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/net/atarilance.c linux-2.1.72/drivers/net/atarilance.c --- linux-2.1.72.orig/drivers/net/atarilance.c Fri May 16 19:47:30 1997 +++ linux-2.1.72/drivers/net/atarilance.c Wed Dec 17 13:43:35 1997 @@ -763,14 +763,6 @@ return( 0 ); } - if (skb == NULL) { - dev_tint( dev ); - return( 0 ); - } - - if (skb->len <= 0) - return( 0 ); - DPRINTK( 2, ( "%s: lance_start_xmit() called, csr0 %4.4x.\n", dev->name, DREG )); @@ -827,6 +819,7 @@ head->flag = TMD1_OWN_CHIP | TMD1_ENP | TMD1_STP; dev_kfree_skb( skb, FREE_WRITE ); lp->cur_tx++; + lp->stats.tx_bytes += skb->len; while( lp->cur_tx >= TX_RING_SIZE && lp->dirty_tx >= TX_RING_SIZE ) { lp->cur_tx -= TX_RING_SIZE; lp->dirty_tx -= TX_RING_SIZE; @@ -1035,6 +1028,7 @@ skb->protocol = eth_type_trans( skb, dev ); netif_rx( skb ); lp->stats.rx_packets++; + lp->stats.rx_bytes += skb->len; } } diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/scsi/atari_scsi.c linux-2.1.72/drivers/scsi/atari_scsi.c --- linux-2.1.72.orig/drivers/scsi/atari_scsi.c Mon Dec 15 20:37:09 1997 +++ linux-2.1.72/drivers/scsi/atari_scsi.c Tue Dec 16 16:43:06 1997 @@ -698,7 +698,7 @@ hades_dma_emulator); } #endif - if (is_medusa || is_hades) { + if (MACH_IS_MEDUSA || MACH_IS_HADES) { /* While the read overruns (described by Drew Eckhardt in * NCR5380.c) never happened on TTs, they do in fact on the Medusa * (This was the cause why SCSI didn't work right for so long @@ -1020,7 +1020,7 @@ { unsigned long possible_len, limit; #ifndef CONFIG_TT_DMA_EMUL - if (is_hades) + if (MACH_IS_HADES) /* Hades has no SCSI DMA at all :-( Always force use of PIO */ return( 0 ); #endif Binary files linux-2.1.72.orig/drivers/sound/configure and linux-2.1.72/drivers/sound/configure differ diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/drivers/sound/dmasound.c linux-2.1.72/drivers/sound/dmasound.c --- linux-2.1.72.orig/drivers/sound/dmasound.c Mon Dec 15 19:55:43 1997 +++ linux-2.1.72/drivers/sound/dmasound.c Tue Dec 16 16:43:48 1997 @@ -2599,8 +2599,7 @@ case SOUND_MIXER_READ_DEVMASK: return(IOCTL_OUT(arg, SOUND_MASK_VOLUME | SOUND_MASK_TREBLE | SOUND_MASK_BASS | - ((atari_mch_cookie >> 16) == ATARI_MCH_TT ? - SOUND_MASK_SPEAKER : 0))); + (MACH_IS_TT ? SOUND_MASK_SPEAKER : 0))); case SOUND_MIXER_READ_RECMASK: return(IOCTL_OUT(arg, 0)); case SOUND_MIXER_READ_STEREODEVS: @@ -2616,7 +2615,7 @@ case SOUND_MIXER_READ_SPEAKER: { int porta; - if ((atari_mch_cookie >> 16) == ATARI_MCH_TT) { + if (MACH_IS_TT) { cli(); sound_ym.rd_data_reg_sel = 14; porta = sound_ym.rd_data_reg_sel; @@ -2635,7 +2634,7 @@ IOCTL_IN(arg, data); return(IOCTL_OUT(arg, sound_set_treble(data))); case SOUND_MIXER_WRITE_SPEAKER: - if ((atari_mch_cookie >> 16) == ATARI_MCH_TT) { + if (MACH_IS_TT) { int porta; IOCTL_IN(arg, data); cli(); diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/include/asm-m68k/atarihw.h linux-2.1.72/include/asm-m68k/atarihw.h --- linux-2.1.72.orig/include/asm-m68k/atarihw.h Sat Nov 29 20:32:23 1997 +++ linux-2.1.72/include/asm-m68k/atarihw.h Wed Dec 17 11:39:45 1997 @@ -21,14 +21,25 @@ #define _LINUX_ATARIHW_H_ #include +#include extern u_long atari_mch_cookie; - -/* mch_cookie values (upper word) */ -#define ATARI_MCH_ST 0 -#define ATARI_MCH_STE 1 -#define ATARI_MCH_TT 2 -#define ATARI_MCH_FALCON 3 +extern u_long atari_mch_type; +extern u_long atari_switches; +extern int atari_rtc_year_offset; +extern int atari_dont_touch_floppy_select; + +/* convenience macros for testing machine type */ +#define MACH_IS_ST ((atari_mch_cookie >> 16) == ATARI_MCH_ST) +#define MACH_IS_STE ((atari_mch_cookie >> 16) == ATARI_MCH_STE && \ + (atari_mch_cookie & 0xffff) == 0) +#define MACH_IS_MSTE ((atari_mch_cookie >> 16) == ATARI_MCH_STE && \ + (atari_mch_cookie & 0xffff) == 0x10) +#define MACH_IS_TT ((atari_mch_cookie >> 16) == ATARI_MCH_TT) +#define MACH_IS_FALCON ((atari_mch_cookie >> 16) == ATARI_MCH_FALCON) +#define MACH_IS_MEDUSA (atari_mch_type == ATARI_MACH_MEDUSA) +#define MACH_IS_HADES (atari_mch_type == ATARI_MACH_HADES) +#define MACH_IS_AB40 (atari_mch_type == ATARI_MACH_AB40) /* values for atari_switches */ #define ATARI_SWITCH_IKBD 0x01 @@ -104,19 +115,6 @@ #define MFPDELAY() \ __asm__ __volatile__ ( "tstb %0" : : "m" (mfp.par_dt_reg) : "cc" ); -/* Memory used for screen ram and stdma buffers */ -void atari_stram_init (void); -void *atari_stram_alloc (long size, unsigned long *start_mem ); -void atari_stram_free (void *); - -extern int is_medusa; -extern int is_hades; - -/* Memory used for screen ram and stdma buffers */ -void atari_stram_init (void); -void *atari_stram_alloc (long size, unsigned long *start_mem ); -void atari_stram_free (void *); - /* Do cache push/invalidate for DMA read/write. This function obeys the * snooping on some machines (Medusa) and processors: The Medusa itself can * snoop, but only the '040 can source data from its cache to DMA writes i.e., @@ -133,11 +131,11 @@ { if (writeflag) { - if (!is_medusa || CPU_IS_060) + if (!MACH_IS_MEDUSA || CPU_IS_060) cache_push( paddr, len ); } else { - if (!is_medusa) + if (!MACH_IS_MEDUSA) cache_clear( paddr, len ); } } diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/include/asm-m68k/bootinfo.h linux-2.1.72/include/asm-m68k/bootinfo.h --- linux-2.1.72.orig/include/asm-m68k/bootinfo.h Sun Dec 14 17:35:02 1997 +++ linux-2.1.72/include/asm-m68k/bootinfo.h Tue Dec 16 16:45:56 1997 @@ -93,7 +93,20 @@ */ #define BI_ATARI_MCH_COOKIE 0x8000 /* _MCH cookie from TOS (u_long) */ +#define BI_ATARI_MCH_TYPE 0x8001 /* special machine type (u_long) */ + /* (values are ATARI_MACH_* defines */ +/* mch_cookie values (upper word) */ +#define ATARI_MCH_ST 0 +#define ATARI_MCH_STE 1 +#define ATARI_MCH_TT 2 +#define ATARI_MCH_FALCON 3 + +/* mch_type values */ +#define ATARI_MACH_NORMAL 0 /* no special machine type */ +#define ATARI_MACH_MEDUSA 1 /* Medusa 040 */ +#define ATARI_MACH_HADES 2 /* Hades 040 or 060 */ +#define ATARI_MACH_AB40 3 /* Afterburner040 on Falcon */ /* * Stuff for bootinfo interface versioning @@ -129,7 +142,7 @@ #endif /* __ASSEMBLY__ */ #define AMIGA_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) -#define ATARI_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) +#define ATARI_BOOTI_VERSION MK_BI_VERSION( 2, 1 ) #define MVME16x_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/include/asm-m68k/signal.h linux-2.1.72/include/asm-m68k/signal.h --- linux-2.1.72.orig/include/asm-m68k/signal.h Mon Dec 15 13:36:36 1997 +++ linux-2.1.72/include/asm-m68k/signal.h Wed Dec 17 14:46:22 1997 @@ -73,6 +73,7 @@ * SA_FLAGS values: * * SA_ONSTACK is not currently supported, but will allow sigaltstack(2). + * (++roman: SA_ONSTACK is supported on m68k) * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the * SA_RESTART flag to get restarting signals (which were the default long ago) * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/include/linux/console.h linux-2.1.72/include/linux/console.h --- linux-2.1.72.orig/include/linux/console.h Fri Dec 12 22:37:02 1997 +++ linux-2.1.72/include/linux/console.h Wed Dec 17 11:52:13 1997 @@ -90,8 +90,8 @@ int (*read)(struct console *, const char *, unsigned); kdev_t (*device)(struct console *); int (*wait_key)(struct console *); - void (*unblank)(void); - int (*setup)(struct console *, char *); + void (*unblank)(void); + void (*setup)(struct console *, char *); short flags; short index; int cflag; diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/include/linux/mc146818rtc.h linux-2.1.72/include/linux/mc146818rtc.h --- linux-2.1.72.orig/include/linux/mc146818rtc.h Sun Dec 14 22:31:23 1997 +++ linux-2.1.72/include/linux/mc146818rtc.h Wed Dec 17 12:03:13 1997 @@ -29,21 +29,18 @@ * to deal with both modes */ #define RTC_CHECK_DRIVER_INIT() (MACH_IS_ATARI && ATARIHW_PRESENT(TT_CLK)) -#define RTC_MACH_VARIABLES \ - static int leap_year_fix; +#define RTC_MACH_VARIABLES #define RTC_MACH_INIT() \ do { \ if (RTC_HAS_IRQ) \ /* select RTC int on H->L edge */ \ tt_mfp.active_edge &= ~0x40; \ - leap_year_fix = (is_medusa || is_hades || \ - *(short *)0xff000002 >= 0x306); \ } while(0) /* On Atari, the year was stored with base 1970 in old TOS versions (before * 3.06). Later, Atari recognized that this broke leap year recognition, and * changed the base to 1968. Medusa and Hades always use the new version. */ -#define RTC_YEAR_BASE (leap_year_fix ? 68 : 70) +#define RTC_YEAR_BASE atari_rtc_year_offset #define RTC_CENTURY_SWITCH -1 /* no century switch */ #define RTC_MINYEAR (RTC_YEAR_BASE + 1900) diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/init/main.c linux-2.1.72/init/main.c --- linux-2.1.72.orig/init/main.c Fri Dec 12 22:37:10 1997 +++ linux-2.1.72/init/main.c Tue Dec 16 17:15:57 1997 @@ -268,15 +268,6 @@ extern void ipc_init(void); #endif -#if defined(__sparc__) || defined(CONFIG_SERIAL_CONSOLE) -extern int serial_console; -#ifdef CONFIG_SERIAL_CONSOLE -extern void console_setup(char *str, int *ints); -static char console_env[] = "CONSOLE=/dev/ttySx"; -static char *console_dev = console_env + 8; -#endif -#endif - /* * Boot command-line arguments */ @@ -367,7 +358,6 @@ { "swap=", swap_setup }, { "buff=", buff_setup }, { "panic=", panic_setup }, - { "console=", console_setup }, #ifdef CONFIG_VT { "no-scroll", no_scroll }, #endif @@ -878,16 +868,6 @@ argv_init[++args] = line; } } -#ifdef CONFIG_SERIAL_CONSOLE - if (serial_console) - console_env[17] = serial_console - 64 + '0'; - else { - console_env[16] = '0'; - console_env[17] = '\0'; - } - if (envs < MAX_INIT_ENVS) - envp_init[++envs] = console_env; -#endif argv_init[args+1] = NULL; envp_init[envs+1] = NULL; } diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.72.orig/kernel/printk.c linux-2.1.72/kernel/printk.c --- linux-2.1.72.orig/kernel/printk.c Fri Dec 12 22:37:13 1997 +++ linux-2.1.72/kernel/printk.c Wed Dec 17 11:55:15 1997 @@ -317,11 +317,10 @@ * that registers here. */ if (selected_console == 0) { - if (console->setup == NULL || - console->setup(console, NULL) == 0) { - console->flags |= CON_ENABLED | CON_FIRST; - selected_console = 1; - } + console->flags |= CON_ENABLED | CON_FIRST; + selected_console = 1; + if (console->setup) + console->setup(console, NULL); } /* @@ -334,15 +333,13 @@ if (console->index >= 0 && console->index != console_cmdline[i].index) continue; - if (console->index < 0) console->index = 0; - if (console->setup && - console->setup(console, console_cmdline[i].options) != 0) - break; - console->flags |= CON_ENABLED; - console->index = console_cmdline[i].index; - if (i == 0) - console->flags |= CON_FIRST; - break; + console->flags |= CON_ENABLED; + console->index = console_cmdline[i].index; + if (i == 0) + console->flags |= CON_FIRST; + if (console->setup) + console->setup(console, console_cmdline[i].options); + break; } if (!(console->flags & CON_ENABLED))