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

📄 prep_setup.c

📁 一个2.4.21版本的嵌入式linux内核
💻 C
📖 第 1 页 / 共 3 页
字号:
	seq_printf(m, "machine\t\t: PReP %s\n", Motherboard_map_name);	/* report amount and type of L2 cache present */	seq_printf(m, "l2 cache\t: ");	switch (cachew & L2CACHE_MASK) {		case L2CACHE_512KB:			seq_printf(m, "512KiB");			break;		case L2CACHE_256KB:			seq_printf(m, "256KiB");			break;		case L2CACHE_1MB:			seq_printf(m, "1MiB");			break;		case L2CACHE_NONE:			seq_printf(m, "none\n");			goto no_l2;			break;		default:			seq_printf(m, "%x\n", cachew);	}	seq_printf(m, ", parity %s",			(cachew & L2CACHE_PARITY)? "enabled" : "disabled");	seq_printf(m, " SRAM:");	switch ( ((cachew & 0xf0) >> 4) & ~(0x3) ) {		case 1: seq_printf(m, "synchronous, parity, flow-through\n");				break;		case 2: seq_printf(m, "asynchronous, no parity\n");				break;		case 3: seq_printf(m, "asynchronous, parity\n");				break;		default:seq_printf(m, "synchronous, pipelined, no parity\n");				break;	}no_l2:#ifdef CONFIG_PREP_RESIDUAL	/* print info about SIMMs */	if (res->ResidualLength != 0) {		int i;		seq_printf(m, "simms\t\t: ");		for (i = 0; (res->ActualNumMemories) && (i < MAX_MEMS); i++) {			if (res->Memories[i].SIMMSize != 0)				seq_printf(m, "%d:%ldM ", i,					(res->Memories[i].SIMMSize > 1024) ? 					res->Memories[i].SIMMSize>>20 : 					res->Memories[i].SIMMSize);		}		seq_printf(m, "\n");	}#endif	return 0;}static void __prepprep_restart(char *cmd){#define PREP_SP92	0x92	/* Special Port 92 */	__cli(); /* no interrupts */	/* set exception prefix high - to the prom */	_nmask_and_or_msr(0, MSR_IP);	/* make sure bit 0 (reset) is a 0 */	outb( inb(PREP_SP92) & ~1L , PREP_SP92);	/* signal a reset to system control port A - soft reset */	outb( inb(PREP_SP92) | 1 , PREP_SP92);	while ( 1 ) ;	/* not reached */#undef PREP_SP92}static void __prepprep_halt(void){	__cli(); /* no interrupts */	/* set exception prefix high - to the prom */	_nmask_and_or_msr(0, MSR_IP);	while ( 1 ) ;	/* not reached */}/* Carrera is the power manager in the Thinkpads. Unfortunately not much is * known about it, so we can't power down. */static void __prepprep_carrera_poweroff(void){	prep_halt();}/* * On most IBM PReP's, power management is handled by a Signetics 87c750 * behind the Utah component on the ISA bus. To access the 750 you must write * a series of nibbles to port 0x82a (decoded by the Utah). This is described * somewhat in the IBM Carolina Technical Specification. * -Hollis */static void __preputah_sig87c750_setbit(unsigned int bytenum, unsigned int bitnum, int value){	/*	 * byte1: 0 0 0 1 0  d  a5 a4	 * byte2: 0 0 0 1 a3 a2 a1 a0	 *	 * d = the bit's value, enabled or disabled	 * (a5 a4 a3) = the byte number, minus 20	 * (a2 a1 a0) = the bit number	 *	 * example: set the 5th bit of byte 21 (21.5)	 *     a5 a4 a3 = 001 (byte 1)	 *     a2 a1 a0 = 101 (bit 5)	 *	 *     byte1 = 0001 0100 (0x14)	 *     byte2 = 0001 1101 (0x1d)	 */	unsigned char byte1=0x10, byte2=0x10;	/* the 750's '20.0' is accessed as '0.0' through Utah (which adds 20) */	bytenum -= 20;	byte1 |= (!!value) << 2;		/* set d */	byte1 |= (bytenum >> 1) & 0x3;	/* set a5, a4 */	byte2 |= (bytenum & 0x1) << 3;	/* set a3 */	byte2 |= bitnum & 0x7;			/* set a2, a1, a0 */	outb(byte1, PREP_IBM_PM1);	/* first nibble */	mb();	udelay(100);				/* important: let controller recover */	outb(byte2, PREP_IBM_PM1);	/* second nibble */	mb();	udelay(100);				/* important: let controller recover */}static void __prepprep_sig750_poweroff(void){	/* tweak the power manager found in most IBM PRePs (except Thinkpads) */	unsigned long flags;	__cli();	/* set exception prefix high - to the prom */	save_flags( flags );	restore_flags( flags|MSR_IP );	utah_sig87c750_setbit(21, 5, 1); /* set bit 21.5, "PMEXEC_OFF" */	while (1) ;	/* not reached */}static int __prepprep_show_percpuinfo(struct seq_file *m, int i){	/* PREP's without residual data will give incorrect values here */	seq_printf(m, "clock\t\t: ");#ifdef CONFIG_PREP_RESIDUAL		if (res->ResidualLength)		seq_printf(m, "%ldMHz\n",			   (res->VitalProductData.ProcessorHz > 1024) ?			   res->VitalProductData.ProcessorHz / 1000000 :			   res->VitalProductData.ProcessorHz);	else#endif /* CONFIG_PREP_RESIDUAL */		seq_printf(m, "???\n");	return 0;}#ifdef CONFIG_SOUND_CS4232 static long __init masktoint(unsigned int i){	int t = -1;	while (i >> ++t)		;	return (t-1);}/* * ppc_cs4232_dma and ppc_cs4232_dma2 are used in include/asm/dma.h * to distinguish sound dma-channels from others. This is because  * blocksize on 16 bit dma-channels 5,6,7 is 128k, but * the cs4232.c uses 64k like on 8 bit dma-channels 0,1,2,3 */static void __init prep_init_sound(void){	PPC_DEVICE *audiodevice = NULL;	/*	 * Get the needed resource informations from residual data.	 * 	 */#ifdef CONFIG_PREP_RESIDUAL	audiodevice = residual_find_device(~0, NULL, MultimediaController,			AudioController, -1, 0);	if (audiodevice != NULL) {		PnP_TAG_PACKET *pkt;		pkt = PnP_find_packet((unsigned char *)&res->DevicePnPHeap[audiodevice->AllocatedOffset],				S5_Packet, 0);		if (pkt != NULL)			ppc_cs4232_dma = masktoint(pkt->S5_Pack.DMAMask);		pkt = PnP_find_packet((unsigned char*)&res->DevicePnPHeap[audiodevice->AllocatedOffset],				S5_Packet, 1);		if (pkt != NULL)			ppc_cs4232_dma2 = masktoint(pkt->S5_Pack.DMAMask);	}#endif	/*	 * These are the PReP specs' defaults for the cs4231.  We use these	 * as fallback incase we don't have residual data.	 * At least the IBM Thinkpad 850 with IDE DMA Channels at 6 and 7 	 * will use the other values.	 */	if (audiodevice == NULL) {		switch (_prep_type) {		case _PREP_IBM:			ppc_cs4232_dma = 1;			ppc_cs4232_dma2 = -1;			break;		default: 			ppc_cs4232_dma = 6;			ppc_cs4232_dma2 = 7;		}	}	/*	 * Find a way to push these informations to the cs4232 driver	 * Give it out with printk, when not in cmd_line?	 * Append it to  cmd_line and saved_command_line?	 * Format is cs4232=io,irq,dma,dma2	 */}#endif /* CONFIG_SOUND_CS4232 *//* * Fill out screen_info according to the residual data. This allows us to use * at least vesafb. */static void __initprep_init_vesa(void){#if defined(CONFIG_PREP_RESIDUAL) && \	(defined(CONFIG_FB_VGA16) || defined(CONFIG_FB_VGA_16_MODULE) || \	 defined(CONFIG_FB_VESA))	PPC_DEVICE *vgadev;	vgadev = residual_find_device(~0, NULL, DisplayController, SVGAController,									-1, 0);	if (vgadev != NULL) {		PnP_TAG_PACKET *pkt;		pkt = PnP_find_large_vendor_packet(				(unsigned char *)&res->DevicePnPHeap[vgadev->AllocatedOffset],				0x04, 0); /* 0x04 = Display Tag */		if (pkt != NULL) {			unsigned char *ptr = (unsigned char *)pkt;			if (ptr[4]) {				/* graphics mode */				screen_info.orig_video_isVGA = VIDEO_TYPE_VLFB;				screen_info.lfb_depth = ptr[4] * 8;				screen_info.lfb_width = swab16(*(short *)(ptr+6));				screen_info.lfb_height = swab16(*(short *)(ptr+8));				screen_info.lfb_linelength = swab16(*(short *)(ptr+10));				screen_info.lfb_base = swab32(*(long *)(ptr+12));				screen_info.lfb_size = swab32(*(long *)(ptr+20)) / 65536;			}		}	}#endif /* CONFIG_PREP_RESIDUAL */}static void __initprep_setup_arch(void){	unsigned char reg;	int is_ide=0;	/* init to some ~sane value until calibrate_delay() runs */	loops_per_jiffy = 50000000;		/* Lookup PCI host bridges */	prep_find_bridges();		/* Set up floppy in PS/2 mode */	outb(0x09, SIO_CONFIG_RA);	reg = inb(SIO_CONFIG_RD);	reg = (reg & 0x3F) | 0x40;	outb(reg, SIO_CONFIG_RD);	outb(reg, SIO_CONFIG_RD);	/* Have to write twice to change! */	switch ( _prep_type )	{	case _PREP_IBM:		reg = inb(PREP_IBM_PLANAR);		printk(KERN_INFO "IBM planar ID: %08x", reg);		switch (reg) {			case PREP_IBM_SANDALFOOT:				prep_gen_enable_l2();				setup_ibm_pci = prep_sandalfoot_setup_pci;				ppc_md.power_off = prep_sig750_poweroff;				ppc_md.show_cpuinfo = prep_sandalfoot_cpuinfo;				break;			case PREP_IBM_THINKPAD:				prep_gen_enable_l2();				setup_ibm_pci = prep_thinkpad_setup_pci;				ppc_md.power_off = prep_carrera_poweroff;				ppc_md.show_cpuinfo = prep_thinkpad_cpuinfo;				break;			default:				printk(" -- unknown! Assuming Carolina");			case PREP_IBM_CAROLINA_IDE_0:			case PREP_IBM_CAROLINA_IDE_1:			case PREP_IBM_CAROLINA_IDE_2:				is_ide = 1;			case PREP_IBM_CAROLINA_SCSI_0:			case PREP_IBM_CAROLINA_SCSI_1:			case PREP_IBM_CAROLINA_SCSI_2:			case PREP_IBM_CAROLINA_SCSI_3:				prep_carolina_enable_l2();				setup_ibm_pci = prep_carolina_setup_pci;				ppc_md.power_off = prep_sig750_poweroff;				ppc_md.show_cpuinfo = prep_carolina_cpuinfo;				break;			case PREP_IBM_TIGER1_133:			case PREP_IBM_TIGER1_166:			case PREP_IBM_TIGER1_180:			case PREP_IBM_TIGER1_xxx:			case PREP_IBM_TIGER1_333:				prep_carolina_enable_l2();				setup_ibm_pci = prep_tiger1_setup_pci;				ppc_md.power_off = prep_sig750_poweroff;				ppc_md.show_cpuinfo = prep_tiger1_cpuinfo;				break;		}		printk("\n");		/* default root device */		if (is_ide)			ROOT_DEV = to_kdev_t(0x0303); /* hda3 */		else			ROOT_DEV = to_kdev_t(0x0803); /* sda3 */		break;	case _PREP_Motorola:		prep_gen_enable_l2();		ppc_md.power_off = prep_halt;		ppc_md.show_cpuinfo = prep_mot_cpuinfo;#ifdef CONFIG_BLK_DEV_INITRD		if (initrd_start)			ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); /* /dev/ram */		else#endif#ifdef CONFIG_ROOT_NFS			ROOT_DEV = to_kdev_t(0x00ff); /* /dev/nfs */#else			ROOT_DEV = to_kdev_t(0x0802); /* /dev/sda2 */#endif		break;	}	/* Read in NVRAM data */ 	init_prep_nvram();	/* if no bootargs, look in NVRAM */	if ( cmd_line[0] == '\0' ) {		char *bootargs;		 bootargs = prep_nvram_get_var("bootargs");		 if (bootargs != NULL) {			 strcpy(cmd_line, bootargs);			 /* again.. */			 strcpy(saved_command_line, cmd_line);		}	}#ifdef CONFIG_SOUND_CS4232 	prep_init_sound();#endif /* CONFIG_SOUND_CS4232 */	prep_init_vesa();	switch (_prep_type) {	case _PREP_Motorola:		raven_init();		break;	case _PREP_IBM:		ibm_prep_init();		break;	}#ifdef CONFIG_VGA_CONSOLE

⌨️ 快捷键说明

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