cmtdef.h 22 KB

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