⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config.c

📁 Linux内核源代码 为压缩文件 是<<Linux内核>>一书中的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/* *  linux/arch/m68k/atari/config.c * *  Copyright (C) 1994 Bjoern Brauel * *  5/2/94 Roman Hodek: *    Added setting of time_adj to get a better clock. * *  5/14/94 Roman Hodek: *    gettod() for TT  * *  5/15/94 Roman Hodek: *    hard_reset_now() for Atari (and others?) * *  94/12/30 Andreas Schwab: *    atari_sched_init fixed to get precise clock. * * 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. *//* * Miscellaneous atari stuff */#include <linux/config.h>#include <linux/types.h>#include <linux/mm.h>#include <linux/console.h>#include <linux/init.h>#include <linux/delay.h>#include <linux/ioport.h>#include <asm/bootinfo.h>#include <asm/setup.h>#include <asm/atarihw.h>#include <asm/atariints.h>#include <asm/atari_stram.h>#include <asm/system.h>#include <asm/machdep.h>#include <asm/hwtest.h>#include <asm/io.h>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;/* local function prototypes */static void atari_reset( void );#ifdef CONFIG_ATARI_FLOPPYextern void atari_floppy_setup(char *, int *);#endifstatic void atari_get_model(char *model);static int atari_get_hardware_list(char *buffer);/* atari specific keyboard functions */extern int atari_keyb_init(void);extern int atari_kbdrate (struct kbd_repeat *);extern int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep,			       char raw_mode);extern void atari_kbd_leds (unsigned int);/* atari specific irq functions */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 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);extern void atari_mksound( unsigned int count, unsigned int ticks );#ifdef CONFIG_HEARTBEATstatic void atari_heartbeat( int on );#endif/* atari specific timer functions (in time.c) */extern void atari_sched_init(void (*)(int, void *, struct pt_regs *));extern unsigned long atari_gettimeoffset (void);extern void atari_mste_gettod (int *, int *, int *, int *, int *, int *);extern void atari_tt_gettod (int *, int *, int *, int *, int *, int *);extern int atari_mste_hwclk (int, struct hwclk_time *);extern int atari_tt_hwclk (int, struct hwclk_time *);extern int atari_mste_set_clock_mmss (unsigned long);extern int atari_tt_set_clock_mmss (unsigned long);/* atari specific debug functions (in debug.c) */extern void atari_debug_init(void);#ifdef CONFIG_MAGIC_SYSRQstatic char atari_sysrq_xlate[128] =	"\000\0331234567890-=\177\t"					/* 0x00 - 0x0f */	"qwertyuiop[]\r\000as"							/* 0x10 - 0x1f */	"dfghjkl;'`\000\\zxcv"							/* 0x20 - 0x2f */	"bnm,./\000\000\000 \000\201\202\203\204\205"	/* 0x30 - 0x3f */	"\206\207\210\211\212\000\000\000\000\000-\000\000\000+\000"/* 0x40 - 0x4f */	"\000\000\000\177\000\000\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */	"\000\000\000()/*789456123"						/* 0x60 - 0x6f */	"0.\r\000\000\000\000\000\000\000\000\000\000\000\000\000";	/* 0x70 - 0x7f */#endifextern void (*kd_mksound)(unsigned int, unsigned int);/* I've moved hwreg_present() and hwreg_present_bywrite() out into * mm/hwtest.c, to avoid having multiple copies of the same routine * in the kernel [I wanted them in hp300 and they were already used * in the nubus code. NB: I don't have an Atari so this might (just * conceivably) break something. * I've preserved the #if 0 version of hwreg_present_bywrite() here * for posterity. *   -- Peter Maydell <pmaydell@chiark.greenend.org.uk>, 05/1998 */  #if 0static int __inithwreg_present_bywrite(volatile void *regp, unsigned char val){    int		ret;    long	save_sp, save_vbr;    static long tmp_vectors[3] = { 0, 0, (long)&&after_test };	    __asm__ __volatile__	(	"movec	%/vbr,%2\n\t"	/* save vbr value            */                "movec	%4,%/vbr\n\t"	/* set up temporary vectors  */		"movel	%/sp,%1\n\t"	/* save sp                   */		"moveq	#0,%0\n\t"	/* assume not present        */		"moveb	%5,%3@\n\t"	/* write the hardware reg    */		"cmpb	%3@,%5\n\t"	/* compare it                */		"seq	%0"		/* comes here only if reg    */                                        /* is present                */		: "=d&" (ret), "=r&" (save_sp), "=r&" (save_vbr)		: "a" (regp), "r" (tmp_vectors), "d" (val)                );  after_test:    __asm__ __volatile__      (	"movel	%0,%/sp\n\t"		/* restore sp                */        "movec	%1,%/vbr"			/* restore vbr               */        : : "r" (save_sp), "r" (save_vbr) : "sp"	);    return( ret );}#endif/* ++roman: This is a more elaborate test for an SCC chip, since the plain * Medusa board generates DTACK at the SCC's standard addresses, but a SCC * board in the Medusa is possible. Also, the addresses where the ST_ESCC * resides generate DTACK without the chip, too. * The method is to write values into the interrupt vector register, that * should be readable without trouble (from channel A!). */static int __init scc_test( volatile char *ctla ){	if (!hwreg_present( ctla ))		return( 0 );	MFPDELAY();	*ctla = 2; MFPDELAY();	*ctla = 0x40; MFPDELAY();		*ctla = 2; MFPDELAY();	if (*ctla != 0x40) return( 0 );	MFPDELAY();	*ctla = 2; MFPDELAY();	*ctla = 0x60; MFPDELAY();		*ctla = 2; MFPDELAY();	if (*ctla != 0x60) return( 0 );	return( 1 );}    /*     *  Parse an Atari-specific record in the bootinfo     */int __init 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;	case BI_ATARI_MCH_TYPE:	    atari_mch_type = *data;	    break;	default:	    unknown = 1;    }    return(unknown);}/* Parse the Atari-specific switches= option. */void __init atari_switches_setup( const char *str, unsigned len ){    char switches[len+1];    char *p;    int ovsc_shift;    /* copy string to local array, strtok works destructively... */    strncpy( switches, str, len );    switches[len] = 0;    atari_switches = 0;    /* parse the options */    for( p = strtok( switches, "," ); p; p = strtok( NULL, "," ) ) {	ovsc_shift = 0;	if (strncmp( p, "ov_", 3 ) == 0) {	    p += 3;	    ovsc_shift = ATARI_SWITCH_OVSC_SHIFT;	}		if (strcmp( p, "ikbd" ) == 0) {	    /* RTS line of IKBD ACIA */	    atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift;	}	else if (strcmp( p, "midi" ) == 0) {	    /* RTS line of MIDI ACIA */	    atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift;	}	else if (strcmp( p, "snd6" ) == 0) {	    atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift;	}	else if (strcmp( p, "snd7" ) == 0) {	    atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;	}    }}    /*     *  Setup the Atari configuration info     */void __init config_atari(void){    unsigned short tos_version;    memset(&atari_hw_present, 0, sizeof(atari_hw_present));    atari_debug_init();    ioport_resource.end  = 0xFFFFFFFF;  /* Change size of I/O space from 64KB                                           to 4GB. */    mach_sched_init      = atari_sched_init;    mach_keyb_init       = atari_keyb_init;    mach_kbdrate         = atari_kbdrate;    mach_kbd_translate   = atari_kbd_translate;    SYSRQ_KEY            = 0xff;    mach_kbd_leds        = atari_kbd_leds;    mach_init_IRQ        = atari_init_IRQ;    mach_request_irq     = atari_request_irq;    mach_free_irq        = atari_free_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_reset           = atari_reset;#ifdef CONFIG_ATARI_FLOPPY    mach_floppy_setup	 = atari_floppy_setup;#endif#ifdef CONFIG_DUMMY_CONSOLE    conswitchp	         = &dummy_con;#endif    mach_max_dma_address = 0xffffff;    kd_mksound		 = atari_mksound;#ifdef CONFIG_MAGIC_SYSRQ    mach_sysrq_key = 98;          /* HELP */    mach_sysrq_shift_state = 8;   /* Alt */    mach_sysrq_shift_mask = 0xff; /* all modifiers except CapsLock */    mach_sysrq_xlate = atari_sysrq_xlate;#endif#ifdef CONFIG_HEARTBEAT    mach_heartbeat = atari_heartbeat;#endif    /* Set switches as requested by the user */    if (atari_switches & ATARI_SWITCH_IKBD)	acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID;    if (atari_switches & ATARI_SWITCH_MIDI)	acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID;    if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) {	sound_ym.rd_data_reg_sel = 14;	sound_ym.wd_data = sound_ym.rd_data_reg_sel |			   ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) |			   ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0);    }	    /* ++bjoern:      * Determine hardware present     */    printk( "Atari hardware found: " );    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! */    }    else if (hwreg_present( f030_xreg )) {	ATARIHW_SET(VIDEL_SHIFTER);        printk( "VIDEL " );        /* This is a temporary hack: If there is Falcon video         * hardware, we assume that the ST-DMA serves SCSI instead of         * ACSI. In the future, there should be a better method for         * this...         */	ATARIHW_SET(ST_SCSI);        printk( "STDMA-SCSI " );    }    else if (hwreg_present( tt_palette )) {	ATARIHW_SET(TT_SHIFTER);        printk( "TT_SHIFTER " );    }    else if (hwreg_present( &shifter.bas_hi )) {        if (hwreg_present( &shifter.bas_lo ) &&	    (shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) {	    ATARIHW_SET(EXTD_SHIFTER);            printk( "EXTD_SHIFTER " );        }        else {	    ATARIHW_SET(STND_SHIFTER);            printk( "STND_SHIFTER " );        }    }    if (hwreg_present( &mfp.par_dt_reg )) {	ATARIHW_SET(ST_MFP);        printk( "ST_MFP " );    }    if (hwreg_present( &tt_mfp.par_dt_reg )) {	ATARIHW_SET(TT_MFP);        printk( "TT_MFP " );    }    if (hwreg_present( &tt_scsi_dma.dma_addr_hi )) {	ATARIHW_SET(SCSI_DMA);        printk( "TT_SCSI_DMA " );    }    if (!MACH_IS_HADES && hwreg_present( &st_dma.dma_hi )) {	ATARIHW_SET(STND_DMA);        printk( "STND_DMA " );    }    if (MACH_IS_MEDUSA || /* The ST-DMA address registers aren't readable			   * on all Medusas, so the test below may fail */        (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 &&         (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) &&         st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) {	ATARIHW_SET(EXTD_DMA);        printk( "EXTD_DMA " );    }    if (hwreg_present( &tt_scsi.scsi_data )) {	ATARIHW_SET(TT_SCSI);        printk( "TT_SCSI " );    }    if (hwreg_present( &sound_ym.rd_data_reg_sel )) {	ATARIHW_SET(YM_2149);        printk( "YM2149 " );    }    if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&	hwreg_present( &tt_dmasnd.ctrl )) {	ATARIHW_SET(PCM_8BIT);        printk( "PCM " );    }    if (!MACH_IS_HADES && hwreg_present( &codec.unused5 )) {	ATARIHW_SET(CODEC);        printk( "CODEC " );    }    if (hwreg_present( &dsp56k_host_interface.icr )) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -