GNU Linux-libre 4.14.313-gnu1
[releases.git] / drivers / scsi / bfa / bfa_modules.h
1 /*
2  * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
3  * Copyright (c) 2014- QLogic Corporation.
4  * All rights reserved
5  * www.qlogic.com
6  *
7  * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
8  *
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
19 /*
20  *  bfa_modules.h BFA modules
21  */
22
23 #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
32 struct bfa_modules_s {
33         struct bfa_fcdiag_s     fcdiag;         /* fcdiag module */
34         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        */
39         struct bfa_fcp_mod_s    fcp_mod;        /*  FCP initiator module     */
40         struct bfa_sgpg_mod_s   sgpg_mod;       /*  SG page module            */
41         struct bfa_port_s       port;           /*  Physical port module     */
42         struct bfa_ablk_s       ablk;           /*  ASIC block config module */
43         struct bfa_cee_s        cee;            /*  CEE Module  */
44         struct bfa_sfp_s        sfp;            /*  SFP module  */
45         struct bfa_flash_s      flash;          /*  flash module */
46         struct bfa_diag_s       diag_mod;       /*  diagnostics module  */
47         struct bfa_phy_s        phy;            /*  phy module          */
48         struct bfa_dconf_mod_s  dconf_mod;      /*  DCONF common module */
49         struct bfa_fru_s        fru;            /*  fru module          */
50 };
51
52 /*
53  * !!! Only append to the enums defined here to avoid any versioning
54  * !!! needed between trace utility and driver version
55  */
56 enum {
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
64 #define BFA_CACHELINE_SZ        (256)
65
66 struct bfa_s {
67         void                    *bfad;          /*  BFA driver instance    */
68         struct bfa_plog_s       *plog;          /*  portlog buffer          */
69         struct bfa_trc_mod_s    *trcmod;        /*  driver tracing          */
70         struct bfa_ioc_s        ioc;            /*  IOC module              */
71         struct bfa_iocfc_s      iocfc;          /*  IOCFC module            */
72         struct bfa_timer_mod_s  timer_mod;      /*  timer module            */
73         struct bfa_modules_s    modules;        /*  BFA modules     */
74         struct list_head        comp_q;         /*  pending completions     */
75         bfa_boolean_t           queue_process;  /*  queue processing enabled */
76         struct list_head        reqq_waitq[BFI_IOC_MAX_CQS];
77         bfa_boolean_t           fcs;            /*  FCS is attached to BFA */
78         struct bfa_msix_s       msix;
79         int                     bfa_aen_seq;
80         bfa_boolean_t           intr_enabled;   /*  Status of interrupts */
81 };
82
83 extern bfa_boolean_t bfa_auto_recover;
84
85 void bfa_dconf_attach(struct bfa_s *, void *, struct bfa_iocfc_cfg_s *);
86 void bfa_dconf_meminfo(struct bfa_iocfc_cfg_s *, struct bfa_meminfo_s *,
87                   struct bfa_s *);
88 void bfa_dconf_iocdisable(struct bfa_s *);
89 void bfa_fcp_attach(struct bfa_s *, void *, struct bfa_iocfc_cfg_s *,
90                 struct bfa_pcidev_s *);
91 void bfa_fcp_iocdisable(struct bfa_s *bfa);
92 void bfa_fcp_meminfo(struct bfa_iocfc_cfg_s *, struct bfa_meminfo_s *,
93                 struct bfa_s *);
94 void bfa_fcpim_iocdisable(struct bfa_fcp_mod_s *);
95 void bfa_fcport_start(struct bfa_s *);
96 void bfa_fcport_iocdisable(struct bfa_s *);
97 void bfa_fcport_meminfo(struct bfa_iocfc_cfg_s *, struct bfa_meminfo_s *,
98                    struct bfa_s *);
99 void bfa_fcport_attach(struct bfa_s *, void *, struct bfa_iocfc_cfg_s *,
100                 struct bfa_pcidev_s *);
101 void bfa_fcxp_iocdisable(struct bfa_s *);
102 void bfa_fcxp_meminfo(struct bfa_iocfc_cfg_s *, struct bfa_meminfo_s *,
103                 struct bfa_s *);
104 void bfa_fcxp_attach(struct bfa_s *, void *, struct bfa_iocfc_cfg_s *,
105                 struct bfa_pcidev_s *);
106 void bfa_fcdiag_iocdisable(struct bfa_s *);
107 void bfa_fcdiag_attach(struct bfa_s *bfa, void *, struct bfa_iocfc_cfg_s *,
108                 struct bfa_pcidev_s *);
109 void bfa_ioim_lm_init(struct bfa_s *);
110 void bfa_lps_iocdisable(struct bfa_s *bfa);
111 void bfa_lps_meminfo(struct bfa_iocfc_cfg_s *, struct bfa_meminfo_s *,
112                 struct bfa_s *);
113 void bfa_lps_attach(struct bfa_s *, void *, struct bfa_iocfc_cfg_s *,
114         struct bfa_pcidev_s *);
115 void bfa_rport_iocdisable(struct bfa_s *bfa);
116 void bfa_rport_meminfo(struct bfa_iocfc_cfg_s *, struct bfa_meminfo_s *,
117                 struct bfa_s *);
118 void bfa_rport_attach(struct bfa_s *, void *, struct bfa_iocfc_cfg_s *,
119                 struct bfa_pcidev_s *);
120 void bfa_sgpg_meminfo(struct bfa_iocfc_cfg_s *, struct bfa_meminfo_s *,
121                 struct bfa_s *);
122 void bfa_sgpg_attach(struct bfa_s *, void *bfad, struct bfa_iocfc_cfg_s *,
123                 struct bfa_pcidev_s *);
124 void bfa_uf_iocdisable(struct bfa_s *);
125 void bfa_uf_meminfo(struct bfa_iocfc_cfg_s *, struct bfa_meminfo_s *,
126                 struct bfa_s *);
127 void bfa_uf_attach(struct bfa_s *, void *, struct bfa_iocfc_cfg_s *,
128                 struct bfa_pcidev_s *);
129 void bfa_uf_start(struct bfa_s *);
130
131 #endif /* __BFA_MODULES_H__ */