bfa_priv.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright (c) 2005-2009 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. #ifndef __BFA_PRIV_H__
  18. #define __BFA_PRIV_H__
  19. #include "bfa_iocfc.h"
  20. #include "bfa_intr_priv.h"
  21. #include "bfa_trcmod_priv.h"
  22. #include "bfa_modules_priv.h"
  23. #include "bfa_fwimg_priv.h"
  24. #include <cs/bfa_log.h>
  25. #include <bfa_timer.h>
  26. /**
  27. * Macro to define a new BFA module
  28. */
  29. #define BFA_MODULE(__mod) \
  30. static void bfa_ ## __mod ## _meminfo( \
  31. struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len, \
  32. u32 *dm_len); \
  33. static void bfa_ ## __mod ## _attach(struct bfa_s *bfa, \
  34. void *bfad, struct bfa_iocfc_cfg_s *cfg, \
  35. struct bfa_meminfo_s *meminfo, \
  36. struct bfa_pcidev_s *pcidev); \
  37. static void bfa_ ## __mod ## _initdone(struct bfa_s *bfa); \
  38. static void bfa_ ## __mod ## _detach(struct bfa_s *bfa); \
  39. static void bfa_ ## __mod ## _start(struct bfa_s *bfa); \
  40. static void bfa_ ## __mod ## _stop(struct bfa_s *bfa); \
  41. static void bfa_ ## __mod ## _iocdisable(struct bfa_s *bfa); \
  42. \
  43. extern struct bfa_module_s hal_mod_ ## __mod; \
  44. struct bfa_module_s hal_mod_ ## __mod = { \
  45. bfa_ ## __mod ## _meminfo, \
  46. bfa_ ## __mod ## _attach, \
  47. bfa_ ## __mod ## _initdone, \
  48. bfa_ ## __mod ## _detach, \
  49. bfa_ ## __mod ## _start, \
  50. bfa_ ## __mod ## _stop, \
  51. bfa_ ## __mod ## _iocdisable, \
  52. }
  53. #define BFA_CACHELINE_SZ (256)
  54. /**
  55. * Structure used to interact between different BFA sub modules
  56. *
  57. * Each sub module needs to implement only the entry points relevant to it (and
  58. * can leave entry points as NULL)
  59. */
  60. struct bfa_module_s {
  61. void (*meminfo) (struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
  62. u32 *dm_len);
  63. void (*attach) (struct bfa_s *bfa, void *bfad,
  64. struct bfa_iocfc_cfg_s *cfg,
  65. struct bfa_meminfo_s *meminfo,
  66. struct bfa_pcidev_s *pcidev);
  67. void (*initdone) (struct bfa_s *bfa);
  68. void (*detach) (struct bfa_s *bfa);
  69. void (*start) (struct bfa_s *bfa);
  70. void (*stop) (struct bfa_s *bfa);
  71. void (*iocdisable) (struct bfa_s *bfa);
  72. };
  73. extern struct bfa_module_s *hal_mods[];
  74. struct bfa_s {
  75. void *bfad; /* BFA driver instance */
  76. struct bfa_aen_s *aen; /* AEN module */
  77. struct bfa_plog_s *plog; /* portlog buffer */
  78. struct bfa_log_mod_s *logm; /* driver logging modulen */
  79. struct bfa_trc_mod_s *trcmod; /* driver tracing */
  80. struct bfa_ioc_s ioc; /* IOC module */
  81. struct bfa_iocfc_s iocfc; /* IOCFC module */
  82. struct bfa_timer_mod_s timer_mod; /* timer module */
  83. struct bfa_modules_s modules; /* BFA modules */
  84. struct list_head comp_q; /* pending completions */
  85. bfa_boolean_t rme_process; /* RME processing enabled */
  86. struct list_head reqq_waitq[BFI_IOC_MAX_CQS];
  87. bfa_boolean_t fcs; /* FCS is attached to BFA */
  88. struct bfa_msix_s msix;
  89. };
  90. extern bfa_isr_func_t bfa_isrs[BFI_MC_MAX];
  91. extern bfa_ioc_mbox_mcfunc_t bfa_mbox_isrs[];
  92. extern bfa_boolean_t bfa_auto_recover;
  93. extern struct bfa_module_s hal_mod_flash;
  94. extern struct bfa_module_s hal_mod_fcdiag;
  95. extern struct bfa_module_s hal_mod_sgpg;
  96. extern struct bfa_module_s hal_mod_pport;
  97. extern struct bfa_module_s hal_mod_fcxp;
  98. extern struct bfa_module_s hal_mod_lps;
  99. extern struct bfa_module_s hal_mod_uf;
  100. extern struct bfa_module_s hal_mod_rport;
  101. extern struct bfa_module_s hal_mod_fcpim;
  102. extern struct bfa_module_s hal_mod_pbind;
  103. #endif /* __BFA_PRIV_H__ */