smtinit.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. Init SMT
  14. call all module level initialization routines
  15. */
  16. #include "h/types.h"
  17. #include "h/fddi.h"
  18. #include "h/smc.h"
  19. void init_fddi_driver(struct s_smc *smc, const u_char *mac_addr);
  20. /* define global debug variable */
  21. #if defined(DEBUG) && !defined(DEBUG_BRD)
  22. struct smt_debug debug;
  23. #endif
  24. #ifndef MULT_OEM
  25. #define OEMID(smc,i) oem_id[i]
  26. extern u_char oem_id[] ;
  27. #else /* MULT_OEM */
  28. #define OEMID(smc,i) smc->hw.oem_id->oi_mark[i]
  29. extern struct s_oem_ids oem_ids[] ;
  30. #endif /* MULT_OEM */
  31. /*
  32. * Set OEM specific values
  33. *
  34. * Can not be called in smt_reset_defaults, because it is not sure that
  35. * the OEM ID is already defined.
  36. */
  37. static void set_oem_spec_val(struct s_smc *smc)
  38. {
  39. struct fddi_mib *mib ;
  40. mib = &smc->mib ;
  41. /*
  42. * set IBM specific values
  43. */
  44. if (OEMID(smc,0) == 'I') {
  45. mib->fddiSMTConnectionPolicy = POLICY_MM ;
  46. }
  47. }
  48. /*
  49. * Init SMT
  50. */
  51. int init_smt(struct s_smc *smc, const u_char *mac_addr)
  52. /* u_char *mac_addr; canonical address or NULL */
  53. {
  54. int p ;
  55. #if defined(DEBUG) && !defined(DEBUG_BRD)
  56. debug.d_smt = 0 ;
  57. debug.d_smtf = 0 ;
  58. debug.d_rmt = 0 ;
  59. debug.d_ecm = 0 ;
  60. debug.d_pcm = 0 ;
  61. debug.d_cfm = 0 ;
  62. debug.d_plc = 0 ;
  63. #ifdef ESS
  64. debug.d_ess = 0 ;
  65. #endif
  66. #ifdef SBA
  67. debug.d_sba = 0 ;
  68. #endif
  69. #endif /* DEBUG && !DEBUG_BRD */
  70. /* First initialize the ports mib->pointers */
  71. for ( p = 0; p < NUMPHYS; p ++ ) {
  72. smc->y[p].mib = & smc->mib.p[p] ;
  73. }
  74. set_oem_spec_val(smc) ;
  75. (void) smt_set_mac_opvalues(smc) ;
  76. init_fddi_driver(smc,mac_addr) ; /* HW driver */
  77. smt_fixup_mib(smc) ; /* update values that depend on s.sas */
  78. ev_init(smc) ; /* event queue */
  79. #ifndef SLIM_SMT
  80. smt_init_evc(smc) ; /* evcs in MIB */
  81. #endif /* no SLIM_SMT */
  82. smt_timer_init(smc) ; /* timer package */
  83. smt_agent_init(smc) ; /* SMT frame manager */
  84. pcm_init(smc) ; /* PCM state machine */
  85. ecm_init(smc) ; /* ECM state machine */
  86. cfm_init(smc) ; /* CFM state machine */
  87. rmt_init(smc) ; /* RMT state machine */
  88. for (p = 0 ; p < NUMPHYS ; p++) {
  89. pcm(smc,p,0) ; /* PCM A state machine */
  90. }
  91. ecm(smc,0) ; /* ECM state machine */
  92. cfm(smc,0) ; /* CFM state machine */
  93. rmt(smc,0) ; /* RMT state machine */
  94. smt_agent_task(smc) ; /* NIF FSM etc */
  95. PNMI_INIT(smc) ; /* PNMI initialization */
  96. return 0;
  97. }