1
2
3
4
5
6
7
8
9
10
11 #ifndef _SCMECM_
12 #define _SCMECM_
13
14 #if defined(PCI) && !defined(OSDEF)
15
16
17
18 #define OSDEF
19 #endif
20
21 #ifdef PCI
22 #ifndef SUPERNET_3
23 #define SUPERNET_3
24 #endif
25 #ifndef TAG_MODE
26 #define TAG_MODE
27 #endif
28 #endif
29
30
31
32
33
34
35
36 #ifdef OSDEF
37 #include "osdef1st.h"
38 #endif
39 #ifdef OEM_CONCEPT
40 #include "oemdef.h"
41 #endif
42 #include "smt.h"
43 #include "cmtdef.h"
44 #include "fddimib.h"
45 #include "targethw.h"
46 #include "targetos.h"
47 #ifdef ESS
48 #include "sba.h"
49 #endif
50
51
52
53
54
55
56
57
58 struct event_queue {
59 u_short class ;
60 u_short event ;
61 } ;
62
63
64
65
66 #ifdef CONCENTRATOR
67 #define MAX_EVENT 128
68 #else
69 #define MAX_EVENT 64
70 #endif
71
72 struct s_queue {
73
74 struct event_queue ev_queue[MAX_EVENT];
75 struct event_queue *ev_put ;
76 struct event_queue *ev_get ;
77 } ;
78
79
80
81
82
83 struct s_ecm {
84 u_char path_test ;
85 u_char sb_flag ;
86 u_char DisconnectFlag ;
87
88 u_char ecm_line_state ;
89 u_long trace_prop ;
90
91
92
93
94 char ec_pad[2] ;
95 struct smt_timer ecm_timer ;
96 } ;
97
98
99
100
101
102
103 struct s_rmt {
104 u_char dup_addr_test ;
105 u_char da_flag ;
106 u_char loop_avail ;
107 u_char sm_ma_avail ;
108 u_char no_flag ;
109 u_char bn_flag ;
110 u_char jm_flag ;
111 u_char rm_join ;
112 u_char rm_loop ;
113
114 long fast_rm_join ;
115
116
117
118 struct smt_timer rmt_timer0 ;
119 struct smt_timer rmt_timer1 ;
120 struct smt_timer rmt_timer2 ;
121 u_char timer0_exp ;
122 u_char timer1_exp ;
123 u_char timer2_exp ;
124
125 u_char rm_pad1[1] ;
126 } ;
127
128
129
130
131
132
133 struct s_cfm {
134 u_char cf_state;
135 u_char cf_pad[3] ;
136 } ;
137
138
139
140
141
142
143 #ifdef CONCENTRATOR
144 struct s_cem {
145 int ce_state ;
146 int ce_port ;
147 int ce_type ;
148 } ;
149
150
151
152
153 struct s_c_ring {
154 struct s_c_ring *c_next ;
155 char c_entity ;
156 } ;
157
158 struct mib_path_config {
159 u_long fddimibPATHConfigSMTIndex;
160 u_long fddimibPATHConfigPATHIndex;
161 u_long fddimibPATHConfigTokenOrder;
162 u_long fddimibPATHConfigResourceType;
163 #define SNMP_RES_TYPE_MAC 2
164 #define SNMP_RES_TYPE_PORT 4
165 u_long fddimibPATHConfigResourceIndex;
166 u_long fddimibPATHConfigCurrentPath;
167 #define SNMP_PATH_ISOLATED 1
168 #define SNMP_PATH_LOCAL 2
169 #define SNMP_PATH_SECONDARY 3
170 #define SNMP_PATH_PRIMARY 4
171 #define SNMP_PATH_CONCATENATED 5
172 #define SNMP_PATH_THRU 6
173 };
174
175
176 #endif
177
178
179
180
181 #define PCM_DISABLED 0
182 #define PCM_CONNECTING 1
183 #define PCM_STANDBY 2
184 #define PCM_ACTIVE 3
185
186 struct s_pcm {
187 u_char pcm_pad[3] ;
188 } ;
189
190
191
192
193
194 struct s_phy {
195
196 struct fddi_mib_p *mib ;
197
198 u_char np ;
199 u_char cf_join ;
200 u_char cf_loop ;
201 u_char wc_flag ;
202 u_char pc_mode ;
203 u_char pc_lem_fail ;
204 u_char lc_test ;
205 u_char scrub ;
206 char phy_name ;
207 u_char pmd_type[2] ;
208 #define PMD_SK_CONN 0
209 #define PMD_SK_PMD 1
210 u_char pmd_scramble ;
211
212
213 u_char curr_ls ;
214 u_char ls_flag ;
215 u_char rc_flag ;
216 u_char tc_flag ;
217 u_char td_flag ;
218 u_char bitn ;
219 u_char tr_flag ;
220 u_char twisted ;
221 u_char t_val[NUMBITS] ;
222 u_char r_val[NUMBITS] ;
223 u_long t_next[NUMBITS] ;
224 struct smt_timer pcm_timer0 ;
225 struct smt_timer pcm_timer1 ;
226 struct smt_timer pcm_timer2 ;
227 u_char timer0_exp ;
228 u_char timer1_exp ;
229 u_char timer2_exp ;
230 u_char pcm_pad1[1] ;
231 int cem_pst ;
232 struct lem_counter lem ;
233 #ifdef AMDPLC
234 struct s_plc plc ;
235 #endif
236 } ;
237
238
239
240
241
242 struct s_timer {
243 struct smt_timer *st_queue ;
244 struct smt_timer st_fast ;
245 } ;
246
247
248
249
250 #define SMT_EVENT_BASE 1
251 #define SMT_EVENT_MAC_PATH_CHANGE (SMT_EVENT_BASE+0)
252 #define SMT_EVENT_MAC_NEIGHBOR_CHANGE (SMT_EVENT_BASE+1)
253 #define SMT_EVENT_PORT_PATH_CHANGE (SMT_EVENT_BASE+2)
254 #define SMT_EVENT_PORT_CONNECTION (SMT_EVENT_BASE+3)
255
256 #define SMT_IS_CONDITION(x) ((x)>=SMT_COND_BASE)
257
258 #define SMT_COND_BASE (SMT_EVENT_PORT_CONNECTION+1)
259 #define SMT_COND_SMT_PEER_WRAP (SMT_COND_BASE+0)
260 #define SMT_COND_SMT_HOLD (SMT_COND_BASE+1)
261 #define SMT_COND_MAC_FRAME_ERROR (SMT_COND_BASE+2)
262 #define SMT_COND_MAC_DUP_ADDR (SMT_COND_BASE+3)
263 #define SMT_COND_MAC_NOT_COPIED (SMT_COND_BASE+4)
264 #define SMT_COND_PORT_EB_ERROR (SMT_COND_BASE+5)
265 #define SMT_COND_PORT_LER (SMT_COND_BASE+6)
266
267 #define SR0_WAIT 0
268 #define SR1_HOLDOFF 1
269 #define SR2_DISABLED 2
270
271 struct s_srf {
272 u_long SRThreshold ;
273 u_char RT_Flag ;
274 u_char sr_state ;
275 u_char any_report ;
276 u_long TSR ;
277 u_short ring_status ;
278 } ;
279
280
281
282
283 #define RS_RES15 (1<<15)
284 #define RS_HARDERROR (1<<14)
285 #define RS_SOFTERROR (1<<13)
286 #define RS_BEACON (1<<12)
287 #define RS_PATHTEST (1<<11)
288 #define RS_SELFTEST (1<<10)
289 #define RS_RES9 (1<< 9)
290 #define RS_DISCONNECT (1<< 8)
291 #define RS_RES7 (1<< 7)
292 #define RS_DUPADDR (1<< 6)
293 #define RS_NORINGOP (1<< 5)
294 #define RS_VERSION (1<< 4)
295 #define RS_STUCKBYPASSS (1<< 3)
296 #define RS_EVENT (1<< 2)
297 #define RS_RINGOPCHANGE (1<< 1)
298 #define RS_RES0 (1<< 0)
299
300 #define RS_SET(smc,bit) \
301 ring_status_indication(smc,smc->srf.ring_status |= bit)
302 #define RS_CLEAR(smc,bit) \
303 ring_status_indication(smc,smc->srf.ring_status &= ~bit)
304
305 #define RS_CLEAR_EVENT (0xffff & ~(RS_NORINGOP))
306
307
308
309 #ifndef AIX_EVENT
310 #define AIX_EVENT(smc,opt0,opt1,opt2,opt3)
311 #endif
312
313 struct s_srf_evc {
314 u_char evc_code ;
315 u_char evc_index ;
316 u_char evc_rep_required ;
317 u_short evc_para ;
318 u_char *evc_cond_state ;
319 u_char *evc_multiple ;
320 } ;
321
322
323
324
325
326 #define SMT_MAX_TEST 5
327 #define SMT_TID_NIF 0
328 #define SMT_TID_NIF_TEST 1
329 #define SMT_TID_ECF_UNA 2
330 #define SMT_TID_ECF_DNA 3
331 #define SMT_TID_ECF 4
332
333 struct smt_values {
334 u_long smt_tvu ;
335 u_long smt_tvd ;
336 u_long smt_tid ;
337 u_long pend[SMT_MAX_TEST] ;
338 u_long uniq_time ;
339 u_short uniq_ticks ;
340 u_short please_reconnect ;
341 u_long smt_last_lem ;
342 u_long smt_last_notify ;
343 struct smt_timer smt_timer ;
344 u_long last_tok_time[NUMMACS];
345 } ;
346
347
348
349
350 #define SMT_DAS 0
351 #define SMT_SAS 1
352 #define SMT_NAC 2
353
354 struct smt_config {
355 u_char attach_s ;
356 u_char sas ;
357 u_char build_ring_map ;
358 u_char numphys ;
359 u_char sc_pad[1] ;
360
361 u_long pcm_tb_min ;
362 u_long pcm_tb_max ;
363 u_long pcm_c_min ;
364 u_long pcm_t_out ;
365 u_long pcm_tl_min ;
366 u_long pcm_lc_short ;
367 u_long pcm_lc_medium ;
368 u_long pcm_lc_long ;
369 u_long pcm_lc_extended ;
370 u_long pcm_t_next_9 ;
371 u_long pcm_ns_max ;
372
373 u_long ecm_i_max ;
374 u_long ecm_in_max ;
375 u_long ecm_td_min ;
376 u_long ecm_test_done ;
377 u_long ecm_check_poll ;
378
379 u_long rmt_t_non_op ;
380 u_long rmt_t_stuck ;
381 u_long rmt_t_direct ;
382 u_long rmt_t_jam ;
383 u_long rmt_t_announce ;
384 u_long rmt_t_poll ;
385 u_long rmt_dup_mac_behavior ;
386
387
388
389
390 u_long mac_d_max ;
391
392 u_long lct_short ;
393 u_long lct_medium ;
394 u_long lct_long ;
395 u_long lct_extended ;
396 } ;
397
398 #ifdef DEBUG
399
400
401
402 struct smt_debug {
403 int d_smtf ;
404 int d_smt ;
405 int d_ecm ;
406 int d_rmt ;
407 int d_cfm ;
408 int d_pcm ;
409 int d_plc ;
410 #ifdef ESS
411 int d_ess ;
412 #endif
413 #ifdef SBA
414 int d_sba ;
415 #endif
416 struct os_debug d_os;
417 } ;
418
419 #ifndef DEBUG_BRD
420
421 extern struct smt_debug debug;
422 #endif
423
424 #endif
425
426
427
428
429
430 struct s_smc {
431 struct s_smt_os os ;
432 struct s_smt_hw hw ;
433
434
435
436
437
438 struct smt_config s ;
439 struct smt_values sm ;
440 struct s_ecm e ;
441 struct s_rmt r ;
442 struct s_cfm cf ;
443 #ifdef CONCENTRATOR
444 struct s_cem ce[NUMPHYS] ;
445 struct s_c_ring cr[NUMPHYS+NUMMACS] ;
446 #endif
447 struct s_pcm p ;
448 struct s_phy y[NUMPHYS] ;
449 struct s_queue q ;
450 struct s_timer t ;
451 struct s_srf srf ;
452 struct s_srf_evc evcs[6+NUMPHYS*4] ;
453 struct fddi_mib mib ;
454 #ifdef SBA
455 struct s_sba sba ;
456 #endif
457 #ifdef ESS
458 struct s_ess ess ;
459 #endif
460 #if defined(DEBUG) && defined(DEBUG_BRD)
461
462 struct smt_debug debug;
463 #endif
464 } ;
465
466 extern const struct fddi_addr fddi_broadcast;
467
468 void all_selection_criteria(struct s_smc *smc);
469 void card_stop(struct s_smc *smc);
470 void init_board(struct s_smc *smc, u_char *mac_addr);
471 int init_fplus(struct s_smc *smc);
472 void init_plc(struct s_smc *smc);
473 int init_smt(struct s_smc *smc, u_char *mac_addr);
474 void mac1_irq(struct s_smc *smc, u_short stu, u_short stl);
475 void mac2_irq(struct s_smc *smc, u_short code_s2u, u_short code_s2l);
476 void mac3_irq(struct s_smc *smc, u_short code_s3u, u_short code_s3l);
477 int pcm_status_twisted(struct s_smc *smc);
478 void plc1_irq(struct s_smc *smc);
479 void plc2_irq(struct s_smc *smc);
480 void read_address(struct s_smc *smc, u_char *mac_addr);
481 void timer_irq(struct s_smc *smc);
482
483 #endif
484