~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to drivers/scsi/bfa/bfa.h

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
struct bfa_s;
28
28
 
29
29
typedef void (*bfa_isr_func_t) (struct bfa_s *bfa, struct bfi_msg_s *m);
30
 
typedef void    (*bfa_cb_cbfn_t) (void *cbarg, bfa_boolean_t complete);
 
30
typedef void (*bfa_cb_cbfn_status_t) (void *cbarg, bfa_status_t status);
31
31
 
32
32
/*
33
33
 * Interrupt message handlers
54
54
         ((void *)((struct bfi_msg_s *)((__bfa)->iocfc.req_cq_ba[__reqq].kva) \
55
55
                   + bfa_reqq_pi((__bfa), (__reqq)))))
56
56
 
57
 
#define bfa_reqq_produce(__bfa, __reqq) do {                            \
 
57
#define bfa_reqq_produce(__bfa, __reqq, __mh)  do {                     \
 
58
                (__mh).mtag.h2i.qid     = (__bfa)->iocfc.hw_qid[__reqq];\
58
59
                (__bfa)->iocfc.req_cq_pi[__reqq]++;                     \
59
60
                (__bfa)->iocfc.req_cq_pi[__reqq] &=                     \
60
61
                        ((__bfa)->iocfc.cfg.drvcfg.num_reqq_elems - 1); \
76
77
} while (0)
77
78
 
78
79
/*
79
 
 * Queue element to wait for room in request queue. FIFO order is
80
 
 * maintained when fullfilling requests.
81
 
 */
82
 
struct bfa_reqq_wait_s {
83
 
        struct list_head        qe;
84
 
        void            (*qresume) (void *cbarg);
85
 
        void            *cbarg;
86
 
};
87
 
 
88
 
/*
89
80
 * Circular queue usage assignments
90
81
 */
91
82
enum {
128
119
 
129
120
#define bfa_reqq_wcancel(__wqe) list_del(&(__wqe)->qe)
130
121
 
131
 
 
132
 
/*
133
 
 * Generic BFA callback element.
134
 
 */
135
 
struct bfa_cb_qe_s {
136
 
        struct list_head         qe;
137
 
        bfa_cb_cbfn_t  cbfn;
138
 
        bfa_boolean_t   once;
139
 
        u32             rsvd;
140
 
        void           *cbarg;
141
 
};
142
 
 
143
122
#define bfa_cb_queue(__bfa, __hcb_qe, __cbfn, __cbarg) do {     \
144
123
                (__hcb_qe)->cbfn  = (__cbfn);      \
145
124
                (__hcb_qe)->cbarg = (__cbarg);      \
 
125
                (__hcb_qe)->pre_rmv = BFA_FALSE;                \
146
126
                list_add_tail(&(__hcb_qe)->qe, &(__bfa)->comp_q);      \
147
127
        } while (0)
148
128
 
157
137
                }                                                       \
158
138
        } while (0)
159
139
 
 
140
#define bfa_cb_queue_status(__bfa, __hcb_qe, __status) do {             \
 
141
                (__hcb_qe)->fw_status = (__status);                     \
 
142
                list_add_tail(&(__hcb_qe)->qe, &(__bfa)->comp_q);       \
 
143
} while (0)
 
144
 
160
145
#define bfa_cb_queue_done(__hcb_qe) do {        \
161
146
                (__hcb_qe)->once = BFA_FALSE;   \
162
147
        } while (0)
172
157
 
173
158
extern char     bfa_version[];
174
159
 
175
 
/*
176
 
 * BFA memory resources
177
 
 */
178
 
enum bfa_mem_type {
179
 
        BFA_MEM_TYPE_KVA = 1,   /*  Kernel Virtual Memory *(non-dma-able) */
180
 
        BFA_MEM_TYPE_DMA = 2,   /*  DMA-able memory */
181
 
        BFA_MEM_TYPE_MAX = BFA_MEM_TYPE_DMA,
182
 
};
183
 
 
184
 
struct bfa_mem_elem_s {
185
 
