Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 1 | /* |
Anil Gurumurthy | 889d0d4 | 2015-11-26 03:54:45 -0500 | [diff] [blame] | 2 | * Copyright (c) 2005-2014 Brocade Communications Systems, Inc. |
| 3 | * Copyright (c) 2014- QLogic Corporation. |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 4 | * All rights reserved |
Anil Gurumurthy | 889d0d4 | 2015-11-26 03:54:45 -0500 | [diff] [blame] | 5 | * www.qlogic.com |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 6 | * |
Anil Gurumurthy | 31e1d56 | 2015-11-26 03:54:46 -0500 | [diff] [blame] | 7 | * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter. |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 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 | |
| 19 | #ifndef __BFA_PORT_H__ |
| 20 | #define __BFA_PORT_H__ |
| 21 | |
| 22 | #include "bfa_defs_svc.h" |
| 23 | #include "bfa_ioc.h" |
| 24 | #include "bfa_cs.h" |
| 25 | |
| 26 | typedef void (*bfa_port_stats_cbfn_t) (void *dev, bfa_status_t status); |
| 27 | typedef void (*bfa_port_endis_cbfn_t) (void *dev, bfa_status_t status); |
| 28 | |
| 29 | struct bfa_port_s { |
| 30 | void *dev; |
| 31 | struct bfa_ioc_s *ioc; |
| 32 | struct bfa_trc_mod_s *trcmod; |
| 33 | u32 msgtag; |
| 34 | bfa_boolean_t stats_busy; |
| 35 | struct bfa_mbox_cmd_s stats_mb; |
| 36 | bfa_port_stats_cbfn_t stats_cbfn; |
| 37 | void *stats_cbarg; |
| 38 | bfa_status_t stats_status; |
| 39 | u32 stats_reset_time; |
| 40 | union bfa_port_stats_u *stats; |
| 41 | struct bfa_dma_s stats_dma; |
| 42 | bfa_boolean_t endis_pending; |
| 43 | struct bfa_mbox_cmd_s endis_mb; |
| 44 | bfa_port_endis_cbfn_t endis_cbfn; |
| 45 | void *endis_cbarg; |
| 46 | bfa_status_t endis_status; |
Krishna Gudipati | d37779f | 2011-06-13 15:42:10 -0700 | [diff] [blame] | 47 | struct bfa_ioc_notify_s ioc_notify; |
Krishna Gudipati | 43ffdf4 | 2011-06-13 15:46:21 -0700 | [diff] [blame] | 48 | bfa_boolean_t pbc_disabled; |
Krishna Gudipati | e353546 | 2012-09-21 17:26:07 -0700 | [diff] [blame] | 49 | bfa_boolean_t dport_enabled; |
Krishna Gudipati | 4507025 | 2011-06-24 20:24:29 -0700 | [diff] [blame] | 50 | struct bfa_mem_dma_s port_dma; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 51 | }; |
| 52 | |
Krishna Gudipati | 4507025 | 2011-06-24 20:24:29 -0700 | [diff] [blame] | 53 | #define BFA_MEM_PORT_DMA(__bfa) (&((__bfa)->modules.port.port_dma)) |
| 54 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 55 | void bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, |
| 56 | void *dev, struct bfa_trc_mod_s *trcmod); |
Krishna Gudipati | d37779f | 2011-06-13 15:42:10 -0700 | [diff] [blame] | 57 | void bfa_port_notify(void *arg, enum bfa_ioc_event_e event); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 58 | |
| 59 | bfa_status_t bfa_port_get_stats(struct bfa_port_s *port, |
| 60 | union bfa_port_stats_u *stats, |
| 61 | bfa_port_stats_cbfn_t cbfn, void *cbarg); |
| 62 | bfa_status_t bfa_port_clear_stats(struct bfa_port_s *port, |
| 63 | bfa_port_stats_cbfn_t cbfn, void *cbarg); |
| 64 | bfa_status_t bfa_port_enable(struct bfa_port_s *port, |
| 65 | bfa_port_endis_cbfn_t cbfn, void *cbarg); |
| 66 | bfa_status_t bfa_port_disable(struct bfa_port_s *port, |
| 67 | bfa_port_endis_cbfn_t cbfn, void *cbarg); |
| 68 | u32 bfa_port_meminfo(void); |
| 69 | void bfa_port_mem_claim(struct bfa_port_s *port, |
| 70 | u8 *dma_kva, u64 dma_pa); |
Krishna Gudipati | e353546 | 2012-09-21 17:26:07 -0700 | [diff] [blame] | 71 | void bfa_port_set_dportenabled(struct bfa_port_s *port, |
| 72 | bfa_boolean_t enabled); |
Krishna Gudipati | 148d610 | 2011-06-24 20:25:36 -0700 | [diff] [blame] | 73 | |
| 74 | /* |
| 75 | * CEE declaration |
| 76 | */ |
| 77 | typedef void (*bfa_cee_get_attr_cbfn_t) (void *dev, bfa_status_t status); |
| 78 | typedef void (*bfa_cee_get_stats_cbfn_t) (void *dev, bfa_status_t status); |
| 79 | typedef void (*bfa_cee_reset_stats_cbfn_t) (void *dev, bfa_status_t status); |
| 80 | |
| 81 | struct bfa_cee_cbfn_s { |
| 82 | bfa_cee_get_attr_cbfn_t get_attr_cbfn; |
| 83 | void *get_attr_cbarg; |
| 84 | bfa_cee_get_stats_cbfn_t get_stats_cbfn; |
| 85 | void *get_stats_cbarg; |
| 86 | bfa_cee_reset_stats_cbfn_t reset_stats_cbfn; |
| 87 | void *reset_stats_cbarg; |
| 88 | }; |
| 89 | |
| 90 | struct bfa_cee_s { |
| 91 | void *dev; |
| 92 | bfa_boolean_t get_attr_pending; |
| 93 | bfa_boolean_t get_stats_pending; |
| 94 | bfa_boolean_t reset_stats_pending; |
| 95 | bfa_status_t get_attr_status; |
| 96 | bfa_status_t get_stats_status; |
| 97 | bfa_status_t reset_stats_status; |
| 98 | struct bfa_cee_cbfn_s cbfn; |
| 99 | struct bfa_ioc_notify_s ioc_notify; |
| 100 | struct bfa_trc_mod_s *trcmod; |
| 101 | struct bfa_cee_attr_s *attr; |
| 102 | struct bfa_cee_stats_s *stats; |
| 103 | struct bfa_dma_s attr_dma; |
| 104 | struct bfa_dma_s stats_dma; |
| 105 | struct bfa_ioc_s *ioc; |
| 106 | struct bfa_mbox_cmd_s get_cfg_mb; |
| 107 | struct bfa_mbox_cmd_s get_stats_mb; |
| 108 | struct bfa_mbox_cmd_s reset_stats_mb; |
| 109 | struct bfa_mem_dma_s cee_dma; |
| 110 | }; |
| 111 | |
| 112 | #define BFA_MEM_CEE_DMA(__bfa) (&((__bfa)->modules.cee.cee_dma)) |
| 113 | |
| 114 | u32 bfa_cee_meminfo(void); |
| 115 | void bfa_cee_mem_claim(struct bfa_cee_s *cee, u8 *dma_kva, u64 dma_pa); |
| 116 | void bfa_cee_attach(struct bfa_cee_s *cee, |
| 117 | struct bfa_ioc_s *ioc, void *dev); |
| 118 | bfa_status_t bfa_cee_get_attr(struct bfa_cee_s *cee, |
| 119 | struct bfa_cee_attr_s *attr, |
| 120 | bfa_cee_get_attr_cbfn_t cbfn, void *cbarg); |
| 121 | bfa_status_t bfa_cee_get_stats(struct bfa_cee_s *cee, |
| 122 | struct bfa_cee_stats_s *stats, |
| 123 | bfa_cee_get_stats_cbfn_t cbfn, void *cbarg); |
| 124 | bfa_status_t bfa_cee_reset_stats(struct bfa_cee_s *cee, |
| 125 | bfa_cee_reset_stats_cbfn_t cbfn, void *cbarg); |
| 126 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 127 | #endif /* __BFA_PORT_H__ */ |