linux/drivers/net/fddi/skfp/h/cmtdef.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/******************************************************************************
 *
 *	(C)Copyright 1998,1999 SysKonnect,
 *	a business unit of Schneider & Koch & Co. Datensysteme GmbH.
 *
 *	The information in this file is provided "AS IS" without warranty.
 *
 ******************************************************************************/

#ifndef	_CMTDEF_
#define _CMTDEF_

/* **************************************************************** */

/*
 * implementation specific constants
 * MODIIFY THE FOLLOWING THREE DEFINES
 */
#define AMDPLC
#ifdef	CONC
#define NUMPHYS
#else
#ifdef	CONC_II
#define NUMPHYS
#else
#define NUMPHYS
#endif
#endif
#define NUMMACS
#define NUMPATHS

/*
 * DO NOT MODIFY BEYOND THIS POINT
 */

/* **************************************************************** */

#if	NUMPHYS > 2
#define CONCENTRATOR
#endif

/*
 * Definitions for comfortable LINT usage
 */
#ifdef	lint
#define LINT_USE
#else
#define LINT_USE(x)
#endif

#ifdef	DEBUG
#define DB_PR
#else
#define DB_PR(flag, fmt, ...)

#endif

#ifdef DEBUG_BRD
#define DB_TEST
#else
#define DB_TEST
#endif

#define DB_ECM(fmt, ...)
#define DB_ECMN(n, fmt, ...)
#define DB_RMT(fmt, ...)
#define DB_RMTN(n, fmt, ...)
#define DB_CFM(fmt, ...)
#define DB_CFMN(n, fmt, ...)
#define DB_PCM(fmt, ...)
#define DB_PCMN(n, fmt, ...)
#define DB_SMT(fmt, ...)
#define DB_SMTN(n, fmt, ...)
#define DB_SBA(fmt, ...)
#define DB_SBAN(n, fmt, ...)
#define DB_ESS(fmt, ...)
#define DB_ESSN(n, fmt, ...)

#ifndef	SS_NOT_DS
#define SK_LOC_DECL(type,var)
#else
#define SK_LOC_DECL
#endif
/*
 * PHYs and PORTS
 * Note: Don't touch the definition of PA and PB. Those might be used
 *	by some "for" loops.
 */
#define PA
#define PB
#if	defined(SUPERNET_3) || defined(CONC_II)
/*
 * The port indices have to be different,
 * because the MAC output goes through the 2. PLC
 * Conc II: It has to be the first port in the row.
 */
#define PS
#else
#define PS
#endif
#define PM

/*
 * PHY types - as in path descriptor 'fddiPHYType'
 */
#define TA
#define TB
#define TS
#define TM
#define TNONE


/*
 * indexes in MIB
 */
#define INDEX_MAC
#define INDEX_PATH
#define INDEX_PORT


/*
 * policies
 */
#define POLICY_AA
#define POLICY_AB
#define POLICY_AS
#define POLICY_AM
#define POLICY_BA
#define POLICY_BB
#define POLICY_BS
#define POLICY_BM
#define POLICY_SA
#define POLICY_SB
#define POLICY_SS
#define POLICY_SM
#define POLICY_MA
#define POLICY_MB
#define POLICY_MS
#define POLICY_MM

/*
 * commands
 */

/*
 * EVENTS
 * event classes
 */
#define EVENT_ECM
#define EVENT_CFM
#define EVENT_RMT
#define EVENT_SMT
#define EVENT_PCM
#define EVENT_PCMA
#define EVENT_PCMB

/* WARNING :
 * EVENT_PCM* must be last in the above list
 * if more than two ports are used, EVENT_PCM .. EVENT_PCMA+NUM_PHYS-1
 * are used !
 */

#define EV_TOKEN(class,event)
#define EV_T_CLASS(token)
#define EV_T_EVENT(token)

/*
 * ECM events
 */
