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

📄 msi_init.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 2 页
字号:
#ifndef	lintstatic char *sccsid = "@(#)msi_init.c	4.1	(ULTRIX)	7/2/90";#endif	lint/************************************************************************ *                                                                      * *                      Copyright (c) 1989                              * *              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.     * *                                                                      * ************************************************************************ * * *   Facility:	Systems Communication Architecture *		Mayfair Storage Interconnect Port Driver * *   Abstract:	This module contains Mayfair Storage Interconnect Port *		Driver( MSI ) initialization routines and functions. * *   Creator:	Todd M. Katz	Creation Date:	December 07, 1988 * *   Function/Routines: * *   msi_init_port		Initialize a Local MSI Port *   msi_probe			Probe a Local MSI Port *   msi_start_port		Start a Local MSI Port * *   Modification History: * *   28-Dec-89		Robin *	Removed the cpu specific code on the 5400 and made it a ifdef mips. * *   09-Nov-1989	David E. Eiche		DEE0080 *	Add code to msi_probe() to store the new software port type and *	interconnect type fields in the LPIB. * *   9-Jul-1989         Stephen W. Bailey       SWBXXXX *      Added initialization for pccb->Msiisr3 (the SII Main Control *      Diagnostic Register) necessary to fix race conditions with ILP, *      TLP and packet STATUS word for packets in the IL. * *   29-Jun-1989	Todd M. Katz		TMK0001 *	*TEMP* MIPSfair II debugging code. Allocate dynamic memory for caching * 	SII RAM buffer contents during panics. * *   14-Jun-1989	Pete Keilty *	Add include file smp_lock.h * *   10-Jun-1989	Pete Keilty *	Add WBFLUSH, MSI_RPROTOPTE, MSI_XPROTOPTE macro's for MIPS cpu. *	Add Splscs() macro for raise ipl to IPL_SCS. *	Modifed msi_start_port for MIPS cpu's.	 *//* Libraries and Include Files. */#include		"../h/types.h"#include		"../h/dyntypes.h"#include		"../h/param.h"#include		"../h/time.h"#include		"../h/kmalloc.h"#include		"../h/ksched.h"#include		"../h/errlog.h"#include		"../h/systm.h"#include		"../h/vmmac.h"#include		"../h/smp_lock.h"#include		"../machine/pte.h"#include		"../../machine/common/cpuconf.h"#include		"../io/uba/ubareg.h"#include		"../io/scs/sca.h"#include		"../io/scs/scaparam.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/ci/cippd.h"#include		"../io/msi/msiport.h"#include		"../io/scs/scamachmac.h"/* External Variables and Routines. */extern	struct timeval	time;extern	PDT		msi_pdt;extern	PCCB		*msi_adapt[];extern	pccbq		scs_lport_db;extern	caddr_t		get_sys_ptes();extern	u_short		msi_cippdburst,			msi_cippdcontct;extern	void		msi_dealloc_pkt(),			msi_disable(),			msi_init_port(),			msi_log_devattn(),			msi_log_initerr(),			msi_start_port();extern	u_long		scs_dg_size,			scs_msg_size,			gvp_initialize(),			scs_initialize();extern int		cpu;/* Temporary Mipsfair 1 debug code */#ifdef notdefextern u_char	*siirambuf;#endif notdef/*   Name:	msi_init_port	- Initialize a Local MSI Port * *   Abstract:	This routine directs the initialization of a local MSI port. *		It also oversees the port's initial initialization.  It is *		always invoked by forking to it. * *		The local port must be completely disabled whenever execution *		of this routine is scheduled including disablement of: * *		1. Port interrupts. *		2. XFP, RFP, and XFP_TIMER activity. *		3. CI PPD finite state machine activity on the local port. * *		The local MSI port SII chip must also have been reset. * *		NOTE: This is a mandatory PD function( Init_port ) for use by *		      the CI PPD. * *   Inputs: * *   IPL_SCS			- Interrupt processor level *   msi_cippdburst		- CI PPD port polling burst size *   msi_cippdcontct		- CI PPD port contact interval( in seconds ) *   pccb			- Port Command and Control Block pointer *	pd.msi			-  MSI specific PCCB fields *	    lpstatus.active	-   0 *	ppd.cippd		-  CI PPD specific PCCB fields *	    fsmstatus.cleanup	-   1 *	    fsmstatus.fkip	-   1 *	    fsmstatus.online	-   0 *   time			- Current time of day * *   Outputs: * *   IPL_SCS			- Interrupt processor level *   pccb			- Port Command and Control Block pointer *	lpinfo.addr		-  Local port station address *	lpinfo.nreinits		-  Number of local port re-initializations *	pd.msi			-  MSI specific PCCB fields *	    comqh		-   MSIB high priority command queue *	    comql		-   MSIB low priority command queue *	    dfreeq		-   MSIB datagram free queue *	    lpidinfo		-   Local port id information( INITIALIZED ) *	    lpstatus.init	-   0 *	    mfreeq		-   MSIB message free queue *	    randomseed		-   Random number generator seed *	    perport		-   Per-DSSI port information *		rcounters	-    Receive counters( INITIALIZED ) *		rpstatus.dip	-    0 *		rpstatus.path	-    0 *		rpstatus.vc	-    0 *		rseqno		-    0 *		xcounters	-    Transmit counters( INITIALIZED ) *		xretries	-    0 *		xretryq		-    MSIB transmit retry queue *		xretry_timer	-    0 *		xseqno		-    0 *	ppd.cippd		-  CI PPD specific PCCB fields *	    burst		-   Port polling burst size *	    contact		-   Port polling contact frequency *	    fsmstatus.cleanup	-   0 *	    fsmstatus.fkip	-   0 * *   SMP:	The PCCB and PCCB specific XFP, RFP, COMQH, COMQL, DFREEQ, and *		MFREEQ are locked to synchronize access.  Any locking done by *		this routine is probably unnecessary.  This is because of lack *		of conflict for all lock controlled data structures and *		variables due to the single threadedness of port clean up and *		initialization.  It is done anyway to guarantee unrestricted *		access and because stale CI PPD interval timer, RFP, XFP, or *		XFP_TIMER threads could still be scheduled or even active. *		PCCB addresses are always valid because these data structures *		are never deleted. */voidmsi_init_port( pccb )    register PCCB		*pccb;{    register MSI_PPORTINFO	*ppi;    register u_long		init_evcode, num;    register u_long		save_ipl = Splscs();    /* The steps involved in local MSI port initialization are as follows:     *     *  1. The PCCB, RFP, and XFP are locked.     *  2. Port clean up is marked completed.     *     *  - PORT RE-INITIALIZATION ONLY:     *  3. CI PPD port polling burst size and port polling contact frequency     *	   values are reset.     *  4. All port queues are flushed and all flushed packets are deallocated.     *     *  - ALL INITIALIZATIONS:     *  5. SII chip target and initiator timeouts are enabled and timer values     *	   set.     *  6. SII chip DSSI bus drivers are turned on.     *  7. DSSI mode operation of the SII chip is enabled.     *  8. SII chip interrupts, parity error reporting, and receptions are     *	   enabled.     *  9. Local port SII RAM buffer is subdivided into transmit and receive     *	   SIIBUFs and each of them is appropriately initialized.     * 10. SII chip is handed its initial receive buffer list.     * 11. The local MSI port is marked active.     *     * - INITIAL PORT INITIALIZATION ONLY:     * 12. The local port address is retrieved.     * 13. The random transmit delay interval generator is initialized.     * 14. The identification information for the local port is initialized.     *     *  - ALL INITIALIZATIONS:     * 15. Initialization of the local MSI port is logged.     * 16. The XFP, RFP, and PCCB are unlocked.     * 17. The CI PPD is notified of successful port initialization.     *     * Local port CI PPD port polling burst size and contact frequency are     * reset( Step 3 ) using configuration variables.  This allows their values     * to change following failure and re-initialization of a local port.     *     * All MSIB port queues containing dynammically allocated host memory are     * flushed immediately prior to port re-initialization( Step 4 ).  This     * action insures their pristine state and recovers the dynamic memory.     * Logically this action should occur as part of port clean up.  However,     * flushing port queues specifically at this time does not prevent     * subsequent packet queueing.  Nothing can prevent SYSAP, SCS, CI PPD, or     * even MSI Receive Fork Process( RFP ) motivated insertion of packets onto     * port queues without seriously affecting performance until all paths     * associated with the failed port have been terminated.  This condition is     * not reached until the virtual end of port clean up.  This is why port     * queues are flushed during port re-initialization instead of during port     * clean up.  It is just easier and more straightforward to insure their     * pristine state if packet flushing is done at this time.     *     * The SII chip allows its port station address to be either programmed in     * or specified by on-board jumper settings.  The MSI port driver makes use     * of the latter option to avoid addressing conflicts with other remote     * ports on the DSSI bus.  During startup of the local MSI port( Steps 6-10     * ) the SII chip was told to use the on-board jumper settings to specify     * its port station address.  This address is retrived in Step 12 and used     * as the local port station address.     */    Lock_pccb( pccb )    Pccb_fork_done( pccb, PANIC_PCCBFB )    Lock_rfp( pccb )    Lock_xfp( pccb )    pccb->Fsmstatus.cleanup = 0;    if( !pccb->Lpstatus.init ) {	++pccb->lpinfo.nreinits;	pccb->Contact = msi_cippdcontct;	pccb->Burst = msi_cippdburst;	Flush_comqh( pccb )	Flush_comql( pccb )	Flush_dfreeq( pccb )	Flush_mfreeq( pccb )	for( num = 0, ppi = &pccb->Perport[ 0 ];	     num < MSI_MAXNUM_PORT;	     ++num, ++ppi ){	    Init_portinfo( ppi )	}    }    ( void )msi_start_port( pccb );    if( pccb->Lpstatus.init ) {	pccb->Lpstatus.init = 0;	init_evcode = I_LPORT_INIT;	Scaaddr_lob( pccb->lpinfo.addr ) = ( *pccb->Msiidr & MSIIDR_BUSID );	Xinit_generator( pccb )	Init_lpdinfo( pccb )    } else {	init_evcode = I_LPORT_REINIT;    }    ( void )msi_log_devattn( pccb, init_evcode, LOG_NOREGS );    Unlock_xfp( pccb )    Unlock_rfp( pccb )    Unlock_pccb( pccb )    ( void )cippd_start( pccb );    ( void )splx( save_ipl );}/*   Name:	msi_probe	- Probe a Local MSI Port * *   Abstract:	This routine probes a newly discovered MSI port culminating in *		its first initialization.  Any encountered errors abort the MSI *		port probing. * *		NOTE: The MSI port driver NEVER requires sanity checks to be *		      made on its local ports.  It always initializes the PCCB *		      specific finite state machine status bit "nosanity_chk" *		      so that the CI PPD skips such checks. * *   Inputs: * *   0				- Interrupt processor level *   msi_cippdburst		- CI PPD port polling burst size *   msi_cippdcontct		- CI PPD port contact interval( in seconds ) *   msi_pdt			- MSI Port Dispatch Table *   msibuf			- Adapter I/O space 128K RAM buffer address *   msinum			- MSI adapter number *   msi_adapt			- Vector of MSI Adapter Control Blocks *   msiregs			- Adapter I/O space register addresses *   scs_dg_size		- Maximum application datagram size *   scs_lport_db		- System-wide local port database queue head *   scs_msg_size		- Maximum application message size * *   Outputs: * *   0				- Interrupt processor level *   msi_adapt			- Vector of MSI Adapter Control Block *   pccb			- Port Command and Control Block pointer *				   ( INITIALIZED as required ) *   pccb			- Port Command and Control Block pointer *				   ( INITIALIZED as required ) *   scs_lport_db		- System-wide local port database queue head * *   Return Values: * *   1 if probing is successful; otherwise, 0 * *   SMP:	No locks are required even though the PCCB, PCCB specifc XFP *		and SCA database are manipulated.  This function is only called *		during system initialization and at that time only the *		processor executing this code is operational.  This guarantees *		uncompromised access to all data structures without locking the *		PCCB, PCCB specific XFP, or the SCA database. * *		PCCB and PCCB specific XFP, RFP, COMQH, COMQL, DFREEQ, and *		MFREEQ lock structures are initialized. */intmsi_probe( msinum, msiregs, msibuf )

⌨️ 快捷键说明

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