2 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
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
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.
18 #ifndef __BFA_DEFS_H__
19 #define __BFA_DEFS_H__
24 #define BFA_MFG_SERIALNUM_SIZE 11
25 #define STRSZ(_n) (((_n) + 4) & ~3)
28 * Manufacturing card type
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 */
43 BFA_MFG_TYPE_INVALID
= 0, /* Invalid card type */
51 #define bfa_mfg_is_mezz(type) (( \
52 (type) == BFA_MFG_TYPE_JAYHAWK || \
53 (type) == BFA_MFG_TYPE_WANCHESE || \
54 (type) == BFA_MFG_TYPE_ASTRA || \
55 (type) == BFA_MFG_TYPE_LIGHTNING_P0 || \
56 (type) == BFA_MFG_TYPE_LIGHTNING))
59 * Check if the card having old wwn/mac handling
61 #define bfa_mfg_is_old_wwn_mac_model(type) (( \
62 (type) == BFA_MFG_TYPE_FC8P2 || \
63 (type) == BFA_MFG_TYPE_FC8P1 || \
64 (type) == BFA_MFG_TYPE_FC4P2 || \
65 (type) == BFA_MFG_TYPE_FC4P1 || \
66 (type) == BFA_MFG_TYPE_CNA10P2 || \
67 (type) == BFA_MFG_TYPE_CNA10P1 || \
68 (type) == BFA_MFG_TYPE_JAYHAWK || \
69 (type) == BFA_MFG_TYPE_WANCHESE))
71 #define bfa_mfg_increment_wwn_mac(m, i) \
73 u32 t = ((u32)(m)[0] << 16) | ((u32)(m)[1] << 8) | \
76 (m)[0] = (t >> 16) & 0xFF; \
77 (m)[1] = (t >> 8) & 0xFF; \
84 #define BFA_MFG_VPD_LEN 512
90 BFA_MFG_VPD_UNKNOWN
= 0, /* vendor unknown */
91 BFA_MFG_VPD_IBM
= 1, /* vendor IBM */
92 BFA_MFG_VPD_HP
= 2, /* vendor HP */
93 BFA_MFG_VPD_DELL
= 3, /* vendor DELL */
94 BFA_MFG_VPD_PCI_IBM
= 0x08, /* PCI VPD IBM */
95 BFA_MFG_VPD_PCI_HP
= 0x10, /* PCI VPD HP */
96 BFA_MFG_VPD_PCI_DELL
= 0x20, /* PCI VPD DELL */
97 BFA_MFG_VPD_PCI_BRCD
= 0xf8, /* PCI VPD Brocade */
101 * All numerical fields are in big-endian format.
103 struct bfa_mfg_vpd_s
{
104 u8 version
; /* vpd data version */
105 u8 vpd_sig
[3]; /* characters 'V', 'P', 'D' */
106 u8 chksum
; /* u8 checksum */
107 u8 vendor
; /* vendor */
108 u8 len
; /* vpd data length excluding header */
110 u8 data
[BFA_MFG_VPD_LEN
]; /* vpd data */
116 * Status return values
119 BFA_STATUS_OK
= 0, /* Success */
120 BFA_STATUS_FAILED
= 1, /* Operation failed */
121 BFA_STATUS_EINVAL
= 2, /* Invalid params Check input
123 BFA_STATUS_ENOMEM
= 3, /* Out of resources */
124 BFA_STATUS_ETIMER
= 5, /* Timer expired - Retry, if persists,
126 BFA_STATUS_EPROTOCOL
= 6, /* Protocol error */
127 BFA_STATUS_DEVBUSY
= 13, /* Device busy - Retry operation */
128 BFA_STATUS_UNKNOWN_LWWN
= 18, /* LPORT PWWN not found */
129 BFA_STATUS_UNKNOWN_RWWN
= 19, /* RPORT PWWN not found */
130 BFA_STATUS_VPORT_EXISTS
= 21, /* VPORT already exists */
131 BFA_STATUS_VPORT_MAX
= 22, /* Reached max VPORT supported limit */
132 BFA_STATUS_UNSUPP_SPEED
= 23, /* Invalid Speed Check speed setting */
133 BFA_STATUS_INVLD_DFSZ
= 24, /* Invalid Max data field size */
134 BFA_STATUS_FABRIC_RJT
= 29, /* Reject from attached fabric */
135 BFA_STATUS_VPORT_WWN_BP
= 46, /* WWN is same as base port's WWN */
136 BFA_STATUS_NO_FCPIM_NEXUS
= 52, /* No FCP Nexus exists with the rport */
137 BFA_STATUS_IOC_FAILURE
= 56, /* IOC failure - Retry, if persists
139 BFA_STATUS_INVALID_WWN
= 57, /* Invalid WWN */
140 BFA_STATUS_DIAG_BUSY
= 71, /* diag busy */
141 BFA_STATUS_ENOFSAVE
= 78, /* No saved firmware trace */
142 BFA_STATUS_IOC_DISABLED
= 82, /* IOC is already disabled */
143 BFA_STATUS_INVALID_MAC
= 134, /* Invalid MAC address */
144 BFA_STATUS_PBC
= 154, /* Operation not allowed for pre-boot
146 BFA_STATUS_TRUNK_ENABLED
= 164, /* Trunk is already enabled on
148 BFA_STATUS_TRUNK_DISABLED
= 165, /* Trunking is disabled on
150 BFA_STATUS_IOPROFILE_OFF
= 175, /* IO profile OFF */
151 BFA_STATUS_MAX_VAL
/* Unknown error code */
153 #define bfa_status_t enum bfa_status
155 enum bfa_eproto_status
{
156 BFA_EPROTO_BAD_ACCEPT
= 0,
157 BFA_EPROTO_UNKNOWN_RSP
= 1
159 #define bfa_eproto_status_t enum bfa_eproto_status
165 #define bfa_boolean_t enum bfa_boolean
167 #define BFA_STRING_32 32
168 #define BFA_VERSION_LEN 64
171 * ---------------------- adapter definitions ------------
175 * BFA adapter level attributes.
178 BFA_ADAPTER_SERIAL_NUM_LEN
= STRSZ(BFA_MFG_SERIALNUM_SIZE
),
180 *!< adapter serial num length
182 BFA_ADAPTER_MODEL_NAME_LEN
= 16, /* model name length */
183 BFA_ADAPTER_MODEL_DESCR_LEN
= 128, /* model description length */
184 BFA_ADAPTER_MFG_NAME_LEN
= 8, /* manufacturer name length */
185 BFA_ADAPTER_SYM_NAME_LEN
= 64, /* adapter symbolic name length */
186 BFA_ADAPTER_OS_TYPE_LEN
= 64, /* adapter os type length */
189 struct bfa_adapter_attr_s
{
190 char manufacturer
[BFA_ADAPTER_MFG_NAME_LEN
];
191 char serial_num
[BFA_ADAPTER_SERIAL_NUM_LEN
];
193 char model
[BFA_ADAPTER_MODEL_NAME_LEN
];
194 char model_descr
[BFA_ADAPTER_MODEL_DESCR_LEN
];
196 char node_symname
[FC_SYMNAME_MAX
];
197 char hw_ver
[BFA_VERSION_LEN
];
198 char fw_ver
[BFA_VERSION_LEN
];
199 char optrom_ver
[BFA_VERSION_LEN
];
200 char os_type
[BFA_ADAPTER_OS_TYPE_LEN
];
201 struct bfa_mfg_vpd_s vpd
;
219 * ---------------------- IOC definitions ------------
223 BFA_IOC_DRIVER_LEN
= 16,
224 BFA_IOC_CHIP_REV_LEN
= 8,
228 * Driver and firmware versions.
230 struct bfa_ioc_driver_attr_s
{
231 char driver
[BFA_IOC_DRIVER_LEN
]; /* driver name */
232 char driver_ver
[BFA_VERSION_LEN
]; /* driver version */
233 char fw_ver
[BFA_VERSION_LEN
]; /* firmware version */
234 char bios_ver
[BFA_VERSION_LEN
]; /* bios version */
235 char efi_ver
[BFA_VERSION_LEN
]; /* EFI version */
236 char ob_ver
[BFA_VERSION_LEN
]; /* openboot version */
240 * IOC PCI device attributes
242 struct bfa_ioc_pci_attr_s
{
243 u16 vendor_id
; /* PCI vendor ID */
244 u16 device_id
; /* PCI device ID */
245 u16 ssid
; /* subsystem ID */
246 u16 ssvid
; /* subsystem vendor ID */
247 u32 pcifn
; /* PCI device function */
248 u32 rsvd
; /* padding */
249 char chip_rev
[BFA_IOC_CHIP_REV_LEN
]; /* chip revision */
256 BFA_IOC_UNINIT
= 1, /* IOC is in uninit state */
257 BFA_IOC_RESET
= 2, /* IOC is in reset state */
258 BFA_IOC_SEMWAIT
= 3, /* Waiting for IOC h/w semaphore */
259 BFA_IOC_HWINIT
= 4, /* IOC h/w is being initialized */
260 BFA_IOC_GETATTR
= 5, /* IOC is being configured */
261 BFA_IOC_OPERATIONAL
= 6, /* IOC is operational */
262 BFA_IOC_INITFAIL
= 7, /* IOC hardware failure */
263 BFA_IOC_FAIL
= 8, /* IOC heart-beat failure */
264 BFA_IOC_DISABLING
= 9, /* IOC is being disabled */
265 BFA_IOC_DISABLED
= 10, /* IOC is disabled */
266 BFA_IOC_FWMISMATCH
= 11, /* IOC f/w different from drivers */
267 BFA_IOC_ENABLING
= 12, /* IOC is being enabled */
273 struct bfa_fw_ioc_stats_s
{
285 struct bfa_ioc_drv_stats_s
{
302 struct bfa_ioc_stats_s
{
303 struct bfa_ioc_drv_stats_s drv_stats
; /* driver IOC stats */
304 struct bfa_fw_ioc_stats_s fw_stats
; /* firmware IOC stats */
307 enum bfa_ioc_type_e
{
309 BFA_IOC_TYPE_FCoE
= 2,
314 * IOC attributes returned in queries
316 struct bfa_ioc_attr_s
{
317 enum bfa_ioc_type_e ioc_type
;
318 enum bfa_ioc_state state
; /* IOC state */
319 struct bfa_adapter_attr_s adapter_attr
; /* HBA attributes */
320 struct bfa_ioc_driver_attr_s driver_attr
; /* driver attr */
321 struct bfa_ioc_pci_attr_s pci_attr
;
322 u8 port_id
; /* port number */
323 u8 rsvd
[7]; /* 64bit align */
327 * ---------------------- mfg definitions ------------
333 #define BFA_MFG_CHKSUM_SIZE 16
335 #define BFA_MFG_PARTNUM_SIZE 14
336 #define BFA_MFG_SUPPLIER_ID_SIZE 10
337 #define BFA_MFG_SUPPLIER_PARTNUM_SIZE 20
338 #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE 20
339 #define BFA_MFG_SUPPLIER_REVISION_SIZE 4
344 * All numerical fields are in big-endian format.
346 struct bfa_mfg_block_s
{
347 u8 version
; /* manufacturing block version */
348 u8 mfg_sig
[3]; /* characters 'M', 'F', 'G' */
349 u16 mfgsize
; /* mfg block size */
350 u16 u16_chksum
; /* old u16 checksum */
351 char brcd_serialnum
[STRSZ(BFA_MFG_SERIALNUM_SIZE
)];
352 char brcd_partnum
[STRSZ(BFA_MFG_PARTNUM_SIZE
)];
353 u8 mfg_day
; /* manufacturing day */
354 u8 mfg_month
; /* manufacturing month */
355 u16 mfg_year
; /* manufacturing year */
356 wwn_t mfg_wwn
; /* wwn base for this adapter */
357 u8 num_wwn
; /* number of wwns assigned */
358 u8 mfg_speeds
; /* speeds allowed for this adapter */
360 char supplier_id
[STRSZ(BFA_MFG_SUPPLIER_ID_SIZE
)];
361 char supplier_partnum
[STRSZ(BFA_MFG_SUPPLIER_PARTNUM_SIZE
)];
363 supplier_serialnum
[STRSZ(BFA_MFG_SUPPLIER_SERIALNUM_SIZE
)];
365 supplier_revision
[STRSZ(BFA_MFG_SUPPLIER_REVISION_SIZE
)];
366 mac_t mfg_mac
; /* mac address */
367 u8 num_mac
; /* number of mac addresses */
369 u32 mfg_type
; /* card type */
371 u8 md5_chksum
[BFA_MFG_CHKSUM_SIZE
]; /* md5 checksum */
377 * ---------------------- pci definitions ------------
381 * PCI device and vendor ID information
384 BFA_PCI_VENDOR_ID_BROCADE
= 0x1657,
385 BFA_PCI_DEVICE_ID_FC_8G2P
= 0x13,
386 BFA_PCI_DEVICE_ID_FC_8G1P
= 0x17,
387 BFA_PCI_DEVICE_ID_CT
= 0x14,
388 BFA_PCI_DEVICE_ID_CT_FC
= 0x21,
391 #define bfa_asic_id_ct(devid) \
392 ((devid) == BFA_PCI_DEVICE_ID_CT || \
393 (devid) == BFA_PCI_DEVICE_ID_CT_FC)
396 * PCI sub-system device and vendor ID information
399 BFA_PCI_FCOE_SSDEVICE_ID
= 0x14,
403 * Maximum number of device address ranges mapped through different BAR(s)
405 #define BFA_PCI_ACCESS_RANGES 1
408 * Port speed settings. Each specific speed is a bit field. Use multiple
409 * bits to specify speeds to be selected for auto-negotiation.
411 enum bfa_port_speed
{
412 BFA_PORT_SPEED_UNKNOWN
= 0,
413 BFA_PORT_SPEED_1GBPS
= 1,
414 BFA_PORT_SPEED_2GBPS
= 2,
415 BFA_PORT_SPEED_4GBPS
= 4,
416 BFA_PORT_SPEED_8GBPS
= 8,
417 BFA_PORT_SPEED_10GBPS
= 10,
418 BFA_PORT_SPEED_16GBPS
= 16,
419 BFA_PORT_SPEED_AUTO
=
420 (BFA_PORT_SPEED_1GBPS
| BFA_PORT_SPEED_2GBPS
|
421 BFA_PORT_SPEED_4GBPS
| BFA_PORT_SPEED_8GBPS
),
423 #define bfa_port_speed_t enum bfa_port_speed
426 BFA_BOOT_BOOTLUN_MAX
= 4, /* maximum boot lun per IOC */
427 BFA_PREBOOT_BOOTLUN_MAX
= 8, /* maximum preboot lun per IOC */
430 #define BOOT_CFG_REV1 1
431 #define BOOT_CFG_VLAN 1
434 * Boot options setting. Boot options setting determines from where
435 * to get the boot lun information
437 enum bfa_boot_bootopt
{
438 BFA_BOOT_AUTO_DISCOVER
= 0, /* Boot from blun provided by fabric */
439 BFA_BOOT_STORED_BLUN
= 1, /* Boot from bluns stored in flash */
440 BFA_BOOT_FIRST_LUN
= 2, /* Boot from first discovered blun */
441 BFA_BOOT_PBC
= 3, /* Boot from pbc configured blun */
446 * Boot lun information.
448 struct bfa_boot_bootlun_s
{
449 wwn_t pwwn
; /* port wwn of target */
450 struct scsi_lun lun
; /* 64-bit lun */
455 * BOOT boot configuraton
457 struct bfa_boot_pbc_s
{
458 u8 enable
; /* enable/disable SAN boot */
459 u8 speed
; /* boot speed settings */
460 u8 topology
; /* boot topology setting */
462 u32 nbluns
; /* number of boot luns */
463 struct bfa_boot_bootlun_s pblun
[BFA_PREBOOT_BOOTLUN_MAX
];
466 #endif /* __BFA_DEFS_H__ */