diff options
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcs.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs.c | 63 |
1 files changed, 46 insertions, 17 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index 7cb39a306ea9..3516172c597c 100644 --- a/drivers/scsi/bfa/bfa_fcs.c +++ b/drivers/scsi/bfa/bfa_fcs.c | |||
@@ -36,6 +36,7 @@ | |||
36 | * FCS sub-modules | 36 | * FCS sub-modules |
37 | */ | 37 | */ |
38 | struct bfa_fcs_mod_s { | 38 | struct bfa_fcs_mod_s { |
39 | void (*attach) (struct bfa_fcs_s *fcs); | ||
39 | void (*modinit) (struct bfa_fcs_s *fcs); | 40 | void (*modinit) (struct bfa_fcs_s *fcs); |
40 | void (*modexit) (struct bfa_fcs_s *fcs); | 41 | void (*modexit) (struct bfa_fcs_s *fcs); |
41 | }; | 42 | }; |
@@ -43,12 +44,10 @@ struct bfa_fcs_mod_s { | |||
43 | #define BFA_FCS_MODULE(_mod) { _mod ## _modinit, _mod ## _modexit } | 44 | #define BFA_FCS_MODULE(_mod) { _mod ## _modinit, _mod ## _modexit } |
44 | 45 | ||
45 | static struct bfa_fcs_mod_s fcs_modules[] = { | 46 | static struct bfa_fcs_mod_s fcs_modules[] = { |
46 | BFA_FCS_MODULE(bfa_fcs_pport), | 47 | { bfa_fcs_pport_attach, NULL, NULL }, |
47 | BFA_FCS_MODULE(bfa_fcs_uf), | 48 | { bfa_fcs_uf_attach, NULL, NULL }, |
48 | BFA_FCS_MODULE(bfa_fcs_fabric), | 49 | { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, |
49 | BFA_FCS_MODULE(bfa_fcs_vport), | 50 | bfa_fcs_fabric_modexit }, |
50 | BFA_FCS_MODULE(bfa_fcs_rport), | ||
51 | BFA_FCS_MODULE(bfa_fcs_fcpim), | ||
52 | }; | 51 | }; |
53 | 52 | ||
54 | /** | 53 | /** |
@@ -71,16 +70,10 @@ bfa_fcs_exit_comp(void *fcs_cbarg) | |||
71 | */ | 70 | */ |
72 | 71 | ||
73 | /** | 72 | /** |
74 | * FCS instance initialization. | 73 | * fcs attach -- called once to initialize data structures at driver attach time |
75 | * | ||
76 | * param[in] fcs FCS instance | ||
77 | * param[in] bfa BFA instance | ||
78 | * param[in] bfad BFA driver instance | ||
79 | * | ||
80 | * return None | ||
81 | */ | 74 | */ |
82 | void | 75 | void |
83 | bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, | 76 | bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, |
84 | bfa_boolean_t min_cfg) | 77 | bfa_boolean_t min_cfg) |
85 | { | 78 | { |
86 | int i; | 79 | int i; |
@@ -95,7 +88,24 @@ bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, | |||
95 | 88 | ||
96 | for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { | 89 | for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { |
97 | mod = &fcs_modules[i]; | 90 | mod = &fcs_modules[i]; |
98 | mod->modinit(fcs); | 91 | if (mod->attach) |
92 | mod->attach(fcs); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * fcs initialization, called once after bfa initialization is complete | ||
98 | */ | ||
99 | void | ||
100 | bfa_fcs_init(struct bfa_fcs_s *fcs) | ||
101 | { | ||
102 | int i; | ||
103 | struct bfa_fcs_mod_s *mod; | ||
104 | |||
105 | for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { | ||
106 | mod = &fcs_modules[i]; | ||
107 | if (mod->modinit) | ||
108 | mod->modinit(fcs); | ||
99 | } | 109 | } |
100 | } | 110 | } |
101 | 111 | ||
@@ -127,6 +137,23 @@ bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, | |||
127 | } | 137 | } |
128 | 138 | ||
129 | /** | 139 | /** |
140 | * @brief | ||
141 | * FCS FDMI Driver Parameter Initialization | ||
142 | * | ||
143 | * @param[in] fcs FCS instance | ||
144 | * @param[in] fdmi_enable TRUE/FALSE | ||
145 | * | ||
146 | * @return None | ||
147 | */ | ||
148 | void | ||
149 | bfa_fcs_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable) | ||
150 | { | ||
151 | |||
152 | fcs->fdmi_enabled = fdmi_enable; | ||
153 | |||
154 | } | ||
155 | |||
156 | /** | ||
130 | * FCS instance cleanup and exit. | 157 | * FCS instance cleanup and exit. |
131 | * | 158 | * |
132 | * param[in] fcs FCS instance | 159 | * param[in] fcs FCS instance |
@@ -143,10 +170,12 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs) | |||
143 | nmods = sizeof(fcs_modules) / sizeof(fcs_modules[0]); | 170 | nmods = sizeof(fcs_modules) / sizeof(fcs_modules[0]); |
144 | 171 | ||
145 | for (i = 0; i < nmods; i++) { | 172 | for (i = 0; i < nmods; i++) { |
146 | bfa_wc_up(&fcs->wc); | ||
147 | 173 | ||
148 | mod = &fcs_modules[i]; | 174 | mod = &fcs_modules[i]; |
149 | mod->modexit(fcs); | 175 | if (mod->modexit) { |
176 | bfa_wc_up(&fcs->wc); | ||
177 | mod->modexit(fcs); | ||
178 | } | ||
150 | } | 179 | } |
151 | 180 | ||
152 | bfa_wc_wait(&fcs->wc); | 181 | bfa_wc_wait(&fcs->wc); |