cmtdef.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. /******************************************************************************
  2. *
  3. * (C)Copyright 1998,1999 SysKonnect,
  4. * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
  5. *
  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.
  10. *
  11. * The information in this file is provided "AS IS" without warranty.
  12. *
  13. ******************************************************************************/
  14. #ifndef _CMTDEF_
  15. #define _CMTDEF_
  16. /* **************************************************************** */
  17. /*
  18. * implementation specific constants
  19. * MODIIFY THE FOLLOWING THREE DEFINES
  20. */
  21. #define AMDPLC /* if Amd PLC chip used */
  22. #ifdef CONC
  23. #define NUMPHYS 12 /* 2 for SAS or DAS, more for Concentrator */
  24. #else
  25. #ifdef CONC_II
  26. #define NUMPHYS 24 /* 2 for SAS or DAS, more for Concentrator */
  27. #else
  28. #define NUMPHYS 2 /* 2 for SAS or DAS, more for Concentrator */
  29. #endif
  30. #endif
  31. #define NUMMACS 1 /* only 1 supported at the moment */
  32. #define NUMPATHS 2 /* primary and secondary path supported */
  33. /*
  34. * DO NOT MODIFY BEYOND THIS POINT
  35. */
  36. /* **************************************************************** */
  37. #if NUMPHYS > 2
  38. #define CONCENTRATOR
  39. #endif
  40. /*
  41. * Definitions for comfortable LINT usage
  42. */
  43. #ifdef lint
  44. #define LINT_USE(x) (x)=(x)
  45. #else
  46. #define LINT_USE(x)
  47. #endif
  48. #ifdef DEBUG
  49. #define DB_PR(flag,a,b,c) { if (flag) printf(a,b,c) ; }
  50. #else
  51. #define DB_PR(flag,a,b,c)
  52. #endif
  53. #ifdef DEBUG_BRD
  54. #define DB_ECM(a,b,c) DB_PR((smc->debug.d_smt&1),a,b,c)
  55. #define DB_ECMN(n,a,b,c) DB_PR((smc->debug.d_ecm >=(n)),a,b,c)
  56. #define DB_RMT(a,b,c) DB_PR((smc->debug.d_smt&2),a,b,c)
  57. #define DB_RMTN(n,a,b,c) DB_PR((smc->debug.d_rmt >=(n)),a,b,c)
  58. #define DB_CFM(a,b,c) DB_PR((smc->debug.d_smt&4),a,b,c)
  59. #define DB_CFMN(n,a,b,c) DB_PR((smc->debug.d_cfm >=(n)),a,b,c)
  60. #define DB_PCM(a,b,c) DB_PR((smc->debug.d_smt&8),a,b,c)
  61. #define DB_PCMN(n,a,b,c) DB_PR((smc->debug.d_pcm >=(n)),a,b,c)
  62. #define DB_SMT(a,b,c) DB_PR((smc->debug.d_smtf),a,b,c)
  63. #define DB_SMTN(n,a,b,c) DB_PR((smc->debug.d_smtf >=(n)),a,b,c)
  64. #define DB_SBA(a,b,c) DB_PR((smc->debug.d_sba),a,b,c)
  65. #define DB_SBAN(n,a,b,c) DB_PR((smc->debug.d_sba >=(n)),a,b,c)
  66. #define DB_ESS(a,b,c) DB_PR((smc->debug.d_ess),a,b,c)
  67. #define DB_ESSN(n,a,b,c) DB_PR((smc->debug.d_ess >=(n)),a,b,c)
  68. #else
  69. #define DB_ECM(a,b,c) DB_PR((debug.d_smt&1),a,b,c)
  70. #define DB_ECMN(n,a,b,c) DB_PR((debug.d_ecm >=(n)),a,b,c)
  71. #define DB_RMT(a,b,c) DB_PR((debug.d_smt&2),a,b,c)
  72. #define DB_RMTN(n,a,b,c) DB_PR((debug.d_rmt >=(n)),a,b,c)
  73. #define DB_CFM(a,b,c) DB_PR((debug.d_smt&4),a,b,c)
  74. #define DB_CFMN(n,a,b,c) DB_PR((debug.d_cfm >=(n)),a,b,c)
  75. #define DB_PCM(a,b,c) DB_PR((debug.d_smt&8),a,b,c)
  76. #define DB_PCMN(n,a,b,c) DB_PR((debug.d_pcm >=(n)),a,b,c)
  77. #define DB_SMT(a,b,c) DB_PR((debug.d_smtf),a,b,c)
  78. #define DB_SMTN(n,a,b,c) DB_PR((debug.d_smtf >=(n)),a,b,c)
  79. #define DB_SBA(a,b,c) DB_PR((debug.d_sba),a,b,c)
  80. #define DB_SBAN(n,a,b,c) DB_PR((debug.d_sba >=(n)),a,b,c)
  81. #define DB_ESS(a,b,c) DB_PR((debug.d_ess),a,b,c)
  82. #define DB_ESSN(n,a,b,c) DB_PR((debug.d_ess >=(n)),a,b,c)
  83. #endif
  84. #ifndef SS_NOT_DS
  85. #define SK_LOC_DECL(type,var) type var
  86. #else
  87. #define SK_LOC_DECL(type,var) static type var
  88. #endif
  89. /*
  90. * PHYs and PORTS
  91. * Note: Don't touch the definition of PA and PB. Those might be used
  92. * by some "for" loops.
  93. */
  94. #define PA 0
  95. #define PB 1
  96. #if defined(SUPERNET_3) || defined(CONC_II)
  97. /*
  98. * The port indices have to be different,
  99. * because the MAC output goes through the 2. PLC
  100. * Conc II: It has to be the first port in the row.
  101. */
  102. #define PS 0 /* Internal PLC which is the same as PA */
  103. #else
  104. #define PS 1
  105. #endif
  106. #define PM 2 /* PM .. PA+NUM_PHYS-1 */
  107. /*
  108. * PHY types - as in path descriptor 'fddiPHYType'
  109. */
  110. #define TA 0 /* A port */
  111. #define TB 1 /* B port */
  112. #define TS 2 /* S port */
  113. #define TM 3 /* M port */
  114. #define TNONE 4
  115. /*
  116. * indexes in MIB
  117. */
  118. #define INDEX_MAC 1
  119. #define INDEX_PATH 1
  120. #define INDEX_PORT 1
  121. /*
  122. * policies
  123. */
  124. #define POLICY_AA (1<<0) /* reject AA */
  125. #define POLICY_AB (1<<1) /* reject AB */
  126. #define POLICY_AS (1<<2) /* reject AS */
  127. #define POLICY_AM (1<<3) /* reject AM */
  128. #define POLICY_BA (1<<4) /* reject BA */
  129. #define POLICY_BB (1<<5) /* reject BB */
  130. #define POLICY_BS (1<<6) /* reject BS */
  131. #define POLICY_BM (1<<7) /* reject BM */
  132. #define POLICY_SA (1<<8) /* reject SA */
  133. #define POLICY_SB (1<<9) /* reject SB */
  134. #define POLICY_SS (1<<10) /* reject SS */
  135. #define POLICY_SM (1<<11) /* reject SM */
  136. #define POLICY_MA (1<<12) /* reject MA */
  137. #define POLICY_MB (1<<13) /* reject MB */
  138. #define POLICY_MS (1<<14) /* reject MS */
  139. #define POLICY_MM (1<<15) /* reject MM */
  140. /*
  141. * commands
  142. */
  143. /*
  144. * EVENTS
  145. * event classes
  146. */
  147. #define EVENT_ECM 1 /* event class ECM */
  148. #define EVENT_CFM 2 /* event class CFM */
  149. #define EVENT_RMT 3 /* event class RMT */
  150. #define EVENT_SMT 4 /* event class SMT */
  151. #define EVENT_PCM 5 /* event class PCM */
  152. #define EVENT_PCMA 5 /* event class PCMA */
  153. #define EVENT_PCMB 6 /* event class PCMB */
  154. /* WARNING :
  155. * EVENT_PCM* must be last in the above list
  156. * if more than two ports are used, EVENT_PCM .. EVENT_PCMA+NUM_PHYS-1
  157. * are used !
  158. */
  159. #define EV_TOKEN(class,event) (((u_long)(class)<<16L)|((u_long)(event)))
  160. #define EV_T_CLASS(token) ((int)((token)>>16)&0xffff)
  161. #define EV_T_EVENT(token) ((int)(token)&0xffff)
  162. /*
  163. * ECM events
  164. */
  165. #define EC_CONNECT 1 /* connect request */
  166. #define EC_DISCONNECT 2 /* disconnect request */
  167. #define EC_TRACE_PROP 3 /* trace propagation */
  168. #define EC_PATH_TEST 4 /* path test */
  169. #define EC_TIMEOUT_TD 5 /* timer TD_min */
  170. #define EC_TIMEOUT_TMAX 6 /* timer trace_max */
  171. #define EC_TIMEOUT_IMAX 7 /* timer I_max */
  172. #define EC_TIMEOUT_INMAX 8 /* timer IN_max */
  173. #define EC_TEST_DONE 9 /* path test done */
  174. /*
  175. * CFM events
  176. */
  177. #define CF_LOOP 1 /* cf_loop flag from PCM */
  178. #define CF_LOOP_A 1 /* cf_loop flag from PCM */
  179. #define CF_LOOP_B 2 /* cf_loop flag from PCM */
  180. #define CF_JOIN 3 /* cf_join flag from PCM */
  181. #define CF_JOIN_A 3 /* cf_join flag from PCM */
  182. #define CF_JOIN_B 4 /* cf_join flag from PCM */
  183. /*
  184. * PCM events
  185. */
  186. #define PC_START 1
  187. #define PC_STOP 2
  188. #define PC_LOOP 3
  189. #define PC_JOIN 4
  190. #define PC_SIGNAL 5
  191. #define PC_REJECT 6
  192. #define PC_MAINT 7
  193. #define PC_TRACE 8
  194. #define PC_PDR 9
  195. #define PC_ENABLE 10
  196. #define PC_DISABLE 11
  197. /*
  198. * must be ordered as in LineStateType
  199. */
  200. #define PC_QLS 12
  201. #define PC_ILS 13
  202. #define PC_MLS 14
  203. #define PC_HLS 15
  204. #define PC_LS_PDR 16
  205. #define PC_LS_NONE 17
  206. #define LS2MIB(x) ((x)-PC_QLS)
  207. #define MIB2LS(x) ((x)+PC_QLS)
  208. #define PC_TIMEOUT_TB_MAX 18 /* timer TB_max */
  209. #define PC_TIMEOUT_TB_MIN 19 /* timer TB_min */
  210. #define PC_TIMEOUT_C_MIN 20 /* timer C_Min */
  211. #define PC_TIMEOUT_T_OUT 21 /* timer T_Out */
  212. #define PC_TIMEOUT_TL_MIN 22 /* timer TL_Min */
  213. #define PC_TIMEOUT_T_NEXT 23 /* timer t_next[] */
  214. #define PC_TIMEOUT_LCT 24
  215. #define PC_NSE 25 /* NOISE hardware timer */
  216. #define PC_LEM 26 /* LEM done */
  217. /*
  218. * RMT events meaning from
  219. */
  220. #define RM_RING_OP 1 /* ring operational MAC */
  221. #define RM_RING_NON_OP 2 /* ring not operational MAC */
  222. #define RM_MY_BEACON 3 /* recvd my beacon MAC */
  223. #define RM_OTHER_BEACON 4 /* recvd other beacon MAC */
  224. #define RM_MY_CLAIM 5 /* recvd my claim MAC */
  225. #define RM_TRT_EXP 6 /* TRT exp MAC */
  226. #define RM_VALID_CLAIM 7 /* claim from dup addr MAC */
  227. #define RM_JOIN 8 /* signal rm_join CFM */
  228. #define RM_LOOP 9 /* signal rm_loop CFM */
  229. #define RM_DUP_ADDR 10 /* dup_addr_test hange SMT-NIF */
  230. #define RM_ENABLE_FLAG 11 /* enable flag */
  231. #define RM_TIMEOUT_NON_OP 12 /* timeout T_Non_OP */
  232. #define RM_TIMEOUT_T_STUCK 13 /* timeout T_Stuck */
  233. #define RM_TIMEOUT_ANNOUNCE 14 /* timeout T_Announce */
  234. #define RM_TIMEOUT_T_DIRECT 15 /* timeout T_Direct */
  235. #define RM_TIMEOUT_D_MAX 16 /* timeout D_Max */
  236. #define RM_TIMEOUT_POLL 17 /* claim/beacon poller */
  237. #define RM_TX_STATE_CHANGE 18 /* To restart timer for D_Max */
  238. /*
  239. * SMT events
  240. */
  241. #define SM_TIMER 1 /* timer */
  242. #define SM_FAST 2 /* smt_force_irq */
  243. /* PC modes */
  244. #define PM_NONE 0
  245. #define PM_PEER 1
  246. #define PM_TREE 2
  247. /*
  248. * PCM withhold codes
  249. * MIB PC-WithholdType ENUM
  250. */
  251. #define PC_WH_NONE 0 /* ok */
  252. #define PC_WH_M_M 1 /* M to M */
  253. #define PC_WH_OTHER 2 /* other incompatible phys */
  254. #define PC_WH_PATH 3 /* path not available */
  255. /*
  256. * LCT duration
  257. */
  258. #define LC_SHORT 1 /* short LCT */
  259. #define LC_MEDIUM 2 /* medium LCT */
  260. #define LC_LONG 3 /* long LCT */
  261. #define LC_EXTENDED 4 /* extended LCT */
  262. /*
  263. * path_test values
  264. */
  265. #define PT_NONE 0
  266. #define PT_TESTING 1 /* test is running */
  267. #define PT_PASSED 2 /* test passed */
  268. #define PT_FAILED 3 /* test failed */
  269. #define PT_PENDING 4 /* path test follows */
  270. #define PT_EXITING 5 /* disconnected while in trace/leave */
  271. /*
  272. * duplicate address test
  273. * MIB DupAddressTest ENUM
  274. */
  275. #define DA_NONE 0 /* */
  276. #define DA_PASSED 1 /* test passed */
  277. #define DA_FAILED 2 /* test failed */
  278. /*
  279. * optical bypass
  280. */
  281. #define BP_DEINSERT 0 /* disable bypass */
  282. #define BP_INSERT 1 /* enable bypass */
  283. /*
  284. * ODL enable/disable
  285. */
  286. #define PM_TRANSMIT_DISABLE 0 /* disable xmit */
  287. #define PM_TRANSMIT_ENABLE 1 /* enable xmit */
  288. /*
  289. * parameter for config_mux
  290. * note : number is index in config_endec table !
  291. */
  292. #define MUX_THRUA 0 /* through A */
  293. #define MUX_THRUB 1 /* through B */
  294. #define MUX_WRAPA 2 /* wrap A */
  295. #define MUX_WRAPB 3 /* wrap B */
  296. #define MUX_ISOLATE 4 /* isolated */
  297. #define MUX_WRAPS 5 /* SAS */
  298. /*
  299. * MAC control
  300. */
  301. #define MA_RESET 0
  302. #define MA_BEACON 1
  303. #define MA_CLAIM 2
  304. #define MA_DIRECTED 3 /* directed beacon */
  305. #define MA_TREQ 4 /* change T_Req */
  306. #define MA_OFFLINE 5 /* switch MAC to offline */
  307. /*
  308. * trace prop
  309. * bit map for trace propagation
  310. */
  311. #define ENTITY_MAC (NUMPHYS)
  312. #define ENTITY_PHY(p) (p)
  313. #define ENTITY_BIT(m) (1<<(m))
  314. /*
  315. * Resource Tag Types
  316. */
  317. #define PATH_ISO 0 /* isolated */
  318. #define PATH_PRIM 3 /* primary path */
  319. #define PATH_THRU 5 /* through path */
  320. #define RES_MAC 2 /* resource type MAC */
  321. #define RES_PORT 4 /* resource type PORT */
  322. /*
  323. * CFM state
  324. * oops: MUST MATCH CF-StateType in SMT7.2 !
  325. */
  326. #define SC0_ISOLATED 0 /* isolated */
  327. #define SC1_WRAP_A 5 /* wrap A (not used) */
  328. #define SC2_WRAP_B 6 /* wrap B (not used) */
  329. #define SC4_THRU_A 12 /* through A */
  330. #define SC5_THRU_B 7 /* through B (used in SMT 6.2) */
  331. #define SC7_WRAP_S 8 /* SAS (not used) */
  332. #define SC9_C_WRAP_A 9 /* c wrap A */
  333. #define SC10_C_WRAP_B 10 /* c wrap B */
  334. #define SC11_C_WRAP_S 11 /* c wrap S */
  335. /*
  336. * convert MIB time in units of 80nS to uS
  337. */
  338. #define MIB2US(t) ((t)/12)
  339. #define SEC2MIB(s) ((s)*12500000L)
  340. /*
  341. * SMT timer
  342. */
  343. struct smt_timer {
  344. struct smt_timer *tm_next ; /* linked list */
  345. struct s_smc *tm_smc ; /* pointer to context */
  346. u_long tm_delta ; /* delta time */
  347. u_long tm_token ; /* token value */
  348. u_short tm_active ; /* flag : active/inactive */
  349. u_short tm_pad ; /* pad field */
  350. } ;
  351. /*
  352. * communication structures
  353. */
  354. struct mac_parameter {
  355. u_long t_neg ; /* T_Neg parameter */
  356. u_long t_pri ; /* T_Pri register in MAC */
  357. } ;
  358. /*
  359. * MAC counters
  360. */
  361. struct mac_counter {
  362. u_long mac_nobuf_counter ; /* MAC SW counter: no buffer */
  363. u_long mac_r_restart_counter ; /* MAC SW counter: rx restarted */
  364. } ;
  365. /*
  366. * para struct context for SMT parameters
  367. */
  368. struct s_pcon {
  369. int pc_len ;
  370. int pc_err ;
  371. int pc_badset ;
  372. void *pc_p ;
  373. } ;
  374. /*
  375. * link error monitor
  376. */
  377. #define LEM_AVG 5
  378. struct lem_counter {
  379. #ifdef AM29K
  380. int lem_on ;
  381. u_long lem_errors ;
  382. u_long lem_symbols ;
  383. u_long lem_tsymbols ;
  384. int lem_s_count ;
  385. int lem_n_s ;
  386. int lem_values ;
  387. int lem_index ;
  388. int lem_avg_ber[LEM_AVG] ;
  389. int lem_sum ;
  390. #else
  391. u_short lem_float_ber ; /* 10E-nn bit error rate */
  392. u_long lem_errors ; /* accumulated error count */
  393. u_short lem_on ;
  394. #endif
  395. } ;
  396. #define NUMBITS 10
  397. #ifdef AMDPLC
  398. /*
  399. * PLC state table
  400. */
  401. struct s_plc {
  402. u_short p_state ; /* current state */
  403. u_short p_bits ; /* number of bits to send */
  404. u_short p_start ; /* first bit pos */
  405. u_short p_pad ; /* padding for alignment */
  406. u_long soft_err ; /* error counter */
  407. u_long parity_err ; /* error counter */
  408. u_long ebuf_err ; /* error counter */
  409. u_long ebuf_cont ; /* continuous error counter */
  410. u_long phyinv ; /* error counter */
  411. u_long vsym_ctr ; /* error counter */
  412. u_long mini_ctr ; /* error counter */
  413. u_long tpc_exp ; /* error counter */
  414. u_long np_err ; /* error counter */
  415. u_long b_pcs ; /* error counter */
  416. u_long b_tpc ; /* error counter */
  417. u_long b_tne ; /* error counter */
  418. u_long b_qls ; /* error counter */
  419. u_long b_ils ; /* error counter */
  420. u_long b_hls ; /* error counter */
  421. } ;
  422. #endif
  423. #ifdef PROTOTYP_INC
  424. #include "fddi/driver.pro"
  425. #else /* PROTOTYP_INC */
  426. /*
  427. * function prototypes
  428. */
  429. #include "mbuf.h" /* Type definitions for MBUFs */
  430. #include "smtstate.h" /* struct smt_state */
  431. void hwt_restart(struct s_smc *smc); /* hwt.c */
  432. SMbuf *smt_build_frame(struct s_smc *smc, int class, int type,
  433. int length); /* smt.c */
  434. SMbuf *smt_get_mbuf(struct s_smc *smc); /* drvsr.c */
  435. void *sm_to_para(struct s_smc *smc, struct smt_header *sm,
  436. int para); /* smt.c */
  437. #ifndef SK_UNUSED
  438. #define SK_UNUSED(var) (void)(var)
  439. #endif
  440. void queue_event(struct s_smc *smc, int class, int event);
  441. void ecm(struct s_smc *smc, int event);
  442. void ecm_init(struct s_smc *smc);
  443. void rmt(struct s_smc *smc, int event);
  444. void rmt_init(struct s_smc *smc);
  445. void pcm(struct s_smc *smc, const int np, int event);
  446. void pcm_init(struct s_smc *smc);
  447. void cfm(struct s_smc *smc, int event);
  448. void cfm_init(struct s_smc *smc);
  449. void smt_timer_start(struct s_smc *smc, struct smt_timer *timer, u_long time,
  450. u_long token);
  451. void smt_timer_stop(struct s_smc *smc, struct smt_timer *timer);
  452. void pcm_status_state(struct s_smc *smc, int np, int *type, int *state,
  453. int *remote, int *mac);
  454. void plc_config_mux(struct s_smc *smc, int mux);
  455. void sm_lem_evaluate(struct s_smc *smc);
  456. void mac_update_counter(struct s_smc *smc);
  457. void sm_pm_ls_latch(struct s_smc *smc, int phy, int on_off);
  458. void sm_ma_control(struct s_smc *smc, int mode);
  459. void sm_mac_check_beacon_claim(struct s_smc *smc);
  460. void config_mux(struct s_smc *smc, int mux);
  461. void smt_agent_init(struct s_smc *smc);
  462. void smt_timer_init(struct s_smc *smc);
  463. void smt_received_pack(struct s_smc *smc, SMbuf *mb, int fs);
  464. void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
  465. int index, int local);
  466. void smt_swap_para(struct smt_header *sm, int len, int direction);
  467. void ev_init(struct s_smc *smc);
  468. void hwt_init(struct s_smc *smc);
  469. u_long hwt_read(struct s_smc *smc);
  470. void hwt_stop(struct s_smc *smc);
  471. void hwt_start(struct s_smc *smc, u_long time);
  472. void smt_send_mbuf(struct s_smc *smc, SMbuf *mb, int fc);
  473. void smt_free_mbuf(struct s_smc *smc, SMbuf *mb);
  474. void sm_pm_bypass_req(struct s_smc *smc, int mode);
  475. void rmt_indication(struct s_smc *smc, int i);
  476. void cfm_state_change(struct s_smc *smc, int c_state);
  477. #if defined(DEBUG) || !defined(NO_SMT_PANIC)
  478. void smt_panic(struct s_smc *smc, char *text);
  479. #else
  480. #define smt_panic(smc,text)
  481. #endif /* DEBUG || !NO_SMT_PANIC */
  482. void smt_stat_counter(struct s_smc *smc, int stat);
  483. void smt_timer_poll(struct s_smc *smc);
  484. u_long smt_get_time(void);
  485. u_long smt_get_tid(struct s_smc *smc);
  486. void smt_timer_done(struct s_smc *smc);
  487. void smt_fixup_mib(struct s_smc *smc);
  488. void smt_reset_defaults(struct s_smc *smc, int level);
  489. void smt_agent_task(struct s_smc *smc);
  490. int smt_check_para(struct s_smc *smc, struct smt_header *sm,
  491. const u_short list[]);
  492. void driver_get_bia(struct s_smc *smc, struct fddi_addr *bia_addr);
  493. #ifdef SUPERNET_3
  494. void drv_reset_indication(struct s_smc *smc);
  495. #endif /* SUPERNET_3 */
  496. void smt_start_watchdog(struct s_smc *smc);
  497. void smt_event(struct s_smc *smc, int event);
  498. void timer_event(struct s_smc *smc, u_long token);
  499. void ev_dispatcher(struct s_smc *smc);
  500. void pcm_get_state(struct s_smc *smc, struct smt_state *state);
  501. void ecm_state_change(struct s_smc *smc, int e_state);
  502. int sm_pm_bypass_present(struct s_smc *smc);
  503. void pcm_state_change(struct s_smc *smc, int plc, int p_state);
  504. void rmt_state_change(struct s_smc *smc, int r_state);
  505. int sm_pm_get_ls(struct s_smc *smc, int phy);
  506. int pcm_get_s_port(struct s_smc *smc);
  507. int pcm_rooted_station(struct s_smc *smc);
  508. int cfm_get_mac_input(struct s_smc *smc);
  509. int cfm_get_mac_output(struct s_smc *smc);
  510. int cem_build_path(struct s_smc *smc, char *to, int path_index);
  511. int sm_mac_get_tx_state(struct s_smc *smc);
  512. char *get_pcmstate(struct s_smc *smc, int np);
  513. int smt_action(struct s_smc *smc, int class, int code, int index);
  514. u_short smt_online(struct s_smc *smc, int on);
  515. void smt_force_irq(struct s_smc *smc);
  516. void smt_pmf_received_pack(struct s_smc *smc, SMbuf *mb, int local);
  517. void smt_send_frame(struct s_smc *smc, SMbuf *mb, int fc, int local);
  518. void smt_set_timestamp(struct s_smc *smc, u_char *p);
  519. void mac_set_rx_mode(struct s_smc *smc, int mode);
  520. int mac_add_multicast(struct s_smc *smc, struct fddi_addr *addr, int can);
  521. void mac_update_multicast(struct s_smc *smc);
  522. void mac_clear_multicast(struct s_smc *smc);
  523. void set_formac_tsync(struct s_smc *smc, long sync_bw);
  524. void formac_reinit_tx(struct s_smc *smc);
  525. void formac_tx_restart(struct s_smc *smc);
  526. void process_receive(struct s_smc *smc);
  527. void init_driver_fplus(struct s_smc *smc);
  528. void rtm_irq(struct s_smc *smc);
  529. void rtm_set_timer(struct s_smc *smc);
  530. void ring_status_indication(struct s_smc *smc, u_long status);
  531. void llc_recover_tx(struct s_smc *smc);
  532. void llc_restart_tx(struct s_smc *smc);
  533. void plc_clear_irq(struct s_smc *smc, int p);
  534. void plc_irq(struct s_smc *smc, int np, unsigned int cmd);
  535. int smt_set_mac_opvalues(struct s_smc *smc);
  536. #ifdef TAG_MODE
  537. void mac_do_pci_fix(struct s_smc *smc);
  538. void mac_drv_clear_tx_queue(struct s_smc *smc);
  539. void mac_drv_repair_descr(struct s_smc *smc);
  540. u_long hwt_quick_read(struct s_smc *smc);
  541. void hwt_wait_time(struct s_smc *smc, u_long start, long duration);
  542. #endif
  543. #ifdef SMT_PNMI
  544. int pnmi_init(struct s_smc* smc);
  545. int pnmi_process_ndis_id(struct s_smc *smc, u_long ndis_oid, void *buf, int len,
  546. int *BytesAccessed, int *BytesNeeded, u_char action);
  547. #endif
  548. #ifdef SBA
  549. #ifndef _H2INC
  550. void sba();
  551. #endif
  552. void sba_raf_received_pack();
  553. void sba_timer_poll();
  554. void smt_init_sba();
  555. #endif
  556. #ifdef ESS
  557. int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm,
  558. int fs);
  559. void ess_timer_poll(struct s_smc *smc);
  560. void ess_para_change(struct s_smc *smc);
  561. #endif
  562. #ifndef BOOT
  563. void smt_init_evc(struct s_smc *smc);
  564. void smt_srf_event(struct s_smc *smc, int code, int index, int cond);
  565. #else
  566. #define smt_init_evc(smc)
  567. #define smt_srf_event(smc,code,index,cond)
  568. #endif
  569. #ifndef SMT_REAL_TOKEN_CT
  570. void smt_emulate_token_ct(struct s_smc *smc, int mac_index);
  571. #endif
  572. #if defined(DEBUG) && !defined(BOOT)
  573. void dump_smt(struct s_smc *smc, struct smt_header *sm, char *text);
  574. #else
  575. #define dump_smt(smc,sm,text)
  576. #endif
  577. #ifdef DEBUG
  578. char* addr_to_string(struct fddi_addr *addr);
  579. void dump_hex(char *p, int len);
  580. #endif
  581. #endif /* PROTOTYP_INC */
  582. /* PNMI default defines */
  583. #ifndef PNMI_INIT
  584. #define PNMI_INIT(smc) /* Nothing */
  585. #endif
  586. #ifndef PNMI_GET_ID
  587. #define PNMI_GET_ID( smc, ndis_oid, buf, len, BytesWritten, BytesNeeded ) \
  588. ( 1 ? (-1) : (-1) )
  589. #endif
  590. #ifndef PNMI_SET_ID
  591. #define PNMI_SET_ID( smc, ndis_oid, buf, len, BytesRead, BytesNeeded, \
  592. set_type) ( 1 ? (-1) : (-1) )
  593. #endif
  594. /*
  595. * SMT_PANIC defines
  596. */
  597. #ifndef SMT_PANIC
  598. #define SMT_PANIC(smc,nr,msg) smt_panic (smc, msg)
  599. #endif
  600. #ifndef SMT_ERR_LOG
  601. #define SMT_ERR_LOG(smc,nr,msg) SMT_PANIC (smc, nr, msg)
  602. #endif
  603. #ifndef SMT_EBASE
  604. #define SMT_EBASE 100
  605. #endif
  606. #define SMT_E0100 SMT_EBASE + 0
  607. #define SMT_E0100_MSG "cfm FSM: invalid ce_type"
  608. #define SMT_E0101 SMT_EBASE + 1
  609. #define SMT_E0101_MSG "CEM: case ???"
  610. #define SMT_E0102 SMT_EBASE + 2
  611. #define SMT_E0102_MSG "CEM A: invalid state"
  612. #define SMT_E0103 SMT_EBASE + 3
  613. #define SMT_E0103_MSG "CEM B: invalid state"
  614. #define SMT_E0104 SMT_EBASE + 4
  615. #define SMT_E0104_MSG "CEM M: invalid state"
  616. #define SMT_E0105 SMT_EBASE + 5
  617. #define SMT_E0105_MSG "CEM S: invalid state"
  618. #define SMT_E0106 SMT_EBASE + 6
  619. #define SMT_E0106_MSG "CFM : invalid state"
  620. #define SMT_E0107 SMT_EBASE + 7
  621. #define SMT_E0107_MSG "ECM : invalid state"
  622. #define SMT_E0108 SMT_EBASE + 8
  623. #define SMT_E0108_MSG "prop_actions : NAC in DAS CFM"
  624. #define SMT_E0109 SMT_EBASE + 9
  625. #define SMT_E0109_MSG "ST2U.FM_SERRSF error in special frame"
  626. #define SMT_E0110 SMT_EBASE + 10
  627. #define SMT_E0110_MSG "ST2U.FM_SRFRCTOV recv. count. overflow"
  628. #define SMT_E0111 SMT_EBASE + 11
  629. #define SMT_E0111_MSG "ST2U.FM_SNFSLD NP & FORMAC simult. load"
  630. #define SMT_E0112 SMT_EBASE + 12
  631. #define SMT_E0112_MSG "ST2U.FM_SRCVFRM single-frame recv.-mode"
  632. #define SMT_E0113 SMT_EBASE + 13
  633. #define SMT_E0113_MSG "FPLUS: Buffer Memory Error"
  634. #define SMT_E0114 SMT_EBASE + 14
  635. #define SMT_E0114_MSG "ST2U.FM_SERRSF error in special frame"
  636. #define SMT_E0115 SMT_EBASE + 15
  637. #define SMT_E0115_MSG "ST3L: parity error in receive queue 2"
  638. #define SMT_E0116 SMT_EBASE + 16
  639. #define SMT_E0116_MSG "ST3L: parity error in receive queue 1"
  640. #define SMT_E0117 SMT_EBASE + 17
  641. #define SMT_E0117_MSG "E_SMT_001: RxD count for receive queue 1 = 0"
  642. #define SMT_E0118 SMT_EBASE + 18
  643. #define SMT_E0118_MSG "PCM : invalid state"
  644. #define SMT_E0119 SMT_EBASE + 19
  645. #define SMT_E0119_MSG "smt_add_para"
  646. #define SMT_E0120 SMT_EBASE + 20
  647. #define SMT_E0120_MSG "smt_set_para"
  648. #define SMT_E0121 SMT_EBASE + 21
  649. #define SMT_E0121_MSG "invalid event in dispatcher"
  650. #define SMT_E0122 SMT_EBASE + 22
  651. #define SMT_E0122_MSG "RMT : invalid state"
  652. #define SMT_E0123 SMT_EBASE + 23
  653. #define SMT_E0123_MSG "SBA: state machine has invalid state"
  654. #define SMT_E0124 SMT_EBASE + 24
  655. #define SMT_E0124_MSG "sba_free_session() called with NULL pointer"
  656. #define SMT_E0125 SMT_EBASE + 25
  657. #define SMT_E0125_MSG "SBA : invalid session pointer"
  658. #define SMT_E0126 SMT_EBASE + 26
  659. #define SMT_E0126_MSG "smt_free_mbuf() called with NULL pointer\n"
  660. #define SMT_E0127 SMT_EBASE + 27
  661. #define SMT_E0127_MSG "sizeof evcs"
  662. #define SMT_E0128 SMT_EBASE + 28
  663. #define SMT_E0128_MSG "evc->evc_cond_state = 0"
  664. #define SMT_E0129 SMT_EBASE + 29
  665. #define SMT_E0129_MSG "evc->evc_multiple = 0"
  666. #define SMT_E0130 SMT_EBASE + 30
  667. #define SMT_E0130_MSG write_mdr_warning
  668. #define SMT_E0131 SMT_EBASE + 31
  669. #define SMT_E0131_MSG cam_warning
  670. #define SMT_E0132 SMT_EBASE + 32
  671. #define SMT_E0132_MSG "ST1L.FM_SPCEPDx parity/coding error"
  672. #define SMT_E0133 SMT_EBASE + 33
  673. #define SMT_E0133_MSG "ST1L.FM_STBURx tx buffer underrun"
  674. #define SMT_E0134 SMT_EBASE + 34
  675. #define SMT_E0134_MSG "ST1L.FM_SPCEPDx parity error"
  676. #define SMT_E0135 SMT_EBASE + 35
  677. #define SMT_E0135_MSG "RMT: duplicate MAC address detected. Ring left!"
  678. #define SMT_E0136 SMT_EBASE + 36
  679. #define SMT_E0136_MSG "Elasticity Buffer hang-up"
  680. #define SMT_E0137 SMT_EBASE + 37
  681. #define SMT_E0137_MSG "SMT: queue overrun"
  682. #define SMT_E0138 SMT_EBASE + 38
  683. #define SMT_E0138_MSG "RMT: duplicate MAC address detected. Ring NOT left!"
  684. #endif /* _CMTDEF_ */