2 * Linux network driver for Brocade Converged Network Adapter.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License (GPL) Version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
14 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
18 #ifndef __BFA_DEFS_MFG_COMM_H__
19 #define __BFA_DEFS_MFG_COMM_H__
24 * Manufacturing block version
26 #define BFA_MFG_VERSION 2
27 #define BFA_MFG_VERSION_UNINIT 0xFF
30 * Manufacturing block encrypted version
32 #define BFA_MFG_ENC_VER 2
35 * Manufacturing block version 1 length
37 #define BFA_MFG_VER1_LEN 128
40 * Manufacturing block header length
42 #define BFA_MFG_HDR_LEN 4
44 #define BFA_MFG_SERIALNUM_SIZE 11
45 #define STRSZ(_n) (((_n) + 4) & ~3)
48 * Manufacturing card type
51 BFA_MFG_TYPE_CB_MAX
= 825, /*!< Crossbow card type max */
52 BFA_MFG_TYPE_FC8P2
= 825, /*!< 8G 2port FC card */
53 BFA_MFG_TYPE_FC8P1
= 815, /*!< 8G 1port FC card */
54 BFA_MFG_TYPE_FC4P2
= 425, /*!< 4G 2port FC card */
55 BFA_MFG_TYPE_FC4P1
= 415, /*!< 4G 1port FC card */
56 BFA_MFG_TYPE_CNA10P2
= 1020, /*!< 10G 2port CNA card */
57 BFA_MFG_TYPE_CNA10P1
= 1010, /*!< 10G 1port CNA card */
58 BFA_MFG_TYPE_JAYHAWK
= 804, /*!< Jayhawk mezz card */
59 BFA_MFG_TYPE_WANCHESE
= 1007, /*!< Wanchese mezz card */
60 BFA_MFG_TYPE_ASTRA
= 807, /*!< Astra mezz card */
61 BFA_MFG_TYPE_LIGHTNING_P0
= 902, /*!< Lightning mezz card - old */
62 BFA_MFG_TYPE_LIGHTNING
= 1741, /*!< Lightning mezz card */
63 BFA_MFG_TYPE_INVALID
= 0, /*!< Invalid card type */
69 * Check if 1-port card
71 #define bfa_mfg_is_1port(type) (( \
72 (type) == BFA_MFG_TYPE_FC8P1 || \
73 (type) == BFA_MFG_TYPE_FC4P1 || \
74 (type) == BFA_MFG_TYPE_CNA10P1))
79 #define bfa_mfg_is_mezz(type) (( \
80 (type) == BFA_MFG_TYPE_JAYHAWK || \
81 (type) == BFA_MFG_TYPE_WANCHESE || \
82 (type) == BFA_MFG_TYPE_ASTRA || \
83 (type) == BFA_MFG_TYPE_LIGHTNING_P0 || \
84 (type) == BFA_MFG_TYPE_LIGHTNING))
87 * Check if card type valid
89 #define bfa_mfg_is_card_type_valid(type) (( \
90 (type) == BFA_MFG_TYPE_FC8P2 || \
91 (type) == BFA_MFG_TYPE_FC8P1 || \
92 (type) == BFA_MFG_TYPE_FC4P2 || \
93 (type) == BFA_MFG_TYPE_FC4P1 || \
94 (type) == BFA_MFG_TYPE_CNA10P2 || \
95 (type) == BFA_MFG_TYPE_CNA10P1 || \
96 bfa_mfg_is_mezz(type)))
98 #define bfa_mfg_adapter_prop_init_flash(card_type, prop) \
100 switch ((card_type)) { \
101 case BFA_MFG_TYPE_FC8P2: \
102 case BFA_MFG_TYPE_JAYHAWK: \
103 case BFA_MFG_TYPE_ASTRA: \
104 (prop) = BFI_ADAPTER_SETP(NPORTS, 2) | \
105 BFI_ADAPTER_SETP(SPEED, 8); \
107 case BFA_MFG_TYPE_FC8P1: \
108 (prop) = BFI_ADAPTER_SETP(NPORTS, 1) | \
109 BFI_ADAPTER_SETP(SPEED, 8); \
111 case BFA_MFG_TYPE_FC4P2: \
112 (prop) = BFI_ADAPTER_SETP(NPORTS, 2) | \
113 BFI_ADAPTER_SETP(SPEED, 4); \
115 case BFA_MFG_TYPE_FC4P1: \
116 (prop) = BFI_ADAPTER_SETP(NPORTS, 1) | \
117 BFI_ADAPTER_SETP(SPEED, 4); \
119 case BFA_MFG_TYPE_CNA10P2: \
120 case BFA_MFG_TYPE_WANCHESE: \
121 case BFA_MFG_TYPE_LIGHTNING_P0: \
122 case BFA_MFG_TYPE_LIGHTNING: \
123 (prop) = BFI_ADAPTER_SETP(NPORTS, 2); \
124 (prop) |= BFI_ADAPTER_SETP(SPEED, 10); \
126 case BFA_MFG_TYPE_CNA10P1: \
127 (prop) = BFI_ADAPTER_SETP(NPORTS, 1); \
128 (prop) |= BFI_ADAPTER_SETP(SPEED, 10); \
131 (prop) = BFI_ADAPTER_UNSUPP; \
136 CB_GPIO_TTV
= (1), /*!< TTV debug capable cards */
137 CB_GPIO_FC8P2
= (2), /*!< 8G 2port FC card */
138 CB_GPIO_FC8P1
= (3), /*!< 8G 1port FC card */
139 CB_GPIO_FC4P2
= (4), /*!< 4G 2port FC card */
140 CB_GPIO_FC4P1
= (5), /*!< 4G 1port FC card */
141 CB_GPIO_DFLY
= (6), /*!< 8G 2port FC mezzanine card */
142 CB_GPIO_PROTO
= (1 << 7) /*!< 8G 2port FC prototypes */
145 #define bfa_mfg_adapter_prop_init_gpio(gpio, card_type, prop) \
147 if ((gpio) & CB_GPIO_PROTO) { \
148 (prop) |= BFI_ADAPTER_PROTO; \
149 (gpio) &= ~CB_GPIO_PROTO; \
153 (prop) |= BFI_ADAPTER_TTV; \
155 case CB_GPIO_FC8P2: \
156 (prop) |= BFI_ADAPTER_SETP(NPORTS, 2); \
157 (prop) |= BFI_ADAPTER_SETP(SPEED, 8); \
158 (card_type) = BFA_MFG_TYPE_FC8P2; \
160 case CB_GPIO_FC8P1: \
161 (prop) |= BFI_ADAPTER_SETP(NPORTS, 1); \
162 (prop) |= BFI_ADAPTER_SETP(SPEED, 8); \
163 (card_type) = BFA_MFG_TYPE_FC8P1; \
165 case CB_GPIO_FC4P2: \
166 (prop) |= BFI_ADAPTER_SETP(NPORTS, 2); \
167 (prop) |= BFI_ADAPTER_SETP(SPEED, 4); \
168 (card_type) = BFA_MFG_TYPE_FC4P2; \
170 case CB_GPIO_FC4P1: \
171 (prop) |= BFI_ADAPTER_SETP(NPORTS, 1); \
172 (prop) |= BFI_ADAPTER_SETP(SPEED, 4); \
173 (card_type) = BFA_MFG_TYPE_FC4P1; \
176 (prop) |= BFI_ADAPTER_UNSUPP; \
177 (card_type) = BFA_MFG_TYPE_INVALID; \
184 #define BFA_MFG_VPD_LEN 512
185 #define BFA_MFG_VPD_LEN_INVALID 0
187 #define BFA_MFG_VPD_PCI_HDR_OFF 137
188 #define BFA_MFG_VPD_PCI_VER_MASK 0x07 /*!< version mask 3 bits */
189 #define BFA_MFG_VPD_PCI_VDR_MASK 0xf8 /*!< vendor mask 5 bits */
195 BFA_MFG_VPD_UNKNOWN
= 0, /*!< vendor unknown */
196 BFA_MFG_VPD_IBM
= 1, /*!< vendor IBM */
197 BFA_MFG_VPD_HP
= 2, /*!< vendor HP */
198 BFA_MFG_VPD_DELL
= 3, /*!< vendor DELL */
199 BFA_MFG_VPD_PCI_IBM
= 0x08, /*!< PCI VPD IBM */
200 BFA_MFG_VPD_PCI_HP
= 0x10, /*!< PCI VPD HP */
201 BFA_MFG_VPD_PCI_DELL
= 0x20, /*!< PCI VPD DELL */
202 BFA_MFG_VPD_PCI_BRCD
= 0xf8, /*!< PCI VPD Brocade */
206 * @brief BFA adapter flash vpd data definition.
208 * All numerical fields are in big-endian format.
211 u8 version
; /*!< vpd data version */
212 u8 vpd_sig
[3]; /*!< characters 'V', 'P', 'D' */
213 u8 chksum
; /*!< u8 checksum */
214 u8 vendor
; /*!< vendor */
215 u8 len
; /*!< vpd data length excluding header */
217 u8 data
[BFA_MFG_VPD_LEN
]; /*!< vpd data */
222 #endif /* __BFA_DEFS_MFG_H__ */