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