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

📄 cippd_error.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 4 页
字号:
#ifndef	lintstatic char *sccsid = "@(#)cippd_error.c	4.1	(ULTRIX)	7/2/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.     * *                                                                      * ************************************************************************ * * *   Facility:	Systems Communication Architecture *		Computer Interconnect Port-to-Port Driver * *   Abstract:	This module contains Computer Interconnect Port-to-Port *		Driver( CI PPD ) error processing functions and routines. * *   Creator:	Todd M. Katz	Creation Date:	January 15, 1988 * *   Function/Routines: * *   cippd_clean_fpb		Clean up Aborted Formative CI PPD Path *   cippd_clean_pb		Clean up CI PPD Path Following Path Failure *   cippd_conlog		Log CI PPD Events to Console Terminal *   cippd_csyslev		Process CI PPD Common System Level Events *   cippd_log_path		Event Log CI PPD Path Specific Events *   cippd_log_sys		Event Log CI PPD System Specific Events * *   Modification History: * *   19-Sep-1989	Pete Keilty *	Add SCA errlogging levels to cippd. * *   20-May-1989	Pete Keilty *	Added support for mips risc cpu's  *	Changed splx( IPL_SCS ) to new macro Splscs() * *   06-Apr-1989	Pete Keilty *	Added include file smp_lock.h * *   17-Jan-1989	Todd M. Katz		TMK0006 *	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. *	2. Some hardware platforms require field alignments and access types *	   to match( ie- only longword aligned entities may be longword *	   accessed ).  Structure fields of type c_scaaddr present a potential *	   problem because they are 6 bytes long but are often treated as *	   contigious longword and word.  Such fields have been longword *	   aligned whenever possible.  However, it is not feasible to align *	   certain fields with this format within the CI PPD error log event *	   packet for compatibility reasons.  Therefore, what has been changed *	   for these fields is how they are accessed.  They are now accessed as *	   three contigious words instead of as contigious longword and word. *	3. Modify cippd_log_path() and cippd_log_sys() to always initialize the *	   CI PPD error log packet field cippd_optfmask2 to 0. *	4. Modify cippd_conlog() to include the local port name when *	   identifying the path associated with the event being reported. *	5. Include header file ../vaxmsi/msisysap.h. * *   23-Sep-1988	Todd M. Katz		TMK0005 *	1. Modify cippd_conlog() to add remote port station address( CF_RPORT ) *	   as a class of variable information displayed. *	2. Modify cippd_log_path() to treat all events of remote error severity *	   as remote port specific events for the purpose of logging them to *	   the console. *	3. Modify cippd_log_path() to completely set the remote port station *	   address field( cippd_rsaddr ) of the event record to undefined( *	   EL_UNDEF ) when the identity of the remote port is unknown. *	   Currently, only the low order longword of this field is being set. * *   18-Aug-1988	Todd M. Katz		TMK0004 *	 1. Refer to error logging as event logging. *	 2. SCA event codes have been completely revised. *	 3. The following informational events( ES_I ) have been redefined as *	    warning events( ES_W ): TALKUP, BADSWTYPE. *	 4. The following informational events( ES_I ) have been redefined as *	     remote error events( ES_RE ): DBCONFLICT, RERROR. *	 5. The following informational events( ES_I ) have been redefined as *	    error events( ES_E ): TALKDOWN. *	 6. Rename the informational event( ES_IC ) mnemonic from IE -> I. *	 7. Modifications to cippd_conlog(): *		1) Invalid remote port station address( CF_BADPORTNUM ) and *		   path information( CF_PATH ) have been eliminated and local *		   SYSAP( CF_SYSAPNAME ) and port( CF_LPORTNAME ) names have *		   been added as classes of variable information displayed. *		2) All event code verification checks have been redone. *		3) Logging of certain specific events now occurs regardless of *		   the current CI PPD severity level. *		4) Define a new arguement to the routine, event_type( type of *		   event being console logged ). *		5) The general format of all messages has been redesigned. *		   Path specific information is always displayed by default if *		   the event being logged is a path specific event( *		   PATH_EVENT ).  The remote system name is always displayed by *		   default if the event being logged is a system specific *		   event( SYSTEM_EVENT ).  No information is displayed by *		   default if the event being logged is a remote port specific *		   event( RPORT_EVENT ). *	 8. Modifications to cippd_log_sys(): *		1) Initialize the new CI PPD event logging packet field *		   cippd_evpktver. *		2) Initialize the new CI PPD system level information *		   structure cippdscommon. *		3) Log the current number of paths to the remote system. *		4) Eliminate remote system software type as a class of optional *	    	   information logged. *	 9. Modifications to cippd_log_path(): *		1) Initialize the new CI PPD event logging packet field *		   cippd_evpktver. *		2) Log the path state and current number of paths to the remote *		   system. *		3) Increment the number of errors associated with the *		   appropriate local port only when the severity of the current *		   event is error( ES_E ) or higher. *		4) Add new path information and local SYSAP name as classes of *		   optional information logged. *		5) This routine is now capable of logging both path and remote *		   port specific events. *	10. Modify cippd_clean_fpb() to bypass removal and deallocation of the *	    CI PPD datagram reserved for path establishment from the *	    appropriate local port datagram free queue when local port failure *	    was responsible for abortion of path establishment. * *   03-Jun-1988	Todd M. Katz		TMK0003 *	1. Modify cippd_errorlog() to log path establishment failures *	   IE_ALLOCFAIL and IE_NORETRIES and unsupported remote system software *	   type informational event IE_BADSWTYPE. *	2. Add path( CF_RPORT ) and system software type( CF_SWTYPE ) as *	   classes of variable information displayed by cippd_conlog().  Also, *	   update the format in which various events are displayed. *	3. Split cippd_errorlog() into the two routines cippd_log_path() and *	   cippd_log_sys() to differentiate between logging of path specific *	   and common system level events respectively.  Modify both routines *	   to appropriately initialize the new CI PPD event log packet field *	   cippd_optfmask according to the information being logged.  This *	   field consists of a bit mask with a unique bit assigned for each *	   field optionally present within a CI PPD event log packet. *	4. Add System Block as an optional argument to cippd_conlog(). *	5. Add routine cippd_csyslev() to govern both logging and bookkeeping *	   of common system level events.  Such events are associated with *	   specific remote systems and not with specific ports on those *	   systems. * *   02-Jun-1988	Ricky S. Palmer *      Removed inclusion of header file ../vaxmsi/msisysap.h * *   11-Apr-1988	Todd M. Katz		TMK0002 *	1. Add use of Pb_fork_done() and Pccb_fork() macros in place of *	   straight-line code. *	2. Modify cippd_errorlog() to include logging of the local port name *	   whenever an event pertains to a specific CI PPD path. * *   15-Jan-1988	Todd M. Katz		TMK0001 *	Formated module, revised comments, increased robustness, made *	CI PPD and GVP completely independent from underlying port drivers, *	restructured code paths, and added SMP support. *//* Libraries and Include Files. */#include		"../h/types.h"#include		"../h/param.h"#include		"../h/systm.h"#include		"../h/vmmac.h"#include		"../h/time.h"#include		"../h/ksched.h"#include		"../h/kmalloc.h"#include		"../h/errlog.h"#include		"../h/smp_lock.h"#include		"../h/dyntypes.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/gvp/gvp.h"#include		"../io/ci/cippd.h"/* External Variables and Routines. */extern	SCSIB		lscs;extern	struct el_rec	*ealloc();extern	cippd_slibq	cippd_sli_db;extern	u_short		cippd_severity;extern	u_short		cippd_errlog;extern	CLSTAB		cippd_cltab[ ES_SE + 1 ][ EC_PD + 1 ];extern	void		cippd_conlog(), cippd_log_sys(), scs_dealloc_pb(),			scs_dealloc_sb(), scs_path_crash();/*   Name:	cippd_clean_fpb	- Clean up Aborted Formative CI PPD Path * *   Abstract:	This routine cleans up formative paths whose establishment has *		been aborted due to either errors or failure of the local ports *		to which they are associated.  It is always invoked by forking *		to it. * *		The PB is deallocated following clean up.  Clean up may involve *		deallocation of a formative SB. * *		Scheduling of PD specific port re-initialization occurs if *		crash initiated clean up of the local port has completed. * *		NOTE: The appropriate port drivers are always responsible for *		      the removal and deallocation of all free datagram and *		      message buffers associated with failed local ports.  The *		      CI PPD must never attempt to dispose of such buffers. * *   Inputs: * *   IPL_SCS			- Interrupt processor level *   pb				- Path Block pointer *	pinfo.state		-  PS_PATH_FAILURE *	ppd.cippd		-  CI PPD specific PB fields *	    fsmpstatus.fkip	-   1 * *   Outputs: * *   IPL_SCS			- Interrupt processor level *   pccb			- Port Command and Control Block pointer *	lpinfo.ppd.cippd	-  CI PPD specific local port information *	    nform_paths		-   Current number of formative paths * *   SMP:	The PCCB is locked to synchronize access, for PB removal from *		the local port formative PB queue, and for deletion of the PB  *		representing the formative path.  PCCB addresses are always *		valid because these data structures are never deleted once *		their corresponding ports have been initialized. * *		The PB is locked allowing exclusive access for deleting both PB *		and optional formative SB and as required by optional PD *		routines which delete emergency port specific buffers.  PB *		address validity is guaranteed both by single threading of path *		clean up and by incrementing the PB semaphore prior to *		scheduling of the asynchronous invocation of this routine.  The *		former should be sufficient to guarantee validity, but the *		latter is done anyway as additional protection and to detect *		errors in error recovery logic. * *		PB semaphores are synchronized to before path clean up is *		actually initiated because occasions exist elsewhere within *		the CI PPD when PBs must be unlocked and yet temporarily *		protected against the premature deletion which path clean up *		entails.  PB semaphores are also used to guarantee PB validity *		on entry to this routine. */voidcippd_clean_fpb( pb )    register PB		*pb;{    register SB		*sb;    register SCSH	*scsbp;    register PCCB	*pccb;    register u_long	( *dealloc )();    register u_long	save_ipl = Splscs();    /* Clean up of an aborted formative path includes:     *     * 1. Locking the PCCB.     * 2. Locking the PB.     * 3. Synchronizing to the PB semaphore.     * 4. Removing and deallocating the CI PPD datagram reserved for path     *    establishment from the appropriate local port datagram free queue.     * 5. Optionally deallocating all emergency port specific buffers.     * 6. Optionally deallocating a formative SB.     * 7. Removing the formative PB from the appropriate local port formative     *	  PB queue, unlocking it, and deallocating it.     * 8. Decrementing the number of formative paths originating at the port     *    and scheduling port initialization through forking only when there     *    are no longer any paths originating at the port and port clean up is     *	  currently in progress.     * 9. Unlocking the PCCB.     *     * Synchronization to the PB semaphore( Step 3 ) is important in a SMP     * environment for the following reason.  Occasions exist within the CI     * PPD which require threads to temporarily release all locks, including PB     * locks, while still protecting PBs from deletion.  PB semaphores are the     * mechanism chosen to meet this requirement.  A thread wishing to     * temporarily protect a PB, increments its semaphore prior to releasing     * all locks.  The semaphore is decremented only after all locks have been     * re-obtained and the need for protecting the PB in this fashion has     * passed.  In the interim, any thread desiring to clean up and deallocate     * this PB must first synchronize to its semaphore before proceeding.     *     * The removal and deallocation of the CI PPD datagram reserved for path     * establishment( Step 4 ) is bypassed whenever failure of the local port     * was responsible for abortion of path establishment.     *     * The PCCB fork block is used to schedule port initialization( Step 8 ).     * It should always be available because it is used only for port clean up     * and initialization, these activities are single threaded, and     * initialization always follows clean up.  Guaranteed availability of the     * PCCB fork block is one of the benefits of single threading of port clean     * up and initialization.     *     * One final note.  Once PB removal and deallocation completes, the CI PPD     * is free to attempt establishment of a new path incarnation.  Such     * attempts do not occur until after the path is re-discovered through     * polling.  New path incarnations are fully subject to crashing on     * encountering of sufficient serious errors.     */    pccb = pb->pccb;    Lock_pccb( pccb )    Lock_pb( pb )    Pb_fork_done( pb, PPDPANIC_PBFB )    Decr_pb_sem( pb );    while( Test_pb_sem( pb )) {	Incr_pb_sem( pb );	Unlock_pb( pb )	Unlock_pccb( pccb )	Lock_pccb( pccb )	Lock_pb( pb )	Decr_pb_sem( pb );    }    if( !Port_failure( pb->pinfo.reason )) {

⌨️ 快捷键说明

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