2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
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
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.
19 * bfa_fcs.c BFA FCS main
22 #include <fcs/bfa_fcs.h>
25 #include "fcs_vport.h"
26 #include "fcs_rport.h"
27 #include "fcs_fabric.h"
28 #include "fcs_fcpim.h"
29 #include "fcs_fcptm.h"
33 #include <fcb/bfa_fcb.h>
38 struct bfa_fcs_mod_s
{
39 void (*modinit
) (struct bfa_fcs_s
*fcs
);
40 void (*modexit
) (struct bfa_fcs_s
*fcs
);
43 #define BFA_FCS_MODULE(_mod) { _mod ## _modinit, _mod ## _modexit }
45 static struct bfa_fcs_mod_s fcs_modules
[] = {
46 BFA_FCS_MODULE(bfa_fcs_pport
),
47 BFA_FCS_MODULE(bfa_fcs_uf
),
48 BFA_FCS_MODULE(bfa_fcs_fabric
),
49 BFA_FCS_MODULE(bfa_fcs_vport
),
50 BFA_FCS_MODULE(bfa_fcs_rport
),
51 BFA_FCS_MODULE(bfa_fcs_fcpim
),
59 bfa_fcs_exit_comp(void *fcs_cbarg
)
61 struct bfa_fcs_s
*fcs
= fcs_cbarg
;
62 struct bfad_s
*bfad
= fcs
->bfad
;
64 complete(&bfad
->comp
);
74 * FCS instance initialization.
76 * param[in] fcs FCS instance
77 * param[in] bfa BFA instance
78 * param[in] bfad BFA driver instance
83 bfa_fcs_init(struct bfa_fcs_s
*fcs
, struct bfa_s
*bfa
, struct bfad_s
*bfad
,
84 bfa_boolean_t min_cfg
)
87 struct bfa_fcs_mod_s
*mod
;
91 fcs
->min_cfg
= min_cfg
;
96 for (i
= 0; i
< sizeof(fcs_modules
) / sizeof(fcs_modules
[0]); i
++) {
97 mod
= &fcs_modules
[i
];
103 * Start FCS operations.
106 bfa_fcs_start(struct bfa_fcs_s
*fcs
)
108 bfa_fcs_fabric_modstart(fcs
);
112 * FCS driver details initialization.
114 * param[in] fcs FCS instance
115 * param[in] driver_info Driver Details
120 bfa_fcs_driver_info_init(struct bfa_fcs_s
*fcs
,
121 struct bfa_fcs_driver_info_s
*driver_info
)
124 fcs
->driver_info
= *driver_info
;
126 bfa_fcs_fabric_psymb_init(&fcs
->fabric
);
130 * FCS instance cleanup and exit.
132 * param[in] fcs FCS instance
136 bfa_fcs_exit(struct bfa_fcs_s
*fcs
)
138 struct bfa_fcs_mod_s
*mod
;
141 bfa_wc_init(&fcs
->wc
, bfa_fcs_exit_comp
, fcs
);
143 nmods
= sizeof(fcs_modules
) / sizeof(fcs_modules
[0]);
145 for (i
= 0; i
< nmods
; i
++) {
148 mod
= &fcs_modules
[i
];
152 bfa_wc_wait(&fcs
->wc
);
157 bfa_fcs_trc_init(struct bfa_fcs_s
*fcs
, struct bfa_trc_mod_s
*trcmod
)
159 fcs
->trcmod
= trcmod
;
164 bfa_fcs_log_init(struct bfa_fcs_s
*fcs
, struct bfa_log_mod_s
*logmod
)
171 bfa_fcs_aen_init(struct bfa_fcs_s
*fcs
, struct bfa_aen_s
*aen
)
177 bfa_fcs_modexit_comp(struct bfa_fcs_s
*fcs
)
179 bfa_wc_down(&fcs
->wc
);