ath9k: remove unneeded calculation of minimal calibration power
[linux-2.6/next.git] / drivers / scsi / bfa / bfa_fcs.c
blob3516172c597c9f43633df2459bdfdd472589c72a
1 /*
2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
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.
18 /**
19 * bfa_fcs.c BFA FCS main
22 #include <fcs/bfa_fcs.h>
23 #include "fcs_port.h"
24 #include "fcs_uf.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"
30 #include "fcbuild.h"
31 #include "fcs.h"
32 #include "bfad_drv.h"
33 #include <fcb/bfa_fcb.h>
35 /**
36 * FCS sub-modules
38 struct bfa_fcs_mod_s {
39 void (*attach) (struct bfa_fcs_s *fcs);
40 void (*modinit) (struct bfa_fcs_s *fcs);
41 void (*modexit) (struct bfa_fcs_s *fcs);
44 #define BFA_FCS_MODULE(_mod) { _mod ## _modinit, _mod ## _modexit }
46 static struct bfa_fcs_mod_s fcs_modules[] = {
47 { bfa_fcs_pport_attach, NULL, NULL },
48 { bfa_fcs_uf_attach, NULL, NULL },
49 { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit,
50 bfa_fcs_fabric_modexit },
53 /**
54 * fcs_api BFA FCS API
57 static void
58 bfa_fcs_exit_comp(void *fcs_cbarg)
60 struct bfa_fcs_s *fcs = fcs_cbarg;
61 struct bfad_s *bfad = fcs->bfad;
63 complete(&bfad->comp);
68 /**
69 * fcs_api BFA FCS API
72 /**
73 * fcs attach -- called once to initialize data structures at driver attach time
75 void
76 bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
77 bfa_boolean_t min_cfg)
79 int i;
80 struct bfa_fcs_mod_s *mod;
82 fcs->bfa = bfa;
83 fcs->bfad = bfad;
84 fcs->min_cfg = min_cfg;
86 bfa_attach_fcs(bfa);
87 fcbuild_init();
89 for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
90 mod = &fcs_modules[i];
91 if (mod->attach)
92 mod->attach(fcs);
96 /**
97 * fcs initialization, called once after bfa initialization is complete
99 void
100 bfa_fcs_init(struct bfa_fcs_s *fcs)
102 int i;
103 struct bfa_fcs_mod_s *mod;
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);
113 * Start FCS operations.
115 void
116 bfa_fcs_start(struct bfa_fcs_s *fcs)
118 bfa_fcs_fabric_modstart(fcs);
122 * FCS driver details initialization.
124 * param[in] fcs FCS instance
125 * param[in] driver_info Driver Details
127 * return None
129 void
130 bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
131 struct bfa_fcs_driver_info_s *driver_info)
134 fcs->driver_info = *driver_info;
136 bfa_fcs_fabric_psymb_init(&fcs->fabric);
140 * @brief
141 * FCS FDMI Driver Parameter Initialization
143 * @param[in] fcs FCS instance
144 * @param[in] fdmi_enable TRUE/FALSE
146 * @return None
148 void
149 bfa_fcs_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable)
152 fcs->fdmi_enabled = fdmi_enable;
157 * FCS instance cleanup and exit.
159 * param[in] fcs FCS instance
160 * return None
162 void
163 bfa_fcs_exit(struct bfa_fcs_s *fcs)
165 struct bfa_fcs_mod_s *mod;
166 int nmods, i;
168 bfa_wc_init(&fcs->wc, bfa_fcs_exit_comp, fcs);
170 nmods = sizeof(fcs_modules) / sizeof(fcs_modules[0]);
172 for (i = 0; i < nmods; i++) {
174 mod = &fcs_modules[i];
175 if (mod->modexit) {
176 bfa_wc_up(&fcs->wc);
177 mod->modexit(fcs);
181 bfa_wc_wait(&fcs->wc);
185 void
186 bfa_fcs_trc_init(struct bfa_fcs_s *fcs, struct bfa_trc_mod_s *trcmod)
188 fcs->trcmod = trcmod;
192 void
193 bfa_fcs_log_init(struct bfa_fcs_s *fcs, struct bfa_log_mod_s *logmod)
195 fcs->logm = logmod;
199 void
200 bfa_fcs_aen_init(struct bfa_fcs_s *fcs, struct bfa_aen_s *aen)
202 fcs->aen = aen;
205 void
206 bfa_fcs_modexit_comp(struct bfa_fcs_s *fcs)
208 bfa_wc_down(&fcs->wc);