Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 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_H__ |
| 18 | #define __BFA_H__ |
| 19 | |
Maggie Zhang | f16a175 | 2010-12-09 19:12:32 -0800 | [diff] [blame] | 20 | #include "bfad_drv.h" |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 21 | #include "bfa_cs.h" |
| 22 | #include "bfa_plog.h" |
| 23 | #include "bfa_defs_svc.h" |
| 24 | #include "bfi.h" |
| 25 | #include "bfa_ioc.h" |
| 26 | |
| 27 | struct bfa_s; |
| 28 | |
| 29 | typedef void (*bfa_isr_func_t) (struct bfa_s *bfa, struct bfi_msg_s *m); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 30 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 31 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 32 | * Interrupt message handlers |
| 33 | */ |
| 34 | void bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 35 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 36 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 37 | * Request and response queue related defines |
| 38 | */ |
| 39 | #define BFA_REQQ_NELEMS_MIN (4) |
| 40 | #define BFA_RSPQ_NELEMS_MIN (4) |
| 41 | |
| 42 | #define bfa_reqq_pi(__bfa, __reqq) ((__bfa)->iocfc.req_cq_pi[__reqq]) |
| 43 | #define bfa_reqq_ci(__bfa, __reqq) \ |
| 44 | (*(u32 *)((__bfa)->iocfc.req_cq_shadow_ci[__reqq].kva)) |
| 45 | |
| 46 | #define bfa_reqq_full(__bfa, __reqq) \ |
| 47 | (((bfa_reqq_pi(__bfa, __reqq) + 1) & \ |
| 48 | ((__bfa)->iocfc.cfg.drvcfg.num_reqq_elems - 1)) == \ |
| 49 | bfa_reqq_ci(__bfa, __reqq)) |
| 50 | |
| 51 | #define bfa_reqq_next(__bfa, __reqq) \ |
| 52 | (bfa_reqq_full(__bfa, __reqq) ? NULL : \ |
| 53 | ((void *)((struct bfi_msg_s *)((__bfa)->iocfc.req_cq_ba[__reqq].kva) \ |
| 54 | + bfa_reqq_pi((__bfa), (__reqq))))) |
| 55 | |
Krishna Gudipati | 3fd4598 | 2011-06-24 20:24:08 -0700 | [diff] [blame] | 56 | #define bfa_reqq_produce(__bfa, __reqq, __mh) do { \ |
| 57 | (__mh).mtag.h2i.qid = (__bfa)->iocfc.hw_qid[__reqq];\ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 58 | (__bfa)->iocfc.req_cq_pi[__reqq]++; \ |
| 59 | (__bfa)->iocfc.req_cq_pi[__reqq] &= \ |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 60 | ((__bfa)->iocfc.cfg.drvcfg.num_reqq_elems - 1); \ |
| 61 | writel((__bfa)->iocfc.req_cq_pi[__reqq], \ |
Jing Huang | 5344026 | 2010-10-18 17:12:29 -0700 | [diff] [blame] | 62 | (__bfa)->iocfc.bfa_regs.cpe_q_pi[__reqq]); \ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 63 | mmiowb(); \ |
| 64 | } while (0) |
| 65 | |
| 66 | #define bfa_rspq_pi(__bfa, __rspq) \ |
| 67 | (*(u32 *)((__bfa)->iocfc.rsp_cq_shadow_pi[__rspq].kva)) |
| 68 | |
| 69 | #define bfa_rspq_ci(__bfa, __rspq) ((__bfa)->iocfc.rsp_cq_ci[__rspq]) |
| 70 | #define bfa_rspq_elem(__bfa, __rspq, __ci) \ |
| 71 | (&((struct bfi_msg_s *)((__bfa)->iocfc.rsp_cq_ba[__rspq].kva))[__ci]) |
| 72 | |
| 73 | #define CQ_INCR(__index, __size) do { \ |
| 74 | (__index)++; \ |
| 75 | (__index) &= ((__size) - 1); \ |
| 76 | } while (0) |
| 77 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 78 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 79 | * Circular queue usage assignments |
| 80 | */ |
| 81 | enum { |
| 82 | BFA_REQQ_IOC = 0, /* all low-priority IOC msgs */ |
| 83 | BFA_REQQ_FCXP = 0, /* all FCXP messages */ |
| 84 | BFA_REQQ_LPS = 0, /* all lport service msgs */ |
| 85 | BFA_REQQ_PORT = 0, /* all port messages */ |
| 86 | BFA_REQQ_FLASH = 0, /* for flash module */ |
| 87 | BFA_REQQ_DIAG = 0, /* for diag module */ |
| 88 | BFA_REQQ_RPORT = 0, /* all port messages */ |
| 89 | BFA_REQQ_SBOOT = 0, /* all san boot messages */ |
| 90 | BFA_REQQ_QOS_LO = 1, /* all low priority IO */ |
| 91 | BFA_REQQ_QOS_MD = 2, /* all medium priority IO */ |
| 92 | BFA_REQQ_QOS_HI = 3, /* all high priority IO */ |
| 93 | }; |
| 94 | |
| 95 | static inline void |
| 96 | bfa_reqq_winit(struct bfa_reqq_wait_s *wqe, void (*qresume) (void *cbarg), |
| 97 | void *cbarg) |
| 98 | { |
| 99 | wqe->qresume = qresume; |
| 100 | wqe->cbarg = cbarg; |
| 101 | } |
| 102 | |
| 103 | #define bfa_reqq(__bfa, __reqq) (&(__bfa)->reqq_waitq[__reqq]) |
| 104 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 105 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 106 | * static inline void |
| 107 | * bfa_reqq_wait(struct bfa_s *bfa, int reqq, struct bfa_reqq_wait_s *wqe) |
| 108 | */ |
| 109 | #define bfa_reqq_wait(__bfa, __reqq, __wqe) do { \ |
| 110 | \ |
| 111 | struct list_head *waitq = bfa_reqq(__bfa, __reqq); \ |
| 112 | \ |
Jing Huang | d4b671c | 2010-12-26 21:46:35 -0800 | [diff] [blame] | 113 | WARN_ON(((__reqq) >= BFI_IOC_MAX_CQS)); \ |
| 114 | WARN_ON(!((__wqe)->qresume && (__wqe)->cbarg)); \ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 115 | \ |
| 116 | list_add_tail(&(__wqe)->qe, waitq); \ |
| 117 | } while (0) |
| 118 | |
| 119 | #define bfa_reqq_wcancel(__wqe) list_del(&(__wqe)->qe) |
| 120 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 121 | #define bfa_cb_queue(__bfa, __hcb_qe, __cbfn, __cbarg) do { \ |
| 122 | (__hcb_qe)->cbfn = (__cbfn); \ |
| 123 | (__hcb_qe)->cbarg = (__cbarg); \ |
| 124 | list_add_tail(&(__hcb_qe)->qe, &(__bfa)->comp_q); \ |
| 125 | } while (0) |
| 126 | |
| 127 | #define bfa_cb_dequeue(__hcb_qe) list_del(&(__hcb_qe)->qe) |
| 128 | |
| 129 | #define bfa_cb_queue_once(__bfa, __hcb_qe, __cbfn, __cbarg) do { \ |
| 130 | (__hcb_qe)->cbfn = (__cbfn); \ |
| 131 | (__hcb_qe)->cbarg = (__cbarg); \ |
| 132 | if (!(__hcb_qe)->once) { \ |
| 133 | list_add_tail(&(__hcb_qe)->qe, &(__bfa)->comp_q); \ |
| 134 | (__hcb_qe)->once = BFA_TRUE; \ |
| 135 | } \ |
| 136 | } while (0) |
| 137 | |
| 138 | #define bfa_cb_queue_done(__hcb_qe) do { \ |
| 139 | (__hcb_qe)->once = BFA_FALSE; \ |
| 140 | } while (0) |
| 141 | |
| 142 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 143 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 144 | * PCI devices supported by the current BFA |
| 145 | */ |
| 146 | struct bfa_pciid_s { |
| 147 | u16 device_id; |
| 148 | u16 vendor_id; |
| 149 | }; |
| 150 | |
| 151 | extern char bfa_version[]; |
| 152 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 153 | struct bfa_iocfc_regs_s { |
Jing Huang | 5344026 | 2010-10-18 17:12:29 -0700 | [diff] [blame] | 154 | void __iomem *intr_status; |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 155 | void __iomem *intr_mask; |
Jing Huang | 5344026 | 2010-10-18 17:12:29 -0700 | [diff] [blame] | 156 | void __iomem *cpe_q_pi[BFI_IOC_MAX_CQS]; |
| 157 | void __iomem *cpe_q_ci[BFI_IOC_MAX_CQS]; |
Jing Huang | 5344026 | 2010-10-18 17:12:29 -0700 | [diff] [blame] | 158 | void __iomem *cpe_q_ctrl[BFI_IOC_MAX_CQS]; |
| 159 | void __iomem *rme_q_ci[BFI_IOC_MAX_CQS]; |
| 160 | void __iomem *rme_q_pi[BFI_IOC_MAX_CQS]; |
Jing Huang | 5344026 | 2010-10-18 17:12:29 -0700 | [diff] [blame] | 161 | void __iomem *rme_q_ctrl[BFI_IOC_MAX_CQS]; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 162 | }; |
| 163 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 164 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 165 | * MSIX vector handlers |
| 166 | */ |
| 167 | #define BFA_MSIX_MAX_VECTORS 22 |
| 168 | typedef void (*bfa_msix_handler_t)(struct bfa_s *bfa, int vec); |
| 169 | struct bfa_msix_s { |
| 170 | int nvecs; |
| 171 | bfa_msix_handler_t handler[BFA_MSIX_MAX_VECTORS]; |
| 172 | }; |
| 173 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 174 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 175 | * Chip specific interfaces |
| 176 | */ |
| 177 | struct bfa_hwif_s { |
| 178 | void (*hw_reginit)(struct bfa_s *bfa); |
| 179 | void (*hw_reqq_ack)(struct bfa_s *bfa, int reqq); |
Krishna Gudipati | ca6e0ea | 2011-07-20 17:00:45 -0700 | [diff] [blame^] | 180 | void (*hw_rspq_ack)(struct bfa_s *bfa, int rspq, u32 ci); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 181 | void (*hw_msix_init)(struct bfa_s *bfa, int nvecs); |
Krishna Gudipati | 775c774 | 2011-06-13 15:52:12 -0700 | [diff] [blame] | 182 | void (*hw_msix_ctrl_install)(struct bfa_s *bfa); |
| 183 | void (*hw_msix_queue_install)(struct bfa_s *bfa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 184 | void (*hw_msix_uninstall)(struct bfa_s *bfa); |
| 185 | void (*hw_isr_mode_set)(struct bfa_s *bfa, bfa_boolean_t msix); |
| 186 | void (*hw_msix_getvecs)(struct bfa_s *bfa, u32 *vecmap, |
| 187 | u32 *nvecs, u32 *maxvec); |
| 188 | void (*hw_msix_get_rme_range) (struct bfa_s *bfa, u32 *start, |
| 189 | u32 *end); |
Krishna Gudipati | 1118920 | 2011-06-13 15:50:35 -0700 | [diff] [blame] | 190 | int cpe_vec_q0; |
| 191 | int rme_vec_q0; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 192 | }; |
| 193 | typedef void (*bfa_cb_iocfc_t) (void *cbarg, enum bfa_status status); |
| 194 | |
Krishna Gudipati | a714134 | 2011-06-24 20:23:19 -0700 | [diff] [blame] | 195 | struct bfa_faa_cbfn_s { |
| 196 | bfa_cb_iocfc_t faa_cbfn; |
| 197 | void *faa_cbarg; |
| 198 | }; |
| 199 | |
| 200 | #define BFA_FAA_ENABLED 1 |
| 201 | #define BFA_FAA_DISABLED 2 |
| 202 | |
| 203 | /* |
| 204 | * FAA attributes |
| 205 | */ |
| 206 | struct bfa_faa_attr_s { |
| 207 | wwn_t faa; |
| 208 | u8 faa_state; |
| 209 | u8 pwwn_source; |
| 210 | u8 rsvd[6]; |
| 211 | }; |
| 212 | |
| 213 | struct bfa_faa_args_s { |
| 214 | struct bfa_faa_attr_s *faa_attr; |
| 215 | struct bfa_faa_cbfn_s faa_cb; |
| 216 | u8 faa_state; |
| 217 | bfa_boolean_t busy; |
| 218 | }; |
| 219 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 220 | struct bfa_iocfc_s { |
| 221 | struct bfa_s *bfa; |
| 222 | struct bfa_iocfc_cfg_s cfg; |
| 223 | int action; |
| 224 | u32 req_cq_pi[BFI_IOC_MAX_CQS]; |
| 225 | u32 rsp_cq_ci[BFI_IOC_MAX_CQS]; |
Krishna Gudipati | 3fd4598 | 2011-06-24 20:24:08 -0700 | [diff] [blame] | 226 | u8 hw_qid[BFI_IOC_MAX_CQS]; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 227 | struct bfa_cb_qe_s init_hcb_qe; |
| 228 | struct bfa_cb_qe_s stop_hcb_qe; |
| 229 | struct bfa_cb_qe_s dis_hcb_qe; |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 230 | struct bfa_cb_qe_s en_hcb_qe; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 231 | struct bfa_cb_qe_s stats_hcb_qe; |
| 232 | bfa_boolean_t cfgdone; |
| 233 | |
| 234 | struct bfa_dma_s cfg_info; |
| 235 | struct bfi_iocfc_cfg_s *cfginfo; |
| 236 | struct bfa_dma_s cfgrsp_dma; |
| 237 | struct bfi_iocfc_cfgrsp_s *cfgrsp; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 238 | struct bfa_dma_s req_cq_ba[BFI_IOC_MAX_CQS]; |
| 239 | struct bfa_dma_s req_cq_shadow_ci[BFI_IOC_MAX_CQS]; |
| 240 | struct bfa_dma_s rsp_cq_ba[BFI_IOC_MAX_CQS]; |
| 241 | struct bfa_dma_s rsp_cq_shadow_pi[BFI_IOC_MAX_CQS]; |
| 242 | struct bfa_iocfc_regs_s bfa_regs; /* BFA device registers */ |
| 243 | struct bfa_hwif_s hwif; |
| 244 | bfa_cb_iocfc_t updateq_cbfn; /* bios callback function */ |
| 245 | void *updateq_cbarg; /* bios callback arg */ |
| 246 | u32 intr_mask; |
Krishna Gudipati | a714134 | 2011-06-24 20:23:19 -0700 | [diff] [blame] | 247 | struct bfa_faa_args_s faa_args; |
Krishna Gudipati | 4507025 | 2011-06-24 20:24:29 -0700 | [diff] [blame] | 248 | struct bfa_mem_dma_s ioc_dma; |
| 249 | struct bfa_mem_dma_s iocfc_dma; |
| 250 | struct bfa_mem_dma_s reqq_dma[BFI_IOC_MAX_CQS]; |
| 251 | struct bfa_mem_dma_s rspq_dma[BFI_IOC_MAX_CQS]; |
| 252 | struct bfa_mem_kva_s kva_seg; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 253 | }; |
| 254 | |
Krishna Gudipati | 4507025 | 2011-06-24 20:24:29 -0700 | [diff] [blame] | 255 | #define BFA_MEM_IOC_DMA(_bfa) (&((_bfa)->iocfc.ioc_dma)) |
| 256 | #define BFA_MEM_IOCFC_DMA(_bfa) (&((_bfa)->iocfc.iocfc_dma)) |
| 257 | #define BFA_MEM_REQQ_DMA(_bfa, _qno) (&((_bfa)->iocfc.reqq_dma[(_qno)])) |
| 258 | #define BFA_MEM_RSPQ_DMA(_bfa, _qno) (&((_bfa)->iocfc.rspq_dma[(_qno)])) |
| 259 | #define BFA_MEM_IOCFC_KVA(_bfa) (&((_bfa)->iocfc.kva_seg)) |
| 260 | |
Krishna Gudipati | 3fd4598 | 2011-06-24 20:24:08 -0700 | [diff] [blame] | 261 | #define bfa_fn_lpu(__bfa) \ |
| 262 | bfi_fn_lpu(bfa_ioc_pcifn(&(__bfa)->ioc), bfa_ioc_portid(&(__bfa)->ioc)) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 263 | #define bfa_msix_init(__bfa, __nvecs) \ |
| 264 | ((__bfa)->iocfc.hwif.hw_msix_init(__bfa, __nvecs)) |
Krishna Gudipati | 775c774 | 2011-06-13 15:52:12 -0700 | [diff] [blame] | 265 | #define bfa_msix_ctrl_install(__bfa) \ |
| 266 | ((__bfa)->iocfc.hwif.hw_msix_ctrl_install(__bfa)) |
| 267 | #define bfa_msix_queue_install(__bfa) \ |
| 268 | ((__bfa)->iocfc.hwif.hw_msix_queue_install(__bfa)) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 269 | #define bfa_msix_uninstall(__bfa) \ |
| 270 | ((__bfa)->iocfc.hwif.hw_msix_uninstall(__bfa)) |
Krishna Gudipati | ca6e0ea | 2011-07-20 17:00:45 -0700 | [diff] [blame^] | 271 | #define bfa_isr_rspq_ack(__bfa, __queue, __ci) \ |
| 272 | ((__bfa)->iocfc.hwif.hw_rspq_ack(__bfa, __queue, __ci)) |
Krishna Gudipati | 3fd4598 | 2011-06-24 20:24:08 -0700 | [diff] [blame] | 273 | #define bfa_isr_reqq_ack(__bfa, __queue) do { \ |
| 274 | if ((__bfa)->iocfc.hwif.hw_reqq_ack) \ |
| 275 | (__bfa)->iocfc.hwif.hw_reqq_ack(__bfa, __queue); \ |
| 276 | } while (0) |
Krishna Gudipati | 1118920 | 2011-06-13 15:50:35 -0700 | [diff] [blame] | 277 | #define bfa_isr_mode_set(__bfa, __msix) do { \ |
| 278 | if ((__bfa)->iocfc.hwif.hw_isr_mode_set) \ |
| 279 | (__bfa)->iocfc.hwif.hw_isr_mode_set(__bfa, __msix); \ |
| 280 | } while (0) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 281 | #define bfa_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec) \ |
| 282 | ((__bfa)->iocfc.hwif.hw_msix_getvecs(__bfa, __vecmap, \ |
| 283 | __nvecs, __maxvec)) |
| 284 | #define bfa_msix_get_rme_range(__bfa, __start, __end) \ |
| 285 | ((__bfa)->iocfc.hwif.hw_msix_get_rme_range(__bfa, __start, __end)) |
| 286 | #define bfa_msix(__bfa, __vec) \ |
| 287 | ((__bfa)->msix.handler[__vec](__bfa, __vec)) |
| 288 | |
| 289 | /* |
| 290 | * FC specific IOC functions. |
| 291 | */ |
Krishna Gudipati | 4507025 | 2011-06-24 20:24:29 -0700 | [diff] [blame] | 292 | void bfa_iocfc_meminfo(struct bfa_iocfc_cfg_s *cfg, |
| 293 | struct bfa_meminfo_s *meminfo, |
| 294 | struct bfa_s *bfa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 295 | void bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, |
| 296 | struct bfa_iocfc_cfg_s *cfg, |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 297 | struct bfa_pcidev_s *pcidev); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 298 | void bfa_iocfc_init(struct bfa_s *bfa); |
| 299 | void bfa_iocfc_start(struct bfa_s *bfa); |
| 300 | void bfa_iocfc_stop(struct bfa_s *bfa); |
| 301 | void bfa_iocfc_isr(void *bfa, struct bfi_mbmsg_s *msg); |
Krishna Gudipati | 4507025 | 2011-06-24 20:24:29 -0700 | [diff] [blame] | 302 | void bfa_iocfc_set_snsbase(struct bfa_s *bfa, int seg_no, u64 snsbase_pa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 303 | bfa_boolean_t bfa_iocfc_is_operational(struct bfa_s *bfa); |
| 304 | void bfa_iocfc_reset_queues(struct bfa_s *bfa); |
| 305 | |
| 306 | void bfa_msix_all(struct bfa_s *bfa, int vec); |
| 307 | void bfa_msix_reqq(struct bfa_s *bfa, int vec); |
| 308 | void bfa_msix_rspq(struct bfa_s *bfa, int vec); |
| 309 | void bfa_msix_lpu_err(struct bfa_s *bfa, int vec); |
| 310 | |
| 311 | void bfa_hwcb_reginit(struct bfa_s *bfa); |
Krishna Gudipati | ca6e0ea | 2011-07-20 17:00:45 -0700 | [diff] [blame^] | 312 | void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 313 | void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs); |
Krishna Gudipati | 775c774 | 2011-06-13 15:52:12 -0700 | [diff] [blame] | 314 | void bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa); |
| 315 | void bfa_hwcb_msix_queue_install(struct bfa_s *bfa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 316 | void bfa_hwcb_msix_uninstall(struct bfa_s *bfa); |
| 317 | void bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix); |
| 318 | void bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs, |
| 319 | u32 *maxvec); |
| 320 | void bfa_hwcb_msix_get_rme_range(struct bfa_s *bfa, u32 *start, |
| 321 | u32 *end); |
| 322 | void bfa_hwct_reginit(struct bfa_s *bfa); |
Krishna Gudipati | 1118920 | 2011-06-13 15:50:35 -0700 | [diff] [blame] | 323 | void bfa_hwct2_reginit(struct bfa_s *bfa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 324 | void bfa_hwct_reqq_ack(struct bfa_s *bfa, int rspq); |
Krishna Gudipati | ca6e0ea | 2011-07-20 17:00:45 -0700 | [diff] [blame^] | 325 | void bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci); |
| 326 | void bfa_hwct2_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 327 | void bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs); |
Krishna Gudipati | 775c774 | 2011-06-13 15:52:12 -0700 | [diff] [blame] | 328 | void bfa_hwct_msix_ctrl_install(struct bfa_s *bfa); |
| 329 | void bfa_hwct_msix_queue_install(struct bfa_s *bfa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 330 | void bfa_hwct_msix_uninstall(struct bfa_s *bfa); |
| 331 | void bfa_hwct_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix); |
| 332 | void bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs, |
| 333 | u32 *maxvec); |
| 334 | void bfa_hwct_msix_get_rme_range(struct bfa_s *bfa, u32 *start, |
| 335 | u32 *end); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 336 | void bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t *wwns); |
| 337 | wwn_t bfa_iocfc_get_pwwn(struct bfa_s *bfa); |
| 338 | wwn_t bfa_iocfc_get_nwwn(struct bfa_s *bfa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 339 | int bfa_iocfc_get_pbc_vports(struct bfa_s *bfa, |
| 340 | struct bfi_pbc_vport_s *pbc_vport); |
| 341 | |
| 342 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 343 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 344 | *---------------------------------------------------------------------- |
| 345 | * BFA public interfaces |
| 346 | *---------------------------------------------------------------------- |
| 347 | */ |
| 348 | #define bfa_stats(_mod, _stats) ((_mod)->stats._stats++) |
| 349 | #define bfa_ioc_get_stats(__bfa, __ioc_stats) \ |
| 350 | bfa_ioc_fetch_stats(&(__bfa)->ioc, __ioc_stats) |
| 351 | #define bfa_ioc_clear_stats(__bfa) \ |
| 352 | bfa_ioc_clr_stats(&(__bfa)->ioc) |
| 353 | #define bfa_get_nports(__bfa) \ |
| 354 | bfa_ioc_get_nports(&(__bfa)->ioc) |
| 355 | #define bfa_get_adapter_manufacturer(__bfa, __manufacturer) \ |
| 356 | bfa_ioc_get_adapter_manufacturer(&(__bfa)->ioc, __manufacturer) |
| 357 | #define bfa_get_adapter_model(__bfa, __model) \ |
| 358 | bfa_ioc_get_adapter_model(&(__bfa)->ioc, __model) |
| 359 | #define bfa_get_adapter_serial_num(__bfa, __serial_num) \ |
| 360 | bfa_ioc_get_adapter_serial_num(&(__bfa)->ioc, __serial_num) |
| 361 | #define bfa_get_adapter_fw_ver(__bfa, __fw_ver) \ |
| 362 | bfa_ioc_get_adapter_fw_ver(&(__bfa)->ioc, __fw_ver) |
| 363 | #define bfa_get_adapter_optrom_ver(__bfa, __optrom_ver) \ |
| 364 | bfa_ioc_get_adapter_optrom_ver(&(__bfa)->ioc, __optrom_ver) |
| 365 | #define bfa_get_pci_chip_rev(__bfa, __chip_rev) \ |
| 366 | bfa_ioc_get_pci_chip_rev(&(__bfa)->ioc, __chip_rev) |
| 367 | #define bfa_get_ioc_state(__bfa) \ |
| 368 | bfa_ioc_get_state(&(__bfa)->ioc) |
| 369 | #define bfa_get_type(__bfa) \ |
| 370 | bfa_ioc_get_type(&(__bfa)->ioc) |
| 371 | #define bfa_get_mac(__bfa) \ |
| 372 | bfa_ioc_get_mac(&(__bfa)->ioc) |
| 373 | #define bfa_get_mfg_mac(__bfa) \ |
| 374 | bfa_ioc_get_mfg_mac(&(__bfa)->ioc) |
| 375 | #define bfa_get_fw_clock_res(__bfa) \ |
| 376 | ((__bfa)->iocfc.cfgrsp->fwcfg.fw_tick_res) |
| 377 | |
| 378 | void bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids); |
| 379 | void bfa_cfg_get_default(struct bfa_iocfc_cfg_s *cfg); |
| 380 | void bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg); |
| 381 | void bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, |
Krishna Gudipati | 4507025 | 2011-06-24 20:24:29 -0700 | [diff] [blame] | 382 | struct bfa_meminfo_s *meminfo, |
| 383 | struct bfa_s *bfa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 384 | void bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, |
| 385 | struct bfa_meminfo_s *meminfo, |
| 386 | struct bfa_pcidev_s *pcidev); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 387 | void bfa_detach(struct bfa_s *bfa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 388 | void bfa_cb_init(void *bfad, bfa_status_t status); |
| 389 | void bfa_cb_updateq(void *bfad, bfa_status_t status); |
| 390 | |
| 391 | bfa_boolean_t bfa_intx(struct bfa_s *bfa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 392 | void bfa_isr_enable(struct bfa_s *bfa); |
| 393 | void bfa_isr_disable(struct bfa_s *bfa); |
| 394 | |
| 395 | void bfa_comp_deq(struct bfa_s *bfa, struct list_head *comp_q); |
| 396 | void bfa_comp_process(struct bfa_s *bfa, struct list_head *comp_q); |
| 397 | void bfa_comp_free(struct bfa_s *bfa, struct list_head *comp_q); |
| 398 | |
| 399 | typedef void (*bfa_cb_ioc_t) (void *cbarg, enum bfa_status status); |
| 400 | void bfa_iocfc_get_attr(struct bfa_s *bfa, struct bfa_iocfc_attr_s *attr); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 401 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 402 | |
| 403 | bfa_status_t bfa_iocfc_israttr_set(struct bfa_s *bfa, |
| 404 | struct bfa_iocfc_intr_attr_s *attr); |
| 405 | |
| 406 | void bfa_iocfc_enable(struct bfa_s *bfa); |
| 407 | void bfa_iocfc_disable(struct bfa_s *bfa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 408 | #define bfa_timer_start(_bfa, _timer, _timercb, _arg, _timeout) \ |
| 409 | bfa_timer_begin(&(_bfa)->timer_mod, _timer, _timercb, _arg, _timeout) |
| 410 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 411 | #endif /* __BFA_H__ */ |