xref: /openbmc/linux/drivers/scsi/bfa/bfad_bsg.h (revision 81d67439)
1 /*
2  * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
3  * All rights reserved
4  * www.brocade.com
5  *
6  * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7  *
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
11  *
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.
16  */
17 #ifndef BFAD_BSG_H
18 #define BFAD_BSG_H
19 
20 #include "bfa_defs.h"
21 #include "bfa_defs_fcs.h"
22 
23 /* Definitions of vendor unique structures and command codes passed in
24  * using FC_BSG_HST_VENDOR message code.
25  */
26 enum {
27 	IOCMD_IOC_ENABLE = 0x1,
28 	IOCMD_IOC_DISABLE,
29 	IOCMD_IOC_GET_ATTR,
30 	IOCMD_IOC_GET_INFO,
31 	IOCMD_IOC_GET_STATS,
32 	IOCMD_IOC_GET_FWSTATS,
33 	IOCMD_IOCFC_GET_ATTR,
34 	IOCMD_IOCFC_SET_INTR,
35 	IOCMD_PORT_ENABLE,
36 	IOCMD_PORT_DISABLE,
37 	IOCMD_PORT_GET_ATTR,
38 	IOCMD_PORT_GET_STATS,
39 	IOCMD_LPORT_GET_ATTR,
40 	IOCMD_LPORT_GET_RPORTS,
41 	IOCMD_LPORT_GET_STATS,
42 	IOCMD_LPORT_GET_IOSTATS,
43 	IOCMD_RPORT_GET_ATTR,
44 	IOCMD_RPORT_GET_ADDR,
45 	IOCMD_RPORT_GET_STATS,
46 	IOCMD_FABRIC_GET_LPORTS,
47 	IOCMD_FCPIM_MODSTATS,
48 	IOCMD_FCPIM_DEL_ITN_STATS,
49 	IOCMD_ITNIM_GET_ATTR,
50 	IOCMD_ITNIM_GET_IOSTATS,
51 	IOCMD_ITNIM_GET_ITNSTATS,
52 	IOCMD_IOC_PCIFN_CFG,
53 	IOCMD_FCPORT_ENABLE,
54 	IOCMD_FCPORT_DISABLE,
55 	IOCMD_PCIFN_CREATE,
56 	IOCMD_PCIFN_DELETE,
57 	IOCMD_PCIFN_BW,
58 	IOCMD_ADAPTER_CFG_MODE,
59 	IOCMD_PORT_CFG_MODE,
60 	IOCMD_FLASH_ENABLE_OPTROM,
61 	IOCMD_FLASH_DISABLE_OPTROM,
62 	IOCMD_FAA_ENABLE,
63 	IOCMD_FAA_DISABLE,
64 	IOCMD_FAA_QUERY,
65 	IOCMD_CEE_GET_ATTR,
66 	IOCMD_CEE_GET_STATS,
67 	IOCMD_CEE_RESET_STATS,
68 	IOCMD_SFP_MEDIA,
69 	IOCMD_SFP_SPEED,
70 	IOCMD_FLASH_GET_ATTR,
71 	IOCMD_FLASH_ERASE_PART,
72 	IOCMD_FLASH_UPDATE_PART,
73 	IOCMD_FLASH_READ_PART,
74 	IOCMD_DIAG_TEMP,
75 	IOCMD_DIAG_MEMTEST,
76 	IOCMD_DIAG_LOOPBACK,
77 	IOCMD_DIAG_FWPING,
78 	IOCMD_DIAG_QUEUETEST,
79 	IOCMD_DIAG_SFP,
80 	IOCMD_DIAG_LED,
81 	IOCMD_DIAG_BEACON_LPORT,
82 	IOCMD_DIAG_LB_STAT,
83 	IOCMD_PHY_GET_ATTR,
84 	IOCMD_PHY_GET_STATS,
85 	IOCMD_PHY_UPDATE_FW,
86 	IOCMD_PHY_READ_FW,
87 	IOCMD_VHBA_QUERY,
88 	IOCMD_DEBUG_PORTLOG,
89 };
90 
91 struct bfa_bsg_gen_s {
92 	bfa_status_t	status;
93 	u16		bfad_num;
94 	u16		rsvd;
95 };
96 
97 struct bfa_bsg_ioc_info_s {
98 	bfa_status_t	status;
99 	u16		bfad_num;
100 	u16		rsvd;
101 	char		serialnum[64];
102 	char		hwpath[BFA_STRING_32];
103 	char		adapter_hwpath[BFA_STRING_32];
104 	char		guid[BFA_ADAPTER_SYM_NAME_LEN*2];
105 	char		name[BFA_ADAPTER_SYM_NAME_LEN];
106 	char		port_name[BFA_ADAPTER_SYM_NAME_LEN];
107 	char		eth_name[BFA_ADAPTER_SYM_NAME_LEN];
108 	wwn_t		pwwn;
109 	wwn_t		nwwn;
110 	wwn_t		factorypwwn;
111 	wwn_t		factorynwwn;
112 	mac_t		mac;
113 	mac_t		factory_mac; /* Factory mac address */
114 	mac_t		current_mac; /* Currently assigned mac address */
115 	enum bfa_ioc_type_e	ioc_type;
116 	u16		pvid; /* Port vlan id */
117 	u16		rsvd1;
118 	u32		host;
119 	u32		bandwidth; /* For PF support */
120 	u32		rsvd2;
121 };
122 
123 struct bfa_bsg_ioc_attr_s {
124 	bfa_status_t	status;
125 	u16		bfad_num;
126 	u16		rsvd;
127 	struct bfa_ioc_attr_s  ioc_attr;
128 };
129 
130 struct bfa_bsg_ioc_stats_s {
131 	bfa_status_t	status;
132 	u16		bfad_num;
133 	u16		rsvd;
134 	struct bfa_ioc_stats_s ioc_stats;
135 };
136 
137 struct bfa_bsg_ioc_fwstats_s {
138 	bfa_status_t	status;
139 	u16		bfad_num;
140 	u16		rsvd;
141 	u32		buf_size;
142 	u32		rsvd1;
143 	u64		buf_ptr;
144 };
145 
146 struct bfa_bsg_iocfc_attr_s {
147 	bfa_status_t	status;
148 	u16		bfad_num;
149 	u16		rsvd;
150 	struct bfa_iocfc_attr_s	iocfc_attr;
151 };
152 
153 struct bfa_bsg_iocfc_intr_s {
154 	bfa_status_t	status;
155 	u16		bfad_num;
156 	u16		rsvd;
157 	struct bfa_iocfc_intr_attr_s attr;
158 };
159 
160 struct bfa_bsg_port_attr_s {
161 	bfa_status_t	status;
162 	u16		bfad_num;
163 	u16		rsvd;
164 	struct bfa_port_attr_s	attr;
165 };
166 
167 struct bfa_bsg_port_stats_s {
168 	bfa_status_t	status;
169 	u16		bfad_num;
170 	u16		rsvd;
171 	u32		buf_size;
172 	u32		rsvd1;
173 	u64		buf_ptr;
174 };
175 
176 struct bfa_bsg_lport_attr_s {
177 	bfa_status_t	status;
178 	u16		bfad_num;
179 	u16		vf_id;
180 	wwn_t		pwwn;
181 	struct bfa_lport_attr_s port_attr;
182 };
183 
184 struct bfa_bsg_lport_stats_s {
185 	bfa_status_t	status;
186 	u16		bfad_num;
187 	u16		vf_id;
188 	wwn_t		pwwn;
189 	struct bfa_lport_stats_s port_stats;
190 };
191 
192 struct bfa_bsg_lport_iostats_s {
193 	bfa_status_t	status;
194 	u16		bfad_num;
195 	u16		vf_id;
196 	wwn_t		pwwn;
197 	struct bfa_itnim_iostats_s iostats;
198 };
199 
200 struct bfa_bsg_lport_get_rports_s {
201 	bfa_status_t	status;
202 	u16		bfad_num;
203 	u16		vf_id;
204 	wwn_t		pwwn;
205 	u64		rbuf_ptr;
206 	u32		nrports;
207 	u32		rsvd;
208 };
209 
210 struct bfa_bsg_rport_attr_s {
211 	bfa_status_t	status;
212 	u16		bfad_num;
213 	u16		vf_id;
214 	wwn_t		pwwn;
215 	wwn_t		rpwwn;
216 	struct bfa_rport_attr_s attr;
217 };
218 
219 struct bfa_bsg_rport_stats_s {
220 	bfa_status_t	status;
221 	u16		bfad_num;
222 	u16		vf_id;
223 	wwn_t		pwwn;
224 	wwn_t		rpwwn;
225 	struct bfa_rport_stats_s stats;
226 };
227 
228 struct bfa_bsg_rport_scsi_addr_s {
229 	bfa_status_t	status;
230 	u16		bfad_num;
231 	u16		vf_id;
232 	wwn_t		pwwn;
233 	wwn_t		rpwwn;
234 	u32		host;
235 	u32		bus;
236 	u32		target;
237 	u32		lun;
238 };
239 
240 struct bfa_bsg_fabric_get_lports_s {
241 	bfa_status_t	status;
242 	u16		bfad_num;
243 	u16		vf_id;
244 	u64		buf_ptr;
245 	u32		nports;
246 	u32		rsvd;
247 };
248 
249 struct bfa_bsg_fcpim_modstats_s {
250 	bfa_status_t	status;
251 	u16		bfad_num;
252 	struct bfa_itnim_iostats_s modstats;
253 };
254 
255 struct bfa_bsg_fcpim_del_itn_stats_s {
256 	bfa_status_t	status;
257 	u16		bfad_num;
258 	struct bfa_fcpim_del_itn_stats_s modstats;
259 };
260 
261 struct bfa_bsg_itnim_attr_s {
262 	bfa_status_t	status;
263 	u16		bfad_num;
264 	u16		vf_id;
265 	wwn_t		lpwwn;
266 	wwn_t		rpwwn;
267 	struct bfa_itnim_attr_s	attr;
268 };
269 
270 struct bfa_bsg_itnim_iostats_s {
271 	bfa_status_t	status;
272 	u16		bfad_num;
273 	u16		vf_id;
274 	wwn_t		lpwwn;
275 	wwn_t		rpwwn;
276 	struct bfa_itnim_iostats_s iostats;
277 };
278 
279 struct bfa_bsg_itnim_itnstats_s {
280 	bfa_status_t	status;
281 	u16		bfad_num;
282 	u16		vf_id;
283 	wwn_t		lpwwn;
284 	wwn_t		rpwwn;
285 	struct bfa_itnim_stats_s itnstats;
286 };
287 
288 struct bfa_bsg_pcifn_cfg_s {
289 	bfa_status_t		status;
290 	u16			bfad_num;
291 	u16			rsvd;
292 	struct bfa_ablk_cfg_s	pcifn_cfg;
293 };
294 
295 struct bfa_bsg_pcifn_s {
296 	bfa_status_t		status;
297 	u16			bfad_num;
298 	u16			pcifn_id;
299 	u32			bandwidth;
300 	u8			port;
301 	enum bfi_pcifn_class	pcifn_class;
302 	u8			rsvd[1];
303 };
304 
305 struct bfa_bsg_adapter_cfg_mode_s {
306 	bfa_status_t	status;
307 	u16		bfad_num;
308 	u16		rsvd;
309 	struct bfa_adapter_cfg_mode_s	cfg;
310 };
311 
312 struct bfa_bsg_port_cfg_mode_s {
313 	bfa_status_t	status;
314 	u16		bfad_num;
315 	u16		instance;
316 	struct bfa_port_cfg_mode_s cfg;
317 };
318 
319 struct bfa_bsg_faa_attr_s {
320 	bfa_status_t		status;
321 	u16			bfad_num;
322 	u16			rsvd;
323 	struct bfa_faa_attr_s	faa_attr;
324 };
325 
326 struct bfa_bsg_cee_attr_s {
327 	bfa_status_t	status;
328 	u16		bfad_num;
329 	u16		rsvd;
330 	u32		buf_size;
331 	u32		rsvd1;
332 	u64		buf_ptr;
333 };
334 
335 struct bfa_bsg_cee_stats_s {
336 	bfa_status_t	status;
337 	u16		bfad_num;
338 	u16		rsvd;
339 	u32		buf_size;
340 	u32		rsvd1;
341 	u64		buf_ptr;
342 };
343 
344 struct bfa_bsg_sfp_media_s {
345 	bfa_status_t	status;
346 	u16		bfad_num;
347 	u16		rsvd;
348 	enum bfa_defs_sfp_media_e media;
349 };
350 
351 struct bfa_bsg_sfp_speed_s {
352 	bfa_status_t	status;
353 	u16		bfad_num;
354 	u16		rsvd;
355 	enum bfa_port_speed speed;
356 };
357 
358 struct bfa_bsg_flash_attr_s {
359 	bfa_status_t	status;
360 	u16		bfad_num;
361 	u16		rsvd;
362 	struct bfa_flash_attr_s attr;
363 };
364 
365 struct bfa_bsg_flash_s {
366 	bfa_status_t	status;
367 	u16		bfad_num;
368 	u8		instance;
369 	u8		rsvd;
370 	enum  bfa_flash_part_type type;
371 	int		bufsz;
372 	u64		buf_ptr;
373 };
374 
375 struct bfa_bsg_diag_get_temp_s {
376 	bfa_status_t	status;
377 	u16		bfad_num;
378 	u16		rsvd;
379 	struct bfa_diag_results_tempsensor_s result;
380 };
381 
382 struct bfa_bsg_diag_memtest_s {
383 	bfa_status_t	status;
384 	u16		bfad_num;
385 	u16		rsvd[3];
386 	u32		pat;
387 	struct bfa_diag_memtest_result result;
388 	struct bfa_diag_memtest_s memtest;
389 };
390 
391 struct bfa_bsg_diag_loopback_s {
392 	bfa_status_t	status;
393 	u16		bfad_num;
394 	u16		rsvd;
395 	enum bfa_port_opmode opmode;
396 	enum bfa_port_speed speed;
397 	u32		lpcnt;
398 	u32		pat;
399 	struct bfa_diag_loopback_result_s result;
400 };
401 
402 struct bfa_bsg_diag_fwping_s {
403 	bfa_status_t	status;
404 	u16		bfad_num;
405 	u16		rsvd;
406 	u32		cnt;
407 	u32		pattern;
408 	struct bfa_diag_results_fwping result;
409 };
410 
411 struct bfa_bsg_diag_qtest_s {
412 	bfa_status_t	status;
413 	u16	bfad_num;
414 	u16	rsvd;
415 	u32	force;
416 	u32	queue;
417 	struct bfa_diag_qtest_result_s result;
418 };
419 
420 struct bfa_bsg_sfp_show_s {
421 	bfa_status_t	status;
422 	u16		bfad_num;
423 	u16		rsvd;
424 	struct sfp_mem_s sfp;
425 };
426 
427 struct bfa_bsg_diag_led_s {
428 	bfa_status_t	status;
429 	u16		bfad_num;
430 	u16		rsvd;
431 	struct bfa_diag_ledtest_s ledtest;
432 };
433 
434 struct bfa_bsg_diag_beacon_s {
435 	bfa_status_t	status;
436 	u16		bfad_num;
437 	u16		rsvd;
438 	bfa_boolean_t   beacon;
439 	bfa_boolean_t   link_e2e_beacon;
440 	u32		second;
441 };
442 
443 struct bfa_bsg_diag_lb_stat_s {
444 	bfa_status_t	status;
445 	u16		bfad_num;
446 	u16		rsvd;
447 };
448 
449 struct bfa_bsg_phy_attr_s {
450 	bfa_status_t	status;
451 	u16	bfad_num;
452 	u16	instance;
453 	struct bfa_phy_attr_s	attr;
454 };
455 
456 struct bfa_bsg_phy_s {
457 	bfa_status_t	status;
458 	u16	bfad_num;
459 	u16	instance;
460 	u64	bufsz;
461 	u64	buf_ptr;
462 };
463 
464 struct bfa_bsg_debug_s {
465 	bfa_status_t	status;
466 	u16		bfad_num;
467 	u16		rsvd;
468 	u32		bufsz;
469 	int		inst_no;
470 	u64		buf_ptr;
471 	u64		offset;
472 };
473 
474 struct bfa_bsg_phy_stats_s {
475 	bfa_status_t	status;
476 	u16	bfad_num;
477 	u16	instance;
478 	struct bfa_phy_stats_s	stats;
479 };
480 
481 struct bfa_bsg_vhba_attr_s {
482 	bfa_status_t	status;
483 	u16		bfad_num;
484 	u16		pcifn_id;
485 	struct bfa_vhba_attr_s	attr;
486 };
487 
488 struct bfa_bsg_fcpt_s {
489 	bfa_status_t    status;
490 	u16		vf_id;
491 	wwn_t		lpwwn;
492 	wwn_t		dpwwn;
493 	u32		tsecs;
494 	int		cts;
495 	enum fc_cos	cos;
496 	struct fchs_s	fchs;
497 };
498 #define bfa_bsg_fcpt_t struct bfa_bsg_fcpt_s
499 
500 struct bfa_bsg_data {
501 	int payload_len;
502 	void *payload;
503 };
504 
505 #define bfad_chk_iocmd_sz(__payload_len, __hdrsz, __bufsz)	\
506 	(((__payload_len) != ((__hdrsz) + (__bufsz))) ?		\
507 	 BFA_STATUS_FAILED : BFA_STATUS_OK)
508 
509 #endif /* BFAD_BSG_H */
510