bfa_modules.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. /*
  18. * bfa_modules.h BFA modules
  19. */
  20. #ifndef __BFA_MODULES_H__
  21. #define __BFA_MODULES_H__
  22. #include "bfa_cs.h"
  23. #include "bfa.h"
  24. #include "bfa_svc.h"
  25. #include "bfa_fcpim.h"
  26. #include "bfa_port.h"
  27. struct bfa_modules_s {
  28. struct bfa_fcdiag_s fcdiag; /* fcdiag module */
  29. struct bfa_fcport_s fcport; /* fc port module */
  30. struct bfa_fcxp_mod_s fcxp_mod; /* fcxp module */
  31. struct bfa_lps_mod_s lps_mod; /* fcxp module */
  32. struct bfa_uf_mod_s uf_mod; /* unsolicited frame module */
  33. struct bfa_rport_mod_s rport_mod; /* remote port module */
  34. struct bfa_fcp_mod_s fcp_mod; /* FCP initiator module */
  35. struct bfa_sgpg_mod_s sgpg_mod; /* SG page module */
  36. struct bfa_port_s port; /* Physical port module */
  37. struct bfa_ablk_s ablk; /* ASIC block config module */
  38. struct bfa_cee_s cee; /* CEE Module */
  39. struct bfa_sfp_s sfp; /* SFP module */
  40. struct bfa_flash_s flash; /* flash module */
  41. struct bfa_diag_s diag_mod; /* diagnostics module */
  42. struct bfa_phy_s phy; /* phy module */
  43. struct bfa_dconf_mod_s dconf_mod; /* DCONF common module */
  44. struct bfa_fru_s fru; /* fru module */
  45. };
  46. /*
  47. * !!! Only append to the enums defined here to avoid any versioning
  48. * !!! needed between trace utility and driver version
  49. */
  50. enum {
  51. BFA_TRC_HAL_CORE = 1,
  52. BFA_TRC_HAL_FCXP = 2,
  53. BFA_TRC_HAL_FCPIM = 3,
  54. BFA_TRC_HAL_IOCFC_CT = 4,
  55. BFA_TRC_HAL_IOCFC_CB = 5,
  56. };
  57. /*
  58. * Macro to define a new BFA module
  59. */
  60. #define BFA_MODULE(__mod) \
  61. static void bfa_ ## __mod ## _meminfo( \
  62. struct bfa_iocfc_cfg_s *cfg, \
  63. struct bfa_meminfo_s *meminfo, \
  64. struct bfa_s *bfa); \
  65. static void bfa_ ## __mod ## _attach(struct bfa_s *bfa, \
  66. void *bfad, struct bfa_iocfc_cfg_s *cfg, \
  67. struct bfa_pcidev_s *pcidev); \
  68. static void bfa_ ## __mod ## _detach(struct bfa_s *bfa); \
  69. static void bfa_ ## __mod ## _start(struct bfa_s *bfa); \
  70. static void bfa_ ## __mod ## _stop(struct bfa_s *bfa); \
  71. static void bfa_ ## __mod ## _iocdisable(struct bfa_s *bfa); \
  72. \
  73. extern struct bfa_module_s hal_mod_ ## __mod; \
  74. struct bfa_module_s hal_mod_ ## __mod = { \
  75. bfa_ ## __mod ## _meminfo, \
  76. bfa_ ## __mod ## _attach, \
  77. bfa_ ## __mod ## _detach, \
  78. bfa_ ## __mod ## _start, \
  79. bfa_ ## __mod ## _stop, \
  80. bfa_ ## __mod ## _iocdisable, \
  81. }
  82. #define BFA_CACHELINE_SZ (256)
  83. /*
  84. * Structure used to interact between different BFA sub modules
  85. *
  86. * Each sub module needs to implement only the entry points relevant to it (and
  87. * can leave entry points as NULL)
  88. */
  89. struct bfa_module_s {
  90. void (*meminfo) (struct bfa_iocfc_cfg_s *cfg,
  91. struct bfa_meminfo_s *meminfo,
  92. struct bfa_s *bfa);
  93. void (*attach) (struct bfa_s *bfa, void *bfad,
  94. struct bfa_iocfc_cfg_s *cfg,
  95. struct bfa_pcidev_s *pcidev);
  96. void (*detach) (struct bfa_s *bfa);
  97. void (*start) (struct bfa_s *bfa);
  98. void (*stop) (struct bfa_s *bfa);
  99. void (*iocdisable) (struct bfa_s *bfa);
  100. };
  101. struct bfa_s {
  102. void *bfad; /* BFA driver instance */
  103. struct bfa_plog_s *plog; /* portlog buffer */
  104. struct bfa_trc_mod_s *trcmod; /* driver tracing */
  105. struct bfa_ioc_s ioc; /* IOC module */
  106. struct bfa_iocfc_s iocfc; /* IOCFC module */
  107. struct bfa_timer_mod_s timer_mod; /* timer module */
  108. struct bfa_modules_s modules; /* BFA modules */
  109. struct list_head comp_q; /* pending completions */
  110. bfa_boolean_t queue_process; /* queue processing enabled */
  111. struct list_head reqq_waitq[BFI_IOC_MAX_CQS];
  112. bfa_boolean_t fcs; /* FCS is attached to BFA */
  113. struct bfa_msix_s msix;
  114. int bfa_aen_seq;
  115. bfa_boolean_t intr_enabled; /* Status of interrupts */
  116. };
  117. extern bfa_boolean_t bfa_auto_recover;
  118. extern struct bfa_module_s hal_mod_fcdiag;
  119. extern struct bfa_module_s hal_mod_sgpg;
  120. extern struct bfa_module_s hal_mod_fcport;
  121. extern struct bfa_module_s hal_mod_fcxp;
  122. extern struct bfa_module_s hal_mod_lps;
  123. extern struct bfa_module_s hal_mod_uf;
  124. extern struct bfa_module_s hal_mod_rport;
  125. extern struct bfa_module_s hal_mod_fcp;
  126. extern struct bfa_module_s hal_mod_dconf;
  127. #endif /* __BFA_MODULES_H__ */