[SCSI] bfa: Enable ASIC block configuration and query.
[cascardo/linux.git] / drivers / scsi / bfa / bfad_bsg.h
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_GET_ATTR = 0x1,
28         IOCMD_IOC_GET_INFO,
29         IOCMD_PORT_GET_ATTR,
30         IOCMD_LPORT_GET_ATTR,
31         IOCMD_RPORT_GET_ADDR,
32         IOCMD_FABRIC_GET_LPORTS,
33         IOCMD_ITNIM_GET_ATTR,
34         IOCMD_IOC_PCIFN_CFG,
35         IOCMD_PCIFN_CREATE,
36         IOCMD_PCIFN_DELETE,
37         IOCMD_PCIFN_BW,
38         IOCMD_ADAPTER_CFG_MODE,
39         IOCMD_PORT_CFG_MODE,
40         IOCMD_FLASH_ENABLE_OPTROM,
41         IOCMD_FLASH_DISABLE_OPTROM,
42 };
43
44 struct bfa_bsg_gen_s {
45         bfa_status_t    status;
46         u16             bfad_num;
47         u16             rsvd;
48 };
49
50 struct bfa_bsg_ioc_info_s {
51         bfa_status_t    status;
52         u16             bfad_num;
53         u16             rsvd;
54         char            serialnum[64];
55         char            hwpath[BFA_STRING_32];
56         char            adapter_hwpath[BFA_STRING_32];
57         char            guid[BFA_ADAPTER_SYM_NAME_LEN*2];
58         char            name[BFA_ADAPTER_SYM_NAME_LEN];
59         char            port_name[BFA_ADAPTER_SYM_NAME_LEN];
60         char            eth_name[BFA_ADAPTER_SYM_NAME_LEN];
61         wwn_t           pwwn;
62         wwn_t           nwwn;
63         wwn_t           factorypwwn;
64         wwn_t           factorynwwn;
65         mac_t           mac;
66         mac_t           factory_mac; /* Factory mac address */
67         mac_t           current_mac; /* Currently assigned mac address */
68         enum bfa_ioc_type_e     ioc_type;
69         u16             pvid; /* Port vlan id */
70         u16             rsvd1;
71         u32             host;
72         u32             bandwidth; /* For PF support */
73         u32             rsvd2;
74 };
75
76 struct bfa_bsg_ioc_attr_s {
77         bfa_status_t    status;
78         u16             bfad_num;
79         u16             rsvd;
80         struct bfa_ioc_attr_s  ioc_attr;
81 };
82
83 struct bfa_bsg_port_attr_s {
84         bfa_status_t    status;
85         u16             bfad_num;
86         u16             rsvd;
87         struct bfa_port_attr_s  attr;
88 };
89
90 struct bfa_bsg_lport_attr_s {
91         bfa_status_t    status;
92         u16             bfad_num;
93         u16             vf_id;
94         wwn_t           pwwn;
95         struct bfa_lport_attr_s port_attr;
96 };
97
98 struct bfa_bsg_rport_scsi_addr_s {
99         bfa_status_t    status;
100         u16             bfad_num;
101         u16             vf_id;
102         wwn_t           pwwn;
103         wwn_t           rpwwn;
104         u32             host;
105         u32             bus;
106         u32             target;
107         u32             lun;
108 };
109
110 struct bfa_bsg_fabric_get_lports_s {
111         bfa_status_t    status;
112         u16             bfad_num;
113         u16             vf_id;
114         u64             buf_ptr;
115         u32             nports;
116         u32             rsvd;
117 };
118
119 struct bfa_bsg_itnim_attr_s {
120         bfa_status_t    status;
121         u16             bfad_num;
122         u16             vf_id;
123         wwn_t           lpwwn;
124         wwn_t           rpwwn;
125         struct bfa_itnim_attr_s attr;
126 };
127
128 struct bfa_bsg_pcifn_cfg_s {
129         bfa_status_t            status;
130         u16                     bfad_num;
131         u16                     rsvd;
132         struct bfa_ablk_cfg_s   pcifn_cfg;
133 };
134
135 struct bfa_bsg_pcifn_s {
136         bfa_status_t            status;
137         u16                     bfad_num;
138         u16                     pcifn_id;
139         u32                     bandwidth;
140         u8                      port;
141         enum bfi_pcifn_class    pcifn_class;
142         u8                      rsvd[1];
143 };
144
145 struct bfa_bsg_adapter_cfg_mode_s {
146         bfa_status_t    status;
147         u16             bfad_num;
148         u16             rsvd;
149         struct bfa_adapter_cfg_mode_s   cfg;
150 };
151
152 struct bfa_bsg_port_cfg_mode_s {
153         bfa_status_t    status;
154         u16             bfad_num;
155         u16             instance;
156         struct bfa_port_cfg_mode_s cfg;
157 };
158
159 struct bfa_bsg_fcpt_s {
160         bfa_status_t    status;
161         u16             vf_id;
162         wwn_t           lpwwn;
163         wwn_t           dpwwn;
164         u32             tsecs;
165         int             cts;
166         enum fc_cos     cos;
167         struct fchs_s   fchs;
168 };
169 #define bfa_bsg_fcpt_t struct bfa_bsg_fcpt_s
170
171 struct bfa_bsg_data {
172         int payload_len;
173         void *payload;
174 };
175
176 #define bfad_chk_iocmd_sz(__payload_len, __hdrsz, __bufsz)      \
177         (((__payload_len) != ((__hdrsz) + (__bufsz))) ?         \
178          BFA_STATUS_FAILED : BFA_STATUS_OK)
179
180 #endif /* BFAD_BSG_H */