xref: /linux/drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h (revision ab93e0dd72c37d378dd936f031ffb83ff2bd87ce)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2024 Intel Corporation. */
3 
4 #ifndef _IXGBE_TYPE_E610_H_
5 #define _IXGBE_TYPE_E610_H_
6 
7 #include <linux/net/intel/libie/adminq.h>
8 
9 #define BYTES_PER_DWORD	4
10 
11 /* General E610 defines */
12 #define IXGBE_MAX_VSI			768
13 
14 /* Checksum and Shadow RAM pointers */
15 #define IXGBE_E610_SR_NVM_CTRL_WORD		0x00
16 #define IXGBE_E610_SR_PBA_BLOCK_PTR		0x16
17 #define IXGBE_E610_SR_PBA_BLOCK_MASK		GENMASK(15, 8)
18 #define IXGBE_E610_SR_NVM_DEV_STARTER_VER	0x18
19 #define IXGBE_E610_SR_NVM_EETRACK_LO		0x2D
20 #define IXGBE_E610_SR_NVM_EETRACK_HI		0x2E
21 #define IXGBE_E610_NVM_VER_LO_MASK		GENMASK(7, 0)
22 #define IXGBE_E610_NVM_VER_HI_MASK		GENMASK(15, 12)
23 #define IXGBE_E610_SR_SW_CHECKSUM_WORD		0x3F
24 #define IXGBE_E610_SR_PFA_PTR			0x40
25 #define IXGBE_E610_SR_1ST_NVM_BANK_PTR		0x42
26 #define IXGBE_E610_SR_NVM_BANK_SIZE		0x43
27 #define IXGBE_E610_SR_1ST_OROM_BANK_PTR		0x44
28 #define IXGBE_E610_SR_OROM_BANK_SIZE		0x45
29 #define IXGBE_E610_SR_NETLIST_BANK_PTR		0x46
30 #define IXGBE_E610_SR_NETLIST_BANK_SIZE		0x47
31 
32 /* The OROM version topology */
33 #define IXGBE_OROM_VER_PATCH_MASK		GENMASK_ULL(7, 0)
34 #define IXGBE_OROM_VER_BUILD_MASK		GENMASK_ULL(23, 8)
35 #define IXGBE_OROM_VER_MASK			GENMASK_ULL(31, 24)
36 
37 /* CSS Header words */
38 #define IXGBE_NVM_CSS_HDR_LEN_L			0x02
39 #define IXGBE_NVM_CSS_HDR_LEN_H			0x03
40 #define IXGBE_NVM_CSS_SREV_L			0x14
41 #define IXGBE_NVM_CSS_SREV_H			0x15
42 
43 #define IXGBE_HDR_LEN_ROUNDUP			32
44 
45 /* Length of Authentication header section in words */
46 #define IXGBE_NVM_AUTH_HEADER_LEN		0x08
47 
48 /* Shadow RAM related */
49 #define IXGBE_SR_WORDS_IN_1KB	512
50 
51 /* The Netlist ID Block is located after all of the Link Topology nodes. */
52 #define IXGBE_NETLIST_ID_BLK_SIZE		0x30
53 #define IXGBE_NETLIST_ID_BLK_OFFSET(n)		IXGBE_NETLIST_LINK_TOPO_OFFSET(0x0004 + 2 * (n))
54 
55 /* netlist ID block field offsets (word offsets) */
56 #define IXGBE_NETLIST_ID_BLK_MAJOR_VER_LOW	0x02
57 #define IXGBE_NETLIST_ID_BLK_MAJOR_VER_HIGH	0x03
58 #define IXGBE_NETLIST_ID_BLK_MINOR_VER_LOW	0x04
59 #define IXGBE_NETLIST_ID_BLK_MINOR_VER_HIGH	0x05
60 #define IXGBE_NETLIST_ID_BLK_TYPE_LOW		0x06
61 #define IXGBE_NETLIST_ID_BLK_TYPE_HIGH		0x07
62 #define IXGBE_NETLIST_ID_BLK_REV_LOW		0x08
63 #define IXGBE_NETLIST_ID_BLK_REV_HIGH		0x09
64 #define IXGBE_NETLIST_ID_BLK_SHA_HASH_WORD(n)	(0x0A + (n))
65 #define IXGBE_NETLIST_ID_BLK_CUST_VER		0x2F
66 
67 /* The Link Topology Netlist section is stored as a series of words. It is
68  * stored in the NVM as a TLV, with the first two words containing the type
69  * and length.
70  */
71 #define IXGBE_NETLIST_LINK_TOPO_MOD_ID		0x011B
72 #define IXGBE_NETLIST_TYPE_OFFSET		0x0000
73 #define IXGBE_NETLIST_LEN_OFFSET		0x0001
74 
75 /* The Link Topology section follows the TLV header. When reading the netlist
76  * using ixgbe_read_netlist_module, we need to account for the 2-word TLV
77  * header.
78  */
79 #define IXGBE_NETLIST_LINK_TOPO_OFFSET(n)	((n) + 2)
80 #define IXGBE_LINK_TOPO_MODULE_LEN	IXGBE_NETLIST_LINK_TOPO_OFFSET(0x0000)
81 #define IXGBE_LINK_TOPO_NODE_COUNT	IXGBE_NETLIST_LINK_TOPO_OFFSET(0x0001)
82 #define IXGBE_LINK_TOPO_NODE_COUNT_M		GENMASK_ULL(9, 0)
83 
84 /* Firmware Status Register (GL_FWSTS) */
85 #define GL_FWSTS		0x00083048 /* Reset Source: POR */
86 #define GL_FWSTS_EP_PF0		BIT(24)
87 #define GL_FWSTS_EP_PF1		BIT(25)
88 
89 /* Global NVM General Status Register */
90 #define GLNVM_GENS		0x000B6100 /* Reset Source: POR */
91 #define GLNVM_GENS_SR_SIZE_M	GENMASK(7, 5)
92 
93 #define IXGBE_GL_MNG_FWSM		0x000B6134 /* Reset Source: POR */
94 #define IXGBE_GL_MNG_FWSM_RECOVERY_M	BIT(1)
95 #define IXGBE_GL_MNG_FWSM_ROLLBACK_M    BIT(2)
96 
97 /* Flash Access Register */
98 #define IXGBE_GLNVM_FLA			0x000B6108 /* Reset Source: POR */
99 #define IXGBE_GLNVM_FLA_LOCKED_S	6
100 #define IXGBE_GLNVM_FLA_LOCKED_M	BIT(6)
101 
102 /* Auxiliary field, mask and shift definition for Shadow RAM and NVM Flash */
103 #define IXGBE_SR_CTRL_WORD_1_M		GENMASK(7, 6)
104 #define IXGBE_SR_CTRL_WORD_VALID	BIT(0)
105 #define IXGBE_SR_CTRL_WORD_OROM_BANK	BIT(3)
106 #define IXGBE_SR_CTRL_WORD_NETLIST_BANK	BIT(4)
107 #define IXGBE_SR_CTRL_WORD_NVM_BANK	BIT(5)
108 #define IXGBE_SR_NVM_PTR_4KB_UNITS	BIT(15)
109 
110 /* Admin Command Interface (ACI) registers */
111 #define IXGBE_PF_HIDA(_i)			(0x00085000 + ((_i) * 4))
112 #define IXGBE_PF_HIDA_2(_i)			(0x00085020 + ((_i) * 4))
113 #define IXGBE_PF_HIBA(_i)			(0x00084000 + ((_i) * 4))
114 #define IXGBE_PF_HICR				0x00082048
115 
116 #define IXGBE_PF_HICR_EN			BIT(0)
117 #define IXGBE_PF_HICR_C				BIT(1)
118 #define IXGBE_PF_HICR_SV			BIT(2)
119 #define IXGBE_PF_HICR_EV			BIT(3)
120 
121 #define IXGBE_FW_API_VER_MAJOR		0x01
122 #define IXGBE_FW_API_VER_MINOR		0x07
123 #define IXGBE_FW_API_VER_DIFF_ALLOWED	0x02
124 
125 #define IXGBE_ACI_DESC_SIZE		32
126 #define IXGBE_ACI_DESC_SIZE_IN_DWORDS	(IXGBE_ACI_DESC_SIZE / BYTES_PER_DWORD)
127 
128 #define IXGBE_ACI_MAX_BUFFER_SIZE		4096    /* Size in bytes */
129 #define IXGBE_ACI_SEND_DELAY_TIME_MS		10
130 #define IXGBE_ACI_SEND_MAX_EXECUTE		3
131 #define IXGBE_ACI_SEND_TIMEOUT_MS		\
132 		(IXGBE_ACI_SEND_MAX_EXECUTE * IXGBE_ACI_SEND_DELAY_TIME_MS)
133 /* [ms] timeout of waiting for sync response */
134 #define IXGBE_ACI_SYNC_RESPONSE_TIMEOUT		100000
135 /* [ms] timeout of waiting for async response */
136 #define IXGBE_ACI_ASYNC_RESPONSE_TIMEOUT	150000
137 /* [ms] timeout of waiting for resource release */
138 #define IXGBE_ACI_RELEASE_RES_TIMEOUT		10000
139 
140 /* Admin Command Interface (ACI) opcodes */
141 enum ixgbe_aci_opc {
142 	ixgbe_aci_opc_get_ver				= 0x0001,
143 	ixgbe_aci_opc_driver_ver			= 0x0002,
144 	ixgbe_aci_opc_get_exp_err			= 0x0005,
145 
146 	/* resource ownership */
147 	ixgbe_aci_opc_req_res				= 0x0008,
148 	ixgbe_aci_opc_release_res			= 0x0009,
149 
150 	/* device/function capabilities */
151 	ixgbe_aci_opc_list_func_caps			= 0x000A,
152 	ixgbe_aci_opc_list_dev_caps			= 0x000B,
153 
154 	/* safe disable of RXEN */
155 	ixgbe_aci_opc_disable_rxen			= 0x000C,
156 
157 	/* FW events */
158 	ixgbe_aci_opc_get_fw_event			= 0x0014,
159 
160 	/* PHY commands */
161 	ixgbe_aci_opc_get_phy_caps			= 0x0600,
162 	ixgbe_aci_opc_set_phy_cfg			= 0x0601,
163 	ixgbe_aci_opc_restart_an			= 0x0605,
164 	ixgbe_aci_opc_get_link_status			= 0x0607,
165 	ixgbe_aci_opc_set_event_mask			= 0x0613,
166 	ixgbe_aci_opc_get_link_topo			= 0x06E0,
167 	ixgbe_aci_opc_get_link_topo_pin			= 0x06E1,
168 	ixgbe_aci_opc_read_i2c				= 0x06E2,
169 	ixgbe_aci_opc_write_i2c				= 0x06E3,
170 	ixgbe_aci_opc_read_mdio				= 0x06E4,
171 	ixgbe_aci_opc_write_mdio			= 0x06E5,
172 	ixgbe_aci_opc_set_gpio_by_func			= 0x06E6,
173 	ixgbe_aci_opc_get_gpio_by_func			= 0x06E7,
174 	ixgbe_aci_opc_set_port_id_led			= 0x06E9,
175 	ixgbe_aci_opc_set_gpio				= 0x06EC,
176 	ixgbe_aci_opc_get_gpio				= 0x06ED,
177 	ixgbe_aci_opc_sff_eeprom			= 0x06EE,
178 	ixgbe_aci_opc_prog_topo_dev_nvm			= 0x06F2,
179 	ixgbe_aci_opc_read_topo_dev_nvm			= 0x06F3,
180 
181 	/* NVM commands */
182 	ixgbe_aci_opc_nvm_read				= 0x0701,
183 	ixgbe_aci_opc_nvm_erase				= 0x0702,
184 	ixgbe_aci_opc_nvm_write				= 0x0703,
185 	ixgbe_aci_opc_nvm_cfg_read			= 0x0704,
186 	ixgbe_aci_opc_nvm_cfg_write			= 0x0705,
187 	ixgbe_aci_opc_nvm_checksum			= 0x0706,
188 	ixgbe_aci_opc_nvm_write_activate		= 0x0707,
189 	ixgbe_aci_opc_nvm_sr_dump			= 0x0707,
190 	ixgbe_aci_opc_nvm_save_factory_settings		= 0x0708,
191 	ixgbe_aci_opc_nvm_update_empr			= 0x0709,
192 	ixgbe_aci_opc_nvm_pkg_data			= 0x070A,
193 	ixgbe_aci_opc_nvm_pass_component_tbl		= 0x070B,
194 
195 	/* Alternate Structure Commands */
196 	ixgbe_aci_opc_write_alt_direct			= 0x0900,
197 	ixgbe_aci_opc_write_alt_indirect		= 0x0901,
198 	ixgbe_aci_opc_read_alt_direct			= 0x0902,
199 	ixgbe_aci_opc_read_alt_indirect			= 0x0903,
200 	ixgbe_aci_opc_done_alt_write			= 0x0904,
201 	ixgbe_aci_opc_clear_port_alt_write		= 0x0906,
202 
203 	/* TCA Events */
204 	ixgbe_aci_opc_temp_tca_event                    = 0x0C94,
205 
206 	/* debug commands */
207 	ixgbe_aci_opc_debug_dump_internals		= 0xFF08,
208 
209 	/* SystemDiagnostic commands */
210 	ixgbe_aci_opc_set_health_status_config		= 0xFF20,
211 	ixgbe_aci_opc_get_supported_health_status_codes	= 0xFF21,
212 	ixgbe_aci_opc_get_health_status			= 0xFF22,
213 	ixgbe_aci_opc_clear_health_status		= 0xFF23,
214 };
215 
216 #define IXGBE_DRV_VER_STR_LEN_E610	32
217 
218 /* Get Expanded Error Code (0x0005, direct) */
219 struct ixgbe_aci_cmd_get_exp_err {
220 	__le32 reason;
221 #define IXGBE_ACI_EXPANDED_ERROR_NOT_PROVIDED	0xFFFFFFFF
222 	__le32 identifier;
223 	u8 rsvd[8];
224 };
225 
226 /* FW update timeout definitions are in milliseconds */
227 #define IXGBE_NVM_TIMEOUT		180000
228 
229 /* Disable RXEN (direct 0x000C) */
230 struct ixgbe_aci_cmd_disable_rxen {
231 	u8 lport_num;
232 	u8 reserved[15];
233 };
234 
235 /* Get PHY capabilities (indirect 0x0600) */
236 struct ixgbe_aci_cmd_get_phy_caps {
237 	u8 lport_num;
238 	u8 reserved;
239 	__le16 param0;
240 	/* 18.0 - Report qualified modules */
241 #define IXGBE_ACI_GET_PHY_RQM		BIT(0)
242 	/* 18.1 - 18.3 : Report mode
243 	 * 000b - Report topology capabilities, without media
244 	 * 001b - Report topology capabilities, with media
245 	 * 010b - Report Active configuration
246 	 * 011b - Report PHY Type and FEC mode capabilities
247 	 * 100b - Report Default capabilities
248 	 */
249 #define IXGBE_ACI_REPORT_MODE_M			GENMASK(3, 1)
250 #define IXGBE_ACI_REPORT_TOPO_CAP_NO_MEDIA	0
251 #define IXGBE_ACI_REPORT_TOPO_CAP_MEDIA		BIT(1)
252 #define IXGBE_ACI_REPORT_ACTIVE_CFG		BIT(2)
253 #define IXGBE_ACI_REPORT_DFLT_CFG		BIT(3)
254 	__le32 reserved1;
255 	__le32 addr_high;
256 	__le32 addr_low;
257 };
258 
259 /* This is #define of PHY type (Extended):
260  * The first set of defines is for phy_type_low.
261  */
262 #define IXGBE_PHY_TYPE_LOW_100BASE_TX		BIT_ULL(0)
263 #define IXGBE_PHY_TYPE_LOW_100M_SGMII		BIT_ULL(1)
264 #define IXGBE_PHY_TYPE_LOW_1000BASE_T		BIT_ULL(2)
265 #define IXGBE_PHY_TYPE_LOW_1000BASE_SX		BIT_ULL(3)
266 #define IXGBE_PHY_TYPE_LOW_1000BASE_LX		BIT_ULL(4)
267 #define IXGBE_PHY_TYPE_LOW_1000BASE_KX		BIT_ULL(5)
268 #define IXGBE_PHY_TYPE_LOW_1G_SGMII		BIT_ULL(6)
269 #define IXGBE_PHY_TYPE_LOW_2500BASE_T		BIT_ULL(7)
270 #define IXGBE_PHY_TYPE_LOW_2500BASE_X		BIT_ULL(8)
271 #define IXGBE_PHY_TYPE_LOW_2500BASE_KX		BIT_ULL(9)
272 #define IXGBE_PHY_TYPE_LOW_5GBASE_T		BIT_ULL(10)
273 #define IXGBE_PHY_TYPE_LOW_5GBASE_KR		BIT_ULL(11)
274 #define IXGBE_PHY_TYPE_LOW_10GBASE_T		BIT_ULL(12)
275 #define IXGBE_PHY_TYPE_LOW_10G_SFI_DA		BIT_ULL(13)
276 #define IXGBE_PHY_TYPE_LOW_10GBASE_SR		BIT_ULL(14)
277 #define IXGBE_PHY_TYPE_LOW_10GBASE_LR		BIT_ULL(15)
278 #define IXGBE_PHY_TYPE_LOW_10GBASE_KR_CR1	BIT_ULL(16)
279 #define IXGBE_PHY_TYPE_LOW_10G_SFI_AOC_ACC	BIT_ULL(17)
280 #define IXGBE_PHY_TYPE_LOW_10G_SFI_C2C		BIT_ULL(18)
281 #define IXGBE_PHY_TYPE_LOW_25GBASE_T		BIT_ULL(19)
282 #define IXGBE_PHY_TYPE_LOW_25GBASE_CR		BIT_ULL(20)
283 #define IXGBE_PHY_TYPE_LOW_25GBASE_CR_S		BIT_ULL(21)
284 #define IXGBE_PHY_TYPE_LOW_25GBASE_CR1		BIT_ULL(22)
285 #define IXGBE_PHY_TYPE_LOW_25GBASE_SR		BIT_ULL(23)
286 #define IXGBE_PHY_TYPE_LOW_25GBASE_LR		BIT_ULL(24)
287 #define IXGBE_PHY_TYPE_LOW_25GBASE_KR		BIT_ULL(25)
288 #define IXGBE_PHY_TYPE_LOW_25GBASE_KR_S		BIT_ULL(26)
289 #define IXGBE_PHY_TYPE_LOW_25GBASE_KR1		BIT_ULL(27)
290 #define IXGBE_PHY_TYPE_LOW_25G_AUI_AOC_ACC	BIT_ULL(28)
291 #define IXGBE_PHY_TYPE_LOW_25G_AUI_C2C		BIT_ULL(29)
292 #define IXGBE_PHY_TYPE_LOW_MAX_INDEX		29
293 /* The second set of defines is for phy_type_high. */
294 #define IXGBE_PHY_TYPE_HIGH_10BASE_T		BIT_ULL(1)
295 #define IXGBE_PHY_TYPE_HIGH_10M_SGMII		BIT_ULL(2)
296 #define IXGBE_PHY_TYPE_HIGH_2500M_SGMII		BIT_ULL(56)
297 #define IXGBE_PHY_TYPE_HIGH_100M_USXGMII	BIT_ULL(57)
298 #define IXGBE_PHY_TYPE_HIGH_1G_USXGMII		BIT_ULL(58)
299 #define IXGBE_PHY_TYPE_HIGH_2500M_USXGMII	BIT_ULL(59)
300 #define IXGBE_PHY_TYPE_HIGH_5G_USXGMII		BIT_ULL(60)
301 #define IXGBE_PHY_TYPE_HIGH_10G_USXGMII		BIT_ULL(61)
302 #define IXGBE_PHY_TYPE_HIGH_MAX_INDEX		61
303 
304 struct ixgbe_aci_cmd_get_phy_caps_data {
305 	__le64 phy_type_low; /* Use values from IXGBE_PHY_TYPE_LOW_* */
306 	__le64 phy_type_high; /* Use values from IXGBE_PHY_TYPE_HIGH_* */
307 	u8 caps;
308 #define IXGBE_ACI_PHY_EN_TX_LINK_PAUSE			BIT(0)
309 #define IXGBE_ACI_PHY_EN_RX_LINK_PAUSE			BIT(1)
310 #define IXGBE_ACI_PHY_LOW_POWER_MODE			BIT(2)
311 #define IXGBE_ACI_PHY_EN_LINK				BIT(3)
312 #define IXGBE_ACI_PHY_AN_MODE				BIT(4)
313 #define IXGBE_ACI_PHY_EN_MOD_QUAL			BIT(5)
314 #define IXGBE_ACI_PHY_EN_LESM				BIT(6)
315 #define IXGBE_ACI_PHY_EN_AUTO_FEC			BIT(7)
316 #define IXGBE_ACI_PHY_CAPS_MASK				GENMASK(7, 0)
317 	u8 low_power_ctrl_an;
318 #define IXGBE_ACI_PHY_EN_D3COLD_LOW_POWER_AUTONEG	BIT(0)
319 #define IXGBE_ACI_PHY_AN_EN_CLAUSE28			BIT(1)
320 #define IXGBE_ACI_PHY_AN_EN_CLAUSE73			BIT(2)
321 #define IXGBE_ACI_PHY_AN_EN_CLAUSE37			BIT(3)
322 	__le16 eee_cap;
323 #define IXGBE_ACI_PHY_EEE_EN_100BASE_TX			BIT(0)
324 #define IXGBE_ACI_PHY_EEE_EN_1000BASE_T			BIT(1)
325 #define IXGBE_ACI_PHY_EEE_EN_10GBASE_T			BIT(2)
326 #define IXGBE_ACI_PHY_EEE_EN_1000BASE_KX		BIT(3)
327 #define IXGBE_ACI_PHY_EEE_EN_10GBASE_KR			BIT(4)
328 #define IXGBE_ACI_PHY_EEE_EN_25GBASE_KR			BIT(5)
329 #define IXGBE_ACI_PHY_EEE_EN_10BASE_T			BIT(11)
330 	__le16 eeer_value;
331 	u8 phy_id_oui[4]; /* PHY/Module ID connected on the port */
332 	u8 phy_fw_ver[8];
333 	u8 link_fec_options;
334 #define IXGBE_ACI_PHY_FEC_10G_KR_40G_KR4_EN		BIT(0)
335 #define IXGBE_ACI_PHY_FEC_10G_KR_40G_KR4_REQ		BIT(1)
336 #define IXGBE_ACI_PHY_FEC_25G_RS_528_REQ		BIT(2)
337 #define IXGBE_ACI_PHY_FEC_25G_KR_REQ			BIT(3)
338 #define IXGBE_ACI_PHY_FEC_25G_RS_544_REQ		BIT(4)
339 #define IXGBE_ACI_PHY_FEC_25G_RS_CLAUSE91_EN		BIT(6)
340 #define IXGBE_ACI_PHY_FEC_25G_KR_CLAUSE74_EN		BIT(7)
341 #define IXGBE_ACI_PHY_FEC_MASK				0xdf
342 	u8 module_compliance_enforcement;
343 #define IXGBE_ACI_MOD_ENFORCE_STRICT_MODE		BIT(0)
344 	u8 extended_compliance_code;
345 #define IXGBE_ACI_MODULE_TYPE_TOTAL_BYTE		3
346 	u8 module_type[IXGBE_ACI_MODULE_TYPE_TOTAL_BYTE];
347 #define IXGBE_ACI_MOD_TYPE_BYTE0_SFP_PLUS		0xA0
348 #define IXGBE_ACI_MOD_TYPE_BYTE0_QSFP_PLUS		0x80
349 #define IXGBE_ACI_MOD_TYPE_IDENT			1
350 #define IXGBE_ACI_MOD_TYPE_BYTE1_SFP_PLUS_CU_PASSIVE	BIT(0)
351 #define IXGBE_ACI_MOD_TYPE_BYTE1_SFP_PLUS_CU_ACTIVE	BIT(1)
352 #define IXGBE_ACI_MOD_TYPE_BYTE1_10G_BASE_SR		BIT(4)
353 #define IXGBE_ACI_MOD_TYPE_BYTE1_10G_BASE_LR		BIT(5)
354 #define IXGBE_ACI_MOD_TYPE_BYTE1_10G_BASE_LRM		BIT(6)
355 #define IXGBE_ACI_MOD_TYPE_BYTE1_10G_BASE_ER		BIT(7)
356 #define IXGBE_ACI_MOD_TYPE_BYTE2_SFP_PLUS		0xA0
357 #define IXGBE_ACI_MOD_TYPE_BYTE2_QSFP_PLUS		0x86
358 	u8 qualified_module_count;
359 	u8 rsvd2[7];	/* Bytes 47:41 reserved */
360 #define IXGBE_ACI_QUAL_MOD_COUNT_MAX			16
361 	struct {
362 		u8 v_oui[3];
363 		u8 rsvd3;
364 		u8 v_part[16];
365 		__le32 v_rev;
366 		__le64 rsvd4;
367 	} qual_modules[IXGBE_ACI_QUAL_MOD_COUNT_MAX];
368 };
369 
370 /* Set PHY capabilities (direct 0x0601)
371  * NOTE: This command must be followed by setup link and restart auto-neg
372  */
373 struct ixgbe_aci_cmd_set_phy_cfg {
374 	u8 lport_num;
375 	u8 reserved[7];
376 	__le32 addr_high;
377 	__le32 addr_low;
378 };
379 
380 /* Set PHY config command data structure */
381 struct ixgbe_aci_cmd_set_phy_cfg_data {
382 	__le64 phy_type_low; /* Use values from IXGBE_PHY_TYPE_LOW_* */
383 	__le64 phy_type_high; /* Use values from IXGBE_PHY_TYPE_HIGH_* */
384 	u8 caps;
385 #define IXGBE_ACI_PHY_ENA_VALID_MASK		0xef
386 #define IXGBE_ACI_PHY_ENA_TX_PAUSE_ABILITY	BIT(0)
387 #define IXGBE_ACI_PHY_ENA_RX_PAUSE_ABILITY	BIT(1)
388 #define IXGBE_ACI_PHY_ENA_LOW_POWER		BIT(2)
389 #define IXGBE_ACI_PHY_ENA_LINK			BIT(3)
390 #define IXGBE_ACI_PHY_ENA_AUTO_LINK_UPDT	BIT(5)
391 #define IXGBE_ACI_PHY_ENA_LESM			BIT(6)
392 #define IXGBE_ACI_PHY_ENA_AUTO_FEC		BIT(7)
393 	u8 low_power_ctrl_an;
394 	__le16 eee_cap; /* Value from ixgbe_aci_get_phy_caps */
395 	__le16 eeer_value; /* Use defines from ixgbe_aci_get_phy_caps */
396 	u8 link_fec_opt; /* Use defines from ixgbe_aci_get_phy_caps */
397 	u8 module_compliance_enforcement;
398 };
399 
400 /* Restart AN command data structure (direct 0x0605)
401  * Also used for response, with only the lport_num field present.
402  */
403 struct ixgbe_aci_cmd_restart_an {
404 	u8 lport_num;
405 	u8 reserved;
406 	u8 cmd_flags;
407 #define IXGBE_ACI_RESTART_AN_LINK_RESTART	BIT(1)
408 #define IXGBE_ACI_RESTART_AN_LINK_ENABLE	BIT(2)
409 	u8 reserved2[13];
410 };
411 
412 /* Get link status (indirect 0x0607), also used for Link Status Event */
413 struct ixgbe_aci_cmd_get_link_status {
414 	u8 lport_num;
415 	u8 reserved;
416 	__le16 cmd_flags;
417 #define IXGBE_ACI_LSE_M				GENMASK(1, 0)
418 #define IXGBE_ACI_LSE_NOP			0x0
419 #define IXGBE_ACI_LSE_DIS			0x2
420 #define IXGBE_ACI_LSE_ENA			0x3
421 	/* only response uses this flag */
422 #define IXGBE_ACI_LSE_IS_ENABLED		0x1
423 	__le32 reserved2;
424 	__le32 addr_high;
425 	__le32 addr_low;
426 };
427 
428 /* Get link status response data structure, also used for Link Status Event */
429 struct ixgbe_aci_cmd_get_link_status_data {
430 	u8 topo_media_conflict;
431 #define IXGBE_ACI_LINK_TOPO_CONFLICT		BIT(0)
432 #define IXGBE_ACI_LINK_MEDIA_CONFLICT		BIT(1)
433 #define IXGBE_ACI_LINK_TOPO_CORRUPT		BIT(2)
434 #define IXGBE_ACI_LINK_TOPO_UNREACH_PRT		BIT(4)
435 #define IXGBE_ACI_LINK_TOPO_UNDRUTIL_PRT	BIT(5)
436 #define IXGBE_ACI_LINK_TOPO_UNDRUTIL_MEDIA	BIT(6)
437 #define IXGBE_ACI_LINK_TOPO_UNSUPP_MEDIA	BIT(7)
438 	u8 link_cfg_err;
439 #define IXGBE_ACI_LINK_CFG_ERR				BIT(0)
440 #define IXGBE_ACI_LINK_CFG_COMPLETED			BIT(1)
441 #define IXGBE_ACI_LINK_ACT_PORT_OPT_INVAL		BIT(2)
442 #define IXGBE_ACI_LINK_FEAT_ID_OR_CONFIG_ID_INVAL	BIT(3)
443 #define IXGBE_ACI_LINK_TOPO_CRITICAL_SDP_ERR		BIT(4)
444 #define IXGBE_ACI_LINK_MODULE_POWER_UNSUPPORTED		BIT(5)
445 #define IXGBE_ACI_LINK_EXTERNAL_PHY_LOAD_FAILURE	BIT(6)
446 #define IXGBE_ACI_LINK_INVAL_MAX_POWER_LIMIT		BIT(7)
447 	u8 link_info;
448 #define IXGBE_ACI_LINK_UP		BIT(0)	/* Link Status */
449 #define IXGBE_ACI_LINK_FAULT		BIT(1)
450 #define IXGBE_ACI_LINK_FAULT_TX		BIT(2)
451 #define IXGBE_ACI_LINK_FAULT_RX		BIT(3)
452 #define IXGBE_ACI_LINK_FAULT_REMOTE	BIT(4)
453 #define IXGBE_ACI_LINK_UP_PORT		BIT(5)	/* External Port Link Status */
454 #define IXGBE_ACI_MEDIA_AVAILABLE	BIT(6)
455 #define IXGBE_ACI_SIGNAL_DETECT		BIT(7)
456 	u8 an_info;
457 #define IXGBE_ACI_AN_COMPLETED		BIT(0)
458 #define IXGBE_ACI_LP_AN_ABILITY		BIT(1)
459 #define IXGBE_ACI_PD_FAULT		BIT(2)	/* Parallel Detection Fault */
460 #define IXGBE_ACI_FEC_EN		BIT(3)
461 #define IXGBE_ACI_PHY_LOW_POWER		BIT(4)	/* Low Power State */
462 #define IXGBE_ACI_LINK_PAUSE_TX		BIT(5)
463 #define IXGBE_ACI_LINK_PAUSE_RX		BIT(6)
464 #define IXGBE_ACI_QUALIFIED_MODULE	BIT(7)
465 	u8 ext_info;
466 #define IXGBE_ACI_LINK_PHY_TEMP_ALARM	BIT(0)
467 #define IXGBE_ACI_LINK_EXCESSIVE_ERRORS	BIT(1)	/* Excessive Link Errors */
468 	/* Port Tx Suspended */
469 #define IXGBE_ACI_LINK_TX_ACTIVE	0
470 #define IXGBE_ACI_LINK_TX_DRAINED	1
471 #define IXGBE_ACI_LINK_TX_FLUSHED	3
472 	u8 lb_status;
473 #define IXGBE_ACI_LINK_LB_PHY_LCL	BIT(0)
474 #define IXGBE_ACI_LINK_LB_PHY_RMT	BIT(1)
475 #define IXGBE_ACI_LINK_LB_MAC_LCL	BIT(2)
476 	__le16 max_frame_size;
477 	u8 cfg;
478 #define IXGBE_ACI_LINK_25G_KR_FEC_EN		BIT(0)
479 #define IXGBE_ACI_LINK_25G_RS_528_FEC_EN	BIT(1)
480 #define IXGBE_ACI_LINK_25G_RS_544_FEC_EN	BIT(2)
481 #define IXGBE_ACI_FEC_MASK			GENMASK(2, 0)
482 	/* Pacing Config */
483 #define IXGBE_ACI_CFG_PACING_M		GENMASK(6, 3)
484 #define IXGBE_ACI_CFG_PACING_TYPE_M	BIT(7)
485 #define IXGBE_ACI_CFG_PACING_TYPE_AVG	0
486 #define IXGBE_ACI_CFG_PACING_TYPE_FIXED	IXGBE_ACI_CFG_PACING_TYPE_M
487 	/* External Device Power Ability */
488 	u8 power_desc;
489 #define IXGBE_ACI_PWR_CLASS_M			GENMASK(5, 0)
490 #define IXGBE_ACI_LINK_PWR_BASET_LOW_HIGH	0
491 #define IXGBE_ACI_LINK_PWR_BASET_HIGH		1
492 #define IXGBE_ACI_LINK_PWR_QSFP_CLASS_1		0
493 #define IXGBE_ACI_LINK_PWR_QSFP_CLASS_2		1
494 #define IXGBE_ACI_LINK_PWR_QSFP_CLASS_3		2
495 #define IXGBE_ACI_LINK_PWR_QSFP_CLASS_4		3
496 	__le16 link_speed;
497 #define IXGBE_ACI_LINK_SPEED_M			GENMASK(10, 0)
498 #define IXGBE_ACI_LINK_SPEED_10MB		BIT(0)
499 #define IXGBE_ACI_LINK_SPEED_100MB		BIT(1)
500 #define IXGBE_ACI_LINK_SPEED_1000MB		BIT(2)
501 #define IXGBE_ACI_LINK_SPEED_2500MB		BIT(3)
502 #define IXGBE_ACI_LINK_SPEED_5GB		BIT(4)
503 #define IXGBE_ACI_LINK_SPEED_10GB		BIT(5)
504 #define IXGBE_ACI_LINK_SPEED_20GB		BIT(6)
505 #define IXGBE_ACI_LINK_SPEED_25GB		BIT(7)
506 #define IXGBE_ACI_LINK_SPEED_40GB		BIT(8)
507 #define IXGBE_ACI_LINK_SPEED_50GB		BIT(9)
508 #define IXGBE_ACI_LINK_SPEED_100GB		BIT(10)
509 #define IXGBE_ACI_LINK_SPEED_200GB		BIT(11)
510 #define IXGBE_ACI_LINK_SPEED_UNKNOWN		BIT(15)
511 	__le16 reserved3;
512 	u8 ext_fec_status;
513 #define IXGBE_ACI_LINK_RS_272_FEC_EN	BIT(0) /* RS 272 FEC enabled */
514 	u8 reserved4;
515 	__le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
516 	__le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */
517 	/* Get link status version 2 link partner data */
518 	__le64 lp_phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
519 	__le64 lp_phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */
520 	u8 lp_fec_adv;
521 #define IXGBE_ACI_LINK_LP_10G_KR_FEC_CAP	BIT(0)
522 #define IXGBE_ACI_LINK_LP_25G_KR_FEC_CAP	BIT(1)
523 #define IXGBE_ACI_LINK_LP_RS_528_FEC_CAP	BIT(2)
524 #define IXGBE_ACI_LINK_LP_50G_KR_272_FEC_CAP	BIT(3)
525 #define IXGBE_ACI_LINK_LP_100G_KR_272_FEC_CAP	BIT(4)
526 #define IXGBE_ACI_LINK_LP_200G_KR_272_FEC_CAP	BIT(5)
527 	u8 lp_fec_req;
528 #define IXGBE_ACI_LINK_LP_10G_KR_FEC_REQ	BIT(0)
529 #define IXGBE_ACI_LINK_LP_25G_KR_FEC_REQ	BIT(1)
530 #define IXGBE_ACI_LINK_LP_RS_528_FEC_REQ	BIT(2)
531 #define IXGBE_ACI_LINK_LP_KR_272_FEC_REQ	BIT(3)
532 	u8 lp_flowcontrol;
533 #define IXGBE_ACI_LINK_LP_PAUSE_ADV		BIT(0)
534 #define IXGBE_ACI_LINK_LP_ASM_DIR_ADV		BIT(1)
535 	u8 reserved5[5];
536 } __packed;
537 
538 /* Set event mask command (direct 0x0613) */
539 struct ixgbe_aci_cmd_set_event_mask {
540 	u8	lport_num;
541 	u8	reserved[7];
542 	__le16	event_mask;
543 #define IXGBE_ACI_LINK_EVENT_UPDOWN		BIT(1)
544 #define IXGBE_ACI_LINK_EVENT_MEDIA_NA		BIT(2)
545 #define IXGBE_ACI_LINK_EVENT_LINK_FAULT		BIT(3)
546 #define IXGBE_ACI_LINK_EVENT_PHY_TEMP_ALARM	BIT(4)
547 #define IXGBE_ACI_LINK_EVENT_EXCESSIVE_ERRORS	BIT(5)
548 #define IXGBE_ACI_LINK_EVENT_SIGNAL_DETECT	BIT(6)
549 #define IXGBE_ACI_LINK_EVENT_AN_COMPLETED	BIT(7)
550 #define IXGBE_ACI_LINK_EVENT_MODULE_QUAL_FAIL	BIT(8)
551 #define IXGBE_ACI_LINK_EVENT_PORT_TX_SUSPENDED	BIT(9)
552 #define IXGBE_ACI_LINK_EVENT_TOPO_CONFLICT	BIT(10)
553 #define IXGBE_ACI_LINK_EVENT_MEDIA_CONFLICT	BIT(11)
554 #define IXGBE_ACI_LINK_EVENT_PHY_FW_LOAD_FAIL	BIT(12)
555 	u8	reserved1[6];
556 };
557 
558 struct ixgbe_aci_cmd_link_topo_params {
559 	u8 lport_num;
560 	u8 lport_num_valid;
561 #define IXGBE_ACI_LINK_TOPO_PORT_NUM_VALID	BIT(0)
562 	u8 node_type_ctx;
563 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_M		GENMASK(3, 0)
564 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_PHY	0
565 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_GPIO_CTRL	1
566 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_MUX_CTRL	2
567 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_LED_CTRL	3
568 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_LED	4
569 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_THERMAL	5
570 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_CAGE	6
571 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_MEZZ	7
572 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_ID_EEPROM	8
573 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_CLK_CTRL	9
574 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_CLK_MUX	10
575 #define IXGBE_ACI_LINK_TOPO_NODE_TYPE_GPS	11
576 #define IXGBE_ACI_LINK_TOPO_NODE_CTX_S		4
577 #define IXGBE_ACI_LINK_TOPO_NODE_CTX_M		GENMASK(7, 4)
578 #define IXGBE_ACI_LINK_TOPO_NODE_CTX_GLOBAL			0
579 #define IXGBE_ACI_LINK_TOPO_NODE_CTX_BOARD			1
580 #define IXGBE_ACI_LINK_TOPO_NODE_CTX_PORT			2
581 #define IXGBE_ACI_LINK_TOPO_NODE_CTX_NODE			3
582 #define IXGBE_ACI_LINK_TOPO_NODE_CTX_NODE_HANDLE		4
583 #define IXGBE_ACI_LINK_TOPO_NODE_CTX_DIRECT_BUS_ACCESS		5
584 #define IXGBE_ACI_LINK_TOPO_NODE_CTX_NODE_HANDLE_BUS_ADDRESS	6
585 	u8 index;
586 };
587 
588 struct ixgbe_aci_cmd_link_topo_addr {
589 	struct ixgbe_aci_cmd_link_topo_params topo_params;
590 	__le16 handle;
591 /* Used to decode the handle field */
592 #define IXGBE_ACI_LINK_TOPO_HANDLE_BRD_TYPE_M		BIT(9)
593 #define IXGBE_ACI_LINK_TOPO_HANDLE_BRD_TYPE_LOM		BIT(9)
594 #define IXGBE_ACI_LINK_TOPO_HANDLE_BRD_TYPE_MEZZ	0
595 };
596 
597 /* Get Link Topology Handle (direct, 0x06E0) */
598 struct ixgbe_aci_cmd_get_link_topo {
599 	struct ixgbe_aci_cmd_link_topo_addr addr;
600 	u8 node_part_num;
601 #define IXGBE_ACI_GET_LINK_TOPO_NODE_NR_PCA9575		0x21
602 #define IXGBE_ACI_GET_LINK_TOPO_NODE_NR_ZL30632_80032	0x24
603 #define IXGBE_ACI_GET_LINK_TOPO_NODE_NR_SI5384		0x25
604 #define IXGBE_ACI_GET_LINK_TOPO_NODE_NR_C827		0x31
605 #define IXGBE_ACI_GET_LINK_TOPO_NODE_NR_GEN_CLK_MUX	0x47
606 #define IXGBE_ACI_GET_LINK_TOPO_NODE_NR_GEN_GPS		0x48
607 #define IXGBE_ACI_GET_LINK_TOPO_NODE_NR_E610_PTC	0x49
608 	u8 rsvd[9];
609 };
610 
611 /* Get Link Topology Pin (direct, 0x06E1) */
612 struct ixgbe_aci_cmd_get_link_topo_pin {
613 	struct ixgbe_aci_cmd_link_topo_addr addr;
614 	u8 input_io_params;
615 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_GPIO	0
616 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_RESET_N	1
617 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_INT_N	2
618 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_PRESENT_N	3
619 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_TX_DIS	4
620 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_MODSEL_N	5
621 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_LPMODE	6
622 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_TX_FAULT	7
623 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_RX_LOSS	8
624 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_RS0		9
625 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_RS1		10
626 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_EEPROM_WP	11
627 /* 12 repeats intentionally due to two different uses depending on context */
628 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_LED		12
629 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_RED_LED	12
630 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_GREEN_LED	13
631 #define IXGBE_ACI_LINK_TOPO_IO_FUNC_BLUE_LED	14
632 #define IXGBE_ACI_LINK_TOPO_INPUT_IO_TYPE_GPIO	3
633 /* Use IXGBE_ACI_LINK_TOPO_NODE_TYPE_* for the type values */
634 	u8 output_io_params;
635 /* Use IXGBE_ACI_LINK_TOPO_NODE_TYPE_* for the type values */
636 	u8 output_io_flags;
637 #define IXGBE_ACI_LINK_TOPO_OUTPUT_POLARITY	BIT(5)
638 #define IXGBE_ACI_LINK_TOPO_OUTPUT_VALUE	BIT(6)
639 #define IXGBE_ACI_LINK_TOPO_OUTPUT_DRIVEN	BIT(7)
640 	u8 rsvd[7];
641 };
642 
643 /* Set Port Identification LED (direct, 0x06E9) */
644 struct ixgbe_aci_cmd_set_port_id_led {
645 	u8 lport_num;
646 	u8 lport_num_valid;
647 	u8 ident_mode;
648 	u8 rsvd[13];
649 };
650 
651 #define IXGBE_ACI_PORT_ID_PORT_NUM_VALID	BIT(0)
652 #define IXGBE_ACI_PORT_IDENT_LED_ORIG		0
653 #define IXGBE_ACI_PORT_IDENT_LED_BLINK		BIT(0)
654 
655 /* Read/Write SFF EEPROM command (indirect 0x06EE) */
656 struct ixgbe_aci_cmd_sff_eeprom {
657 	u8 lport_num;
658 	u8 lport_num_valid;
659 #define IXGBE_ACI_SFF_PORT_NUM_VALID		BIT(0)
660 	__le16 i2c_bus_addr;
661 #define IXGBE_ACI_SFF_I2CBUS_7BIT_M		GENMASK(6, 0)
662 #define IXGBE_ACI_SFF_I2CBUS_10BIT_M		GENMASK(9, 0)
663 #define IXGBE_ACI_SFF_I2CBUS_TYPE_M		BIT(10)
664 #define IXGBE_ACI_SFF_I2CBUS_TYPE_7BIT		0
665 #define IXGBE_ACI_SFF_I2CBUS_TYPE_10BIT		IXGBE_ACI_SFF_I2CBUS_TYPE_M
666 #define IXGBE_ACI_SFF_NO_PAGE_BANK_UPDATE	0
667 #define IXGBE_ACI_SFF_UPDATE_PAGE		1
668 #define IXGBE_ACI_SFF_UPDATE_BANK		2
669 #define IXGBE_ACI_SFF_UPDATE_PAGE_BANK		3
670 #define IXGBE_ACI_SFF_IS_WRITE			BIT(15)
671 	__le16 i2c_offset;
672 	u8 module_bank;
673 	u8 module_page;
674 	__le32 addr_high;
675 	__le32 addr_low;
676 };
677 
678 /* NVM Read command (indirect 0x0701)
679  * NVM Erase commands (direct 0x0702)
680  * NVM Write commands (indirect 0x0703)
681  * NVM Write Activate commands (direct 0x0707)
682  * NVM Shadow RAM Dump commands (direct 0x0707)
683  */
684 struct ixgbe_aci_cmd_nvm {
685 #define IXGBE_ACI_NVM_MAX_OFFSET	0xFFFFFF
686 	__le16 offset_low;
687 	u8 offset_high; /* For Write Activate offset_high is used as flags2 */
688 #define IXGBE_ACI_NVM_OFFSET_HI_A_MASK  GENMASK(15, 8)
689 #define IXGBE_ACI_NVM_OFFSET_HI_U_MASK	GENMASK(23, 16)
690 	u8 cmd_flags;
691 #define IXGBE_ACI_NVM_LAST_CMD		BIT(0)
692 #define IXGBE_ACI_NVM_PCIR_REQ		BIT(0) /* Used by NVM Write reply */
693 #define IXGBE_ACI_NVM_PRESERVE_ALL	BIT(1)
694 #define IXGBE_ACI_NVM_ACTIV_SEL_NVM	BIT(3) /* Write Activate/SR Dump only */
695 #define IXGBE_ACI_NVM_ACTIV_SEL_OROM	BIT(4)
696 #define IXGBE_ACI_NVM_ACTIV_SEL_NETLIST	BIT(5)
697 #define IXGBE_ACI_NVM_SPECIAL_UPDATE	BIT(6)
698 #define IXGBE_ACI_NVM_REVERT_LAST_ACTIV	BIT(6) /* Write Activate only */
699 #define IXGBE_ACI_NVM_FLASH_ONLY	BIT(7)
700 #define IXGBE_ACI_NVM_RESET_LVL_M	GENMASK(1, 0) /* Write reply only */
701 #define IXGBE_ACI_NVM_POR_FLAG		0
702 #define IXGBE_ACI_NVM_PERST_FLAG	1
703 #define IXGBE_ACI_NVM_EMPR_FLAG		2
704 #define IXGBE_ACI_NVM_EMPR_ENA		BIT(0) /* Write Activate reply only */
705 #define IXGBE_ACI_NVM_NO_PRESERVATION	0x0
706 #define IXGBE_ACI_NVM_PRESERVE_SELECTED	0x6
707 
708 	/* For Write Activate, several flags are sent as part of a separate
709 	 * flags2 field using a separate byte. For simplicity of the software
710 	 * interface, we pass the flags as a 16 bit value so these flags are
711 	 * all offset by 8 bits
712 	 */
713 #define IXGBE_ACI_NVM_ACTIV_REQ_EMPR	BIT(8) /* NVM Write Activate only */
714 	__le16 module_typeid;
715 	__le16 length;
716 #define IXGBE_ACI_NVM_ERASE_LEN	0xFFFF
717 	__le32 addr_high;
718 	__le32 addr_low;
719 };
720 
721 /* NVM Module_Type ID, needed offset and read_len for
722  * struct ixgbe_aci_cmd_nvm.
723  */
724 #define IXGBE_ACI_NVM_START_POINT		0
725 
726 /* NVM Checksum Command (direct, 0x0706) */
727 struct ixgbe_aci_cmd_nvm_checksum {
728 	u8 flags;
729 #define IXGBE_ACI_NVM_CHECKSUM_VERIFY	BIT(0)
730 #define IXGBE_ACI_NVM_CHECKSUM_RECALC	BIT(1)
731 	u8 rsvd;
732 	__le16 checksum; /* Used only by response */
733 #define IXGBE_ACI_NVM_CHECKSUM_CORRECT	0xBABA
734 	u8 rsvd2[12];
735 };
736 
737 /* Used for NVM Set Package Data command - 0x070A */
738 struct ixgbe_aci_cmd_nvm_pkg_data {
739 	u8 reserved[3];
740 	u8 cmd_flags;
741 #define IXGBE_ACI_NVM_PKG_DELETE	BIT(0) /* used for command call */
742 
743 	u32 reserved1;
744 	__le32 addr_high;
745 	__le32 addr_low;
746 };
747 
748 /* Used for Pass Component Table command - 0x070B */
749 struct ixgbe_aci_cmd_nvm_pass_comp_tbl {
750 	u8 component_response; /* Response only */
751 #define IXGBE_ACI_NVM_PASS_COMP_CAN_BE_UPDATED		0x0
752 #define IXGBE_ACI_NVM_PASS_COMP_CAN_MAY_BE_UPDATEABLE	0x1
753 #define IXGBE_ACI_NVM_PASS_COMP_CAN_NOT_BE_UPDATED	0x2
754 #define IXGBE_ACI_NVM_PASS_COMP_PARTIAL_CHECK		0x3
755 	u8 component_response_code; /* Response only */
756 #define IXGBE_ACI_NVM_PASS_COMP_CAN_BE_UPDATED_CODE	0x0
757 #define IXGBE_ACI_NVM_PASS_COMP_STAMP_IDENTICAL_CODE	0x1
758 #define IXGBE_ACI_NVM_PASS_COMP_STAMP_LOWER		0x2
759 #define IXGBE_ACI_NVM_PASS_COMP_INVALID_STAMP_CODE	0x3
760 #define IXGBE_ACI_NVM_PASS_COMP_CONFLICT_CODE		0x4
761 #define IXGBE_ACI_NVM_PASS_COMP_PRE_REQ_NOT_MET_CODE	0x5
762 #define IXGBE_ACI_NVM_PASS_COMP_NOT_SUPPORTED_CODE	0x6
763 #define IXGBE_ACI_NVM_PASS_COMP_CANNOT_DOWNGRADE_CODE	0x7
764 #define IXGBE_ACI_NVM_PASS_COMP_INCOMPLETE_IMAGE_CODE	0x8
765 #define IXGBE_ACI_NVM_PASS_COMP_VER_STR_IDENTICAL_CODE	0xA
766 #define IXGBE_ACI_NVM_PASS_COMP_VER_STR_LOWER_CODE	0xB
767 	u8 reserved;
768 	u8 transfer_flag;
769 	__le32 reserved1;
770 	__le32 addr_high;
771 	__le32 addr_low;
772 };
773 
774 struct ixgbe_aci_cmd_nvm_comp_tbl {
775 	__le16 comp_class;
776 #define NVM_COMP_CLASS_ALL_FW		0x000A
777 
778 	__le16 comp_id;
779 #define NVM_COMP_ID_OROM		0x5
780 #define NVM_COMP_ID_NVM			0x6
781 #define NVM_COMP_ID_NETLIST		0x8
782 
783 	u8 comp_class_idx;
784 #define FWU_COMP_CLASS_IDX_NOT_USE	0x0
785 
786 	__le32 comp_cmp_stamp;
787 	u8 cvs_type;
788 #define NVM_CVS_TYPE_ASCII		0x1
789 
790 	u8 cvs_len;
791 	u8 cvs[]; /* Component Version String */
792 } __packed;
793 
794 /* E610-specific adapter context structures */
795 
796 struct ixgbe_link_status {
797 	/* Refer to ixgbe_aci_phy_type for bits definition */
798 	u64 phy_type_low;
799 	u64 phy_type_high;
800 	u16 max_frame_size;
801 	u16 link_speed;
802 	u16 req_speeds;
803 	u8 topo_media_conflict;
804 	u8 link_cfg_err;
805 	u8 lse_ena;	/* Link Status Event notification */
806 	u8 link_info;
807 	u8 an_info;
808 	u8 ext_info;
809 	u8 fec_info;
810 	u8 pacing;
811 	/* Refer to #define from module_type[IXGBE_ACI_MODULE_TYPE_TOTAL_BYTE]
812 	 * of ixgbe_aci_get_phy_caps structure
813 	 */
814 	u8 module_type[IXGBE_ACI_MODULE_TYPE_TOTAL_BYTE];
815 };
816 
817 /* Common HW capabilities for SW use */
818 struct ixgbe_hw_caps {
819 	/* Write CSR protection */
820 	u64 wr_csr_prot;
821 	u32 switching_mode;
822 	/* switching mode supported - EVB switching (including cloud) */
823 #define IXGBE_NVM_IMAGE_TYPE_EVB		0x0
824 
825 	/* Manageability mode & supported protocols over MCTP */
826 	u32 mgmt_mode;
827 #define IXGBE_MGMT_MODE_PASS_THRU_MODE_M	GENMASK(3, 0)
828 #define IXGBE_MGMT_MODE_CTL_INTERFACE_M		GENMASK(7, 4)
829 #define IXGBE_MGMT_MODE_REDIR_SB_INTERFACE_M	GENMASK(11, 8)
830 
831 	u32 mgmt_protocols_mctp;
832 #define IXGBE_MGMT_MODE_PROTO_RSVD	BIT(0)
833 #define IXGBE_MGMT_MODE_PROTO_PLDM	BIT(1)
834 #define IXGBE_MGMT_MODE_PROTO_OEM	BIT(2)
835 #define IXGBE_MGMT_MODE_PROTO_NC_SI	BIT(3)
836 
837 	u32 os2bmc;
838 	u32 valid_functions;
839 	/* DCB capabilities */
840 	u32 active_tc_bitmap;
841 	u32 maxtc;
842 
843 	/* RSS related capabilities */
844 	u32 rss_table_size;		/* 512 for PFs and 64 for VFs */
845 	u32 rss_table_entry_width;	/* RSS Entry width in bits */
846 
847 	/* Tx/Rx queues */
848 	u32 num_rxq;			/* Number/Total Rx queues */
849 	u32 rxq_first_id;		/* First queue ID for Rx queues */
850 	u32 num_txq;			/* Number/Total Tx queues */
851 	u32 txq_first_id;		/* First queue ID for Tx queues */
852 
853 	/* MSI-X vectors */
854 	u32 num_msix_vectors;
855 	u32 msix_vector_first_id;
856 
857 	/* Max MTU for function or device */
858 	u32 max_mtu;
859 
860 	/* WOL related */
861 	u32 num_wol_proxy_fltr;
862 	u32 wol_proxy_vsi_seid;
863 
864 	/* LED/SDP pin count */
865 	u32 led_pin_num;
866 	u32 sdp_pin_num;
867 
868 	/* LED/SDP - Supports up to 12 LED pins and 8 SDP signals */
869 #define IXGBE_MAX_SUPPORTED_GPIO_LED	12
870 #define IXGBE_MAX_SUPPORTED_GPIO_SDP	8
871 	u8 led[IXGBE_MAX_SUPPORTED_GPIO_LED];
872 	u8 sdp[IXGBE_MAX_SUPPORTED_GPIO_SDP];
873 	/* SR-IOV virtualization */
874 	u8 sr_iov_1_1;			/* SR-IOV enabled */
875 	/* VMDQ */
876 	u8 vmdq;			/* VMDQ supported */
877 
878 	/* EVB capabilities */
879 	u8 evb_802_1_qbg;		/* Edge Virtual Bridging */
880 	u8 evb_802_1_qbh;		/* Bridge Port Extension */
881 
882 	u8 dcb;
883 	u8 iscsi;
884 	u8 ieee_1588;
885 	u8 mgmt_cem;
886 
887 	/* WoL and APM support */
888 #define IXGBE_WOL_SUPPORT_M		BIT(0)
889 #define IXGBE_ACPI_PROG_MTHD_M		BIT(1)
890 #define IXGBE_PROXY_SUPPORT_M		BIT(2)
891 	u8 apm_wol_support;
892 	u8 acpi_prog_mthd;
893 	u8 proxy_support;
894 	bool nvm_update_pending_nvm;
895 	bool nvm_update_pending_orom;
896 	bool nvm_update_pending_netlist;
897 #define IXGBE_NVM_PENDING_NVM_IMAGE		BIT(0)
898 #define IXGBE_NVM_PENDING_OROM			BIT(1)
899 #define IXGBE_NVM_PENDING_NETLIST		BIT(2)
900 	bool sec_rev_disabled;
901 	bool update_disabled;
902 	bool nvm_unified_update;
903 	bool netlist_auth;
904 #define IXGBE_NVM_MGMT_SEC_REV_DISABLED		BIT(0)
905 #define IXGBE_NVM_MGMT_UPDATE_DISABLED		BIT(1)
906 #define IXGBE_NVM_MGMT_UNIFIED_UPD_SUPPORT	BIT(3)
907 #define IXGBE_NVM_MGMT_NETLIST_AUTH_SUPPORT	BIT(5)
908 	bool no_drop_policy_support;
909 	/* PCIe reset avoidance */
910 	bool pcie_reset_avoidance; /* false: not supported, true: supported */
911 	/* Post update reset restriction */
912 	bool reset_restrict_support; /* false: not supported, true: supported */
913 
914 	/* External topology device images within the NVM */
915 #define IXGBE_EXT_TOPO_DEV_IMG_COUNT	4
916 	u32 ext_topo_dev_img_ver_high[IXGBE_EXT_TOPO_DEV_IMG_COUNT];
917 	u32 ext_topo_dev_img_ver_low[IXGBE_EXT_TOPO_DEV_IMG_COUNT];
918 	u8 ext_topo_dev_img_part_num[IXGBE_EXT_TOPO_DEV_IMG_COUNT];
919 #define IXGBE_EXT_TOPO_DEV_IMG_PART_NUM_S	8
920 #define IXGBE_EXT_TOPO_DEV_IMG_PART_NUM_M	GENMASK(15, 8)
921 	bool ext_topo_dev_img_load_en[IXGBE_EXT_TOPO_DEV_IMG_COUNT];
922 #define IXGBE_EXT_TOPO_DEV_IMG_LOAD_EN	BIT(0)
923 	bool ext_topo_dev_img_prog_en[IXGBE_EXT_TOPO_DEV_IMG_COUNT];
924 #define IXGBE_EXT_TOPO_DEV_IMG_PROG_EN	BIT(1)
925 } __packed;
926 
927 #define IXGBE_OROM_CIV_SIGNATURE	"$CIV"
928 
929 struct ixgbe_orom_civd_info {
930 	u8 signature[4];	/* Must match ASCII '$CIV' characters */
931 	u8 checksum;		/* Simple modulo 256 sum of all structure bytes must equal 0 */
932 	__le32 combo_ver;	/* Combo Image Version number */
933 	u8 combo_name_len;	/* Length of the unicode combo image version string, max of 32 */
934 	__le16 combo_name[32];	/* Unicode string representing the Combo Image version */
935 };
936 
937 /* Function specific capabilities */
938 struct ixgbe_hw_func_caps {
939 	u32 num_allocd_vfs;		/* Number of allocated VFs */
940 	u32 vf_base_id;			/* Logical ID of the first VF */
941 	u32 guar_num_vsi;
942 	struct ixgbe_hw_caps common_cap;
943 	bool no_drop_policy_ena;
944 };
945 
946 /* Device wide capabilities */
947 struct ixgbe_hw_dev_caps {
948 	struct ixgbe_hw_caps common_cap;
949 	u32 num_vfs_exposed;		/* Total number of VFs exposed */
950 	u32 num_vsi_allocd_to_host;	/* Excluding EMP VSI */
951 	u32 num_flow_director_fltr;	/* Number of FD filters available */
952 	u32 num_funcs;
953 };
954 
955 /* ACI event information */
956 struct ixgbe_aci_event {
957 	struct libie_aq_desc desc;
958 	u8 *msg_buf;
959 	u16 msg_len;
960 	u16 buf_len;
961 };
962 
963 struct ixgbe_aci_info {
964 	struct mutex lock;		/* admin command interface lock */
965 	enum libie_aq_err last_status;	/* last status of sent admin command */
966 };
967 
968 enum ixgbe_bank_select {
969 	IXGBE_ACTIVE_FLASH_BANK,
970 	IXGBE_INACTIVE_FLASH_BANK,
971 };
972 
973 /* Option ROM version information */
974 struct ixgbe_orom_info {
975 	u8 major;			/* Major version of OROM */
976 	u8 patch;			/* Patch version of OROM */
977 	u16 build;			/* Build version of OROM */
978 	u32 srev;			/* Security revision */
979 };
980 
981 /* NVM version information */
982 struct ixgbe_nvm_info {
983 	u32 eetrack;
984 	u32 srev;
985 	u8 major;
986 	u8 minor;
987 } __packed;
988 
989 /* netlist version information */
990 struct ixgbe_netlist_info {
991 	u32 major;			/* major high/low */
992 	u32 minor;			/* minor high/low */
993 	u32 type;			/* type high/low */
994 	u32 rev;			/* revision high/low */
995 	u32 hash;			/* SHA-1 hash word */
996 	u16 cust_ver;			/* customer version */
997 } __packed;
998 
999 /* Enumeration of possible flash banks for the NVM, OROM, and Netlist modules
1000  * of the flash image.
1001  */
1002 enum ixgbe_flash_bank {
1003 	IXGBE_INVALID_FLASH_BANK,
1004 	IXGBE_1ST_FLASH_BANK,
1005 	IXGBE_2ND_FLASH_BANK,
1006 };
1007 
1008 /* information for accessing NVM, OROM, and Netlist flash banks */
1009 struct ixgbe_bank_info {
1010 	u32 nvm_ptr;				/* Pointer to 1st NVM bank */
1011 	u32 nvm_size;				/* Size of NVM bank */
1012 	u32 orom_ptr;				/* Pointer to 1st OROM bank */
1013 	u32 orom_size;				/* Size of OROM bank */
1014 	u32 netlist_ptr;			/* Ptr to 1st Netlist bank */
1015 	u32 netlist_size;			/* Size of Netlist bank */
1016 	enum ixgbe_flash_bank nvm_bank;		/* Active NVM bank */
1017 	enum ixgbe_flash_bank orom_bank;	/* Active OROM bank */
1018 	enum ixgbe_flash_bank netlist_bank;	/* Active Netlist bank */
1019 };
1020 
1021 /* Flash Chip Information */
1022 struct ixgbe_flash_info {
1023 	struct ixgbe_orom_info orom;	/* Option ROM version info */
1024 	u32 flash_size;			/* Available flash size in bytes */
1025 	struct ixgbe_nvm_info nvm;	/* NVM version information */
1026 	struct ixgbe_netlist_info netlist;	/* Netlist version info */
1027 	struct ixgbe_bank_info banks;	/* Flash Bank information */
1028 	u16 sr_words;			/* Shadow RAM size in words */
1029 	u8 blank_nvm_mode;		/* is NVM empty (no FW present) */
1030 };
1031 
1032 #endif /* _IXGBE_TYPE_E610_H_ */
1033