Loading...
1/******************************************************************************
2 *
3 * (C)Copyright 1998,1999 SysKonnect,
4 * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
5 *
6 * See the file "skfddi.c" for further information.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * The information in this file is provided "AS IS" without warranty.
14 *
15 ******************************************************************************/
16
17/*
18 Init SMT
19 call all module level initialization routines
20*/
21
22#include "h/types.h"
23#include "h/fddi.h"
24#include "h/smc.h"
25
26#ifndef lint
27static const char ID_sccs[] = "@(#)smtinit.c 1.15 97/05/06 (C) SK " ;
28#endif
29
30void init_fddi_driver(struct s_smc *smc, u_char *mac_addr);
31
32/* define global debug variable */
33#if defined(DEBUG) && !defined(DEBUG_BRD)
34struct smt_debug debug;
35#endif
36
37#ifndef MULT_OEM
38#define OEMID(smc,i) oem_id[i]
39 extern u_char oem_id[] ;
40#else /* MULT_OEM */
41#define OEMID(smc,i) smc->hw.oem_id->oi_mark[i]
42 extern struct s_oem_ids oem_ids[] ;
43#endif /* MULT_OEM */
44
45/*
46 * Set OEM specific values
47 *
48 * Can not be called in smt_reset_defaults, because it is not sure that
49 * the OEM ID is already defined.
50 */
51static void set_oem_spec_val(struct s_smc *smc)
52{
53 struct fddi_mib *mib ;
54
55 mib = &smc->mib ;
56
57 /*
58 * set IBM specific values
59 */
60 if (OEMID(smc,0) == 'I') {
61 mib->fddiSMTConnectionPolicy = POLICY_MM ;
62 }
63}
64
65/*
66 * Init SMT
67 */
68int init_smt(struct s_smc *smc, u_char *mac_addr)
69/* u_char *mac_addr; canonical address or NULL */
70{
71 int p ;
72
73#if defined(DEBUG) && !defined(DEBUG_BRD)
74 debug.d_smt = 0 ;
75 debug.d_smtf = 0 ;
76 debug.d_rmt = 0 ;
77 debug.d_ecm = 0 ;
78 debug.d_pcm = 0 ;
79 debug.d_cfm = 0 ;
80
81 debug.d_plc = 0 ;
82#ifdef ESS
83 debug.d_ess = 0 ;
84#endif
85#ifdef SBA
86 debug.d_sba = 0 ;
87#endif
88#endif /* DEBUG && !DEBUG_BRD */
89
90 /* First initialize the ports mib->pointers */
91 for ( p = 0; p < NUMPHYS; p ++ ) {
92 smc->y[p].mib = & smc->mib.p[p] ;
93 }
94
95 set_oem_spec_val(smc) ;
96 (void) smt_set_mac_opvalues(smc) ;
97 init_fddi_driver(smc,mac_addr) ; /* HW driver */
98 smt_fixup_mib(smc) ; /* update values that depend on s.sas */
99
100 ev_init(smc) ; /* event queue */
101#ifndef SLIM_SMT
102 smt_init_evc(smc) ; /* evcs in MIB */
103#endif /* no SLIM_SMT */
104 smt_timer_init(smc) ; /* timer package */
105 smt_agent_init(smc) ; /* SMT frame manager */
106
107 pcm_init(smc) ; /* PCM state machine */
108 ecm_init(smc) ; /* ECM state machine */
109 cfm_init(smc) ; /* CFM state machine */
110 rmt_init(smc) ; /* RMT state machine */
111
112 for (p = 0 ; p < NUMPHYS ; p++) {
113 pcm(smc,p,0) ; /* PCM A state machine */
114 }
115 ecm(smc,0) ; /* ECM state machine */
116 cfm(smc,0) ; /* CFM state machine */
117 rmt(smc,0) ; /* RMT state machine */
118
119 smt_agent_task(smc) ; /* NIF FSM etc */
120
121 PNMI_INIT(smc) ; /* PNMI initialization */
122
123 return 0;
124}
125
1// SPDX-License-Identifier: GPL-2.0-or-later
2/******************************************************************************
3 *
4 * (C)Copyright 1998,1999 SysKonnect,
5 * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
6 *
7 * See the file "skfddi.c" for further information.
8 *
9 * The information in this file is provided "AS IS" without warranty.
10 *
11 ******************************************************************************/
12
13/*
14 Init SMT
15 call all module level initialization routines
16*/
17
18#include "h/types.h"
19#include "h/fddi.h"
20#include "h/smc.h"
21
22void init_fddi_driver(struct s_smc *smc, const u_char *mac_addr);
23
24/* define global debug variable */
25#if defined(DEBUG) && !defined(DEBUG_BRD)
26struct smt_debug debug;
27#endif
28
29#ifndef MULT_OEM
30#define OEMID(smc,i) oem_id[i]
31 extern u_char oem_id[] ;
32#else /* MULT_OEM */
33#define OEMID(smc,i) smc->hw.oem_id->oi_mark[i]
34 extern struct s_oem_ids oem_ids[] ;
35#endif /* MULT_OEM */
36
37/*
38 * Set OEM specific values
39 *
40 * Can not be called in smt_reset_defaults, because it is not sure that
41 * the OEM ID is already defined.
42 */
43static void set_oem_spec_val(struct s_smc *smc)
44{
45 struct fddi_mib *mib ;
46
47 mib = &smc->mib ;
48
49 /*
50 * set IBM specific values
51 */
52 if (OEMID(smc,0) == 'I') {
53 mib->fddiSMTConnectionPolicy = POLICY_MM ;
54 }
55}
56
57/*
58 * Init SMT
59 */
60int init_smt(struct s_smc *smc, const u_char *mac_addr)
61/* u_char *mac_addr; canonical address or NULL */
62{
63 int p ;
64
65#if defined(DEBUG) && !defined(DEBUG_BRD)
66 debug.d_smt = 0 ;
67 debug.d_smtf = 0 ;
68 debug.d_rmt = 0 ;
69 debug.d_ecm = 0 ;
70 debug.d_pcm = 0 ;
71 debug.d_cfm = 0 ;
72
73 debug.d_plc = 0 ;
74#ifdef ESS
75 debug.d_ess = 0 ;
76#endif
77#ifdef SBA
78 debug.d_sba = 0 ;
79#endif
80#endif /* DEBUG && !DEBUG_BRD */
81
82 /* First initialize the ports mib->pointers */
83 for ( p = 0; p < NUMPHYS; p ++ ) {
84 smc->y[p].mib = & smc->mib.p[p] ;
85 }
86
87 set_oem_spec_val(smc) ;
88 (void) smt_set_mac_opvalues(smc) ;
89 init_fddi_driver(smc,mac_addr) ; /* HW driver */
90 smt_fixup_mib(smc) ; /* update values that depend on s.sas */
91
92 ev_init(smc) ; /* event queue */
93#ifndef SLIM_SMT
94 smt_init_evc(smc) ; /* evcs in MIB */
95#endif /* no SLIM_SMT */
96 smt_timer_init(smc) ; /* timer package */
97 smt_agent_init(smc) ; /* SMT frame manager */
98
99 pcm_init(smc) ; /* PCM state machine */
100 ecm_init(smc) ; /* ECM state machine */
101 cfm_init(smc) ; /* CFM state machine */
102 rmt_init(smc) ; /* RMT state machine */
103
104 for (p = 0 ; p < NUMPHYS ; p++) {
105 pcm(smc,p,0) ; /* PCM A state machine */
106 }
107 ecm(smc,0) ; /* ECM state machine */
108 cfm(smc,0) ; /* CFM state machine */
109 rmt(smc,0) ; /* RMT state machine */
110
111 smt_agent_task(smc) ; /* NIF FSM etc */
112
113 PNMI_INIT(smc) ; /* PNMI initialization */
114
115 return 0;
116}
117