blob: 53135f21fa0e4e2a93665f2068596e6a2fba8c28 [file] [log] [blame]
Jing Huang7725ccf2009-09-23 17:46:15 -07001/*
Anil Gurumurthy889d0d42015-11-26 03:54:45 -05002 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
3 * Copyright (c) 2014- QLogic Corporation.
Jing Huang7725ccf2009-09-23 17:46:15 -07004 * All rights reserved
Anil Gurumurthy889d0d42015-11-26 03:54:45 -05005 * www.qlogic.com
Jing Huang7725ccf2009-09-23 17:46:15 -07006 *
Anil Gurumurthy31e1d562015-11-26 03:54:46 -05007 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
Jing Huang7725ccf2009-09-23 17:46:15 -07008 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License (GPL) Version 2 as
11 * published by the Free Software Foundation
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 */
18
Jing Huangacdc79a2010-10-18 17:15:55 -070019/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070020 * bfa_modules.h BFA modules
21 */
Jing Huang7725ccf2009-09-23 17:46:15 -070022
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070023#ifndef __BFA_MODULES_H__
24#define __BFA_MODULES_H__
25
26#include "bfa_cs.h"
27#include "bfa.h"
28#include "bfa_svc.h"
29#include "bfa_fcpim.h"
30#include "bfa_port.h"
31
32struct bfa_modules_s {
Krishna Gudipati3d7fc662011-06-24 20:28:17 -070033 struct bfa_fcdiag_s fcdiag; /* fcdiag module */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070034 struct bfa_fcport_s fcport; /* fc port module */
35 struct bfa_fcxp_mod_s fcxp_mod; /* fcxp module */
36 struct bfa_lps_mod_s lps_mod; /* fcxp module */
37 struct bfa_uf_mod_s uf_mod; /* unsolicited frame module */
38 struct bfa_rport_mod_s rport_mod; /* remote port module */
Krishna Gudipatie2187d72011-06-13 15:53:58 -070039 struct bfa_fcp_mod_s fcp_mod; /* FCP initiator module */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070040 struct bfa_sgpg_mod_s sgpg_mod; /* SG page module */
41 struct bfa_port_s port; /* Physical port module */
Krishna Gudipati1a4d8e12011-06-24 20:22:28 -070042 struct bfa_ablk_s ablk; /* ASIC block config module */
Krishna Gudipati148d6102011-06-24 20:25:36 -070043 struct bfa_cee_s cee; /* CEE Module */
Krishna Gudipati51e569a2011-06-24 20:26:25 -070044 struct bfa_sfp_s sfp; /* SFP module */
Krishna Gudipati5a54b1d2011-06-24 20:27:13 -070045 struct bfa_flash_s flash; /* flash module */
Krishna Gudipati3d7fc662011-06-24 20:28:17 -070046 struct bfa_diag_s diag_mod; /* diagnostics module */
Krishna Gudipati3350d982011-06-24 20:28:37 -070047 struct bfa_phy_s phy; /* phy module */
Krishna Gudipati45c5dc12011-07-20 17:03:46 -070048 struct bfa_dconf_mod_s dconf_mod; /* DCONF common module */
Krishna Gudipatie6826c92012-09-21 17:27:14 -070049 struct bfa_fru_s fru; /* fru module */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070050};
51
52/*
53 * !!! Only append to the enums defined here to avoid any versioning
54 * !!! needed between trace utility and driver version
55 */
56enum {
57 BFA_TRC_HAL_CORE = 1,
58 BFA_TRC_HAL_FCXP = 2,
59 BFA_TRC_HAL_FCPIM = 3,
60 BFA_TRC_HAL_IOCFC_CT = 4,
61 BFA_TRC_HAL_IOCFC_CB = 5,
62};
63
Jing Huangacdc79a2010-10-18 17:15:55 -070064/*
Jing Huang7725ccf2009-09-23 17:46:15 -070065 * Macro to define a new BFA module
66 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070067#define BFA_MODULE(__mod) \
Jing Huang7725ccf2009-09-23 17:46:15 -070068 static void bfa_ ## __mod ## _meminfo( \
Krishna Gudipati45070252011-06-24 20:24:29 -070069 struct bfa_iocfc_cfg_s *cfg, \
70 struct bfa_meminfo_s *meminfo, \
71 struct bfa_s *bfa); \
Jing Huang7725ccf2009-09-23 17:46:15 -070072 static void bfa_ ## __mod ## _attach(struct bfa_s *bfa, \
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070073 void *bfad, struct bfa_iocfc_cfg_s *cfg, \
Jing Huang7725ccf2009-09-23 17:46:15 -070074 struct bfa_pcidev_s *pcidev); \
Jing Huang7725ccf2009-09-23 17:46:15 -070075 static void bfa_ ## __mod ## _detach(struct bfa_s *bfa); \
76 static void bfa_ ## __mod ## _start(struct bfa_s *bfa); \
77 static void bfa_ ## __mod ## _stop(struct bfa_s *bfa); \
78 static void bfa_ ## __mod ## _iocdisable(struct bfa_s *bfa); \
79 \
80 extern struct bfa_module_s hal_mod_ ## __mod; \
81 struct bfa_module_s hal_mod_ ## __mod = { \
82 bfa_ ## __mod ## _meminfo, \
83 bfa_ ## __mod ## _attach, \
Jing Huang7725ccf2009-09-23 17:46:15 -070084 bfa_ ## __mod ## _detach, \
85 bfa_ ## __mod ## _start, \
86 bfa_ ## __mod ## _stop, \
87 bfa_ ## __mod ## _iocdisable, \
88 }
89
90#define BFA_CACHELINE_SZ (256)
91
Jing Huangacdc79a2010-10-18 17:15:55 -070092/*
Jing Huang7725ccf2009-09-23 17:46:15 -070093 * Structure used to interact between different BFA sub modules
94 *
95 * Each sub module needs to implement only the entry points relevant to it (and
96 * can leave entry points as NULL)
97 */
98struct bfa_module_s {
Krishna Gudipati45070252011-06-24 20:24:29 -070099 void (*meminfo) (struct bfa_iocfc_cfg_s *cfg,
100 struct bfa_meminfo_s *meminfo,
101 struct bfa_s *bfa);
Jing Huang7725ccf2009-09-23 17:46:15 -0700102 void (*attach) (struct bfa_s *bfa, void *bfad,
103 struct bfa_iocfc_cfg_s *cfg,
Jing Huang7725ccf2009-09-23 17:46:15 -0700104 struct bfa_pcidev_s *pcidev);
Jing Huang7725ccf2009-09-23 17:46:15 -0700105 void (*detach) (struct bfa_s *bfa);
106 void (*start) (struct bfa_s *bfa);
107 void (*stop) (struct bfa_s *bfa);
108 void (*iocdisable) (struct bfa_s *bfa);
109};
110
Jing Huang7725ccf2009-09-23 17:46:15 -0700111
112struct bfa_s {
113 void *bfad; /* BFA driver instance */
Jing Huang7725ccf2009-09-23 17:46:15 -0700114 struct bfa_plog_s *plog; /* portlog buffer */
Jing Huang7725ccf2009-09-23 17:46:15 -0700115 struct bfa_trc_mod_s *trcmod; /* driver tracing */
116 struct bfa_ioc_s ioc; /* IOC module */
117 struct bfa_iocfc_s iocfc; /* IOCFC module */
118 struct bfa_timer_mod_s timer_mod; /* timer module */
119 struct bfa_modules_s modules; /* BFA modules */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700120 struct list_head comp_q; /* pending completions */
Krishna Gudipati775c7742011-06-13 15:52:12 -0700121 bfa_boolean_t queue_process; /* queue processing enabled */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700122 struct list_head reqq_waitq[BFI_IOC_MAX_CQS];
Jing Huang7725ccf2009-09-23 17:46:15 -0700123 bfa_boolean_t fcs; /* FCS is attached to BFA */
124 struct bfa_msix_s msix;
Krishna Gudipati7826f302011-07-20 16:59:13 -0700125 int bfa_aen_seq;
Krishna Gudipati9aec0242012-08-22 19:52:18 -0700126 bfa_boolean_t intr_enabled; /* Status of interrupts */
Jing Huang7725ccf2009-09-23 17:46:15 -0700127};
128
Jing Huang7725ccf2009-09-23 17:46:15 -0700129extern bfa_boolean_t bfa_auto_recover;
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700130extern struct bfa_module_s hal_mod_fcdiag;
Jing Huang7725ccf2009-09-23 17:46:15 -0700131extern struct bfa_module_s hal_mod_sgpg;
Krishna Gudipati1c8a4c32010-03-05 19:37:37 -0800132extern struct bfa_module_s hal_mod_fcport;
Jing Huang7725ccf2009-09-23 17:46:15 -0700133extern struct bfa_module_s hal_mod_fcxp;
134extern struct bfa_module_s hal_mod_lps;
135extern struct bfa_module_s hal_mod_uf;
136extern struct bfa_module_s hal_mod_rport;
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700137extern struct bfa_module_s hal_mod_fcp;
Krishna Gudipati45c5dc12011-07-20 17:03:46 -0700138extern struct bfa_module_s hal_mod_dconf;
Jing Huang7725ccf2009-09-23 17:46:15 -0700139
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700140#endif /* __BFA_MODULES_H__ */