        enum bfa_mem_type mem_type;     /* see enum bfa_mem_type */
186
 
        u32     mem_len;        /*  Total Length in Bytes       */
187
 
        u8              *kva;           /*  kernel virtual address      */
188
 
        u64     dma;            /*  dma address if DMA memory   */
189
 
        u8              *kva_curp;      /*  kva allocation cursor       */
190
 
        u64     dma_curp;       /*  dma allocation cursor       */
191
 
};
192
 
 
193
 
struct bfa_meminfo_s {
194
 
        struct bfa_mem_elem_s meminfo[BFA_MEM_TYPE_MAX];
195
 
};
196
 
#define bfa_meminfo_kva(_m)                             \
197
 
        ((_m)->meminfo[BFA_MEM_TYPE_KVA - 1].kva_curp)
198
 
#define bfa_meminfo_dma_virt(_m)                        \
199
 
        ((_m)->meminfo[BFA_MEM_TYPE_DMA - 1].kva_curp)
200
 
#define bfa_meminfo_dma_phys(_m)                        \
201
 
        ((_m)->meminfo[BFA_MEM_TYPE_DMA - 1].dma_curp)
202
 
 
203
160
struct bfa_iocfc_regs_s {
204
161
        void __iomem    *intr_status;
205
162
        void __iomem    *intr_mask;
206
163
        void __iomem    *cpe_q_pi[BFI_IOC_MAX_CQS];
207
164
        void __iomem    *cpe_q_ci[BFI_IOC_MAX_CQS];
208
 
        void __iomem    *cpe_q_depth[BFI_IOC_MAX_CQS];
209
165
        void __iomem    *cpe_q_ctrl[BFI_IOC_MAX_CQS];
210
166
        void __iomem    *rme_q_ci[BFI_IOC_MAX_CQS];
211
167
        void __iomem    *rme_q_pi[BFI_IOC_MAX_CQS];
212
 
        void __iomem    *rme_q_depth[BFI_IOC_MAX_CQS];
213
168
        void __iomem    *rme_q_ctrl[BFI_IOC_MAX_CQS];
214
169
};
215
170
 
229
184
struct bfa_hwif_s {
230
185
        void (*hw_reginit)(struct bfa_s *bfa);
231
186
        void (*hw_reqq_ack)(struct bfa_s *bfa, int reqq);
232
 
        void (*hw_rspq_ack)(struct bfa_s *bfa, int rspq);
 
187
        void (*hw_rspq_ack)(struct bfa_s *bfa, int rspq, u32 ci);
233
188
        void (*hw_msix_init)(struct bfa_s *bfa, int nvecs);
234
 
        void (*hw_msix_install)(struct bfa_s *bfa);
 
189
        void (*hw_msix_ctrl_install)(struct bfa_s *bfa);
 
190
        void (*hw_msix_queue_install)(struct bfa_s *bfa);
235
191
        void (*hw_msix_uninstall)(struct bfa_s *bfa);
236
192
        void (*hw_isr_mode_set)(struct bfa_s *bfa, bfa_boolean_t msix);
237
193
        void (*hw_msix_getvecs)(struct bfa_s *bfa, u32 *vecmap,
238
194
                                u32 *nvecs, u32 *maxvec);
239
195
        void (*hw_msix_get_rme_range) (struct bfa_s *bfa, u32 *start,
240
196
                                       u32 *end);
 
197
        int     cpe_vec_q0;
 
198
        int     rme_vec_q0;
241
199
};
242
200
typedef void (*bfa_cb_iocfc_t) (void *cbarg, enum bfa_status status);
243
201
 
 
202
struct bfa_faa_cbfn_s {
 
203
        bfa_cb_iocfc_t  faa_cbfn;
 
204
        void            *faa_cbarg;
 
205
};
 
206
 
 
207
#define BFA_FAA_ENABLED         1
 
208
#define BFA_FAA_DISABLED        2
 
209
 
 
210
/*
 
211
 *      FAA attributes
 
212
 */
 
