ARM: 7409/1: Do not call flush_cache_user_range with mmap_sem held
[linux/fpc-iii.git] / drivers / net / bna / bfa_defs_mfg_comm.h
blobfdd6776183615477a83e9a685e1f66becf166613
1 /*
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.
15 * All rights reserved
16 * www.brocade.com
18 #ifndef __BFA_DEFS_MFG_COMM_H__
19 #define __BFA_DEFS_MFG_COMM_H__
21 #include "cna.h"
23 /**
24 * Manufacturing block version
26 #define BFA_MFG_VERSION 2
27 #define BFA_MFG_VERSION_UNINIT 0xFF
29 /**
30 * Manufacturing block encrypted version
32 #define BFA_MFG_ENC_VER 2
34 /**
35 * Manufacturing block version 1 length
37 #define BFA_MFG_VER1_LEN 128
39 /**
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)
47 /**
48 * Manufacturing card type
50 enum {
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 */
66 #pragma pack(1)
68 /**
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))
76 /**
77 * Check if Mezz card
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))
86 /**
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) \
99 do { \
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); \
106 break; \
107 case BFA_MFG_TYPE_FC8P1: \
108 (prop) = BFI_ADAPTER_SETP(NPORTS, 1) | \
109 BFI_ADAPTER_SETP(SPEED, 8); \
110 break; \
111 case BFA_MFG_TYPE_FC4P2: \
112 (prop) = BFI_ADAPTER_SETP(NPORTS, 2) | \
113 BFI_ADAPTER_SETP(SPEED, 4); \
114 break; \
115 case BFA_MFG_TYPE_FC4P1: \
116 (prop) = BFI_ADAPTER_SETP(NPORTS, 1) | \
117 BFI_ADAPTER_SETP(SPEED, 4); \
118 break; \
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); \
125 break; \
126 case BFA_MFG_TYPE_CNA10P1: \
127 (prop) = BFI_ADAPTER_SETP(NPORTS, 1); \
128 (prop) |= BFI_ADAPTER_SETP(SPEED, 10); \
129 break; \
130 default: \
131 (prop) = BFI_ADAPTER_UNSUPP; \
133 } while (0)
135 enum {
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) \
146 do { \
147 if ((gpio) & CB_GPIO_PROTO) { \
148 (prop) |= BFI_ADAPTER_PROTO; \
149 (gpio) &= ~CB_GPIO_PROTO; \
151 switch ((gpio)) { \
152 case CB_GPIO_TTV: \
153 (prop) |= BFI_ADAPTER_TTV; \
154 case CB_GPIO_DFLY: \
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; \
159 break; \
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; \
164 break; \
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; \
169 break; \
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; \
174 break; \
175 default: \
176 (prop) |= BFI_ADAPTER_UNSUPP; \
177 (card_type) = BFA_MFG_TYPE_INVALID; \
179 } while (0)
182 * VPD data length
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 */
192 * VPD vendor tag
194 enum {
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.
210 struct bfa_mfg_vpd {
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 */
216 u8 rsv;
217 u8 data[BFA_MFG_VPD_LEN]; /*!< vpd data */
220 #pragma pack()
222 #endif /* __BFA_DEFS_MFG_H__ */