Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /******************************************************************************
0003  *
0004  *  (C)Copyright 1998,1999 SysKonnect,
0005  *  a business unit of Schneider & Koch & Co. Datensysteme GmbH.
0006  *
0007  *  See the file "skfddi.c" for further information.
0008  *
0009  *  The information in this file is provided "AS IS" without warranty.
0010  *
0011  ******************************************************************************/
0012 
0013 /*
0014     Init SMT
0015     call all module level initialization routines
0016 */
0017 
0018 #include "h/types.h"
0019 #include "h/fddi.h"
0020 #include "h/smc.h"
0021 
0022 void init_fddi_driver(struct s_smc *smc, const u_char *mac_addr);
0023 
0024 /* define global debug variable */
0025 #if defined(DEBUG) && !defined(DEBUG_BRD)
0026 struct smt_debug debug;
0027 #endif
0028 
0029 #ifndef MULT_OEM
0030 #define OEMID(smc,i)    oem_id[i]
0031     extern u_char   oem_id[] ;
0032 #else   /* MULT_OEM */
0033 #define OEMID(smc,i)    smc->hw.oem_id->oi_mark[i]
0034     extern struct s_oem_ids oem_ids[] ;
0035 #endif  /* MULT_OEM */
0036 
0037 /*
0038  * Set OEM specific values
0039  *
0040  * Can not be called in smt_reset_defaults, because it is not sure that
0041  * the OEM ID is already defined.
0042  */
0043 static void set_oem_spec_val(struct s_smc *smc)
0044 {
0045     struct fddi_mib *mib ;
0046 
0047     mib = &smc->mib ;
0048 
0049     /*
0050      * set IBM specific values
0051      */
0052     if (OEMID(smc,0) == 'I') {
0053         mib->fddiSMTConnectionPolicy = POLICY_MM ;
0054     }
0055 }
0056 
0057 /*
0058  * Init SMT
0059  */
0060 int init_smt(struct s_smc *smc, const u_char *mac_addr)
0061 /* u_char *mac_addr;    canonical address or NULL */
0062 {
0063     int p ;
0064 
0065 #if defined(DEBUG) && !defined(DEBUG_BRD)
0066     debug.d_smt = 0 ;
0067     debug.d_smtf = 0 ;
0068     debug.d_rmt = 0 ;
0069     debug.d_ecm = 0 ;
0070     debug.d_pcm = 0 ;
0071     debug.d_cfm = 0 ;
0072 
0073     debug.d_plc = 0 ;
0074 #ifdef  ESS
0075     debug.d_ess = 0 ;
0076 #endif
0077 #ifdef  SBA
0078     debug.d_sba = 0 ;
0079 #endif
0080 #endif  /* DEBUG && !DEBUG_BRD */
0081 
0082     /* First initialize the ports mib->pointers */
0083     for ( p = 0; p < NUMPHYS; p ++ ) {
0084         smc->y[p].mib = & smc->mib.p[p] ;
0085     }
0086 
0087     set_oem_spec_val(smc) ; 
0088     (void) smt_set_mac_opvalues(smc) ;
0089     init_fddi_driver(smc,mac_addr) ;    /* HW driver */
0090     smt_fixup_mib(smc) ;        /* update values that depend on s.sas */
0091 
0092     ev_init(smc) ;          /* event queue */
0093 #ifndef SLIM_SMT
0094     smt_init_evc(smc) ;     /* evcs in MIB */
0095 #endif  /* no SLIM_SMT */
0096     smt_timer_init(smc) ;       /* timer package */
0097     smt_agent_init(smc) ;       /* SMT frame manager */
0098 
0099     pcm_init(smc) ;         /* PCM state machine */
0100     ecm_init(smc) ;         /* ECM state machine */
0101     cfm_init(smc) ;         /* CFM state machine */
0102     rmt_init(smc) ;         /* RMT state machine */
0103 
0104     for (p = 0 ; p < NUMPHYS ; p++) {
0105         pcm(smc,p,0) ;      /* PCM A state machine */
0106     }
0107     ecm(smc,0) ;            /* ECM state machine */
0108     cfm(smc,0) ;            /* CFM state machine */
0109     rmt(smc,0) ;            /* RMT state machine */
0110 
0111     smt_agent_task(smc) ;       /* NIF FSM etc */
0112 
0113         PNMI_INIT(smc) ;                /* PNMI initialization */
0114 
0115     return 0;
0116 }
0117