bfa_port.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
  4. * Copyright (c) 2014- QLogic Corporation.
  5. * All rights reserved
  6. * www.qlogic.com
  7. *
  8. * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
  9. */
  10. #ifndef __BFA_PORT_H__
  11. #define __BFA_PORT_H__
  12. #include "bfa_defs_svc.h"
  13. #include "bfa_ioc.h"
  14. #include "bfa_cs.h"
  15. typedef void (*bfa_port_stats_cbfn_t) (void *dev, bfa_status_t status);
  16. typedef void (*bfa_port_endis_cbfn_t) (void *dev, bfa_status_t status);
  17. struct bfa_port_s {
  18. void *dev;
  19. struct bfa_ioc_s *ioc;
  20. struct bfa_trc_mod_s *trcmod;
  21. u32 msgtag;
  22. bfa_boolean_t stats_busy;
  23. struct bfa_mbox_cmd_s stats_mb;
  24. bfa_port_stats_cbfn_t stats_cbfn;
  25. void *stats_cbarg;
  26. bfa_status_t stats_status;
  27. time64_t stats_reset_time;
  28. union bfa_port_stats_u *stats;
  29. struct bfa_dma_s stats_dma;
  30. bfa_boolean_t endis_pending;
  31. struct bfa_mbox_cmd_s endis_mb;
  32. bfa_port_endis_cbfn_t endis_cbfn;
  33. void *endis_cbarg;
  34. bfa_status_t endis_status;
  35. struct bfa_ioc_notify_s ioc_notify;
  36. bfa_boolean_t pbc_disabled;
  37. bfa_boolean_t dport_enabled;
  38. struct bfa_mem_dma_s port_dma;
  39. };
  40. #define BFA_MEM_PORT_DMA(__bfa) (&((__bfa)->modules.port.port_dma))
  41. void bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
  42. void *dev, struct bfa_trc_mod_s *trcmod);
  43. void bfa_port_notify(void *arg, enum bfa_ioc_event_e event);
  44. bfa_status_t bfa_port_get_stats(struct bfa_port_s *port,
  45. union bfa_port_stats_u *stats,
  46. bfa_port_stats_cbfn_t cbfn, void *cbarg);
  47. bfa_status_t bfa_port_clear_stats(struct bfa_port_s *port,
  48. bfa_port_stats_cbfn_t cbfn, void *cbarg);
  49. bfa_status_t bfa_port_enable(struct bfa_port_s *port,
  50. bfa_port_endis_cbfn_t cbfn, void *cbarg);
  51. bfa_status_t bfa_port_disable(struct bfa_port_s *port,
  52. bfa_port_endis_cbfn_t cbfn, void *cbarg);
  53. u32 bfa_port_meminfo(void);
  54. void bfa_port_mem_claim(struct bfa_port_s *port,
  55. u8 *dma_kva, u64 dma_pa);
  56. void bfa_port_set_dportenabled(struct bfa_port_s *port,
  57. bfa_boolean_t enabled);
  58. /*
  59. * CEE declaration
  60. */
  61. typedef void (*bfa_cee_get_attr_cbfn_t) (void *dev, bfa_status_t status);
  62. typedef void (*bfa_cee_get_stats_cbfn_t) (void *dev, bfa_status_t status);
  63. typedef void (*bfa_cee_reset_stats_cbfn_t) (void *dev, bfa_status_t status);
  64. struct bfa_cee_cbfn_s {
  65. bfa_cee_get_attr_cbfn_t get_attr_cbfn;
  66. void *get_attr_cbarg;
  67. bfa_cee_get_stats_cbfn_t get_stats_cbfn;
  68. void *get_stats_cbarg;
  69. bfa_cee_reset_stats_cbfn_t reset_stats_cbfn;
  70. void *reset_stats_cbarg;
  71. };
  72. struct bfa_cee_s {
  73. void *dev;
  74. bfa_boolean_t get_attr_pending;
  75. bfa_boolean_t get_stats_pending;
  76. bfa_boolean_t reset_stats_pending;
  77. bfa_status_t get_attr_status;
  78. bfa_status_t get_stats_status;
  79. bfa_status_t reset_stats_status;
  80. struct bfa_cee_cbfn_s cbfn;
  81. struct bfa_ioc_notify_s ioc_notify;
  82. struct bfa_trc_mod_s *trcmod;
  83. struct bfa_cee_attr_s *attr;
  84. struct bfa_cee_stats_s *stats;
  85. struct bfa_dma_s attr_dma;
  86. struct bfa_dma_s stats_dma;
  87. struct bfa_ioc_s *ioc;
  88. struct bfa_mbox_cmd_s get_cfg_mb;
  89. struct bfa_mbox_cmd_s get_stats_mb;
  90. struct bfa_mbox_cmd_s reset_stats_mb;
  91. struct bfa_mem_dma_s cee_dma;
  92. };
  93. #define BFA_MEM_CEE_DMA(__bfa) (&((__bfa)->modules.cee.cee_dma))
  94. u32 bfa_cee_meminfo(void);
  95. void bfa_cee_mem_claim(struct bfa_cee_s *cee, u8 *dma_kva, u64 dma_pa);
  96. void bfa_cee_attach(struct bfa_cee_s *cee,
  97. struct bfa_ioc_s *ioc, void *dev);
  98. bfa_status_t bfa_cee_get_attr(struct bfa_cee_s *cee,
  99. struct bfa_cee_attr_s *attr,
  100. bfa_cee_get_attr_cbfn_t cbfn, void *cbarg);
  101. bfa_status_t bfa_cee_get_stats(struct bfa_cee_s *cee,
  102. struct bfa_cee_stats_s *stats,
  103. bfa_cee_get_stats_cbfn_t cbfn, void *cbarg);
  104. bfa_status_t bfa_cee_reset_stats(struct bfa_cee_s *cee,
  105. bfa_cee_reset_stats_cbfn_t cbfn, void *cbarg);
  106. #endif /* __BFA_PORT_H__ */