1*52fa7bf9SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2a36c61f9SKrishna Gudipati /* 3889d0d42SAnil Gurumurthy * Copyright (c) 2005-2014 Brocade Communications Systems, Inc. 4889d0d42SAnil Gurumurthy * Copyright (c) 2014- QLogic Corporation. 5a36c61f9SKrishna Gudipati * All rights reserved 6889d0d42SAnil Gurumurthy * www.qlogic.com 7a36c61f9SKrishna Gudipati * 831e1d569SAnil Gurumurthy * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter. 9a36c61f9SKrishna Gudipati */ 10a36c61f9SKrishna Gudipati 11a36c61f9SKrishna Gudipati #ifndef __BFA_PORT_H__ 12a36c61f9SKrishna Gudipati #define __BFA_PORT_H__ 13a36c61f9SKrishna Gudipati 14a36c61f9SKrishna Gudipati #include "bfa_defs_svc.h" 15a36c61f9SKrishna Gudipati #include "bfa_ioc.h" 16a36c61f9SKrishna Gudipati #include "bfa_cs.h" 17a36c61f9SKrishna Gudipati 18a36c61f9SKrishna Gudipati typedef void (*bfa_port_stats_cbfn_t) (void *dev, bfa_status_t status); 19a36c61f9SKrishna Gudipati typedef void (*bfa_port_endis_cbfn_t) (void *dev, bfa_status_t status); 20a36c61f9SKrishna Gudipati 21a36c61f9SKrishna Gudipati struct bfa_port_s { 22a36c61f9SKrishna Gudipati void *dev; 23a36c61f9SKrishna Gudipati struct bfa_ioc_s *ioc; 24a36c61f9SKrishna Gudipati struct bfa_trc_mod_s *trcmod; 25a36c61f9SKrishna Gudipati u32 msgtag; 26a36c61f9SKrishna Gudipati bfa_boolean_t stats_busy; 27a36c61f9SKrishna Gudipati struct bfa_mbox_cmd_s stats_mb; 28a36c61f9SKrishna Gudipati bfa_port_stats_cbfn_t stats_cbfn; 29a36c61f9SKrishna Gudipati void *stats_cbarg; 30a36c61f9SKrishna Gudipati bfa_status_t stats_status; 318f604a03SArnd Bergmann time64_t stats_reset_time; 32a36c61f9SKrishna Gudipati union bfa_port_stats_u *stats; 33a36c61f9SKrishna Gudipati struct bfa_dma_s stats_dma; 34a36c61f9SKrishna Gudipati bfa_boolean_t endis_pending; 35a36c61f9SKrishna Gudipati struct bfa_mbox_cmd_s endis_mb; 36a36c61f9SKrishna Gudipati bfa_port_endis_cbfn_t endis_cbfn; 37a36c61f9SKrishna Gudipati void *endis_cbarg; 38a36c61f9SKrishna Gudipati bfa_status_t endis_status; 39d37779f8SKrishna Gudipati struct bfa_ioc_notify_s ioc_notify; 4043ffdf4dSKrishna Gudipati bfa_boolean_t pbc_disabled; 41e353546eSKrishna Gudipati bfa_boolean_t dport_enabled; 424507025dSKrishna Gudipati struct bfa_mem_dma_s port_dma; 43a36c61f9SKrishna Gudipati }; 44a36c61f9SKrishna Gudipati 454507025dSKrishna Gudipati #define BFA_MEM_PORT_DMA(__bfa) (&((__bfa)->modules.port.port_dma)) 464507025dSKrishna Gudipati 47a36c61f9SKrishna Gudipati void bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, 48a36c61f9SKrishna Gudipati void *dev, struct bfa_trc_mod_s *trcmod); 49d37779f8SKrishna Gudipati void bfa_port_notify(void *arg, enum bfa_ioc_event_e event); 50a36c61f9SKrishna Gudipati 51a36c61f9SKrishna Gudipati bfa_status_t bfa_port_get_stats(struct bfa_port_s *port, 52a36c61f9SKrishna Gudipati union bfa_port_stats_u *stats, 53a36c61f9SKrishna Gudipati bfa_port_stats_cbfn_t cbfn, void *cbarg); 54a36c61f9SKrishna Gudipati bfa_status_t bfa_port_clear_stats(struct bfa_port_s *port, 55a36c61f9SKrishna Gudipati bfa_port_stats_cbfn_t cbfn, void *cbarg); 56a36c61f9SKrishna Gudipati bfa_status_t bfa_port_enable(struct bfa_port_s *port, 57a36c61f9SKrishna Gudipati bfa_port_endis_cbfn_t cbfn, void *cbarg); 58a36c61f9SKrishna Gudipati bfa_status_t bfa_port_disable(struct bfa_port_s *port, 59a36c61f9SKrishna Gudipati bfa_port_endis_cbfn_t cbfn, void *cbarg); 60a36c61f9SKrishna Gudipati u32 bfa_port_meminfo(void); 61a36c61f9SKrishna Gudipati void bfa_port_mem_claim(struct bfa_port_s *port, 62a36c61f9SKrishna Gudipati u8 *dma_kva, u64 dma_pa); 63e353546eSKrishna Gudipati void bfa_port_set_dportenabled(struct bfa_port_s *port, 64e353546eSKrishna Gudipati bfa_boolean_t enabled); 65148d6103SKrishna Gudipati 66148d6103SKrishna Gudipati /* 67148d6103SKrishna Gudipati * CEE declaration 68148d6103SKrishna Gudipati */ 69148d6103SKrishna Gudipati typedef void (*bfa_cee_get_attr_cbfn_t) (void *dev, bfa_status_t status); 70148d6103SKrishna Gudipati typedef void (*bfa_cee_get_stats_cbfn_t) (void *dev, bfa_status_t status); 71148d6103SKrishna Gudipati typedef void (*bfa_cee_reset_stats_cbfn_t) (void *dev, bfa_status_t status); 72148d6103SKrishna Gudipati 73148d6103SKrishna Gudipati struct bfa_cee_cbfn_s { 74148d6103SKrishna Gudipati bfa_cee_get_attr_cbfn_t get_attr_cbfn; 75148d6103SKrishna Gudipati void *get_attr_cbarg; 76148d6103SKrishna Gudipati bfa_cee_get_stats_cbfn_t get_stats_cbfn; 77148d6103SKrishna Gudipati void *get_stats_cbarg; 78148d6103SKrishna Gudipati bfa_cee_reset_stats_cbfn_t reset_stats_cbfn; 79148d6103SKrishna Gudipati void *reset_stats_cbarg; 80148d6103SKrishna Gudipati }; 81148d6103SKrishna Gudipati 82148d6103SKrishna Gudipati struct bfa_cee_s { 83148d6103SKrishna Gudipati void *dev; 84148d6103SKrishna Gudipati bfa_boolean_t get_attr_pending; 85148d6103SKrishna Gudipati bfa_boolean_t get_stats_pending; 86148d6103SKrishna Gudipati bfa_boolean_t reset_stats_pending; 87148d6103SKrishna Gudipati bfa_status_t get_attr_status; 88148d6103SKrishna Gudipati bfa_status_t get_stats_status; 89148d6103SKrishna Gudipati bfa_status_t reset_stats_status; 90148d6103SKrishna Gudipati struct bfa_cee_cbfn_s cbfn; 91148d6103SKrishna Gudipati struct bfa_ioc_notify_s ioc_notify; 92148d6103SKrishna Gudipati struct bfa_trc_mod_s *trcmod; 93148d6103SKrishna Gudipati struct bfa_cee_attr_s *attr; 94148d6103SKrishna Gudipati struct bfa_cee_stats_s *stats; 95148d6103SKrishna Gudipati struct bfa_dma_s attr_dma; 96148d6103SKrishna Gudipati struct bfa_dma_s stats_dma; 97148d6103SKrishna Gudipati struct bfa_ioc_s *ioc; 98148d6103SKrishna Gudipati struct bfa_mbox_cmd_s get_cfg_mb; 99148d6103SKrishna Gudipati struct bfa_mbox_cmd_s get_stats_mb; 100148d6103SKrishna Gudipati struct bfa_mbox_cmd_s reset_stats_mb; 101148d6103SKrishna Gudipati struct bfa_mem_dma_s cee_dma; 102148d6103SKrishna Gudipati }; 103148d6103SKrishna Gudipati 104148d6103SKrishna Gudipati #define BFA_MEM_CEE_DMA(__bfa) (&((__bfa)->modules.cee.cee_dma)) 105148d6103SKrishna Gudipati 106148d6103SKrishna Gudipati u32 bfa_cee_meminfo(void); 107148d6103SKrishna Gudipati void bfa_cee_mem_claim(struct bfa_cee_s *cee, u8 *dma_kva, u64 dma_pa); 108148d6103SKrishna Gudipati void bfa_cee_attach(struct bfa_cee_s *cee, 109148d6103SKrishna Gudipati struct bfa_ioc_s *ioc, void *dev); 110148d6103SKrishna Gudipati bfa_status_t bfa_cee_get_attr(struct bfa_cee_s *cee, 111148d6103SKrishna Gudipati struct bfa_cee_attr_s *attr, 112148d6103SKrishna Gudipati bfa_cee_get_attr_cbfn_t cbfn, void *cbarg); 113148d6103SKrishna Gudipati bfa_status_t bfa_cee_get_stats(struct bfa_cee_s *cee, 114148d6103SKrishna Gudipati struct bfa_cee_stats_s *stats, 115148d6103SKrishna Gudipati bfa_cee_get_stats_cbfn_t cbfn, void *cbarg); 116148d6103SKrishna Gudipati bfa_status_t bfa_cee_reset_stats(struct bfa_cee_s *cee, 117148d6103SKrishna Gudipati bfa_cee_reset_stats_cbfn_t cbfn, void *cbarg); 118148d6103SKrishna Gudipati 119a36c61f9SKrishna Gudipati #endif /* __BFA_PORT_H__ */ 120