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

📄 msi_subr.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 2 页
字号:
#ifndef	lintstatic char *sccsid = "@(#)msi_subr.c	4.1	(ULTRIX)	7/2/90";#endif	lint/************************************************************************ *                                                                      * *                      Copyright (c) 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 *		Mayfair Storage Interconnect Port Driver * *   Abstract:	This module contains Mayfair Storage Interconnect Port *		Driver( MSI ) functions provided for use by the CI PPD *		finite state machine in the establishment, maintenance, *		and termination of paths.  Other MSI functions( *		msi_init_port() and msi_log_badport() ) required by the *		CI PPD are located in other modules. * *		This module also contains miscellaneous MSI functions. * *   Creator:	Todd M. Katz	Creation Date:	January 16, 1989 * *   Functions/Routines: * *   Functions and Routines Required by the CI PPD Finite State Machine *	msi_get_port		Retrieve Port Number from Buffer *   	msi_init_pb		Initialize a Path Block *	msi_send_reqid		Request Remote Port Identification *   	msi_set_circuit		Set Virtual Circuit State to On/Off *    MSI Port Driver Miscellaneous Functions *	msi_alloc_pkt		Allocate MSI Port Command Packet *	msi_dealloc_pkt		Deallocate MSI Port Command Packet * *   Modification History: * *   14-Jun-1989	Pete Keilty *	Add include file smp_lock.h *//* Libraries and Include Files. */#include		"../h/types.h"#include		"../h/dyntypes.h"#include		"../h/param.h"#include		"../h/time.h"#include		"../h/ksched.h"#include		"../h/kmalloc.h"#include		"../h/errlog.h"#include		"../h/smp_lock.h"#ifdef mips#include		"../h/systm.h"#include		"../h/vmmac.h"#endif mips#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"/* External Variables and Routines. */extern	MSIB		*msi_alloc_pkt();extern	void		msi_dealloc_pkt(),			msi_log_packet(),			msi_xfp();/*   Name:	msi_get_port	- Retrieve Port Number from Buffer * *   Abstract:	This function retrieves the remote port station address from a *		MSI specific packet. * *		NOTE: This is a mandatory PD function( Get_port ) for use by *		      the CI PPD. * *		NOTE: SCA port numbers are 6 bytes in size; however, maximum *		      MSI and CI PPD port numbers only occupy 1 byte, the *		      low-order byte of a port station address.  Port numbers *		      are passed as 4 bytes entities back and forth between the *		      CI PPD and MSI port driver. * *   Inputs: * *   IPL_SCS			- Interrupt processor level *   cippdbp			- Address of CI PPD header in packet *   pccb			- Port Command and Control Block pointer * *   Outputs: * *   IPL_SCS			- Interrupt processor level * *   Return Values: * *   Sending/Destination port number of MSI packet * *   SMP:	No locks are required.  PCCB addresses are always valid because *		these data structures are never deleted once their *		corresponding ports have been initialized. */u_longmsi_get_port( pccb, cippdbp )    PCCB		*pccb;    CIPPDH		*cippdbp;{    register MSIB	*msibp = Ppd_to_pd( pccb, cippdbp );    return(( u_long )msibp->Rport_addr );}/*   Name:	msi_init_pb	- Initialize a Path Block * *   Abstract:	This function initializes the MSI port specific portion of a *		Path Block and verifies the suitability of the remote port for *		path establishment.  The information for PB initialization is *		obtained from the ID response received from the target remote *		port.  This information also indicates whether the remote port *		is in a state( ENABLED or MAINTENANCE/ENABLED ) suitable for *		path establishment. * *		NOTE: This is an optional PD function( Init_pb ) for use by the *		      CI PPD finite state machine.  The MSI port driver *		      provides it because the driver has MSI port specific *		      information to store and because remote MSI ports may be *		      in states unsuitable for path establishment.  Other port *		      drivers do not have such needs and need not provide this *		      function.  Those port drivers which do provide this *		      function and allow it to return failure status must log *		      the failure reason in a PD specific fashion.  However, *		      only the very first occurrence of failure on each path *		      should be logged.  Subsequent failures should not be *		      logged until after a success status is to be returned for *		      the path. * *   Inputs: * *   IPL_SCS			- Interrupt processor level *   cippdbp			- Address of CI PPD header in ID packet *				   ( if it had such a header ) *   pb				- Path Block pointer *   pccb			- Port Command and Control Block pointer * *   Outputs: * *   IPL_SCS			- Interrupt processor level *   pb				- Path Block pointer *	pinfo.pd.msi		-  MSI specific path information *	    rpi			-   Remote port information( INITIALIZED ) *	pinfo.type.hwtype	-  Hardware type of remote port *   pccb			- Port Command and Control Block pointer *	lpinfo.pd.msi		-  MSI specific local port information *	    rpslogmap		-   Remote port state port logging bitmap * *   Return Values: * *   RET_SUCCESS		- PB successfully initialized *   RET_FAILURE		- Remote port is NOT in an acceptable state * *   SMP:	The PCCB is locked( EXTERNALLY ) as required by *		msi_log_packet() in case logging becomes necessary. * *		The PB is locked( EXTERNALLY ) postponing potential deletion *		and allowing exclusive access to PB contents. */u_longmsi_init_pb( pccb, pb, cippdbp )    PCCB		*pccb;    register PB		*pb;    register CIPPDH	*cippdbp;{    register MSIB	*msibp = Ppd_to_pd( pccb, cippdbp );    register u_long	status = RET_SUCCESS;    pb->pinfo.type.hwtype = ( u_char )msibp->Id.id.port_type[ 0 ];    ( void )bcopy(( u_char * )&msibp->Id.id.portinfo,		  ( u_char * )&pb->pinfo.Rpinfo,		  sizeof( MSIRPI ));    if( pb->pinfo.Rpinfo.sys_state.port_state == PS_ENAB ||	 pb->pinfo.Rpinfo.sys_state.port_state == PS_ENAB_MAINT ) {	Clear_lpinfomap( Rpslogmap, Scaaddr_lob( pb->pinfo.rport_addr ))    } else {	if( !Test_lpinfomap( Rpslogmap, Scaaddr_lob( pb->pinfo.rport_addr ))) {	    Set_lpinfomap( Rpslogmap, Scaaddr_lob( pb->pinfo.rport_addr ))	    ( void )msi_log_packet( pccb,				    pb,				    NULL,				    &msibp->Ph,				    sizeof( MSI_ID ),				    RE_RPORTSTATE,				    RPORT_EVENT );	}	status = RET_FAILURE;    }    return( status );}/*   Name:	msi_send_reqid	- Request Remote Port Identification * *   Abstract:	This function initiates a request for the identification of a *		specific remote port.  It is provided by the port driver for *		use by the CI PPD finite state machine during port polling for *		the maintenance of existing paths and the initiation of new *		ones. * *		Execution of this function may also result in asynchronous *		reception of information corresponding to the report port whose *		identification was requested.  Such reception through *		invocation of cippd_receive() occurs only when a request is *		made for an existing remote port. * *		Initiating a request for remote port identification is *		accomplished by initiating transmission of a MSI port specific *		IDREQ packet to the target remote port.  Either a MSI port *		command packet or a MSI port specific datagram buffer may be *		used to contain the identification request.  Datagram buffers *		are used only when explicitly supplied to the function and are *		disposed of following packet transmission as specified. *		Command packets are allocated by this function when datagram *		buffers are not provided.  They are always deallocated *		following packet transmission. * *		NOTE: This is a mandatory PD function( Send_Reqid ) for use by *		      the CI PPD finite state machine.  Not all port drivers *		      issue port commands in order to obtain remote port *		      identifications like the MSI port driver.  However, all *		      drivers must still supply this function for scheduling *		      purposes.  All port drivers must schedule CI PPD *		      reception of remote port identification information. *		      Those drivers, unlike the MSI port driver, which have NOT *		      permanently disabled sanity checking on their local ports *		      must also schedule CI PPD notification of the completion *		      of their requests for remote port identifications.  Such *		      notifications occur through invocation of *		      cippd_reqid_snt(), but only when the caller requests *		      deallocation of the packet used in satisfying the request *		      ( dispose == DEALLOC_BUF ).  How each driver goes about *		      performing each scheduling is driver specific, but all *		      notifications MUST be done asynchronously.  They may NOT *		      occur through immediate call backs.  All drivers must *		      also dispose of all port specific datagram buffers *		      optionally provided to this function as specified. *		       *		NOTE: SCA port numbers are 6 bytes in size; however, maximum *		      MSI and CI PPD port numbers only occupy 1 byte, the *		      low-order byte of a port station address.  Port numbers *		      are passed as 4 bytes entities back and forth between the

⌨️ 快捷键说明

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