Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 1 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 2 | * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 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 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 18 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 19 | * bfa_modules.h BFA modules |
| 20 | */ |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 21 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 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 { |
Krishna Gudipati | 3d7fc66 | 2011-06-24 20:28:17 -0700 | [diff] [blame] | 32 | struct bfa_fcdiag_s fcdiag; /* fcdiag module */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 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 */ |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame] | 38 | struct bfa_fcp_mod_s fcp_mod; /* FCP initiator module */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 39 | struct bfa_sgpg_mod_s sgpg_mod; /* SG page module */ |
| 40 | struct bfa_port_s port; /* Physical port module */ |
Krishna Gudipati | 1a4d8e1 | 2011-06-24 20:22:28 -0700 | [diff] [blame] | 41 | struct bfa_ablk_s ablk; /* ASIC block config module */ |
Krishna Gudipati | 148d610 | 2011-06-24 20:25:36 -0700 | [diff] [blame] | 42 | struct bfa_cee_s cee; /* CEE Module */ |
Krishna Gudipati | 51e569a | 2011-06-24 20:26:25 -0700 | [diff] [blame] | 43 | struct bfa_sfp_s sfp; /* SFP module */ |
Krishna Gudipati | 5a54b1d | 2011-06-24 20:27:13 -0700 | [diff] [blame] | 44 | struct bfa_flash_s flash; /* flash module */ |
Krishna Gudipati | 3d7fc66 | 2011-06-24 20:28:17 -0700 | [diff] [blame] | 45 | struct bfa_diag_s diag_mod; /* diagnostics module */ |
Krishna Gudipati | 3350d98 | 2011-06-24 20:28:37 -0700 | [diff] [blame] | 46 | struct bfa_phy_s phy; /* phy module */ |
Krishna Gudipati | 45c5dc1 | 2011-07-20 17:03:46 -0700 | [diff] [blame] | 47 | struct bfa_dconf_mod_s dconf_mod; /* DCONF common module */ |
Krishna Gudipati | e6826c9 | 2012-09-21 17:27:14 -0700 | [diff] [blame] | 48 | struct bfa_fru_s fru; /* fru module */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | /* |
| 52 | * !!! Only append to the enums defined here to avoid any versioning |
| 53 | * !!! needed between trace utility and driver version |
| 54 | */ |
| 55 | enum { |
| 56 | BFA_TRC_HAL_CORE = 1, |
| 57 | BFA_TRC_HAL_FCXP = 2, |
| 58 | BFA_TRC_HAL_FCPIM = 3, |
| 59 | BFA_TRC_HAL_IOCFC_CT = 4, |
| 60 | BFA_TRC_HAL_IOCFC_CB = 5, |
| 61 | }; |
| 62 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 63 | /* |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 64 | * Macro to define a new BFA module |
| 65 | */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 66 | #define BFA_MODULE(__mod) \ |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 67 | static void bfa_ ## __mod ## _meminfo( \ |
Krishna Gudipati | 4507025 | 2011-06-24 20:24:29 -0700 | [diff] [blame] | 68 | struct bfa_iocfc_cfg_s *cfg, \ |
| 69 | struct bfa_meminfo_s *meminfo, \ |
| 70 | struct bfa_s *bfa); \ |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 71 | static void bfa_ ## __mod ## _attach(struct bfa_s *bfa, \ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 72 | void *bfad, struct bfa_iocfc_cfg_s *cfg, \ |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 73 | struct bfa_pcidev_s *pcidev); \ |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 74 | static void bfa_ ## __mod ## _detach(struct bfa_s *bfa); \ |
| 75 | static void bfa_ ## __mod ## _start(struct bfa_s *bfa); \ |
| 76 | static void bfa_ ## __mod ## _stop(struct bfa_s *bfa); \ |
| 77 | static void bfa_ ## __mod ## _iocdisable(struct bfa_s *bfa); \ |
| 78 | \ |
| 79 | extern struct bfa_module_s hal_mod_ ## __mod; \ |
| 80 | struct bfa_module_s hal_mod_ ## __mod = { \ |
| 81 | bfa_ ## __mod ## _meminfo, \ |
| 82 | bfa_ ## __mod ## _attach, \ |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 83 | bfa_ ## __mod ## _detach, \ |
| 84 | bfa_ ## __mod ## _start, \ |
| 85 | bfa_ ## __mod ## _stop, \ |
| 86 | bfa_ ## __mod ## _iocdisable, \ |
| 87 | } |
| 88 | |
| 89 | #define BFA_CACHELINE_SZ (256) |
| 90 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 91 | /* |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 92 | * Structure used to interact between different BFA sub modules |
| 93 | * |
| 94 | * Each sub module needs to implement only the entry points relevant to it (and |
| 95 | * can leave entry points as NULL) |
| 96 | */ |
| 97 | struct bfa_module_s { |
Krishna Gudipati | 4507025 | 2011-06-24 20:24:29 -0700 | [diff] [blame] | 98 | void (*meminfo) (struct bfa_iocfc_cfg_s *cfg, |
| 99 | struct bfa_meminfo_s *meminfo, |
| 100 | struct bfa_s *bfa); |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 101 | void (*attach) (struct bfa_s *bfa, void *bfad, |
| 102 | struct bfa_iocfc_cfg_s *cfg, |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 103 | struct bfa_pcidev_s *pcidev); |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 104 | void (*detach) (struct bfa_s *bfa); |
| 105 | void (*start) (struct bfa_s *bfa); |
| 106 | void (*stop) (struct bfa_s *bfa); |
| 107 | void (*iocdisable) (struct bfa_s *bfa); |
| 108 | }; |
| 109 | |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 110 | |
| 111 | struct bfa_s { |
| 112 | void *bfad; /* BFA driver instance */ |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 113 | struct bfa_plog_s *plog; /* portlog buffer */ |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 114 | struct bfa_trc_mod_s *trcmod; /* driver tracing */ |
| 115 | struct bfa_ioc_s ioc; /* IOC module */ |
| 116 | struct bfa_iocfc_s iocfc; /* IOCFC module */ |
| 117 | struct bfa_timer_mod_s timer_mod; /* timer module */ |
| 118 | struct bfa_modules_s modules; /* BFA modules */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 119 | struct list_head comp_q; /* pending completions */ |
Krishna Gudipati | 775c774 | 2011-06-13 15:52:12 -0700 | [diff] [blame] | 120 | bfa_boolean_t queue_process; /* queue processing enabled */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 121 | struct list_head reqq_waitq[BFI_IOC_MAX_CQS]; |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 122 | bfa_boolean_t fcs; /* FCS is attached to BFA */ |
| 123 | struct bfa_msix_s msix; |
Krishna Gudipati | 7826f30 | 2011-07-20 16:59:13 -0700 | [diff] [blame] | 124 | int bfa_aen_seq; |
Krishna Gudipati | 9aec024 | 2012-08-22 19:52:18 -0700 | [diff] [blame] | 125 | bfa_boolean_t intr_enabled; /* Status of interrupts */ |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 126 | }; |
| 127 | |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 128 | extern bfa_boolean_t bfa_auto_recover; |
Krishna Gudipati | 3d7fc66 | 2011-06-24 20:28:17 -0700 | [diff] [blame] | 129 | extern struct bfa_module_s hal_mod_fcdiag; |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 130 | extern struct bfa_module_s hal_mod_sgpg; |
Krishna Gudipati | 1c8a4c3 | 2010-03-05 19:37:37 -0800 | [diff] [blame] | 131 | extern struct bfa_module_s hal_mod_fcport; |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 132 | extern struct bfa_module_s hal_mod_fcxp; |
| 133 | extern struct bfa_module_s hal_mod_lps; |
| 134 | extern struct bfa_module_s hal_mod_uf; |
| 135 | extern struct bfa_module_s hal_mod_rport; |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame] | 136 | extern struct bfa_module_s hal_mod_fcp; |
Krishna Gudipati | 45c5dc1 | 2011-07-20 17:03:46 -0700 | [diff] [blame] | 137 | extern struct bfa_module_s hal_mod_dconf; |
Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 138 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 139 | #endif /* __BFA_MODULES_H__ */ |