#define EC_CONNECT
#define EC_DISCONNECT
#define EC_TRACE_PROP
#define EC_PATH_TEST
#define EC_TIMEOUT_TD
#define EC_TIMEOUT_TMAX
#define EC_TIMEOUT_IMAX
#define EC_TIMEOUT_INMAX
#define EC_TEST_DONE

/*
 * CFM events
 */
#define CF_LOOP
#define CF_LOOP_A
#define CF_LOOP_B
#define CF_JOIN
#define CF_JOIN_A
#define CF_JOIN_B

/*
 * PCM events
 */
#define PC_START
#define PC_STOP
#define PC_LOOP
#define PC_JOIN
#define PC_SIGNAL
#define PC_REJECT
#define PC_MAINT
#define PC_TRACE
#define PC_PDR
#define PC_ENABLE
#define PC_DISABLE

/*
 * must be ordered as in LineStateType
 */
#define PC_QLS
#define PC_ILS
#define PC_MLS
#define PC_HLS
#define PC_LS_PDR
#define PC_LS_NONE
#define LS2MIB(x)
#define MIB2LS(x)

#define PC_TIMEOUT_TB_MAX
#define PC_TIMEOUT_TB_MIN
#define PC_TIMEOUT_C_MIN
#define PC_TIMEOUT_T_OUT
#define PC_TIMEOUT_TL_MIN
#define PC_TIMEOUT_T_NEXT
#define PC_TIMEOUT_LCT
#define PC_NSE
#define PC_LEM

/*
 * RMT events				  meaning		from
 */
#define RM_RING_OP
#define RM_RING_NON_OP
#define RM_MY_BEACON
#define RM_OTHER_BEACON
#define RM_MY_CLAIM
#define RM_TRT_EXP
#define RM_VALID_CLAIM
#define RM_JOIN
#define RM_LOOP
#define RM_DUP_ADDR
#define RM_ENABLE_FLAG

#define RM_TIMEOUT_NON_OP
#define RM_TIMEOUT_T_STUCK
#define RM_TIMEOUT_ANNOUNCE
#define RM_TIMEOUT_T_DIRECT
#define RM_TIMEOUT_D_MAX
#define RM_TIMEOUT_POLL
#define RM_TX_STATE_CHANGE

/*
 * SMT events
 */
#define SM_TIMER
#define SM_FAST

/* PC modes */
#define PM_NONE
#define PM_PEER
#define PM_TREE

/*
 * PCM withhold codes
 * MIB PC-WithholdType ENUM
 */
#define PC_WH_NONE
#define PC_WH_M_M
#define PC_WH_OTHER
#define PC_WH_PATH
/*
 * LCT duration
 */
#define LC_SHORT
#define LC_MEDIUM
#define LC_LONG
#define LC_EXTENDED

/*
 * path_test values
 */
#define PT_NONE
#define PT_TESTING
#define PT_PASSED
#define PT_FAILED
#define PT_PENDING
#define PT_EXITING

/*
 * duplicate address test
 * MIB DupAddressTest ENUM
 */
#define DA_NONE
#define DA_PASSED
#define DA_FAILED


/*
 * optical bypass
 */
#define BP_DEINSERT
#define BP_INSERT

/*
 * ODL enable/disable
 */
#define PM_TRANSMIT_DISABLE
#define PM_TRANSMIT_ENABLE

/*
 * parameter for config_mux
 * note : number is index in config_endec table !
 */
#define MUX_THRUA
#define MUX_THRUB
#define MUX_WRAPA
#define MUX_WRAPB
#define MUX_ISOLATE
#define MUX_WRAPS

/*
 * MAC control
 */
#define MA_RESET
#define MA_BEACON
#define MA_CLAIM
#define MA_DIRECTED
#define MA_TREQ
#define MA_OFFLINE


/*
 * trace prop
 * bit map for trace propagation
 */
#define ENTITY_MAC
#define ENTITY_PHY(p)
#define ENTITY_BIT(m)

/*
 * Resource Tag Types
 */
