smtinit.c 3.0 KB

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