bfa_modules.h 4.7 KB

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