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