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

📄 cvax.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 2 页
字号:
#ifndef lintstatic char *sccsid = "@(#)cvax.c	4.5	ULTRIX	4/11/91";#endif lint/************************************************************************ *									* *			Copyright (c) 1986,87,88 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:	cvax.c * * 11-Apr-91	dlh *	- (6000 only) *	- do not call vp_reset in cca_startcpu *	- do write 0 to ACCS (to clear the enable bit) if VP is set disabled in *	  the cca - this write is done via cca_send() *	  note: question write of 0 to ACCS when CPU is not in vpmask.   *		this may not be necessary. * * 20-dec-90	dlh *	added parameter to vp_reset() * * 10-Oct-90	dlh *	add vector support for the Mariah (VAX6000-5xx) * * 4-Sep-90	dlh *	check cca to see if this is a vector-capable machine and if it  *	is then allocate the cpu vpdata structure and set up global  *	variables * * 03-Jun-90    jas *	Modified cca_startcpu() to not do INIT command if cpu is *	an xmp.  Modified cca_send() such that delay is 100000 for RXRDY *	clearing if cpu is xmp. *  * 10-Nov-89	jaw *	move machdep KMALLOC to ccastartcpu for ka6200 because  * 	structure cannot be kmalloced on the IS. * * 30-Oct-89    Szczypek *      Added check for disabled processor in cca_startcpu().  If *      cpu disabled, fact is noted in error log.  Check range is *      from node 0->31. *       * 17-Jul-89	Darrell A. Dunnuck (darrell) *	Removed the printf for VAX_60 that printed the stkpaddr in *	cca_startcpu(). * * 30-May-89	darrell *	Replaced include of cpu.h with include of cpuconf.h. * * 10-Jan-89	Kong *	Added Rigel (VAX6400) support.  Although Rigel is different *	from CVAX, it uses the same CCA routines. * *  26-Jan-89	jaw *	fix up start/stop cpu. * * 16-Aug-88	robin *	Removed \n from print statements (as per Darrell's request); *	removed the ifdiff'ed code that was never used; and marked  *	"dk" to -1 so iostat and vmstat did not think the "ln" device *	was a disk. * * 06-Mar-88	darrell *	creation of this file to contain cvax specific code that *	can be common to all machines with a CVAX processor. * **********************************************************************/#include "../h/types.h"#include "../h/param.h"#include "../h/buf.h"#include "../h/config.h"#include "../h/dk.h"#include "../machine/vectors.h"#include "../h/cpudata.h"#include "../h/time.h"#include "../h/errlog.h"#include "../h/vmmac.h"#include "../h/kmalloc.h"#include "../machine/pte.h"#include "../machine/scb.h"#include "../machine/rpb.h"#include "../io/uba/ubareg.h"#include "../io/uba/ubavar.h"#include "../../machine/common/cpuconf.h"#include "../machine/cvax.h"#include "../h/cpudata.h"#include "../machine/ka6200.h"#include "../machine/mtpr.h"#include "../machine/ka6400.h"/* timers & counters for errors:    used with following error bit... */struct cfpa_errcnt cfpa_errcnt;		/* machine checks 1 thru 4 */struct cdal_errcnt cdal_errcnt;		/* MSER_MCD */struct cache_errcnt cache_errcnt;	/* MSER_MCC */struct qnxm_errcnt qnxm_errcnt;		/* DSER_QNXM */struct qngr_errcnt qngr_errcnt;		/* DSER_NOGRANT */struct qpe_errcnt qpe_errcnt;		/* DSER_QPE */struct dnxm_errcnt dnxm_errcnt;		/* DSER_DNXM */struct crd_errcnt crd_errcnt;		/* MEM_CRD */struct cdalW_errcnt cdalW_errcnt;	/* MEM_CDAL */struct rdsW_errcnt rdsW_errcnt;		/* MEM_RDS */struct tag_errcnt tag_errcnt;		/* CACR_CPE *//* * Machine Check codes for CVAX CPUs. */char *mcCVAX[] = {	"unknown machine check type code",		/* 0 */	"CFPA protocol error",				/* 1 */	"CFPA reserved instruction",			/* 2 */	"CFPA protocol error",				/* 3 */	"CFPA protocol error",				/* 4 */	"process PTE in P0 space during TB miss",	/* 5 */	"process PTE in P1 space during TB miss",	/* 6 */	"process PTE in P0 space during M = 0",		/* 7 */	"process PTE in P1 space during M = 0",		/* 8 */	"hardware interrupt at unused IPL",		/* 9 */	"undefined MOVC3 or MOVC5 state",		/* 10 */	"cache/memory/bus read error",			/* 80 */	"SCB, PCB or SPTE read error",			/* 81 */	"cache/memory/bus write error",			/* 82 */	"PCB or SPTE write error",			/* 83 */};extern int dkn;         /* number of iostat dk numbers assigned so far */extern int nNUBA;extern int cpu;extern int cpu_sub_subtype;/* * Name:	ib_config_cont (nxv, slot, name); * * Args:	nxv	- The virtual address of the "controller" * *		nxp	- The physicall address of the "controller" * *		slot	- The mbus slot number containing the "controller" * *		name	- The name of the "controller" to match with in the *			  ubminit and ubdinit structures * *		scb_vec_addr - The offset from the begining of scb block *				 zero that you want the address of the  *				 interrupt routine specified in the um *				 structure inserted.  If the value equals *				 zero, do not insert the the address of the *				 interrupt routine into the scb. * * Returns:	1 - if the "controller" was found *		0 - if the "controller" wasn't found */ib_config_cont(nxv, nxp, slot, name, scb_vec_addr)char *nxv;char *nxp;u_long slot;char *name;int scb_vec_addr;{	register struct uba_device *ui;	register struct uba_ctlr *um;	register struct uba_driver *udp;	register struct config_adpt *p_adpt;	extern struct config_adpt config_adpt[];	int (**ivec)();	int i;	int found = 0;	um = ubminit;	while (found == 0 && (um->um_driver)) {	    if ((um->um_adpt == slot) && (strcmp(um->um_ctlrname, name) == 0) &&		(um->um_alive == 0) && (um->um_ubanum == -1)) {		    found = 1;	    }	    else {	    	if ((um->um_adpt == '?') && (strcmp(um->um_ctlrname, name) == 0) &&		    (um->um_alive == 0) && (um->um_ubanum == -1)) {			found = 1;		}		else {		    um++;		}	    }	}	if (found == 0) {	    return(0);	}	 	udp = um->um_driver;	for( p_adpt = &config_adpt[0]; p_adpt->p_name; p_adpt++) {	/* first look for iobus entry for this board then	 * check if the driver is correct for this board then 	 * check that the controller number is the same as the	 * iobus entry then	 * check that this iobus entry has not been used	 */				    if (strcmp("ibus", p_adpt->p_name)==0 && 		(char *)udp == p_adpt->c_name &&		p_adpt->c_num == um->um_ctlr  &&		p_adpt->c_ptr == 0) {		    found = 1;	    }	}	if (found = 0) {	    return(0);	}/* DAD - do this here for now.  Need to set up the vector since * sz_siiprobe goes and looks for devices */	if (scb_vec_addr)	    ibcon_vec(scb_vec_addr, um);	i = (*udp->ud_probe)(nxv);	if (i == 0)	    return(0);	um->um_adpt = slot;	um->um_alive = (i ? 1 : 0);	um->um_addr = (char *)nxv;	um->um_physaddr = (char *)svtophy(um->um_addr);	udp->ud_minfo[um->um_ctlr] = um;	config_fillin(um);	printf("\n");	for (ui = ubdinit; ui->ui_driver; ui++) {	    if (ui->ui_driver != udp || ui->ui_alive ||		ui->ui_ctlr != um->um_ctlr && ui->ui_ctlr != '?') {		    continue;	    }	    if ((*udp->ud_slave)(ui, nxv)) {		ui->ui_alive = 1;		ui->ui_ctlr = um->um_ctlr;		ui->ui_addr = (char *)nxv;		ui->ui_ubanum = um->um_ubanum;		ui->ui_hd = um->um_hd;		ui->ui_physaddr = nxp;		ui->ui_adpt = slot;		if (ui->ui_dk && dkn < DK_NDRIVE)		    ui->ui_dk = dkn++;		else		    ui->ui_dk = -1;		ui->ui_mi = um;		/* ui_type comes from driver */		udp->ud_dinfo[ui->ui_unit] = ui;		if(ui->ui_slave >= 0) {		    printf("%s%d at %s%d slave %d",			ui->ui_devname, ui->ui_unit,			udp->ud_mname, um->um_ctlr, ui->ui_slave);		}		else {		    printf("%s%d at %s%d",			ui->ui_devname, ui->ui_unit,			udp->ud_mname, um->um_ctlr);		}		(*udp->ud_attach)(ui);		printf("\n");	    }	}	return (found);}/* * Name:	ib_config_dev (nxv, nxp, slot, name); * * Args:	nxv	- The virtual address of the "device" * *		nxp	- The physical address of the "device" * *		slot	- The ibus slot number containing the "device" * *		name	- The name of the "device" to match with in the *			  ubminit and ubdinit structures * *		scb_vec_addr - The offset from the begining of scb block *				 zero that you want the address of the  *				 interrupt routine specified in the um *				 structure inserted.  If the value equals *				 zero, do not insert the the address of the *				 interrupt routine into the scb. * * Returns:	1 - if the "device" was found *		0 - if the "device" wasn't found */ib_config_dev(nxv, nxp, slot, name, scb_vec_addr)char *nxv;char *nxp;u_long slot;char *name;int scb_vec_addr;{	register struct uba_device *ui;	register struct uba_ctlr *um;	register struct uba_driver *udp;	register struct config_adpt *p_adpt;	extern struct config_adpt config_adpt[];	int (**ivec)();	int i;	int found = 0;		ui = ubdinit;	while (found == 0 && (ui->ui_driver)) {	    if ((ui->ui_adpt == slot) && (strcmp(ui->ui_devname, name) == 0) &&		(ui->ui_alive == 0) && (ui->ui_slave == -1)) {		        found = 1;	    }	    else {		if ((ui->ui_adpt == '?') && (strcmp(ui->ui_devname, name) == 0) &&		    (ui->ui_alive == 0) && (ui->ui_slave == -1)) {		        found = 1;	    	}		else {		    ui++;		}	    }	}	if (found == 0)	    return(0);	udp = ui->ui_driver;	i = (*udp->ud_probe)(nxv);	if (i == 0) {	    return(0);	}	ui->ui_adpt = slot;	config_fillin(ui);	printf("\n");	if (scb_vec_addr)	    ibdev_vec(scb_vec_addr, ui);	ui->ui_alive = (i ? 1 : 0);	ui->ui_addr = (char *)nxv;	ui->ui_dk = -1;	udp->ud_dinfo[ui->ui_unit] = ui;

⌨️ 快捷键说明

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