#define PATH_ISO
#define PATH_PRIM
#define PATH_THRU

#define RES_MAC
#define RES_PORT


/*
 * CFM state
 * oops: MUST MATCH CF-StateType in SMT7.2 !
 */
#define SC0_ISOLATED
#define SC1_WRAP_A
#define SC2_WRAP_B
#define SC4_THRU_A
#define SC5_THRU_B
#define SC7_WRAP_S
#define SC9_C_WRAP_A
#define SC10_C_WRAP_B
#define SC11_C_WRAP_S

/*
 * convert MIB time in units of 80nS to uS
 */
#define MIB2US(t)
#define SEC2MIB(s)
/*
 * SMT timer
 */
struct smt_timer {} ;

/*
 * communication structures
 */
struct mac_parameter {} ;

/*
 * MAC counters
 */
struct mac_counter {} ;

/*
 * para struct context for SMT parameters
 */
struct s_pcon {} ;

/*
 * link error monitor
 */
#define LEM_AVG
struct lem_counter {} ;

#define NUMBITS

#ifdef	AMDPLC

/*
 * PLC state table
 */
struct s_plc {} ;
#endif

#ifdef	PROTOTYP_INC
#include "fddi/driver.pro"
#else	/* PROTOTYP_INC */
/*
 * function prototypes
 */
#include "mbuf.h"	/* Type definitions for MBUFs */
#include "smtstate.h"	/* struct smt_state */

void hwt_restart(struct s_smc *smc);	/* hwt.c */
SMbuf *smt_build_frame(struct s_smc *smc, int class, int type,
		       int length);	/* smt.c */
SMbuf *smt_get_mbuf(struct s_smc *smc);	/* drvsr.c */
void *sm_to_para(struct s_smc *smc, struct smt_header *sm,
		 int para);		/* smt.c */

#ifndef SK_UNUSED
#define SK_UNUSED(var)
#endif

void queue_event(struct s_smc *smc, int class, int event);
void ecm(struct s_smc *smc, int event);
void ecm_init(struct s_smc *smc);
void rmt(struct s_smc *smc, int event);
void rmt_init(struct s_smc *smc);
void pcm(struct s_smc *smc, const int np, int event);
void pcm_init(struct s_smc *smc);
void cfm(struct s_smc *smc, int event);
void cfm_init(struct s_smc *smc);
void smt_timer_start(struct s_smc *smc, struct smt_timer *timer, u_long time,
		     u_long token);
void smt_timer_stop(struct s_smc *smc, struct smt_timer *timer);
void pcm_status_state(struct s_smc *smc, int np, int *type, int *state,
		      int *remote, int *mac);
void plc_config_mux(struct s_smc *smc, int mux);
void sm_lem_evaluate(struct s_smc *smc);
void mac_update_counter(struct s_smc *smc);
void sm_ma_control(struct s_smc *smc, int mode);
void sm_mac_check_beacon_claim(struct s_smc *smc);
void config_mux(struct s_smc *smc, int mux);
void smt_agent_init(struct s_smc *smc);
void smt_timer_init(struct s_smc *smc);
void smt_received_pack(struct s_smc *smc, SMbuf *mb, int fs);
void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
		  int index, int local);
void smt_swap_para(struct smt_header *sm, int len, int direction);
void ev_init(struct s_smc *smc);
void hwt_init(struct s_smc *smc);
u_long hwt_read(struct s_smc *smc);
void hwt_stop(struct s_smc *smc);
void hwt_start(struct s_smc *smc, u_long time);
void smt_send_mbuf(struct s_smc *smc, SMbuf *mb, int fc);
void smt_free_mbuf(struct s_smc *smc, SMbuf *mb);
void sm_pm_bypass_req(struct s_smc *smc, int mode);
void rmt_indication(struct s_smc *smc, int i);
void cfm_state_change(struct s_smc *smc, int c_state);

