bfa_port.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. #ifndef __BFA_PORT_H__
  18. #define __BFA_PORT_H__
  19. #include "bfa_defs_svc.h"
  20. #include "bfa_ioc.h"
  21. #include "bfa_cs.h"
  22. typedef void (*bfa_port_stats_cbfn_t) (void *dev, bfa_status_t status);
  23. typedef void (*bfa_port_endis_cbfn_t) (void *dev, bfa_status_t status);
  24. struct bfa_port_s {
  25. void *dev;
  26. struct bfa_ioc_s *ioc;
  27. struct bfa_trc_mod_s *trcmod;
  28. u32 msgtag;
  29. bfa_boolean_t stats_busy;
  30. struct bfa_mbox_cmd_s stats_mb;
  31. bfa_port_stats_cbfn_t stats_cbfn;
  32. void *stats_cbarg;
  33. bfa_status_t stats_status;
  34. u32 stats_reset_time;
  35. union bfa_port_stats_u *stats;
  36. struct bfa_dma_s stats_dma;
  37. bfa_boolean_t endis_pending;
  38. struct bfa_mbox_cmd_s endis_mb;
  39. bfa_port_endis_cbfn_t endis_cbfn;
  40. void *endis_cbarg;
  41. bfa_status_t endis_status;
  42. struct bfa_ioc_notify_s ioc_notify;
  43. bfa_boolean_t pbc_disabled;
  44. bfa_boolean_t dport_enabled;
  45. struct bfa_mem_dma_s port_dma;
  46. };
  47. #define BFA_MEM_PORT_DMA(__bfa) (&((__bfa)->modules.port.port_dma))
  48. void bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
  49. void *dev, struct bfa_trc_mod_s *trcmod);
  50. void bfa_port_notify(void *arg, enum bfa_ioc_event_e event);
  51. bfa_status_t bfa_port_get_stats(struct bfa_port_s *port,
  52. union bfa_port_stats_u *stats,
  53. bfa_port_stats_cbfn_t cbfn, void *cbarg);
  54. bfa_status_t bfa_port_clear_stats(struct bfa_port_s *port,
  55. bfa_port_stats_cbfn_t cbfn, void *cbarg);
  56. bfa_status_t bfa_port_enable(struct bfa_port_s *port,
  57. bfa_port_endis_cbfn_t cbfn, void *cbarg);
  58. bfa_status_t bfa_port_disable(struct bfa_port_s *port,
  59. bfa_port_endis_cbfn_t cbfn, void *cbarg);
  60. u32 bfa_port_meminfo(void);
  61. void bfa_port_mem_claim(struct bfa_port_s *port,
  62. u8 *dma_kva, u64 dma_pa);
  63. void bfa_port_set_dportenabled(struct bfa_port_s *port,
  64. bfa_boolean_t enabled);
  65. /*
  66. * CEE declaration
  67. */
  68. typedef void (*bfa_cee_get_attr_cbfn_t) (void *dev, bfa_status_t status);
  69. typedef void (*bfa_cee_get_stats_cbfn_t) (void *dev, bfa_status_t status);
  70. typedef void (*bfa_cee_reset_stats_cbfn_t) (void *dev, bfa_status_t status);
  71. struct bfa_cee_cbfn_s {
  72. bfa_cee_get_attr_cbfn_t get_attr_cbfn;
  73. void *get_attr_cbarg;
  74. bfa_cee_get_stats_cbfn_t get_stats_cbfn;
  75. void *get_stats_cbarg;
  76. bfa_cee_reset_stats_cbfn_t reset_stats_cbfn;
  77. void *reset_stats_cbarg;
  78. };
  79. struct bfa_cee_s {
  80. void *dev;
  81. bfa_boolean_t get_attr_pending;
  82. bfa_boolean_t get_stats_pending;
  83. bfa_boolean_t reset_stats_pending;
  84. bfa_status_t get_attr_status;
  85. bfa_status_t get_stats_status;
  86. bfa_status_t reset_stats_status;
  87. struct bfa_cee_cbfn_s cbfn;
  88. struct bfa_ioc_notify_s ioc_notify;
  89. struct bfa_trc_mod_s *trcmod;
  90. struct bfa_cee_attr_s *attr;
  91. struct bfa_cee_stats_s *stats;
  92. struct bfa_dma_s attr_dma;
  93. struct bfa_dma_s stats_dma;
  94. struct bfa_ioc_s *ioc;
  95. struct bfa_mbox_cmd_s get_cfg_mb;
  96. struct bfa_mbox_cmd_s get_stats_mb;
  97. struct bfa_mbox_cmd_s reset_stats_mb;
  98. struct bfa_mem_dma_s cee_dma;
  99. };
  100. #define BFA_MEM_CEE_DMA(__bfa) (&((__bfa)->modules.cee.cee_dma))
  101. u32 bfa_cee_meminfo(void);
  102. void bfa_cee_mem_claim(struct bfa_cee_s *cee, u8 *dma_kva, u64 dma_pa);
  103. void bfa_cee_attach(struct bfa_cee_s *cee,
  104. struct bfa_ioc_s *ioc, void *dev);
  105. bfa_status_t bfa_cee_get_attr(struct bfa_cee_s *cee,
  106. struct bfa_cee_attr_s *attr,
  107. bfa_cee_get_attr_cbfn_t cbfn, void *cbarg);
  108. bfa_status_t bfa_cee_get_stats(struct bfa_cee_s *cee,
  109. struct bfa_cee_stats_s *stats,
  110. bfa_cee_get_stats_cbfn_t cbfn, void *cbarg);
  111. bfa_status_t bfa_cee_reset_stats(struct bfa_cee_s *cee,
  112. bfa_cee_reset_stats_cbfn_t cbfn, void *cbarg);
  113. #endif /* __BFA_PORT_H__ */