MIPS: Yosemite, Emma: Fix off-by-two in arcs_cmdline buffer size check
[linux-2.6/linux-mips.git] / drivers / scsi / bfa / bfad_bsg.h
blobe859adb9aa9e807ae779e2ddb5444ec31bc7400b
1 /*
2 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
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
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.
17 #ifndef BFAD_BSG_H
18 #define BFAD_BSG_H
20 #include "bfa_defs.h"
21 #include "bfa_defs_fcs.h"
23 /* Definitions of vendor unique structures and command codes passed in
24 * using FC_BSG_HST_VENDOR message code.
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_IOC_RESET_STATS,
34 IOCMD_IOC_RESET_FWSTATS,
35 IOCMD_IOC_SET_ADAPTER_NAME,
36 IOCMD_IOC_SET_PORT_NAME,
37 IOCMD_IOCFC_GET_ATTR,
38 IOCMD_IOCFC_SET_INTR,
39 IOCMD_PORT_ENABLE,
40 IOCMD_PORT_DISABLE,
41 IOCMD_PORT_GET_ATTR,
42 IOCMD_PORT_GET_STATS,
43 IOCMD_PORT_RESET_STATS,
44 IOCMD_PORT_CFG_TOPO,
45 IOCMD_PORT_CFG_SPEED,
46 IOCMD_PORT_CFG_ALPA,
47 IOCMD_PORT_CFG_MAXFRSZ,
48 IOCMD_PORT_CLR_ALPA,
49 IOCMD_PORT_BBSC_ENABLE,
50 IOCMD_PORT_BBSC_DISABLE,
51 IOCMD_LPORT_GET_ATTR,
52 IOCMD_LPORT_GET_RPORTS,
53 IOCMD_LPORT_GET_STATS,
54 IOCMD_LPORT_RESET_STATS,
55 IOCMD_LPORT_GET_IOSTATS,
56 IOCMD_RPORT_GET_ATTR,
57 IOCMD_RPORT_GET_ADDR,
58 IOCMD_RPORT_GET_STATS,
59 IOCMD_RPORT_RESET_STATS,
60 IOCMD_RPORT_SET_SPEED,
61 IOCMD_VPORT_GET_ATTR,
62 IOCMD_VPORT_GET_STATS,
63 IOCMD_VPORT_RESET_STATS,
64 IOCMD_FABRIC_GET_LPORTS,
65 IOCMD_RATELIM_ENABLE,
66 IOCMD_RATELIM_DISABLE,
67 IOCMD_RATELIM_DEF_SPEED,
68 IOCMD_FCPIM_FAILOVER,
69 IOCMD_FCPIM_MODSTATS,
70 IOCMD_FCPIM_MODSTATSCLR,
71 IOCMD_FCPIM_DEL_ITN_STATS,
72 IOCMD_ITNIM_GET_ATTR,
73 IOCMD_ITNIM_GET_IOSTATS,
74 IOCMD_ITNIM_RESET_STATS,
75 IOCMD_ITNIM_GET_ITNSTATS,
76 IOCMD_IOC_PCIFN_CFG,
77 IOCMD_FCPORT_ENABLE,
78 IOCMD_FCPORT_DISABLE,
79 IOCMD_PCIFN_CREATE,
80 IOCMD_PCIFN_DELETE,
81 IOCMD_PCIFN_BW,
82 IOCMD_ADAPTER_CFG_MODE,
83 IOCMD_PORT_CFG_MODE,
84 IOCMD_FLASH_ENABLE_OPTROM,
85 IOCMD_FLASH_DISABLE_OPTROM,
86 IOCMD_FAA_ENABLE,
87 IOCMD_FAA_DISABLE,
88 IOCMD_FAA_QUERY,
89 IOCMD_CEE_GET_ATTR,
90 IOCMD_CEE_GET_STATS,
91 IOCMD_CEE_RESET_STATS,
92 IOCMD_SFP_MEDIA,
93 IOCMD_SFP_SPEED,
94 IOCMD_FLASH_GET_ATTR,
95 IOCMD_FLASH_ERASE_PART,
96 IOCMD_FLASH_UPDATE_PART,
97 IOCMD_FLASH_READ_PART,
98 IOCMD_DIAG_TEMP,
99 IOCMD_DIAG_MEMTEST,
100 IOCMD_DIAG_LOOPBACK,
101 IOCMD_DIAG_FWPING,
102 IOCMD_DIAG_QUEUETEST,
103 IOCMD_DIAG_SFP,
104 IOCMD_DIAG_LED,
105 IOCMD_DIAG_BEACON_LPORT,
106 IOCMD_DIAG_LB_STAT,
107 IOCMD_PHY_GET_ATTR,
108 IOCMD_PHY_GET_STATS,
109 IOCMD_PHY_UPDATE_FW,
110 IOCMD_PHY_READ_FW,
111 IOCMD_VHBA_QUERY,
112 IOCMD_DEBUG_PORTLOG,
113 IOCMD_DEBUG_FW_CORE,
114 IOCMD_DEBUG_FW_STATE_CLR,
115 IOCMD_DEBUG_PORTLOG_CLR,
116 IOCMD_DEBUG_START_DTRC,
117 IOCMD_DEBUG_STOP_DTRC,
118 IOCMD_DEBUG_PORTLOG_CTL,
119 IOCMD_FCPIM_PROFILE_ON,
120 IOCMD_FCPIM_PROFILE_OFF,
121 IOCMD_ITNIM_GET_IOPROFILE,
122 IOCMD_FCPORT_GET_STATS,
123 IOCMD_FCPORT_RESET_STATS,
124 IOCMD_BOOT_CFG,
125 IOCMD_BOOT_QUERY,
126 IOCMD_PREBOOT_QUERY,
127 IOCMD_ETHBOOT_CFG,
128 IOCMD_ETHBOOT_QUERY,
129 IOCMD_TRUNK_ENABLE,
130 IOCMD_TRUNK_DISABLE,
131 IOCMD_TRUNK_GET_ATTR,
132 IOCMD_QOS_ENABLE,
133 IOCMD_QOS_DISABLE,
134 IOCMD_QOS_GET_ATTR,
135 IOCMD_QOS_GET_VC_ATTR,
136 IOCMD_QOS_GET_STATS,
137 IOCMD_QOS_RESET_STATS,
138 IOCMD_VF_GET_STATS,
139 IOCMD_VF_RESET_STATS,
140 IOCMD_FCPIM_LUNMASK_ENABLE,
141 IOCMD_FCPIM_LUNMASK_DISABLE,
142 IOCMD_FCPIM_LUNMASK_CLEAR,
143 IOCMD_FCPIM_LUNMASK_QUERY,
144 IOCMD_FCPIM_LUNMASK_ADD,
145 IOCMD_FCPIM_LUNMASK_DELETE,
148 struct bfa_bsg_gen_s {
149 bfa_status_t status;
150 u16 bfad_num;
151 u16 rsvd;
154 struct bfa_bsg_portlogctl_s {
155 bfa_status_t status;
156 u16 bfad_num;
157 u16 rsvd;
158 bfa_boolean_t ctl;
159 int inst_no;
162 struct bfa_bsg_fcpim_profile_s {
163 bfa_status_t status;
164 u16 bfad_num;
165 u16 rsvd;
168 struct bfa_bsg_itnim_ioprofile_s {
169 bfa_status_t status;
170 u16 bfad_num;
171 u16 vf_id;
172 wwn_t lpwwn;
173 wwn_t rpwwn;
174 struct bfa_itnim_ioprofile_s ioprofile;
177 struct bfa_bsg_fcport_stats_s {
178 bfa_status_t status;
179 u16 bfad_num;
180 u16 rsvd;
181 union bfa_fcport_stats_u stats;
184 struct bfa_bsg_ioc_name_s {
185 bfa_status_t status;
186 u16 bfad_num;
187 u16 rsvd;
188 char name[BFA_ADAPTER_SYM_NAME_LEN];
191 struct bfa_bsg_ioc_info_s {
192 bfa_status_t status;
193 u16 bfad_num;
194 u16 rsvd;
195 char serialnum[64];
196 char hwpath[BFA_STRING_32];
197 char adapter_hwpath[BFA_STRING_32];
198 char guid[BFA_ADAPTER_SYM_NAME_LEN*2];
199 char name[BFA_ADAPTER_SYM_NAME_LEN];
200 char port_name[BFA_ADAPTER_SYM_NAME_LEN];
201 char eth_name[BFA_ADAPTER_SYM_NAME_LEN];
202 wwn_t pwwn;
203 wwn_t nwwn;
204 wwn_t factorypwwn;
205 wwn_t factorynwwn;
206 mac_t mac;
207 mac_t factory_mac; /* Factory mac address */
208 mac_t current_mac; /* Currently assigned mac address */
209 enum bfa_ioc_type_e ioc_type;
210 u16 pvid; /* Port vlan id */
211 u16 rsvd1;
212 u32 host;
213 u32 bandwidth; /* For PF support */
214 u32 rsvd2;
217 struct bfa_bsg_ioc_attr_s {
218 bfa_status_t status;
219 u16 bfad_num;
220 u16 rsvd;
221 struct bfa_ioc_attr_s ioc_attr;
224 struct bfa_bsg_ioc_stats_s {
225 bfa_status_t status;
226 u16 bfad_num;
227 u16 rsvd;
228 struct bfa_ioc_stats_s ioc_stats;
231 struct bfa_bsg_ioc_fwstats_s {
232 bfa_status_t status;
233 u16 bfad_num;
234 u16 rsvd;
235 u32 buf_size;
236 u32 rsvd1;
237 u64 buf_ptr;
240 struct bfa_bsg_iocfc_attr_s {
241 bfa_status_t status;
242 u16 bfad_num;
243 u16 rsvd;
244 struct bfa_iocfc_attr_s iocfc_attr;
247 struct bfa_bsg_iocfc_intr_s {
248 bfa_status_t status;
249 u16 bfad_num;
250 u16 rsvd;
251 struct bfa_iocfc_intr_attr_s attr;
254 struct bfa_bsg_port_attr_s {
255 bfa_status_t status;
256 u16 bfad_num;
257 u16 rsvd;
258 struct bfa_port_attr_s attr;
261 struct bfa_bsg_port_cfg_s {
262 bfa_status_t status;
263 u16 bfad_num;
264 u16 rsvd;
265 u32 param;
266 u32 rsvd1;
269 struct bfa_bsg_port_cfg_maxfrsize_s {
270 bfa_status_t status;
271 u16 bfad_num;
272 u16 maxfrsize;
275 struct bfa_bsg_port_stats_s {
276 bfa_status_t status;
277 u16 bfad_num;
278 u16 rsvd;
279 u32 buf_size;
280 u32 rsvd1;
281 u64 buf_ptr;
284 struct bfa_bsg_lport_attr_s {
285 bfa_status_t status;
286 u16 bfad_num;
287 u16 vf_id;
288 wwn_t pwwn;
289 struct bfa_lport_attr_s port_attr;
292 struct bfa_bsg_lport_stats_s {
293 bfa_status_t status;
294 u16 bfad_num;
295 u16 vf_id;
296 wwn_t pwwn;
297 struct bfa_lport_stats_s port_stats;
300 struct bfa_bsg_lport_iostats_s {
301 bfa_status_t status;
302 u16 bfad_num;
303 u16 vf_id;
304 wwn_t pwwn;
305 struct bfa_itnim_iostats_s iostats;
308 struct bfa_bsg_lport_get_rports_s {
309 bfa_status_t status;
310 u16 bfad_num;
311 u16 vf_id;
312 wwn_t pwwn;
313 u64 rbuf_ptr;
314 u32 nrports;
315 u32 rsvd;
318 struct bfa_bsg_rport_attr_s {
319 bfa_status_t status;
320 u16 bfad_num;
321 u16 vf_id;
322 wwn_t pwwn;
323 wwn_t rpwwn;
324 struct bfa_rport_attr_s attr;
327 struct bfa_bsg_rport_stats_s {
328 bfa_status_t status;
329 u16 bfad_num;
330 u16 vf_id;
331 wwn_t pwwn;
332 wwn_t rpwwn;
333 struct bfa_rport_stats_s stats;
336 struct bfa_bsg_rport_scsi_addr_s {
337 bfa_status_t status;
338 u16 bfad_num;
339 u16 vf_id;
340 wwn_t pwwn;
341 wwn_t rpwwn;
342 u32 host;
343 u32 bus;
344 u32 target;
345 u32 lun;
348 struct bfa_bsg_rport_reset_stats_s {
349 bfa_status_t status;
350 u16 bfad_num;
351 u16 vf_id;
352 wwn_t pwwn;
353 wwn_t rpwwn;
356 struct bfa_bsg_rport_set_speed_s {
357 bfa_status_t status;
358 u16 bfad_num;
359 u16 vf_id;
360 enum bfa_port_speed speed;
361 u32 rsvd;
362 wwn_t pwwn;
363 wwn_t rpwwn;
366 struct bfa_bsg_vport_attr_s {
367 bfa_status_t status;
368 u16 bfad_num;
369 u16 vf_id;
370 wwn_t vpwwn;
371 struct bfa_vport_attr_s vport_attr;
374 struct bfa_bsg_vport_stats_s {
375 bfa_status_t status;
376 u16 bfad_num;
377 u16 vf_id;
378 wwn_t vpwwn;
379 struct bfa_vport_stats_s vport_stats;
382 struct bfa_bsg_reset_stats_s {
383 bfa_status_t status;
384 u16 bfad_num;
385 u16 vf_id;
386 wwn_t vpwwn;
389 struct bfa_bsg_fabric_get_lports_s {
390 bfa_status_t status;
391 u16 bfad_num;
392 u16 vf_id;
393 u64 buf_ptr;
394 u32 nports;
395 u32 rsvd;
398 struct bfa_bsg_trl_speed_s {
399 bfa_status_t status;
400 u16 bfad_num;
401 u16 rsvd;
402 enum bfa_port_speed speed;
405 struct bfa_bsg_fcpim_s {
406 bfa_status_t status;
407 u16 bfad_num;
408 u16 param;
411 struct bfa_bsg_fcpim_modstats_s {
412 bfa_status_t status;
413 u16 bfad_num;
414 struct bfa_itnim_iostats_s modstats;
417 struct bfa_bsg_fcpim_del_itn_stats_s {
418 bfa_status_t status;
419 u16 bfad_num;
420 struct bfa_fcpim_del_itn_stats_s modstats;
423 struct bfa_bsg_fcpim_modstatsclr_s {
424 bfa_status_t status;
425 u16 bfad_num;
428 struct bfa_bsg_itnim_attr_s {
429 bfa_status_t status;
430 u16 bfad_num;
431 u16 vf_id;
432 wwn_t lpwwn;
433 wwn_t rpwwn;
434 struct bfa_itnim_attr_s attr;
437 struct bfa_bsg_itnim_iostats_s {
438 bfa_status_t status;
439 u16 bfad_num;
440 u16 vf_id;
441 wwn_t lpwwn;
442 wwn_t rpwwn;
443 struct bfa_itnim_iostats_s iostats;
446 struct bfa_bsg_itnim_itnstats_s {
447 bfa_status_t status;
448 u16 bfad_num;
449 u16 vf_id;
450 wwn_t lpwwn;
451 wwn_t rpwwn;
452 struct bfa_itnim_stats_s itnstats;
455 struct bfa_bsg_pcifn_cfg_s {
456 bfa_status_t status;
457 u16 bfad_num;
458 u16 rsvd;
459 struct bfa_ablk_cfg_s pcifn_cfg;
462 struct bfa_bsg_pcifn_s {
463 bfa_status_t status;
464 u16 bfad_num;
465 u16 pcifn_id;
466 u32 bandwidth;
467 u8 port;
468 enum bfi_pcifn_class pcifn_class;
469 u8 rsvd[1];
472 struct bfa_bsg_adapter_cfg_mode_s {
473 bfa_status_t status;
474 u16 bfad_num;
475 u16 rsvd;
476 struct bfa_adapter_cfg_mode_s cfg;
479 struct bfa_bsg_port_cfg_mode_s {
480 bfa_status_t status;
481 u16 bfad_num;
482 u16 instance;
483 struct bfa_port_cfg_mode_s cfg;
486 struct bfa_bsg_faa_attr_s {
487 bfa_status_t status;
488 u16 bfad_num;
489 u16 rsvd;
490 struct bfa_faa_attr_s faa_attr;
493 struct bfa_bsg_cee_attr_s {
494 bfa_status_t status;
495 u16 bfad_num;
496 u16 rsvd;
497 u32 buf_size;
498 u32 rsvd1;
499 u64 buf_ptr;
502 struct bfa_bsg_cee_stats_s {
503 bfa_status_t status;
504 u16 bfad_num;
505 u16 rsvd;
506 u32 buf_size;
507 u32 rsvd1;
508 u64 buf_ptr;
511 struct bfa_bsg_sfp_media_s {
512 bfa_status_t status;
513 u16 bfad_num;
514 u16 rsvd;
515 enum bfa_defs_sfp_media_e media;
518 struct bfa_bsg_sfp_speed_s {
519 bfa_status_t status;
520 u16 bfad_num;
521 u16 rsvd;
522 enum bfa_port_speed speed;
525 struct bfa_bsg_flash_attr_s {
526 bfa_status_t status;
527 u16 bfad_num;
528 u16 rsvd;
529 struct bfa_flash_attr_s attr;
532 struct bfa_bsg_flash_s {
533 bfa_status_t status;
534 u16 bfad_num;
535 u8 instance;
536 u8 rsvd;
537 enum bfa_flash_part_type type;
538 int bufsz;
539 u64 buf_ptr;
542 struct bfa_bsg_diag_get_temp_s {
543 bfa_status_t status;
544 u16 bfad_num;
545 u16 rsvd;
546 struct bfa_diag_results_tempsensor_s result;
549 struct bfa_bsg_diag_memtest_s {
550 bfa_status_t status;
551 u16 bfad_num;
552 u16 rsvd[3];
553 u32 pat;
554 struct bfa_diag_memtest_result result;
555 struct bfa_diag_memtest_s memtest;
558 struct bfa_bsg_diag_loopback_s {
559 bfa_status_t status;
560 u16 bfad_num;
561 u16 rsvd;
562 enum bfa_port_opmode opmode;
563 enum bfa_port_speed speed;
564 u32 lpcnt;
565 u32 pat;
566 struct bfa_diag_loopback_result_s result;
569 struct bfa_bsg_diag_fwping_s {
570 bfa_status_t status;
571 u16 bfad_num;
572 u16 rsvd;
573 u32 cnt;
574 u32 pattern;
575 struct bfa_diag_results_fwping result;
578 struct bfa_bsg_diag_qtest_s {
579 bfa_status_t status;
580 u16 bfad_num;
581 u16 rsvd;
582 u32 force;
583 u32 queue;
584 struct bfa_diag_qtest_result_s result;
587 struct bfa_bsg_sfp_show_s {
588 bfa_status_t status;
589 u16 bfad_num;
590 u16 rsvd;
591 struct sfp_mem_s sfp;
594 struct bfa_bsg_diag_led_s {
595 bfa_status_t status;
596 u16 bfad_num;
597 u16 rsvd;
598 struct bfa_diag_ledtest_s ledtest;
601 struct bfa_bsg_diag_beacon_s {
602 bfa_status_t status;
603 u16 bfad_num;
604 u16 rsvd;
605 bfa_boolean_t beacon;
606 bfa_boolean_t link_e2e_beacon;
607 u32 second;
610 struct bfa_bsg_diag_lb_stat_s {
611 bfa_status_t status;
612 u16 bfad_num;
613 u16 rsvd;
616 struct bfa_bsg_phy_attr_s {
617 bfa_status_t status;
618 u16 bfad_num;
619 u16 instance;
620 struct bfa_phy_attr_s attr;
623 struct bfa_bsg_phy_s {
624 bfa_status_t status;
625 u16 bfad_num;
626 u16 instance;
627 u64 bufsz;
628 u64 buf_ptr;
631 struct bfa_bsg_debug_s {
632 bfa_status_t status;
633 u16 bfad_num;
634 u16 rsvd;
635 u32 bufsz;
636 int inst_no;
637 u64 buf_ptr;
638 u64 offset;
641 struct bfa_bsg_phy_stats_s {
642 bfa_status_t status;
643 u16 bfad_num;
644 u16 instance;
645 struct bfa_phy_stats_s stats;
648 struct bfa_bsg_vhba_attr_s {
649 bfa_status_t status;
650 u16 bfad_num;
651 u16 pcifn_id;
652 struct bfa_vhba_attr_s attr;
655 struct bfa_bsg_boot_s {
656 bfa_status_t status;
657 u16 bfad_num;
658 u16 rsvd;
659 struct bfa_boot_cfg_s cfg;
662 struct bfa_bsg_preboot_s {
663 bfa_status_t status;
664 u16 bfad_num;
665 u16 rsvd;
666 struct bfa_boot_pbc_s cfg;
669 struct bfa_bsg_ethboot_s {
670 bfa_status_t status;
671 u16 bfad_num;
672 u16 rsvd;
673 struct bfa_ethboot_cfg_s cfg;
676 struct bfa_bsg_trunk_attr_s {
677 bfa_status_t status;
678 u16 bfad_num;
679 u16 rsvd;
680 struct bfa_trunk_attr_s attr;
683 struct bfa_bsg_qos_attr_s {
684 bfa_status_t status;
685 u16 bfad_num;
686 u16 rsvd;
687 struct bfa_qos_attr_s attr;
690 struct bfa_bsg_qos_vc_attr_s {
691 bfa_status_t status;
692 u16 bfad_num;
693 u16 rsvd;
694 struct bfa_qos_vc_attr_s attr;
697 struct bfa_bsg_vf_stats_s {
698 bfa_status_t status;
699 u16 bfad_num;
700 u16 vf_id;
701 struct bfa_vf_stats_s stats;
704 struct bfa_bsg_vf_reset_stats_s {
705 bfa_status_t status;
706 u16 bfad_num;
707 u16 vf_id;
710 struct bfa_bsg_fcpim_lunmask_query_s {
711 bfa_status_t status;
712 u16 bfad_num;
713 struct bfa_lunmask_cfg_s lun_mask;
716 struct bfa_bsg_fcpim_lunmask_s {
717 bfa_status_t status;
718 u16 bfad_num;
719 u16 vf_id;
720 wwn_t pwwn;
721 wwn_t rpwwn;
722 struct scsi_lun lun;
725 struct bfa_bsg_fcpt_s {
726 bfa_status_t status;
727 u16 vf_id;
728 wwn_t lpwwn;
729 wwn_t dpwwn;
730 u32 tsecs;
731 int cts;
732 enum fc_cos cos;
733 struct fchs_s fchs;
735 #define bfa_bsg_fcpt_t struct bfa_bsg_fcpt_s
737 struct bfa_bsg_data {
738 int payload_len;
739 void *payload;
742 #define bfad_chk_iocmd_sz(__payload_len, __hdrsz, __bufsz) \
743 (((__payload_len) != ((__hdrsz) + (__bufsz))) ? \
744 BFA_STATUS_FAILED : BFA_STATUS_OK)
746 #endif /* BFAD_BSG_H */