Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 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 | #ifndef __BFA_DEFS_H__ |
| 19 | #define __BFA_DEFS_H__ |
| 20 | |
| 21 | #include "bfa_fc.h" |
Maggie Zhang | f16a175 | 2010-12-09 19:12:32 -0800 | [diff] [blame] | 22 | #include "bfad_drv.h" |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 23 | |
| 24 | #define BFA_MFG_SERIALNUM_SIZE 11 |
| 25 | #define STRSZ(_n) (((_n) + 4) & ~3) |
| 26 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 27 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 28 | * Manufacturing card type |
| 29 | */ |
| 30 | enum { |
| 31 | BFA_MFG_TYPE_CB_MAX = 825, /* Crossbow card type max */ |
| 32 | BFA_MFG_TYPE_FC8P2 = 825, /* 8G 2port FC card */ |
| 33 | BFA_MFG_TYPE_FC8P1 = 815, /* 8G 1port FC card */ |
| 34 | BFA_MFG_TYPE_FC4P2 = 425, /* 4G 2port FC card */ |
| 35 | BFA_MFG_TYPE_FC4P1 = 415, /* 4G 1port FC card */ |
| 36 | BFA_MFG_TYPE_CNA10P2 = 1020, /* 10G 2port CNA card */ |
| 37 | BFA_MFG_TYPE_CNA10P1 = 1010, /* 10G 1port CNA card */ |
| 38 | BFA_MFG_TYPE_JAYHAWK = 804, /* Jayhawk mezz card */ |
| 39 | BFA_MFG_TYPE_WANCHESE = 1007, /* Wanchese mezz card */ |
| 40 | BFA_MFG_TYPE_ASTRA = 807, /* Astra mezz card */ |
| 41 | BFA_MFG_TYPE_LIGHTNING_P0 = 902, /* Lightning mezz card - old */ |
| 42 | BFA_MFG_TYPE_LIGHTNING = 1741, /* Lightning mezz card */ |
Krishna Gudipati | 8b070b4 | 2011-06-13 15:52:40 -0700 | [diff] [blame] | 43 | BFA_MFG_TYPE_PROWLER_F = 1560, /* Prowler FC only cards */ |
| 44 | BFA_MFG_TYPE_PROWLER_N = 1410, /* Prowler NIC only cards */ |
| 45 | BFA_MFG_TYPE_PROWLER_C = 1710, /* Prowler CNA only cards */ |
| 46 | BFA_MFG_TYPE_PROWLER_D = 1860, /* Prowler Dual cards */ |
| 47 | BFA_MFG_TYPE_CHINOOK = 1867, /* Chinook cards */ |
| 48 | BFA_MFG_TYPE_INVALID = 0, /* Invalid card type */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | #pragma pack(1) |
| 52 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 53 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 54 | * Check if Mezz card |
| 55 | */ |
| 56 | #define bfa_mfg_is_mezz(type) (( \ |
| 57 | (type) == BFA_MFG_TYPE_JAYHAWK || \ |
| 58 | (type) == BFA_MFG_TYPE_WANCHESE || \ |
| 59 | (type) == BFA_MFG_TYPE_ASTRA || \ |
| 60 | (type) == BFA_MFG_TYPE_LIGHTNING_P0 || \ |
Krishna Gudipati | 8b070b4 | 2011-06-13 15:52:40 -0700 | [diff] [blame] | 61 | (type) == BFA_MFG_TYPE_LIGHTNING || \ |
| 62 | (type) == BFA_MFG_TYPE_CHINOOK)) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 63 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 64 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 65 | * Check if the card having old wwn/mac handling |
| 66 | */ |
| 67 | #define bfa_mfg_is_old_wwn_mac_model(type) (( \ |
| 68 | (type) == BFA_MFG_TYPE_FC8P2 || \ |
| 69 | (type) == BFA_MFG_TYPE_FC8P1 || \ |
| 70 | (type) == BFA_MFG_TYPE_FC4P2 || \ |
| 71 | (type) == BFA_MFG_TYPE_FC4P1 || \ |
| 72 | (type) == BFA_MFG_TYPE_CNA10P2 || \ |
| 73 | (type) == BFA_MFG_TYPE_CNA10P1 || \ |
| 74 | (type) == BFA_MFG_TYPE_JAYHAWK || \ |
| 75 | (type) == BFA_MFG_TYPE_WANCHESE)) |
| 76 | |
| 77 | #define bfa_mfg_increment_wwn_mac(m, i) \ |
| 78 | do { \ |
| 79 | u32 t = ((u32)(m)[0] << 16) | ((u32)(m)[1] << 8) | \ |
| 80 | (u32)(m)[2]; \ |
| 81 | t += (i); \ |
| 82 | (m)[0] = (t >> 16) & 0xFF; \ |
| 83 | (m)[1] = (t >> 8) & 0xFF; \ |
| 84 | (m)[2] = t & 0xFF; \ |
| 85 | } while (0) |
| 86 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 87 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 88 | * VPD data length |
| 89 | */ |
| 90 | #define BFA_MFG_VPD_LEN 512 |
| 91 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 92 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 93 | * VPD vendor tag |
| 94 | */ |
| 95 | enum { |
| 96 | BFA_MFG_VPD_UNKNOWN = 0, /* vendor unknown */ |
| 97 | BFA_MFG_VPD_IBM = 1, /* vendor IBM */ |
| 98 | BFA_MFG_VPD_HP = 2, /* vendor HP */ |
| 99 | BFA_MFG_VPD_DELL = 3, /* vendor DELL */ |
| 100 | BFA_MFG_VPD_PCI_IBM = 0x08, /* PCI VPD IBM */ |
| 101 | BFA_MFG_VPD_PCI_HP = 0x10, /* PCI VPD HP */ |
| 102 | BFA_MFG_VPD_PCI_DELL = 0x20, /* PCI VPD DELL */ |
| 103 | BFA_MFG_VPD_PCI_BRCD = 0xf8, /* PCI VPD Brocade */ |
| 104 | }; |
| 105 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 106 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 107 | * All numerical fields are in big-endian format. |
| 108 | */ |
| 109 | struct bfa_mfg_vpd_s { |
| 110 | u8 version; /* vpd data version */ |
| 111 | u8 vpd_sig[3]; /* characters 'V', 'P', 'D' */ |
| 112 | u8 chksum; /* u8 checksum */ |
| 113 | u8 vendor; /* vendor */ |
| 114 | u8 len; /* vpd data length excluding header */ |
| 115 | u8 rsv; |
| 116 | u8 data[BFA_MFG_VPD_LEN]; /* vpd data */ |
| 117 | }; |
| 118 | |
| 119 | #pragma pack() |
| 120 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 121 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 122 | * Status return values |
| 123 | */ |
| 124 | enum bfa_status { |
| 125 | BFA_STATUS_OK = 0, /* Success */ |
| 126 | BFA_STATUS_FAILED = 1, /* Operation failed */ |
| 127 | BFA_STATUS_EINVAL = 2, /* Invalid params Check input |
| 128 | * parameters */ |
| 129 | BFA_STATUS_ENOMEM = 3, /* Out of resources */ |
| 130 | BFA_STATUS_ETIMER = 5, /* Timer expired - Retry, if persists, |
| 131 | * contact support */ |
| 132 | BFA_STATUS_EPROTOCOL = 6, /* Protocol error */ |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 133 | BFA_STATUS_UNKNOWN_VFID = 11, /* VF_ID not found */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 134 | BFA_STATUS_DEVBUSY = 13, /* Device busy - Retry operation */ |
| 135 | BFA_STATUS_UNKNOWN_LWWN = 18, /* LPORT PWWN not found */ |
| 136 | BFA_STATUS_UNKNOWN_RWWN = 19, /* RPORT PWWN not found */ |
| 137 | BFA_STATUS_VPORT_EXISTS = 21, /* VPORT already exists */ |
| 138 | BFA_STATUS_VPORT_MAX = 22, /* Reached max VPORT supported limit */ |
| 139 | BFA_STATUS_UNSUPP_SPEED = 23, /* Invalid Speed Check speed setting */ |
| 140 | BFA_STATUS_INVLD_DFSZ = 24, /* Invalid Max data field size */ |
| 141 | BFA_STATUS_FABRIC_RJT = 29, /* Reject from attached fabric */ |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 142 | BFA_STATUS_PORT_OFFLINE = 34, /* Port is not online */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 143 | BFA_STATUS_VPORT_WWN_BP = 46, /* WWN is same as base port's WWN */ |
| 144 | BFA_STATUS_NO_FCPIM_NEXUS = 52, /* No FCP Nexus exists with the rport */ |
| 145 | BFA_STATUS_IOC_FAILURE = 56, /* IOC failure - Retry, if persists |
| 146 | * contact support */ |
| 147 | BFA_STATUS_INVALID_WWN = 57, /* Invalid WWN */ |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 148 | BFA_STATUS_VERSION_FAIL = 70, /* Application/Driver version mismatch */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 149 | BFA_STATUS_DIAG_BUSY = 71, /* diag busy */ |
| 150 | BFA_STATUS_ENOFSAVE = 78, /* No saved firmware trace */ |
| 151 | BFA_STATUS_IOC_DISABLED = 82, /* IOC is already disabled */ |
| 152 | BFA_STATUS_INVALID_MAC = 134, /* Invalid MAC address */ |
| 153 | BFA_STATUS_PBC = 154, /* Operation not allowed for pre-boot |
| 154 | * configuration */ |
| 155 | BFA_STATUS_TRUNK_ENABLED = 164, /* Trunk is already enabled on |
| 156 | * this adapter */ |
| 157 | BFA_STATUS_TRUNK_DISABLED = 165, /* Trunking is disabled on |
| 158 | * the adapter */ |
| 159 | BFA_STATUS_IOPROFILE_OFF = 175, /* IO profile OFF */ |
| 160 | BFA_STATUS_MAX_VAL /* Unknown error code */ |
| 161 | }; |
| 162 | #define bfa_status_t enum bfa_status |
| 163 | |
| 164 | enum bfa_eproto_status { |
| 165 | BFA_EPROTO_BAD_ACCEPT = 0, |
| 166 | BFA_EPROTO_UNKNOWN_RSP = 1 |
| 167 | }; |
| 168 | #define bfa_eproto_status_t enum bfa_eproto_status |
| 169 | |
| 170 | enum bfa_boolean { |
| 171 | BFA_FALSE = 0, |
| 172 | BFA_TRUE = 1 |
| 173 | }; |
| 174 | #define bfa_boolean_t enum bfa_boolean |
| 175 | |
| 176 | #define BFA_STRING_32 32 |
| 177 | #define BFA_VERSION_LEN 64 |
| 178 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 179 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 180 | * ---------------------- adapter definitions ------------ |
| 181 | */ |
| 182 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 183 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 184 | * BFA adapter level attributes. |
| 185 | */ |
| 186 | enum { |
| 187 | BFA_ADAPTER_SERIAL_NUM_LEN = STRSZ(BFA_MFG_SERIALNUM_SIZE), |
| 188 | /* |
| 189 | *!< adapter serial num length |
| 190 | */ |
| 191 | BFA_ADAPTER_MODEL_NAME_LEN = 16, /* model name length */ |
| 192 | BFA_ADAPTER_MODEL_DESCR_LEN = 128, /* model description length */ |
| 193 | BFA_ADAPTER_MFG_NAME_LEN = 8, /* manufacturer name length */ |
| 194 | BFA_ADAPTER_SYM_NAME_LEN = 64, /* adapter symbolic name length */ |
| 195 | BFA_ADAPTER_OS_TYPE_LEN = 64, /* adapter os type length */ |
| 196 | }; |
| 197 | |
| 198 | struct bfa_adapter_attr_s { |
| 199 | char manufacturer[BFA_ADAPTER_MFG_NAME_LEN]; |
| 200 | char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN]; |
| 201 | u32 card_type; |
| 202 | char model[BFA_ADAPTER_MODEL_NAME_LEN]; |
| 203 | char model_descr[BFA_ADAPTER_MODEL_DESCR_LEN]; |
| 204 | wwn_t pwwn; |
| 205 | char node_symname[FC_SYMNAME_MAX]; |
| 206 | char hw_ver[BFA_VERSION_LEN]; |
| 207 | char fw_ver[BFA_VERSION_LEN]; |
| 208 | char optrom_ver[BFA_VERSION_LEN]; |
| 209 | char os_type[BFA_ADAPTER_OS_TYPE_LEN]; |
| 210 | struct bfa_mfg_vpd_s vpd; |
| 211 | struct mac_s mac; |
| 212 | |
| 213 | u8 nports; |
| 214 | u8 max_speed; |
| 215 | u8 prototype; |
| 216 | char asic_rev; |
| 217 | |
| 218 | u8 pcie_gen; |
| 219 | u8 pcie_lanes_orig; |
| 220 | u8 pcie_lanes; |
| 221 | u8 cna_capable; |
| 222 | |
| 223 | u8 is_mezz; |
| 224 | u8 trunk_capable; |
| 225 | }; |
| 226 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 227 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 228 | * ---------------------- IOC definitions ------------ |
| 229 | */ |
| 230 | |
| 231 | enum { |
| 232 | BFA_IOC_DRIVER_LEN = 16, |
| 233 | BFA_IOC_CHIP_REV_LEN = 8, |
| 234 | }; |
| 235 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 236 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 237 | * Driver and firmware versions. |
| 238 | */ |
| 239 | struct bfa_ioc_driver_attr_s { |
| 240 | char driver[BFA_IOC_DRIVER_LEN]; /* driver name */ |
| 241 | char driver_ver[BFA_VERSION_LEN]; /* driver version */ |
| 242 | char fw_ver[BFA_VERSION_LEN]; /* firmware version */ |
| 243 | char bios_ver[BFA_VERSION_LEN]; /* bios version */ |
| 244 | char efi_ver[BFA_VERSION_LEN]; /* EFI version */ |
| 245 | char ob_ver[BFA_VERSION_LEN]; /* openboot version */ |
| 246 | }; |
| 247 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 248 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 249 | * IOC PCI device attributes |
| 250 | */ |
| 251 | struct bfa_ioc_pci_attr_s { |
| 252 | u16 vendor_id; /* PCI vendor ID */ |
| 253 | u16 device_id; /* PCI device ID */ |
| 254 | u16 ssid; /* subsystem ID */ |
| 255 | u16 ssvid; /* subsystem vendor ID */ |
| 256 | u32 pcifn; /* PCI device function */ |
| 257 | u32 rsvd; /* padding */ |
| 258 | char chip_rev[BFA_IOC_CHIP_REV_LEN]; /* chip revision */ |
| 259 | }; |
| 260 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 261 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 262 | * IOC states |
| 263 | */ |
| 264 | enum bfa_ioc_state { |
| 265 | BFA_IOC_UNINIT = 1, /* IOC is in uninit state */ |
| 266 | BFA_IOC_RESET = 2, /* IOC is in reset state */ |
| 267 | BFA_IOC_SEMWAIT = 3, /* Waiting for IOC h/w semaphore */ |
| 268 | BFA_IOC_HWINIT = 4, /* IOC h/w is being initialized */ |
| 269 | BFA_IOC_GETATTR = 5, /* IOC is being configured */ |
| 270 | BFA_IOC_OPERATIONAL = 6, /* IOC is operational */ |
| 271 | BFA_IOC_INITFAIL = 7, /* IOC hardware failure */ |
| 272 | BFA_IOC_FAIL = 8, /* IOC heart-beat failure */ |
| 273 | BFA_IOC_DISABLING = 9, /* IOC is being disabled */ |
| 274 | BFA_IOC_DISABLED = 10, /* IOC is disabled */ |
| 275 | BFA_IOC_FWMISMATCH = 11, /* IOC f/w different from drivers */ |
| 276 | BFA_IOC_ENABLING = 12, /* IOC is being enabled */ |
| 277 | }; |
| 278 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 279 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 280 | * IOC firmware stats |
| 281 | */ |
| 282 | struct bfa_fw_ioc_stats_s { |
| 283 | u32 enable_reqs; |
| 284 | u32 disable_reqs; |
| 285 | u32 get_attr_reqs; |
| 286 | u32 dbg_sync; |
| 287 | u32 dbg_dump; |
| 288 | u32 unknown_reqs; |
| 289 | }; |
| 290 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 291 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 292 | * IOC driver stats |
| 293 | */ |
| 294 | struct bfa_ioc_drv_stats_s { |
| 295 | u32 ioc_isrs; |
| 296 | u32 ioc_enables; |
| 297 | u32 ioc_disables; |
| 298 | u32 ioc_hbfails; |
| 299 | u32 ioc_boots; |
| 300 | u32 stats_tmos; |
| 301 | u32 hb_count; |
| 302 | u32 disable_reqs; |
| 303 | u32 enable_reqs; |
| 304 | u32 disable_replies; |
| 305 | u32 enable_replies; |
| 306 | }; |
| 307 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 308 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 309 | * IOC statistics |
| 310 | */ |
| 311 | struct bfa_ioc_stats_s { |
| 312 | struct bfa_ioc_drv_stats_s drv_stats; /* driver IOC stats */ |
| 313 | struct bfa_fw_ioc_stats_s fw_stats; /* firmware IOC stats */ |
| 314 | }; |
| 315 | |
| 316 | enum bfa_ioc_type_e { |
| 317 | BFA_IOC_TYPE_FC = 1, |
| 318 | BFA_IOC_TYPE_FCoE = 2, |
| 319 | BFA_IOC_TYPE_LL = 3, |
| 320 | }; |
| 321 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 322 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 323 | * IOC attributes returned in queries |
| 324 | */ |
| 325 | struct bfa_ioc_attr_s { |
| 326 | enum bfa_ioc_type_e ioc_type; |
| 327 | enum bfa_ioc_state state; /* IOC state */ |
| 328 | struct bfa_adapter_attr_s adapter_attr; /* HBA attributes */ |
| 329 | struct bfa_ioc_driver_attr_s driver_attr; /* driver attr */ |
| 330 | struct bfa_ioc_pci_attr_s pci_attr; |
| 331 | u8 port_id; /* port number */ |
Krishna Gudipati | 1a4d8e1 | 2011-06-24 20:22:28 -0700 | [diff] [blame^] | 332 | u8 port_mode; /* bfa_mode_s */ |
| 333 | u8 cap_bm; /* capability */ |
| 334 | u8 port_mode_cfg; /* bfa_mode_s */ |
| 335 | u8 rsvd[4]; /* 64bit align */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 336 | }; |
| 337 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 338 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 339 | * ---------------------- mfg definitions ------------ |
| 340 | */ |
| 341 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 342 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 343 | * Checksum size |
| 344 | */ |
| 345 | #define BFA_MFG_CHKSUM_SIZE 16 |
| 346 | |
| 347 | #define BFA_MFG_PARTNUM_SIZE 14 |
| 348 | #define BFA_MFG_SUPPLIER_ID_SIZE 10 |
| 349 | #define BFA_MFG_SUPPLIER_PARTNUM_SIZE 20 |
| 350 | #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE 20 |
| 351 | #define BFA_MFG_SUPPLIER_REVISION_SIZE 4 |
Krishna Gudipati | 8b070b4 | 2011-06-13 15:52:40 -0700 | [diff] [blame] | 352 | /* |
| 353 | * Initial capability definition |
| 354 | */ |
| 355 | #define BFA_MFG_IC_FC 0x01 |
| 356 | #define BFA_MFG_IC_ETH 0x02 |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 357 | |
Krishna Gudipati | 1a4d8e1 | 2011-06-24 20:22:28 -0700 | [diff] [blame^] | 358 | /* |
| 359 | * Adapter capability mask definition |
| 360 | */ |
| 361 | #define BFA_CM_HBA 0x01 |
| 362 | #define BFA_CM_CNA 0x02 |
| 363 | #define BFA_CM_NIC 0x04 |
| 364 | #define BFA_CM_FC16G 0x08 |
| 365 | #define BFA_CM_SRIOV 0x10 |
| 366 | #define BFA_CM_MEZZ 0x20 |
| 367 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 368 | #pragma pack(1) |
| 369 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 370 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 371 | * All numerical fields are in big-endian format. |
| 372 | */ |
| 373 | struct bfa_mfg_block_s { |
| 374 | u8 version; /* manufacturing block version */ |
| 375 | u8 mfg_sig[3]; /* characters 'M', 'F', 'G' */ |
| 376 | u16 mfgsize; /* mfg block size */ |
| 377 | u16 u16_chksum; /* old u16 checksum */ |
| 378 | char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)]; |
| 379 | char brcd_partnum[STRSZ(BFA_MFG_PARTNUM_SIZE)]; |
| 380 | u8 mfg_day; /* manufacturing day */ |
| 381 | u8 mfg_month; /* manufacturing month */ |
| 382 | u16 mfg_year; /* manufacturing year */ |
| 383 | wwn_t mfg_wwn; /* wwn base for this adapter */ |
| 384 | u8 num_wwn; /* number of wwns assigned */ |
| 385 | u8 mfg_speeds; /* speeds allowed for this adapter */ |
| 386 | u8 rsv[2]; |
| 387 | char supplier_id[STRSZ(BFA_MFG_SUPPLIER_ID_SIZE)]; |
| 388 | char supplier_partnum[STRSZ(BFA_MFG_SUPPLIER_PARTNUM_SIZE)]; |
| 389 | char |
| 390 | supplier_serialnum[STRSZ(BFA_MFG_SUPPLIER_SERIALNUM_SIZE)]; |
| 391 | char |
| 392 | supplier_revision[STRSZ(BFA_MFG_SUPPLIER_REVISION_SIZE)]; |
| 393 | mac_t mfg_mac; /* mac address */ |
| 394 | u8 num_mac; /* number of mac addresses */ |
| 395 | u8 rsv2; |
| 396 | u32 mfg_type; /* card type */ |
| 397 | u8 rsv3[108]; |
| 398 | u8 md5_chksum[BFA_MFG_CHKSUM_SIZE]; /* md5 checksum */ |
| 399 | }; |
| 400 | |
| 401 | #pragma pack() |
| 402 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 403 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 404 | * ---------------------- pci definitions ------------ |
| 405 | */ |
| 406 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 407 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 408 | * PCI device and vendor ID information |
| 409 | */ |
| 410 | enum { |
| 411 | BFA_PCI_VENDOR_ID_BROCADE = 0x1657, |
| 412 | BFA_PCI_DEVICE_ID_FC_8G2P = 0x13, |
| 413 | BFA_PCI_DEVICE_ID_FC_8G1P = 0x17, |
| 414 | BFA_PCI_DEVICE_ID_CT = 0x14, |
| 415 | BFA_PCI_DEVICE_ID_CT_FC = 0x21, |
Krishna Gudipati | 1118920 | 2011-06-13 15:50:35 -0700 | [diff] [blame] | 416 | BFA_PCI_DEVICE_ID_CT2 = 0x22, |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 417 | }; |
| 418 | |
Krishna Gudipati | 1118920 | 2011-06-13 15:50:35 -0700 | [diff] [blame] | 419 | #define bfa_asic_id_cb(__d) \ |
| 420 | ((__d) == BFA_PCI_DEVICE_ID_FC_8G2P || \ |
| 421 | (__d) == BFA_PCI_DEVICE_ID_FC_8G1P) |
| 422 | #define bfa_asic_id_ct(__d) \ |
| 423 | ((__d) == BFA_PCI_DEVICE_ID_CT || \ |
| 424 | (__d) == BFA_PCI_DEVICE_ID_CT_FC) |
| 425 | #define bfa_asic_id_ct2(__d) ((__d) == BFA_PCI_DEVICE_ID_CT2) |
| 426 | #define bfa_asic_id_ctc(__d) \ |
| 427 | (bfa_asic_id_ct(__d) || bfa_asic_id_ct2(__d)) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 428 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 429 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 430 | * PCI sub-system device and vendor ID information |
| 431 | */ |
| 432 | enum { |
| 433 | BFA_PCI_FCOE_SSDEVICE_ID = 0x14, |
Krishna Gudipati | 1a4d8e1 | 2011-06-24 20:22:28 -0700 | [diff] [blame^] | 434 | BFA_PCI_CT2_SSID_FCoE = 0x22, |
| 435 | BFA_PCI_CT2_SSID_ETH = 0x23, |
| 436 | BFA_PCI_CT2_SSID_FC = 0x24, |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 437 | }; |
| 438 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 439 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 440 | * Maximum number of device address ranges mapped through different BAR(s) |
| 441 | */ |
| 442 | #define BFA_PCI_ACCESS_RANGES 1 |
| 443 | |
| 444 | /* |
| 445 | * Port speed settings. Each specific speed is a bit field. Use multiple |
| 446 | * bits to specify speeds to be selected for auto-negotiation. |
| 447 | */ |
| 448 | enum bfa_port_speed { |
| 449 | BFA_PORT_SPEED_UNKNOWN = 0, |
| 450 | BFA_PORT_SPEED_1GBPS = 1, |
| 451 | BFA_PORT_SPEED_2GBPS = 2, |
| 452 | BFA_PORT_SPEED_4GBPS = 4, |
| 453 | BFA_PORT_SPEED_8GBPS = 8, |
| 454 | BFA_PORT_SPEED_10GBPS = 10, |
| 455 | BFA_PORT_SPEED_16GBPS = 16, |
| 456 | BFA_PORT_SPEED_AUTO = |
| 457 | (BFA_PORT_SPEED_1GBPS | BFA_PORT_SPEED_2GBPS | |
Krishna Gudipati | 8b070b4 | 2011-06-13 15:52:40 -0700 | [diff] [blame] | 458 | BFA_PORT_SPEED_4GBPS | BFA_PORT_SPEED_8GBPS | |
| 459 | BFA_PORT_SPEED_16GBPS), |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 460 | }; |
| 461 | #define bfa_port_speed_t enum bfa_port_speed |
| 462 | |
| 463 | enum { |
| 464 | BFA_BOOT_BOOTLUN_MAX = 4, /* maximum boot lun per IOC */ |
| 465 | BFA_PREBOOT_BOOTLUN_MAX = 8, /* maximum preboot lun per IOC */ |
| 466 | }; |
| 467 | |
| 468 | #define BOOT_CFG_REV1 1 |
| 469 | #define BOOT_CFG_VLAN 1 |
| 470 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 471 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 472 | * Boot options setting. Boot options setting determines from where |
| 473 | * to get the boot lun information |
| 474 | */ |
| 475 | enum bfa_boot_bootopt { |
| 476 | BFA_BOOT_AUTO_DISCOVER = 0, /* Boot from blun provided by fabric */ |
| 477 | BFA_BOOT_STORED_BLUN = 1, /* Boot from bluns stored in flash */ |
| 478 | BFA_BOOT_FIRST_LUN = 2, /* Boot from first discovered blun */ |
| 479 | BFA_BOOT_PBC = 3, /* Boot from pbc configured blun */ |
| 480 | }; |
| 481 | |
| 482 | #pragma pack(1) |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 483 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 484 | * Boot lun information. |
| 485 | */ |
| 486 | struct bfa_boot_bootlun_s { |
Maggie Zhang | f314878 | 2010-12-09 19:11:39 -0800 | [diff] [blame] | 487 | wwn_t pwwn; /* port wwn of target */ |
| 488 | struct scsi_lun lun; /* 64-bit lun */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 489 | }; |
| 490 | #pragma pack() |
| 491 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 492 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 493 | * BOOT boot configuraton |
| 494 | */ |
| 495 | struct bfa_boot_pbc_s { |
| 496 | u8 enable; /* enable/disable SAN boot */ |
| 497 | u8 speed; /* boot speed settings */ |
| 498 | u8 topology; /* boot topology setting */ |
| 499 | u8 rsvd1; |
| 500 | u32 nbluns; /* number of boot luns */ |
| 501 | struct bfa_boot_bootlun_s pblun[BFA_PREBOOT_BOOTLUN_MAX]; |
| 502 | }; |
| 503 | |
Krishna Gudipati | 1a4d8e1 | 2011-06-24 20:22:28 -0700 | [diff] [blame^] | 504 | /* |
| 505 | * ASIC block configuration related structures |
| 506 | */ |
| 507 | #define BFA_ABLK_MAX_PORTS 2 |
| 508 | #define BFA_ABLK_MAX_PFS 16 |
| 509 | #define BFA_ABLK_MAX 2 |
| 510 | |
| 511 | #pragma pack(1) |
| 512 | enum bfa_mode_s { |
| 513 | BFA_MODE_HBA = 1, |
| 514 | BFA_MODE_CNA = 2, |
| 515 | BFA_MODE_NIC = 3 |
| 516 | }; |
| 517 | |
| 518 | struct bfa_adapter_cfg_mode_s { |
| 519 | u16 max_pf; |
| 520 | u16 max_vf; |
| 521 | enum bfa_mode_s mode; |
| 522 | }; |
| 523 | |
| 524 | struct bfa_ablk_cfg_pf_s { |
| 525 | u16 pers; |
| 526 | u8 port_id; |
| 527 | u8 optrom; |
| 528 | u8 valid; |
| 529 | u8 sriov; |
| 530 | u8 max_vfs; |
| 531 | u8 rsvd[1]; |
| 532 | u16 num_qpairs; |
| 533 | u16 num_vectors; |
| 534 | u32 bw; |
| 535 | }; |
| 536 | |
| 537 | struct bfa_ablk_cfg_port_s { |
| 538 | u8 mode; |
| 539 | u8 type; |
| 540 | u8 max_pfs; |
| 541 | u8 rsvd[5]; |
| 542 | }; |
| 543 | |
| 544 | struct bfa_ablk_cfg_inst_s { |
| 545 | u8 nports; |
| 546 | u8 max_pfs; |
| 547 | u8 rsvd[6]; |
| 548 | struct bfa_ablk_cfg_pf_s pf_cfg[BFA_ABLK_MAX_PFS]; |
| 549 | struct bfa_ablk_cfg_port_s port_cfg[BFA_ABLK_MAX_PORTS]; |
| 550 | }; |
| 551 | |
| 552 | struct bfa_ablk_cfg_s { |
| 553 | struct bfa_ablk_cfg_inst_s inst[BFA_ABLK_MAX]; |
| 554 | }; |
| 555 | #pragma pack() |
| 556 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 557 | #endif /* __BFA_DEFS_H__ */ |