bfa_port.h 4.2 KB

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