xref: /linux/drivers/net/fddi/skfp/h/smc.h (revision 2e0566ae)
12874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
233f810b2SJeff Kirsher /******************************************************************************
333f810b2SJeff Kirsher  *
433f810b2SJeff Kirsher  *	(C)Copyright 1998,1999 SysKonnect,
533f810b2SJeff Kirsher  *	a business unit of Schneider & Koch & Co. Datensysteme GmbH.
633f810b2SJeff Kirsher  *
733f810b2SJeff Kirsher  *	The information in this file is provided "AS IS" without warranty.
833f810b2SJeff Kirsher  *
933f810b2SJeff Kirsher  ******************************************************************************/
1033f810b2SJeff Kirsher 
1133f810b2SJeff Kirsher #ifndef	_SCMECM_
1233f810b2SJeff Kirsher #define _SCMECM_
1333f810b2SJeff Kirsher 
1433f810b2SJeff Kirsher #if	defined(PCI) && !defined(OSDEF)
1533f810b2SJeff Kirsher /*
1633f810b2SJeff Kirsher  * In the case of the PCI bus the file osdef1st.h must be present
1733f810b2SJeff Kirsher  */
1833f810b2SJeff Kirsher #define	OSDEF
1933f810b2SJeff Kirsher #endif
2033f810b2SJeff Kirsher 
2133f810b2SJeff Kirsher #ifdef	PCI
2233f810b2SJeff Kirsher #ifndef	SUPERNET_3
2333f810b2SJeff Kirsher #define	SUPERNET_3
2433f810b2SJeff Kirsher #endif
2533f810b2SJeff Kirsher #ifndef	TAG_MODE
2633f810b2SJeff Kirsher #define	TAG_MODE
2733f810b2SJeff Kirsher #endif
2833f810b2SJeff Kirsher #endif
2933f810b2SJeff Kirsher 
3033f810b2SJeff Kirsher /*
3133f810b2SJeff Kirsher  * include all other files in required order
3233f810b2SJeff Kirsher  * the following files must have been included before:
3333f810b2SJeff Kirsher  *	types.h
3433f810b2SJeff Kirsher  *	fddi.h
3533f810b2SJeff Kirsher  */
3633f810b2SJeff Kirsher #ifdef	OSDEF
37aab3ac26SJeff Kirsher #include "osdef1st.h"
3833f810b2SJeff Kirsher #endif	/* OSDEF */
3933f810b2SJeff Kirsher #ifdef	OEM_CONCEPT
4033f810b2SJeff Kirsher #include "oemdef.h"
4133f810b2SJeff Kirsher #endif	/* OEM_CONCEPT */
42aab3ac26SJeff Kirsher #include "smt.h"
43aab3ac26SJeff Kirsher #include "cmtdef.h"
44aab3ac26SJeff Kirsher #include "fddimib.h"
45aab3ac26SJeff Kirsher #include "targethw.h"		/* all target hw dependencies */
46aab3ac26SJeff Kirsher #include "targetos.h"		/* all target os dependencies */
4733f810b2SJeff Kirsher #ifdef	ESS
48aab3ac26SJeff Kirsher #include "sba.h"
4933f810b2SJeff Kirsher #endif
5033f810b2SJeff Kirsher 
5133f810b2SJeff Kirsher /*
5233f810b2SJeff Kirsher  * Event Queue
5333f810b2SJeff Kirsher  *	queue.c
5433f810b2SJeff Kirsher  * events are class/value pairs
5533f810b2SJeff Kirsher  *	class	is addressee, e.g. RMT, PCM etc.
5633f810b2SJeff Kirsher  *	value	is command, e.g. line state change, ring op change etc.
5733f810b2SJeff Kirsher  */
5833f810b2SJeff Kirsher struct event_queue {
5933f810b2SJeff Kirsher 	u_short	class ;			/* event class */
6033f810b2SJeff Kirsher 	u_short	event ;			/* event value */
6133f810b2SJeff Kirsher } ;
6233f810b2SJeff Kirsher 
6333f810b2SJeff Kirsher /*
6433f810b2SJeff Kirsher  * define event queue as circular buffer
6533f810b2SJeff Kirsher  */
6633f810b2SJeff Kirsher #ifdef	CONCENTRATOR
6733f810b2SJeff Kirsher #define MAX_EVENT	128
6833f810b2SJeff Kirsher #else	/* nCONCENTRATOR */
6933f810b2SJeff Kirsher #define MAX_EVENT	64
7033f810b2SJeff Kirsher #endif	/* nCONCENTRATOR */
7133f810b2SJeff Kirsher 
7233f810b2SJeff Kirsher struct s_queue {
7333f810b2SJeff Kirsher 
7433f810b2SJeff Kirsher 	struct event_queue ev_queue[MAX_EVENT];
7533f810b2SJeff Kirsher 	struct event_queue *ev_put ;
7633f810b2SJeff Kirsher 	struct event_queue *ev_get ;
7733f810b2SJeff Kirsher } ;
7833f810b2SJeff Kirsher 
7933f810b2SJeff Kirsher /*
8033f810b2SJeff Kirsher  * ECM - Entity Coordination Management
8133f810b2SJeff Kirsher  * ecm.c
8233f810b2SJeff Kirsher  */
8333f810b2SJeff Kirsher struct s_ecm {
8433f810b2SJeff Kirsher 	u_char path_test ;		/* ECM path test variable */
8533f810b2SJeff Kirsher 	u_char sb_flag ;		/* ECM stuck bypass */
8633f810b2SJeff Kirsher 	u_char DisconnectFlag ;		/* jd 05-Aug-1999 Bug #10419
8733f810b2SJeff Kirsher 					 * ECM disconnected */
8833f810b2SJeff Kirsher 	u_char ecm_line_state ;		/* flag to dispatcher : line states */
8933f810b2SJeff Kirsher 	u_long trace_prop ;		/* ECM Trace_Prop flag >= 16 bits !! */
9033f810b2SJeff Kirsher 	/* NUMPHYS note:
9133f810b2SJeff Kirsher 	 * this variable must have enough bits to hold all entiies in
9233f810b2SJeff Kirsher 	 * the station. So NUMPHYS may not be greater than 31.
9333f810b2SJeff Kirsher 	 */
9433f810b2SJeff Kirsher 	char	ec_pad[2] ;
9533f810b2SJeff Kirsher 	struct smt_timer ecm_timer ;	/* timer */
9633f810b2SJeff Kirsher } ;
9733f810b2SJeff Kirsher 
9833f810b2SJeff Kirsher 
9933f810b2SJeff Kirsher /*
10033f810b2SJeff Kirsher  * RMT - Ring Management
10133f810b2SJeff Kirsher  * rmt.c
10233f810b2SJeff Kirsher  */
10333f810b2SJeff Kirsher struct s_rmt {
10433f810b2SJeff Kirsher 	u_char dup_addr_test ;		/* state of dupl. addr. test */
10533f810b2SJeff Kirsher 	u_char da_flag ;		/* flag : duplicate address det. */
10633f810b2SJeff Kirsher 	u_char loop_avail ;		/* flag : MAC available for loopback */
10733f810b2SJeff Kirsher 	u_char sm_ma_avail ;		/* flag : MAC available for SMT */
10833f810b2SJeff Kirsher 	u_char no_flag ;		/* flag : ring not operational */
10933f810b2SJeff Kirsher 	u_char bn_flag ;		/* flag : MAC reached beacon state */
11033f810b2SJeff Kirsher 	u_char jm_flag ;		/* flag : jamming in NON_OP_DUP */
11133f810b2SJeff Kirsher 	u_char rm_join ;		/* CFM flag RM_Join */
11233f810b2SJeff Kirsher 	u_char rm_loop ;		/* CFM flag RM_Loop */
11333f810b2SJeff Kirsher 
11433f810b2SJeff Kirsher 	long fast_rm_join ;		/* bit mask of active ports */
11533f810b2SJeff Kirsher 	/*
11633f810b2SJeff Kirsher 	 * timer and flags
11733f810b2SJeff Kirsher 	 */
11833f810b2SJeff Kirsher 	struct smt_timer rmt_timer0 ;	/* timer 0 */
11933f810b2SJeff Kirsher 	struct smt_timer rmt_timer1 ;	/* timer 1 */
12033f810b2SJeff Kirsher 	struct smt_timer rmt_timer2 ;	/* timer 2 */
12133f810b2SJeff Kirsher 	u_char timer0_exp ;		/* flag : timer 0 expired */
12233f810b2SJeff Kirsher 	u_char timer1_exp ;		/* flag : timer 1 expired */
12333f810b2SJeff Kirsher 	u_char timer2_exp ;		/* flag : timer 2 expired */
12433f810b2SJeff Kirsher 
1252c956a5aSGustavo A. R. Silva 	u_char rm_pad1;
12633f810b2SJeff Kirsher } ;
12733f810b2SJeff Kirsher 
12833f810b2SJeff Kirsher /*
12933f810b2SJeff Kirsher  * CFM - Configuration Management
13033f810b2SJeff Kirsher  * cfm.c
13133f810b2SJeff Kirsher  * used for SAS and DAS
13233f810b2SJeff Kirsher  */
13333f810b2SJeff Kirsher struct s_cfm {
13433f810b2SJeff Kirsher 	u_char cf_state;		/* CFM state machine current state */
13533f810b2SJeff Kirsher 	u_char cf_pad[3] ;
13633f810b2SJeff Kirsher } ;
13733f810b2SJeff Kirsher 
13833f810b2SJeff Kirsher /*
13933f810b2SJeff Kirsher  * CEM - Configuration Element Management
14033f810b2SJeff Kirsher  * cem.c
14133f810b2SJeff Kirsher  * used for Concentrator
14233f810b2SJeff Kirsher  */
14333f810b2SJeff Kirsher #ifdef	CONCENTRATOR
14433f810b2SJeff Kirsher struct s_cem {
14533f810b2SJeff Kirsher 	int	ce_state ;	/* CEM state */
14633f810b2SJeff Kirsher 	int	ce_port ;	/* PA PB PM PM+1 .. */
14733f810b2SJeff Kirsher 	int	ce_type ;	/* TA TB TS TM */
14833f810b2SJeff Kirsher } ;
14933f810b2SJeff Kirsher 
15033f810b2SJeff Kirsher /*
15133f810b2SJeff Kirsher  * linked list of CCEs in current token path
15233f810b2SJeff Kirsher  */
15333f810b2SJeff Kirsher struct s_c_ring {
15433f810b2SJeff Kirsher 	struct s_c_ring	*c_next ;
15533f810b2SJeff Kirsher 	char		c_entity ;
15633f810b2SJeff Kirsher } ;
15733f810b2SJeff Kirsher 
15833f810b2SJeff Kirsher struct mib_path_config {
15933f810b2SJeff Kirsher 	u_long	fddimibPATHConfigSMTIndex;
16033f810b2SJeff Kirsher 	u_long	fddimibPATHConfigPATHIndex;
16133f810b2SJeff Kirsher 	u_long	fddimibPATHConfigTokenOrder;
16233f810b2SJeff Kirsher 	u_long	fddimibPATHConfigResourceType;
16333f810b2SJeff Kirsher #define SNMP_RES_TYPE_MAC	2	/* Resource is a MAC */
16433f810b2SJeff Kirsher #define SNMP_RES_TYPE_PORT	4	/* Resource is a PORT */
16533f810b2SJeff Kirsher 	u_long	fddimibPATHConfigResourceIndex;
16633f810b2SJeff Kirsher 	u_long	fddimibPATHConfigCurrentPath;
16733f810b2SJeff Kirsher #define SNMP_PATH_ISOLATED	1	/* Current path is isolated */
16833f810b2SJeff Kirsher #define SNMP_PATH_LOCAL		2	/* Current path is local */
16933f810b2SJeff Kirsher #define SNMP_PATH_SECONDARY	3	/* Current path is secondary */
17033f810b2SJeff Kirsher #define SNMP_PATH_PRIMARY	4	/* Current path is primary */
17133f810b2SJeff Kirsher #define SNMP_PATH_CONCATENATED	5	/* Current path is concatenated */
17233f810b2SJeff Kirsher #define SNMP_PATH_THRU		6	/* Current path is thru */
17333f810b2SJeff Kirsher };
17433f810b2SJeff Kirsher 
17533f810b2SJeff Kirsher 
17633f810b2SJeff Kirsher #endif
17733f810b2SJeff Kirsher 
17833f810b2SJeff Kirsher /*
17933f810b2SJeff Kirsher  * PCM connect states
18033f810b2SJeff Kirsher  */
18133f810b2SJeff Kirsher #define PCM_DISABLED	0
18233f810b2SJeff Kirsher #define PCM_CONNECTING	1
18333f810b2SJeff Kirsher #define PCM_STANDBY	2
18433f810b2SJeff Kirsher #define PCM_ACTIVE	3
18533f810b2SJeff Kirsher 
18633f810b2SJeff Kirsher struct s_pcm {
18733f810b2SJeff Kirsher 	u_char	pcm_pad[3] ;
18833f810b2SJeff Kirsher } ;
18933f810b2SJeff Kirsher 
19033f810b2SJeff Kirsher /*
19133f810b2SJeff Kirsher  * PHY struct
19233f810b2SJeff Kirsher  * one per physical port
19333f810b2SJeff Kirsher  */
19433f810b2SJeff Kirsher struct s_phy {
19533f810b2SJeff Kirsher 	/* Inter Module Globals */
19633f810b2SJeff Kirsher 	struct fddi_mib_p	*mib ;
19733f810b2SJeff Kirsher 
19833f810b2SJeff Kirsher 	u_char np ;		/* index 0 .. NUMPHYS */
19933f810b2SJeff Kirsher 	u_char cf_join ;
20033f810b2SJeff Kirsher 	u_char cf_loop ;
20133f810b2SJeff Kirsher 	u_char wc_flag ;	/* withhold connection flag */
20233f810b2SJeff Kirsher 	u_char pc_mode ;	/* Holds the negotiated mode of the PCM */
20333f810b2SJeff Kirsher 	u_char pc_lem_fail ;	/* flag : LCT failed */
20433f810b2SJeff Kirsher 	u_char lc_test ;
20533f810b2SJeff Kirsher 	u_char scrub ;		/* CFM flag Scrub -> PCM */
20633f810b2SJeff Kirsher 	char phy_name ;
20733f810b2SJeff Kirsher 	u_char pmd_type[2] ;	/* SK connector/transceiver type codes */
20833f810b2SJeff Kirsher #define PMD_SK_CONN	0	/* pmd_type[PMD_SK_CONN] = Connector */
20933f810b2SJeff Kirsher #define PMD_SK_PMD	1	/* pmd_type[PMD_SK_PMD] = Xver */
21033f810b2SJeff Kirsher 	u_char pmd_scramble ;	/* scrambler on/off */
21133f810b2SJeff Kirsher 
21233f810b2SJeff Kirsher 	/* inner Module Globals */
21333f810b2SJeff Kirsher 	u_char curr_ls ;	/* current line state */
21433f810b2SJeff Kirsher 	u_char ls_flag ;
21533f810b2SJeff Kirsher 	u_char rc_flag ;
21633f810b2SJeff Kirsher 	u_char tc_flag ;
21733f810b2SJeff Kirsher 	u_char td_flag ;
21833f810b2SJeff Kirsher 	u_char bitn ;
21933f810b2SJeff Kirsher 	u_char tr_flag ;	/* trace recvd while in active */
22033f810b2SJeff Kirsher 	u_char twisted ;	/* flag to indicate an A-A or B-B connection */
22133f810b2SJeff Kirsher 	u_char t_val[NUMBITS] ;	/* transmit bits for signaling */
22233f810b2SJeff Kirsher 	u_char r_val[NUMBITS] ;	/* receive bits for signaling */
22333f810b2SJeff Kirsher 	u_long t_next[NUMBITS] ;
22433f810b2SJeff Kirsher 	struct smt_timer pcm_timer0 ;
22533f810b2SJeff Kirsher 	struct smt_timer pcm_timer1 ;
22633f810b2SJeff Kirsher 	struct smt_timer pcm_timer2 ;
22733f810b2SJeff Kirsher 	u_char timer0_exp ;
22833f810b2SJeff Kirsher 	u_char timer1_exp ;
22933f810b2SJeff Kirsher 	u_char timer2_exp ;
23033f810b2SJeff Kirsher 	u_char pcm_pad1[1] ;
23123c9c2b3Sqhjindev 	int	cem_pst ;	/* CEM private state; used for dual homing */
23233f810b2SJeff Kirsher 	struct lem_counter lem ;
23333f810b2SJeff Kirsher #ifdef	AMDPLC
23433f810b2SJeff Kirsher 	struct s_plc	plc ;
23533f810b2SJeff Kirsher #endif
23633f810b2SJeff Kirsher } ;
23733f810b2SJeff Kirsher 
23833f810b2SJeff Kirsher /*
23933f810b2SJeff Kirsher  * timer package
24033f810b2SJeff Kirsher  * smttimer.c
24133f810b2SJeff Kirsher  */
24233f810b2SJeff Kirsher struct s_timer {
24333f810b2SJeff Kirsher 	struct smt_timer	*st_queue ;
24433f810b2SJeff Kirsher 	struct smt_timer	st_fast ;
24533f810b2SJeff Kirsher } ;
24633f810b2SJeff Kirsher 
24733f810b2SJeff Kirsher /*
24833f810b2SJeff Kirsher  * SRF types and data
24933f810b2SJeff Kirsher  */
25033f810b2SJeff Kirsher #define SMT_EVENT_BASE			1
25133f810b2SJeff Kirsher #define SMT_EVENT_MAC_PATH_CHANGE	(SMT_EVENT_BASE+0)
25233f810b2SJeff Kirsher #define SMT_EVENT_MAC_NEIGHBOR_CHANGE	(SMT_EVENT_BASE+1)
25333f810b2SJeff Kirsher #define SMT_EVENT_PORT_PATH_CHANGE	(SMT_EVENT_BASE+2)
25433f810b2SJeff Kirsher #define SMT_EVENT_PORT_CONNECTION	(SMT_EVENT_BASE+3)
25533f810b2SJeff Kirsher 
25633f810b2SJeff Kirsher #define SMT_IS_CONDITION(x)			((x)>=SMT_COND_BASE)
25733f810b2SJeff Kirsher 
25833f810b2SJeff Kirsher #define SMT_COND_BASE		(SMT_EVENT_PORT_CONNECTION+1)
25933f810b2SJeff Kirsher #define SMT_COND_SMT_PEER_WRAP		(SMT_COND_BASE+0)
26033f810b2SJeff Kirsher #define SMT_COND_SMT_HOLD		(SMT_COND_BASE+1)
26133f810b2SJeff Kirsher #define SMT_COND_MAC_FRAME_ERROR	(SMT_COND_BASE+2)
26233f810b2SJeff Kirsher #define SMT_COND_MAC_DUP_ADDR		(SMT_COND_BASE+3)
26333f810b2SJeff Kirsher #define SMT_COND_MAC_NOT_COPIED		(SMT_COND_BASE+4)
26433f810b2SJeff Kirsher #define SMT_COND_PORT_EB_ERROR		(SMT_COND_BASE+5)
26533f810b2SJeff Kirsher #define SMT_COND_PORT_LER		(SMT_COND_BASE+6)
26633f810b2SJeff Kirsher 
26733f810b2SJeff Kirsher #define SR0_WAIT	0
26833f810b2SJeff Kirsher #define SR1_HOLDOFF	1
26933f810b2SJeff Kirsher #define SR2_DISABLED	2
27033f810b2SJeff Kirsher 
27133f810b2SJeff Kirsher struct s_srf {
27233f810b2SJeff Kirsher 	u_long	SRThreshold ;			/* threshold value */
27333f810b2SJeff Kirsher 	u_char	RT_Flag ;			/* report transmitted flag */
27433f810b2SJeff Kirsher 	u_char	sr_state ;			/* state-machine */
27533f810b2SJeff Kirsher 	u_char	any_report ;			/* any report required */
27633f810b2SJeff Kirsher 	u_long	TSR ;				/* timer */
27733f810b2SJeff Kirsher 	u_short	ring_status ;			/* IBM ring status */
27833f810b2SJeff Kirsher } ;
27933f810b2SJeff Kirsher 
28033f810b2SJeff Kirsher /*
28133f810b2SJeff Kirsher  * IBM token ring status
28233f810b2SJeff Kirsher  */
28333f810b2SJeff Kirsher #define RS_RES15	(1<<15)			/* reserved */
28433f810b2SJeff Kirsher #define RS_HARDERROR	(1<<14)			/* ring down */
28533f810b2SJeff Kirsher #define RS_SOFTERROR	(1<<13)			/* sent SRF */
28633f810b2SJeff Kirsher #define RS_BEACON	(1<<12)			/* transmitted beacon */
28733f810b2SJeff Kirsher #define RS_PATHTEST	(1<<11)			/* path test failed */
28833f810b2SJeff Kirsher #define RS_SELFTEST	(1<<10)			/* selftest required */
28933f810b2SJeff Kirsher #define RS_RES9		(1<< 9)			/* reserved */
29033f810b2SJeff Kirsher #define RS_DISCONNECT	(1<< 8)			/* remote disconnect */
29133f810b2SJeff Kirsher #define RS_RES7		(1<< 7)			/* reserved */
29233f810b2SJeff Kirsher #define RS_DUPADDR	(1<< 6)			/* duplicate address */
29333f810b2SJeff Kirsher #define RS_NORINGOP	(1<< 5)			/* no ring op */
29433f810b2SJeff Kirsher #define RS_VERSION	(1<< 4)			/* SMT version mismatch */
29533f810b2SJeff Kirsher #define RS_STUCKBYPASSS	(1<< 3)			/* stuck bypass */
29633f810b2SJeff Kirsher #define RS_EVENT	(1<< 2)			/* FDDI event occurred */
29733f810b2SJeff Kirsher #define RS_RINGOPCHANGE	(1<< 1)			/* ring op changed */
29833f810b2SJeff Kirsher #define RS_RES0		(1<< 0)			/* reserved */
29933f810b2SJeff Kirsher 
30033f810b2SJeff Kirsher #define RS_SET(smc,bit) \
30133f810b2SJeff Kirsher 	ring_status_indication(smc,smc->srf.ring_status |= bit)
30233f810b2SJeff Kirsher #define RS_CLEAR(smc,bit)	\
30333f810b2SJeff Kirsher 	ring_status_indication(smc,smc->srf.ring_status &= ~bit)
30433f810b2SJeff Kirsher 
30533f810b2SJeff Kirsher #define RS_CLEAR_EVENT	(0xffff & ~(RS_NORINGOP))
30633f810b2SJeff Kirsher 
30733f810b2SJeff Kirsher /* Define the AIX-event-Notification as null function if it isn't defined */
30833f810b2SJeff Kirsher /* in the targetos.h file */
30933f810b2SJeff Kirsher #ifndef AIX_EVENT
31033f810b2SJeff Kirsher #define AIX_EVENT(smc,opt0,opt1,opt2,opt3)	/* nothing */
31133f810b2SJeff Kirsher #endif
31233f810b2SJeff Kirsher 
31333f810b2SJeff Kirsher struct s_srf_evc {
31433f810b2SJeff Kirsher 	u_char	evc_code ;			/* event code type */
31533f810b2SJeff Kirsher 	u_char	evc_index ;			/* index for mult. instances */
31633f810b2SJeff Kirsher 	u_char	evc_rep_required ;		/* report required */
31733f810b2SJeff Kirsher 	u_short	evc_para ;			/* SMT Para Number */
31833f810b2SJeff Kirsher 	u_char	*evc_cond_state ;		/* condition state */
31933f810b2SJeff Kirsher 	u_char	*evc_multiple ;			/* multiple occurrence */
32033f810b2SJeff Kirsher } ;
32133f810b2SJeff Kirsher 
32233f810b2SJeff Kirsher /*
32333f810b2SJeff Kirsher  * Values used by frame based services
32433f810b2SJeff Kirsher  * smt.c
32533f810b2SJeff Kirsher  */
32633f810b2SJeff Kirsher #define SMT_MAX_TEST		5
32733f810b2SJeff Kirsher #define SMT_TID_NIF		0		/* pending NIF request */
32833f810b2SJeff Kirsher #define SMT_TID_NIF_TEST	1		/* pending NIF test */
32933f810b2SJeff Kirsher #define SMT_TID_ECF_UNA		2		/* pending ECF UNA test */
33033f810b2SJeff Kirsher #define SMT_TID_ECF_DNA		3		/* pending ECF DNA test */
33133f810b2SJeff Kirsher #define SMT_TID_ECF		4		/* pending ECF test */
33233f810b2SJeff Kirsher 
33333f810b2SJeff Kirsher struct smt_values {
33433f810b2SJeff Kirsher 	u_long		smt_tvu ;		/* timer valid una */
33533f810b2SJeff Kirsher 	u_long		smt_tvd ;		/* timer valid dna */
33633f810b2SJeff Kirsher 	u_long		smt_tid ;		/* transaction id */
33733f810b2SJeff Kirsher 	u_long		pend[SMT_MAX_TEST] ;	/* TID of requests */
33833f810b2SJeff Kirsher 	u_long		uniq_time ;		/* unique time stamp */
33933f810b2SJeff Kirsher 	u_short		uniq_ticks  ;		/* unique time stamp */
34033f810b2SJeff Kirsher 	u_short		please_reconnect ;	/* flag : reconnect */
34133f810b2SJeff Kirsher 	u_long		smt_last_lem ;
34233f810b2SJeff Kirsher 	u_long		smt_last_notify ;
34333f810b2SJeff Kirsher 	struct smt_timer	smt_timer ;	/* SMT NIF timer */
34433f810b2SJeff Kirsher 	u_long		last_tok_time[NUMMACS];	/* token cnt emulation */
34533f810b2SJeff Kirsher } ;
34633f810b2SJeff Kirsher 
34733f810b2SJeff Kirsher /*
34833f810b2SJeff Kirsher  * SMT/CMT configurable parameters
34933f810b2SJeff Kirsher  */
35033f810b2SJeff Kirsher #define SMT_DAS	0			/* dual attach */
35133f810b2SJeff Kirsher #define SMT_SAS	1			/* single attach */
35233f810b2SJeff Kirsher #define SMT_NAC	2			/* null attach concentrator */
35333f810b2SJeff Kirsher 
35433f810b2SJeff Kirsher struct smt_config {
35533f810b2SJeff Kirsher 	u_char	attach_s ;		/* CFM attach to secondary path */
35633f810b2SJeff Kirsher 	u_char	sas ;			/* SMT_DAS/SAS/NAC */
35733f810b2SJeff Kirsher 	u_char	build_ring_map ;	/* build ringmap if TRUE */
35833f810b2SJeff Kirsher 	u_char	numphys ;		/* number of active phys */
35933f810b2SJeff Kirsher 	u_char	sc_pad[1] ;
36033f810b2SJeff Kirsher 
36133f810b2SJeff Kirsher 	u_long	pcm_tb_min ;		/* PCM : TB_Min timer value */
36233f810b2SJeff Kirsher 	u_long	pcm_tb_max ;		/* PCM : TB_Max timer value */
36333f810b2SJeff Kirsher 	u_long	pcm_c_min ;		/* PCM : C_Min timer value */
36433f810b2SJeff Kirsher 	u_long	pcm_t_out ;		/* PCM : T_Out timer value */
36533f810b2SJeff Kirsher 	u_long	pcm_tl_min ;		/* PCM : TL_min timer value */
36633f810b2SJeff Kirsher 	u_long	pcm_lc_short ;		/* PCM : LC_Short timer value */
36733f810b2SJeff Kirsher 	u_long	pcm_lc_medium ;		/* PCM : LC_Medium timer value */
36833f810b2SJeff Kirsher 	u_long	pcm_lc_long ;		/* PCM : LC_Long timer value */
36933f810b2SJeff Kirsher 	u_long	pcm_lc_extended ;	/* PCM : LC_Extended timer value */
37033f810b2SJeff Kirsher 	u_long	pcm_t_next_9 ;		/* PCM : T_Next[9] timer value */
37133f810b2SJeff Kirsher 	u_long	pcm_ns_max ;		/* PCM : NS_Max timer value */
37233f810b2SJeff Kirsher 
37333f810b2SJeff Kirsher 	u_long	ecm_i_max ;		/* ECM : I_Max timer value */
37433f810b2SJeff Kirsher 	u_long	ecm_in_max ;		/* ECM : IN_Max timer value */
37533f810b2SJeff Kirsher 	u_long	ecm_td_min ;		/* ECM : TD_Min timer */
37633f810b2SJeff Kirsher 	u_long	ecm_test_done ;		/* ECM : path test done timer */
37733f810b2SJeff Kirsher 	u_long	ecm_check_poll ;	/* ECM : check bypass poller */
37833f810b2SJeff Kirsher 
37933f810b2SJeff Kirsher 	u_long	rmt_t_non_op ;		/* RMT : T_Non_OP timer value */
38033f810b2SJeff Kirsher 	u_long	rmt_t_stuck ;		/* RMT : T_Stuck timer value */
38133f810b2SJeff Kirsher 	u_long	rmt_t_direct ;		/* RMT : T_Direct timer value */
38233f810b2SJeff Kirsher 	u_long	rmt_t_jam ;		/* RMT : T_Jam timer value */
38333f810b2SJeff Kirsher 	u_long	rmt_t_announce ;	/* RMT : T_Announce timer value */
38433f810b2SJeff Kirsher 	u_long	rmt_t_poll ;		/* RMT : claim/beacon poller */
38533f810b2SJeff Kirsher 	u_long  rmt_dup_mac_behavior ;  /* Flag for the beavior of SMT if
38633f810b2SJeff Kirsher 					 * a Duplicate MAC Address was detected.
38733f810b2SJeff Kirsher 					 * FALSE: SMT will leave finally the ring
38833f810b2SJeff Kirsher 					 * TRUE:  SMT will reinstert into the ring
38933f810b2SJeff Kirsher 					 */
39033f810b2SJeff Kirsher 	u_long	mac_d_max ;		/* MAC : D_Max timer value */
39133f810b2SJeff Kirsher 
39233f810b2SJeff Kirsher 	u_long lct_short ;		/* LCT : error threshold */
39333f810b2SJeff Kirsher 	u_long lct_medium ;		/* LCT : error threshold */
39433f810b2SJeff Kirsher 	u_long lct_long ;		/* LCT : error threshold */
39533f810b2SJeff Kirsher 	u_long lct_extended ;		/* LCT : error threshold */
39633f810b2SJeff Kirsher } ;
39733f810b2SJeff Kirsher 
39833f810b2SJeff Kirsher #ifdef	DEBUG
39933f810b2SJeff Kirsher /*
40033f810b2SJeff Kirsher  * Debugging struct sometimes used in smc
40133f810b2SJeff Kirsher  */
40233f810b2SJeff Kirsher struct	smt_debug {
40333f810b2SJeff Kirsher 	int	d_smtf ;
40433f810b2SJeff Kirsher 	int	d_smt ;
40533f810b2SJeff Kirsher 	int	d_ecm ;
40633f810b2SJeff Kirsher 	int	d_rmt ;
40733f810b2SJeff Kirsher 	int	d_cfm ;
40833f810b2SJeff Kirsher 	int	d_pcm ;
40933f810b2SJeff Kirsher 	int	d_plc ;
41033f810b2SJeff Kirsher #ifdef	ESS
41133f810b2SJeff Kirsher 	int	d_ess ;
41233f810b2SJeff Kirsher #endif
41333f810b2SJeff Kirsher #ifdef	SBA
41433f810b2SJeff Kirsher 	int	d_sba ;
41533f810b2SJeff Kirsher #endif
41633f810b2SJeff Kirsher 	struct	os_debug	d_os;	/* Include specific OS DEBUG struct */
41733f810b2SJeff Kirsher } ;
41833f810b2SJeff Kirsher 
41933f810b2SJeff Kirsher #ifndef	DEBUG_BRD
42033f810b2SJeff Kirsher /* all boards shall be debugged with one debug struct */
42133f810b2SJeff Kirsher extern	struct	smt_debug	debug;	/* Declaration of debug struct */
42233f810b2SJeff Kirsher #endif	/* DEBUG_BRD */
42333f810b2SJeff Kirsher 
42433f810b2SJeff Kirsher #endif	/* DEBUG */
42533f810b2SJeff Kirsher 
42633f810b2SJeff Kirsher /*
42733f810b2SJeff Kirsher  * the SMT Context Struct SMC
42833f810b2SJeff Kirsher  * this struct contains ALL global variables of SMT
42933f810b2SJeff Kirsher  */
43033f810b2SJeff Kirsher struct s_smc {
43133f810b2SJeff Kirsher 	struct s_smt_os	os ;		/* os specific */
43233f810b2SJeff Kirsher 	struct s_smt_hw	hw ;		/* hardware */
43333f810b2SJeff Kirsher 
43433f810b2SJeff Kirsher /*
43533f810b2SJeff Kirsher  * NOTE: os and hw MUST BE the first two structs
43633f810b2SJeff Kirsher  * anything beyond hw WILL BE SET TO ZERO in smt_set_defaults()
43733f810b2SJeff Kirsher  */
43833f810b2SJeff Kirsher 	struct smt_config s ;		/* smt constants */
43933f810b2SJeff Kirsher 	struct smt_values sm ;		/* smt variables */
44033f810b2SJeff Kirsher 	struct s_ecm	e ;		/* ecm */
44133f810b2SJeff Kirsher 	struct s_rmt	r ;		/* rmt */
44233f810b2SJeff Kirsher 	struct s_cfm	cf ;		/* cfm/cem */
44333f810b2SJeff Kirsher #ifdef	CONCENTRATOR
44433f810b2SJeff Kirsher 	struct s_cem	ce[NUMPHYS] ;	/* cem */
44533f810b2SJeff Kirsher 	struct s_c_ring	cr[NUMPHYS+NUMMACS] ;
44633f810b2SJeff Kirsher #endif
44733f810b2SJeff Kirsher 	struct s_pcm	p ;		/* pcm */
44833f810b2SJeff Kirsher 	struct s_phy	y[NUMPHYS] ;	/* phy */
44933f810b2SJeff Kirsher 	struct s_queue	q ;		/* queue */
45033f810b2SJeff Kirsher 	struct s_timer	t ;		/* timer */
45133f810b2SJeff Kirsher 	struct s_srf srf ;		/* SRF */
45233f810b2SJeff Kirsher 	struct s_srf_evc evcs[6+NUMPHYS*4] ;
45333f810b2SJeff Kirsher 	struct fddi_mib	mib ;		/* __THE_MIB__ */
45433f810b2SJeff Kirsher #ifdef	SBA
45533f810b2SJeff Kirsher 	struct s_sba	sba ;		/* SBA variables */
45633f810b2SJeff Kirsher #endif
45733f810b2SJeff Kirsher #ifdef	ESS
45833f810b2SJeff Kirsher 	struct s_ess	ess ;		/* Ess variables */
45933f810b2SJeff Kirsher #endif
46033f810b2SJeff Kirsher #if	defined(DEBUG) && defined(DEBUG_BRD)
46133f810b2SJeff Kirsher 	/* If you want all single board to be debugged separately */
46233f810b2SJeff Kirsher 	struct smt_debug	debug;	/* Declaration of debug struct */
46333f810b2SJeff Kirsher #endif	/* DEBUG_BRD && DEBUG */
46433f810b2SJeff Kirsher } ;
46533f810b2SJeff Kirsher 
46633f810b2SJeff Kirsher extern const struct fddi_addr fddi_broadcast;
46733f810b2SJeff Kirsher 
468d140ad96SJoe Perches void all_selection_criteria(struct s_smc *smc);
469d140ad96SJoe Perches void card_stop(struct s_smc *smc);
470d140ad96SJoe Perches void init_board(struct s_smc *smc, u_char *mac_addr);
471d140ad96SJoe Perches int init_fplus(struct s_smc *smc);
472d140ad96SJoe Perches void init_plc(struct s_smc *smc);
473*2e0566aeSJakub Kicinski int init_smt(struct s_smc *smc, const u_char *mac_addr);
474d140ad96SJoe Perches void mac1_irq(struct s_smc *smc, u_short stu, u_short stl);
475d140ad96SJoe Perches void mac2_irq(struct s_smc *smc, u_short code_s2u, u_short code_s2l);
476d140ad96SJoe Perches void mac3_irq(struct s_smc *smc, u_short code_s3u, u_short code_s3l);
477d140ad96SJoe Perches int pcm_status_twisted(struct s_smc *smc);
478d140ad96SJoe Perches void plc1_irq(struct s_smc *smc);
479d140ad96SJoe Perches void plc2_irq(struct s_smc *smc);
480d140ad96SJoe Perches void read_address(struct s_smc *smc, u_char *mac_addr);
481d140ad96SJoe Perches void timer_irq(struct s_smc *smc);
48233f810b2SJeff Kirsher 
48333f810b2SJeff Kirsher #endif	/* _SCMECM_ */
48433f810b2SJeff Kirsher 
485