blob: bff98add80cd06f1ddf7188805e571aabc52c0f3 [file] [log] [blame]
James Smartda0436e2009-05-22 14:51:39 -04001/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2009 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com *
7 * *
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 *******************************************************************/
20
21/* Macros to deal with bit fields. Each bit field must have 3 #defines
22 * associated with it (_SHIFT, _MASK, and _WORD).
23 * EG. For a bit field that is in the 7th bit of the "field4" field of a
24 * structure and is 2 bits in size the following #defines must exist:
25 * struct temp {
26 * uint32_t field1;
27 * uint32_t field2;
28 * uint32_t field3;
29 * uint32_t field4;
30 * #define example_bit_field_SHIFT 7
31 * #define example_bit_field_MASK 0x03
32 * #define example_bit_field_WORD field4
33 * uint32_t field5;
34 * };
35 * Then the macros below may be used to get or set the value of that field.
36 * EG. To get the value of the bit field from the above example:
37 * struct temp t1;
38 * value = bf_get(example_bit_field, &t1);
39 * And then to set that bit field:
40 * bf_set(example_bit_field, &t1, 2);
41 * Or clear that bit field:
42 * bf_set(example_bit_field, &t1, 0);
43 */
James Smartcb5172e2010-03-15 11:25:07 -040044#define bf_get_le32(name, ptr) \
45 ((le32_to_cpu((ptr)->name##_WORD) >> name##_SHIFT) & name##_MASK)
James Smartda0436e2009-05-22 14:51:39 -040046#define bf_get(name, ptr) \
47 (((ptr)->name##_WORD >> name##_SHIFT) & name##_MASK)
James Smartcb5172e2010-03-15 11:25:07 -040048#define bf_set_le32(name, ptr, value) \
49 ((ptr)->name##_WORD = cpu_to_le32(((((value) & \
50 name##_MASK) << name##_SHIFT) | (le32_to_cpu((ptr)->name##_WORD) & \
51 ~(name##_MASK << name##_SHIFT)))))
James Smartda0436e2009-05-22 14:51:39 -040052#define bf_set(name, ptr, value) \
53 ((ptr)->name##_WORD = ((((value) & name##_MASK) << name##_SHIFT) | \
54 ((ptr)->name##_WORD & ~(name##_MASK << name##_SHIFT))))
55
56struct dma_address {
57 uint32_t addr_lo;
58 uint32_t addr_hi;
59};
60
James Smart8fa38512009-07-19 10:01:03 -040061struct lpfc_sli_intf {
62 uint32_t word0;
James Smart28baac72010-02-12 14:42:03 -050063#define lpfc_sli_intf_valid_SHIFT 29
64#define lpfc_sli_intf_valid_MASK 0x00000007
65#define lpfc_sli_intf_valid_WORD word0
James Smart8fa38512009-07-19 10:01:03 -040066#define LPFC_SLI_INTF_VALID 6
James Smart28baac72010-02-12 14:42:03 -050067#define lpfc_sli_intf_featurelevel2_SHIFT 24
68#define lpfc_sli_intf_featurelevel2_MASK 0x0000001F
69#define lpfc_sli_intf_featurelevel2_WORD word0
70#define lpfc_sli_intf_featurelevel1_SHIFT 16
71#define lpfc_sli_intf_featurelevel1_MASK 0x000000FF
72#define lpfc_sli_intf_featurelevel1_WORD word0
73#define LPFC_SLI_INTF_FEATURELEVEL1_1 1
74#define LPFC_SLI_INTF_FEATURELEVEL1_2 2
75#define lpfc_sli_intf_sli_family_SHIFT 8
76#define lpfc_sli_intf_sli_family_MASK 0x000000FF
77#define lpfc_sli_intf_sli_family_WORD word0
78#define LPFC_SLI_INTF_FAMILY_BE2 0
79#define LPFC_SLI_INTF_FAMILY_BE3 1
80#define lpfc_sli_intf_slirev_SHIFT 4
81#define lpfc_sli_intf_slirev_MASK 0x0000000F
82#define lpfc_sli_intf_slirev_WORD word0
83#define LPFC_SLI_INTF_REV_SLI3 3
84#define LPFC_SLI_INTF_REV_SLI4 4
85#define lpfc_sli_intf_if_type_SHIFT 0
86#define lpfc_sli_intf_if_type_MASK 0x00000007
87#define lpfc_sli_intf_if_type_WORD word0
88#define LPFC_SLI_INTF_IF_TYPE_0 0
89#define LPFC_SLI_INTF_IF_TYPE_1 1
James Smart8fa38512009-07-19 10:01:03 -040090};
91
James Smartda0436e2009-05-22 14:51:39 -040092#define LPFC_SLI4_MBX_EMBED true
93#define LPFC_SLI4_MBX_NEMBED false
94
95#define LPFC_SLI4_MB_WORD_COUNT 64
96#define LPFC_MAX_MQ_PAGE 8
97#define LPFC_MAX_WQ_PAGE 8
98#define LPFC_MAX_CQ_PAGE 4
99#define LPFC_MAX_EQ_PAGE 8
100
101#define LPFC_VIR_FUNC_MAX 32 /* Maximum number of virtual functions */
102#define LPFC_PCI_FUNC_MAX 5 /* Maximum number of PCI functions */
103#define LPFC_VFR_PAGE_SIZE 0x1000 /* 4KB BAR2 per-VF register page size */
104
105/* Define SLI4 Alignment requirements. */
106#define LPFC_ALIGN_16_BYTE 16
107#define LPFC_ALIGN_64_BYTE 64
108
109/* Define SLI4 specific definitions. */
110#define LPFC_MQ_CQE_BYTE_OFFSET 256
111#define LPFC_MBX_CMD_HDR_LENGTH 16
112#define LPFC_MBX_ERROR_RANGE 0x4000
113#define LPFC_BMBX_BIT1_ADDR_HI 0x2
114#define LPFC_BMBX_BIT1_ADDR_LO 0
115#define LPFC_RPI_HDR_COUNT 64
116#define LPFC_HDR_TEMPLATE_SIZE 4096
117#define LPFC_RPI_ALLOC_ERROR 0xFFFF
118#define LPFC_FCF_RECORD_WD_CNT 132
119#define LPFC_ENTIRE_FCF_DATABASE 0
120#define LPFC_DFLT_FCF_INDEX 0
121
122/* Virtual function numbers */
123#define LPFC_VF0 0
124#define LPFC_VF1 1
125#define LPFC_VF2 2
126#define LPFC_VF3 3
127#define LPFC_VF4 4
128#define LPFC_VF5 5
129#define LPFC_VF6 6
130#define LPFC_VF7 7
131#define LPFC_VF8 8
132#define LPFC_VF9 9
133#define LPFC_VF10 10
134#define LPFC_VF11 11
135#define LPFC_VF12 12
136#define LPFC_VF13 13
137#define LPFC_VF14 14
138#define LPFC_VF15 15
139#define LPFC_VF16 16
140#define LPFC_VF17 17
141#define LPFC_VF18 18
142#define LPFC_VF19 19
143#define LPFC_VF20 20
144#define LPFC_VF21 21
145#define LPFC_VF22 22
146#define LPFC_VF23 23
147#define LPFC_VF24 24
148#define LPFC_VF25 25
149#define LPFC_VF26 26
150#define LPFC_VF27 27
151#define LPFC_VF28 28
152#define LPFC_VF29 29
153#define LPFC_VF30 30
154#define LPFC_VF31 31
155
156/* PCI function numbers */
157#define LPFC_PCI_FUNC0 0
158#define LPFC_PCI_FUNC1 1
159#define LPFC_PCI_FUNC2 2
160#define LPFC_PCI_FUNC3 3
161#define LPFC_PCI_FUNC4 4
162
163/* Active interrupt test count */
164#define LPFC_ACT_INTR_CNT 4
165
166/* Delay Multiplier constant */
167#define LPFC_DMULT_CONST 651042
168#define LPFC_MIM_IMAX 636
169#define LPFC_FP_DEF_IMAX 10000
170#define LPFC_SP_DEF_IMAX 10000
171
James Smart28baac72010-02-12 14:42:03 -0500172/* PORT_CAPABILITIES constants. */
173#define LPFC_MAX_SUPPORTED_PAGES 8
174
James Smartda0436e2009-05-22 14:51:39 -0400175struct ulp_bde64 {
176 union ULP_BDE_TUS {
177 uint32_t w;
178 struct {
179#ifdef __BIG_ENDIAN_BITFIELD
180 uint32_t bdeFlags:8; /* BDE Flags 0 IS A SUPPORTED
181 VALUE !! */
182 uint32_t bdeSize:24; /* Size of buffer (in bytes) */
183#else /* __LITTLE_ENDIAN_BITFIELD */
184 uint32_t bdeSize:24; /* Size of buffer (in bytes) */
185 uint32_t bdeFlags:8; /* BDE Flags 0 IS A SUPPORTED
186 VALUE !! */
187#endif
188#define BUFF_TYPE_BDE_64 0x00 /* BDE (Host_resident) */
189#define BUFF_TYPE_BDE_IMMED 0x01 /* Immediate Data BDE */
190#define BUFF_TYPE_BDE_64P 0x02 /* BDE (Port-resident) */
191#define BUFF_TYPE_BDE_64I 0x08 /* Input BDE (Host-resident) */
192#define BUFF_TYPE_BDE_64IP 0x0A /* Input BDE (Port-resident) */
193#define BUFF_TYPE_BLP_64 0x40 /* BLP (Host-resident) */
194#define BUFF_TYPE_BLP_64P 0x42 /* BLP (Port-resident) */
195 } f;
196 } tus;
197 uint32_t addrLow;
198 uint32_t addrHigh;
199};
200
201struct lpfc_sli4_flags {
202 uint32_t word0;
203#define lpfc_fip_flag_SHIFT 0
204#define lpfc_fip_flag_MASK 0x00000001
205#define lpfc_fip_flag_WORD word0
206};
207
James Smart5ffc2662009-11-18 15:39:44 -0500208struct sli4_bls_acc {
209 uint32_t word0_rsvd; /* Word0 must be reserved */
210 uint32_t word1;
211#define lpfc_abts_orig_SHIFT 0
212#define lpfc_abts_orig_MASK 0x00000001
213#define lpfc_abts_orig_WORD word1
214#define LPFC_ABTS_UNSOL_RSP 1
215#define LPFC_ABTS_UNSOL_INT 0
216 uint32_t word2;
217#define lpfc_abts_rxid_SHIFT 0
218#define lpfc_abts_rxid_MASK 0x0000FFFF
219#define lpfc_abts_rxid_WORD word2
220#define lpfc_abts_oxid_SHIFT 16
221#define lpfc_abts_oxid_MASK 0x0000FFFF
222#define lpfc_abts_oxid_WORD word2
223 uint32_t word3;
224 uint32_t word4;
225 uint32_t word5_rsvd; /* Word5 must be reserved */
226};
227
James Smartda0436e2009-05-22 14:51:39 -0400228/* event queue entry structure */
229struct lpfc_eqe {
230 uint32_t word0;
231#define lpfc_eqe_resource_id_SHIFT 16
232#define lpfc_eqe_resource_id_MASK 0x000000FF
233#define lpfc_eqe_resource_id_WORD word0
234#define lpfc_eqe_minor_code_SHIFT 4
235#define lpfc_eqe_minor_code_MASK 0x00000FFF
236#define lpfc_eqe_minor_code_WORD word0
237#define lpfc_eqe_major_code_SHIFT 1
238#define lpfc_eqe_major_code_MASK 0x00000007
239#define lpfc_eqe_major_code_WORD word0
240#define lpfc_eqe_valid_SHIFT 0
241#define lpfc_eqe_valid_MASK 0x00000001
242#define lpfc_eqe_valid_WORD word0
243};
244
245/* completion queue entry structure (common fields for all cqe types) */
246struct lpfc_cqe {
247 uint32_t reserved0;
248 uint32_t reserved1;
249 uint32_t reserved2;
250 uint32_t word3;
251#define lpfc_cqe_valid_SHIFT 31
252#define lpfc_cqe_valid_MASK 0x00000001
253#define lpfc_cqe_valid_WORD word3
254#define lpfc_cqe_code_SHIFT 16
255#define lpfc_cqe_code_MASK 0x000000FF
256#define lpfc_cqe_code_WORD word3
257};
258
259/* Completion Queue Entry Status Codes */
260#define CQE_STATUS_SUCCESS 0x0
261#define CQE_STATUS_FCP_RSP_FAILURE 0x1
262#define CQE_STATUS_REMOTE_STOP 0x2
263#define CQE_STATUS_LOCAL_REJECT 0x3
264#define CQE_STATUS_NPORT_RJT 0x4
265#define CQE_STATUS_FABRIC_RJT 0x5
266#define CQE_STATUS_NPORT_BSY 0x6
267#define CQE_STATUS_FABRIC_BSY 0x7
268#define CQE_STATUS_INTERMED_RSP 0x8
269#define CQE_STATUS_LS_RJT 0x9
270#define CQE_STATUS_CMD_REJECT 0xb
271#define CQE_STATUS_FCP_TGT_LENCHECK 0xc
272#define CQE_STATUS_NEED_BUFF_ENTRY 0xf
273
274/* Status returned by hardware (valid only if status = CQE_STATUS_SUCCESS). */
275#define CQE_HW_STATUS_NO_ERR 0x0
276#define CQE_HW_STATUS_UNDERRUN 0x1
277#define CQE_HW_STATUS_OVERRUN 0x2
278
279/* Completion Queue Entry Codes */
280#define CQE_CODE_COMPL_WQE 0x1
281#define CQE_CODE_RELEASE_WQE 0x2
282#define CQE_CODE_RECEIVE 0x4
283#define CQE_CODE_XRI_ABORTED 0x5
284
285/* completion queue entry for wqe completions */
286struct lpfc_wcqe_complete {
287 uint32_t word0;
288#define lpfc_wcqe_c_request_tag_SHIFT 16
289#define lpfc_wcqe_c_request_tag_MASK 0x0000FFFF
290#define lpfc_wcqe_c_request_tag_WORD word0
291#define lpfc_wcqe_c_status_SHIFT 8
292#define lpfc_wcqe_c_status_MASK 0x000000FF
293#define lpfc_wcqe_c_status_WORD word0
294#define lpfc_wcqe_c_hw_status_SHIFT 0
295#define lpfc_wcqe_c_hw_status_MASK 0x000000FF
296#define lpfc_wcqe_c_hw_status_WORD word0
297 uint32_t total_data_placed;
298 uint32_t parameter;
299 uint32_t word3;
300#define lpfc_wcqe_c_valid_SHIFT lpfc_cqe_valid_SHIFT
301#define lpfc_wcqe_c_valid_MASK lpfc_cqe_valid_MASK
302#define lpfc_wcqe_c_valid_WORD lpfc_cqe_valid_WORD
303#define lpfc_wcqe_c_xb_SHIFT 28
304#define lpfc_wcqe_c_xb_MASK 0x00000001
305#define lpfc_wcqe_c_xb_WORD word3
306#define lpfc_wcqe_c_pv_SHIFT 27
307#define lpfc_wcqe_c_pv_MASK 0x00000001
308#define lpfc_wcqe_c_pv_WORD word3
309#define lpfc_wcqe_c_priority_SHIFT 24
310#define lpfc_wcqe_c_priority_MASK 0x00000007
311#define lpfc_wcqe_c_priority_WORD word3
312#define lpfc_wcqe_c_code_SHIFT lpfc_cqe_code_SHIFT
313#define lpfc_wcqe_c_code_MASK lpfc_cqe_code_MASK
314#define lpfc_wcqe_c_code_WORD lpfc_cqe_code_WORD
315};
316
317/* completion queue entry for wqe release */
318struct lpfc_wcqe_release {
319 uint32_t reserved0;
320 uint32_t reserved1;
321 uint32_t word2;
322#define lpfc_wcqe_r_wq_id_SHIFT 16
323#define lpfc_wcqe_r_wq_id_MASK 0x0000FFFF
324#define lpfc_wcqe_r_wq_id_WORD word2
325#define lpfc_wcqe_r_wqe_index_SHIFT 0
326#define lpfc_wcqe_r_wqe_index_MASK 0x0000FFFF
327#define lpfc_wcqe_r_wqe_index_WORD word2
328 uint32_t word3;
329#define lpfc_wcqe_r_valid_SHIFT lpfc_cqe_valid_SHIFT
330#define lpfc_wcqe_r_valid_MASK lpfc_cqe_valid_MASK
331#define lpfc_wcqe_r_valid_WORD lpfc_cqe_valid_WORD
332#define lpfc_wcqe_r_code_SHIFT lpfc_cqe_code_SHIFT
333#define lpfc_wcqe_r_code_MASK lpfc_cqe_code_MASK
334#define lpfc_wcqe_r_code_WORD lpfc_cqe_code_WORD
335};
336
337struct sli4_wcqe_xri_aborted {
338 uint32_t word0;
339#define lpfc_wcqe_xa_status_SHIFT 8
340#define lpfc_wcqe_xa_status_MASK 0x000000FF
341#define lpfc_wcqe_xa_status_WORD word0
342 uint32_t parameter;
343 uint32_t word2;
344#define lpfc_wcqe_xa_remote_xid_SHIFT 16
345#define lpfc_wcqe_xa_remote_xid_MASK 0x0000FFFF
346#define lpfc_wcqe_xa_remote_xid_WORD word2
347#define lpfc_wcqe_xa_xri_SHIFT 0
348#define lpfc_wcqe_xa_xri_MASK 0x0000FFFF
349#define lpfc_wcqe_xa_xri_WORD word2
350 uint32_t word3;
351#define lpfc_wcqe_xa_valid_SHIFT lpfc_cqe_valid_SHIFT
352#define lpfc_wcqe_xa_valid_MASK lpfc_cqe_valid_MASK
353#define lpfc_wcqe_xa_valid_WORD lpfc_cqe_valid_WORD
354#define lpfc_wcqe_xa_ia_SHIFT 30
355#define lpfc_wcqe_xa_ia_MASK 0x00000001
356#define lpfc_wcqe_xa_ia_WORD word3
357#define CQE_XRI_ABORTED_IA_REMOTE 0
358#define CQE_XRI_ABORTED_IA_LOCAL 1
359#define lpfc_wcqe_xa_br_SHIFT 29
360#define lpfc_wcqe_xa_br_MASK 0x00000001
361#define lpfc_wcqe_xa_br_WORD word3
362#define CQE_XRI_ABORTED_BR_BA_ACC 0
363#define CQE_XRI_ABORTED_BR_BA_RJT 1
364#define lpfc_wcqe_xa_eo_SHIFT 28
365#define lpfc_wcqe_xa_eo_MASK 0x00000001
366#define lpfc_wcqe_xa_eo_WORD word3
367#define CQE_XRI_ABORTED_EO_REMOTE 0
368#define CQE_XRI_ABORTED_EO_LOCAL 1
369#define lpfc_wcqe_xa_code_SHIFT lpfc_cqe_code_SHIFT
370#define lpfc_wcqe_xa_code_MASK lpfc_cqe_code_MASK
371#define lpfc_wcqe_xa_code_WORD lpfc_cqe_code_WORD
372};
373
374/* completion queue entry structure for rqe completion */
375struct lpfc_rcqe {
376 uint32_t word0;
377#define lpfc_rcqe_bindex_SHIFT 16
378#define lpfc_rcqe_bindex_MASK 0x0000FFF
379#define lpfc_rcqe_bindex_WORD word0
380#define lpfc_rcqe_status_SHIFT 8
381#define lpfc_rcqe_status_MASK 0x000000FF
382#define lpfc_rcqe_status_WORD word0
383#define FC_STATUS_RQ_SUCCESS 0x10 /* Async receive successful */
384#define FC_STATUS_RQ_BUF_LEN_EXCEEDED 0x11 /* payload truncated */
385#define FC_STATUS_INSUFF_BUF_NEED_BUF 0x12 /* Insufficient buffers */
386#define FC_STATUS_INSUFF_BUF_FRM_DISC 0x13 /* Frame Discard */
387 uint32_t reserved1;
388 uint32_t word2;
389#define lpfc_rcqe_length_SHIFT 16
390#define lpfc_rcqe_length_MASK 0x0000FFFF
391#define lpfc_rcqe_length_WORD word2
392#define lpfc_rcqe_rq_id_SHIFT 6
393#define lpfc_rcqe_rq_id_MASK 0x000003FF
394#define lpfc_rcqe_rq_id_WORD word2
395#define lpfc_rcqe_fcf_id_SHIFT 0
396#define lpfc_rcqe_fcf_id_MASK 0x0000003F
397#define lpfc_rcqe_fcf_id_WORD word2
398 uint32_t word3;
399#define lpfc_rcqe_valid_SHIFT lpfc_cqe_valid_SHIFT
400#define lpfc_rcqe_valid_MASK lpfc_cqe_valid_MASK
401#define lpfc_rcqe_valid_WORD lpfc_cqe_valid_WORD
402#define lpfc_rcqe_port_SHIFT 30
403#define lpfc_rcqe_port_MASK 0x00000001
404#define lpfc_rcqe_port_WORD word3
405#define lpfc_rcqe_hdr_length_SHIFT 24
406#define lpfc_rcqe_hdr_length_MASK 0x0000001F
407#define lpfc_rcqe_hdr_length_WORD word3
408#define lpfc_rcqe_code_SHIFT lpfc_cqe_code_SHIFT
409#define lpfc_rcqe_code_MASK lpfc_cqe_code_MASK
410#define lpfc_rcqe_code_WORD lpfc_cqe_code_WORD
411#define lpfc_rcqe_eof_SHIFT 8
412#define lpfc_rcqe_eof_MASK 0x000000FF
413#define lpfc_rcqe_eof_WORD word3
414#define FCOE_EOFn 0x41
415#define FCOE_EOFt 0x42
416#define FCOE_EOFni 0x49
417#define FCOE_EOFa 0x50
418#define lpfc_rcqe_sof_SHIFT 0
419#define lpfc_rcqe_sof_MASK 0x000000FF
420#define lpfc_rcqe_sof_WORD word3
421#define FCOE_SOFi2 0x2d
422#define FCOE_SOFi3 0x2e
423#define FCOE_SOFn2 0x35
424#define FCOE_SOFn3 0x36
425};
426
427struct lpfc_wqe_generic{
428 struct ulp_bde64 bde;
429 uint32_t word3;
430 uint32_t word4;
431 uint32_t word5;
432 uint32_t word6;
433#define lpfc_wqe_gen_context_SHIFT 16
434#define lpfc_wqe_gen_context_MASK 0x0000FFFF
435#define lpfc_wqe_gen_context_WORD word6
436#define lpfc_wqe_gen_xri_SHIFT 0
437#define lpfc_wqe_gen_xri_MASK 0x0000FFFF
438#define lpfc_wqe_gen_xri_WORD word6
439 uint32_t word7;
440#define lpfc_wqe_gen_lnk_SHIFT 23
441#define lpfc_wqe_gen_lnk_MASK 0x00000001
442#define lpfc_wqe_gen_lnk_WORD word7
443#define lpfc_wqe_gen_erp_SHIFT 22
444#define lpfc_wqe_gen_erp_MASK 0x00000001
445#define lpfc_wqe_gen_erp_WORD word7
446#define lpfc_wqe_gen_pu_SHIFT 20
447#define lpfc_wqe_gen_pu_MASK 0x00000003
448#define lpfc_wqe_gen_pu_WORD word7
449#define lpfc_wqe_gen_class_SHIFT 16
450#define lpfc_wqe_gen_class_MASK 0x00000007
451#define lpfc_wqe_gen_class_WORD word7
452#define lpfc_wqe_gen_command_SHIFT 8
453#define lpfc_wqe_gen_command_MASK 0x000000FF
454#define lpfc_wqe_gen_command_WORD word7
455#define lpfc_wqe_gen_status_SHIFT 4
456#define lpfc_wqe_gen_status_MASK 0x0000000F
457#define lpfc_wqe_gen_status_WORD word7
458#define lpfc_wqe_gen_ct_SHIFT 2
James Smart6669f9b2009-10-02 15:16:45 -0400459#define lpfc_wqe_gen_ct_MASK 0x00000003
James Smartda0436e2009-05-22 14:51:39 -0400460#define lpfc_wqe_gen_ct_WORD word7
461 uint32_t abort_tag;
462 uint32_t word9;
463#define lpfc_wqe_gen_request_tag_SHIFT 0
464#define lpfc_wqe_gen_request_tag_MASK 0x0000FFFF
465#define lpfc_wqe_gen_request_tag_WORD word9
466 uint32_t word10;
467#define lpfc_wqe_gen_ccp_SHIFT 24
468#define lpfc_wqe_gen_ccp_MASK 0x000000FF
469#define lpfc_wqe_gen_ccp_WORD word10
470#define lpfc_wqe_gen_ccpe_SHIFT 23
471#define lpfc_wqe_gen_ccpe_MASK 0x00000001
472#define lpfc_wqe_gen_ccpe_WORD word10
473#define lpfc_wqe_gen_pv_SHIFT 19
474#define lpfc_wqe_gen_pv_MASK 0x00000001
475#define lpfc_wqe_gen_pv_WORD word10
476#define lpfc_wqe_gen_pri_SHIFT 16
477#define lpfc_wqe_gen_pri_MASK 0x00000007
478#define lpfc_wqe_gen_pri_WORD word10
479 uint32_t word11;
480#define lpfc_wqe_gen_cq_id_SHIFT 16
James Smartf1126682009-06-10 17:22:44 -0400481#define lpfc_wqe_gen_cq_id_MASK 0x0000FFFF
James Smartda0436e2009-05-22 14:51:39 -0400482#define lpfc_wqe_gen_cq_id_WORD word11
James Smartf1126682009-06-10 17:22:44 -0400483#define LPFC_WQE_CQ_ID_DEFAULT 0xffff
James Smartda0436e2009-05-22 14:51:39 -0400484#define lpfc_wqe_gen_wqec_SHIFT 7
485#define lpfc_wqe_gen_wqec_MASK 0x00000001
486#define lpfc_wqe_gen_wqec_WORD word11
James Smartc8685952009-11-18 15:39:16 -0500487#define ELS_ID_FLOGI 3
488#define ELS_ID_FDISC 2
489#define ELS_ID_LOGO 1
490#define ELS_ID_DEFAULT 0
491#define lpfc_wqe_gen_els_id_SHIFT 4
492#define lpfc_wqe_gen_els_id_MASK 0x00000003
493#define lpfc_wqe_gen_els_id_WORD word11
James Smartda0436e2009-05-22 14:51:39 -0400494#define lpfc_wqe_gen_cmd_type_SHIFT 0
495#define lpfc_wqe_gen_cmd_type_MASK 0x0000000F
496#define lpfc_wqe_gen_cmd_type_WORD word11
497 uint32_t payload[4];
498};
499
500struct lpfc_rqe {
501 uint32_t address_hi;
502 uint32_t address_lo;
503};
504
505/* buffer descriptors */
506struct lpfc_bde4 {
507 uint32_t addr_hi;
508 uint32_t addr_lo;
509 uint32_t word2;
510#define lpfc_bde4_last_SHIFT 31
511#define lpfc_bde4_last_MASK 0x00000001
512#define lpfc_bde4_last_WORD word2
513#define lpfc_bde4_sge_offset_SHIFT 0
514#define lpfc_bde4_sge_offset_MASK 0x000003FF
515#define lpfc_bde4_sge_offset_WORD word2
516 uint32_t word3;
517#define lpfc_bde4_length_SHIFT 0
518#define lpfc_bde4_length_MASK 0x000000FF
519#define lpfc_bde4_length_WORD word3
520};
521
522struct lpfc_register {
523 uint32_t word0;
524};
525
526#define LPFC_UERR_STATUS_HI 0x00A4
527#define LPFC_UERR_STATUS_LO 0x00A0
James Smarta747c9c2009-11-18 15:41:10 -0500528#define LPFC_UE_MASK_HI 0x00AC
529#define LPFC_UE_MASK_LO 0x00A8
James Smart28baac72010-02-12 14:42:03 -0500530#define LPFC_SLI_INTF 0x0058
James Smartda0436e2009-05-22 14:51:39 -0400531
532/* BAR0 Registers */
533#define LPFC_HST_STATE 0x00AC
534#define lpfc_hst_state_perr_SHIFT 31
535#define lpfc_hst_state_perr_MASK 0x1
536#define lpfc_hst_state_perr_WORD word0
537#define lpfc_hst_state_sfi_SHIFT 30
538#define lpfc_hst_state_sfi_MASK 0x1
539#define lpfc_hst_state_sfi_WORD word0
540#define lpfc_hst_state_nip_SHIFT 29
541#define lpfc_hst_state_nip_MASK 0x1
542#define lpfc_hst_state_nip_WORD word0
543#define lpfc_hst_state_ipc_SHIFT 28
544#define lpfc_hst_state_ipc_MASK 0x1
545#define lpfc_hst_state_ipc_WORD word0
546#define lpfc_hst_state_xrom_SHIFT 27
547#define lpfc_hst_state_xrom_MASK 0x1
548#define lpfc_hst_state_xrom_WORD word0
549#define lpfc_hst_state_dl_SHIFT 26
550#define lpfc_hst_state_dl_MASK 0x1
551#define lpfc_hst_state_dl_WORD word0
552#define lpfc_hst_state_port_status_SHIFT 0
553#define lpfc_hst_state_port_status_MASK 0xFFFF
554#define lpfc_hst_state_port_status_WORD word0
555
556#define LPFC_POST_STAGE_POWER_ON_RESET 0x0000
557#define LPFC_POST_STAGE_AWAITING_HOST_RDY 0x0001
558#define LPFC_POST_STAGE_HOST_RDY 0x0002
559#define LPFC_POST_STAGE_BE_RESET 0x0003
560#define LPFC_POST_STAGE_SEEPROM_CS_START 0x0100
561#define LPFC_POST_STAGE_SEEPROM_CS_DONE 0x0101
562#define LPFC_POST_STAGE_DDR_CONFIG_START 0x0200
563#define LPFC_POST_STAGE_DDR_CONFIG_DONE 0x0201
564#define LPFC_POST_STAGE_DDR_CALIBRATE_START 0x0300
565#define LPFC_POST_STAGE_DDR_CALIBRATE_DONE 0x0301
566#define LPFC_POST_STAGE_DDR_TEST_START 0x0400
567#define LPFC_POST_STAGE_DDR_TEST_DONE 0x0401
568#define LPFC_POST_STAGE_REDBOOT_INIT_START 0x0600
569#define LPFC_POST_STAGE_REDBOOT_INIT_DONE 0x0601
570#define LPFC_POST_STAGE_FW_IMAGE_LOAD_START 0x0700
571#define LPFC_POST_STAGE_FW_IMAGE_LOAD_DONE 0x0701
572#define LPFC_POST_STAGE_ARMFW_START 0x0800
573#define LPFC_POST_STAGE_DHCP_QUERY_START 0x0900
574#define LPFC_POST_STAGE_DHCP_QUERY_DONE 0x0901
575#define LPFC_POST_STAGE_BOOT_TARGET_DISCOVERY_START 0x0A00
576#define LPFC_POST_STAGE_BOOT_TARGET_DISCOVERY_DONE 0x0A01
577#define LPFC_POST_STAGE_RC_OPTION_SET 0x0B00
578#define LPFC_POST_STAGE_SWITCH_LINK 0x0B01
579#define LPFC_POST_STAGE_SEND_ICDS_MESSAGE 0x0B02
580#define LPFC_POST_STAGE_PERFROM_TFTP 0x0B03
581#define LPFC_POST_STAGE_PARSE_XML 0x0B04
582#define LPFC_POST_STAGE_DOWNLOAD_IMAGE 0x0B05
583#define LPFC_POST_STAGE_FLASH_IMAGE 0x0B06
584#define LPFC_POST_STAGE_RC_DONE 0x0B07
585#define LPFC_POST_STAGE_REBOOT_SYSTEM 0x0B08
586#define LPFC_POST_STAGE_MAC_ADDRESS 0x0C00
587#define LPFC_POST_STAGE_ARMFW_READY 0xC000
588#define LPFC_POST_STAGE_ARMFW_UE 0xF000
589
James Smartda0436e2009-05-22 14:51:39 -0400590/* BAR1 Registers */
591#define LPFC_IMR_MASK_ALL 0xFFFFFFFF
592#define LPFC_ISCR_CLEAR_ALL 0xFFFFFFFF
593
594#define LPFC_HST_ISR0 0x0C18
595#define LPFC_HST_ISR1 0x0C1C
596#define LPFC_HST_ISR2 0x0C20
597#define LPFC_HST_ISR3 0x0C24
598#define LPFC_HST_ISR4 0x0C28
599
600#define LPFC_HST_IMR0 0x0C48
601#define LPFC_HST_IMR1 0x0C4C
602#define LPFC_HST_IMR2 0x0C50
603#define LPFC_HST_IMR3 0x0C54
604#define LPFC_HST_IMR4 0x0C58
605
606#define LPFC_HST_ISCR0 0x0C78
607#define LPFC_HST_ISCR1 0x0C7C
608#define LPFC_HST_ISCR2 0x0C80
609#define LPFC_HST_ISCR3 0x0C84
610#define LPFC_HST_ISCR4 0x0C88
611
612#define LPFC_SLI4_INTR0 BIT0
613#define LPFC_SLI4_INTR1 BIT1
614#define LPFC_SLI4_INTR2 BIT2
615#define LPFC_SLI4_INTR3 BIT3
616#define LPFC_SLI4_INTR4 BIT4
617#define LPFC_SLI4_INTR5 BIT5
618#define LPFC_SLI4_INTR6 BIT6
619#define LPFC_SLI4_INTR7 BIT7
620#define LPFC_SLI4_INTR8 BIT8
621#define LPFC_SLI4_INTR9 BIT9
622#define LPFC_SLI4_INTR10 BIT10
623#define LPFC_SLI4_INTR11 BIT11
624#define LPFC_SLI4_INTR12 BIT12
625#define LPFC_SLI4_INTR13 BIT13
626#define LPFC_SLI4_INTR14 BIT14
627#define LPFC_SLI4_INTR15 BIT15
628#define LPFC_SLI4_INTR16 BIT16
629#define LPFC_SLI4_INTR17 BIT17
630#define LPFC_SLI4_INTR18 BIT18
631#define LPFC_SLI4_INTR19 BIT19
632#define LPFC_SLI4_INTR20 BIT20
633#define LPFC_SLI4_INTR21 BIT21
634#define LPFC_SLI4_INTR22 BIT22
635#define LPFC_SLI4_INTR23 BIT23
636#define LPFC_SLI4_INTR24 BIT24
637#define LPFC_SLI4_INTR25 BIT25
638#define LPFC_SLI4_INTR26 BIT26
639#define LPFC_SLI4_INTR27 BIT27
640#define LPFC_SLI4_INTR28 BIT28
641#define LPFC_SLI4_INTR29 BIT29
642#define LPFC_SLI4_INTR30 BIT30
643#define LPFC_SLI4_INTR31 BIT31
644
645/* BAR2 Registers */
646#define LPFC_RQ_DOORBELL 0x00A0
647#define lpfc_rq_doorbell_num_posted_SHIFT 16
648#define lpfc_rq_doorbell_num_posted_MASK 0x3FFF
649#define lpfc_rq_doorbell_num_posted_WORD word0
650#define LPFC_RQ_POST_BATCH 8 /* RQEs to post at one time */
651#define lpfc_rq_doorbell_id_SHIFT 0
652#define lpfc_rq_doorbell_id_MASK 0x03FF
653#define lpfc_rq_doorbell_id_WORD word0
654
655#define LPFC_WQ_DOORBELL 0x0040
656#define lpfc_wq_doorbell_num_posted_SHIFT 24
657#define lpfc_wq_doorbell_num_posted_MASK 0x00FF
658#define lpfc_wq_doorbell_num_posted_WORD word0
659#define lpfc_wq_doorbell_index_SHIFT 16
660#define lpfc_wq_doorbell_index_MASK 0x00FF
661#define lpfc_wq_doorbell_index_WORD word0
662#define lpfc_wq_doorbell_id_SHIFT 0
663#define lpfc_wq_doorbell_id_MASK 0xFFFF
664#define lpfc_wq_doorbell_id_WORD word0
665
666#define LPFC_EQCQ_DOORBELL 0x0120
667#define lpfc_eqcq_doorbell_arm_SHIFT 29
668#define lpfc_eqcq_doorbell_arm_MASK 0x0001
669#define lpfc_eqcq_doorbell_arm_WORD word0
670#define lpfc_eqcq_doorbell_num_released_SHIFT 16
671#define lpfc_eqcq_doorbell_num_released_MASK 0x1FFF
672#define lpfc_eqcq_doorbell_num_released_WORD word0
673#define lpfc_eqcq_doorbell_qt_SHIFT 10
674#define lpfc_eqcq_doorbell_qt_MASK 0x0001
675#define lpfc_eqcq_doorbell_qt_WORD word0
676#define LPFC_QUEUE_TYPE_COMPLETION 0
677#define LPFC_QUEUE_TYPE_EVENT 1
678#define lpfc_eqcq_doorbell_eqci_SHIFT 9
679#define lpfc_eqcq_doorbell_eqci_MASK 0x0001
680#define lpfc_eqcq_doorbell_eqci_WORD word0
681#define lpfc_eqcq_doorbell_cqid_SHIFT 0
682#define lpfc_eqcq_doorbell_cqid_MASK 0x03FF
683#define lpfc_eqcq_doorbell_cqid_WORD word0
684#define lpfc_eqcq_doorbell_eqid_SHIFT 0
685#define lpfc_eqcq_doorbell_eqid_MASK 0x01FF
686#define lpfc_eqcq_doorbell_eqid_WORD word0
687
688#define LPFC_BMBX 0x0160
689#define lpfc_bmbx_addr_SHIFT 2
690#define lpfc_bmbx_addr_MASK 0x3FFFFFFF
691#define lpfc_bmbx_addr_WORD word0
692#define lpfc_bmbx_hi_SHIFT 1
693#define lpfc_bmbx_hi_MASK 0x0001
694#define lpfc_bmbx_hi_WORD word0
695#define lpfc_bmbx_rdy_SHIFT 0
696#define lpfc_bmbx_rdy_MASK 0x0001
697#define lpfc_bmbx_rdy_WORD word0
698
699#define LPFC_MQ_DOORBELL 0x0140
700#define lpfc_mq_doorbell_num_posted_SHIFT 16
701#define lpfc_mq_doorbell_num_posted_MASK 0x3FFF
702#define lpfc_mq_doorbell_num_posted_WORD word0
703#define lpfc_mq_doorbell_id_SHIFT 0
704#define lpfc_mq_doorbell_id_MASK 0x03FF
705#define lpfc_mq_doorbell_id_WORD word0
706
707struct lpfc_sli4_cfg_mhdr {
708 uint32_t word1;
709#define lpfc_mbox_hdr_emb_SHIFT 0
710#define lpfc_mbox_hdr_emb_MASK 0x00000001
711#define lpfc_mbox_hdr_emb_WORD word1
712#define lpfc_mbox_hdr_sge_cnt_SHIFT 3
713#define lpfc_mbox_hdr_sge_cnt_MASK 0x0000001F
714#define lpfc_mbox_hdr_sge_cnt_WORD word1
715 uint32_t payload_length;
716 uint32_t tag_lo;
717 uint32_t tag_hi;
718 uint32_t reserved5;
719};
720
721union lpfc_sli4_cfg_shdr {
722 struct {
723 uint32_t word6;
724#define lpfc_mbox_hdr_opcode_SHIFT 0
725#define lpfc_mbox_hdr_opcode_MASK 0x000000FF
726#define lpfc_mbox_hdr_opcode_WORD word6
727#define lpfc_mbox_hdr_subsystem_SHIFT 8
728#define lpfc_mbox_hdr_subsystem_MASK 0x000000FF
729#define lpfc_mbox_hdr_subsystem_WORD word6
730#define lpfc_mbox_hdr_port_number_SHIFT 16
731#define lpfc_mbox_hdr_port_number_MASK 0x000000FF
732#define lpfc_mbox_hdr_port_number_WORD word6
733#define lpfc_mbox_hdr_domain_SHIFT 24
734#define lpfc_mbox_hdr_domain_MASK 0x000000FF
735#define lpfc_mbox_hdr_domain_WORD word6
736 uint32_t timeout;
737 uint32_t request_length;
738 uint32_t reserved9;
739 } request;
740 struct {
741 uint32_t word6;
742#define lpfc_mbox_hdr_opcode_SHIFT 0
743#define lpfc_mbox_hdr_opcode_MASK 0x000000FF
744#define lpfc_mbox_hdr_opcode_WORD word6
745#define lpfc_mbox_hdr_subsystem_SHIFT 8
746#define lpfc_mbox_hdr_subsystem_MASK 0x000000FF
747#define lpfc_mbox_hdr_subsystem_WORD word6
748#define lpfc_mbox_hdr_domain_SHIFT 24
749#define lpfc_mbox_hdr_domain_MASK 0x000000FF
750#define lpfc_mbox_hdr_domain_WORD word6
751 uint32_t word7;
752#define lpfc_mbox_hdr_status_SHIFT 0
753#define lpfc_mbox_hdr_status_MASK 0x000000FF
754#define lpfc_mbox_hdr_status_WORD word7
755#define lpfc_mbox_hdr_add_status_SHIFT 8
756#define lpfc_mbox_hdr_add_status_MASK 0x000000FF
757#define lpfc_mbox_hdr_add_status_WORD word7
758 uint32_t response_length;
759 uint32_t actual_response_length;
760 } response;
761};
762
763/* Mailbox structures */
764struct mbox_header {
765 struct lpfc_sli4_cfg_mhdr cfg_mhdr;
766 union lpfc_sli4_cfg_shdr cfg_shdr;
767};
768
769/* Subsystem Definitions */
770#define LPFC_MBOX_SUBSYSTEM_COMMON 0x1
771#define LPFC_MBOX_SUBSYSTEM_FCOE 0xC
772
773/* Device Specific Definitions */
774
775/* The HOST ENDIAN defines are in Big Endian format. */
776#define HOST_ENDIAN_LOW_WORD0 0xFF3412FF
777#define HOST_ENDIAN_HIGH_WORD1 0xFF7856FF
778
779/* Common Opcodes */
780#define LPFC_MBOX_OPCODE_CQ_CREATE 0x0C
781#define LPFC_MBOX_OPCODE_EQ_CREATE 0x0D
782#define LPFC_MBOX_OPCODE_MQ_CREATE 0x15
783#define LPFC_MBOX_OPCODE_GET_CNTL_ATTRIBUTES 0x20
784#define LPFC_MBOX_OPCODE_NOP 0x21
785#define LPFC_MBOX_OPCODE_MQ_DESTROY 0x35
786#define LPFC_MBOX_OPCODE_CQ_DESTROY 0x36
787#define LPFC_MBOX_OPCODE_EQ_DESTROY 0x37
James Smart6669f9b2009-10-02 15:16:45 -0400788#define LPFC_MBOX_OPCODE_QUERY_FW_CFG 0x3A
James Smartda0436e2009-05-22 14:51:39 -0400789#define LPFC_MBOX_OPCODE_FUNCTION_RESET 0x3D
790
791/* FCoE Opcodes */
792#define LPFC_MBOX_OPCODE_FCOE_WQ_CREATE 0x01
793#define LPFC_MBOX_OPCODE_FCOE_WQ_DESTROY 0x02
794#define LPFC_MBOX_OPCODE_FCOE_POST_SGL_PAGES 0x03
795#define LPFC_MBOX_OPCODE_FCOE_REMOVE_SGL_PAGES 0x04
796#define LPFC_MBOX_OPCODE_FCOE_RQ_CREATE 0x05
797#define LPFC_MBOX_OPCODE_FCOE_RQ_DESTROY 0x06
798#define LPFC_MBOX_OPCODE_FCOE_READ_FCF_TABLE 0x08
799#define LPFC_MBOX_OPCODE_FCOE_ADD_FCF 0x09
800#define LPFC_MBOX_OPCODE_FCOE_DELETE_FCF 0x0A
801#define LPFC_MBOX_OPCODE_FCOE_POST_HDR_TEMPLATE 0x0B
James Smartecfd03c2010-02-12 14:41:27 -0500802#define LPFC_MBOX_OPCODE_FCOE_REDISCOVER_FCF 0x10
James Smartda0436e2009-05-22 14:51:39 -0400803
804/* Mailbox command structures */
805struct eq_context {
806 uint32_t word0;
807#define lpfc_eq_context_size_SHIFT 31
808#define lpfc_eq_context_size_MASK 0x00000001
809#define lpfc_eq_context_size_WORD word0
810#define LPFC_EQE_SIZE_4 0x0
811#define LPFC_EQE_SIZE_16 0x1
812#define lpfc_eq_context_valid_SHIFT 29
813#define lpfc_eq_context_valid_MASK 0x00000001
814#define lpfc_eq_context_valid_WORD word0
815 uint32_t word1;
816#define lpfc_eq_context_count_SHIFT 26
817#define lpfc_eq_context_count_MASK 0x00000003
818#define lpfc_eq_context_count_WORD word1
819#define LPFC_EQ_CNT_256 0x0
820#define LPFC_EQ_CNT_512 0x1
821#define LPFC_EQ_CNT_1024 0x2
822#define LPFC_EQ_CNT_2048 0x3
823#define LPFC_EQ_CNT_4096 0x4
824 uint32_t word2;
825#define lpfc_eq_context_delay_multi_SHIFT 13
826#define lpfc_eq_context_delay_multi_MASK 0x000003FF
827#define lpfc_eq_context_delay_multi_WORD word2
828 uint32_t reserved3;
829};
830
831struct sgl_page_pairs {
832 uint32_t sgl_pg0_addr_lo;
833 uint32_t sgl_pg0_addr_hi;
834 uint32_t sgl_pg1_addr_lo;
835 uint32_t sgl_pg1_addr_hi;
836};
837
838struct lpfc_mbx_post_sgl_pages {
839 struct mbox_header header;
840 uint32_t word0;
841#define lpfc_post_sgl_pages_xri_SHIFT 0
842#define lpfc_post_sgl_pages_xri_MASK 0x0000FFFF
843#define lpfc_post_sgl_pages_xri_WORD word0
844#define lpfc_post_sgl_pages_xricnt_SHIFT 16
845#define lpfc_post_sgl_pages_xricnt_MASK 0x0000FFFF
846#define lpfc_post_sgl_pages_xricnt_WORD word0
847 struct sgl_page_pairs sgl_pg_pairs[1];
848};
849
850/* word0 of page-1 struct shares the same SHIFT/MASK/WORD defines as above */
851struct lpfc_mbx_post_uembed_sgl_page1 {
852 union lpfc_sli4_cfg_shdr cfg_shdr;
853 uint32_t word0;
854 struct sgl_page_pairs sgl_pg_pairs;
855};
856
857struct lpfc_mbx_sge {
858 uint32_t pa_lo;
859 uint32_t pa_hi;
860 uint32_t length;
861};
862
863struct lpfc_mbx_nembed_cmd {
864 struct lpfc_sli4_cfg_mhdr cfg_mhdr;
865#define LPFC_SLI4_MBX_SGE_MAX_PAGES 19
866 struct lpfc_mbx_sge sge[LPFC_SLI4_MBX_SGE_MAX_PAGES];
867};
868
869struct lpfc_mbx_nembed_sge_virt {
870 void *addr[LPFC_SLI4_MBX_SGE_MAX_PAGES];
871};
872
873struct lpfc_mbx_eq_create {
874 struct mbox_header header;
875 union {
876 struct {
877 uint32_t word0;
878#define lpfc_mbx_eq_create_num_pages_SHIFT 0
879#define lpfc_mbx_eq_create_num_pages_MASK 0x0000FFFF
880#define lpfc_mbx_eq_create_num_pages_WORD word0
881 struct eq_context context;
882 struct dma_address page[LPFC_MAX_EQ_PAGE];
883 } request;
884 struct {
885 uint32_t word0;
886#define lpfc_mbx_eq_create_q_id_SHIFT 0
887#define lpfc_mbx_eq_create_q_id_MASK 0x0000FFFF
888#define lpfc_mbx_eq_create_q_id_WORD word0
889 } response;
890 } u;
891};
892
893struct lpfc_mbx_eq_destroy {
894 struct mbox_header header;
895 union {
896 struct {
897 uint32_t word0;
898#define lpfc_mbx_eq_destroy_q_id_SHIFT 0
899#define lpfc_mbx_eq_destroy_q_id_MASK 0x0000FFFF
900#define lpfc_mbx_eq_destroy_q_id_WORD word0
901 } request;
902 struct {
903 uint32_t word0;
904 } response;
905 } u;
906};
907
908struct lpfc_mbx_nop {
909 struct mbox_header header;
910 uint32_t context[2];
911};
912
913struct cq_context {
914 uint32_t word0;
915#define lpfc_cq_context_event_SHIFT 31
916#define lpfc_cq_context_event_MASK 0x00000001
917#define lpfc_cq_context_event_WORD word0
918#define lpfc_cq_context_valid_SHIFT 29
919#define lpfc_cq_context_valid_MASK 0x00000001
920#define lpfc_cq_context_valid_WORD word0
921#define lpfc_cq_context_count_SHIFT 27
922#define lpfc_cq_context_count_MASK 0x00000003
923#define lpfc_cq_context_count_WORD word0
924#define LPFC_CQ_CNT_256 0x0
925#define LPFC_CQ_CNT_512 0x1
926#define LPFC_CQ_CNT_1024 0x2
927 uint32_t word1;
928#define lpfc_cq_eq_id_SHIFT 22
929#define lpfc_cq_eq_id_MASK 0x000000FF
930#define lpfc_cq_eq_id_WORD word1
931 uint32_t reserved0;
932 uint32_t reserved1;
933};
934
935struct lpfc_mbx_cq_create {
936 struct mbox_header header;
937 union {
938 struct {
939 uint32_t word0;
940#define lpfc_mbx_cq_create_num_pages_SHIFT 0
941#define lpfc_mbx_cq_create_num_pages_MASK 0x0000FFFF
942#define lpfc_mbx_cq_create_num_pages_WORD word0
943 struct cq_context context;
944 struct dma_address page[LPFC_MAX_CQ_PAGE];
945 } request;
946 struct {
947 uint32_t word0;
948#define lpfc_mbx_cq_create_q_id_SHIFT 0
949#define lpfc_mbx_cq_create_q_id_MASK 0x0000FFFF
950#define lpfc_mbx_cq_create_q_id_WORD word0
951 } response;
952 } u;
953};
954
955struct lpfc_mbx_cq_destroy {
956 struct mbox_header header;
957 union {
958 struct {
959 uint32_t word0;
960#define lpfc_mbx_cq_destroy_q_id_SHIFT 0
961#define lpfc_mbx_cq_destroy_q_id_MASK 0x0000FFFF
962#define lpfc_mbx_cq_destroy_q_id_WORD word0
963 } request;
964 struct {
965 uint32_t word0;
966 } response;
967 } u;
968};
969
970struct wq_context {
971 uint32_t reserved0;
972 uint32_t reserved1;
973 uint32_t reserved2;
974 uint32_t reserved3;
975};
976
977struct lpfc_mbx_wq_create {
978 struct mbox_header header;
979 union {
980 struct {
981 uint32_t word0;
982#define lpfc_mbx_wq_create_num_pages_SHIFT 0
983#define lpfc_mbx_wq_create_num_pages_MASK 0x0000FFFF
984#define lpfc_mbx_wq_create_num_pages_WORD word0
985#define lpfc_mbx_wq_create_cq_id_SHIFT 16
986#define lpfc_mbx_wq_create_cq_id_MASK 0x0000FFFF
987#define lpfc_mbx_wq_create_cq_id_WORD word0
988 struct dma_address page[LPFC_MAX_WQ_PAGE];
989 } request;
990 struct {
991 uint32_t word0;
992#define lpfc_mbx_wq_create_q_id_SHIFT 0
993#define lpfc_mbx_wq_create_q_id_MASK 0x0000FFFF
994#define lpfc_mbx_wq_create_q_id_WORD word0
995 } response;
996 } u;
997};
998
999struct lpfc_mbx_wq_destroy {
1000 struct mbox_header header;
1001 union {
1002 struct {
1003 uint32_t word0;
1004#define lpfc_mbx_wq_destroy_q_id_SHIFT 0
1005#define lpfc_mbx_wq_destroy_q_id_MASK 0x0000FFFF
1006#define lpfc_mbx_wq_destroy_q_id_WORD word0
1007 } request;
1008 struct {
1009 uint32_t word0;
1010 } response;
1011 } u;
1012};
1013
1014#define LPFC_HDR_BUF_SIZE 128
James Smarteeead812009-12-21 17:01:23 -05001015#define LPFC_DATA_BUF_SIZE 2048
James Smartda0436e2009-05-22 14:51:39 -04001016struct rq_context {
1017 uint32_t word0;
1018#define lpfc_rq_context_rq_size_SHIFT 16
1019#define lpfc_rq_context_rq_size_MASK 0x0000000F
1020#define lpfc_rq_context_rq_size_WORD word0
1021#define LPFC_RQ_RING_SIZE_512 9 /* 512 entries */
1022#define LPFC_RQ_RING_SIZE_1024 10 /* 1024 entries */
1023#define LPFC_RQ_RING_SIZE_2048 11 /* 2048 entries */
1024#define LPFC_RQ_RING_SIZE_4096 12 /* 4096 entries */
1025 uint32_t reserved1;
1026 uint32_t word2;
1027#define lpfc_rq_context_cq_id_SHIFT 16
1028#define lpfc_rq_context_cq_id_MASK 0x000003FF
1029#define lpfc_rq_context_cq_id_WORD word2
1030#define lpfc_rq_context_buf_size_SHIFT 0
1031#define lpfc_rq_context_buf_size_MASK 0x0000FFFF
1032#define lpfc_rq_context_buf_size_WORD word2
1033 uint32_t reserved3;
1034};
1035
1036struct lpfc_mbx_rq_create {
1037 struct mbox_header header;
1038 union {
1039 struct {
1040 uint32_t word0;
1041#define lpfc_mbx_rq_create_num_pages_SHIFT 0
1042#define lpfc_mbx_rq_create_num_pages_MASK 0x0000FFFF
1043#define lpfc_mbx_rq_create_num_pages_WORD word0
1044 struct rq_context context;
1045 struct dma_address page[LPFC_MAX_WQ_PAGE];
1046 } request;
1047 struct {
1048 uint32_t word0;
1049#define lpfc_mbx_rq_create_q_id_SHIFT 0
1050#define lpfc_mbx_rq_create_q_id_MASK 0x0000FFFF
1051#define lpfc_mbx_rq_create_q_id_WORD word0
1052 } response;
1053 } u;
1054};
1055
1056struct lpfc_mbx_rq_destroy {
1057 struct mbox_header header;
1058 union {
1059 struct {
1060 uint32_t word0;
1061#define lpfc_mbx_rq_destroy_q_id_SHIFT 0
1062#define lpfc_mbx_rq_destroy_q_id_MASK 0x0000FFFF
1063#define lpfc_mbx_rq_destroy_q_id_WORD word0
1064 } request;
1065 struct {
1066 uint32_t word0;
1067 } response;
1068 } u;
1069};
1070
1071struct mq_context {
1072 uint32_t word0;
1073#define lpfc_mq_context_cq_id_SHIFT 22
1074#define lpfc_mq_context_cq_id_MASK 0x000003FF
1075#define lpfc_mq_context_cq_id_WORD word0
1076#define lpfc_mq_context_count_SHIFT 16
1077#define lpfc_mq_context_count_MASK 0x0000000F
1078#define lpfc_mq_context_count_WORD word0
1079#define LPFC_MQ_CNT_16 0x5
1080#define LPFC_MQ_CNT_32 0x6
1081#define LPFC_MQ_CNT_64 0x7
1082#define LPFC_MQ_CNT_128 0x8
1083 uint32_t word1;
1084#define lpfc_mq_context_valid_SHIFT 31
1085#define lpfc_mq_context_valid_MASK 0x00000001
1086#define lpfc_mq_context_valid_WORD word1
1087 uint32_t reserved2;
1088 uint32_t reserved3;
1089};
1090
1091struct lpfc_mbx_mq_create {
1092 struct mbox_header header;
1093 union {
1094 struct {
1095 uint32_t word0;
1096#define lpfc_mbx_mq_create_num_pages_SHIFT 0
1097#define lpfc_mbx_mq_create_num_pages_MASK 0x0000FFFF
1098#define lpfc_mbx_mq_create_num_pages_WORD word0
1099 struct mq_context context;
1100 struct dma_address page[LPFC_MAX_MQ_PAGE];
1101 } request;
1102 struct {
1103 uint32_t word0;
1104#define lpfc_mbx_mq_create_q_id_SHIFT 0
1105#define lpfc_mbx_mq_create_q_id_MASK 0x0000FFFF
1106#define lpfc_mbx_mq_create_q_id_WORD word0
1107 } response;
1108 } u;
1109};
1110
1111struct lpfc_mbx_mq_destroy {
1112 struct mbox_header header;
1113 union {
1114 struct {
1115 uint32_t word0;
1116#define lpfc_mbx_mq_destroy_q_id_SHIFT 0
1117#define lpfc_mbx_mq_destroy_q_id_MASK 0x0000FFFF
1118#define lpfc_mbx_mq_destroy_q_id_WORD word0
1119 } request;
1120 struct {
1121 uint32_t word0;
1122 } response;
1123 } u;
1124};
1125
1126struct lpfc_mbx_post_hdr_tmpl {
1127 struct mbox_header header;
1128 uint32_t word10;
1129#define lpfc_mbx_post_hdr_tmpl_rpi_offset_SHIFT 0
1130#define lpfc_mbx_post_hdr_tmpl_rpi_offset_MASK 0x0000FFFF
1131#define lpfc_mbx_post_hdr_tmpl_rpi_offset_WORD word10
1132#define lpfc_mbx_post_hdr_tmpl_page_cnt_SHIFT 16
1133#define lpfc_mbx_post_hdr_tmpl_page_cnt_MASK 0x0000FFFF
1134#define lpfc_mbx_post_hdr_tmpl_page_cnt_WORD word10
1135 uint32_t rpi_paddr_lo;
1136 uint32_t rpi_paddr_hi;
1137};
1138
1139struct sli4_sge { /* SLI-4 */
1140 uint32_t addr_hi;
1141 uint32_t addr_lo;
1142
1143 uint32_t word2;
1144#define lpfc_sli4_sge_offset_SHIFT 0 /* Offset of buffer - Not used*/
1145#define lpfc_sli4_sge_offset_MASK 0x00FFFFFF
1146#define lpfc_sli4_sge_offset_WORD word2
1147#define lpfc_sli4_sge_last_SHIFT 31 /* Last SEG in the SGL sets
1148 this flag !! */
1149#define lpfc_sli4_sge_last_MASK 0x00000001
1150#define lpfc_sli4_sge_last_WORD word2
James Smart28baac72010-02-12 14:42:03 -05001151 uint32_t sge_len;
James Smartda0436e2009-05-22 14:51:39 -04001152};
1153
1154struct fcf_record {
1155 uint32_t max_rcv_size;
1156 uint32_t fka_adv_period;
1157 uint32_t fip_priority;
1158 uint32_t word3;
1159#define lpfc_fcf_record_mac_0_SHIFT 0
1160#define lpfc_fcf_record_mac_0_MASK 0x000000FF
1161#define lpfc_fcf_record_mac_0_WORD word3
1162#define lpfc_fcf_record_mac_1_SHIFT 8
1163#define lpfc_fcf_record_mac_1_MASK 0x000000FF
1164#define lpfc_fcf_record_mac_1_WORD word3
1165#define lpfc_fcf_record_mac_2_SHIFT 16
1166#define lpfc_fcf_record_mac_2_MASK 0x000000FF
1167#define lpfc_fcf_record_mac_2_WORD word3
1168#define lpfc_fcf_record_mac_3_SHIFT 24
1169#define lpfc_fcf_record_mac_3_MASK 0x000000FF
1170#define lpfc_fcf_record_mac_3_WORD word3
1171 uint32_t word4;
1172#define lpfc_fcf_record_mac_4_SHIFT 0
1173#define lpfc_fcf_record_mac_4_MASK 0x000000FF
1174#define lpfc_fcf_record_mac_4_WORD word4
1175#define lpfc_fcf_record_mac_5_SHIFT 8
1176#define lpfc_fcf_record_mac_5_MASK 0x000000FF
1177#define lpfc_fcf_record_mac_5_WORD word4
1178#define lpfc_fcf_record_fcf_avail_SHIFT 16
1179#define lpfc_fcf_record_fcf_avail_MASK 0x000000FF
James Smart0c287582009-06-10 17:22:56 -04001180#define lpfc_fcf_record_fcf_avail_WORD word4
James Smartda0436e2009-05-22 14:51:39 -04001181#define lpfc_fcf_record_mac_addr_prov_SHIFT 24
1182#define lpfc_fcf_record_mac_addr_prov_MASK 0x000000FF
1183#define lpfc_fcf_record_mac_addr_prov_WORD word4
1184#define LPFC_FCF_FPMA 1 /* Fabric Provided MAC Address */
1185#define LPFC_FCF_SPMA 2 /* Server Provided MAC Address */
1186 uint32_t word5;
1187#define lpfc_fcf_record_fab_name_0_SHIFT 0
1188#define lpfc_fcf_record_fab_name_0_MASK 0x000000FF
1189#define lpfc_fcf_record_fab_name_0_WORD word5
1190#define lpfc_fcf_record_fab_name_1_SHIFT 8
1191#define lpfc_fcf_record_fab_name_1_MASK 0x000000FF
1192#define lpfc_fcf_record_fab_name_1_WORD word5
1193#define lpfc_fcf_record_fab_name_2_SHIFT 16
1194#define lpfc_fcf_record_fab_name_2_MASK 0x000000FF
1195#define lpfc_fcf_record_fab_name_2_WORD word5
1196#define lpfc_fcf_record_fab_name_3_SHIFT 24
1197#define lpfc_fcf_record_fab_name_3_MASK 0x000000FF
1198#define lpfc_fcf_record_fab_name_3_WORD word5
1199 uint32_t word6;
1200#define lpfc_fcf_record_fab_name_4_SHIFT 0
1201#define lpfc_fcf_record_fab_name_4_MASK 0x000000FF
1202#define lpfc_fcf_record_fab_name_4_WORD word6
1203#define lpfc_fcf_record_fab_name_5_SHIFT 8
1204#define lpfc_fcf_record_fab_name_5_MASK 0x000000FF
1205#define lpfc_fcf_record_fab_name_5_WORD word6
1206#define lpfc_fcf_record_fab_name_6_SHIFT 16
1207#define lpfc_fcf_record_fab_name_6_MASK 0x000000FF
1208#define lpfc_fcf_record_fab_name_6_WORD word6
1209#define lpfc_fcf_record_fab_name_7_SHIFT 24
1210#define lpfc_fcf_record_fab_name_7_MASK 0x000000FF
1211#define lpfc_fcf_record_fab_name_7_WORD word6
1212 uint32_t word7;
1213#define lpfc_fcf_record_fc_map_0_SHIFT 0
1214#define lpfc_fcf_record_fc_map_0_MASK 0x000000FF
1215#define lpfc_fcf_record_fc_map_0_WORD word7
1216#define lpfc_fcf_record_fc_map_1_SHIFT 8
1217#define lpfc_fcf_record_fc_map_1_MASK 0x000000FF
1218#define lpfc_fcf_record_fc_map_1_WORD word7
1219#define lpfc_fcf_record_fc_map_2_SHIFT 16
1220#define lpfc_fcf_record_fc_map_2_MASK 0x000000FF
1221#define lpfc_fcf_record_fc_map_2_WORD word7
1222#define lpfc_fcf_record_fcf_valid_SHIFT 24
1223#define lpfc_fcf_record_fcf_valid_MASK 0x000000FF
1224#define lpfc_fcf_record_fcf_valid_WORD word7
1225 uint32_t word8;
1226#define lpfc_fcf_record_fcf_index_SHIFT 0
1227#define lpfc_fcf_record_fcf_index_MASK 0x0000FFFF
1228#define lpfc_fcf_record_fcf_index_WORD word8
1229#define lpfc_fcf_record_fcf_state_SHIFT 16
1230#define lpfc_fcf_record_fcf_state_MASK 0x0000FFFF
1231#define lpfc_fcf_record_fcf_state_WORD word8
1232 uint8_t vlan_bitmap[512];
James Smart8fa38512009-07-19 10:01:03 -04001233 uint32_t word137;
1234#define lpfc_fcf_record_switch_name_0_SHIFT 0
1235#define lpfc_fcf_record_switch_name_0_MASK 0x000000FF
1236#define lpfc_fcf_record_switch_name_0_WORD word137
1237#define lpfc_fcf_record_switch_name_1_SHIFT 8
1238#define lpfc_fcf_record_switch_name_1_MASK 0x000000FF
1239#define lpfc_fcf_record_switch_name_1_WORD word137
1240#define lpfc_fcf_record_switch_name_2_SHIFT 16
1241#define lpfc_fcf_record_switch_name_2_MASK 0x000000FF
1242#define lpfc_fcf_record_switch_name_2_WORD word137
1243#define lpfc_fcf_record_switch_name_3_SHIFT 24
1244#define lpfc_fcf_record_switch_name_3_MASK 0x000000FF
1245#define lpfc_fcf_record_switch_name_3_WORD word137
1246 uint32_t word138;
1247#define lpfc_fcf_record_switch_name_4_SHIFT 0
1248#define lpfc_fcf_record_switch_name_4_MASK 0x000000FF
1249#define lpfc_fcf_record_switch_name_4_WORD word138
1250#define lpfc_fcf_record_switch_name_5_SHIFT 8
1251#define lpfc_fcf_record_switch_name_5_MASK 0x000000FF
1252#define lpfc_fcf_record_switch_name_5_WORD word138
1253#define lpfc_fcf_record_switch_name_6_SHIFT 16
1254#define lpfc_fcf_record_switch_name_6_MASK 0x000000FF
1255#define lpfc_fcf_record_switch_name_6_WORD word138
1256#define lpfc_fcf_record_switch_name_7_SHIFT 24
1257#define lpfc_fcf_record_switch_name_7_MASK 0x000000FF
1258#define lpfc_fcf_record_switch_name_7_WORD word138
James Smartda0436e2009-05-22 14:51:39 -04001259};
1260
1261struct lpfc_mbx_read_fcf_tbl {
1262 union lpfc_sli4_cfg_shdr cfg_shdr;
1263 union {
1264 struct {
1265 uint32_t word10;
1266#define lpfc_mbx_read_fcf_tbl_indx_SHIFT 0
1267#define lpfc_mbx_read_fcf_tbl_indx_MASK 0x0000FFFF
1268#define lpfc_mbx_read_fcf_tbl_indx_WORD word10
1269 } request;
1270 struct {
1271 uint32_t eventag;
1272 } response;
1273 } u;
1274 uint32_t word11;
1275#define lpfc_mbx_read_fcf_tbl_nxt_vindx_SHIFT 0
1276#define lpfc_mbx_read_fcf_tbl_nxt_vindx_MASK 0x0000FFFF
1277#define lpfc_mbx_read_fcf_tbl_nxt_vindx_WORD word11
1278};
1279
1280struct lpfc_mbx_add_fcf_tbl_entry {
1281 union lpfc_sli4_cfg_shdr cfg_shdr;
1282 uint32_t word10;
1283#define lpfc_mbx_add_fcf_tbl_fcfi_SHIFT 0
1284#define lpfc_mbx_add_fcf_tbl_fcfi_MASK 0x0000FFFF
1285#define lpfc_mbx_add_fcf_tbl_fcfi_WORD word10
1286 struct lpfc_mbx_sge fcf_sge;
1287};
1288
1289struct lpfc_mbx_del_fcf_tbl_entry {
1290 struct mbox_header header;
1291 uint32_t word10;
1292#define lpfc_mbx_del_fcf_tbl_count_SHIFT 0
1293#define lpfc_mbx_del_fcf_tbl_count_MASK 0x0000FFFF
1294#define lpfc_mbx_del_fcf_tbl_count_WORD word10
1295#define lpfc_mbx_del_fcf_tbl_index_SHIFT 16
1296#define lpfc_mbx_del_fcf_tbl_index_MASK 0x0000FFFF
1297#define lpfc_mbx_del_fcf_tbl_index_WORD word10
1298};
1299
James Smartecfd03c2010-02-12 14:41:27 -05001300struct lpfc_mbx_redisc_fcf_tbl {
1301 struct mbox_header header;
1302 uint32_t word10;
1303#define lpfc_mbx_redisc_fcf_count_SHIFT 0
1304#define lpfc_mbx_redisc_fcf_count_MASK 0x0000FFFF
1305#define lpfc_mbx_redisc_fcf_count_WORD word10
1306 uint32_t resvd;
1307 uint32_t word12;
1308#define lpfc_mbx_redisc_fcf_index_SHIFT 0
1309#define lpfc_mbx_redisc_fcf_index_MASK 0x0000FFFF
1310#define lpfc_mbx_redisc_fcf_index_WORD word12
1311};
1312
James Smart6669f9b2009-10-02 15:16:45 -04001313struct lpfc_mbx_query_fw_cfg {
1314 struct mbox_header header;
1315 uint32_t config_number;
1316 uint32_t asic_rev;
1317 uint32_t phys_port;
1318 uint32_t function_mode;
1319/* firmware Function Mode */
1320#define lpfc_function_mode_toe_SHIFT 0
1321#define lpfc_function_mode_toe_MASK 0x00000001
1322#define lpfc_function_mode_toe_WORD function_mode
1323#define lpfc_function_mode_nic_SHIFT 1
1324#define lpfc_function_mode_nic_MASK 0x00000001
1325#define lpfc_function_mode_nic_WORD function_mode
1326#define lpfc_function_mode_rdma_SHIFT 2
1327#define lpfc_function_mode_rdma_MASK 0x00000001
1328#define lpfc_function_mode_rdma_WORD function_mode
1329#define lpfc_function_mode_vm_SHIFT 3
1330#define lpfc_function_mode_vm_MASK 0x00000001
1331#define lpfc_function_mode_vm_WORD function_mode
1332#define lpfc_function_mode_iscsi_i_SHIFT 4
1333#define lpfc_function_mode_iscsi_i_MASK 0x00000001
1334#define lpfc_function_mode_iscsi_i_WORD function_mode
1335#define lpfc_function_mode_iscsi_t_SHIFT 5
1336#define lpfc_function_mode_iscsi_t_MASK 0x00000001
1337#define lpfc_function_mode_iscsi_t_WORD function_mode
1338#define lpfc_function_mode_fcoe_i_SHIFT 6
1339#define lpfc_function_mode_fcoe_i_MASK 0x00000001
1340#define lpfc_function_mode_fcoe_i_WORD function_mode
1341#define lpfc_function_mode_fcoe_t_SHIFT 7
1342#define lpfc_function_mode_fcoe_t_MASK 0x00000001
1343#define lpfc_function_mode_fcoe_t_WORD function_mode
1344#define lpfc_function_mode_dal_SHIFT 8
1345#define lpfc_function_mode_dal_MASK 0x00000001
1346#define lpfc_function_mode_dal_WORD function_mode
1347#define lpfc_function_mode_lro_SHIFT 9
1348#define lpfc_function_mode_lro_MASK 0x00000001
1349#define lpfc_function_mode_lro_WORD function_mode9
1350#define lpfc_function_mode_flex10_SHIFT 10
1351#define lpfc_function_mode_flex10_MASK 0x00000001
1352#define lpfc_function_mode_flex10_WORD function_mode
1353#define lpfc_function_mode_ncsi_SHIFT 11
1354#define lpfc_function_mode_ncsi_MASK 0x00000001
1355#define lpfc_function_mode_ncsi_WORD function_mode
1356};
1357
James Smartda0436e2009-05-22 14:51:39 -04001358/* Status field for embedded SLI_CONFIG mailbox command */
1359#define STATUS_SUCCESS 0x0
1360#define STATUS_FAILED 0x1
1361#define STATUS_ILLEGAL_REQUEST 0x2
1362#define STATUS_ILLEGAL_FIELD 0x3
1363#define STATUS_INSUFFICIENT_BUFFER 0x4
1364#define STATUS_UNAUTHORIZED_REQUEST 0x5
1365#define STATUS_FLASHROM_SAVE_FAILED 0x17
1366#define STATUS_FLASHROM_RESTORE_FAILED 0x18
1367#define STATUS_ICCBINDEX_ALLOC_FAILED 0x1a
1368#define STATUS_IOCTLHANDLE_ALLOC_FAILED 0x1b
1369#define STATUS_INVALID_PHY_ADDR_FROM_OSM 0x1c
1370#define STATUS_INVALID_PHY_ADDR_LEN_FROM_OSM 0x1d
1371#define STATUS_ASSERT_FAILED 0x1e
1372#define STATUS_INVALID_SESSION 0x1f
1373#define STATUS_INVALID_CONNECTION 0x20
1374#define STATUS_BTL_PATH_EXCEEDS_OSM_LIMIT 0x21
1375#define STATUS_BTL_NO_FREE_SLOT_PATH 0x24
1376#define STATUS_BTL_NO_FREE_SLOT_TGTID 0x25
1377#define STATUS_OSM_DEVSLOT_NOT_FOUND 0x26
1378#define STATUS_FLASHROM_READ_FAILED 0x27
1379#define STATUS_POLL_IOCTL_TIMEOUT 0x28
1380#define STATUS_ERROR_ACITMAIN 0x2a
1381#define STATUS_REBOOT_REQUIRED 0x2c
1382#define STATUS_FCF_IN_USE 0x3a
James Smartdef9c7a2009-12-21 17:02:28 -05001383#define STATUS_FCF_TABLE_EMPTY 0x43
James Smartda0436e2009-05-22 14:51:39 -04001384
1385struct lpfc_mbx_sli4_config {
1386 struct mbox_header header;
1387};
1388
1389struct lpfc_mbx_init_vfi {
1390 uint32_t word1;
1391#define lpfc_init_vfi_vr_SHIFT 31
1392#define lpfc_init_vfi_vr_MASK 0x00000001
1393#define lpfc_init_vfi_vr_WORD word1
1394#define lpfc_init_vfi_vt_SHIFT 30
1395#define lpfc_init_vfi_vt_MASK 0x00000001
1396#define lpfc_init_vfi_vt_WORD word1
1397#define lpfc_init_vfi_vf_SHIFT 29
1398#define lpfc_init_vfi_vf_MASK 0x00000001
1399#define lpfc_init_vfi_vf_WORD word1
1400#define lpfc_init_vfi_vfi_SHIFT 0
1401#define lpfc_init_vfi_vfi_MASK 0x0000FFFF
1402#define lpfc_init_vfi_vfi_WORD word1
1403 uint32_t word2;
1404#define lpfc_init_vfi_fcfi_SHIFT 0
1405#define lpfc_init_vfi_fcfi_MASK 0x0000FFFF
1406#define lpfc_init_vfi_fcfi_WORD word2
1407 uint32_t word3;
1408#define lpfc_init_vfi_pri_SHIFT 13
1409#define lpfc_init_vfi_pri_MASK 0x00000007
1410#define lpfc_init_vfi_pri_WORD word3
1411#define lpfc_init_vfi_vf_id_SHIFT 1
1412#define lpfc_init_vfi_vf_id_MASK 0x00000FFF
1413#define lpfc_init_vfi_vf_id_WORD word3
1414 uint32_t word4;
1415#define lpfc_init_vfi_hop_count_SHIFT 24
1416#define lpfc_init_vfi_hop_count_MASK 0x000000FF
1417#define lpfc_init_vfi_hop_count_WORD word4
1418};
1419
1420struct lpfc_mbx_reg_vfi {
1421 uint32_t word1;
1422#define lpfc_reg_vfi_vp_SHIFT 28
1423#define lpfc_reg_vfi_vp_MASK 0x00000001
1424#define lpfc_reg_vfi_vp_WORD word1
1425#define lpfc_reg_vfi_vfi_SHIFT 0
1426#define lpfc_reg_vfi_vfi_MASK 0x0000FFFF
1427#define lpfc_reg_vfi_vfi_WORD word1
1428 uint32_t word2;
1429#define lpfc_reg_vfi_vpi_SHIFT 16
1430#define lpfc_reg_vfi_vpi_MASK 0x0000FFFF
1431#define lpfc_reg_vfi_vpi_WORD word2
1432#define lpfc_reg_vfi_fcfi_SHIFT 0
1433#define lpfc_reg_vfi_fcfi_MASK 0x0000FFFF
1434#define lpfc_reg_vfi_fcfi_WORD word2
James Smartc8685952009-11-18 15:39:16 -05001435 uint32_t wwn[2];
James Smartda0436e2009-05-22 14:51:39 -04001436 struct ulp_bde64 bde;
1437 uint32_t word8_rsvd;
1438 uint32_t word9_rsvd;
1439 uint32_t word10;
1440#define lpfc_reg_vfi_nport_id_SHIFT 0
1441#define lpfc_reg_vfi_nport_id_MASK 0x00FFFFFF
1442#define lpfc_reg_vfi_nport_id_WORD word10
1443};
1444
1445struct lpfc_mbx_init_vpi {
1446 uint32_t word1;
1447#define lpfc_init_vpi_vfi_SHIFT 16
1448#define lpfc_init_vpi_vfi_MASK 0x0000FFFF
1449#define lpfc_init_vpi_vfi_WORD word1
1450#define lpfc_init_vpi_vpi_SHIFT 0
1451#define lpfc_init_vpi_vpi_MASK 0x0000FFFF
1452#define lpfc_init_vpi_vpi_WORD word1
1453};
1454
1455struct lpfc_mbx_read_vpi {
1456 uint32_t word1_rsvd;
1457 uint32_t word2;
1458#define lpfc_mbx_read_vpi_vnportid_SHIFT 0
1459#define lpfc_mbx_read_vpi_vnportid_MASK 0x00FFFFFF
1460#define lpfc_mbx_read_vpi_vnportid_WORD word2
1461 uint32_t word3_rsvd;
1462 uint32_t word4;
1463#define lpfc_mbx_read_vpi_acq_alpa_SHIFT 0
1464#define lpfc_mbx_read_vpi_acq_alpa_MASK 0x000000FF
1465#define lpfc_mbx_read_vpi_acq_alpa_WORD word4
1466#define lpfc_mbx_read_vpi_pb_SHIFT 15
1467#define lpfc_mbx_read_vpi_pb_MASK 0x00000001
1468#define lpfc_mbx_read_vpi_pb_WORD word4
1469#define lpfc_mbx_read_vpi_spec_alpa_SHIFT 16
1470#define lpfc_mbx_read_vpi_spec_alpa_MASK 0x000000FF
1471#define lpfc_mbx_read_vpi_spec_alpa_WORD word4
1472#define lpfc_mbx_read_vpi_ns_SHIFT 30
1473#define lpfc_mbx_read_vpi_ns_MASK 0x00000001
1474#define lpfc_mbx_read_vpi_ns_WORD word4
1475#define lpfc_mbx_read_vpi_hl_SHIFT 31
1476#define lpfc_mbx_read_vpi_hl_MASK 0x00000001
1477#define lpfc_mbx_read_vpi_hl_WORD word4
1478 uint32_t word5_rsvd;
1479 uint32_t word6;
1480#define lpfc_mbx_read_vpi_vpi_SHIFT 0
1481#define lpfc_mbx_read_vpi_vpi_MASK 0x0000FFFF
1482#define lpfc_mbx_read_vpi_vpi_WORD word6
1483 uint32_t word7;
1484#define lpfc_mbx_read_vpi_mac_0_SHIFT 0
1485#define lpfc_mbx_read_vpi_mac_0_MASK 0x000000FF
1486#define lpfc_mbx_read_vpi_mac_0_WORD word7
1487#define lpfc_mbx_read_vpi_mac_1_SHIFT 8
1488#define lpfc_mbx_read_vpi_mac_1_MASK 0x000000FF
1489#define lpfc_mbx_read_vpi_mac_1_WORD word7
1490#define lpfc_mbx_read_vpi_mac_2_SHIFT 16
1491#define lpfc_mbx_read_vpi_mac_2_MASK 0x000000FF
1492#define lpfc_mbx_read_vpi_mac_2_WORD word7
1493#define lpfc_mbx_read_vpi_mac_3_SHIFT 24
1494#define lpfc_mbx_read_vpi_mac_3_MASK 0x000000FF
1495#define lpfc_mbx_read_vpi_mac_3_WORD word7
1496 uint32_t word8;
1497#define lpfc_mbx_read_vpi_mac_4_SHIFT 0
1498#define lpfc_mbx_read_vpi_mac_4_MASK 0x000000FF
1499#define lpfc_mbx_read_vpi_mac_4_WORD word8
1500#define lpfc_mbx_read_vpi_mac_5_SHIFT 8
1501#define lpfc_mbx_read_vpi_mac_5_MASK 0x000000FF
1502#define lpfc_mbx_read_vpi_mac_5_WORD word8
1503#define lpfc_mbx_read_vpi_vlan_tag_SHIFT 16
1504#define lpfc_mbx_read_vpi_vlan_tag_MASK 0x00000FFF
1505#define lpfc_mbx_read_vpi_vlan_tag_WORD word8
1506#define lpfc_mbx_read_vpi_vv_SHIFT 28
1507#define lpfc_mbx_read_vpi_vv_MASK 0x0000001
1508#define lpfc_mbx_read_vpi_vv_WORD word8
1509};
1510
1511struct lpfc_mbx_unreg_vfi {
1512 uint32_t word1_rsvd;
1513 uint32_t word2;
1514#define lpfc_unreg_vfi_vfi_SHIFT 0
1515#define lpfc_unreg_vfi_vfi_MASK 0x0000FFFF
1516#define lpfc_unreg_vfi_vfi_WORD word2
1517};
1518
1519struct lpfc_mbx_resume_rpi {
1520 uint32_t word1;
James Smart8fa38512009-07-19 10:01:03 -04001521#define lpfc_resume_rpi_index_SHIFT 0
1522#define lpfc_resume_rpi_index_MASK 0x0000FFFF
1523#define lpfc_resume_rpi_index_WORD word1
1524#define lpfc_resume_rpi_ii_SHIFT 30
1525#define lpfc_resume_rpi_ii_MASK 0x00000003
1526#define lpfc_resume_rpi_ii_WORD word1
1527#define RESUME_INDEX_RPI 0
1528#define RESUME_INDEX_VPI 1
1529#define RESUME_INDEX_VFI 2
1530#define RESUME_INDEX_FCFI 3
James Smartda0436e2009-05-22 14:51:39 -04001531 uint32_t event_tag;
James Smartda0436e2009-05-22 14:51:39 -04001532};
1533
1534#define REG_FCF_INVALID_QID 0xFFFF
1535struct lpfc_mbx_reg_fcfi {
1536 uint32_t word1;
1537#define lpfc_reg_fcfi_info_index_SHIFT 0
1538#define lpfc_reg_fcfi_info_index_MASK 0x0000FFFF
1539#define lpfc_reg_fcfi_info_index_WORD word1
1540#define lpfc_reg_fcfi_fcfi_SHIFT 16
1541#define lpfc_reg_fcfi_fcfi_MASK 0x0000FFFF
1542#define lpfc_reg_fcfi_fcfi_WORD word1
1543 uint32_t word2;
1544#define lpfc_reg_fcfi_rq_id1_SHIFT 0
1545#define lpfc_reg_fcfi_rq_id1_MASK 0x0000FFFF
1546#define lpfc_reg_fcfi_rq_id1_WORD word2
1547#define lpfc_reg_fcfi_rq_id0_SHIFT 16
1548#define lpfc_reg_fcfi_rq_id0_MASK 0x0000FFFF
1549#define lpfc_reg_fcfi_rq_id0_WORD word2
1550 uint32_t word3;
1551#define lpfc_reg_fcfi_rq_id3_SHIFT 0
1552#define lpfc_reg_fcfi_rq_id3_MASK 0x0000FFFF
1553#define lpfc_reg_fcfi_rq_id3_WORD word3
1554#define lpfc_reg_fcfi_rq_id2_SHIFT 16
1555#define lpfc_reg_fcfi_rq_id2_MASK 0x0000FFFF
1556#define lpfc_reg_fcfi_rq_id2_WORD word3
1557 uint32_t word4;
1558#define lpfc_reg_fcfi_type_match0_SHIFT 24
1559#define lpfc_reg_fcfi_type_match0_MASK 0x000000FF
1560#define lpfc_reg_fcfi_type_match0_WORD word4
1561#define lpfc_reg_fcfi_type_mask0_SHIFT 16
1562#define lpfc_reg_fcfi_type_mask0_MASK 0x000000FF
1563#define lpfc_reg_fcfi_type_mask0_WORD word4
1564#define lpfc_reg_fcfi_rctl_match0_SHIFT 8
1565#define lpfc_reg_fcfi_rctl_match0_MASK 0x000000FF
1566#define lpfc_reg_fcfi_rctl_match0_WORD word4
1567#define lpfc_reg_fcfi_rctl_mask0_SHIFT 0
1568#define lpfc_reg_fcfi_rctl_mask0_MASK 0x000000FF
1569#define lpfc_reg_fcfi_rctl_mask0_WORD word4
1570 uint32_t word5;
1571#define lpfc_reg_fcfi_type_match1_SHIFT 24
1572#define lpfc_reg_fcfi_type_match1_MASK 0x000000FF
1573#define lpfc_reg_fcfi_type_match1_WORD word5
1574#define lpfc_reg_fcfi_type_mask1_SHIFT 16
1575#define lpfc_reg_fcfi_type_mask1_MASK 0x000000FF
1576#define lpfc_reg_fcfi_type_mask1_WORD word5
1577#define lpfc_reg_fcfi_rctl_match1_SHIFT 8
1578#define lpfc_reg_fcfi_rctl_match1_MASK 0x000000FF
1579#define lpfc_reg_fcfi_rctl_match1_WORD word5
1580#define lpfc_reg_fcfi_rctl_mask1_SHIFT 0
1581#define lpfc_reg_fcfi_rctl_mask1_MASK 0x000000FF
1582#define lpfc_reg_fcfi_rctl_mask1_WORD word5
1583 uint32_t word6;
1584#define lpfc_reg_fcfi_type_match2_SHIFT 24
1585#define lpfc_reg_fcfi_type_match2_MASK 0x000000FF
1586#define lpfc_reg_fcfi_type_match2_WORD word6
1587#define lpfc_reg_fcfi_type_mask2_SHIFT 16
1588#define lpfc_reg_fcfi_type_mask2_MASK 0x000000FF
1589#define lpfc_reg_fcfi_type_mask2_WORD word6
1590#define lpfc_reg_fcfi_rctl_match2_SHIFT 8
1591#define lpfc_reg_fcfi_rctl_match2_MASK 0x000000FF
1592#define lpfc_reg_fcfi_rctl_match2_WORD word6
1593#define lpfc_reg_fcfi_rctl_mask2_SHIFT 0
1594#define lpfc_reg_fcfi_rctl_mask2_MASK 0x000000FF
1595#define lpfc_reg_fcfi_rctl_mask2_WORD word6
1596 uint32_t word7;
1597#define lpfc_reg_fcfi_type_match3_SHIFT 24
1598#define lpfc_reg_fcfi_type_match3_MASK 0x000000FF
1599#define lpfc_reg_fcfi_type_match3_WORD word7
1600#define lpfc_reg_fcfi_type_mask3_SHIFT 16
1601#define lpfc_reg_fcfi_type_mask3_MASK 0x000000FF
1602#define lpfc_reg_fcfi_type_mask3_WORD word7
1603#define lpfc_reg_fcfi_rctl_match3_SHIFT 8
1604#define lpfc_reg_fcfi_rctl_match3_MASK 0x000000FF
1605#define lpfc_reg_fcfi_rctl_match3_WORD word7
1606#define lpfc_reg_fcfi_rctl_mask3_SHIFT 0
1607#define lpfc_reg_fcfi_rctl_mask3_MASK 0x000000FF
1608#define lpfc_reg_fcfi_rctl_mask3_WORD word7
1609 uint32_t word8;
1610#define lpfc_reg_fcfi_mam_SHIFT 13
1611#define lpfc_reg_fcfi_mam_MASK 0x00000003
1612#define lpfc_reg_fcfi_mam_WORD word8
1613#define LPFC_MAM_BOTH 0 /* Both SPMA and FPMA */
1614#define LPFC_MAM_SPMA 1 /* Server Provided MAC Address */
1615#define LPFC_MAM_FPMA 2 /* Fabric Provided MAC Address */
1616#define lpfc_reg_fcfi_vv_SHIFT 12
1617#define lpfc_reg_fcfi_vv_MASK 0x00000001
1618#define lpfc_reg_fcfi_vv_WORD word8
1619#define lpfc_reg_fcfi_vlan_tag_SHIFT 0
1620#define lpfc_reg_fcfi_vlan_tag_MASK 0x00000FFF
1621#define lpfc_reg_fcfi_vlan_tag_WORD word8
1622};
1623
1624struct lpfc_mbx_unreg_fcfi {
1625 uint32_t word1_rsv;
1626 uint32_t word2;
1627#define lpfc_unreg_fcfi_SHIFT 0
1628#define lpfc_unreg_fcfi_MASK 0x0000FFFF
1629#define lpfc_unreg_fcfi_WORD word2
1630};
1631
1632struct lpfc_mbx_read_rev {
1633 uint32_t word1;
1634#define lpfc_mbx_rd_rev_sli_lvl_SHIFT 16
1635#define lpfc_mbx_rd_rev_sli_lvl_MASK 0x0000000F
1636#define lpfc_mbx_rd_rev_sli_lvl_WORD word1
1637#define lpfc_mbx_rd_rev_fcoe_SHIFT 20
1638#define lpfc_mbx_rd_rev_fcoe_MASK 0x00000001
1639#define lpfc_mbx_rd_rev_fcoe_WORD word1
James Smart45ed1192009-10-02 15:17:02 -04001640#define lpfc_mbx_rd_rev_cee_ver_SHIFT 21
1641#define lpfc_mbx_rd_rev_cee_ver_MASK 0x00000003
1642#define lpfc_mbx_rd_rev_cee_ver_WORD word1
1643#define LPFC_PREDCBX_CEE_MODE 0
1644#define LPFC_DCBX_CEE_MODE 1
James Smartda0436e2009-05-22 14:51:39 -04001645#define lpfc_mbx_rd_rev_vpd_SHIFT 29
1646#define lpfc_mbx_rd_rev_vpd_MASK 0x00000001
1647#define lpfc_mbx_rd_rev_vpd_WORD word1
1648 uint32_t first_hw_rev;
1649 uint32_t second_hw_rev;
1650 uint32_t word4_rsvd;
1651 uint32_t third_hw_rev;
1652 uint32_t word6;
1653#define lpfc_mbx_rd_rev_fcph_low_SHIFT 0
1654#define lpfc_mbx_rd_rev_fcph_low_MASK 0x000000FF
1655#define lpfc_mbx_rd_rev_fcph_low_WORD word6
1656#define lpfc_mbx_rd_rev_fcph_high_SHIFT 8
1657#define lpfc_mbx_rd_rev_fcph_high_MASK 0x000000FF
1658#define lpfc_mbx_rd_rev_fcph_high_WORD word6
1659#define lpfc_mbx_rd_rev_ftr_lvl_low_SHIFT 16
1660#define lpfc_mbx_rd_rev_ftr_lvl_low_MASK 0x000000FF
1661#define lpfc_mbx_rd_rev_ftr_lvl_low_WORD word6
1662#define lpfc_mbx_rd_rev_ftr_lvl_high_SHIFT 24
1663#define lpfc_mbx_rd_rev_ftr_lvl_high_MASK 0x000000FF
1664#define lpfc_mbx_rd_rev_ftr_lvl_high_WORD word6
1665 uint32_t word7_rsvd;
1666 uint32_t fw_id_rev;
1667 uint8_t fw_name[16];
1668 uint32_t ulp_fw_id_rev;
1669 uint8_t ulp_fw_name[16];
1670 uint32_t word18_47_rsvd[30];
1671 uint32_t word48;
1672#define lpfc_mbx_rd_rev_avail_len_SHIFT 0
1673#define lpfc_mbx_rd_rev_avail_len_MASK 0x00FFFFFF
1674#define lpfc_mbx_rd_rev_avail_len_WORD word48
1675 uint32_t vpd_paddr_low;
1676 uint32_t vpd_paddr_high;
1677 uint32_t avail_vpd_len;
1678 uint32_t rsvd_52_63[12];
1679};
1680
1681struct lpfc_mbx_read_config {
1682 uint32_t word1;
1683#define lpfc_mbx_rd_conf_max_bbc_SHIFT 0
1684#define lpfc_mbx_rd_conf_max_bbc_MASK 0x000000FF
1685#define lpfc_mbx_rd_conf_max_bbc_WORD word1
1686#define lpfc_mbx_rd_conf_init_bbc_SHIFT 8
1687#define lpfc_mbx_rd_conf_init_bbc_MASK 0x000000FF
1688#define lpfc_mbx_rd_conf_init_bbc_WORD word1
1689 uint32_t word2;
1690#define lpfc_mbx_rd_conf_nport_did_SHIFT 0
1691#define lpfc_mbx_rd_conf_nport_did_MASK 0x00FFFFFF
1692#define lpfc_mbx_rd_conf_nport_did_WORD word2
1693#define lpfc_mbx_rd_conf_topology_SHIFT 24
1694#define lpfc_mbx_rd_conf_topology_MASK 0x000000FF
1695#define lpfc_mbx_rd_conf_topology_WORD word2
1696 uint32_t word3;
1697#define lpfc_mbx_rd_conf_ao_SHIFT 0
1698#define lpfc_mbx_rd_conf_ao_MASK 0x00000001
1699#define lpfc_mbx_rd_conf_ao_WORD word3
1700#define lpfc_mbx_rd_conf_bb_scn_SHIFT 8
1701#define lpfc_mbx_rd_conf_bb_scn_MASK 0x0000000F
1702#define lpfc_mbx_rd_conf_bb_scn_WORD word3
1703#define lpfc_mbx_rd_conf_cbb_scn_SHIFT 12
1704#define lpfc_mbx_rd_conf_cbb_scn_MASK 0x0000000F
1705#define lpfc_mbx_rd_conf_cbb_scn_WORD word3
1706#define lpfc_mbx_rd_conf_mc_SHIFT 29
1707#define lpfc_mbx_rd_conf_mc_MASK 0x00000001
1708#define lpfc_mbx_rd_conf_mc_WORD word3
1709 uint32_t word4;
1710#define lpfc_mbx_rd_conf_e_d_tov_SHIFT 0
1711#define lpfc_mbx_rd_conf_e_d_tov_MASK 0x0000FFFF
1712#define lpfc_mbx_rd_conf_e_d_tov_WORD word4
1713 uint32_t word5;
1714#define lpfc_mbx_rd_conf_lp_tov_SHIFT 0
1715#define lpfc_mbx_rd_conf_lp_tov_MASK 0x0000FFFF
1716#define lpfc_mbx_rd_conf_lp_tov_WORD word5
1717 uint32_t word6;
1718#define lpfc_mbx_rd_conf_r_a_tov_SHIFT 0
1719#define lpfc_mbx_rd_conf_r_a_tov_MASK 0x0000FFFF
1720#define lpfc_mbx_rd_conf_r_a_tov_WORD word6
1721 uint32_t word7;
1722#define lpfc_mbx_rd_conf_r_t_tov_SHIFT 0
1723#define lpfc_mbx_rd_conf_r_t_tov_MASK 0x000000FF
1724#define lpfc_mbx_rd_conf_r_t_tov_WORD word7
1725 uint32_t word8;
1726#define lpfc_mbx_rd_conf_al_tov_SHIFT 0
1727#define lpfc_mbx_rd_conf_al_tov_MASK 0x0000000F
1728#define lpfc_mbx_rd_conf_al_tov_WORD word8
1729 uint32_t word9;
1730#define lpfc_mbx_rd_conf_lmt_SHIFT 0
1731#define lpfc_mbx_rd_conf_lmt_MASK 0x0000FFFF
1732#define lpfc_mbx_rd_conf_lmt_WORD word9
1733 uint32_t word10;
1734#define lpfc_mbx_rd_conf_max_alpa_SHIFT 0
1735#define lpfc_mbx_rd_conf_max_alpa_MASK 0x000000FF
1736#define lpfc_mbx_rd_conf_max_alpa_WORD word10
1737 uint32_t word11_rsvd;
1738 uint32_t word12;
1739#define lpfc_mbx_rd_conf_xri_base_SHIFT 0
1740#define lpfc_mbx_rd_conf_xri_base_MASK 0x0000FFFF
1741#define lpfc_mbx_rd_conf_xri_base_WORD word12
1742#define lpfc_mbx_rd_conf_xri_count_SHIFT 16
1743#define lpfc_mbx_rd_conf_xri_count_MASK 0x0000FFFF
1744#define lpfc_mbx_rd_conf_xri_count_WORD word12
1745 uint32_t word13;
1746#define lpfc_mbx_rd_conf_rpi_base_SHIFT 0
1747#define lpfc_mbx_rd_conf_rpi_base_MASK 0x0000FFFF
1748#define lpfc_mbx_rd_conf_rpi_base_WORD word13
1749#define lpfc_mbx_rd_conf_rpi_count_SHIFT 16
1750#define lpfc_mbx_rd_conf_rpi_count_MASK 0x0000FFFF
1751#define lpfc_mbx_rd_conf_rpi_count_WORD word13
1752 uint32_t word14;
1753#define lpfc_mbx_rd_conf_vpi_base_SHIFT 0
1754#define lpfc_mbx_rd_conf_vpi_base_MASK 0x0000FFFF
1755#define lpfc_mbx_rd_conf_vpi_base_WORD word14
1756#define lpfc_mbx_rd_conf_vpi_count_SHIFT 16
1757#define lpfc_mbx_rd_conf_vpi_count_MASK 0x0000FFFF
1758#define lpfc_mbx_rd_conf_vpi_count_WORD word14
1759 uint32_t word15;
1760#define lpfc_mbx_rd_conf_vfi_base_SHIFT 0
1761#define lpfc_mbx_rd_conf_vfi_base_MASK 0x0000FFFF
1762#define lpfc_mbx_rd_conf_vfi_base_WORD word15
1763#define lpfc_mbx_rd_conf_vfi_count_SHIFT 16
1764#define lpfc_mbx_rd_conf_vfi_count_MASK 0x0000FFFF
1765#define lpfc_mbx_rd_conf_vfi_count_WORD word15
1766 uint32_t word16;
1767#define lpfc_mbx_rd_conf_fcfi_base_SHIFT 0
1768#define lpfc_mbx_rd_conf_fcfi_base_MASK 0x0000FFFF
1769#define lpfc_mbx_rd_conf_fcfi_base_WORD word16
1770#define lpfc_mbx_rd_conf_fcfi_count_SHIFT 16
1771#define lpfc_mbx_rd_conf_fcfi_count_MASK 0x0000FFFF
1772#define lpfc_mbx_rd_conf_fcfi_count_WORD word16
1773 uint32_t word17;
1774#define lpfc_mbx_rd_conf_rq_count_SHIFT 0
1775#define lpfc_mbx_rd_conf_rq_count_MASK 0x0000FFFF
1776#define lpfc_mbx_rd_conf_rq_count_WORD word17
1777#define lpfc_mbx_rd_conf_eq_count_SHIFT 16
1778#define lpfc_mbx_rd_conf_eq_count_MASK 0x0000FFFF
1779#define lpfc_mbx_rd_conf_eq_count_WORD word17
1780 uint32_t word18;
1781#define lpfc_mbx_rd_conf_wq_count_SHIFT 0
1782#define lpfc_mbx_rd_conf_wq_count_MASK 0x0000FFFF
1783#define lpfc_mbx_rd_conf_wq_count_WORD word18
1784#define lpfc_mbx_rd_conf_cq_count_SHIFT 16
1785#define lpfc_mbx_rd_conf_cq_count_MASK 0x0000FFFF
1786#define lpfc_mbx_rd_conf_cq_count_WORD word18
1787};
1788
1789struct lpfc_mbx_request_features {
1790 uint32_t word1;
1791#define lpfc_mbx_rq_ftr_qry_SHIFT 0
1792#define lpfc_mbx_rq_ftr_qry_MASK 0x00000001
1793#define lpfc_mbx_rq_ftr_qry_WORD word1
1794 uint32_t word2;
1795#define lpfc_mbx_rq_ftr_rq_iaab_SHIFT 0
1796#define lpfc_mbx_rq_ftr_rq_iaab_MASK 0x00000001
1797#define lpfc_mbx_rq_ftr_rq_iaab_WORD word2
1798#define lpfc_mbx_rq_ftr_rq_npiv_SHIFT 1
1799#define lpfc_mbx_rq_ftr_rq_npiv_MASK 0x00000001
1800#define lpfc_mbx_rq_ftr_rq_npiv_WORD word2
1801#define lpfc_mbx_rq_ftr_rq_dif_SHIFT 2
1802#define lpfc_mbx_rq_ftr_rq_dif_MASK 0x00000001
1803#define lpfc_mbx_rq_ftr_rq_dif_WORD word2
1804#define lpfc_mbx_rq_ftr_rq_vf_SHIFT 3
1805#define lpfc_mbx_rq_ftr_rq_vf_MASK 0x00000001
1806#define lpfc_mbx_rq_ftr_rq_vf_WORD word2
1807#define lpfc_mbx_rq_ftr_rq_fcpi_SHIFT 4
1808#define lpfc_mbx_rq_ftr_rq_fcpi_MASK 0x00000001
1809#define lpfc_mbx_rq_ftr_rq_fcpi_WORD word2
1810#define lpfc_mbx_rq_ftr_rq_fcpt_SHIFT 5
1811#define lpfc_mbx_rq_ftr_rq_fcpt_MASK 0x00000001
1812#define lpfc_mbx_rq_ftr_rq_fcpt_WORD word2
1813#define lpfc_mbx_rq_ftr_rq_fcpc_SHIFT 6
1814#define lpfc_mbx_rq_ftr_rq_fcpc_MASK 0x00000001
1815#define lpfc_mbx_rq_ftr_rq_fcpc_WORD word2
1816#define lpfc_mbx_rq_ftr_rq_ifip_SHIFT 7
1817#define lpfc_mbx_rq_ftr_rq_ifip_MASK 0x00000001
1818#define lpfc_mbx_rq_ftr_rq_ifip_WORD word2
1819 uint32_t word3;
1820#define lpfc_mbx_rq_ftr_rsp_iaab_SHIFT 0
1821#define lpfc_mbx_rq_ftr_rsp_iaab_MASK 0x00000001
1822#define lpfc_mbx_rq_ftr_rsp_iaab_WORD word3
1823#define lpfc_mbx_rq_ftr_rsp_npiv_SHIFT 1
1824#define lpfc_mbx_rq_ftr_rsp_npiv_MASK 0x00000001
1825#define lpfc_mbx_rq_ftr_rsp_npiv_WORD word3
1826#define lpfc_mbx_rq_ftr_rsp_dif_SHIFT 2
1827#define lpfc_mbx_rq_ftr_rsp_dif_MASK 0x00000001
1828#define lpfc_mbx_rq_ftr_rsp_dif_WORD word3
1829#define lpfc_mbx_rq_ftr_rsp_vf_SHIFT 3
1830#define lpfc_mbx_rq_ftr_rsp_vf__MASK 0x00000001
1831#define lpfc_mbx_rq_ftr_rsp_vf_WORD word3
1832#define lpfc_mbx_rq_ftr_rsp_fcpi_SHIFT 4
1833#define lpfc_mbx_rq_ftr_rsp_fcpi_MASK 0x00000001
1834#define lpfc_mbx_rq_ftr_rsp_fcpi_WORD word3
1835#define lpfc_mbx_rq_ftr_rsp_fcpt_SHIFT 5
1836#define lpfc_mbx_rq_ftr_rsp_fcpt_MASK 0x00000001
1837#define lpfc_mbx_rq_ftr_rsp_fcpt_WORD word3
1838#define lpfc_mbx_rq_ftr_rsp_fcpc_SHIFT 6
1839#define lpfc_mbx_rq_ftr_rsp_fcpc_MASK 0x00000001
1840#define lpfc_mbx_rq_ftr_rsp_fcpc_WORD word3
1841#define lpfc_mbx_rq_ftr_rsp_ifip_SHIFT 7
1842#define lpfc_mbx_rq_ftr_rsp_ifip_MASK 0x00000001
1843#define lpfc_mbx_rq_ftr_rsp_ifip_WORD word3
1844};
1845
James Smart28baac72010-02-12 14:42:03 -05001846struct lpfc_mbx_supp_pages {
1847 uint32_t word1;
1848#define qs_SHIFT 0
1849#define qs_MASK 0x00000001
1850#define qs_WORD word1
1851#define wr_SHIFT 1
1852#define wr_MASK 0x00000001
1853#define wr_WORD word1
1854#define pf_SHIFT 8
1855#define pf_MASK 0x000000ff
1856#define pf_WORD word1
1857#define cpn_SHIFT 16
1858#define cpn_MASK 0x000000ff
1859#define cpn_WORD word1
1860 uint32_t word2;
1861#define list_offset_SHIFT 0
1862#define list_offset_MASK 0x000000ff
1863#define list_offset_WORD word2
1864#define next_offset_SHIFT 8
1865#define next_offset_MASK 0x000000ff
1866#define next_offset_WORD word2
1867#define elem_cnt_SHIFT 16
1868#define elem_cnt_MASK 0x000000ff
1869#define elem_cnt_WORD word2
1870 uint32_t word3;
1871#define pn_0_SHIFT 24
1872#define pn_0_MASK 0x000000ff
1873#define pn_0_WORD word3
1874#define pn_1_SHIFT 16
1875#define pn_1_MASK 0x000000ff
1876#define pn_1_WORD word3
1877#define pn_2_SHIFT 8
1878#define pn_2_MASK 0x000000ff
1879#define pn_2_WORD word3
1880#define pn_3_SHIFT 0
1881#define pn_3_MASK 0x000000ff
1882#define pn_3_WORD word3
1883 uint32_t word4;
1884#define pn_4_SHIFT 24
1885#define pn_4_MASK 0x000000ff
1886#define pn_4_WORD word4
1887#define pn_5_SHIFT 16
1888#define pn_5_MASK 0x000000ff
1889#define pn_5_WORD word4
1890#define pn_6_SHIFT 8
1891#define pn_6_MASK 0x000000ff
1892#define pn_6_WORD word4
1893#define pn_7_SHIFT 0
1894#define pn_7_MASK 0x000000ff
1895#define pn_7_WORD word4
1896 uint32_t rsvd[27];
1897#define LPFC_SUPP_PAGES 0
1898#define LPFC_BLOCK_GUARD_PROFILES 1
1899#define LPFC_SLI4_PARAMETERS 2
1900};
1901
1902struct lpfc_mbx_sli4_params {
1903 uint32_t word1;
1904#define qs_SHIFT 0
1905#define qs_MASK 0x00000001
1906#define qs_WORD word1
1907#define wr_SHIFT 1
1908#define wr_MASK 0x00000001
1909#define wr_WORD word1
1910#define pf_SHIFT 8
1911#define pf_MASK 0x000000ff
1912#define pf_WORD word1
1913#define cpn_SHIFT 16
1914#define cpn_MASK 0x000000ff
1915#define cpn_WORD word1
1916 uint32_t word2;
1917#define if_type_SHIFT 0
1918#define if_type_MASK 0x00000007
1919#define if_type_WORD word2
1920#define sli_rev_SHIFT 4
1921#define sli_rev_MASK 0x0000000f
1922#define sli_rev_WORD word2
1923#define sli_family_SHIFT 8
1924#define sli_family_MASK 0x000000ff
1925#define sli_family_WORD word2
1926#define featurelevel_1_SHIFT 16
1927#define featurelevel_1_MASK 0x000000ff
1928#define featurelevel_1_WORD word2
1929#define featurelevel_2_SHIFT 24
1930#define featurelevel_2_MASK 0x0000001f
1931#define featurelevel_2_WORD word2
1932 uint32_t word3;
1933#define fcoe_SHIFT 0
1934#define fcoe_MASK 0x00000001
1935#define fcoe_WORD word3
1936#define fc_SHIFT 1
1937#define fc_MASK 0x00000001
1938#define fc_WORD word3
1939#define nic_SHIFT 2
1940#define nic_MASK 0x00000001
1941#define nic_WORD word3
1942#define iscsi_SHIFT 3
1943#define iscsi_MASK 0x00000001
1944#define iscsi_WORD word3
1945#define rdma_SHIFT 4
1946#define rdma_MASK 0x00000001
1947#define rdma_WORD word3
1948 uint32_t sge_supp_len;
James Smartcb5172e2010-03-15 11:25:07 -04001949#define SLI4_PAGE_SIZE 4096
James Smart28baac72010-02-12 14:42:03 -05001950 uint32_t word5;
1951#define if_page_sz_SHIFT 0
1952#define if_page_sz_MASK 0x0000ffff
1953#define if_page_sz_WORD word5
1954#define loopbk_scope_SHIFT 24
1955#define loopbk_scope_MASK 0x0000000f
1956#define loopbk_scope_WORD word5
1957#define rq_db_window_SHIFT 28
1958#define rq_db_window_MASK 0x0000000f
1959#define rq_db_window_WORD word5
1960 uint32_t word6;
1961#define eq_pages_SHIFT 0
1962#define eq_pages_MASK 0x0000000f
1963#define eq_pages_WORD word6
1964#define eqe_size_SHIFT 8
1965#define eqe_size_MASK 0x000000ff
1966#define eqe_size_WORD word6
1967 uint32_t word7;
1968#define cq_pages_SHIFT 0
1969#define cq_pages_MASK 0x0000000f
1970#define cq_pages_WORD word7
1971#define cqe_size_SHIFT 8
1972#define cqe_size_MASK 0x000000ff
1973#define cqe_size_WORD word7
1974 uint32_t word8;
1975#define mq_pages_SHIFT 0
1976#define mq_pages_MASK 0x0000000f
1977#define mq_pages_WORD word8
1978#define mqe_size_SHIFT 8
1979#define mqe_size_MASK 0x000000ff
1980#define mqe_size_WORD word8
1981#define mq_elem_cnt_SHIFT 16
1982#define mq_elem_cnt_MASK 0x000000ff
1983#define mq_elem_cnt_WORD word8
1984 uint32_t word9;
1985#define wq_pages_SHIFT 0
1986#define wq_pages_MASK 0x0000ffff
1987#define wq_pages_WORD word9
1988#define wqe_size_SHIFT 8
1989#define wqe_size_MASK 0x000000ff
1990#define wqe_size_WORD word9
1991 uint32_t word10;
1992#define rq_pages_SHIFT 0
1993#define rq_pages_MASK 0x0000ffff
1994#define rq_pages_WORD word10
1995#define rqe_size_SHIFT 8
1996#define rqe_size_MASK 0x000000ff
1997#define rqe_size_WORD word10
1998 uint32_t word11;
1999#define hdr_pages_SHIFT 0
2000#define hdr_pages_MASK 0x0000000f
2001#define hdr_pages_WORD word11
2002#define hdr_size_SHIFT 8
2003#define hdr_size_MASK 0x0000000f
2004#define hdr_size_WORD word11
2005#define hdr_pp_align_SHIFT 16
2006#define hdr_pp_align_MASK 0x0000ffff
2007#define hdr_pp_align_WORD word11
2008 uint32_t word12;
2009#define sgl_pages_SHIFT 0
2010#define sgl_pages_MASK 0x0000000f
2011#define sgl_pages_WORD word12
2012#define sgl_pp_align_SHIFT 16
2013#define sgl_pp_align_MASK 0x0000ffff
2014#define sgl_pp_align_WORD word12
2015 uint32_t rsvd_13_63[51];
2016};
2017
James Smartda0436e2009-05-22 14:51:39 -04002018/* Mailbox Completion Queue Error Messages */
2019#define MB_CQE_STATUS_SUCCESS 0x0
2020#define MB_CQE_STATUS_INSUFFICIENT_PRIVILEGES 0x1
2021#define MB_CQE_STATUS_INVALID_PARAMETER 0x2
2022#define MB_CQE_STATUS_INSUFFICIENT_RESOURCES 0x3
2023#define MB_CEQ_STATUS_QUEUE_FLUSHING 0x4
2024#define MB_CQE_STATUS_DMA_FAILED 0x5
2025
2026/* mailbox queue entry structure */
2027struct lpfc_mqe {
2028 uint32_t word0;
2029#define lpfc_mqe_status_SHIFT 16
2030#define lpfc_mqe_status_MASK 0x0000FFFF
2031#define lpfc_mqe_status_WORD word0
2032#define lpfc_mqe_command_SHIFT 8
2033#define lpfc_mqe_command_MASK 0x000000FF
2034#define lpfc_mqe_command_WORD word0
2035 union {
2036 uint32_t mb_words[LPFC_SLI4_MB_WORD_COUNT - 1];
2037 /* sli4 mailbox commands */
2038 struct lpfc_mbx_sli4_config sli4_config;
2039 struct lpfc_mbx_init_vfi init_vfi;
2040 struct lpfc_mbx_reg_vfi reg_vfi;
2041 struct lpfc_mbx_reg_vfi unreg_vfi;
2042 struct lpfc_mbx_init_vpi init_vpi;
2043 struct lpfc_mbx_resume_rpi resume_rpi;
2044 struct lpfc_mbx_read_fcf_tbl read_fcf_tbl;
2045 struct lpfc_mbx_add_fcf_tbl_entry add_fcf_entry;
2046 struct lpfc_mbx_del_fcf_tbl_entry del_fcf_entry;
James Smartecfd03c2010-02-12 14:41:27 -05002047 struct lpfc_mbx_redisc_fcf_tbl redisc_fcf_tbl;
James Smartda0436e2009-05-22 14:51:39 -04002048 struct lpfc_mbx_reg_fcfi reg_fcfi;
2049 struct lpfc_mbx_unreg_fcfi unreg_fcfi;
2050 struct lpfc_mbx_mq_create mq_create;
2051 struct lpfc_mbx_eq_create eq_create;
2052 struct lpfc_mbx_cq_create cq_create;
2053 struct lpfc_mbx_wq_create wq_create;
2054 struct lpfc_mbx_rq_create rq_create;
2055 struct lpfc_mbx_mq_destroy mq_destroy;
2056 struct lpfc_mbx_eq_destroy eq_destroy;
2057 struct lpfc_mbx_cq_destroy cq_destroy;
2058 struct lpfc_mbx_wq_destroy wq_destroy;
2059 struct lpfc_mbx_rq_destroy rq_destroy;
2060 struct lpfc_mbx_post_sgl_pages post_sgl_pages;
2061 struct lpfc_mbx_nembed_cmd nembed_cmd;
2062 struct lpfc_mbx_read_rev read_rev;
2063 struct lpfc_mbx_read_vpi read_vpi;
2064 struct lpfc_mbx_read_config rd_config;
2065 struct lpfc_mbx_request_features req_ftrs;
2066 struct lpfc_mbx_post_hdr_tmpl hdr_tmpl;
James Smart6669f9b2009-10-02 15:16:45 -04002067 struct lpfc_mbx_query_fw_cfg query_fw_cfg;
James Smart28baac72010-02-12 14:42:03 -05002068 struct lpfc_mbx_supp_pages supp_pages;
2069 struct lpfc_mbx_sli4_params sli4_params;
James Smartda0436e2009-05-22 14:51:39 -04002070 struct lpfc_mbx_nop nop;
2071 } un;
2072};
2073
2074struct lpfc_mcqe {
2075 uint32_t word0;
2076#define lpfc_mcqe_status_SHIFT 0
2077#define lpfc_mcqe_status_MASK 0x0000FFFF
2078#define lpfc_mcqe_status_WORD word0
2079#define lpfc_mcqe_ext_status_SHIFT 16
2080#define lpfc_mcqe_ext_status_MASK 0x0000FFFF
2081#define lpfc_mcqe_ext_status_WORD word0
2082 uint32_t mcqe_tag0;
2083 uint32_t mcqe_tag1;
2084 uint32_t trailer;
2085#define lpfc_trailer_valid_SHIFT 31
2086#define lpfc_trailer_valid_MASK 0x00000001
2087#define lpfc_trailer_valid_WORD trailer
2088#define lpfc_trailer_async_SHIFT 30
2089#define lpfc_trailer_async_MASK 0x00000001
2090#define lpfc_trailer_async_WORD trailer
2091#define lpfc_trailer_hpi_SHIFT 29
2092#define lpfc_trailer_hpi_MASK 0x00000001
2093#define lpfc_trailer_hpi_WORD trailer
2094#define lpfc_trailer_completed_SHIFT 28
2095#define lpfc_trailer_completed_MASK 0x00000001
2096#define lpfc_trailer_completed_WORD trailer
2097#define lpfc_trailer_consumed_SHIFT 27
2098#define lpfc_trailer_consumed_MASK 0x00000001
2099#define lpfc_trailer_consumed_WORD trailer
2100#define lpfc_trailer_type_SHIFT 16
2101#define lpfc_trailer_type_MASK 0x000000FF
2102#define lpfc_trailer_type_WORD trailer
2103#define lpfc_trailer_code_SHIFT 8
2104#define lpfc_trailer_code_MASK 0x000000FF
2105#define lpfc_trailer_code_WORD trailer
2106#define LPFC_TRAILER_CODE_LINK 0x1
2107#define LPFC_TRAILER_CODE_FCOE 0x2
2108#define LPFC_TRAILER_CODE_DCBX 0x3
2109};
2110
2111struct lpfc_acqe_link {
2112 uint32_t word0;
2113#define lpfc_acqe_link_speed_SHIFT 24
2114#define lpfc_acqe_link_speed_MASK 0x000000FF
2115#define lpfc_acqe_link_speed_WORD word0
2116#define LPFC_ASYNC_LINK_SPEED_ZERO 0x0
2117#define LPFC_ASYNC_LINK_SPEED_10MBPS 0x1
2118#define LPFC_ASYNC_LINK_SPEED_100MBPS 0x2
2119#define LPFC_ASYNC_LINK_SPEED_1GBPS 0x3
2120#define LPFC_ASYNC_LINK_SPEED_10GBPS 0x4
2121#define lpfc_acqe_link_duplex_SHIFT 16
2122#define lpfc_acqe_link_duplex_MASK 0x000000FF
2123#define lpfc_acqe_link_duplex_WORD word0
2124#define LPFC_ASYNC_LINK_DUPLEX_NONE 0x0
2125#define LPFC_ASYNC_LINK_DUPLEX_HALF 0x1
2126#define LPFC_ASYNC_LINK_DUPLEX_FULL 0x2
2127#define lpfc_acqe_link_status_SHIFT 8
2128#define lpfc_acqe_link_status_MASK 0x000000FF
2129#define lpfc_acqe_link_status_WORD word0
2130#define LPFC_ASYNC_LINK_STATUS_DOWN 0x0
2131#define LPFC_ASYNC_LINK_STATUS_UP 0x1
2132#define LPFC_ASYNC_LINK_STATUS_LOGICAL_DOWN 0x2
2133#define LPFC_ASYNC_LINK_STATUS_LOGICAL_UP 0x3
2134#define lpfc_acqe_link_physical_SHIFT 0
2135#define lpfc_acqe_link_physical_MASK 0x000000FF
2136#define lpfc_acqe_link_physical_WORD word0
2137#define LPFC_ASYNC_LINK_PORT_A 0x0
2138#define LPFC_ASYNC_LINK_PORT_B 0x1
2139 uint32_t word1;
2140#define lpfc_acqe_link_fault_SHIFT 0
2141#define lpfc_acqe_link_fault_MASK 0x000000FF
2142#define lpfc_acqe_link_fault_WORD word1
2143#define LPFC_ASYNC_LINK_FAULT_NONE 0x0
2144#define LPFC_ASYNC_LINK_FAULT_LOCAL 0x1
2145#define LPFC_ASYNC_LINK_FAULT_REMOTE 0x2
James Smart65467b62010-01-26 23:08:29 -05002146#define lpfc_acqe_qos_link_speed_SHIFT 16
2147#define lpfc_acqe_qos_link_speed_MASK 0x0000FFFF
2148#define lpfc_acqe_qos_link_speed_WORD word1
James Smartda0436e2009-05-22 14:51:39 -04002149 uint32_t event_tag;
2150 uint32_t trailer;
2151};
2152
2153struct lpfc_acqe_fcoe {
James Smart6669f9b2009-10-02 15:16:45 -04002154 uint32_t index;
James Smartda0436e2009-05-22 14:51:39 -04002155 uint32_t word1;
2156#define lpfc_acqe_fcoe_fcf_count_SHIFT 0
2157#define lpfc_acqe_fcoe_fcf_count_MASK 0x0000FFFF
2158#define lpfc_acqe_fcoe_fcf_count_WORD word1
2159#define lpfc_acqe_fcoe_event_type_SHIFT 16
2160#define lpfc_acqe_fcoe_event_type_MASK 0x0000FFFF
2161#define lpfc_acqe_fcoe_event_type_WORD word1
2162#define LPFC_FCOE_EVENT_TYPE_NEW_FCF 0x1
2163#define LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL 0x2
2164#define LPFC_FCOE_EVENT_TYPE_FCF_DEAD 0x3
James Smart6669f9b2009-10-02 15:16:45 -04002165#define LPFC_FCOE_EVENT_TYPE_CVL 0x4
James Smartecfd03c2010-02-12 14:41:27 -05002166#define LPFC_FCOE_EVENT_TYPE_FCF_PARAM_MOD 0x5
James Smartda0436e2009-05-22 14:51:39 -04002167 uint32_t event_tag;
2168 uint32_t trailer;
2169};
2170
2171struct lpfc_acqe_dcbx {
2172 uint32_t tlv_ttl;
2173 uint32_t reserved;
2174 uint32_t event_tag;
2175 uint32_t trailer;
2176};
2177
2178/*
2179 * Define the bootstrap mailbox (bmbx) region used to communicate
2180 * mailbox command between the host and port. The mailbox consists
2181 * of a payload area of 256 bytes and a completion queue of length
2182 * 16 bytes.
2183 */
2184struct lpfc_bmbx_create {
2185 struct lpfc_mqe mqe;
2186 struct lpfc_mcqe mcqe;
2187};
2188
2189#define SGL_ALIGN_SZ 64
2190#define SGL_PAGE_SIZE 4096
2191/* align SGL addr on a size boundary - adjust address up */
James Smart5ffc2662009-11-18 15:39:44 -05002192#define NO_XRI ((uint16_t)-1)
2193
James Smartda0436e2009-05-22 14:51:39 -04002194struct wqe_common {
2195 uint32_t word6;
James Smart6669f9b2009-10-02 15:16:45 -04002196#define wqe_xri_tag_SHIFT 0
2197#define wqe_xri_tag_MASK 0x0000FFFF
2198#define wqe_xri_tag_WORD word6
James Smartda0436e2009-05-22 14:51:39 -04002199#define wqe_ctxt_tag_SHIFT 16
2200#define wqe_ctxt_tag_MASK 0x0000FFFF
2201#define wqe_ctxt_tag_WORD word6
2202 uint32_t word7;
2203#define wqe_ct_SHIFT 2
2204#define wqe_ct_MASK 0x00000003
2205#define wqe_ct_WORD word7
2206#define wqe_status_SHIFT 4
2207#define wqe_status_MASK 0x0000000f
2208#define wqe_status_WORD word7
2209#define wqe_cmnd_SHIFT 8
2210#define wqe_cmnd_MASK 0x000000ff
2211#define wqe_cmnd_WORD word7
2212#define wqe_class_SHIFT 16
2213#define wqe_class_MASK 0x00000007
2214#define wqe_class_WORD word7
2215#define wqe_pu_SHIFT 20
2216#define wqe_pu_MASK 0x00000003
2217#define wqe_pu_WORD word7
2218#define wqe_erp_SHIFT 22
2219#define wqe_erp_MASK 0x00000001
2220#define wqe_erp_WORD word7
2221#define wqe_lnk_SHIFT 23
2222#define wqe_lnk_MASK 0x00000001
2223#define wqe_lnk_WORD word7
2224#define wqe_tmo_SHIFT 24
2225#define wqe_tmo_MASK 0x000000ff
2226#define wqe_tmo_WORD word7
2227 uint32_t abort_tag; /* word 8 in WQE */
2228 uint32_t word9;
2229#define wqe_reqtag_SHIFT 0
2230#define wqe_reqtag_MASK 0x0000FFFF
2231#define wqe_reqtag_WORD word9
2232#define wqe_rcvoxid_SHIFT 16
2233#define wqe_rcvoxid_MASK 0x0000FFFF
2234#define wqe_rcvoxid_WORD word9
2235 uint32_t word10;
2236#define wqe_pri_SHIFT 16
2237#define wqe_pri_MASK 0x00000007
2238#define wqe_pri_WORD word10
2239#define wqe_pv_SHIFT 19
2240#define wqe_pv_MASK 0x00000001
2241#define wqe_pv_WORD word10
2242#define wqe_xc_SHIFT 21
2243#define wqe_xc_MASK 0x00000001
2244#define wqe_xc_WORD word10
2245#define wqe_ccpe_SHIFT 23
2246#define wqe_ccpe_MASK 0x00000001
2247#define wqe_ccpe_WORD word10
2248#define wqe_ccp_SHIFT 24
2249#define wqe_ccp_MASK 0x000000ff
2250#define wqe_ccp_WORD word10
2251 uint32_t word11;
2252#define wqe_cmd_type_SHIFT 0
2253#define wqe_cmd_type_MASK 0x0000000f
2254#define wqe_cmd_type_WORD word11
2255#define wqe_wqec_SHIFT 7
2256#define wqe_wqec_MASK 0x00000001
2257#define wqe_wqec_WORD word11
2258#define wqe_cqid_SHIFT 16
James Smart6669f9b2009-10-02 15:16:45 -04002259#define wqe_cqid_MASK 0x0000ffff
James Smartda0436e2009-05-22 14:51:39 -04002260#define wqe_cqid_WORD word11
2261};
2262
2263struct wqe_did {
2264 uint32_t word5;
2265#define wqe_els_did_SHIFT 0
2266#define wqe_els_did_MASK 0x00FFFFFF
2267#define wqe_els_did_WORD word5
James Smart6669f9b2009-10-02 15:16:45 -04002268#define wqe_xmit_bls_pt_SHIFT 28
2269#define wqe_xmit_bls_pt_MASK 0x00000003
2270#define wqe_xmit_bls_pt_WORD word5
James Smartda0436e2009-05-22 14:51:39 -04002271#define wqe_xmit_bls_ar_SHIFT 30
2272#define wqe_xmit_bls_ar_MASK 0x00000001
2273#define wqe_xmit_bls_ar_WORD word5
2274#define wqe_xmit_bls_xo_SHIFT 31
2275#define wqe_xmit_bls_xo_MASK 0x00000001
2276#define wqe_xmit_bls_xo_WORD word5
2277};
2278
2279struct els_request64_wqe {
2280 struct ulp_bde64 bde;
2281 uint32_t payload_len;
2282 uint32_t word4;
2283#define els_req64_sid_SHIFT 0
2284#define els_req64_sid_MASK 0x00FFFFFF
2285#define els_req64_sid_WORD word4
2286#define els_req64_sp_SHIFT 24
2287#define els_req64_sp_MASK 0x00000001
2288#define els_req64_sp_WORD word4
2289#define els_req64_vf_SHIFT 25
2290#define els_req64_vf_MASK 0x00000001
2291#define els_req64_vf_WORD word4
2292 struct wqe_did wqe_dest;
2293 struct wqe_common wqe_com; /* words 6-11 */
2294 uint32_t word12;
2295#define els_req64_vfid_SHIFT 1
2296#define els_req64_vfid_MASK 0x00000FFF
2297#define els_req64_vfid_WORD word12
2298#define els_req64_pri_SHIFT 13
2299#define els_req64_pri_MASK 0x00000007
2300#define els_req64_pri_WORD word12
2301 uint32_t word13;
2302#define els_req64_hopcnt_SHIFT 24
2303#define els_req64_hopcnt_MASK 0x000000ff
2304#define els_req64_hopcnt_WORD word13
2305 uint32_t reserved[2];
2306};
2307
2308struct xmit_els_rsp64_wqe {
2309 struct ulp_bde64 bde;
2310 uint32_t rsvd3;
2311 uint32_t rsvd4;
2312 struct wqe_did wqe_dest;
2313 struct wqe_common wqe_com; /* words 6-11 */
2314 uint32_t rsvd_12_15[4];
2315};
2316
2317struct xmit_bls_rsp64_wqe {
2318 uint32_t payload0;
James Smart6669f9b2009-10-02 15:16:45 -04002319/* Payload0 for BA_ACC */
2320#define xmit_bls_rsp64_acc_seq_id_SHIFT 16
2321#define xmit_bls_rsp64_acc_seq_id_MASK 0x000000ff
2322#define xmit_bls_rsp64_acc_seq_id_WORD payload0
2323#define xmit_bls_rsp64_acc_seq_id_vald_SHIFT 24
2324#define xmit_bls_rsp64_acc_seq_id_vald_MASK 0x000000ff
2325#define xmit_bls_rsp64_acc_seq_id_vald_WORD payload0
2326/* Payload0 for BA_RJT */
2327#define xmit_bls_rsp64_rjt_vspec_SHIFT 0
2328#define xmit_bls_rsp64_rjt_vspec_MASK 0x000000ff
2329#define xmit_bls_rsp64_rjt_vspec_WORD payload0
2330#define xmit_bls_rsp64_rjt_expc_SHIFT 8
2331#define xmit_bls_rsp64_rjt_expc_MASK 0x000000ff
2332#define xmit_bls_rsp64_rjt_expc_WORD payload0
2333#define xmit_bls_rsp64_rjt_rsnc_SHIFT 16
2334#define xmit_bls_rsp64_rjt_rsnc_MASK 0x000000ff
2335#define xmit_bls_rsp64_rjt_rsnc_WORD payload0
James Smartda0436e2009-05-22 14:51:39 -04002336 uint32_t word1;
2337#define xmit_bls_rsp64_rxid_SHIFT 0
2338#define xmit_bls_rsp64_rxid_MASK 0x0000ffff
2339#define xmit_bls_rsp64_rxid_WORD word1
2340#define xmit_bls_rsp64_oxid_SHIFT 16
2341#define xmit_bls_rsp64_oxid_MASK 0x0000ffff
2342#define xmit_bls_rsp64_oxid_WORD word1
2343 uint32_t word2;
James Smart6669f9b2009-10-02 15:16:45 -04002344#define xmit_bls_rsp64_seqcnthi_SHIFT 0
James Smartda0436e2009-05-22 14:51:39 -04002345#define xmit_bls_rsp64_seqcnthi_MASK 0x0000ffff
2346#define xmit_bls_rsp64_seqcnthi_WORD word2
James Smart6669f9b2009-10-02 15:16:45 -04002347#define xmit_bls_rsp64_seqcntlo_SHIFT 16
2348#define xmit_bls_rsp64_seqcntlo_MASK 0x0000ffff
2349#define xmit_bls_rsp64_seqcntlo_WORD word2
James Smartda0436e2009-05-22 14:51:39 -04002350 uint32_t rsrvd3;
2351 uint32_t rsrvd4;
2352 struct wqe_did wqe_dest;
2353 struct wqe_common wqe_com; /* words 6-11 */
2354 uint32_t rsvd_12_15[4];
2355};
James Smart6669f9b2009-10-02 15:16:45 -04002356
James Smartda0436e2009-05-22 14:51:39 -04002357struct wqe_rctl_dfctl {
2358 uint32_t word5;
2359#define wqe_si_SHIFT 2
2360#define wqe_si_MASK 0x000000001
2361#define wqe_si_WORD word5
2362#define wqe_la_SHIFT 3
2363#define wqe_la_MASK 0x000000001
2364#define wqe_la_WORD word5
2365#define wqe_ls_SHIFT 7
2366#define wqe_ls_MASK 0x000000001
2367#define wqe_ls_WORD word5
2368#define wqe_dfctl_SHIFT 8
2369#define wqe_dfctl_MASK 0x0000000ff
2370#define wqe_dfctl_WORD word5
2371#define wqe_type_SHIFT 16
2372#define wqe_type_MASK 0x0000000ff
2373#define wqe_type_WORD word5
2374#define wqe_rctl_SHIFT 24
2375#define wqe_rctl_MASK 0x0000000ff
2376#define wqe_rctl_WORD word5
2377};
2378
2379struct xmit_seq64_wqe {
2380 struct ulp_bde64 bde;
2381 uint32_t paylaod_offset;
2382 uint32_t relative_offset;
2383 struct wqe_rctl_dfctl wge_ctl;
2384 struct wqe_common wqe_com; /* words 6-11 */
2385 /* Note: word10 different REVISIT */
2386 uint32_t xmit_len;
2387 uint32_t rsvd_12_15[3];
2388};
2389struct xmit_bcast64_wqe {
2390 struct ulp_bde64 bde;
2391 uint32_t paylaod_len;
2392 uint32_t rsvd4;
2393 struct wqe_rctl_dfctl wge_ctl; /* word 5 */
2394 struct wqe_common wqe_com; /* words 6-11 */
2395 uint32_t rsvd_12_15[4];
2396};
2397
2398struct gen_req64_wqe {
2399 struct ulp_bde64 bde;
2400 uint32_t command_len;
2401 uint32_t payload_len;
2402 struct wqe_rctl_dfctl wge_ctl; /* word 5 */
2403 struct wqe_common wqe_com; /* words 6-11 */
2404 uint32_t rsvd_12_15[4];
2405};
2406
2407struct create_xri_wqe {
2408 uint32_t rsrvd[5]; /* words 0-4 */
2409 struct wqe_did wqe_dest; /* word 5 */
2410 struct wqe_common wqe_com; /* words 6-11 */
2411 uint32_t rsvd_12_15[4]; /* word 12-15 */
2412};
2413
2414#define T_REQUEST_TAG 3
2415#define T_XRI_TAG 1
2416
2417struct abort_cmd_wqe {
2418 uint32_t rsrvd[3];
2419 uint32_t word3;
2420#define abort_cmd_ia_SHIFT 0
2421#define abort_cmd_ia_MASK 0x000000001
2422#define abort_cmd_ia_WORD word3
2423#define abort_cmd_criteria_SHIFT 8
2424#define abort_cmd_criteria_MASK 0x0000000ff
2425#define abort_cmd_criteria_WORD word3
2426 uint32_t rsrvd4;
2427 uint32_t rsrvd5;
2428 struct wqe_common wqe_com; /* words 6-11 */
2429 uint32_t rsvd_12_15[4]; /* word 12-15 */
2430};
2431
2432struct fcp_iwrite64_wqe {
2433 struct ulp_bde64 bde;
2434 uint32_t payload_len;
2435 uint32_t total_xfer_len;
2436 uint32_t initial_xfer_len;
2437 struct wqe_common wqe_com; /* words 6-11 */
2438 uint32_t rsvd_12_15[4]; /* word 12-15 */
2439};
2440
2441struct fcp_iread64_wqe {
2442 struct ulp_bde64 bde;
2443 uint32_t payload_len; /* word 3 */
2444 uint32_t total_xfer_len; /* word 4 */
2445 uint32_t rsrvd5; /* word 5 */
2446 struct wqe_common wqe_com; /* words 6-11 */
2447 uint32_t rsvd_12_15[4]; /* word 12-15 */
2448};
2449
2450struct fcp_icmnd64_wqe {
2451 struct ulp_bde64 bde; /* words 0-2 */
2452 uint32_t rsrvd[3]; /* words 3-5 */
2453 struct wqe_common wqe_com; /* words 6-11 */
2454 uint32_t rsvd_12_15[4]; /* word 12-15 */
2455};
2456
2457
2458union lpfc_wqe {
2459 uint32_t words[16];
2460 struct lpfc_wqe_generic generic;
2461 struct fcp_icmnd64_wqe fcp_icmd;
2462 struct fcp_iread64_wqe fcp_iread;
2463 struct fcp_iwrite64_wqe fcp_iwrite;
2464 struct abort_cmd_wqe abort_cmd;
2465 struct create_xri_wqe create_xri;
2466 struct xmit_bcast64_wqe xmit_bcast64;
2467 struct xmit_seq64_wqe xmit_sequence;
2468 struct xmit_bls_rsp64_wqe xmit_bls_rsp;
2469 struct xmit_els_rsp64_wqe xmit_els_rsp;
2470 struct els_request64_wqe els_req;
2471 struct gen_req64_wqe gen_req;
2472};
2473
2474#define FCP_COMMAND 0x0
2475#define FCP_COMMAND_DATA_OUT 0x1
2476#define ELS_COMMAND_NON_FIP 0xC
2477#define ELS_COMMAND_FIP 0xD
2478#define OTHER_COMMAND 0x8
2479