Merge branch 'mw-3.1-jul25' of git://oss.oracle.com/git/smushran/linux-2.6 into ocfs2...
[pandora-kernel.git] / drivers / scsi / bfa / bfa_modules.h
1 /*
2  * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
3  * All rights reserved
4  * www.brocade.com
5  *
6  * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7  *
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
11  *
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.
16  */
17
18 /*
19  *  bfa_modules.h BFA modules
20  */
21
22 #ifndef __BFA_MODULES_H__
23 #define __BFA_MODULES_H__
24
25 #include "bfa_cs.h"
26 #include "bfa.h"
27 #include "bfa_svc.h"
28 #include "bfa_fcpim.h"
29 #include "bfa_port.h"
30
31 struct bfa_modules_s {
32         struct bfa_fcdiag_s     fcdiag;         /* fcdiag module */
33         struct bfa_fcport_s     fcport;         /*  fc port module            */
34         struct bfa_fcxp_mod_s   fcxp_mod;       /*  fcxp module       */
35         struct bfa_lps_mod_s    lps_mod;        /*  fcxp module       */
36         struct bfa_uf_mod_s     uf_mod;         /*  unsolicited frame module */
37         struct bfa_rport_mod_s  rport_mod;      /*  remote port module        */
38         struct bfa_fcp_mod_s    fcp_mod;        /*  FCP initiator module     */
39         struct bfa_sgpg_mod_s   sgpg_mod;       /*  SG page module            */
40         struct bfa_port_s       port;           /*  Physical port module     */
41         struct bfa_ablk_s       ablk;           /*  ASIC block config module */
42         struct bfa_cee_s        cee;            /*  CEE Module  */
43         struct bfa_sfp_s        sfp;            /*  SFP module  */
44         struct bfa_flash_s      flash;          /*  flash module */
45         struct bfa_diag_s       diag_mod;       /*  diagnostics module  */
46         struct bfa_phy_s        phy;            /*  phy module          */
47 };
48
49 /*
50  * !!! Only append to the enums defined here to avoid any versioning
51  * !!! needed between trace utility and driver version
52  */
53 enum {
54         BFA_TRC_HAL_CORE        = 1,
55         BFA_TRC_HAL_FCXP        = 2,
56         BFA_TRC_HAL_FCPIM       = 3,
57         BFA_TRC_HAL_IOCFC_CT    = 4,
58         BFA_TRC_HAL_IOCFC_CB    = 5,
59 };
60
61 /*
62  * Macro to define a new BFA module
63  */
64 #define BFA_MODULE(__mod)                                               \
65         static void bfa_ ## __mod ## _meminfo(                          \
66                         struct bfa_iocfc_cfg_s *cfg,                    \
67                         struct bfa_meminfo_s *meminfo,                  \
68                         struct bfa_s *bfa);                             \
69         static void bfa_ ## __mod ## _attach(struct bfa_s *bfa,         \
70                         void *bfad, struct bfa_iocfc_cfg_s *cfg,        \
71                         struct bfa_pcidev_s *pcidev);      \
72         static void bfa_ ## __mod ## _detach(struct bfa_s *bfa);      \
73         static void bfa_ ## __mod ## _start(struct bfa_s *bfa);      \
74         static void bfa_ ## __mod ## _stop(struct bfa_s *bfa);      \
75         static void bfa_ ## __mod ## _iocdisable(struct bfa_s *bfa);      \
76                                                                         \
77         extern struct bfa_module_s hal_mod_ ## __mod;                   \
78         struct bfa_module_s hal_mod_ ## __mod = {                       \
79                 bfa_ ## __mod ## _meminfo,                              \
80                 bfa_ ## __mod ## _attach,                               \
81                 bfa_ ## __mod ## _detach,                               \
82                 bfa_ ## __mod ## _start,                                \
83                 bfa_ ## __mod ## _stop,                                 \
84                 bfa_ ## __mod ## _iocdisable,                           \
85         }
86
87 #define BFA_CACHELINE_SZ        (256)
88
89 /*
90  * Structure used to interact between different BFA sub modules
91  *
92  * Each sub module needs to implement only the entry points relevant to it (and
93  * can leave entry points as NULL)
94  */
95 struct bfa_module_s {
96         void (*meminfo) (struct bfa_iocfc_cfg_s *cfg,
97                          struct bfa_meminfo_s *meminfo,
98                          struct bfa_s *bfa);
99         void (*attach) (struct bfa_s *bfa, void *bfad,
100                         struct bfa_iocfc_cfg_s *cfg,
101                         struct bfa_pcidev_s *pcidev);
102         void (*detach) (struct bfa_s *bfa);
103         void (*start) (struct bfa_s *bfa);
104         void (*stop) (struct bfa_s *bfa);
105         void (*iocdisable) (struct bfa_s *bfa);
106 };
107
108
109 struct bfa_s {
110         void                    *bfad;          /*  BFA driver instance    */
111         struct bfa_plog_s       *plog;          /*  portlog buffer          */
112         struct bfa_trc_mod_s    *trcmod;        /*  driver tracing          */
113         struct bfa_ioc_s        ioc;            /*  IOC module              */
114         struct bfa_iocfc_s      iocfc;          /*  IOCFC module            */
115         struct bfa_timer_mod_s  timer_mod;      /*  timer module            */
116         struct bfa_modules_s    modules;        /*  BFA modules     */
117         struct list_head        comp_q;         /*  pending completions     */
118         bfa_boolean_t           queue_process;  /*  queue processing enabled */
119         struct list_head        reqq_waitq[BFI_IOC_MAX_CQS];
120         bfa_boolean_t           fcs;            /*  FCS is attached to BFA */
121         struct bfa_msix_s       msix;
122 };
123
124 extern bfa_boolean_t bfa_auto_recover;
125 extern struct bfa_module_s hal_mod_fcdiag;
126 extern struct bfa_module_s hal_mod_sgpg;
127 extern struct bfa_module_s hal_mod_fcport;
128 extern struct bfa_module_s hal_mod_fcxp;
129 extern struct bfa_module_s hal_mod_lps;
130 extern struct bfa_module_s hal_mod_uf;
131 extern struct bfa_module_s hal_mod_rport;
132 extern struct bfa_module_s hal_mod_fcp;
133
134 #endif /* __BFA_MODULES_H__ */