📄 ci_subr.c
字号:
#ifndef lintstatic char *sccsid = "@(#)ci_subr.c 4.5 (ULTRIX) 3/7/91";#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 Driver * * Abstract: This module contains Computer Interconnect Port Driver( CI ) * functions provided for use by the CI PPD finite state machine * in the establishment, maintenance, and termination of paths. * Other CI functions( ci_init_port() and ci_log_badport() ) * required by the CI PPD are located in other modules. * * This module also contains miscellaneous CI functions. * * Creator: Todd M. Katz Creation Date: November 6, 1985 * * Functions/Routines: * * Functions and Routines Required by the CI PPD Finite State Machine * ci_alloc_buf Allocate Emergency CI Command Packets * ci_dealloc_buf Deallocate Emergency CI Command Packets * ci_get_port Retrieve Port Number from Buffer * ci_init_pb Initialize a Path Block * ci_inv_cache Invalidate CI Port's Translation Cache * ci_send_reqid Request Remote Port Identification * ci_set_circuit Set Virtual Circuit State to On/Off * ci_notify_port Notify CI Port of Continued CI PPD Activity * ci_test_lpconn Test Local CI Port Connectivity * ci_update_ptype Update Hardware Port Type of Remote Port * CI Port Driver Miscellaneous Functions * ci_alloc_pkt Allocate CI Port Command Packet * ci_dealloc_pkt Deallocate CI Port Command Packet * ci_update_cable Update Cable Status of Path Block * * Modification History: * * 07-Mar-1991 Pete Keilty * Moved REQID back to the communication queue priority 2 * because under heavy I/O loads reqid's would not be serviced * in time on the maintence queue priority 0 causing cippd * sanity timeouts and port crashes. * * 19-Dec-1990 Pete Keilty * Modified ci_set_circuit for CIXCD support of NADP bit. * * 16-Oct-1990 Pete Keilty * 1. Changed smp locking to used new macros Lock_cidevice and * Unlock_cidevice define in ciscs.h. * 2. Added DELAY( 1000 ) around register write again because of * the CIXCD XMOV bug, this was needed on 9000/6000 syatems. * * 16-Jul-1990 Pete Keilty * Add smp_lock lk_cidevice in the ci_notify_port routine for CIXCD, * software workaround for XMOV hardware bug of back to back register * accesses the first one a read the second a write to a software * register. * * 06-Jun-1990 Pete Keilty * 1. Added preliminary support for CIKMF( dash ). * 2. Added packet multiple size detection from ID packet * will be used with 4K pkt eco. * 3. REQID & SNDLB now go on the maintence queue0. * 4. Modified ci_set_circuit for CIXCD. * * 08-Dec-1989 Pete Keilty * 1. Use new macro Get_pgrp() to get port node number for now * untill full subenode addressing is added. * 2. Switch off of hardware type in ci_set_circuit() routine. * * 19-Sep-1989 Pete Keilty * 1. Add pccb to Format_gvph, Pd_to_ppd, & Ppd_to_pd. * 2. Change ci_get_port & ci_set_circuit check for explicit * address format and used it. * * 23-Aug-1989 Pete Keilty * Change ci_update_ptype checks to use bcmp to prevent mips cpu * alignment errors. * * 25-May-1989 Pete Keilty * Add Dm_msg_dg double mapping macro for mips cpu ISIS. * Add new include file scamachmac.h * * 17-Jan-1989 Todd M. Katz TMK0004 * 1. Modify the interface to ci_get_port to include the PCCB address. * 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. Some hardware platforms require field alignments and access types * to match( ie- only longword aligned entities may be longword * accessed ). All fields which need to be and are feasible to be * longword aligned have been so aligned. One field which can not be * aligned as such is the crc field within the SNDLB packet. It can * not be longword aligned because its position is mandated by the CI * protocol. Therefore, instead of attempting to align this field, * change how it is accessed. It is now accessed "generically" instead * of as a longword. * 4. Include header file ../vaxmsi/msisysap.h. * * 19-Aug-1988 Todd M. Katz TMK0003 * 1. Cast all control blocks to ( char * ) before deallocating. * 2. Delete ci_map_reason(). Port driver specific path crash reason * codes no longer exist and all reason code mapping takes place * entirely within the CI PPD. * 3. Rename the Informational Event( ES_I ) mnemonic from IE -> I. * 4. The following Informational Events( ES_I ) have been defined as * Warning Events( ES_WE ): CABLE0_GB, CABLE1_GB, CABLES_UC, * CABLE0_LBGB, CABLE1_LBGB. * 5. The following Informational Events( ES_I ) have been defined as * Remote Error Events( ES_RE ): RPORT_STATE. * 6. Refer to error logging as event logging. * 7. Modify ci_test_lpconn() to reset the following CI PPD specific PCCB * fields using CI configuration variables ci_cippdburst and * ci_cippdcontact immediately prior to testing local port * connectivity: burst( port polling burst size ), contact( port * polling contact frequency ). * * 03-Jun-1988 Todd M. Katz TMK0002 * 1. Create a single unified hierarchical set of naming conventions for * use within the CI port driver and describe them within ciport.h. * Apply these conventions to all names( routine, macro, constant, and * data structure ) used within the driver. * 2. The following macros have been renamed: * 1) Test_mapbit() -> Test_lpinfomap() * 2) Set_mapbit() -> Set__lpinfomap() * 3) Clear_mapbit() -> Clear_lpinfomap() * * 02-Jun-1988 Ricky S. Palmer * Removed inclusion of header file ../vaxmsi/msisysap.h * * 08-Jan-1988 Todd M. Katz TMK0001 * Formated module, revised comments, increased generality and * 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/dyntypes.h"#include "../h/param.h"#include "../h/time.h"#include "../h/ksched.h"#include "../h/kmalloc.h"#include "../h/vmmac.h"#include "../h/errlog.h"#include "../h/smp_lock.h"#include "../machine/pte.h"#include "../machine/cpu.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/ci/cippd.h"#include "../io/ci/ciport.h"/* External Variables and Routines. */extern struct pte Sysmap[];extern PB *cippd_get_pb();extern SCSH *gvp_alloc_dg();extern GVPH *ci_alloc_pkt();extern u_long ci_cippdburst, ci_cippdcontact, gvp_queue_retry;extern void ci_dealloc_pkt(), ci_log_packet(), ci_update_cable();extern u_short ci_maint_timer;/* Name: ci_alloc_buf - Allocate Emergency CI Command Packets * * Abstract: This function preallocates the following emergency CI command * packets required for CI PPD directed termination of the * specified path when fully established: * * 1. Emergency set circuit off command packet. * 2. Emergency invalidate translation cache command packet. * * These command packets are preallocated so as to always be * available for termination of the path. They are not used if * the path is aborted during its establishment. * * NOTE: This is an optional PD function( Alloc_buf ) for use by * the CI PPD finite state machine. The CI port driver * provides it because the driver requires emergency command * packets during path termination. Other port drivers do * not have such needs and need not provide this function. * * Inputs: * * IPL_SCS - Interrupt processor level * pb - Path Block pointer * pccb - Port Command and Control Block pointer * * Outputs: * * IPL_SCS - Interrupt processor level * pb - Path Block pointer * pd.gvp.ci - CI specific PB fields * invtcpkt - Invalidate translation cache command packet * scpkt - Set circuit off command packet * * Return Values: * * RET_SUCCESS - Allocated emergency CI command packets * RET_FAILURE - Unable to allocate emergency command packets * * SMP: The PB is locked( EXTERNALLY ) postponing potential deletion * and allowing exclusive access to PB contents. * * PCCB addresses are always valid allowing access to static * fields because these data structures are never deleted once * their corresponding ports have been initialized( The PCCB is * locked EXTERNALLY anyway ). */u_longci_alloc_buf( pccb, pb ) PCCB *pccb; PB *pb;{ register GVPH *cibp; if(( pb->Invtcpkt = ci_alloc_pkt( pccb ))) { if(( pb->Scpkt = ci_alloc_pkt( pccb ))) { return( RET_SUCCESS ); } else { ( void )ci_dealloc_pkt( pb->Invtcpkt ); pb->Invtcpkt = NULL; } } return( RET_FAILURE );}/* Name: ci_dealloc_buf - Deallocate Emergency CI Command Packets * * Abstract: This routine deallocates the following preallocated emergency * CI command packets required for CI PPD directed termination of * the specified path when fully established: * * 1. Emergency set circuit off command packet. * 2. Emergency invalidate translation cache command packet. * * This routine is never invoked once the specified path has been * fully established. It is only invoked during the abortion of * path establishment. * * NOTE: This is an optional PD routine( Dealloc_buf ) for use by * the CI PPD finite state machine. The CI port driver * provides it because the driver requires emergency command * packets during path termination. Other port drivers do * not have such needs and need not provide this routine. * * Inputs: * * IPL_SCS - Interrupt processor level * pb - Path Block pointer * * Outputs: * * IPL_SCS - Interrupt processor level * pb - Path Block pointer * pd.gvp.ci - CI specific PB fields * invtcpkt - NULL * scpkt - NULL * * SMP: The PB is locked( EXTERNALLY ) postponing premature deletion * and allowing exclusive access to PB contents. */voidci_dealloc_buf( pb ) register PB *pb;{ register GVPH *cibp; if(( cibp = pb->Invtcpkt )) { ( void )ci_dealloc_pkt( cibp ); pb->Invtcpkt = NULL; } if(( cibp = pb->Scpkt )) { ( void )ci_dealloc_pkt( cibp ); pb->Scpkt = NULL; }}/* Name: ci_get_port - Retrieve Port Number from Buffer * * Abstract: This function retrieves the sending/destination port address * from a CI 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 CI * 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 * CI 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 CI packet *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -