#ifndef _SCMECM_
#define _SCMECM_
#if defined(PCI) && !defined(OSDEF)
#define OSDEF
#endif
#ifdef PCI
#ifndef SUPERNET_3
#define SUPERNET_3
#endif
#ifndef TAG_MODE
#define TAG_MODE
#endif
#endif
#ifdef OSDEF
#include "osdef1st.h"
#endif /* OSDEF */
#ifdef OEM_CONCEPT
#include "oemdef.h"
#endif /* OEM_CONCEPT */
#include "smt.h"
#include "cmtdef.h"
#include "fddimib.h"
#include "targethw.h" /* all target hw dependencies */
#include "targetos.h" /* all target os dependencies */
#ifdef ESS
#include "sba.h"
#endif
struct event_queue {
u_short class ;
u_short event ;
} ;
#ifdef CONCENTRATOR
#define MAX_EVENT 128
#else /* nCONCENTRATOR */
#define MAX_EVENT 64
#endif /* nCONCENTRATOR */
struct s_queue {
struct event_queue ev_queue[MAX_EVENT];
struct event_queue *ev_put ;
struct event_queue *ev_get ;
} ;
struct s_ecm {
u_char path_test ;
u_char sb_flag ;
u_char DisconnectFlag ;
u_char ecm_line_state ;
u_long trace_prop ;
char ec_pad[2] ;
struct smt_timer ecm_timer ;
} ;
struct s_rmt {
u_char dup_addr_test ;
u_char da_flag ;
u_char loop_avail ;
u_char sm_ma_avail ;
u_char no_flag ;
u_char bn_flag ;
u_char jm_flag ;
u_char rm_join ;
u_char rm_loop ;
long fast_rm_join ;
struct smt_timer rmt_timer0 ;
struct smt_timer rmt_timer1 ;
struct smt_timer rmt_timer2 ;
u_char timer0_exp ;
u_char timer1_exp ;
u_char timer2_exp ;
u_char rm_pad1;
} ;
struct s_cfm {
u_char cf_state;
u_char cf_pad[3] ;
} ;
#ifdef CONCENTRATOR
struct s_cem {
int ce_state ;
int ce_port ;
int ce_type ;
} ;
struct s_c_ring {
struct s_c_ring *c_next ;
char c_entity ;
} ;
struct mib_path_config {
u_long fddimibPATHConfigSMTIndex;
u_long fddimibPATHConfigPATHIndex;
u_long fddimibPATHConfigTokenOrder;
u_long fddimibPATHConfigResourceType;
#define SNMP_RES_TYPE_MAC 2 /* Resource is a MAC */
#define SNMP_RES_TYPE_PORT 4 /* Resource is a PORT */
u_long fddimibPATHConfigResourceIndex;
u_long fddimibPATHConfigCurrentPath;
#define SNMP_PATH_ISOLATED 1 /* Current path is isolated */
#define SNMP_PATH_LOCAL 2 /* Current path is local */
#define SNMP_PATH_SECONDARY 3 /* Current path is secondary */
#define SNMP_PATH_PRIMARY 4 /* Current path is primary */
#define SNMP_PATH_CONCATENATED 5 /* Current path is concatenated */
#define SNMP_PATH_THRU 6 /* Current path is thru */
};
#endif
#define PCM_DISABLED 0
#define PCM_CONNECTING 1
#define PCM_STANDBY 2
#define PCM_ACTIVE 3
struct s_pcm {
u_char pcm_pad[3] ;
} ;
struct s_phy {
struct fddi_mib_p *mib ;
u_char np ;
u_char cf_join ;
u_char cf_loop ;
u_char wc_flag ;
u_char pc_mode ;
u_char pc_lem_fail ;
u_char lc_test ;
u_char scrub ;
char phy_name ;
u_char pmd_type[2] ;
#define PMD_SK_CONN 0 /* pmd_type[PMD_SK_CONN] = Connector */
#define PMD_SK_PMD 1 /* pmd_type[PMD_SK_PMD] = Xver */
u_char pmd_scramble ;
u_char curr_ls ;
u_char ls_flag ;
u_char rc_flag ;
u_char tc_flag ;
u_char td_flag ;
u_char bitn ;
u_char tr_flag ;
u_char twisted ;
u_char t_val[NUMBITS] ;
u_char r_val[NUMBITS] ;
u_long t_next[NUMBITS] ;
struct smt_timer pcm_timer0 ;
struct smt_timer pcm_timer1 ;
struct smt_timer pcm_timer2 ;
u_char timer0_exp ;
u_char timer1_exp ;
u_char timer2_exp ;
u_char pcm_pad1[1] ;
int cem_pst ;
struct lem_counter lem ;
#ifdef AMDPLC
struct s_plc plc ;
#endif
} ;
struct s_timer {
struct smt_timer *st_queue ;
struct smt_timer st_fast ;
} ;
#define SMT_EVENT_BASE 1
#define SMT_EVENT_MAC_PATH_CHANGE (SMT_EVENT_BASE+0)
#define SMT_EVENT_MAC_NEIGHBOR_CHANGE (SMT_EVENT_BASE+1)
#define SMT_EVENT_PORT_PATH_CHANGE (SMT_EVENT_BASE+2)
#define SMT_EVENT_PORT_CONNECTION (SMT_EVENT_BASE+3)
#define SMT_IS_CONDITION(x) ((x)>=SMT_COND_BASE)
#define SMT_COND_BASE (SMT_EVENT_PORT_CONNECTION+1)
#define SMT_COND_SMT_PEER_WRAP (SMT_COND_BASE+0)
#define SMT_COND_SMT_HOLD (SMT_COND_BASE+1)
#define SMT_COND_MAC_FRAME_ERROR (SMT_COND_BASE+2)
#define SMT_COND_MAC_DUP_ADDR (SMT_COND_BASE+3)
#define SMT_COND_MAC_NOT_COPIED (SMT_COND_BASE+4)
#define SMT_COND_PORT_EB_ERROR (SMT_COND_BASE+5)
#define SMT_COND_PORT_LER (SMT_COND_BASE+6)
#define SR0_WAIT 0
#define SR1_HOLDOFF 1
#define SR2_DISABLED 2
struct s_srf {
u_long SRThreshold ;
u_char RT_Flag ;
u_char sr_state ;
u_char any_report ;
u_long TSR ;
u_short ring_status ;
} ;
#define RS_RES15 (1<<15) /* reserved */
#define RS_HARDERROR (1<<14) /* ring down */
#define RS_SOFTERROR (1<<13) /* sent SRF */
#define RS_BEACON (1<<12) /* transmitted beacon */
#define RS_PATHTEST (1<<11) /* path test failed */
#define RS_SELFTEST (1<<10) /* selftest required */
#define RS_RES9 (1<< 9) /* reserved */
#define RS_DISCONNECT (1<< 8) /* remote disconnect */
#define RS_RES7 (1<< 7) /* reserved */
#define RS_DUPADDR (1<< 6) /* duplicate address */
#define RS_NORINGOP (1<< 5) /* no ring op */
#define RS_VERSION (1<< 4) /* SMT version mismatch */
#define RS_STUCKBYPASSS (1<< 3) /* stuck bypass */
#define RS_EVENT (1<< 2) /* FDDI event occurred */
#define RS_RINGOPCHANGE (1<< 1) /* ring op changed */
#define RS_RES0 (1<< 0) /* reserved */
#define RS_SET(smc,bit) \
ring_status_indication(smc,smc->srf.ring_status |= bit)
#define RS_CLEAR(smc,bit) \
ring_status_indication(smc,smc->srf.ring_status &= ~bit)
#define RS_CLEAR_EVENT (0xffff & ~(RS_NORINGOP))
#ifndef AIX_EVENT
#define AIX_EVENT(smc,opt0,opt1,opt2,opt3) /* nothing */
#endif
struct s_srf_evc {
u_char evc_code ;
u_char evc_index ;
u_char evc_rep_required ;
u_short evc_para ;
u_char *evc_cond_state ;
u_char *evc_multiple ;
} ;
#define SMT_MAX_TEST 5
#define SMT_TID_NIF 0 /* pending NIF request */
#define SMT_TID_NIF_TEST 1 /* pending NIF test */
#define SMT_TID_ECF_UNA 2 /* pending ECF UNA test */
#define SMT_TID_ECF_DNA 3 /* pending ECF DNA test */
#define SMT_TID_ECF 4 /* pending ECF test */
struct smt_values {
u_long smt_tvu ;
u_long smt_tvd ;
u_long smt_tid ;
u_long pend[SMT_MAX_TEST] ;
u_long uniq_time ;
u_short uniq_ticks ;
u_short please_reconnect ;
u_long smt_last_lem ;
u_long smt_last_notify ;
struct smt_timer smt_timer ;
u_long last_tok_time[NUMMACS];
} ;
#define SMT_DAS 0 /* dual attach */
#define SMT_SAS 1 /* single attach */
#define SMT_NAC 2 /* null attach concentrator */
struct smt_config {
u_char attach_s ;
u_char sas ;
u_char build_ring_map ;
u_char numphys ;
u_char sc_pad[1] ;
u_long pcm_tb_min ;
u_long pcm_tb_max ;
u_long pcm_c_min ;
u_long pcm_t_out ;
u_long pcm_tl_min ;
u_long pcm_lc_short ;
u_long pcm_lc_medium ;
u_long pcm_lc_long ;
u_long pcm_lc_extended ;
u_long pcm_t_next_9 ;
u_long pcm_ns_max ;
u_long ecm_i_max ;
u_long ecm_in_max ;
u_long ecm_td_min ;
u_long ecm_test_done ;
u_long ecm_check_poll ;
u_long rmt_t_non_op ;
u_long rmt_t_stuck ;
u_long rmt_t_direct ;
u_long rmt_t_jam ;
u_long rmt_t_announce ;
u_long rmt_t_poll ;
u_long rmt_dup_mac_behavior ;
u_long mac_d_max ;
u_long lct_short ;
u_long lct_medium ;
u_long lct_long ;
u_long lct_extended ;
} ;
#ifdef DEBUG
struct smt_debug {
int d_smtf ;
int d_smt ;
int d_ecm ;
int d_rmt ;
int d_cfm ;
int d_pcm ;
int d_plc ;
#ifdef ESS
int d_ess ;
#endif
#ifdef SBA
int d_sba ;
#endif
struct os_debug d_os;
} ;
#ifndef DEBUG_BRD
extern struct smt_debug debug;
#endif /* DEBUG_BRD */
#endif /* DEBUG */
struct s_smc {
struct s_smt_os os ;
struct s_smt_hw hw ;
struct smt_config s ;
struct smt_values sm ;
struct s_ecm e ;
struct s_rmt r ;
struct s_cfm cf ;
#ifdef CONCENTRATOR
struct s_cem ce[NUMPHYS] ;
struct s_c_ring cr[NUMPHYS+NUMMACS] ;
#endif
struct s_pcm p ;
struct s_phy y[NUMPHYS] ;
struct s_queue q ;
struct s_timer t ;
struct s_srf srf ;
struct s_srf_evc evcs[6+NUMPHYS*4] ;
struct fddi_mib mib ;
#ifdef SBA
struct s_sba sba ;
#endif
#ifdef ESS
struct s_ess ess ;
#endif
#if defined(DEBUG) && defined(DEBUG_BRD)
struct smt_debug debug;
#endif /* DEBUG_BRD && DEBUG */
} ;
extern const struct fddi_addr fddi_broadcast;
void all_selection_criteria(struct s_smc *smc);
void card_stop(struct s_smc *smc);
void init_board(struct s_smc *smc, u_char *mac_addr);
int init_fplus(struct s_smc *smc);
void init_plc(struct s_smc *smc);
int init_smt(struct s_smc *smc, const u_char *mac_addr);
void mac1_irq(struct s_smc *smc, u_short stu, u_short stl);
void mac2_irq(struct s_smc *smc, u_short code_s2u, u_short code_s2l);
void mac3_irq(struct s_smc *smc, u_short code_s3u, u_short code_s3l);
int pcm_status_twisted(struct s_smc *smc);
void plc1_irq(struct s_smc *smc);
void plc2_irq(struct s_smc *smc);
void read_address(struct s_smc *smc, u_char *mac_addr);
void timer_irq(struct s_smc *smc);
#endif /* _SCMECM_ */