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