213
struct bfa_faa_attr_s {
 
214
        wwn_t   faa;
 
215
        u8      faa_state;
 
216
        u8      pwwn_source;
 
217
        u8      rsvd[6];
 
218
};
 
219
 
 
220
struct bfa_faa_args_s {
 
221
        struct bfa_faa_attr_s   *faa_attr;
 
222
        struct bfa_faa_cbfn_s   faa_cb;
 
223
        u8                      faa_state;
 
224
        bfa_boolean_t           busy;
 
225
};
 
226
 
244
227
struct bfa_iocfc_s {
245
228
        struct bfa_s            *bfa;
246
229
        struct bfa_iocfc_cfg_s  cfg;
247
230
        int                     action;
248
231
        u32             req_cq_pi[BFI_IOC_MAX_CQS];
249
232
        u32             rsp_cq_ci[BFI_IOC_MAX_CQS];
 
233
        u8              hw_qid[BFI_IOC_MAX_CQS];
250
234
        struct bfa_cb_qe_s      init_hcb_qe;
251
235
        struct bfa_cb_qe_s      stop_hcb_qe;
252
236
        struct bfa_cb_qe_s      dis_hcb_qe;
 
237
        struct bfa_cb_qe_s      en_hcb_qe;
253
238
        struct bfa_cb_qe_s      stats_hcb_qe;
254
239
        bfa_boolean_t           cfgdone;
255
240
 
257
242
        struct bfi_iocfc_cfg_s *cfginfo;
258
243
        struct bfa_dma_s        cfgrsp_dma;
259
244
        struct bfi_iocfc_cfgrsp_s *cfgrsp;
260
 
        struct bfi_iocfc_cfg_reply_s *cfg_reply;
261
245
        struct bfa_dma_s        req_cq_ba[BFI_IOC_MAX_CQS];
262
246
        struct bfa_dma_s        req_cq_shadow_ci[BFI_IOC_MAX_CQS];
263
247
        struct bfa_dma_s        rsp_cq_ba[BFI_IOC_MAX_CQS];
267
251
        bfa_cb_iocfc_t          updateq_cbfn; /*  bios callback function */
268
252
        void                    *updateq_cbarg; /*  bios callback arg */
269
253
        u32     intr_mask;
 
254
        struct bfa_faa_args_s   faa_args;
 
255
        struct bfa_mem_dma_s    ioc_dma;
 
256
        struct bfa_mem_dma_s    iocfc_dma;
 
257
        struct bfa_mem_dma_s    reqq_dma[BFI_IOC_MAX_CQS];
 
258
        struct bfa_mem_dma_s    rspq_dma[BFI_IOC_MAX_CQS];
 
259
        struct bfa_mem_kva_s    kva_seg;
270
260
};
271
261
 
272
 
#define bfa_lpuid(__bfa)                                                \
273
 
        bfa_ioc_portid(&(__bfa)->ioc)
 
262
#define BFA_MEM_IOC_DMA(_bfa)           (&((_bfa)->iocfc.ioc_dma))
 
263
#define BFA_MEM_IOCFC_DMA(_bfa)         (&((_bfa)->iocfc.iocfc_dma))
 
264
#define BFA_MEM_REQQ_DMA(_bfa, _qno)    (&((_bfa)->iocfc.reqq_dma[(_qno)]))
 
265
#define BFA_MEM_RSPQ_DMA(_bfa, _qno)    (&((_bfa)->iocfc.rspq_dma[(_qno)]))
 
266
#define BFA_MEM_IOCFC_KVA(_bfa)         (&((_bfa)->iocfc.kva_seg))
 
267
 
 
268
#define bfa_fn_lpu(__bfa)       \
 
269
        bfi_fn_lpu(bfa_ioc_pcifn(&(__bfa)->ioc), bfa_ioc_portid(&(__bfa)->ioc))
274
270
#define bfa_msix_init(__bfa, __nvecs)                                   \
275
271
        ((__bfa)->iocfc.hwif.hw_msix_init(__bfa, __nvecs))