#if defined(DEBUG) || !defined(NO_SMT_PANIC)
void smt_panic(struct s_smc *smc, char *text);
#else
#define smt_panic
#endif /* DEBUG || !NO_SMT_PANIC */

void smt_stat_counter(struct s_smc *smc, int stat);
void smt_timer_poll(struct s_smc *smc);
u_long smt_get_time(void);
u_long smt_get_tid(struct s_smc *smc);
void smt_timer_done(struct s_smc *smc);
void smt_fixup_mib(struct s_smc *smc);
void smt_reset_defaults(struct s_smc *smc, int level);
void smt_agent_task(struct s_smc *smc);
int smt_check_para(struct s_smc *smc, struct smt_header *sm,
		   const u_short list[]);
void driver_get_bia(struct s_smc *smc, struct fddi_addr *bia_addr);

#ifdef SUPERNET_3
void drv_reset_indication(struct s_smc *smc);
#endif	/* SUPERNET_3 */

void smt_start_watchdog(struct s_smc *smc);
void smt_event(struct s_smc *smc, int event);
void timer_event(struct s_smc *smc, u_long token);
void ev_dispatcher(struct s_smc *smc);
void pcm_get_state(struct s_smc *smc, struct smt_state *state);
void ecm_state_change(struct s_smc *smc, int e_state);
int sm_pm_bypass_present(struct s_smc *smc);
void pcm_state_change(struct s_smc *smc, int plc, int p_state);
void rmt_state_change(struct s_smc *smc, int r_state);
int sm_pm_get_ls(struct s_smc *smc, int phy);
int pcm_get_s_port(struct s_smc *smc);
int pcm_rooted_station(struct s_smc *smc);
int cfm_get_mac_input(struct s_smc *smc);
int cfm_get_mac_output(struct s_smc *smc);
int cem_build_path(struct s_smc *smc, char *to, int path_index);
int sm_mac_get_tx_state(struct s_smc *smc);
char *get_pcmstate(struct s_smc *smc, int np);
int smt_action(struct s_smc *smc, int class, int code, int index);
u_short smt_online(struct s_smc *smc, int on);
void smt_force_irq(struct s_smc *smc);
void smt_pmf_received_pack(struct s_smc *smc, SMbuf *mb, int local);
void smt_send_frame(struct s_smc *smc, SMbuf *mb, int fc, int local);
void smt_set_timestamp(struct s_smc *smc, u_char *p);
void mac_set_rx_mode(struct s_smc *smc,	int mode);
int mac_add_multicast(struct s_smc *smc, struct fddi_addr *addr, int can);
void mac_update_multicast(struct s_smc *smc);
void mac_clear_multicast(struct s_smc *smc);
void set_formac_tsync(struct s_smc *smc, long sync_bw);
void formac_reinit_tx(struct s_smc *smc);
void formac_tx_restart(struct s_smc *smc);
void process_receive(struct s_smc *smc);
void init_driver_fplus(struct s_smc *smc);
void rtm_irq(struct s_smc *smc);
void rtm_set_timer(struct s_smc *smc);
void ring_status_indication(struct s_smc *smc, u_long status);
void llc_recover_tx(struct s_smc *smc);
void llc_restart_tx(struct s_smc *smc);
void plc_clear_irq(struct s_smc *smc, int p);
void plc_irq(struct s_smc *smc,	int np,	unsigned int cmd);
int smt_set_mac_opvalues(struct s_smc *smc);

#ifdef TAG_MODE
void mac_do_pci_fix(struct s_smc *smc);
void mac_drv_clear_tx_queue(struct s_smc *smc);
void mac_drv_repair_descr(struct s_smc *smc);
u_long hwt_quick_read(struct s_smc *smc);
void hwt_wait_time(struct s_smc *smc, u_long start, long duration);
#endif

#ifdef SMT_PNMI
int pnmi_init(struct s_smc* smc);
int pnmi_process_ndis_id(struct s_smc *smc, u_long ndis_oid, void *buf, int len,
			 int *BytesAccessed, int *BytesNeeded, u_char action);
