[SCSI] bfa: Brocade BFA FC SCSI driver
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / scsi / bfa / bfa_priv.h
1 /*
2 * Copyright (c) 2005-2009 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
18 #ifndef __BFA_PRIV_H__
19 #define __BFA_PRIV_H__
20
21 #include "bfa_iocfc.h"
22 #include "bfa_intr_priv.h"
23 #include "bfa_trcmod_priv.h"
24 #include "bfa_modules_priv.h"
25 #include "bfa_fwimg_priv.h"
26 #include <cs/bfa_log.h>
27 #include <bfa_timer.h>
28
29 /**
30 * Macro to define a new BFA module
31 */
32 #define BFA_MODULE(__mod) \
33 static void bfa_ ## __mod ## _meminfo( \
34 struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len, \
35 u32 *dm_len); \
36 static void bfa_ ## __mod ## _attach(struct bfa_s *bfa, \
37 void *bfad, struct bfa_iocfc_cfg_s *cfg, \
38 struct bfa_meminfo_s *meminfo, \
39 struct bfa_pcidev_s *pcidev); \
40 static void bfa_ ## __mod ## _initdone(struct bfa_s *bfa); \
41 static void bfa_ ## __mod ## _detach(struct bfa_s *bfa); \
42 static void bfa_ ## __mod ## _start(struct bfa_s *bfa); \
43 static void bfa_ ## __mod ## _stop(struct bfa_s *bfa); \
44 static void bfa_ ## __mod ## _iocdisable(struct bfa_s *bfa); \
45 \
46 extern struct bfa_module_s hal_mod_ ## __mod; \
47 struct bfa_module_s hal_mod_ ## __mod = { \
48 bfa_ ## __mod ## _meminfo, \
49 bfa_ ## __mod ## _attach, \
50 bfa_ ## __mod ## _initdone, \
51 bfa_ ## __mod ## _detach, \
52 bfa_ ## __mod ## _start, \
53 bfa_ ## __mod ## _stop, \
54 bfa_ ## __mod ## _iocdisable, \
55 }
56
57 #define BFA_CACHELINE_SZ (256)
58
59 /**
60 * Structure used to interact between different BFA sub modules
61 *
62 * Each sub module needs to implement only the entry points relevant to it (and
63 * can leave entry points as NULL)
64 */
65 struct bfa_module_s {
66 void (*meminfo) (struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
67 u32 *dm_len);
68 void (*attach) (struct bfa_s *bfa, void *bfad,
69 struct bfa_iocfc_cfg_s *cfg,
70 struct bfa_meminfo_s *meminfo,
71 struct bfa_pcidev_s *pcidev);
72 void (*initdone) (struct bfa_s *bfa);
73 void (*detach) (struct bfa_s *bfa);
74 void (*start) (struct bfa_s *bfa);
75 void (*stop) (struct bfa_s *bfa);
76 void (*iocdisable) (struct bfa_s *bfa);
77 };
78
79 extern struct bfa_module_s *hal_mods[];
80
81 struct bfa_s {
82 void *bfad; /* BFA driver instance */
83 struct bfa_aen_s *aen; /* AEN module */
84 struct bfa_plog_s *plog; /* portlog buffer */
85 struct bfa_log_mod_s *logm; /* driver logging modulen */
86 struct bfa_trc_mod_s *trcmod; /* driver tracing */
87 struct bfa_ioc_s ioc; /* IOC module */
88 struct bfa_iocfc_s iocfc; /* IOCFC module */
89 struct bfa_timer_mod_s timer_mod; /* timer module */
90 struct bfa_modules_s modules; /* BFA modules */
91 struct list_head comp_q; /* pending completions */
92 bfa_boolean_t rme_process; /* RME processing enabled */
93 struct list_head reqq_waitq[BFI_IOC_MAX_CQS];
94 bfa_boolean_t fcs; /* FCS is attached to BFA */
95 struct bfa_msix_s msix;
96 };
97
98 extern bfa_isr_func_t bfa_isrs[BFI_MC_MAX];
99 extern bfa_ioc_mbox_mcfunc_t bfa_mbox_isrs[];
100 extern bfa_boolean_t bfa_auto_recover;
101 extern struct bfa_module_s hal_mod_flash;
102 extern struct bfa_module_s hal_mod_fcdiag;
103 extern struct bfa_module_s hal_mod_sgpg;
104 extern struct bfa_module_s hal_mod_pport;
105 extern struct bfa_module_s hal_mod_fcxp;
106 extern struct bfa_module_s hal_mod_lps;
107 extern struct bfa_module_s hal_mod_uf;
108 extern struct bfa_module_s hal_mod_rport;
109 extern struct bfa_module_s hal_mod_fcpim;
110 extern struct bfa_module_s hal_mod_pbind;
111
112 #endif /* __BFA_PRIV_H__ */
113