bfa_priv.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 ## _detach(struct bfa_s *bfa); \
  38. static void bfa_ ## __mod ## _start(struct bfa_s *bfa); \
  39. static void bfa_ ## __mod ## _stop(struct bfa_s *bfa); \
  40. static void bfa_ ## __mod ## _iocdisable(struct bfa_s *bfa); \
  41. \
  42. extern struct bfa_module_s hal_mod_ ## __mod; \
  43. struct bfa_module_s hal_mod_ ## __mod = { \
  44. bfa_ ## __mod ## _meminfo, \
  45. bfa_ ## __mod ## _attach, \
  46. bfa_ ## __mod ## _detach, \
  47. bfa_ ## __mod ## _start, \
  48. bfa_ ## __mod ## _stop, \
  49. bfa_ ## __mod ## _iocdisable, \
  50. }
  51. #define BFA_CACHELINE_SZ (256)
  52. /**
  53. * Structure used to interact between different BFA sub modules
  54. *
  55. * Each sub module needs to implement only the entry points relevant to it (and
  56. * can leave entry points as NULL)
  57. */
  58. struct bfa_module_s {
  59. void (*meminfo) (struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
  60. u32 *dm_len);
  61. void (*attach) (struct bfa_s *bfa, void *bfad,
  62. struct bfa_iocfc_cfg_s *cfg,
  63. struct bfa_meminfo_s *meminfo,
  64. struct bfa_pcidev_s *pcidev);
  65. void (*detach) (struct bfa_s *bfa);
  66. void (*start) (struct bfa_s *bfa);
  67. void (*stop) (struct bfa_s *bfa);
  68. void (*iocdisable) (struct bfa_s *bfa);
  69. };
  70. extern struct bfa_module_s *hal_mods[];
  71. struct bfa_s {
  72. void *bfad; /* BFA driver instance */
  73. struct bfa_aen_s *aen; /* AEN module */
  74. struct bfa_plog_s *plog; /* portlog buffer */
  75. struct bfa_log_mod_s *logm; /* driver logging modulen */
  76. struct bfa_trc_mod_s *trcmod; /* driver tracing */
  77. struct bfa_ioc_s ioc; /* IOC module */
  78. struct bfa_iocfc_s iocfc; /* IOCFC module */
  79. struct bfa_timer_mod_s timer_mod; /* timer module */
  80. struct bfa_modules_s modules; /* BFA modules */
  81. struct list_head comp_q; /* pending completions */
  82. bfa_boolean_t rme_process; /* RME processing enabled */
  83. struct list_head reqq_waitq[BFI_IOC_MAX_CQS];
  84. bfa_boolean_t fcs; /* FCS is attached to BFA */
  85. struct bfa_msix_s msix;
  86. };
  87. extern bfa_isr_func_t bfa_isrs[BFI_MC_MAX];
  88. extern bfa_ioc_mbox_mcfunc_t bfa_mbox_isrs[];
  89. extern bfa_boolean_t bfa_auto_recover;
  90. extern struct bfa_module_s hal_mod_flash;
  91. extern struct bfa_module_s hal_mod_fcdiag;
  92. extern struct bfa_module_s hal_mod_sgpg;
  93. extern struct bfa_module_s hal_mod_fcport;
  94. extern struct bfa_module_s hal_mod_fcxp;
  95. extern struct bfa_module_s hal_mod_lps;
  96. extern struct bfa_module_s hal_mod_uf;
  97. extern struct bfa_module_s hal_mod_rport;
  98. extern struct bfa_module_s hal_mod_fcpim;
  99. extern struct bfa_module_s hal_mod_pbind;
  100. #endif /* __BFA_PRIV_H__ */