bfa_modules.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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_fcport_s fcport; /* fc port module */
  29. struct bfa_fcxp_mod_s fcxp_mod; /* fcxp module */
  30. struct bfa_lps_mod_s lps_mod; /* fcxp module */
  31. struct bfa_uf_mod_s uf_mod; /* unsolicited frame module */
  32. struct bfa_rport_mod_s rport_mod; /* remote port module */
  33. struct bfa_fcpim_mod_s fcpim_mod; /* FCP initiator module */
  34. struct bfa_sgpg_mod_s sgpg_mod; /* SG page module */
  35. struct bfa_port_s port; /* Physical port module */
  36. };
  37. /*
  38. * !!! Only append to the enums defined here to avoid any versioning
  39. * !!! needed between trace utility and driver version
  40. */
  41. enum {
  42. BFA_TRC_HAL_CORE = 1,
  43. BFA_TRC_HAL_FCXP = 2,
  44. BFA_TRC_HAL_FCPIM = 3,
  45. BFA_TRC_HAL_IOCFC_CT = 4,
  46. BFA_TRC_HAL_IOCFC_CB = 5,
  47. };
  48. /*
  49. * Macro to define a new BFA module
  50. */
  51. #define BFA_MODULE(__mod) \
  52. static void bfa_ ## __mod ## _meminfo( \
  53. struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len, \
  54. u32 *dm_len); \
  55. static void bfa_ ## __mod ## _attach(struct bfa_s *bfa, \
  56. void *bfad, struct bfa_iocfc_cfg_s *cfg, \
  57. struct bfa_meminfo_s *meminfo, \
  58. struct bfa_pcidev_s *pcidev); \
  59. static void bfa_ ## __mod ## _detach(struct bfa_s *bfa); \
  60. static void bfa_ ## __mod ## _start(struct bfa_s *bfa); \
  61. static void bfa_ ## __mod ## _stop(struct bfa_s *bfa); \
  62. static void bfa_ ## __mod ## _iocdisable(struct bfa_s *bfa); \
  63. \
  64. extern struct bfa_module_s hal_mod_ ## __mod; \
  65. struct bfa_module_s hal_mod_ ## __mod = { \
  66. bfa_ ## __mod ## _meminfo, \
  67. bfa_ ## __mod ## _attach, \
  68. bfa_ ## __mod ## _detach, \
  69. bfa_ ## __mod ## _start, \
  70. bfa_ ## __mod ## _stop, \
  71. bfa_ ## __mod ## _iocdisable, \
  72. }
  73. #define BFA_CACHELINE_SZ (256)
  74. /*
  75. * Structure used to interact between different BFA sub modules
  76. *
  77. * Each sub module needs to implement only the entry points relevant to it (and
  78. * can leave entry points as NULL)
  79. */
  80. struct bfa_module_s {
  81. void (*meminfo) (struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
  82. u32 *dm_len);
  83. void (*attach) (struct bfa_s *bfa, void *bfad,
  84. struct bfa_iocfc_cfg_s *cfg,
  85. struct bfa_meminfo_s *meminfo,
  86. struct bfa_pcidev_s *pcidev);
  87. void (*detach) (struct bfa_s *bfa);
  88. void (*start) (struct bfa_s *bfa);
  89. void (*stop) (struct bfa_s *bfa);
  90. void (*iocdisable) (struct bfa_s *bfa);
  91. };
  92. struct bfa_s {
  93. void *bfad; /* BFA driver instance */
  94. struct bfa_plog_s *plog; /* portlog buffer */
  95. struct bfa_trc_mod_s *trcmod; /* driver tracing */
  96. struct bfa_ioc_s ioc; /* IOC module */
  97. struct bfa_iocfc_s iocfc; /* IOCFC module */
  98. struct bfa_timer_mod_s timer_mod; /* timer module */
  99. struct bfa_modules_s modules; /* BFA modules */
  100. struct list_head comp_q; /* pending completions */
  101. bfa_boolean_t rme_process; /* RME processing enabled */
  102. struct list_head reqq_waitq[BFI_IOC_MAX_CQS];
  103. bfa_boolean_t fcs; /* FCS is attached to BFA */
  104. struct bfa_msix_s msix;
  105. };
  106. extern bfa_boolean_t bfa_auto_recover;
  107. extern struct bfa_module_s hal_mod_sgpg;
  108. extern struct bfa_module_s hal_mod_fcport;
  109. extern struct bfa_module_s hal_mod_fcxp;
  110. extern struct bfa_module_s hal_mod_lps;
  111. extern struct bfa_module_s hal_mod_uf;
  112. extern struct bfa_module_s hal_mod_rport;
  113. extern struct bfa_module_s hal_mod_fcpim;
  114. #endif /* __BFA_MODULES_H__ */