📄 cippd_pmaint.c
字号:
#ifndef lintstatic char *sccsid = "@(#)cippd_pmaint.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 ) path maintenance service functions. All * port drivers which utilize the CI PPD for path establishment, * maintenance, and termination should use these functions. * * Creator: Todd M. Katz Creation Date: May 6, 1985 * * Function/Routines: * * cippd_crash_pb Crash CI PPD Path Represented by Path Block * cippd_get_pb Retrieve Path Block * cippd_open_pb Transition Formative Path Block to Open State * cippd_remove_pb Remove Path Block from System-wide Databases * * Modification History: * * 20-May-1989 Pete Keilty * Added support for mips risc cpu's * Add include file ../h/systm.h this file has define for remque * insque for mips. * * 06-Apr-1989 Pete Keilty * Added include file smp_lock.h * * 17-Jan-1989 Todd M. Katz TMK0004 * 1. The PCCB address is now part of the interface to Get_port. * 2. 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. * 3. Include header file ../vaxmsi/msisysap.h. * * 17-Aug-1988 Todd M. Katz TMK0003 * 1. Modifications to cippd_get_pb(). * 1) Update the conditions under which cippd_get_pb() considers * remote port station address invalid. Formerly, for a remote * port station address to be considered invalid it only had to * exceed the software( CI PPD ) maximum port number( * CIPPD_MAXPATHS - 1 ) and be provided to the function in the * form of buffer. Now, not only must both these criteria * still be met; but in addition, the remote port station * address must also exceed the hardware maximum port number of * the specified local port. * 2) Invoke an appropriate port driver specific routine to log * invalid remote port station addresses. Previously the * logging was done by the CI PPD itself. * 2. Modifications to cippd_crash_pb(): * 1) Initialize the CI PPD specific PCCB field elogopt.port_num * to EL_UNDEF when it is invoked to crash an non-existent * path. This initialization is required by cippd_log_path(), * the routine invoked to log SCS and CI PPD path crash event * codes. * 2) Apply the path crash severity modifier( ESM_PC ) to the path * crash reason code whenever the path has not yet been failed. * 3) Cache the reason code within the PB only when the path has * not yet been failed. Cache a general reason when the path * is formative. Cache the specific path crash reason when the * path is open. Previously, the path crash reason was always * being cached. This could have lead to loss of the * legitimate reason when the routine is invoked twice in quick * succession on the same path. * 4) The routine parameter scsbp ALWAYS points to a character * string of size NAME_SIZE instead of to the SCS header of a * datagram/message buffer whenever SCS invokes the routine * with a reason code of E_SYSAP. This character string * consists of the name of the local SYSAP responsible for * crashing the path. * 5) Add a comment as to how individual port drivers go about * crashing paths following discover of physical path specific * errors. * 3. Refer to error logging as event logging. * * 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 Pccb_fork() macro in place of straight-line code. * 2. Modify cippd_crash_pb() to optionally panic on requests to crash * paths. Error recovery is the default action taken; however, * panicing occurs whenever the CI PPD configuration variable * cippd_pc_panic has been appropriately set. This variable may be set * to trigger panicing on any path crash request or on only requests to * crash open paths. * 3. CI PPD event logging is now split between the routines * cippd_log_path() and cippd_log_sys() to differentiate between * logging of path specific and system level events respectively. * Modify cippd_crash_pb() and cippd_get_pb() to invoke * cippd_log_path(). * * 08-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/ksched.h"#include "../h/time.h"#include "../h/errlog.h"#include "../h/smp_lock.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 u_short cippd_pc_panic;extern void cippd_log_path(), ksched(), scs_dealloc_pb(), scs_dealloc_sb();/* Name: cippd_crash_pb - Crash CI PPD Path Represented by Path Block * * Abstract: This function crashes a specific CI PPD path to a known system * and initiates the process by which it is disabled and cleaned * up. This routine may be sequentially invoked any number of * times to crash a specific path; however, only its first * invocation actually results in crashing of the path. All * subsequent invocations only log crash requests and dispose of * optional buffers. This situation persists until the next * incarnation of the path which does not occur until after the * path has been cleaned up, re-discovered, and re-established. * * An optional message or datagram buffer can be provided. * Alternatively an optional port command packet can be provided * when this routine is invoked by the port drivers themselves. * Three options exist for disposal of this optional buffer: * * 1. Buffers may be returned to the routine invocator. * 2. Buffers may be deallocated. * 3. Buffers may be inserted onto the appropriate free queue of * the appropriate local port. * * Only datagram and message buffers may be disposed of by * deallocation or placement onto an appropriate free queue. PDs * must ALWAYS request return of the buffers they provide when * invoking this routine. * * A pointer to a character string of size NAME_SIZE is ALWAYS * provided in place of an optional message or datagram buffer * whenever this routine is invoked with a reason code == E_SYSAP. * This character string contains the name of the local SYSAP * responsible for crashing the specified path. * * The appropriate local port is crashed whenever the optional PB * is not provided. * * NOTE: Port drivers may invoke this routine following discovery * of a physical error associated with a specific path. * However, they must log the explicit physical error * themselves before invoking this routine with a "generic" * CI PPD event code( E_PD or SE_PD ) appropriate to the * severity of the physical error. * * NOTE: When port drivers invoke this routine to crash a path, * the path may have already been disabled. If so, they * must set the PB path_closed state bit BEFORE calling this * routine. * * NOTE: All error recovery is bypassed in favor of immediately * panicing the system whenever the CI PPD configuration * variable flag cippd_pc_panic is appropriately set. * Normally, this flag is 0 and error recovery is the * default action taken. It is set only when special * debugging activity is required and may be set to trigger * panicing on only requests to crash open paths or on * requests to crash any path, formative or open. * * Inputs: * * IPL_SCS - Interrupt processor level * cippd_pc_panic - CI PPD path crash panic flag * disposal - RETURN_BUF or DEALLOC_BUF or RECEIVE_BUF * pccb - Port Command and Control Block pointer * reason - Reason for crashing virtual path * scsbp - Address of SCS header in buffer( OPTIONAL ) * - Address of local SYSAP name( OPTIONAL ) * pb - Path Block pointer( OPTIONAL ) * * Outputs: * * IPL_SCS - Interrupt processor level * pb - Path Block pointer( OPTIONAL ) * pinfo.reason - Reason for crashing virtual path * pccb - Port Command and Control Block pointer * ppd.cippd - CI PPD specific PCCB fields * elogopt.port_num - Remote port number * elogopt.sysapname - Name of local SYSAP crashing path * * SMP: The PCCB is locked INTERNALLY whenever it was not locked * EXTERNALLY prior to routine invocation. Locking the PCCB * synchronizes access; prevents premature PB deletion; and is * required by cippd_log_path(), by PD routines which add * datagrams or messages to appropriate local port free queues in * this particular case( It is required in this particular case * because the PB is locked ), and by the CI PPD finite state * machine. PCCB addresses are always valid because these data * structures are never deleted once their corresponding ports * have been initialized. * * The PB is locked INTERNALLY( provided it exists ) whenever it * was not locked EXTERNALLY prior to routine invocation. Locking * the PB allows exclusive access to PB contents and is required * by the CI PPD finite state machine. PB address validity must * be EXTERNALLY guaranteed either through EXTERNALLY held locks * or by some other mechanism. * * Whenever the PB is locked EXTERNALLY the PCCB must also be * locked EXTERNALLY. This is because the latter occupies a * higher relative position than the former within the SCA locking * hierarchy. */voidcippd_crash_pb( pccb, pb, reason, disposal, scsbp ) PCCB *pccb; register PB *pb; register u_long reason; u_long disposal; register SCSH *scsbp;{ register GVPPPDH *cippdbp; register u_long unlock_pb = 0, unlock_pccb = 0; /* Crashing of formative and established CI PPD paths is extremely similar * with only a few minor differences. These are pointed out as they are * encountered. Crashing of either type of path consists of the following * distinct steps: * * 1. The crash request is pre-processed. * 2. The path is disabled. * 3. The path is asynchronously cleaned up. * * The first step is executed each time this routine is invoked. It is the * latter two steps which constitute crashing the path and are executed * only once per path incarnation. The major benefits of this single * threading of path crashing are the assumptions made during path clean up * which follow directly from it. These assumptions greatly reduce code * complexity and allow extension of the CI PPD to an SMP environment with * a minimum of pain. They are pointed out as they occur. * * Pre-processing of crash requests includes: * * 1. Locking the PCCB whenever it was not locked EXTERNALLY. * 2. Locking the PB whenever one was provided and it was not locked * EXTERNALLY. * 3. Applying the path crash severity modifier( ESM_PC ) to the path crash * reason code. * 4. Caching the path crash reason within the PB for latter reference. * 5. Caching the name of the local SYSAP responsible for crashing the path * for event logging purposes. * 6. Logging the crash request. * 7. Optionally panicing the system. * 8. Disposing of the optional buffer as requested. * * Steps 3 is executed only if the path is still open as only open paths * can be actually crashed. Formative paths are really just prematurely * terminated and failed paths have already been crashed. * * Step 4 is executed only if the path has not yet been crashed. This step * must only be executed once per path incarnation( ie- only if the path
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -