OMAPDSS: VENC: fix NULL pointer dereference in DSS2 VENC sysfs debug attr on OMAP4
[zen-stable.git] / drivers / net / ethernet / brocade / bna / bfa_defs_mfg_comm.h
blob6681fe87c1e1e1c331978840762878d102d6121f
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 "bfa_defs.h"
23 /**
24 * Manufacturing block version
26 #define BFA_MFG_VERSION 3
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_PROWLER_F = 1560, /*!< Prowler FC only cards */
64 BFA_MFG_TYPE_PROWLER_N = 1410, /*!< Prowler NIC only cards */
65 BFA_MFG_TYPE_PROWLER_C = 1710, /*!< Prowler CNA only cards */
66 BFA_MFG_TYPE_PROWLER_D = 1860, /*!< Prowler Dual cards */
67 BFA_MFG_TYPE_CHINOOK = 1867, /*!< Chinook cards */
68 BFA_MFG_TYPE_INVALID = 0, /*!< Invalid card type */
71 #pragma pack(1)
73 /**
74 * Check if Mezz card
76 #define bfa_mfg_is_mezz(type) (( \
77 (type) == BFA_MFG_TYPE_JAYHAWK || \
78 (type) == BFA_MFG_TYPE_WANCHESE || \
79 (type) == BFA_MFG_TYPE_ASTRA || \
80 (type) == BFA_MFG_TYPE_LIGHTNING_P0 || \
81 (type) == BFA_MFG_TYPE_LIGHTNING || \
82 (type) == BFA_MFG_TYPE_CHINOOK))
84 enum {
85 CB_GPIO_TTV = (1), /*!< TTV debug capable cards */
86 CB_GPIO_FC8P2 = (2), /*!< 8G 2port FC card */
87 CB_GPIO_FC8P1 = (3), /*!< 8G 1port FC card */
88 CB_GPIO_FC4P2 = (4), /*!< 4G 2port FC card */
89 CB_GPIO_FC4P1 = (5), /*!< 4G 1port FC card */
90 CB_GPIO_DFLY = (6), /*!< 8G 2port FC mezzanine card */
91 CB_GPIO_PROTO = (1 << 7) /*!< 8G 2port FC prototypes */
94 #define bfa_mfg_adapter_prop_init_gpio(gpio, card_type, prop) \
95 do { \
96 if ((gpio) & CB_GPIO_PROTO) { \
97 (prop) |= BFI_ADAPTER_PROTO; \
98 (gpio) &= ~CB_GPIO_PROTO; \
99 } \
100 switch ((gpio)) { \
101 case CB_GPIO_TTV: \
102 (prop) |= BFI_ADAPTER_TTV; \
103 case CB_GPIO_DFLY: \
104 case CB_GPIO_FC8P2: \
105 (prop) |= BFI_ADAPTER_SETP(NPORTS, 2); \
106 (prop) |= BFI_ADAPTER_SETP(SPEED, 8); \
107 (card_type) = BFA_MFG_TYPE_FC8P2; \
108 break; \
109 case CB_GPIO_FC8P1: \
110 (prop) |= BFI_ADAPTER_SETP(NPORTS, 1); \
111 (prop) |= BFI_ADAPTER_SETP(SPEED, 8); \
112 (card_type) = BFA_MFG_TYPE_FC8P1; \
113 break; \
114 case CB_GPIO_FC4P2: \
115 (prop) |= BFI_ADAPTER_SETP(NPORTS, 2); \
116 (prop) |= BFI_ADAPTER_SETP(SPEED, 4); \
117 (card_type) = BFA_MFG_TYPE_FC4P2; \
118 break; \
119 case CB_GPIO_FC4P1: \
120 (prop) |= BFI_ADAPTER_SETP(NPORTS, 1); \
121 (prop) |= BFI_ADAPTER_SETP(SPEED, 4); \
122 (card_type) = BFA_MFG_TYPE_FC4P1; \
123 break; \
124 default: \
125 (prop) |= BFI_ADAPTER_UNSUPP; \
126 (card_type) = BFA_MFG_TYPE_INVALID; \
128 } while (0)
131 * VPD data length
133 #define BFA_MFG_VPD_LEN 512
134 #define BFA_MFG_VPD_LEN_INVALID 0
136 #define BFA_MFG_VPD_PCI_HDR_OFF 137
137 #define BFA_MFG_VPD_PCI_VER_MASK 0x07 /*!< version mask 3 bits */
138 #define BFA_MFG_VPD_PCI_VDR_MASK 0xf8 /*!< vendor mask 5 bits */
141 * VPD vendor tag
143 enum {
144 BFA_MFG_VPD_UNKNOWN = 0, /*!< vendor unknown */
145 BFA_MFG_VPD_IBM = 1, /*!< vendor IBM */
146 BFA_MFG_VPD_HP = 2, /*!< vendor HP */
147 BFA_MFG_VPD_DELL = 3, /*!< vendor DELL */
148 BFA_MFG_VPD_PCI_IBM = 0x08, /*!< PCI VPD IBM */
149 BFA_MFG_VPD_PCI_HP = 0x10, /*!< PCI VPD HP */
150 BFA_MFG_VPD_PCI_DELL = 0x20, /*!< PCI VPD DELL */
151 BFA_MFG_VPD_PCI_BRCD = 0xf8, /*!< PCI VPD Brocade */
155 * @brief BFA adapter flash vpd data definition.
157 * All numerical fields are in big-endian format.
159 struct bfa_mfg_vpd {
160 u8 version; /*!< vpd data version */
161 u8 vpd_sig[3]; /*!< characters 'V', 'P', 'D' */
162 u8 chksum; /*!< u8 checksum */
163 u8 vendor; /*!< vendor */
164 u8 len; /*!< vpd data length excluding header */
165 u8 rsv;
166 u8 data[BFA_MFG_VPD_LEN]; /*!< vpd data */
169 #pragma pack()
171 #endif /* __BFA_DEFS_MFG_H__ */