upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / scsi / bfa / bfa_priv.h
1 /*
2  * Copyright (c) 2005-2009 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 #ifndef __BFA_PRIV_H__
19 #define __BFA_PRIV_H__
20
21 #include "bfa_iocfc.h"
22 #include "bfa_intr_priv.h"
23 #include "bfa_trcmod_priv.h"
24 #include "bfa_modules_priv.h"
25 #include "bfa_fwimg_priv.h"
26 #include <cs/bfa_log.h>
27 #include <bfa_timer.h>
28
29 /**
30  * Macro to define a new BFA module
31  */
32 #define BFA_MODULE(__mod)                                               \
33         static void bfa_ ## __mod ## _meminfo(                          \
34                         struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len,      \
35                         u32 *dm_len);      \
36         static void bfa_ ## __mod ## _attach(struct bfa_s *bfa,         \
37                         void *bfad, struct bfa_iocfc_cfg_s *cfg,        \
38                         struct bfa_meminfo_s *meminfo,                  \
39                         struct bfa_pcidev_s *pcidev);      \
40         static void bfa_ ## __mod ## _detach(struct bfa_s *bfa);      \
41         static void bfa_ ## __mod ## _start(struct bfa_s *bfa);      \
42         static void bfa_ ## __mod ## _stop(struct bfa_s *bfa);      \
43         static void bfa_ ## __mod ## _iocdisable(struct bfa_s *bfa);      \
44                                                                         \
45         extern struct bfa_module_s hal_mod_ ## __mod;                   \
46         struct bfa_module_s hal_mod_ ## __mod = {                       \
47                 bfa_ ## __mod ## _meminfo,                              \
48                 bfa_ ## __mod ## _attach,                               \
49                 bfa_ ## __mod ## _detach,                               \
50                 bfa_ ## __mod ## _start,                                \
51                 bfa_ ## __mod ## _stop,                                 \
52                 bfa_ ## __mod ## _iocdisable,                           \
53         }
54
55 #define BFA_CACHELINE_SZ        (256)
56
57 /**
58  * Structure used to interact between different BFA sub modules
59  *
60  * Each sub module needs to implement only the entry points relevant to it (and
61  * can leave entry points as NULL)
62  */
63 struct bfa_module_s {
64         void (*meminfo) (struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
65                         u32 *dm_len);
66         void (*attach) (struct bfa_s *bfa, void *bfad,
67                         struct bfa_iocfc_cfg_s *cfg,
68                         struct bfa_meminfo_s *meminfo,
69                         struct bfa_pcidev_s *pcidev);
70         void (*detach) (struct bfa_s *bfa);
71         void (*start) (struct bfa_s *bfa);
72         void (*stop) (struct bfa_s *bfa);
73         void (*iocdisable) (struct bfa_s *bfa);
74 };
75
76 extern struct bfa_module_s *hal_mods[];
77
78 struct bfa_s {
79         void                    *bfad;          /*  BFA driver instance    */
80         struct bfa_aen_s        *aen;           /*  AEN module              */
81         struct bfa_plog_s       *plog;          /*  portlog buffer          */
82         struct bfa_log_mod_s    *logm;          /*  driver logging modulen */
83         struct bfa_trc_mod_s    *trcmod;        /*  driver tracing          */
84         struct bfa_ioc_s        ioc;            /*  IOC module              */
85         struct bfa_iocfc_s      iocfc;          /*  IOCFC module            */
86         struct bfa_timer_mod_s  timer_mod;      /*  timer module            */
87         struct bfa_modules_s    modules;        /*  BFA modules     */
88         struct list_head        comp_q;         /*  pending completions    */
89         bfa_boolean_t           rme_process;    /*  RME processing enabled */
90         struct list_head                reqq_waitq[BFI_IOC_MAX_CQS];
91         bfa_boolean_t           fcs;            /*  FCS is attached to BFA */
92         struct bfa_msix_s       msix;
93 };
94
95 extern bfa_isr_func_t bfa_isrs[BFI_MC_MAX];
96 extern bfa_ioc_mbox_mcfunc_t  bfa_mbox_isrs[];
97 extern bfa_boolean_t bfa_auto_recover;
98 extern struct bfa_module_s hal_mod_flash;
99 extern struct bfa_module_s hal_mod_fcdiag;
100 extern struct bfa_module_s hal_mod_sgpg;
101 extern struct bfa_module_s hal_mod_fcport;
102 extern struct bfa_module_s hal_mod_fcxp;
103 extern struct bfa_module_s hal_mod_lps;
104 extern struct bfa_module_s hal_mod_uf;
105 extern struct bfa_module_s hal_mod_rport;
106 extern struct bfa_module_s hal_mod_fcpim;
107 extern struct bfa_module_s hal_mod_pbind;
108
109 #endif /* __BFA_PRIV_H__ */
110