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

📄 bvp_ssp.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 2 页
字号:
#ifndef lintstatic char *sccsid = "@(#)bvp_ssp.c	4.3	(ULTRIX)	10/11/90";#endif lint/************************************************************************ *									* *			Copyright (c) 1988 - 1989 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.	* *									* ************************************************************************//* *   Author:		Mark A. Parenti * *   Modification History * *   09-Nov-89		David E. Eiche		DEE0080 *	Changed bvp_init_blks() to fill in the new software and *	interconnect type fields in the LPIB. * *   19-Sep-1989	Pete Keilty *	Added use of local port info. block ovhd_pd to BVP. *	Remove sizeof(GVPH).  Implicit command address format. * *   25-Aug-1989	Pete Keilty *	Cleaned up port enable wait on own bit and delay for 200000. *	Removed kfork set ipl no longer needed. * *   20-Jul-1989	Mark A. Parenti *	Use Ctrl_from_num() macro to generate local system name. Controller *	numbers large than 9 will now be correctly displayed. * *   25-May-1989	Pete Keilty *	Made changes so bvp tape runs on mips cpu's. WBFLUSH add, *	changed splx( IPL_SCS ) to Splscs(), Ksched fork routines now *	raise IPL. *	 *   17-Jan-1989	Todd M. Katz		TMK0003 *	1. The macro Scaaddr_lol() has been renamed to Scaaddr_low().  It now *	   accesses only the low order word( instead of low order longword ) of *	   a SCA system address.  The macro Scaaddr_hos() has been renamed to *	   Scaaddr_hi().  Make use of the new macro Scaaadr_mid(). *	2. Include header file ../vaxmsi/msisysap.h. *	3. Use the ../machine link to refer to machine specific header files. * *   21-Aug-1988	Todd M. Katz		TMK0002 *	Modify bvp_init_blks() to initialize all of the PCCB interlocked *	queue instqi/remqhi error code fields. * *   05-Aug-1988	David E. Eiche		DEE0049 *	Fill in the hardware port type field in the LPIB with the hardware *	port rather than the adaptor type. * *   02-Jun-1988	Ricky S. Palmer *	Removed inclusion of header file ../vaxmsi/msisysap.h * *   14-Apr-1988	David E. Eiche		DEE0030 *	Change uba_driver table to specify "ra"	disk type. * *   09-Jan-1988	Todd M. Katz		TMK0001 *	Included new header files ../vaxscs/scaparam.h, ../vaxmsi/msisysap.h, *	and ../vaxmsi/msiscs.h. *//* Libraries and Include Files. */#include "../machine/pte.h"#include "../h/param.h"#include "../h/systm.h"#include "../h/buf.h"#include "../h/conf.h"#include "../h/dir.h"#include "../h/user.h"#include "../h/map.h"#include "../h/vm.h"#include "../h/dyntypes.h"#include "../h/vmmac.h"#include "../h/dk.h"#include "../h/kmalloc.h"#include "../h/cmap.h"#include "../h/uio.h"#include "../h/ioctl.h"#include "../h/fs.h"#include "../machine/cpu.h"#include "../machine/scb.h"#include "../io/uba/ubareg.h"#include "../io/uba/ubavar.h"#include "../machine/common/cpuconf.h"#ifdef vax#include "../machine/mtpr.h"#endif vax#include "../io/bi/bireg.h"#include "../io/bi/buareg.h"#include "../io/bi/bvpreg.h"#include "../io/bi/bvpport.h"#include "../io/bi/bdareg.h"#include	"../h/errlog.h"#include	"../h/ksched.h"#include	"../io/scs/sca.h"#include	"../io/scs/scaparam.h"#include	"../io/scs/scamachmac.h"#include	"../io/ci/cippdsysap.h"#include	"../io/ci/cisysap.h"#include	"../io/msi/msisysap.h"#include	"../io/bi/bvpsysap.h"#include	"../io/gvp/gvpsysap.h"#include	"../io/uba/uqsysap.h"#include	"../io/sysap/sysap.h"#include	"../io/ci/cippdscs.h"#include	"../io/ci/ciscs.h"#include	"../io/msi/msiscs.h"#include	"../io/bi/bvpscs.h"#include	"../io/gvp/gvpscs.h"#include	"../io/uba/uqscs.h"#include	"../io/scs/scs.h"#include	"../io/gvp/gvp.h"#include	"../io/bi/bvpppd.h"/* External defines							*/extern	numbvp;	/* hack for ft1 km_alloc flag */extern  int 	cpu;extern	u_long	boottime, scs_msg_size, scs_dg_size, gvp_max_bds;extern	GVPBDDB	*gvp_bddb;extern	struct bidata	bidata[];extern 	pccbq	scs_lport_db;extern 	sbq	scs_config_db;extern 	int	hz;extern	int	sysptsize;extern 	u_long	gvp_initialize(), scs_initialize();extern 	PB	*scs_alloc_pb();extern 	SB	*scs_alloc_sb();extern	void	scs_unix_to_vms();extern	SCSH	*gvp_alloc_msg(), *gvp_remove_msg(), *gvp_alloc_dg(),		*gvp_remove_dg();extern 	void	gvp_unmap_buf(), gvp_dealloc_msg(), gvp_add_msg(),		gvp_send_msg(), scs_dealloc_pb(), scs_dealloc_sb(), 		gvp_dealloc_dg(), gvp_add_dg(), gvp_send_dg();extern	u_long	gvp_map_buf();#define DELAYONE 5/*  *	Data Definitions */PIB	bvp_pib;SIB	bvp_sib;extern	int	bvpsspinit();extern	void	bvp_remove_pb(), bvp_crash_path(), bvp_crash_lport(), 		bvp_timer();extern	u_long	bvp_open_path(), bvp_mreset(), bvp_mstart(), bvp_create_sys();extern	PB	*bvp_get_pb();/* 	Port Info Block */extern	struct bvp_port_info bvp_port_info[];/* BVP switch structure */extern	struct bvp_sw bvp_sw[];extern	int    nbvptypes;/*	BVP command table */extern	struct 	bvp_cmd	bvp_cmd[];extern struct	uba_ctlr *bvpminfo[];int	bvp_probe();void	bvp_init_blks(), bvp_qtrans();PDT	bvppdt	={		/* BVP Port Dispatch Table		*/		gvp_alloc_dg,	/* allocate_dg 		(supported)	*/		gvp_dealloc_dg,	/* deallocate_dg	(supported)	*/		gvp_add_dg,	/* add_dg 		(supported)	*/		gvp_remove_dg,	/* remove_dg 		(supported)	*/		gvp_alloc_msg,	/* allocate_msg 	(supported)	*/		gvp_dealloc_msg,/* deallocate_msg 	(supported)	*/		gvp_add_msg,	/* add_msg 		(supported)	*/		gvp_remove_msg,	/* remove_msg 		(supported)	*/		gvp_send_msg,	/* send_msg 		(supported)	*/		gvp_map_buf,	/* map_buffer 		(supported)	*/		gvp_unmap_buf,	/* unmap_buffer 	(supported)	*/		bvp_open_path,	/* open_path 		(supported)	*/		bvp_crash_path,	/* crash_path 		(supported)	*/		bvp_get_pb,	/* get_pb 		(supported)	*/		bvp_remove_pb,	/* remove_pb 		(supported)	*/		bvp_mreset,	/* maint_reset 		(supported)	*/		bvp_mstart,	/* maint_start 		(supported)	*/		gvp_send_dg,	/* send_dg 		(supported)	*/		0,		/* send_data 		(unsupported)	*/		0,		/* request_data		(unsupported)	*/		bvp_crash_lport,/* crash_lport 		(supported)	*/		0		/* shutdown 		(unsupported)	*/			   };u_short bvpstd[] = { 0 };extern	int	bvp_slave();struct  uba_driver bvpsspdriver ={ bvpsspinit, bvp_slave, 0, 0, bvpstd, "ra", 0, "bvp", bvpminfo, 0};/**//* * * *	Name:		bvp_probe *	 *	Abstract:	Probe routine *			 *	Inputs: * *	reg	-	Address of BIIC Registers *	binumber - 	BI number this controller on *	binode	-	BI node number for this controller *	um	-	Ptr to uba_ctlr struct *	 * *	Outputs: * *	 *	 *	 * *	Return  *	Values: * *	 *	 *  *	Side		 *	Effects: * */int	bvp_probe( nxv, binumber, binode, um )int	nxv, binumber, binode;struct	uba_ctlr	*um;{struct	biic_regs	*birg = (struct biic_regs *)nxv;	struct	bvp_port_info	*pcinfo = &bvp_port_info[um->um_ctlr];PCCB	*pccb;volatile struct	bvpregs	*bvrg;u_long	devtype,bvp_status;int	i,j,s,count;	devtype = birg->biic_typ & BITYP_TYPE; /* Device type	 */	for (i = 0; i < nbvptypes; i++) {		if (bvp_sw[i].type == devtype)			break;	}	if (i == nbvptypes)	/* We don't know about this type	*/		return(0);	bvrg = (struct bvpregs *) (nxv + (long)bvp_sw[i].offset);	KM_ALLOC( pccb, PCCB *, sizeof(PCCB), KM_SCA, KM_NOW_CL_CA )	if ( pccb == (PCCB *)NULL )		return(0);	pcinfo->pc_ptr = pccb;		/* Save pointer to PCCB		 */	U_long( pccb->size ) = sizeof( PCCB );	/* Size of PCCB		 */	pccb->type = DYN_PCCB;		/* Structure type		 */	Pccb.port_regs = (struct bvpregs *)bvrg; /* Address of BVP Port Registers */	Pccb.bvp_ctlr = um->um_ctlr;	/* Save controller number	 */	Pccb.bidata = &bidata[binumber]; /* Ptr to bidata structure	 */	Pccb.binumber = binumber;	/* BI number			 */	Pccb.binode = binode;		/* BI node number		 */	Pccb.nxv = (struct biic_regs *)nxv; /* Base virtual address		 */	Lpinfo.bvp_type = devtype; /* Device type	 *//* *	Insert PCCB on system queue */	Insert_entry(pccb->flink, scs_lport_db); 	s = Splscs();		/*  Raise IPL to SCS level	 */	if((i = scs_initialize()) != RET_SUCCESS ||/* Init the SCS layer */	   (i = gvp_initialize()) != RET_SUCCESS){ /* Init the GVP layer */		(void)splx(s);		/* Lower IPL			 */		Remove_entry(pccb->flink); /* Remove from lport_db queue */					/* Reset the device		 */		return(0);		/* Return with err if init fails */	}	(void)splx(s);		/* Lower IPL				 */	bvp_init_blks( pccb );		/* Init  PQB and PCCB	 */	if (bvp_init_port( pccb ) != RET_SUCCESS)		return(0);		/* Init failed or no such port	 *//* *	Issue port Enable instruction */	WBFLUSH	bvrg->bvp_pc = BVP_PC_OWN | BVP_CMD_ENAB; /* Enable the port	 */	WBFLUSH	Wait_own( bvrg )	/* Wait for PC own bit to reset	*/	DELAY(200000);		/* Wait for port give it enough time. */	bvp_status = bvrg->bvp_ps;	if ( (bvp_status & BVP_PS_PST) != BVP_PSTATE_ENAB ) {		cprintf("bvp_probe: Enable failed - Wrong state\n");		return( 0 );	}	bvrg->bvp_ps = bvp_status & ~BVP_PS_OWN; /* Clear ownership bit */	WBFLUSH/* *	Issue Read PIV instruction to turn on interrupts */	Bvpqb.piv = Pccb.ivec;	/* Set in interrupt vector		 */	bvrg->bvp_pc = BVP_PC_OWN | BVP_CMD_RPIV; /* Read PIV command	 */

⌨️ 快捷键说明

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