#endif

#ifdef	SBA
#ifndef _H2INC
void sba();
#endif
void sba_raf_received_pack();
void sba_timer_poll();
void smt_init_sba();
#endif

#ifdef	ESS
int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm,
			  int fs);
void ess_timer_poll(struct s_smc *smc);
void ess_para_change(struct s_smc *smc);
#endif

#ifndef	BOOT
void smt_init_evc(struct s_smc *smc);
void smt_srf_event(struct s_smc *smc, int code, int index, int cond);
#else
#define smt_init_evc
#define smt_srf_event
#endif

#ifndef SMT_REAL_TOKEN_CT
void smt_emulate_token_ct(struct s_smc *smc, int mac_index);
#endif

#if defined(DEBUG) && !defined(BOOT)
void dump_smt(struct s_smc *smc, struct smt_header *sm, char *text);
#else
#define dump_smt(smc,sm,text)
#endif

#ifdef	DEBUG
void dump_hex(char *p, int len);
#endif

#endif	/* PROTOTYP_INC */

/* PNMI default defines */
#ifndef PNMI_INIT
#define PNMI_INIT(smc)
#endif

/*
 * SMT_PANIC defines
 */
#ifndef	SMT_PANIC
#define SMT_PANIC
#endif

#ifndef	SMT_ERR_LOG
#define SMT_ERR_LOG(smc,nr,msg)
#endif

#ifndef	SMT_EBASE
#define SMT_EBASE
#endif

#define SMT_E0100
#define SMT_E0100_MSG
#define SMT_E0101
#define SMT_E0101_MSG
#define SMT_E0102
#define SMT_E0102_MSG
#define SMT_E0103
#define SMT_E0103_MSG
#define SMT_E0104
#define SMT_E0104_MSG
#define SMT_E0105
#define SMT_E0105_MSG
#define SMT_E0106
#define SMT_E0106_MSG
#define SMT_E0107
#define SMT_E0107_MSG
#define SMT_E0108
#define SMT_E0108_MSG
#define SMT_E0109
#define SMT_E0109_MSG
#define SMT_E0110
#define SMT_E0110_MSG
#define SMT_E0111
#define SMT_E0111_MSG
#define SMT_E0112
#define SMT_E0112_MSG
#define SMT_E0113
#define SMT_E0113_MSG
#define SMT_E0114
#define SMT_E0114_MSG
#define SMT_E0115
#define SMT_E0115_MSG
#define SMT_E0116
#define SMT_E0116_MSG
#define SMT_E0117
#define SMT_E0117_MSG
#define SMT_E0118
#define SMT_E0118_MSG
#define SMT_E0119
#define SMT_E0119_MSG
#define SMT_E0120
#define SMT_E0120_MSG
#define SMT_E0121
#define SMT_E0121_MSG
#define SMT_E0122
#define SMT_E0122_MSG
#define SMT_E0123
#define SMT_E0123_MSG
#define SMT_E0124
#define SMT_E0124_MSG
#define SMT_E0125
#define SMT_E0125_MSG
#define SMT_E0126
#define SMT_E0126_MSG
#define SMT_E0127
#define SMT_E0127_MSG
#define SMT_E0128
#define SMT_E0128_MSG
#define SMT_E0129
#define SMT_E0129_MSG
#define SMT_E0130
#define SMT_E0130_MSG
#define SMT_E0131
#define SMT_E0131_MSG
#define SMT_E0132
#define SMT_E0132_MSG
#define SMT_E0133
#define SMT_E0133_MSG
#define SMT_E0134
#define SMT_E0134_MSG
#define SMT_E0135
#define SMT_E0135_MSG
#define SMT_E0136
#define SMT_E0136_MSG
#define SMT_E0137
#define SMT_E0137_MSG
#define SMT_E0138
#define SMT_E0138_MSG
#endif	/* _CMTDEF_ */