diff options
Diffstat (limited to 'arch/m68k/atari')
-rw-r--r-- | arch/m68k/atari/Makefile | 5 | ||||
-rw-r--r-- | arch/m68k/atari/atafb.c | 37 | ||||
-rw-r--r-- | arch/m68k/atari/ataints.c | 16 | ||||
-rw-r--r-- | arch/m68k/atari/atakeyb.c | 65 | ||||
-rw-r--r-- | arch/m68k/atari/atari_ksyms.c | 35 | ||||
-rw-r--r-- | arch/m68k/atari/atasound.c | 1 | ||||
-rw-r--r-- | arch/m68k/atari/config.c | 263 | ||||
-rw-r--r-- | arch/m68k/atari/joystick.c | 32 | ||||
-rw-r--r-- | arch/m68k/atari/ksyms.c | 40 | ||||
-rw-r--r-- | arch/m68k/atari/stdma.c | 1 | ||||
-rw-r--r-- | arch/m68k/atari/stram.c | 10 |
11 files changed, 306 insertions, 199 deletions
diff --git a/arch/m68k/atari/Makefile b/arch/m68k/atari/Makefile index 77324bc10..77d5c7c2b 100644 --- a/arch/m68k/atari/Makefile +++ b/arch/m68k/atari/Makefile @@ -7,10 +7,9 @@ # # Note 2! The CFLAGS definitions are now in the main makefile... -EXTRA_CFLAGS := -Wa,-m68030 - O_TARGET := atari.o O_OBJS := config.o atakeyb.o ataints.o \ - stdma.o atasound.o joystick.o stram.o atafb.o ksyms.o + stdma.o atasound.o joystick.o stram.o atafb.o +OX_OBJS := atari_ksyms.o include $(TOPDIR)/Rules.make diff --git a/arch/m68k/atari/atafb.c b/arch/m68k/atari/atafb.c index 488ecc302..64c9a62d3 100644 --- a/arch/m68k/atari/atafb.c +++ b/arch/m68k/atari/atafb.c @@ -210,11 +210,11 @@ And on the MV300 it's difficult to read out the hardware palette. So we just keep track of the set colors in our own array here, and use that! */ -struct { unsigned char red,green,blue,pad; } MV300_color[256]; +static struct { unsigned char red,green,blue,pad; } MV300_color[256]; #endif /* ATAFB_EXT */ -int inverse=0; +static int inverse=0; extern int fontheight_8x8; extern int fontwidth_8x8; @@ -332,7 +332,7 @@ static char *user6_names[] = {"user6", NULL}; static char *user7_names[] = {"user7", NULL}; static char *dummy_names[] = {"dummy", NULL}; -char **fb_var_names[] = { +static char **fb_var_names[] = { /* Writing the name arrays directly in this array (via "(char *[]){...}") * crashes gcc 2.5.8 (sigsegv) if the inner array * contains more than two items. I've also seen that all elements @@ -365,7 +365,7 @@ char **fb_var_names[] = { /* ,NULL */ /* this causes a sigsegv on my gcc-2.5.8 */ }; -struct fb_var_screeninfo atari_fb_predefined[] = { +static struct fb_var_screeninfo atari_fb_predefined[] = { /* * yres_virtual==0 means use hw-scrolling if possible, else yres */ @@ -467,7 +467,7 @@ struct fb_var_screeninfo atari_fb_predefined[] = { 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 } }; -int num_atari_fb_predefined=arraysize(atari_fb_predefined); +static int num_atari_fb_predefined=arraysize(atari_fb_predefined); static int @@ -2348,7 +2348,7 @@ static int pan_display( struct fb_var_screeninfo *var, #ifdef ATAFB_TT -struct fb_hwswitch tt_switch = { +static struct fb_hwswitch tt_switch = { tt_detect, tt_encode_fix, tt_decode_var, tt_encode_var, tt_get_par, tt_set_par, tt_getcolreg, tt_setcolreg, set_screen_base, NULL, pan_display @@ -2356,7 +2356,7 @@ struct fb_hwswitch tt_switch = { #endif #ifdef ATAFB_FALCON -struct fb_hwswitch falcon_switch = { +static struct fb_hwswitch falcon_switch = { falcon_detect, falcon_encode_fix, falcon_decode_var, falcon_encode_var, falcon_get_par, falcon_set_par, falcon_getcolreg, falcon_setcolreg, set_screen_base, falcon_blank, falcon_pan_display @@ -2364,7 +2364,7 @@ struct fb_hwswitch falcon_switch = { #endif #ifdef ATAFB_STE -struct fb_hwswitch st_switch = { +static struct fb_hwswitch st_switch = { stste_detect, stste_encode_fix, stste_decode_var, stste_encode_var, stste_get_par, stste_set_par, stste_getcolreg, stste_setcolreg, stste_set_screen_base, NULL, pan_display @@ -2372,7 +2372,7 @@ struct fb_hwswitch st_switch = { #endif #ifdef ATAFB_EXT -struct fb_hwswitch ext_switch = { +static struct fb_hwswitch ext_switch = { ext_detect, ext_encode_fix, ext_decode_var, ext_encode_var, ext_get_par, ext_set_par, ext_getcolreg, ext_setcolreg, NULL, NULL, NULL }; @@ -2463,9 +2463,15 @@ static short green2[]= static short blue2[]= { 0x0000,0xffff}; -struct fb_cmap default_16_colors = { 0, 16, red16, green16, blue16, NULL }; -struct fb_cmap default_4_colors = { 0, 4, red4, green4, blue4, NULL }; -struct fb_cmap default_2_colors = { 0, 2, red2, green2, blue2, NULL }; +static struct fb_cmap default_16_colors = { + 0, 16, red16, green16, blue16, NULL +}; +static struct fb_cmap default_4_colors = { + 0, 4, red4, green4, blue4, NULL +}; +static struct fb_cmap default_2_colors = { + 0, 2, red2, green2, blue2, NULL +}; static struct fb_cmap * get_default_colormap(int bpp) @@ -2899,6 +2905,12 @@ atafb_blank(int blank) do_install_cmap(currcon); } +static int +atafb_setcmap(struct fb_cmap *cmap, int con) +{ + return(atari_fb_set_cmap(cmap, 1, con)); +} + struct fb_info * atari_fb_init(long *mem_start) { @@ -2993,6 +3005,7 @@ atari_fb_init(long *mem_start) fb_info.switch_con=&atafb_switch; fb_info.updatevar=&fb_update_var; fb_info.blank=&atafb_blank; + fb_info.setcmap=&atafb_setcmap; var=atari_fb_predefined+default_par-1; do_fb_set_var(var,1); strcat(fb_info.modename,fb_var_names[default_par-1][0]); diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c index 642ff027b..b65beefb1 100644 --- a/arch/m68k/atari/ataints.c +++ b/arch/m68k/atari/ataints.c @@ -40,7 +40,6 @@ #include <linux/ptrace.h> #include <linux/kernel_stat.h> -#include <asm/setup.h> #include <asm/system.h> #include <asm/traps.h> @@ -57,9 +56,7 @@ * All interrupt source have an internal number (defined in * <asm/atariints.h>): Autovector interrupts are 1..7, then follow ST-MFP, * TT-MFP, SCC, and finally VME interrupts. Vector numbers for the latter can - * be allocated by atari_register_vme_int(). Currently, all int source numbers - * have the IRQ_MACHSPEC bit set, to keep the general int handling functions - * in kernel/ints.c from them. + * be allocated by atari_register_vme_int(). * * Each interrupt can be of three types: * @@ -181,7 +178,7 @@ asmlinkage void IRQ_NAME(n); \ void atari_slow_irq_##n##_dummy (void) { \ __asm__ (ALIGN_STR "\n" \ SYMBOL_NAME_STR(atari_slow_irq_) #n "_handler:\t" \ -" addql #1,"SYMBOL_NAME_STR(intr_count)"\n" \ +" addql #1,"SYMBOL_NAME_STR(local_irq_count)"\n" \ SAVE_ALL "\n" \ " andb #~(1<<(" #n "&7))," /* mask this interrupt */ \ "("MFP_MK_BASE"+(((" #n "&8)^8)>>2)+((" #n "&16)<<3)):w\n" \ @@ -193,7 +190,7 @@ SYMBOL_NAME_STR(atari_slow_irq_) #n "_handler:\t" \ " lea "SYMBOL_NAME_STR(irq_handler)"+("#n"+8)*8,%%a0\n" \ " pea %%sp@\n" /* push addr of frame */ \ " movel %%a0@(4),%%sp@-\n" /* push handler data */ \ -" pea (" #n "+0x10000008)\n" /* push int number */ \ +" pea (" #n "+8)\n" /* push int number */ \ " movel %%a0@,%%a0\n" \ " jbsr %%a0@\n" /* call the handler */ \ " addql #8,%%sp\n" \ @@ -284,7 +281,7 @@ __asm__ (ALIGN_STR "\n" SYMBOL_NAME_STR(atari_fast_irq_handler) ": orw #0x700,%%sr /* disable all interrupts */ "SYMBOL_NAME_STR(atari_prio_irq_handler) ":\t - addql #1,"SYMBOL_NAME_STR(intr_count)"\n" + addql #1,"SYMBOL_NAME_STR(local_irq_count)"\n" SAVE_ALL " /* get vector number from stack frame and convert to source */ bfextu %%sp@(" FORMATVEC "){#4,#10},%%d0 @@ -297,7 +294,6 @@ SYMBOL_NAME_STR(atari_fast_irq_handler) ": lea %%a0@(%%d0:l:8),%%a0 pea %%sp@ /* push frame address */ movel %%a0@(4),%%sp@- /* push handler data */ - bset #28,%%d0 /* set MACHSPEC bit */ movel %%d0,%%sp@- /* push int number */ movel %%a0@,%%a0 jsr %%a0@ /* and call the handler */ @@ -588,14 +584,12 @@ unsigned long atari_register_vme_int(void) return 0; free_vme_vec_bitmap |= 1 << i; - return (VME_SOURCE_BASE + i) | IRQ_MACHSPEC; + return (VME_SOURCE_BASE + i); } void atari_unregister_vme_int(unsigned long irq) { - irq &= ~IRQ_MACHSPEC; - if(irq >= VME_SOURCE_BASE && irq < VME_SOURCE_BASE + VME_MAX_SOURCES) { irq -= VME_SOURCE_BASE; free_vme_vec_bitmap &= ~(1 << irq); diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c index 95cc0245f..4f57cb928 100644 --- a/arch/m68k/atari/atakeyb.c +++ b/arch/m68k/atari/atakeyb.c @@ -14,6 +14,7 @@ */ #include <linux/sched.h> +#include <linux/kernel.h> #include <linux/interrupt.h> #include <linux/errno.h> #include <linux/keyboard.h> @@ -40,6 +41,15 @@ void (*atari_MIDI_interrupt_hook) (void); /* Hook for mouse driver */ void (*atari_mouse_interrupt_hook) (char *); +/* variables for IKBD self test: */ + +/* state: 0: off; >0: in progress; >1: 0xf1 received */ +static volatile int ikbd_self_test; +/* timestamp when last received a char */ +static volatile unsigned long self_test_last_rcv; +/* bitmap of keys reported as broken */ +static unsigned long broken_keys[128/(sizeof(unsigned long)*8)] = { 0, }; + #define BREAK_MASK (0x80) /* @@ -331,12 +341,15 @@ static void keyboard_interrupt(int irq, void *dummy, struct pt_regs *fp) { /* a very fast typist or a slow system, give a warning */ /* ...happens often if interrupts were disabled for too long */ - printk( "Keyboard overrun\n" ); + printk( KERN_DEBUG "Keyboard overrun\n" ); scancode = acia.key_data; /* Turn off autorepeating in case a break code has been lost */ del_timer( &atakeyb_rep_timer ); rep_scancode = 0; - if (IS_SYNC_CODE(scancode)) { + if (ikbd_self_test) + /* During self test, don't do resyncing, just process the code */ + goto interpret_scancode; + else if (IS_SYNC_CODE(scancode)) { /* This code seem already to be the start of a new packet or a * single scancode */ kb_state.state = KEYBOARD; @@ -386,10 +399,47 @@ static void keyboard_interrupt(int irq, void *dummy, struct pt_regs *fp) kb_state.buf[0] = scancode; break; + case 0xF1: + /* during self-test, note that 0xf1 received */ + if (ikbd_self_test) { + ++ikbd_self_test; + self_test_last_rcv = jiffies; + break; + } + /* FALL THROUGH */ + default: break_flag = scancode & BREAK_MASK; scancode &= ~BREAK_MASK; + if (ikbd_self_test) { + /* Scancodes sent during the self-test stand for broken + * keys (keys being down). The code *should* be a break + * code, but nevertheless some AT keyboard interfaces send + * make codes instead. Therefore, simply ignore + * break_flag... + * */ + int keyval = ataplain_map[scancode], keytyp; + + set_bit( scancode, broken_keys ); + self_test_last_rcv = jiffies; + keyval = ataplain_map[scancode]; + keytyp = KTYP(keyval) - 0xf0; + keyval = KVAL(keyval); + + printk( KERN_WARNING "Key with scancode %d ", scancode ); + if (keytyp == KT_LATIN || keytyp == KT_LETTER) { + if (keyval < ' ') + printk( "('^%c') ", keyval + '@' ); + else + printk( "('%c') ", keyval ); + } + printk( "is broken -- will be ignored.\n" ); + break; + } + else if (test_bit( scancode, broken_keys )) + break; + if (break_flag) { del_timer( &atakeyb_rep_timer ); rep_scancode = 0; @@ -815,7 +865,18 @@ int atari_keyb_init(void) mfp.active_edge &= ~0x10; atari_turnon_irq(IRQ_MFP_ACIA); + ikbd_self_test = 1; ikbd_reset(); + /* wait for a period of inactivity (here: 0.25s), then assume the IKBD's + * self-test is finished */ + self_test_last_rcv = jiffies; + while( jiffies < self_test_last_rcv + HZ/4 ) + barrier(); + /* if not incremented: no 0xf1 received */ + if (ikbd_self_test == 1) + printk( KERN_ERR "WARNING: keyboard self test failed!\n" ); + ikbd_self_test = 0; + ikbd_mouse_disable(); ikbd_joystick_disable(); diff --git a/arch/m68k/atari/atari_ksyms.c b/arch/m68k/atari/atari_ksyms.c new file mode 100644 index 000000000..c2a9da86e --- /dev/null +++ b/arch/m68k/atari/atari_ksyms.c @@ -0,0 +1,35 @@ +#include <linux/config.h> +#include <linux/module.h> +#include <asm/ptrace.h> +#include <asm/traps.h> +#include <asm/atarihw.h> +#include <asm/atariints.h> +#include <asm/atarikb.h> +#include <asm/atari_joystick.h> +#include <asm/atari_stdma.h> + +extern void atari_microwire_cmd( int cmd ); +extern int atari_SCC_reset_done; + +EXPORT_SYMBOL(atari_mch_cookie); +EXPORT_SYMBOL(atari_hw_present); +EXPORT_SYMBOL(is_medusa); +EXPORT_SYMBOL(is_hades); +EXPORT_SYMBOL(atari_register_vme_int); +EXPORT_SYMBOL(atari_unregister_vme_int); +EXPORT_SYMBOL(stdma_lock); +EXPORT_SYMBOL(stdma_release); +EXPORT_SYMBOL(stdma_others_waiting); +EXPORT_SYMBOL(stdma_islocked); + +EXPORT_SYMBOL(atari_mouse_buttons); +EXPORT_SYMBOL(atari_mouse_interrupt_hook); +EXPORT_SYMBOL(atari_MIDI_interrupt_hook); +EXPORT_SYMBOL(atari_SCC_reset_done); +EXPORT_SYMBOL(ikbd_write); +EXPORT_SYMBOL(ikbd_mouse_y0_top); +EXPORT_SYMBOL(ikbd_mouse_thresh); +EXPORT_SYMBOL(ikbd_mouse_rel_pos); +EXPORT_SYMBOL(ikbd_mouse_disable); + +EXPORT_SYMBOL(atari_microwire_cmd); diff --git a/arch/m68k/atari/atasound.c b/arch/m68k/atari/atasound.c index 33f7f79c6..51f8b6823 100644 --- a/arch/m68k/atari/atasound.c +++ b/arch/m68k/atari/atasound.c @@ -21,7 +21,6 @@ for more details. #include <linux/errno.h> #include <linux/mm.h> -#include <asm/setup.h> #include <asm/atarihw.h> #include <asm/system.h> #include <asm/irq.h> diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index f314fcbbd..0d0607da0 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c @@ -33,6 +33,7 @@ #include <linux/console.h> #include <linux/interrupt.h> +#include <asm/bootinfo.h> #include <asm/setup.h> #include <asm/atarihw.h> #include <asm/atarihdreg.h> @@ -44,7 +45,16 @@ #include <asm/pgtable.h> #include <asm/machdep.h> -extern void atari_sched_init(void (*)(int, void *, struct pt_regs *)); +#ifdef CONFIG_KGDB +#include <asm/kgdb.h> +#endif + +u_long atari_mch_cookie; +struct atari_hw_present atari_hw_present; + +extern char m68k_debug_device[]; + +static void atari_sched_init(void (*)(int, void *, struct pt_regs *)); /* atari specific keyboard functions */ extern int atari_keyb_init(void); extern int atari_kbdrate (struct kbd_repeat *); @@ -53,30 +63,38 @@ extern void atari_kbd_leds (unsigned int); extern void atari_init_IRQ (void); extern int atari_request_irq (unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id); -extern int atari_free_irq (unsigned int irq, void *dev_id); +extern void atari_free_irq (unsigned int irq, void *dev_id); extern void atari_enable_irq (unsigned int); extern void atari_disable_irq (unsigned int); extern int atari_get_irq_list (char *buf); +static void atari_get_model(char *model); +static int atari_get_hardware_list(char *buffer); /* atari specific timer functions */ -extern unsigned long atari_gettimeoffset (void); -extern void atari_mste_gettod (int *, int *, int *, int *, int *, int *); -extern void atari_gettod (int *, int *, int *, int *, int *, int *); -extern int atari_mste_hwclk (int, struct hwclk_time *); -extern int atari_hwclk (int, struct hwclk_time *); -extern int atari_mste_set_clock_mmss (unsigned long); -extern int atari_set_clock_mmss (unsigned long); +static unsigned long atari_gettimeoffset (void); +static void atari_mste_gettod (int *, int *, int *, int *, int *, int *); +static void atari_gettod (int *, int *, int *, int *, int *, int *); +static int atari_mste_hwclk (int, struct hwclk_time *); +static int atari_hwclk (int, struct hwclk_time *); +static int atari_mste_set_clock_mmss (unsigned long); +static int atari_set_clock_mmss (unsigned long); extern void atari_mksound( unsigned int count, unsigned int ticks ); -extern void atari_reset( void ); +static void atari_reset( void ); #ifdef CONFIG_BLK_DEV_FD extern int atari_floppy_init (void); extern void atari_floppy_setup(char *, int *); #endif -extern void atari_waitbut (void); extern struct consw fb_con; extern struct fb_info *atari_fb_init(long *); -extern void atari_debug_init (void); +static void atari_debug_init(void); extern void atari_video_setup(char *, int *); +static struct console atari_console_driver; + +/* 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; + + extern void (*kd_mksound)(unsigned int, unsigned int); /* This function tests for the presence of an address, specially a @@ -205,8 +223,36 @@ static int scc_test( volatile char *ctla ) return( 1 ); } + + /* + * Parse an Atari-specific record in the bootinfo + */ + +int atari_parse_bootinfo(const struct bi_record *record) +{ + int unknown = 0; + const u_long *data = record->data; + + switch (record->tag) { + case BI_ATARI_MCH_COOKIE: + atari_mch_cookie = *data; + break; + default: + unknown = 1; + } + return(unknown); +} + + /* + * Setup the Atari configuration info + */ + void config_atari(void) { + memset(&atari_hw_present, 0, sizeof(atari_hw_present)); + + atari_debug_init(); + mach_sched_init = atari_sched_init; mach_keyb_init = atari_keyb_init; mach_kbdrate = atari_kbdrate; @@ -214,21 +260,20 @@ void config_atari(void) mach_init_IRQ = atari_init_IRQ; mach_request_irq = atari_request_irq; mach_free_irq = atari_free_irq; - mach_enable_irq = atari_enable_irq; - mach_disable_irq = atari_disable_irq; + enable_irq = atari_enable_irq; + disable_irq = atari_disable_irq; + mach_get_model = atari_get_model; + mach_get_hardware_list = atari_get_hardware_list; mach_get_irq_list = atari_get_irq_list; mach_gettimeoffset = atari_gettimeoffset; - mach_mksound = atari_mksound; mach_reset = atari_reset; #ifdef CONFIG_BLK_DEV_FD mach_floppy_init = atari_floppy_init; mach_floppy_setup = atari_floppy_setup; #endif conswitchp = &fb_con; - waitbut = atari_waitbut; mach_fb_init = atari_fb_init; mach_max_dma_address = 0xffffff; - mach_debug_init = atari_debug_init; mach_video_setup = atari_video_setup; kd_mksound = atari_mksound; @@ -237,7 +282,7 @@ void config_atari(void) */ printk( "Atari hardware found: " ); - if (is_medusa) { + if (is_medusa || is_hades) { /* There's no Atari video hardware on the Medusa, but all the * addresses below generate a DTACK so no bus error occurs! */ } @@ -279,7 +324,7 @@ void config_atari(void) ATARIHW_SET(SCSI_DMA); printk( "TT_SCSI_DMA " ); } - if (hwreg_present( &st_dma.dma_hi )) { + if (!is_hades && hwreg_present( &st_dma.dma_hi )) { ATARIHW_SET(STND_DMA); printk( "STND_DMA " ); } @@ -301,21 +346,25 @@ void config_atari(void) ATARIHW_SET(YM_2149); printk( "YM2149 " ); } - if (!is_medusa && hwreg_present( &tt_dmasnd.ctrl )) { + if (!is_medusa && !is_hades && hwreg_present( &tt_dmasnd.ctrl )) { ATARIHW_SET(PCM_8BIT); printk( "PCM " ); } - if (hwreg_present( (void *)(0xffff8940) )) { + if (!is_hades && hwreg_present( &codec.unused5 )) { ATARIHW_SET(CODEC); printk( "CODEC " ); } + if (hwreg_present( &dsp56k_host_interface.icr )) { + ATARIHW_SET(DSP56K); + printk( "DSP56K " ); + } if (hwreg_present( &tt_scc_dma.dma_ctrl ) && #if 0 /* This test sucks! Who knows some better? */ (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) && (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0) #else - !is_medusa + !is_medusa && !is_hades #endif ) { ATARIHW_SET(SCC_DMA); @@ -329,7 +378,12 @@ void config_atari(void) ATARIHW_SET( ST_ESCC ); printk( "ST_ESCC " ); } - if (hwreg_present( &tt_scu.sys_mask )) { + if (is_hades) + { + ATARIHW_SET( VME ); + printk( "VME " ); + } + else if (hwreg_present( &tt_scu.sys_mask )) { ATARIHW_SET(SCU); /* Assume a VME bus if there's a SCU */ ATARIHW_SET( VME ); @@ -339,7 +393,7 @@ void config_atari(void) ATARIHW_SET(ANALOG_JOY); printk( "ANALOG_JOY " ); } - if (hwreg_present( blitter.halftone )) { + if (!is_hades && hwreg_present( blitter.halftone )) { ATARIHW_SET(BLITTER); printk( "BLITTER " ); } @@ -348,7 +402,7 @@ void config_atari(void) printk( "IDE " ); } #if 1 /* This maybe wrong */ - if (!is_medusa && + if (!is_medusa && !is_hades && hwreg_present( &tt_microwire.data ) && hwreg_present( &tt_microwire.mask ) && (tt_microwire.mask = 0x7ff, @@ -366,20 +420,20 @@ void config_atari(void) mach_hwclk = atari_hwclk; mach_set_clock_mmss = atari_set_clock_mmss; } - if (hwreg_present( &mste_rtc.sec_ones)) { + if (!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 && + if (!is_medusa && !is_hades && hwreg_present( &dma_wd.fdc_speed ) && hwreg_write( &dma_wd.fdc_speed, 0 )) { ATARIHW_SET(FDCSPEED); printk( "FDC_SPEED "); } - if (!ATARIHW_PRESENT(ST_SCSI)) { + if (!is_hades && !ATARIHW_PRESENT(ST_SCSI)) { ATARIHW_SET(ACSI); printk( "ACSI " ); } @@ -390,9 +444,11 @@ void config_atari(void) * translation (the one that must not be turned off in * head.S...) */ - __asm__ volatile ("moveq #0,%/d0;" - ".long 0x4e7b0004;" /* movec d0,itt0 */ - ".long 0x4e7b0006;" /* movec d0,dtt0 */ + __asm__ volatile ("moveq #0,%/d0\n\t" + ".chip 68040\n\t" + "movec %%d0,%%itt0\n\t" + "movec %%d0,%%dtt0\n\t" + ".chip 68k" : /* no outputs */ : /* no inputs */ : "d0"); @@ -416,13 +472,18 @@ void config_atari(void) tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache * inhibit, read and write, FDC mask = 3, * FDC val = 4 -> Supervisor only */ - __asm__ __volatile__ ( "pmove %0@,%/tt1" : : "a" (&tt1_val) ); + __asm__ __volatile__ ( ".chip 68030\n\t" + "pmove %0@,%/tt1\n\t" + ".chip 68k" + : : "a" (&tt1_val) ); } else { __asm__ __volatile__ ( "movel %0,%/d0\n\t" - ".long 0x4e7b0005\n\t" /* movec d0,itt1 */ - ".long 0x4e7b0007" /* movec d0,dtt1 */ + ".chip 68040\n\t" + "movec %%d0,%%itt1\n\t" + "movec %%d0,%%dtt1\n\t" + ".chip 68k" : : "g" (0xfe00a040) /* Translate 0xfexxxxxx, enable, * supervisor only, non-cacheable/ @@ -432,7 +493,7 @@ void config_atari(void) } } -void atari_sched_init(void (*timer_routine)(int, void *, struct pt_regs *)) +static void atari_sched_init(void (*timer_routine)(int, void *, struct pt_regs *)) { /* set Timer C data Register */ mfp.tim_dt_c = INT_TICKS; @@ -448,7 +509,7 @@ void atari_sched_init(void (*timer_routine)(int, void *, struct pt_regs *)) #define TICK_SIZE 10000 /* This is always executed with interrupts disabled. */ -unsigned long atari_gettimeoffset (void) +static unsigned long atari_gettimeoffset (void) { unsigned long ticks, offset = 0; @@ -511,8 +572,8 @@ mste_write(struct MSTE_RTC *val) } while(0) -void atari_mste_gettod (int *yearp, int *monp, int *dayp, - int *hourp, int *minp, int *secp) +static void atari_mste_gettod (int *yearp, int *monp, int *dayp, + int *hourp, int *minp, int *secp) { int hr24=0, hour; struct MSTE_RTC val; @@ -538,8 +599,8 @@ void atari_mste_gettod (int *yearp, int *monp, int *dayp, } -void atari_gettod (int *yearp, int *monp, int *dayp, - int *hourp, int *minp, int *secp) +static void atari_gettod (int *yearp, int *monp, int *dayp, + int *hourp, int *minp, int *secp) { unsigned char ctrl; unsigned short tos_version; @@ -585,13 +646,13 @@ void atari_gettod (int *yearp, int *monp, int *dayp, 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 ? 0xfff : *(unsigned short *)0xFF000002; + tos_version = (is_medusa || is_hades) ? 0xfff : *(unsigned short *)0xFF000002; *yearp += (tos_version < 0x306) ? 70 : 68; } #define HWCLK_POLL_INTERVAL 5 -int atari_mste_hwclk( int op, struct hwclk_time *t ) +static int atari_mste_hwclk( int op, struct hwclk_time *t ) { int hour, year; int hr24=0; @@ -650,7 +711,7 @@ int atari_mste_hwclk( int op, struct hwclk_time *t ) return 0; } -int atari_hwclk( int op, struct hwclk_time *t ) +static int atari_hwclk( int op, struct hwclk_time *t ) { int sec=0, min=0, hour=0, day=0, mon=0, year=0, wday=0; unsigned long flags; @@ -660,7 +721,7 @@ int atari_hwclk( int op, struct hwclk_time *t ) /* Tos version at Physical 2. See above for explanation why we cannot use PTOV(2). */ - tos_version = is_medusa ? 0xfff : *(unsigned short *)0xff000002; + tos_version = (is_medusa || is_hades) ? 0xfff : *(unsigned short *)0xff000002; ctrl = RTC_READ(RTC_CONTROL); /* control registers are * independent from the UIP */ @@ -777,7 +838,7 @@ int atari_hwclk( int op, struct hwclk_time *t ) } -int atari_mste_set_clock_mmss (unsigned long nowtime) +static int atari_mste_set_clock_mmss (unsigned long nowtime) { short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; struct MSTE_RTC val; @@ -800,7 +861,7 @@ int atari_mste_set_clock_mmss (unsigned long nowtime) return 0; } -int atari_set_clock_mmss (unsigned long nowtime) +static int atari_set_clock_mmss (unsigned long nowtime) { int retval = 0; short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; @@ -839,13 +900,6 @@ int atari_set_clock_mmss (unsigned long nowtime) return retval; } - -void atari_waitbut (void) -{ - /* sorry, no-op */ -} - - static inline void ata_mfp_out (char c) { while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */ @@ -853,12 +907,12 @@ static inline void ata_mfp_out (char c) mfp.usart_dta = c; } -void ata_mfp_print (const char *str) +static void atari_mfp_console_write (const char *str, unsigned int count) { - for( ; *str; ++str ) { + while (count--) { if (*str == '\n') ata_mfp_out( '\r' ); - ata_mfp_out( *str ); + ata_mfp_out( *str++ ); } } @@ -871,12 +925,12 @@ static inline void ata_scc_out (char c) scc.cha_b_data = c; } -void ata_scc_print (const char *str) +static void atari_scc_console_write (const char *str, unsigned int count) { - for( ; *str; ++str ) { + while (count--) { if (*str == '\n') ata_scc_out( '\r' ); - ata_scc_out( *str ); + ata_scc_out( *str++ ); } } @@ -901,20 +955,20 @@ static int ata_par_out (char c) return( 1 ); } -void ata_par_print (const char *str) +static void atari_par_console_write (const char *str, unsigned int count) { static int printer_present = 1; if (!printer_present) return; - for( ; *str; ++str ) { + while (count--) { 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; } @@ -922,15 +976,18 @@ void ata_par_print (const char *str) } -void atari_debug_init( void ) +static void atari_debug_init(void) { - extern void (*debug_print_proc)(const char *); - extern char m68k_debug_device[]; - +#ifdef CONFIG_KGDB + /* if the m68k_debug_device is used by the GDB stub, do nothing here */ + if (kgdb_initialized) + return(NULL); +#endif + if (!strcmp( m68k_debug_device, "ser" )) { /* defaults to ser2 for a Falcon and ser1 otherwise */ strcpy( m68k_debug_device, - ((boot_info.bi_atari.mch_cookie >> 16) == ATARI_MCH_FALCON) ? + ((atari_mch_cookie >> 16) == ATARI_MCH_FALCON) ? "ser2" : "ser1" ); } @@ -943,7 +1000,7 @@ void atari_debug_init( void ) mfp.tim_dt_d = 2; /* 9600 bps */ mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ mfp.trn_stat |= 0x01; /* enable TX */ - debug_print_proc = ata_mfp_print; + atari_console_driver.write = atari_mfp_console_write; } else if (!strcmp( m68k_debug_device, "ser2" )) { /* SCC Modem2 serial port */ @@ -969,7 +1026,7 @@ void atari_debug_init( void ) scc.cha_b_ctrl = *p++; MFPDELAY(); } - debug_print_proc = ata_scc_print; + atari_console_driver.write = atari_scc_console_write; } else if (!strcmp( m68k_debug_device, "par" )) { /* parallel printer */ @@ -980,29 +1037,10 @@ void atari_debug_init( void ) sound_ym.wd_data = 0; /* no char */ sound_ym.rd_data_reg_sel = 14; /* select port A */ sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */ - debug_print_proc = ata_par_print; - } - else - debug_print_proc = NULL; -} - - -void ata_serial_print (const char *str) -{ - int c; - - while (c = *str++, c != 0) - { - if (c == '\n') - { - while (!(mfp.trn_stat & (1 << 7))) - barrier (); - mfp.usart_dta = '\r'; - } - while (!(mfp.trn_stat & (1 << 7))) - barrier (); - mfp.usart_dta = c; + atari_console_driver.write = atari_par_console_write; } + if (atari_console_driver.write) + register_console(&atari_console_driver); } /* ++roman: @@ -1036,14 +1074,15 @@ void ata_serial_print (const char *str) /* ++andreas: no need for complicated code, just depend on prefetch */ -void atari_reset (void) +static void atari_reset (void) { long tc_val = 0; long reset_addr; /* On the Medusa, phys. 0x4 may contain garbage because it's no ROM. See above for explanation why we cannot use PTOV(4). */ - reset_addr = is_medusa ? 0xe00030 : *(unsigned long *) 0xff000004; + reset_addr = is_hades ? 0x7fe00030 : + (is_medusa ? 0xe00030 : *(unsigned long *) 0xff000004); acia.key_ctrl = ACIA_RESET; /* reset ACIA for switch off OverScan, if it's active */ @@ -1062,7 +1101,9 @@ void atari_reset (void) /* 68060: clear PCR to turn off superscalar operation */ __asm__ __volatile__ ("moveq #0,%/d0\n\t" - ".long 0x4e7b0808" /* movec d0,pcr */ + ".chip 68060\n\t" + "movec %%d0,%%pcr\n\t" + ".chip 68k" : : : "d0" ); } @@ -1070,8 +1111,10 @@ void atari_reset (void) ("movel %0,%/d0\n\t" "andl #0xff000000,%/d0\n\t" "orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */ - ".long 0x4e7b0004\n\t" /* movec d0,itt0 */ - ".long 0x4e7b0006\n\t" /* movec d0,dtt0 */ + ".chip 68040\n\t" + "movec %%d0,%%itt0\n\t" + "movec %%d0,%%dtt0\n\t" + ".chip 68k\n\t" "jmp %0@\n\t" : /* no outputs */ : "a" (jmp_addr040) @@ -1080,9 +1123,11 @@ void atari_reset (void) __asm__ __volatile__ ("moveq #0,%/d0\n\t" "nop\n\t" - ".word 0xf4d8\n\t" /* cinva i/d */ - ".word 0xf518\n\t" /* pflusha */ - ".long 0x4e7b0003\n\t" /* movec d0,tc */ + ".chip 68040\n\t" + "cinva %%bc\n\t" + "pflusha\n\t" + "movec %%d0,%%tc\n\t" + ".chip 68k\n\t" "jmp %0@" : /* no outputs */ : "a" (reset_addr) @@ -1097,10 +1142,10 @@ void atari_reset (void) } -void atari_get_model(char *model) +static void atari_get_model(char *model) { strcpy(model, "Atari "); - switch (boot_info.bi_atari.mch_cookie >> 16) { + switch (atari_mch_cookie >> 16) { case ATARI_MCH_ST: if (ATARIHW_PRESENT(MSTE_CLK)) strcat (model, "Mega ST"); @@ -1108,7 +1153,7 @@ void atari_get_model(char *model) strcat (model, "ST"); break; case ATARI_MCH_STE: - if ((boot_info.bi_atari.mch_cookie & 0xffff) == 0x10) + if ((atari_mch_cookie & 0xffff) == 0x10) strcat (model, "Mega STE"); else strcat (model, "STE"); @@ -1117,6 +1162,8 @@ void atari_get_model(char *model) if (is_medusa) /* Medusa has TT _MCH cookie */ strcat (model, "Medusa"); + else if (is_hades) + strcat(model, "Hades"); else strcat (model, "TT"); break; @@ -1125,21 +1172,20 @@ void atari_get_model(char *model) break; default: sprintf (model + strlen (model), "(unknown mach cookie 0x%lx)", - boot_info.bi_atari.mch_cookie); + atari_mch_cookie); break; } } -int atari_get_hardware_list(char *buffer) +static int atari_get_hardware_list(char *buffer) { int len = 0, i; - for (i = 0; i < boot_info.num_memory; i++) + for (i = 0; i < m68k_num_memory; i++) len += sprintf (buffer+len, "\t%3ld MB at 0x%08lx (%s)\n", - boot_info.memory[i].size >> 20, - boot_info.memory[i].addr, - (boot_info.memory[i].addr & 0xff000000 ? + m68k_memory[i].size >> 20, m68k_memory[i].addr, + (m68k_memory[i].addr & 0xff000000 ? "alternate RAM" : "ST-RAM")); #define ATARIHW_ANNOUNCE(name,str) \ @@ -1174,6 +1220,7 @@ int atari_get_hardware_list(char *buffer) ATARIHW_ANNOUNCE(SCU, "System Control Unit"); ATARIHW_ANNOUNCE(BLITTER, "Blitter"); ATARIHW_ANNOUNCE(VME, "VME Bus"); + ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); return(len); } diff --git a/arch/m68k/atari/joystick.c b/arch/m68k/atari/joystick.c index 67acec33b..de6014171 100644 --- a/arch/m68k/atari/joystick.c +++ b/arch/m68k/atari/joystick.c @@ -10,6 +10,7 @@ #include <linux/sched.h> #include <linux/errno.h> #include <linux/major.h> +#include <linux/poll.h> #include <asm/atarikb.h> #include <asm/atari_joystick.h> @@ -54,7 +55,7 @@ void atari_joystick_interrupt(char *buf) /* ikbd_joystick_event_on(); */ } -static void release_joystick(struct inode *inode, struct file *file) +static int release_joystick(struct inode *inode, struct file *file) { int minor = DEVICE_NR(inode->i_rdev); @@ -63,6 +64,7 @@ static void release_joystick(struct inode *inode, struct file *file) if ((joystick[0].active == 0) && (joystick[1].active == 0)) ikbd_joystick_disable(); + return 0; } static int open_joystick(struct inode *inode, struct file *file) @@ -89,30 +91,28 @@ static long read_joystick(struct inode *inode, struct file *file, char *buffer, unsigned long count) { int minor = DEVICE_NR(inode->i_rdev); - int i; if (count < 2) return -EINVAL; if (!joystick[minor].ready) return -EAGAIN; - put_user(joystick[minor].fire, buffer++); - put_user(joystick[minor].dir, buffer++); - for (i = 0; i < count; i++) - put_user(0, buffer++); joystick[minor].ready = 0; - - return i; + if (put_user(joystick[minor].fire, buffer++) || + put_user(joystick[minor].dir, buffer++)) + return -EFAULT; + if (count > 2) + if (clear_user(buffer, count - 2)) + return -EFAULT; + return count; } -static int joystick_select(struct inode *inode, struct file *file, int sel_type, select_table *wait) +static unsigned int joystick_poll(struct file *file, poll_table *wait) { - int minor = DEVICE_NR(inode->i_rdev); + int minor = DEVICE_NR(file->f_inode->i_rdev); - if (sel_type != SEL_IN) - return 0; + poll_wait(&joystick[minor].wait, wait); if (joystick[minor].ready) - return 1; - select_wait(&joystick[minor].wait, wait); + return POLLIN | POLLRDNORM; return 0; } @@ -121,7 +121,7 @@ struct file_operations atari_joystick_fops = { read_joystick, write_joystick, NULL, /* joystick_readdir */ - joystick_select, + joystick_poll, NULL, /* joystick_ioctl */ NULL, /* joystick_mmap */ open_joystick, @@ -134,7 +134,7 @@ int atari_joystick_init(void) joystick[0].ready = joystick[1].ready = 0; joystick[0].wait = joystick[1].wait = NULL; - if (register_chrdev(MAJOR_NR, "joystick", &atari_joystick_fops)) + if (register_chrdev(MAJOR_NR, "Joystick", &atari_joystick_fops)) printk("unable to get major %d for joystick devices\n", MAJOR_NR); return 0; diff --git a/arch/m68k/atari/ksyms.c b/arch/m68k/atari/ksyms.c deleted file mode 100644 index 303babbe1..000000000 --- a/arch/m68k/atari/ksyms.c +++ /dev/null @@ -1,40 +0,0 @@ -#include <linux/module.h> -#include <asm/ptrace.h> -#include <asm/traps.h> -#include <asm/atarihw.h> -#include <asm/atariints.h> -#include <asm/atarikb.h> -#include <asm/atari_joystick.h> -#include <asm/atari_stdma.h> - -extern void atari_microwire_cmd( int cmd ); - -static struct symbol_table mach_atari_symbol_table = { -#include <linux/symtab_begin.h> - - X(is_medusa), - X(atari_register_vme_int), - X(atari_unregister_vme_int), - X(stdma_lock), - X(stdma_release), - X(stdma_others_waiting), - X(stdma_islocked), - - X(atari_mouse_buttons), - X(atari_mouse_interrupt_hook), - X(atari_MIDI_interrupt_hook), - X(ikbd_write), - X(ikbd_mouse_y0_top), - X(ikbd_mouse_thresh), - X(ikbd_mouse_rel_pos), - X(ikbd_mouse_disable), - - X(atari_microwire_cmd), - -#include <linux/symtab_end.h> -}; - -void mach_atari_syms_export(void) -{ - register_symtab(&mach_atari_symbol_table); -} diff --git a/arch/m68k/atari/stdma.c b/arch/m68k/atari/stdma.c index af4a6c7b6..247b9f684 100644 --- a/arch/m68k/atari/stdma.c +++ b/arch/m68k/atari/stdma.c @@ -32,7 +32,6 @@ #include <linux/types.h> #include <linux/genhd.h> #include <linux/sched.h> -#include <asm/setup.h> #include <asm/atari_stdma.h> #include <asm/atariints.h> #include <asm/atarihw.h> diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c index a82988dae..565b20535 100644 --- a/arch/m68k/atari/stram.c +++ b/arch/m68k/atari/stram.c @@ -26,8 +26,8 @@ void atari_stram_init (void) { struct stram_desc *dp; - stramaddr = boot_info.bi_atari.stram_start; - stramsize = boot_info.bi_atari.stram_size; + stramaddr = atari_stram_start; + stramsize = atari_stram_size; /* initialize start boundary */ dp = DP (stramaddr); @@ -194,11 +194,11 @@ void atari_stram_init( void ) { int i; - for( i = 0; i < boot_info.num_memory; ++i ) { - if (boot_info.memory[i].addr == 0) { + for( i = 0; i < m68k_num_memory; ++i ) { + if (m68k_memory[i].addr == 0) { rsvd_stram_beg = PTOV( 0x800 ); /* skip super-only first 2 KB! */ rsvd_stram_end = rsvd_stram_beg; - stram_end = rsvd_stram_beg - 0x800 + boot_info.memory[i].size; + stram_end = rsvd_stram_beg - 0x800 + m68k_memory[i].size; return; } } |