blob: 67742dca675fb0504c3750cca545fb153c1b57cc [file] [log] [blame]
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001/*
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 Zhangf16a1752010-12-09 19:12:32 -080020#include "bfad_drv.h"
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070021#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
27struct bfa_s;
28
29typedef void (*bfa_isr_func_t) (struct bfa_s *bfa, struct bfi_msg_s *m);
30typedef void (*bfa_cb_cbfn_t) (void *cbarg, bfa_boolean_t complete);
31
Jing Huangacdc79a2010-10-18 17:15:55 -070032/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070033 * Interrupt message handlers
34 */
35void bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070036
Jing Huangacdc79a2010-10-18 17:15:55 -070037/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070038 * Request and response queue related defines
39 */
40#define BFA_REQQ_NELEMS_MIN (4)
41#define BFA_RSPQ_NELEMS_MIN (4)
42
43#define bfa_reqq_pi(__bfa, __reqq) ((__bfa)->iocfc.req_cq_pi[__reqq])
44#define bfa_reqq_ci(__bfa, __reqq) \
45 (*(u32 *)((__bfa)->iocfc.req_cq_shadow_ci[__reqq].kva))
46
47#define bfa_reqq_full(__bfa, __reqq) \
48 (((bfa_reqq_pi(__bfa, __reqq) + 1) & \
49 ((__bfa)->iocfc.cfg.drvcfg.num_reqq_elems - 1)) == \
50 bfa_reqq_ci(__bfa, __reqq))
51
52#define bfa_reqq_next(__bfa, __reqq) \
53 (bfa_reqq_full(__bfa, __reqq) ? NULL : \
54 ((void *)((struct bfi_msg_s *)((__bfa)->iocfc.req_cq_ba[__reqq].kva) \
55 + bfa_reqq_pi((__bfa), (__reqq)))))
56
Krishna Gudipati3fd45982011-06-24 20:24:08 -070057#define bfa_reqq_produce(__bfa, __reqq, __mh) do { \
58 (__mh).mtag.h2i.qid = (__bfa)->iocfc.hw_qid[__reqq];\
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070059 (__bfa)->iocfc.req_cq_pi[__reqq]++; \
60 (__bfa)->iocfc.req_cq_pi[__reqq] &= \
Jing Huangacdc79a2010-10-18 17:15:55 -070061 ((__bfa)->iocfc.cfg.drvcfg.num_reqq_elems - 1); \
62 writel((__bfa)->iocfc.req_cq_pi[__reqq], \
Jing Huang53440262010-10-18 17:12:29 -070063 (__bfa)->iocfc.bfa_regs.cpe_q_pi[__reqq]); \
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070064 mmiowb(); \
65 } while (0)
66
67#define bfa_rspq_pi(__bfa, __rspq) \
68 (*(u32 *)((__bfa)->iocfc.rsp_cq_shadow_pi[__rspq].kva))
69
70#define bfa_rspq_ci(__bfa, __rspq) ((__bfa)->iocfc.rsp_cq_ci[__rspq])
71#define bfa_rspq_elem(__bfa, __rspq, __ci) \
72 (&((struct bfi_msg_s *)((__bfa)->iocfc.rsp_cq_ba[__rspq].kva))[__ci])
73
74#define CQ_INCR(__index, __size) do { \
75 (__index)++; \
76 (__index) &= ((__size) - 1); \
77} while (0)
78
Jing Huangacdc79a2010-10-18 17:15:55 -070079/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070080 * Queue element to wait for room in request queue. FIFO order is
81 * maintained when fullfilling requests.
82 */
83struct bfa_reqq_wait_s {
84 struct list_head qe;
85 void (*qresume) (void *cbarg);
86 void *cbarg;
87};
88
Jing Huangacdc79a2010-10-18 17:15:55 -070089/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070090 * Circular queue usage assignments
91 */
92enum {
93 BFA_REQQ_IOC = 0, /* all low-priority IOC msgs */
94 BFA_REQQ_FCXP = 0, /* all FCXP messages */
95 BFA_REQQ_LPS = 0, /* all lport service msgs */
96 BFA_REQQ_PORT = 0, /* all port messages */
97 BFA_REQQ_FLASH = 0, /* for flash module */
98 BFA_REQQ_DIAG = 0, /* for diag module */
99 BFA_REQQ_RPORT = 0, /* all port messages */
100 BFA_REQQ_SBOOT = 0, /* all san boot messages */
101 BFA_REQQ_QOS_LO = 1, /* all low priority IO */
102 BFA_REQQ_QOS_MD = 2, /* all medium priority IO */
103 BFA_REQQ_QOS_HI = 3, /* all high priority IO */
104};
105
106static inline void
107bfa_reqq_winit(struct bfa_reqq_wait_s *wqe, void (*qresume) (void *cbarg),
108 void *cbarg)
109{
110 wqe->qresume = qresume;
111 wqe->cbarg = cbarg;
112}
113
114#define bfa_reqq(__bfa, __reqq) (&(__bfa)->reqq_waitq[__reqq])
115
Jing Huangacdc79a2010-10-18 17:15:55 -0700116/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700117 * static inline void
118 * bfa_reqq_wait(struct bfa_s *bfa, int reqq, struct bfa_reqq_wait_s *wqe)
119 */
120#define bfa_reqq_wait(__bfa, __reqq, __wqe) do { \
121 \
122 struct list_head *waitq = bfa_reqq(__bfa, __reqq); \
123 \
Jing Huangd4b671c2010-12-26 21:46:35 -0800124 WARN_ON(((__reqq) >= BFI_IOC_MAX_CQS)); \
125 WARN_ON(!((__wqe)->qresume && (__wqe)->cbarg)); \
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700126 \
127 list_add_tail(&(__wqe)->qe, waitq); \
128 } while (0)
129
130#define bfa_reqq_wcancel(__wqe) list_del(&(__wqe)->qe)
131
132
Jing Huangacdc79a2010-10-18 17:15:55 -0700133/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700134 * Generic BFA callback element.
135 */
136struct bfa_cb_qe_s {
137 struct list_head qe;
138 bfa_cb_cbfn_t cbfn;
139 bfa_boolean_t once;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700140 void *cbarg;
141};
142
143#define bfa_cb_queue(__bfa, __hcb_qe, __cbfn, __cbarg) do { \
144 (__hcb_qe)->cbfn = (__cbfn); \
145 (__hcb_qe)->cbarg = (__cbarg); \
146 list_add_tail(&(__hcb_qe)->qe, &(__bfa)->comp_q); \
147 } while (0)
148
149#define bfa_cb_dequeue(__hcb_qe) list_del(&(__hcb_qe)->qe)
150
151#define bfa_cb_queue_once(__bfa, __hcb_qe, __cbfn, __cbarg) do { \
152 (__hcb_qe)->cbfn = (__cbfn); \
153 (__hcb_qe)->cbarg = (__cbarg); \
154 if (!(__hcb_qe)->once) { \
155 list_add_tail(&(__hcb_qe)->qe, &(__bfa)->comp_q); \
156 (__hcb_qe)->once = BFA_TRUE; \
157 } \
158 } while (0)
159
160#define bfa_cb_queue_done(__hcb_qe) do { \
161 (__hcb_qe)->once = BFA_FALSE; \
162 } while (0)
163
164
Jing Huangacdc79a2010-10-18 17:15:55 -0700165/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700166 * PCI devices supported by the current BFA
167 */
168struct bfa_pciid_s {
169 u16 device_id;
170 u16 vendor_id;
171};
172
173extern char bfa_version[];
174
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700175struct bfa_iocfc_regs_s {
Jing Huang53440262010-10-18 17:12:29 -0700176 void __iomem *intr_status;
Jing Huangacdc79a2010-10-18 17:15:55 -0700177 void __iomem *intr_mask;
Jing Huang53440262010-10-18 17:12:29 -0700178 void __iomem *cpe_q_pi[BFI_IOC_MAX_CQS];
179 void __iomem *cpe_q_ci[BFI_IOC_MAX_CQS];
Jing Huang53440262010-10-18 17:12:29 -0700180 void __iomem *cpe_q_ctrl[BFI_IOC_MAX_CQS];
181 void __iomem *rme_q_ci[BFI_IOC_MAX_CQS];
182 void __iomem *rme_q_pi[BFI_IOC_MAX_CQS];
Jing Huang53440262010-10-18 17:12:29 -0700183 void __iomem *rme_q_ctrl[BFI_IOC_MAX_CQS];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700184};
185
Jing Huangacdc79a2010-10-18 17:15:55 -0700186/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700187 * MSIX vector handlers
188 */
189#define BFA_MSIX_MAX_VECTORS 22
190typedef void (*bfa_msix_handler_t)(struct bfa_s *bfa, int vec);
191struct bfa_msix_s {
192 int nvecs;
193 bfa_msix_handler_t handler[BFA_MSIX_MAX_VECTORS];
194};
195
Jing Huangacdc79a2010-10-18 17:15:55 -0700196/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700197 * Chip specific interfaces
198 */
199struct bfa_hwif_s {
200 void (*hw_reginit)(struct bfa_s *bfa);
201 void (*hw_reqq_ack)(struct bfa_s *bfa, int reqq);
202 void (*hw_rspq_ack)(struct bfa_s *bfa, int rspq);
203 void (*hw_msix_init)(struct bfa_s *bfa, int nvecs);
Krishna Gudipati775c7742011-06-13 15:52:12 -0700204 void (*hw_msix_ctrl_install)(struct bfa_s *bfa);
205 void (*hw_msix_queue_install)(struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700206 void (*hw_msix_uninstall)(struct bfa_s *bfa);
207 void (*hw_isr_mode_set)(struct bfa_s *bfa, bfa_boolean_t msix);
208 void (*hw_msix_getvecs)(struct bfa_s *bfa, u32 *vecmap,
209 u32 *nvecs, u32 *maxvec);
210 void (*hw_msix_get_rme_range) (struct bfa_s *bfa, u32 *start,
211 u32 *end);
Krishna Gudipati11189202011-06-13 15:50:35 -0700212 int cpe_vec_q0;
213 int rme_vec_q0;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700214};
215typedef void (*bfa_cb_iocfc_t) (void *cbarg, enum bfa_status status);
216
Krishna Gudipatia7141342011-06-24 20:23:19 -0700217struct bfa_faa_cbfn_s {
218 bfa_cb_iocfc_t faa_cbfn;
219 void *faa_cbarg;
220};
221
222#define BFA_FAA_ENABLED 1
223#define BFA_FAA_DISABLED 2
224
225/*
226 * FAA attributes
227 */
228struct bfa_faa_attr_s {
229 wwn_t faa;
230 u8 faa_state;
231 u8 pwwn_source;
232 u8 rsvd[6];
233};
234
235struct bfa_faa_args_s {
236 struct bfa_faa_attr_s *faa_attr;
237 struct bfa_faa_cbfn_s faa_cb;
238 u8 faa_state;
239 bfa_boolean_t busy;
240};
241
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700242struct bfa_iocfc_s {
243 struct bfa_s *bfa;
244 struct bfa_iocfc_cfg_s cfg;
245 int action;
246 u32 req_cq_pi[BFI_IOC_MAX_CQS];
247 u32 rsp_cq_ci[BFI_IOC_MAX_CQS];
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700248 u8 hw_qid[BFI_IOC_MAX_CQS];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700249 struct bfa_cb_qe_s init_hcb_qe;
250 struct bfa_cb_qe_s stop_hcb_qe;
251 struct bfa_cb_qe_s dis_hcb_qe;
252 struct bfa_cb_qe_s stats_hcb_qe;
253 bfa_boolean_t cfgdone;
254
255 struct bfa_dma_s cfg_info;
256 struct bfi_iocfc_cfg_s *cfginfo;
257 struct bfa_dma_s cfgrsp_dma;
258 struct bfi_iocfc_cfgrsp_s *cfgrsp;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700259 struct bfa_dma_s req_cq_ba[BFI_IOC_MAX_CQS];
260 struct bfa_dma_s req_cq_shadow_ci[BFI_IOC_MAX_CQS];
261 struct bfa_dma_s rsp_cq_ba[BFI_IOC_MAX_CQS];
262 struct bfa_dma_s rsp_cq_shadow_pi[BFI_IOC_MAX_CQS];
263 struct bfa_iocfc_regs_s bfa_regs; /* BFA device registers */
264 struct bfa_hwif_s hwif;
265 bfa_cb_iocfc_t updateq_cbfn; /* bios callback function */
266 void *updateq_cbarg; /* bios callback arg */
267 u32 intr_mask;
Krishna Gudipatia7141342011-06-24 20:23:19 -0700268 struct bfa_faa_args_s faa_args;
Krishna Gudipati45070252011-06-24 20:24:29 -0700269 struct bfa_mem_dma_s ioc_dma;
270 struct bfa_mem_dma_s iocfc_dma;
271 struct bfa_mem_dma_s reqq_dma[BFI_IOC_MAX_CQS];
272 struct bfa_mem_dma_s rspq_dma[BFI_IOC_MAX_CQS];
273 struct bfa_mem_kva_s kva_seg;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700274};
275
Krishna Gudipati45070252011-06-24 20:24:29 -0700276#define BFA_MEM_IOC_DMA(_bfa) (&((_bfa)->iocfc.ioc_dma))
277#define BFA_MEM_IOCFC_DMA(_bfa) (&((_bfa)->iocfc.iocfc_dma))
278#define BFA_MEM_REQQ_DMA(_bfa, _qno) (&((_bfa)->iocfc.reqq_dma[(_qno)]))
279#define BFA_MEM_RSPQ_DMA(_bfa, _qno) (&((_bfa)->iocfc.rspq_dma[(_qno)]))
280#define BFA_MEM_IOCFC_KVA(_bfa) (&((_bfa)->iocfc.kva_seg))
281
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700282#define bfa_fn_lpu(__bfa) \
283 bfi_fn_lpu(bfa_ioc_pcifn(&(__bfa)->ioc), bfa_ioc_portid(&(__bfa)->ioc))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700284#define bfa_msix_init(__bfa, __nvecs) \
285 ((__bfa)->iocfc.hwif.hw_msix_init(__bfa, __nvecs))
Krishna Gudipati775c7742011-06-13 15:52:12 -0700286#define bfa_msix_ctrl_install(__bfa) \
287 ((__bfa)->iocfc.hwif.hw_msix_ctrl_install(__bfa))
288#define bfa_msix_queue_install(__bfa) \
289 ((__bfa)->iocfc.hwif.hw_msix_queue_install(__bfa))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700290#define bfa_msix_uninstall(__bfa) \
291 ((__bfa)->iocfc.hwif.hw_msix_uninstall(__bfa))
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700292#define bfa_isr_rspq_ack(__bfa, __queue) do { \
293 if ((__bfa)->iocfc.hwif.hw_rspq_ack) \
294 (__bfa)->iocfc.hwif.hw_rspq_ack(__bfa, __queue); \
295} while (0)
296#define bfa_isr_reqq_ack(__bfa, __queue) do { \
297 if ((__bfa)->iocfc.hwif.hw_reqq_ack) \
298 (__bfa)->iocfc.hwif.hw_reqq_ack(__bfa, __queue); \
299} while (0)
Krishna Gudipati11189202011-06-13 15:50:35 -0700300#define bfa_isr_mode_set(__bfa, __msix) do { \
301 if ((__bfa)->iocfc.hwif.hw_isr_mode_set) \
302 (__bfa)->iocfc.hwif.hw_isr_mode_set(__bfa, __msix); \
303} while (0)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700304#define bfa_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec) \
305 ((__bfa)->iocfc.hwif.hw_msix_getvecs(__bfa, __vecmap, \
306 __nvecs, __maxvec))
307#define bfa_msix_get_rme_range(__bfa, __start, __end) \
308 ((__bfa)->iocfc.hwif.hw_msix_get_rme_range(__bfa, __start, __end))
309#define bfa_msix(__bfa, __vec) \
310 ((__bfa)->msix.handler[__vec](__bfa, __vec))
311
312/*
313 * FC specific IOC functions.
314 */
Krishna Gudipati45070252011-06-24 20:24:29 -0700315void bfa_iocfc_meminfo(struct bfa_iocfc_cfg_s *cfg,
316 struct bfa_meminfo_s *meminfo,
317 struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700318void bfa_iocfc_attach(struct bfa_s *bfa, void *bfad,
319 struct bfa_iocfc_cfg_s *cfg,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700320 struct bfa_pcidev_s *pcidev);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700321void bfa_iocfc_init(struct bfa_s *bfa);
322void bfa_iocfc_start(struct bfa_s *bfa);
323void bfa_iocfc_stop(struct bfa_s *bfa);
324void bfa_iocfc_isr(void *bfa, struct bfi_mbmsg_s *msg);
Krishna Gudipati45070252011-06-24 20:24:29 -0700325void bfa_iocfc_set_snsbase(struct bfa_s *bfa, int seg_no, u64 snsbase_pa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700326bfa_boolean_t bfa_iocfc_is_operational(struct bfa_s *bfa);
327void bfa_iocfc_reset_queues(struct bfa_s *bfa);
328
329void bfa_msix_all(struct bfa_s *bfa, int vec);
330void bfa_msix_reqq(struct bfa_s *bfa, int vec);
331void bfa_msix_rspq(struct bfa_s *bfa, int vec);
332void bfa_msix_lpu_err(struct bfa_s *bfa, int vec);
333
334void bfa_hwcb_reginit(struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700335void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq);
336void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs);
Krishna Gudipati775c7742011-06-13 15:52:12 -0700337void bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa);
338void bfa_hwcb_msix_queue_install(struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700339void bfa_hwcb_msix_uninstall(struct bfa_s *bfa);
340void bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix);
341void bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs,
342 u32 *maxvec);
343void bfa_hwcb_msix_get_rme_range(struct bfa_s *bfa, u32 *start,
344 u32 *end);
345void bfa_hwct_reginit(struct bfa_s *bfa);
Krishna Gudipati11189202011-06-13 15:50:35 -0700346void bfa_hwct2_reginit(struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700347void bfa_hwct_reqq_ack(struct bfa_s *bfa, int rspq);
348void bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq);
349void bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs);
Krishna Gudipati775c7742011-06-13 15:52:12 -0700350void bfa_hwct_msix_ctrl_install(struct bfa_s *bfa);
351void bfa_hwct_msix_queue_install(struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700352void bfa_hwct_msix_uninstall(struct bfa_s *bfa);
353void bfa_hwct_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix);
354void bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs,
355 u32 *maxvec);
356void bfa_hwct_msix_get_rme_range(struct bfa_s *bfa, u32 *start,
357 u32 *end);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700358void bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t *wwns);
359wwn_t bfa_iocfc_get_pwwn(struct bfa_s *bfa);
360wwn_t bfa_iocfc_get_nwwn(struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700361int bfa_iocfc_get_pbc_vports(struct bfa_s *bfa,
362 struct bfi_pbc_vport_s *pbc_vport);
363
364
Jing Huangacdc79a2010-10-18 17:15:55 -0700365/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700366 *----------------------------------------------------------------------
367 * BFA public interfaces
368 *----------------------------------------------------------------------
369 */
370#define bfa_stats(_mod, _stats) ((_mod)->stats._stats++)
371#define bfa_ioc_get_stats(__bfa, __ioc_stats) \
372 bfa_ioc_fetch_stats(&(__bfa)->ioc, __ioc_stats)
373#define bfa_ioc_clear_stats(__bfa) \
374 bfa_ioc_clr_stats(&(__bfa)->ioc)
375#define bfa_get_nports(__bfa) \
376 bfa_ioc_get_nports(&(__bfa)->ioc)
377#define bfa_get_adapter_manufacturer(__bfa, __manufacturer) \
378 bfa_ioc_get_adapter_manufacturer(&(__bfa)->ioc, __manufacturer)
379#define bfa_get_adapter_model(__bfa, __model) \
380 bfa_ioc_get_adapter_model(&(__bfa)->ioc, __model)
381#define bfa_get_adapter_serial_num(__bfa, __serial_num) \
382 bfa_ioc_get_adapter_serial_num(&(__bfa)->ioc, __serial_num)
383#define bfa_get_adapter_fw_ver(__bfa, __fw_ver) \
384 bfa_ioc_get_adapter_fw_ver(&(__bfa)->ioc, __fw_ver)
385#define bfa_get_adapter_optrom_ver(__bfa, __optrom_ver) \
386 bfa_ioc_get_adapter_optrom_ver(&(__bfa)->ioc, __optrom_ver)
387#define bfa_get_pci_chip_rev(__bfa, __chip_rev) \
388 bfa_ioc_get_pci_chip_rev(&(__bfa)->ioc, __chip_rev)
389#define bfa_get_ioc_state(__bfa) \
390 bfa_ioc_get_state(&(__bfa)->ioc)
391#define bfa_get_type(__bfa) \
392 bfa_ioc_get_type(&(__bfa)->ioc)
393#define bfa_get_mac(__bfa) \
394 bfa_ioc_get_mac(&(__bfa)->ioc)
395#define bfa_get_mfg_mac(__bfa) \
396 bfa_ioc_get_mfg_mac(&(__bfa)->ioc)
397#define bfa_get_fw_clock_res(__bfa) \
398 ((__bfa)->iocfc.cfgrsp->fwcfg.fw_tick_res)
399
400void bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids);
401void bfa_cfg_get_default(struct bfa_iocfc_cfg_s *cfg);
402void bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg);
403void bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg,
Krishna Gudipati45070252011-06-24 20:24:29 -0700404 struct bfa_meminfo_s *meminfo,
405 struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700406void bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
407 struct bfa_meminfo_s *meminfo,
408 struct bfa_pcidev_s *pcidev);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700409void bfa_detach(struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700410void bfa_cb_init(void *bfad, bfa_status_t status);
411void bfa_cb_updateq(void *bfad, bfa_status_t status);
412
413bfa_boolean_t bfa_intx(struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700414void bfa_isr_enable(struct bfa_s *bfa);
415void bfa_isr_disable(struct bfa_s *bfa);
416
417void bfa_comp_deq(struct bfa_s *bfa, struct list_head *comp_q);
418void bfa_comp_process(struct bfa_s *bfa, struct list_head *comp_q);
419void bfa_comp_free(struct bfa_s *bfa, struct list_head *comp_q);
420
421typedef void (*bfa_cb_ioc_t) (void *cbarg, enum bfa_status status);
422void bfa_iocfc_get_attr(struct bfa_s *bfa, struct bfa_iocfc_attr_s *attr);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700423
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700424
425bfa_status_t bfa_iocfc_israttr_set(struct bfa_s *bfa,
426 struct bfa_iocfc_intr_attr_s *attr);
427
428void bfa_iocfc_enable(struct bfa_s *bfa);
429void bfa_iocfc_disable(struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700430#define bfa_timer_start(_bfa, _timer, _timercb, _arg, _timeout) \
431 bfa_timer_begin(&(_bfa)->timer_mod, _timer, _timercb, _arg, _timeout)
432
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700433#endif /* __BFA_H__ */