276
 
#define bfa_msix_install(__bfa)                                         \
277
 
        ((__bfa)->iocfc.hwif.hw_msix_install(__bfa))
 
272
#define bfa_msix_ctrl_install(__bfa)                                    \
 
273
        ((__bfa)->iocfc.hwif.hw_msix_ctrl_install(__bfa))
 
274
#define bfa_msix_queue_install(__bfa)                                   \
 
275
        ((__bfa)->iocfc.hwif.hw_msix_queue_install(__bfa))
278
276
#define bfa_msix_uninstall(__bfa)                                       \
279
277
        ((__bfa)->iocfc.hwif.hw_msix_uninstall(__bfa))
280
 
#define bfa_isr_mode_set(__bfa, __msix)                                 \
281
 
        ((__bfa)->iocfc.hwif.hw_isr_mode_set(__bfa, __msix))
 
278
#define bfa_isr_rspq_ack(__bfa, __queue, __ci)                          \
 
279
        ((__bfa)->iocfc.hwif.hw_rspq_ack(__bfa, __queue, __ci))
 
280
#define bfa_isr_reqq_ack(__bfa, __queue) do {                           \
 
281
        if ((__bfa)->iocfc.hwif.hw_reqq_ack)                            \
 
282
                (__bfa)->iocfc.hwif.hw_reqq_ack(__bfa, __queue);        \
 
283
} while (0)
 
284
#define bfa_isr_mode_set(__bfa, __msix) do {                            \
 
285
        if ((__bfa)->iocfc.hwif.hw_isr_mode_set)                        \
 
286
                (__bfa)->iocfc.hwif.hw_isr_mode_set(__bfa, __msix);     \
 
287
} while (0)
282
288
#define bfa_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec)            \
283
289
        ((__bfa)->iocfc.hwif.hw_msix_getvecs(__bfa, __vecmap,           \
284
290
                                        __nvecs, __maxvec))
290
296
/*
291
297
 * FC specific IOC functions.
292
298
 */
293
 
void bfa_iocfc_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
294
 
                       u32 *dm_len);
 
299
void bfa_iocfc_meminfo(struct bfa_iocfc_cfg_s *cfg,
 
300
                        struct bfa_meminfo_s *meminfo,
 
301
                        struct bfa_s *bfa);
295
302
void bfa_iocfc_attach(struct bfa_s *bfa, void *bfad,
296
303
                      struct bfa_iocfc_cfg_s *cfg,
297
 
                      struct bfa_meminfo_s *meminfo,
298
304
                      struct bfa_pcidev_s *pcidev);
299
305
void bfa_iocfc_init(struct bfa_s *bfa);
300
306
void bfa_iocfc_start(struct bfa_s *bfa);
301
307
void bfa_iocfc_stop(struct bfa_s *bfa);
302
308
void bfa_iocfc_isr(void *bfa, struct bfi_mbmsg_s *msg);
303
 
void bfa_iocfc_set_snsbase(struct bfa_s *bfa, u64 snsbase_pa);
 
309
void bfa_iocfc_set_snsbase(struct bfa_s *bfa, int seg_no, u64 snsbase_pa);
304
310
bfa_boolean_t bfa_iocfc_is_operational(struct bfa_s *bfa);
305
311
void bfa_iocfc_reset_queues(struct bfa_s *bfa);
306
312
 
310
316
void bfa_msix_lpu_err(struct bfa_s *bfa, int vec);
311
317
 
312
318
void bfa_hwcb_reginit(struct bfa_s *bfa);
313
 
void bfa_hwcb_reqq_ack(struct bfa_s *bfa, int rspq);
314
 
void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq);
 
319
void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci);
315
320
void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs);
316
 
void bfa_hwcb_msix_install(struct bfa_s *bfa);
 
321
void bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa);
 
322
void bfa_hwcb_msix_queue_install(struct bfa_s *bfa);
317
323
void bfa_hwcb_msix_uninstall(struct bfa_s *bfa);
318
324
void bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix);
319
325
void bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs,
321
327
void bfa_hwcb_msix_get_rme_range(struct bfa_s *bfa, u32 *start,
322
328
                                 u32 *end);
