blob: d8ea708db9b72fbc486352a6911ea56399e85ee4 [file] [log] [blame]
Jing Huang7725ccf2009-09-23 17:46:15 -07001/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07002 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
Jing Huang7725ccf2009-09-23 17:46:15 -07003 * 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
Jing Huangacdc79a2010-10-18 17:15:55 -070018/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070019 * bfa_modules.h BFA modules
20 */
Jing Huang7725ccf2009-09-23 17:46:15 -070021
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070022#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
31struct bfa_modules_s {
32 struct bfa_fcport_s fcport; /* fc port module */
33 struct bfa_fcxp_mod_s fcxp_mod; /* fcxp module */
34 struct bfa_lps_mod_s lps_mod; /* fcxp module */
35 struct bfa_uf_mod_s uf_mod; /* unsolicited frame module */
36 struct bfa_rport_mod_s rport_mod; /* remote port module */
Krishna Gudipatie2187d72011-06-13 15:53:58 -070037 struct bfa_fcp_mod_s fcp_mod; /* FCP initiator module */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070038 struct bfa_sgpg_mod_s sgpg_mod; /* SG page module */
39 struct bfa_port_s port; /* Physical port module */
Krishna Gudipati1a4d8e12011-06-24 20:22:28 -070040 struct bfa_ablk_s ablk; /* ASIC block config module */
Krishna Gudipati148d6102011-06-24 20:25:36 -070041 struct bfa_cee_s cee; /* CEE Module */
Krishna Gudipati51e569a2011-06-24 20:26:25 -070042 struct bfa_sfp_s sfp; /* SFP module */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070043};
44
45/*
46 * !!! Only append to the enums defined here to avoid any versioning
47 * !!! needed between trace utility and driver version
48 */
49enum {
50 BFA_TRC_HAL_CORE = 1,
51 BFA_TRC_HAL_FCXP = 2,
52 BFA_TRC_HAL_FCPIM = 3,
53 BFA_TRC_HAL_IOCFC_CT = 4,
54 BFA_TRC_HAL_IOCFC_CB = 5,
55};
56
Jing Huangacdc79a2010-10-18 17:15:55 -070057/*
Jing Huang7725ccf2009-09-23 17:46:15 -070058 * Macro to define a new BFA module
59 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070060#define BFA_MODULE(__mod) \
Jing Huang7725ccf2009-09-23 17:46:15 -070061 static void bfa_ ## __mod ## _meminfo( \
Krishna Gudipati45070252011-06-24 20:24:29 -070062 struct bfa_iocfc_cfg_s *cfg, \
63 struct bfa_meminfo_s *meminfo, \
64 struct bfa_s *bfa); \
Jing Huang7725ccf2009-09-23 17:46:15 -070065 static void bfa_ ## __mod ## _attach(struct bfa_s *bfa, \
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070066 void *bfad, struct bfa_iocfc_cfg_s *cfg, \
Jing Huang7725ccf2009-09-23 17:46:15 -070067 struct bfa_pcidev_s *pcidev); \
Jing Huang7725ccf2009-09-23 17:46:15 -070068 static void bfa_ ## __mod ## _detach(struct bfa_s *bfa); \
69 static void bfa_ ## __mod ## _start(struct bfa_s *bfa); \
70 static void bfa_ ## __mod ## _stop(struct bfa_s *bfa); \
71 static void bfa_ ## __mod ## _iocdisable(struct bfa_s *bfa); \
72 \
73 extern struct bfa_module_s hal_mod_ ## __mod; \
74 struct bfa_module_s hal_mod_ ## __mod = { \
75 bfa_ ## __mod ## _meminfo, \
76 bfa_ ## __mod ## _attach, \
Jing Huang7725ccf2009-09-23 17:46:15 -070077 bfa_ ## __mod ## _detach, \
78 bfa_ ## __mod ## _start, \
79 bfa_ ## __mod ## _stop, \
80 bfa_ ## __mod ## _iocdisable, \
81 }
82
83#define BFA_CACHELINE_SZ (256)
84
Jing Huangacdc79a2010-10-18 17:15:55 -070085/*
Jing Huang7725ccf2009-09-23 17:46:15 -070086 * Structure used to interact between different BFA sub modules
87 *
88 * Each sub module needs to implement only the entry points relevant to it (and
89 * can leave entry points as NULL)
90 */
91struct bfa_module_s {
Krishna Gudipati45070252011-06-24 20:24:29 -070092 void (*meminfo) (struct bfa_iocfc_cfg_s *cfg,
93 struct bfa_meminfo_s *meminfo,
94 struct bfa_s *bfa);
Jing Huang7725ccf2009-09-23 17:46:15 -070095 void (*attach) (struct bfa_s *bfa, void *bfad,
96 struct bfa_iocfc_cfg_s *cfg,
Jing Huang7725ccf2009-09-23 17:46:15 -070097 struct bfa_pcidev_s *pcidev);
Jing Huang7725ccf2009-09-23 17:46:15 -070098 void (*detach) (struct bfa_s *bfa);
99 void (*start) (struct bfa_s *bfa);
100 void (*stop) (struct bfa_s *bfa);
101 void (*iocdisable) (struct bfa_s *bfa);
102};
103
Jing Huang7725ccf2009-09-23 17:46:15 -0700104
105struct bfa_s {
106 void *bfad; /* BFA driver instance */
Jing Huang7725ccf2009-09-23 17:46:15 -0700107 struct bfa_plog_s *plog; /* portlog buffer */
Jing Huang7725ccf2009-09-23 17:46:15 -0700108 struct bfa_trc_mod_s *trcmod; /* driver tracing */
109 struct bfa_ioc_s ioc; /* IOC module */
110 struct bfa_iocfc_s iocfc; /* IOCFC module */
111 struct bfa_timer_mod_s timer_mod; /* timer module */
112 struct bfa_modules_s modules; /* BFA modules */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700113 struct list_head comp_q; /* pending completions */
Krishna Gudipati775c7742011-06-13 15:52:12 -0700114 bfa_boolean_t queue_process; /* queue processing enabled */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700115 struct list_head reqq_waitq[BFI_IOC_MAX_CQS];
Jing Huang7725ccf2009-09-23 17:46:15 -0700116 bfa_boolean_t fcs; /* FCS is attached to BFA */
117 struct bfa_msix_s msix;
118};
119
Jing Huang7725ccf2009-09-23 17:46:15 -0700120extern bfa_boolean_t bfa_auto_recover;
Jing Huang7725ccf2009-09-23 17:46:15 -0700121extern struct bfa_module_s hal_mod_sgpg;
Krishna Gudipati1c8a4c32010-03-05 19:37:37 -0800122extern struct bfa_module_s hal_mod_fcport;
Jing Huang7725ccf2009-09-23 17:46:15 -0700123extern struct bfa_module_s hal_mod_fcxp;
124extern struct bfa_module_s hal_mod_lps;
125extern struct bfa_module_s hal_mod_uf;
126extern struct bfa_module_s hal_mod_rport;
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700127extern struct bfa_module_s hal_mod_fcp;
Jing Huang7725ccf2009-09-23 17:46:15 -0700128
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700129#endif /* __BFA_MODULES_H__ */