1 /*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2010-2015 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. *
8 * This program is free software; you can redistribute it and/or *
9 * modify it under the terms of version 2 of the GNU General *
10 * Public License as published by the Free Software Foundation. *
11 * This program is distributed in the hope that it will be useful. *
12 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
13 * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
14 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
15 * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
16 * TO BE LEGALLY INVALID. See the GNU General Public License for *
17 * more details, a copy of which can be found in the file COPYING *
18 * included with this package. *
19 *******************************************************************/
21 * No pointers to user data are allowed, all application buffers and sizes will
22 * derived through the bsg interface.
24 * These are the vendor unique structures passed in using the bsg
25 * FC_BSG_HST_VENDOR message code type.
27 #define LPFC_BSG_VENDOR_SET_CT_EVENT 1
28 #define LPFC_BSG_VENDOR_GET_CT_EVENT 2
29 #define LPFC_BSG_VENDOR_SEND_MGMT_RESP 3
30 #define LPFC_BSG_VENDOR_DIAG_MODE 4
31 #define LPFC_BSG_VENDOR_DIAG_RUN_LOOPBACK 5
32 #define LPFC_BSG_VENDOR_GET_MGMT_REV 6
33 #define LPFC_BSG_VENDOR_MBOX 7
34 #define LPFC_BSG_VENDOR_MENLO_CMD 8
35 #define LPFC_BSG_VENDOR_MENLO_DATA 9
36 #define LPFC_BSG_VENDOR_DIAG_MODE_END 10
37 #define LPFC_BSG_VENDOR_LINK_DIAG_TEST 11
38 #define LPFC_BSG_VENDOR_FORCED_LINK_SPEED 14
53 struct get_ct_event_reply {
58 struct send_mgmt_resp {
64 #define INTERNAL_LOOP_BACK 0x1 /* adapter short cuts the loop internally */
65 #define EXTERNAL_LOOP_BACK 0x2 /* requires an external loopback plug */
67 struct diag_mode_set {
73 struct sli4_link_diag {
78 uint32_t test_version;
79 uint32_t error_action;
82 struct diag_mode_test {
89 uint32_t shdr_add_status;
92 #define LPFC_WWNN_TYPE 0
93 #define LPFC_WWPN_TYPE 1
99 #define MANAGEMENT_MAJOR_REV 1
100 #define MANAGEMENT_MINOR_REV 1
102 /* the MgmtRevInfo structure */
108 struct get_mgmt_rev_reply {
109 struct MgmtRevInfo info;
112 #define BSG_MBOX_SIZE 4096 /* mailbox command plus extended data */
114 /* BSG mailbox request header */
115 struct dfc_mbox_req {
124 /* Used for menlo command or menlo data. The xri is only used for menlo data */
125 struct menlo_command {
130 struct menlo_response {
131 uint32_t xri; /* return the xri of the iocb exchange */
135 * macros and data structures for handling sli-config mailbox command
136 * pass-through support, this header file is shared between user and
137 * kernel spaces, note the set of macros are duplicates from lpfc_hw4.h,
138 * with macro names prefixed with bsg_, as the macros defined in
139 * lpfc_hw4.h are not accessible from user space.
142 /* Macros to deal with bit fields. Each bit field must have 3 #defines
143 * associated with it (_SHIFT, _MASK, and _WORD).
144 * EG. For a bit field that is in the 7th bit of the "field4" field of a
145 * structure and is 2 bits in size the following #defines must exist:
151 * #define example_bit_field_SHIFT 7
152 * #define example_bit_field_MASK 0x03
153 * #define example_bit_field_WORD field4
156 * Then the macros below may be used to get or set the value of that field.
157 * EG. To get the value of the bit field from the above example:
159 * value = bsg_bf_get(example_bit_field, &t1);
160 * And then to set that bit field:
161 * bsg_bf_set(example_bit_field, &t1, 2);
162 * Or clear that bit field:
163 * bsg_bf_set(example_bit_field, &t1, 0);
165 #define bsg_bf_get_le32(name, ptr) \
166 ((le32_to_cpu((ptr)->name##_WORD) >> name##_SHIFT) & name##_MASK)
167 #define bsg_bf_get(name, ptr) \
168 (((ptr)->name##_WORD >> name##_SHIFT) & name##_MASK)
169 #define bsg_bf_set_le32(name, ptr, value) \
170 ((ptr)->name##_WORD = cpu_to_le32(((((value) & \
171 name##_MASK) << name##_SHIFT) | (le32_to_cpu((ptr)->name##_WORD) & \
172 ~(name##_MASK << name##_SHIFT)))))
173 #define bsg_bf_set(name, ptr, value) \
174 ((ptr)->name##_WORD = ((((value) & name##_MASK) << name##_SHIFT) | \
175 ((ptr)->name##_WORD & ~(name##_MASK << name##_SHIFT))))
178 * The sli_config structure specified here is based on the following
181 * -- SLI_CONFIG EMB=0, carrying MSEs, will carry subcommands without
183 * -- SLI_CONFIG EMB=1, not carrying MSE, will carry subcommands with or
184 * without carrying HBDs.
187 struct lpfc_sli_config_mse {
191 #define lpfc_mbox_sli_config_mse_len_SHIFT 0
192 #define lpfc_mbox_sli_config_mse_len_MASK 0xffffff
193 #define lpfc_mbox_sli_config_mse_len_WORD buf_len
196 struct lpfc_sli_config_hbd {
198 #define lpfc_mbox_sli_config_ecmn_hbd_len_SHIFT 0
199 #define lpfc_mbox_sli_config_ecmn_hbd_len_MASK 0xffffff
200 #define lpfc_mbox_sli_config_ecmn_hbd_len_WORD buf_len
205 struct lpfc_sli_config_hdr {
207 #define lpfc_mbox_hdr_emb_SHIFT 0
208 #define lpfc_mbox_hdr_emb_MASK 0x00000001
209 #define lpfc_mbox_hdr_emb_WORD word1
210 #define lpfc_mbox_hdr_mse_cnt_SHIFT 3
211 #define lpfc_mbox_hdr_mse_cnt_MASK 0x0000001f
212 #define lpfc_mbox_hdr_mse_cnt_WORD word1
213 uint32_t payload_length;
219 struct lpfc_sli_config_emb0_subsys {
220 struct lpfc_sli_config_hdr sli_config_hdr;
221 #define LPFC_MBX_SLI_CONFIG_MAX_MSE 19
222 struct lpfc_sli_config_mse mse[LPFC_MBX_SLI_CONFIG_MAX_MSE];
225 #define lpfc_emb0_subcmnd_opcode_SHIFT 0
226 #define lpfc_emb0_subcmnd_opcode_MASK 0xff
227 #define lpfc_emb0_subcmnd_opcode_WORD word64
228 #define lpfc_emb0_subcmnd_subsys_SHIFT 8
229 #define lpfc_emb0_subcmnd_subsys_MASK 0xff
230 #define lpfc_emb0_subcmnd_subsys_WORD word64
231 /* Subsystem FCOE (0x0C) OpCodes */
232 #define SLI_CONFIG_SUBSYS_FCOE 0x0C
233 #define FCOE_OPCODE_READ_FCF 0x08
234 #define FCOE_OPCODE_ADD_FCF 0x09
235 #define FCOE_OPCODE_SET_DPORT_MODE 0x27
236 #define FCOE_OPCODE_GET_DPORT_RESULTS 0x28
239 struct lpfc_sli_config_emb1_subsys {
240 struct lpfc_sli_config_hdr sli_config_hdr;
242 #define lpfc_emb1_subcmnd_opcode_SHIFT 0
243 #define lpfc_emb1_subcmnd_opcode_MASK 0xff
244 #define lpfc_emb1_subcmnd_opcode_WORD word6
245 #define lpfc_emb1_subcmnd_subsys_SHIFT 8
246 #define lpfc_emb1_subcmnd_subsys_MASK 0xff
247 #define lpfc_emb1_subcmnd_subsys_WORD word6
248 /* Subsystem COMN (0x01) OpCodes */
249 #define SLI_CONFIG_SUBSYS_COMN 0x01
250 #define COMN_OPCODE_GET_PROFILE_CONFIG 0xA4
251 #define COMN_OPCODE_READ_OBJECT 0xAB
252 #define COMN_OPCODE_WRITE_OBJECT 0xAC
253 #define COMN_OPCODE_READ_OBJECT_LIST 0xAD
254 #define COMN_OPCODE_DELETE_OBJECT 0xAE
255 #define COMN_OPCODE_GET_CNTL_ADDL_ATTRIBUTES 0x79
256 #define COMN_OPCODE_GET_CNTL_ATTRIBUTES 0x20
258 uint32_t request_length;
260 #define lpfc_subcmnd_version_SHIFT 0
261 #define lpfc_subcmnd_version_MASK 0xff
262 #define lpfc_subcmnd_version_WORD word9
264 #define lpfc_subcmnd_ask_rd_len_SHIFT 0
265 #define lpfc_subcmnd_ask_rd_len_MASK 0xffffff
266 #define lpfc_subcmnd_ask_rd_len_WORD word10
268 uint32_t obj_name[26];
270 #define LPFC_MBX_SLI_CONFIG_MAX_HBD 8
271 struct lpfc_sli_config_hbd hbd[LPFC_MBX_SLI_CONFIG_MAX_HBD];
274 struct lpfc_sli_config_mbox {
276 #define lpfc_mqe_status_SHIFT 16
277 #define lpfc_mqe_status_MASK 0x0000FFFF
278 #define lpfc_mqe_status_WORD word0
279 #define lpfc_mqe_command_SHIFT 8
280 #define lpfc_mqe_command_MASK 0x000000FF
281 #define lpfc_mqe_command_WORD word0
283 struct lpfc_sli_config_emb0_subsys sli_config_emb0_subsys;
284 struct lpfc_sli_config_emb1_subsys sli_config_emb1_subsys;
288 #define LPFC_FORCED_LINK_SPEED_NOT_SUPPORTED 0
289 #define LPFC_FORCED_LINK_SPEED_SUPPORTED 1
290 struct get_forced_link_speed_support {
293 struct forced_link_speed_support_reply {
298 #define SLI_CONFIG_NOT_HANDLED 0
299 #define SLI_CONFIG_HANDLED 1