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