323
329
void bfa_hwct_reginit(struct bfa_s *bfa);
 
330
void bfa_hwct2_reginit(struct bfa_s *bfa);
324
331
void bfa_hwct_reqq_ack(struct bfa_s *bfa, int rspq);
325
 
void bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq);
 
332
void bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci);
 
333
void bfa_hwct2_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci);
326
334
void bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs);
327
 
void bfa_hwct_msix_install(struct bfa_s *bfa);
 
335
void bfa_hwct_msix_ctrl_install(struct bfa_s *bfa);
 
336
void bfa_hwct_msix_queue_install(struct bfa_s *bfa);
328
337
void bfa_hwct_msix_uninstall(struct bfa_s *bfa);
329
338
void bfa_hwct_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix);
330
339
void bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs,
373
382
#define bfa_get_fw_clock_res(__bfa)             \
374
383
        ((__bfa)->iocfc.cfgrsp->fwcfg.fw_tick_res)
375
384
 
 
385
/*
 
386
 * lun mask macros return NULL when min cfg is enabled and there is
 
387
 * no memory allocated for lunmask.
 
388
 */
 
389
#define bfa_get_lun_mask(__bfa)                                 \
 
390
        ((&(__bfa)->modules.dconf_mod)->min_cfg) ? NULL :       \
 
391
         (&(BFA_DCONF_MOD(__bfa)->dconf->lun_mask))
 
392
 
 
393
#define bfa_get_lun_mask_list(_bfa)                             \
 
394
        ((&(_bfa)->modules.dconf_mod)->min_cfg) ? NULL :        \
 
395
         (bfa_get_lun_mask(_bfa)->lun_list)
 
396
 
 
397
#define bfa_get_lun_mask_status(_bfa)                           \
 
398
        (((&(_bfa)->modules.dconf_mod)->min_cfg)                \
 
399
         ? BFA_LUNMASK_MINCFG : ((bfa_get_lun_mask(_bfa))->status))
 
400
 
376
401
void bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids);
377
402
void bfa_cfg_get_default(struct bfa_iocfc_cfg_s *cfg);
378
403
void bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg);
379
404
void bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg,
380
 
                         struct bfa_meminfo_s *meminfo);
 
405
                        struct bfa_meminfo_s *meminfo,
 
406
                        struct bfa_s *bfa);
381
407
void bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
382
408
                struct bfa_meminfo_s *meminfo,
383
409
                struct bfa_pcidev_s *pcidev);
402
428
 
403
429
void bfa_iocfc_enable(struct bfa_s *bfa);
404
430
void bfa_iocfc_disable(struct bfa_s *bfa);
 
431
void bfa_iocfc_cb_dconf_modinit(struct bfa_s *bfa, bfa_status_t status);
405
432
#define bfa_timer_start(_bfa, _timer, _timercb, _arg, _timeout)         \
406
433
        bfa_timer_begin(&(_bfa)->timer_mod, _timer, _timercb, _arg, _timeout)
407
434
 
 
435
struct bfa_cb_pending_q_s {
 
436
        struct bfa_cb_qe_s      hcb_qe;
 
437
        void                    *data;  /* Driver buffer */
 
438
};
 
439
 
 
440
/* Common macros to operate on pending stats/attr apis */
 
441
#define bfa_pending_q_init(__qe, __cbfn, __cbarg, __data) do {  \
 
442
        bfa_q_qe_init(&((__qe)->hcb_qe.qe));                    \
 
443
        (__qe)->hcb_qe.cbfn = (__cbfn);                         \
 
444
        (__qe)->hcb_qe.cbarg = (__cbarg);                       \
 
445
        (__qe)->hcb_qe.pre_rmv = BFA_TRUE;                      \
 
446
        (__qe)->data = (__data);                                \
 
447
} while (0)
 
448
 
408
449
#endif /* __BFA_H__ */