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

📄 ka60.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 3 页
字号:
#ifndef lintstatic char *sccsid = "@(#)ka60.c	4.1	ULTRIX	7/2/90";#endif lint/************************************************************************ *									* *			Copyright (c) 1986,87,88,89 by			* *		Digital Equipment Corporation, Maynard, MA		* *			All rights reserved.				* *									* *   This software is furnished under a license and may be used and	* *   copied  only  in accordance with the terms of such license and	* *   with the  inclusion  of  the  above  copyright  notice.   This	* *   software  or  any	other copies thereof may not be provided or	* *   otherwise made available to any other person.  No title to and	* *   ownership of the software is hereby transferred.			* *									* *   The information in this software is subject to change  without	* *   notice  and should not be construed as a commitment by Digital	* *   Equipment Corporation.						* *									* *   Digital assumes no responsibility for the use  or	reliability	* *   of its software on equipment which is not supplied by Digital.	* *									* ************************************************************************//*********************************************************************** * * Modification History:	ka60.c * * 27-Nov-89    Paul Grist *      added frame_type argument to logmck() calls. * * 03-Oct-89	Darrell A. Dunnuck (darrell) *	A 4 processor firefox now prints the correct processor name -- *	VAXstation 3540, and also fixed a problem with ka60memerr() *	where the condition in an if statement was incorrect such *	that we always assumed an FQAM, and never executed the FTAM *	code. * * 13-Sep-89	Darrell A. Dunnuck (darrell) *	Added a call to ka60custconfig() to allow config support of *	3rd-party M-bus devices. * * 14-Aug-89	Darrell A. Dunnuck (darrell) *	Fixed a bug in ka60memerr() that was causing startcpu() to *	hang. * * 17-Jul-89	Darrell A. Dunnuck (darrell) *	Handle the Q-bus errors on the new FQAM (FQAM -II).  Clean up *	code by removing code within #ifdef notdef -- #endif. * * 24-May-89	darrell *	Changed the #include for cpuconf.h to find it in it's new home -- *	sys/machine/common/cpuconf.h * * 24-May-89	darrell *	Removed the v_ prefix from all cpusw fields, removed cpup from any *	arguments being passed in function args.  cpup is now defined *	globally -- as part of the new cpusw. * * 12-May-89	darrell *	Merged V3.1 changes. * * 16-Feb-89	darrell *	Added a panic to the ka60memerr() routine.  If the frozen bit *	in the buscsr register of any FBIC is set after memerr interrupt *	we will panic. * * 14-Feb-89	darrell *	Added code to ka60crderr(), ka60memerr(), and added the routines *	ka60clrmbint() and ka60setmbint(). * * 20-Jan-89	darrell *	Changed the EL_ESR60 entry to EL_ESR650 to use the already *	defined structure, and made the Mbus I/O Error printout *	an mprintf. * * 20-Jan-89	darrell *	Added error logger support for for memory error, Mbus Errors *	and Error and Status Registers.  Enabled more if the machine *	check handler. * * 18-Nov-88	darrell *	Cleanup. * * 28-Sep-88	darrell *	Changed all writes of fbicsr to be read_modify_write to preserve *	the diagnostic selftest information in the LEDS on all hardware *	modules * * 01-Sep-88	darrell *	Added code to enable I and D stream caching in the CVAX *	internal cache. * * 16-Jun-88	darrell *	Removed definitions that were intended to be I/O space  *	structure definitions that were actually allocating space in BSS. * * 07-Jun-88	darrell *	Code to support ibus is complete. * * 12-7-87	darrell *	Copied this file from ka650.c, and started gutting it to boot *	Firefox. * **********************************************************************/#include "../h/types.h"#include "../h/time.h"#include "../machine/cons.h"#include "../machine/clock.h"#include "uba.h"#include "../machine/pte.h"#include "../h/param.h"#include "../h/systm.h"#include "../h/map.h"#include "../h/buf.h"#include "../h/dk.h"#include "../h/vm.h"#include "../h/conf.h"#include "../h/dmap.h"#include "../h/reboot.h"#include "../h/devio.h"#include "../h/errlog.h"#include "../h/config.h"#include "../machine/cpu.h"#include "../machine/mem.h"#include "../machine/mtpr.h"#include "../machine/ioa.h"#include "../machine/nexus.h"#include "../machine/scb.h"#include "../io/uba/ubareg.h"#include "../io/uba/ubavar.h"#include "../../machine/common/cpuconf.h"#include "../machine/cvax.h"#include "../machine/ka60.h"#include "../io/uba/fcreg.h"#include "../io/uba/fgioctl.h"/* save record of sbis present for sbi error logging for 780 and 8600 */extern long sbi_there;	/* bits 0-15 for nexi,sbi0; 16-31 for nexi on sbi1*/extern int ws_display_type;	/* type of console on workstations */extern	struct uba_driver fcdriver;extern int cache_state;unsigned long ka60_memcon;	/* memory config (memcsr's 0-15) */unsigned int ka60_module;	/* which module had a hard memory error */int ka60_mchkprog = 0;		/* machine check in progress */extern Xka60memerr;extern Xipintr;/* * per M-bus node structure (mb_node) space allocation */struct mb_node mbus_nodes[9];/* * Declare (allocate) space for the Firefox local register spaces. * The structures are in ka60.h. */struct ssc_regs cvqssc[];	/* SSC regs				      */struct cvqbm_regs cvqbm[];	/* Qbus map registers			      */struct cqbic_regs ffqregs[];	/* Firefox CQBIC registers		      */struct fc_regs ffcons[];	/* Firefox console registers		      */struct ffcrom_regs ffcrom[];	/* Firefox console ROM registers	      */struct fbic_regs ffiom[];	/* Firefox FBIC register map		      */int fqamcsr;			/* FQAM CSR				      */extern long cpu_fbic_addr;extern struct cpusw *cpup;	/* pointer to cpusw entry *//* * ka60 configuration routine. * Maps local register space, clears map registers set by VMB, *   calls unifind for device configuration, set console program restart flag. */ka60conf(){	register unsigned int *mapaddr;	/* phys address of Qbus map registers */	register struct mb_node *mbp;	register struct fbic_regs *fbaddr;	register int i;	struct uba_device *ui;	struct uba_ctlr *um;	struct uba_hd *uhp;	struct uba_driver *udp;	int alive;	int base = (int)scb.scb_ipl14;	char *iov;			/* virtual address in I/O space	      */	char *iop;			/* physical address in I/O space      */	extern int fl_ok;	int pri_cpuid;			/* CPUID from Primary CPU	      */	pri_cpuid = mfpr(CPUID);	printf("Primary CPU is %x ", pri_cpuid);	if (fl_ok)		printf("\n");	else		printf(", without an FPU\n");	/*	 * We now have the scb set up enough so we can handle	 * interrupts if any are pending.	 */	(void) spl0();	printf("CCA Base = 0x%x\n", cvqssc->ssc_cca_addr);	cpu_avail = cca_setup() + 1;	/*	 * Map the first page of the console ROM	 */	nxaccess((long *)(MB_SLOT0_BASE + ((pri_cpuid & 0x1e) << 23) + FF_BSROM_OFF), FFCROMmap, 512);	if((*cpup->badaddr)((caddr_t)ffcrom, 4)) {	    cprintf("Base System ROM not found\n");	}	/*	 * Print CVAX chip microcode rev level and	 * KA60 processor firmware rev level	 */	if (cpu_avail > 2)	    printf("VAXstation 3540,  ");	else	    printf("VAXstation 3520,  ");	printf("%d processors available\n", cpu_avail);	printf("	CPU microcode rev = %d, processor firmware rev = %d\n",		(mfpr(SID)) & 0xff, ffcrom->ffcrom_firmrev);	/*	 * Enable all interrupts on the primary CPU	 */	fbaddr = ((struct mb_node *)ka60getmbnode(cpu_fbic_addr,		0x01010108))->mb_vaddr;	fbaddr->f_fbicsr |= FFCSR_EXCAEN | FFCSR_IRQE_3 | FFCSR_IRQE_1 |		FFCSR_PRI0EN |FFCSR_IRQE_0 | FFCSR_LEDS_OFF | FFCSR_NORMAL;	/*	 * Configure the I/O system	 */	/*	 * Say uba0 alive (so installation sizer will see it).	 */	config_set_alive("ibus", 0);	config_set_alive("ibus", 1);	config_set_alive("ibus", 2);	config_set_alive("ibus", 3);	config_set_alive("ibus", 4);	config_set_alive("ibus", 5);	config_set_alive("ibus", 7);	/*	 * Match up the Mbus "devices" with what is in the config file	 */	mbp = mbus_nodes;	for (mbp = mbus_nodes; mbp->mb_flags & FBIC_MAPPED; mbp++) {	    switch (mbp->mb_modtype & 0xff) {		case FMOD_QBUS:		    /*		     * Clear the map registers that were set by VMB (8192 of them).		     * This is necessary so that the QDSS sizing will work when		     *   there is more than one QDSS.		     */		    mapaddr = (unsigned int *)cvqbm->cvqbm_uba.cqba.qb_map;		    for (i = 0; i < 8192; i++) {			*mapaddr = i;			mapaddr++;		    }		    sbi_there |= 1<<0;		    printf("Q22 bus\n");		    uba_hd[0].uba_type = UBAUVII;		    iov = (char *)cvqbm;		    iop = (char *)cpup->nexaddr(0,3);		    unifind ((&((struct cvqbm_regs *)iov)->cvqbm_uba.uba), 			(&((struct cvqbm_regs *)iop)->cvqbm_uba.uba), 			qmem[0],			cpup->umaddr(0,0),			cpup->pc_umsize,			cpup->udevaddr(0,0),			QMEMmap[0], cpup->pc_haveubasr,(long) 0, (long) 0);		    /*		     * Clear bits from the nxm probe and autoconf mchecks.		     */		    ffqregs->cq_dser |= DSER_CLEAR;		    enafbiclog();		    ka60setscbvec(((struct fbic_regs *)mbp->mb_vaddr), 0x17,			(int)&Xka60memerr, SCB_ISTACK);		    ka60setscbvec(((struct fbic_regs *)mbp->mb_vaddr), 0x16,			(int)&Xka60memerr, SCB_ISTACK);		    break;		case FMOD_GRAPHICS:		    alive |= ib_config_dev(mbp->mb_vaddr, mbp->mb_physaddr, mbp->mb_slot, "fg", (base + (mbp->mb_slot * 0x20) + 0x0));		    ka60setscbvec(((struct fbic_regs *)mbp->mb_vaddr), 0x17,			(int)&Xka60memerr, SCB_ISTACK);		    break;		case FMOD_IO:		    alive |= ib_config_dev(ffcons, (MBUS_BASEADDR(mbp->mb_slot) + FF_DZ_OFF), mbp->mb_slot, "fc", (base + (mbp->mb_slot * 0x20) + 0x8));		    alive |= ib_config_dev(cvqni, (MBUS_BASEADDR(mbp->mb_slot) + FF_NI_OFF), mbp->mb_slot, "ln", (base + (mbp->mb_slot * 0x20) + 0x4));		    alive |= ib_config_cont(cvqmsi, (MBUS_BASEADDR(mbp->mb_slot) + FF_SI_OFF), mbp->mb_slot, "sii", (base + (mbp->mb_slot * 0x20) + 0x0));		    ka60setscbvec(((struct fbic_regs *)mbp->mb_vaddr), 0x17,			(int)&Xka60memerr, SCB_ISTACK);		    break;		case FMOD_CPU:		    ka60setscbvec(((struct fbic_regs *)mbp->mb_vaddr), 0x17,			(int)&Xka60memerr, SCB_ISTACK);		    break;		case FMOD_MEM:		    ka60setscbvec(((struct fbic_regs *)mbp->mb_vaddr), 0x17,			(int)&Xka60memerr, SCB_ISTACK);		    break;		default:		    if (ka60custconfig(mbp) != 0) {		    	printf("Unknown MBUS node modtype 0x%x\n",			    mbp->mb_modtype);		    }		    break;	    }	}	/*	 * We're now done probing the I/O busses, so enable interrupts	 */	fbaddr = ((struct mb_node *)ka60getmbnode(cpu_fbic_addr, 0x01010108))->mb_vaddr;	fbaddr->f_fbicsr |= FFCSR_EXCAEN | FFCSR_IRQE_X | FFCSR_LEDS_OFF |		 FFCSR_PRI0EN | FFCSR_HALTEN | FFCSR_NORMAL;	/*	 * Record memory configuration (memcsr's 0-15) in "ka60_memcon".	 */	/*	 * Tell the console program that we've booted and	 * that we speak English and would like to restart	 * if the machine panics.	 */#define RB_CV_RESTART 0x1	/* Restart on Console Halt */	cvqssc->ssc_cpmbx |= RB_CV_RESTART;	return(0);}/* * This routine sets the cache to the state passed:  enabled/disabled. * Enable the  first level cache.  The second * level cache is write back, and was turned on by * the console, and should not be turned off without * having been flushed.  Flushing this cache with * memory management enabled is not an easy task. * * Enable both I-stream and D-stream. */ka60setcache(state)int state;{	mtpr (CADR, state);	return(0);}ka60cachenbl(){	cache_state = 0xfc;	return(0);}/* * Enable CRD interrupts. * This runs at regular (15 min) intervals, turning on the interrupt. * It is called by the timeout call in memenable in machdep.c * The interrupt is turned off, in ka60crderr(), when 3 error interrupts *   occur in 1 time period.  Thus we report at most once per memintvl * (15 mins). */ka60memenable(){	register struct mb_node *mbp;	struct fmdc_regs *fmp;	/*	 * enable SBE interrupts on all memory modules	 */	for (mbp = mbus_nodes; mbp->mb_flags & FBIC_MAPPED; mbp++) {	    if ((mbp->mb_modtype & FMOD_INTERFACE) != FMOD_FMDC)		continue;	    fmp = (struct fmdc_regs *)mbp->mb_vaddr;	    fmp->fm_fmdcsr &= ~FMDCSR_INH_SBE_REPORT;	}}ka60tocons(c)	register int c;{	return(0);}/* * Local Registers on the ka650 are mapped as 6 separate sections * since they are so disjoint. * * "nexnum" is passed in as the section (1 to 6) that we are * currently mapping.  The address constants are defined in ka650.h */short *ka60nexaddr(ioadpt,nexnum)	int ioadpt, nexnum;{	switch (nexnum) {	case 1:		return(CVQMERRADDR);		break;	case 2:		return(CVQCBADDR);		break;	case 3:		return(CVQBMADDR);		break;	case 4:		return(CVQSSCADDR);		break;	case 5:		return(CVQCACHEADDR);		break;	case 6:		return(CVQIPCRADDR);		break;	case 7:		return(CVQROMADDR);		break;	default:		return(CVQMERRADDR);		break;	}}

⌨️ 快捷键说明

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