1 /******************************************************************************
3 * (C)Copyright 1998,1999 SysKonnect,
4 * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * The information in this file is provided "AS IS" without warranty.
13 ******************************************************************************/
18 #if defined(PCI) && !defined(OSDEF)
20 * In the case of the PCI bus the file osdef1st.h must be present
35 * include all other files in required order
36 * the following files must have been included before:
45 #endif /* OEM_CONCEPT */
49 #include "targethw.h" /* all target hw dependencies */
50 #include "targetos.h" /* all target os dependencies */
58 * events are class/value pairs
59 * class is addressee, e.g. RMT, PCM etc.
60 * value is command, e.g. line state change, ring op change etc.
63 u_short
class ; /* event class */
64 u_short event
; /* event value */
68 * define event queue as circular buffer
72 #else /* nCONCENTRATOR */
74 #endif /* nCONCENTRATOR */
78 struct event_queue ev_queue
[MAX_EVENT
];
79 struct event_queue
*ev_put
;
80 struct event_queue
*ev_get
;
84 * ECM - Entity Coordination Management
88 u_char path_test
; /* ECM path test variable */
89 u_char sb_flag
; /* ECM stuck bypass */
90 u_char DisconnectFlag
; /* jd 05-Aug-1999 Bug #10419
92 u_char ecm_line_state
; /* flag to dispatcher : line states */
93 u_long trace_prop
; /* ECM Trace_Prop flag >= 16 bits !! */
95 * this variable must have enough bits to hold all entiies in
96 * the station. So NUMPHYS may not be greater than 31.
99 struct smt_timer ecm_timer
; /* timer */
104 * RMT - Ring Management
108 u_char dup_addr_test
; /* state of dupl. addr. test */
109 u_char da_flag
; /* flag : duplicate address det. */
110 u_char loop_avail
; /* flag : MAC available for loopback */
111 u_char sm_ma_avail
; /* flag : MAC available for SMT */
112 u_char no_flag
; /* flag : ring not operational */
113 u_char bn_flag
; /* flag : MAC reached beacon state */
114 u_char jm_flag
; /* flag : jamming in NON_OP_DUP */
115 u_char rm_join
; /* CFM flag RM_Join */
116 u_char rm_loop
; /* CFM flag RM_Loop */
118 long fast_rm_join
; /* bit mask of active ports */
122 struct smt_timer rmt_timer0
; /* timer 0 */
123 struct smt_timer rmt_timer1
; /* timer 1 */
124 struct smt_timer rmt_timer2
; /* timer 2 */
125 u_char timer0_exp
; /* flag : timer 0 expired */
126 u_char timer1_exp
; /* flag : timer 1 expired */
127 u_char timer2_exp
; /* flag : timer 2 expired */
133 * CFM - Configuration Management
135 * used for SAS and DAS
138 u_char cf_state
; /* CFM state machine current state */
143 * CEM - Configuration Element Management
145 * used for Concentrator
149 int ce_state
; /* CEM state */
150 int ce_port
; /* PA PB PM PM+1 .. */
151 int ce_type
; /* TA TB TS TM */
155 * linked list of CCEs in current token path
158 struct s_c_ring
*c_next
;
162 struct mib_path_config
{
163 u_long fddimibPATHConfigSMTIndex
;
164 u_long fddimibPATHConfigPATHIndex
;
165 u_long fddimibPATHConfigTokenOrder
;
166 u_long fddimibPATHConfigResourceType
;
167 #define SNMP_RES_TYPE_MAC 2 /* Resource is a MAC */
168 #define SNMP_RES_TYPE_PORT 4 /* Resource is a PORT */
169 u_long fddimibPATHConfigResourceIndex
;
170 u_long fddimibPATHConfigCurrentPath
;
171 #define SNMP_PATH_ISOLATED 1 /* Current path is isolated */
172 #define SNMP_PATH_LOCAL 2 /* Current path is local */
173 #define SNMP_PATH_SECONDARY 3 /* Current path is secondary */
174 #define SNMP_PATH_PRIMARY 4 /* Current path is primary */
175 #define SNMP_PATH_CONCATENATED 5 /* Current path is concatenated */
176 #define SNMP_PATH_THRU 6 /* Current path is thru */
185 #define PCM_DISABLED 0
186 #define PCM_CONNECTING 1
187 #define PCM_STANDBY 2
196 * one per physical port
199 /* Inter Module Globals */
200 struct fddi_mib_p
*mib
;
202 u_char np
; /* index 0 .. NUMPHYS */
205 u_char wc_flag
; /* withhold connection flag */
206 u_char pc_mode
; /* Holds the negotiated mode of the PCM */
207 u_char pc_lem_fail
; /* flag : LCT failed */
209 u_char scrub
; /* CFM flag Scrub -> PCM */
211 u_char pmd_type
[2] ; /* SK connector/transceiver type codes */
212 #define PMD_SK_CONN 0 /* pmd_type[PMD_SK_CONN] = Connector */
213 #define PMD_SK_PMD 1 /* pmd_type[PMD_SK_PMD] = Xver */
214 u_char pmd_scramble
; /* scrambler on/off */
216 /* inner Module Globals */
217 u_char curr_ls
; /* current line state */
223 u_char tr_flag
; /* trace recvd while in active */
224 u_char twisted
; /* flag to indicate an A-A or B-B connection */
225 u_char t_val
[NUMBITS
] ; /* transmit bits for signaling */
226 u_char r_val
[NUMBITS
] ; /* receive bits for signaling */
227 u_long t_next
[NUMBITS
] ;
228 struct smt_timer pcm_timer0
;
229 struct smt_timer pcm_timer1
;
230 struct smt_timer pcm_timer2
;
235 int cem_pst
; /* CEM privae state; used for dual homing */
236 struct lem_counter lem
;
247 struct smt_timer
*st_queue
;
248 struct smt_timer st_fast
;
254 #define SMT_EVENT_BASE 1
255 #define SMT_EVENT_MAC_PATH_CHANGE (SMT_EVENT_BASE+0)
256 #define SMT_EVENT_MAC_NEIGHBOR_CHANGE (SMT_EVENT_BASE+1)
257 #define SMT_EVENT_PORT_PATH_CHANGE (SMT_EVENT_BASE+2)
258 #define SMT_EVENT_PORT_CONNECTION (SMT_EVENT_BASE+3)
260 #define SMT_IS_CONDITION(x) ((x)>=SMT_COND_BASE)
262 #define SMT_COND_BASE (SMT_EVENT_PORT_CONNECTION+1)
263 #define SMT_COND_SMT_PEER_WRAP (SMT_COND_BASE+0)
264 #define SMT_COND_SMT_HOLD (SMT_COND_BASE+1)
265 #define SMT_COND_MAC_FRAME_ERROR (SMT_COND_BASE+2)
266 #define SMT_COND_MAC_DUP_ADDR (SMT_COND_BASE+3)
267 #define SMT_COND_MAC_NOT_COPIED (SMT_COND_BASE+4)
268 #define SMT_COND_PORT_EB_ERROR (SMT_COND_BASE+5)
269 #define SMT_COND_PORT_LER (SMT_COND_BASE+6)
272 #define SR1_HOLDOFF 1
273 #define SR2_DISABLED 2
276 u_long SRThreshold
; /* threshold value */
277 u_char RT_Flag
; /* report transmitted flag */
278 u_char sr_state
; /* state-machine */
279 u_char any_report
; /* any report required */
280 u_long TSR
; /* timer */
281 u_short ring_status
; /* IBM ring status */
285 * IBM token ring status
287 #define RS_RES15 (1<<15) /* reserved */
288 #define RS_HARDERROR (1<<14) /* ring down */
289 #define RS_SOFTERROR (1<<13) /* sent SRF */
290 #define RS_BEACON (1<<12) /* transmitted beacon */
291 #define RS_PATHTEST (1<<11) /* path test failed */
292 #define RS_SELFTEST (1<<10) /* selftest required */
293 #define RS_RES9 (1<< 9) /* reserved */
294 #define RS_DISCONNECT (1<< 8) /* remote disconnect */
295 #define RS_RES7 (1<< 7) /* reserved */
296 #define RS_DUPADDR (1<< 6) /* duplicate address */
297 #define RS_NORINGOP (1<< 5) /* no ring op */
298 #define RS_VERSION (1<< 4) /* SMT version mismatch */
299 #define RS_STUCKBYPASSS (1<< 3) /* stuck bypass */
300 #define RS_EVENT (1<< 2) /* FDDI event occurred */
301 #define RS_RINGOPCHANGE (1<< 1) /* ring op changed */
302 #define RS_RES0 (1<< 0) /* reserved */
304 #define RS_SET(smc,bit) \
305 ring_status_indication(smc,smc->srf.ring_status |= bit)
306 #define RS_CLEAR(smc,bit) \
307 ring_status_indication(smc,smc->srf.ring_status &= ~bit)
309 #define RS_CLEAR_EVENT (0xffff & ~(RS_NORINGOP))
311 /* Define the AIX-event-Notification as null function if it isn't defined */
312 /* in the targetos.h file */
314 #define AIX_EVENT(smc,opt0,opt1,opt2,opt3) /* nothing */
318 u_char evc_code
; /* event code type */
319 u_char evc_index
; /* index for mult. instances */
320 u_char evc_rep_required
; /* report required */
321 u_short evc_para
; /* SMT Para Number */
322 u_char
*evc_cond_state
; /* condition state */
323 u_char
*evc_multiple
; /* multiple occurrence */
327 * Values used by frame based services
330 #define SMT_MAX_TEST 5
331 #define SMT_TID_NIF 0 /* pending NIF request */
332 #define SMT_TID_NIF_TEST 1 /* pending NIF test */
333 #define SMT_TID_ECF_UNA 2 /* pending ECF UNA test */
334 #define SMT_TID_ECF_DNA 3 /* pending ECF DNA test */
335 #define SMT_TID_ECF 4 /* pending ECF test */
338 u_long smt_tvu
; /* timer valid una */
339 u_long smt_tvd
; /* timer valid dna */
340 u_long smt_tid
; /* transaction id */
341 u_long pend
[SMT_MAX_TEST
] ; /* TID of requests */
342 u_long uniq_time
; /* unique time stamp */
343 u_short uniq_ticks
; /* unique time stamp */
344 u_short please_reconnect
; /* flag : reconnect */
345 u_long smt_last_lem
;
346 u_long smt_last_notify
;
347 struct smt_timer smt_timer
; /* SMT NIF timer */
348 u_long last_tok_time
[NUMMACS
]; /* token cnt emulation */
352 * SMT/CMT configurable parameters
354 #define SMT_DAS 0 /* dual attach */
355 #define SMT_SAS 1 /* single attach */
356 #define SMT_NAC 2 /* null attach concentrator */
359 u_char attach_s
; /* CFM attach to secondary path */
360 u_char sas
; /* SMT_DAS/SAS/NAC */
361 u_char build_ring_map
; /* build ringmap if TRUE */
362 u_char numphys
; /* number of active phys */
365 u_long pcm_tb_min
; /* PCM : TB_Min timer value */
366 u_long pcm_tb_max
; /* PCM : TB_Max timer value */
367 u_long pcm_c_min
; /* PCM : C_Min timer value */
368 u_long pcm_t_out
; /* PCM : T_Out timer value */
369 u_long pcm_tl_min
; /* PCM : TL_min timer value */
370 u_long pcm_lc_short
; /* PCM : LC_Short timer value */
371 u_long pcm_lc_medium
; /* PCM : LC_Medium timer value */
372 u_long pcm_lc_long
; /* PCM : LC_Long timer value */
373 u_long pcm_lc_extended
; /* PCM : LC_Extended timer value */
374 u_long pcm_t_next_9
; /* PCM : T_Next[9] timer value */
375 u_long pcm_ns_max
; /* PCM : NS_Max timer value */
377 u_long ecm_i_max
; /* ECM : I_Max timer value */
378 u_long ecm_in_max
; /* ECM : IN_Max timer value */
379 u_long ecm_td_min
; /* ECM : TD_Min timer */
380 u_long ecm_test_done
; /* ECM : path test done timer */
381 u_long ecm_check_poll
; /* ECM : check bypass poller */
383 u_long rmt_t_non_op
; /* RMT : T_Non_OP timer value */
384 u_long rmt_t_stuck
; /* RMT : T_Stuck timer value */
385 u_long rmt_t_direct
; /* RMT : T_Direct timer value */
386 u_long rmt_t_jam
; /* RMT : T_Jam timer value */
387 u_long rmt_t_announce
; /* RMT : T_Announce timer value */
388 u_long rmt_t_poll
; /* RMT : claim/beacon poller */
389 u_long rmt_dup_mac_behavior
; /* Flag for the beavior of SMT if
390 * a Duplicate MAC Address was detected.
391 * FALSE: SMT will leave finally the ring
392 * TRUE: SMT will reinstert into the ring
394 u_long mac_d_max
; /* MAC : D_Max timer value */
396 u_long lct_short
; /* LCT : error threshold */
397 u_long lct_medium
; /* LCT : error threshold */
398 u_long lct_long
; /* LCT : error threshold */
399 u_long lct_extended
; /* LCT : error threshold */
404 * Debugging struct sometimes used in smc
420 struct os_debug d_os
; /* Include specific OS DEBUG struct */
424 /* all boards shall be debugged with one debug struct */
425 extern struct smt_debug debug
; /* Declaration of debug struct */
426 #endif /* DEBUG_BRD */
431 * the SMT Context Struct SMC
432 * this struct contains ALL global variables of SMT
435 struct s_smt_os os
; /* os specific */
436 struct s_smt_hw hw
; /* hardware */
439 * NOTE: os and hw MUST BE the first two structs
440 * anything beyond hw WILL BE SET TO ZERO in smt_set_defaults()
442 struct smt_config s
; /* smt constants */
443 struct smt_values sm
; /* smt variables */
444 struct s_ecm e
; /* ecm */
445 struct s_rmt r
; /* rmt */
446 struct s_cfm cf
; /* cfm/cem */
448 struct s_cem ce
[NUMPHYS
] ; /* cem */
449 struct s_c_ring cr
[NUMPHYS
+NUMMACS
] ;
451 struct s_pcm p
; /* pcm */
452 struct s_phy y
[NUMPHYS
] ; /* phy */
453 struct s_queue q
; /* queue */
454 struct s_timer t
; /* timer */
455 struct s_srf srf
; /* SRF */
456 struct s_srf_evc evcs
[6+NUMPHYS
*4] ;
457 struct fddi_mib mib
; /* __THE_MIB__ */
459 struct s_sba sba
; /* SBA variables */
462 struct s_ess ess
; /* Ess variables */
464 #if defined(DEBUG) && defined(DEBUG_BRD)
465 /* If you want all single board to be debugged separately */
466 struct smt_debug debug
; /* Declaration of debug struct */
467 #endif /* DEBUG_BRD && DEBUG */
470 extern const struct fddi_addr fddi_broadcast
;
472 extern void all_selection_criteria(struct s_smc
*smc
);
473 extern void card_stop(struct s_smc
*smc
);
474 extern void init_board(struct s_smc
*smc
, u_char
*mac_addr
);
475 extern int init_fplus(struct s_smc
*smc
);
476 extern void init_plc(struct s_smc
*smc
);
477 extern int init_smt(struct s_smc
*smc
, u_char
* mac_addr
);
478 extern void mac1_irq(struct s_smc
*smc
, u_short stu
, u_short stl
);
479 extern void mac2_irq(struct s_smc
*smc
, u_short code_s2u
, u_short code_s2l
);
480 extern void mac3_irq(struct s_smc
*smc
, u_short code_s3u
, u_short code_s3l
);
481 extern int pcm_status_twisted(struct s_smc
*smc
);
482 extern void plc1_irq(struct s_smc
*smc
);
483 extern void plc2_irq(struct s_smc
*smc
);
484 extern void read_address(struct s_smc
*smc
, u_char
* mac_addr
);
485 extern void timer_irq(struct s_smc
*smc
);
487 #endif /* _SCMECM_ */