xref: /linux/drivers/scsi/lpfc/lpfc_hw4.h (revision f358dd0ca26c152a5e0922e269996268dcb98a9d)
1da0436e9SJames Smart /*******************************************************************
2da0436e9SJames Smart  * This file is part of the Emulex Linux Device Driver for         *
3da0436e9SJames Smart  * Fibre Channel Host Bus Adapters.                                *
450611577SJames Smart  * Copyright (C) 2009-2016 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  */
44079b5c91SJames Smart #define bf_get_be32(name, ptr) \
45079b5c91SJames Smart 	((be32_to_cpu((ptr)->name##_WORD) >> name##_SHIFT) & name##_MASK)
46cb5172eaSJames Smart #define bf_get_le32(name, ptr) \
47cb5172eaSJames Smart 	((le32_to_cpu((ptr)->name##_WORD) >> name##_SHIFT) & name##_MASK)
48da0436e9SJames Smart #define bf_get(name, ptr) \
49da0436e9SJames Smart 	(((ptr)->name##_WORD >> name##_SHIFT) & name##_MASK)
50cb5172eaSJames Smart #define bf_set_le32(name, ptr, value) \
51cb5172eaSJames Smart 	((ptr)->name##_WORD = cpu_to_le32(((((value) & \
52cb5172eaSJames Smart 	name##_MASK) << name##_SHIFT) | (le32_to_cpu((ptr)->name##_WORD) & \
53cb5172eaSJames Smart 	~(name##_MASK << name##_SHIFT)))))
54da0436e9SJames Smart #define bf_set(name, ptr, value) \
55da0436e9SJames Smart 	((ptr)->name##_WORD = ((((value) & name##_MASK) << name##_SHIFT) | \
56da0436e9SJames Smart 		 ((ptr)->name##_WORD & ~(name##_MASK << name##_SHIFT))))
57da0436e9SJames Smart 
58da0436e9SJames Smart struct dma_address {
59da0436e9SJames Smart 	uint32_t addr_lo;
60da0436e9SJames Smart 	uint32_t addr_hi;
61da0436e9SJames Smart };
62da0436e9SJames Smart 
638fa38513SJames Smart struct lpfc_sli_intf {
648fa38513SJames Smart 	uint32_t word0;
658fa38513SJames Smart #define lpfc_sli_intf_valid_SHIFT		29
6628baac74SJames Smart #define lpfc_sli_intf_valid_MASK		0x00000007
678fa38513SJames Smart #define lpfc_sli_intf_valid_WORD		word0
688fa38513SJames Smart #define LPFC_SLI_INTF_VALID		6
69085c647cSJames Smart #define lpfc_sli_intf_sli_hint2_SHIFT		24
70085c647cSJames Smart #define lpfc_sli_intf_sli_hint2_MASK		0x0000001F
71085c647cSJames Smart #define lpfc_sli_intf_sli_hint2_WORD		word0
72085c647cSJames Smart #define LPFC_SLI_INTF_SLI_HINT2_NONE	0
73085c647cSJames Smart #define lpfc_sli_intf_sli_hint1_SHIFT		16
74085c647cSJames Smart #define lpfc_sli_intf_sli_hint1_MASK		0x000000FF
75085c647cSJames Smart #define lpfc_sli_intf_sli_hint1_WORD		word0
76085c647cSJames Smart #define LPFC_SLI_INTF_SLI_HINT1_NONE	0
77085c647cSJames Smart #define LPFC_SLI_INTF_SLI_HINT1_1	1
78085c647cSJames Smart #define LPFC_SLI_INTF_SLI_HINT1_2	2
79085c647cSJames Smart #define lpfc_sli_intf_if_type_SHIFT		12
80085c647cSJames Smart #define lpfc_sli_intf_if_type_MASK		0x0000000F
81085c647cSJames Smart #define lpfc_sli_intf_if_type_WORD		word0
82085c647cSJames Smart #define LPFC_SLI_INTF_IF_TYPE_0		0
83085c647cSJames Smart #define LPFC_SLI_INTF_IF_TYPE_1		1
84085c647cSJames Smart #define LPFC_SLI_INTF_IF_TYPE_2		2
8528baac74SJames Smart #define lpfc_sli_intf_sli_family_SHIFT		8
86085c647cSJames Smart #define lpfc_sli_intf_sli_family_MASK		0x0000000F
8728baac74SJames Smart #define lpfc_sli_intf_sli_family_WORD		word0
88085c647cSJames Smart #define LPFC_SLI_INTF_FAMILY_BE2	0x0
89085c647cSJames Smart #define LPFC_SLI_INTF_FAMILY_BE3	0x1
90085c647cSJames Smart #define LPFC_SLI_INTF_FAMILY_LNCR_A0	0xa
91085c647cSJames Smart #define LPFC_SLI_INTF_FAMILY_LNCR_B0	0xb
9228baac74SJames Smart #define lpfc_sli_intf_slirev_SHIFT		4
9328baac74SJames Smart #define lpfc_sli_intf_slirev_MASK		0x0000000F
9428baac74SJames Smart #define lpfc_sli_intf_slirev_WORD		word0
9528baac74SJames Smart #define LPFC_SLI_INTF_REV_SLI3		3
9628baac74SJames Smart #define LPFC_SLI_INTF_REV_SLI4		4
97085c647cSJames Smart #define lpfc_sli_intf_func_type_SHIFT		0
98085c647cSJames Smart #define lpfc_sli_intf_func_type_MASK		0x00000001
99085c647cSJames Smart #define lpfc_sli_intf_func_type_WORD		word0
100085c647cSJames Smart #define LPFC_SLI_INTF_IF_TYPE_PHYS	0
101085c647cSJames Smart #define LPFC_SLI_INTF_IF_TYPE_VIRT	1
1028fa38513SJames Smart };
1038fa38513SJames Smart 
104da0436e9SJames Smart #define LPFC_SLI4_MBX_EMBED	true
105da0436e9SJames Smart #define LPFC_SLI4_MBX_NEMBED	false
106da0436e9SJames Smart 
107da0436e9SJames Smart #define LPFC_SLI4_MB_WORD_COUNT		64
108da0436e9SJames Smart #define LPFC_MAX_MQ_PAGE		8
109962bc51bSJames Smart #define LPFC_MAX_WQ_PAGE_V0		4
110da0436e9SJames Smart #define LPFC_MAX_WQ_PAGE		8
111895427bdSJames Smart #define LPFC_MAX_RQ_PAGE		8
112da0436e9SJames Smart #define LPFC_MAX_CQ_PAGE		4
113da0436e9SJames Smart #define LPFC_MAX_EQ_PAGE		8
114da0436e9SJames Smart 
115da0436e9SJames Smart #define LPFC_VIR_FUNC_MAX       32 /* Maximum number of virtual functions */
116da0436e9SJames Smart #define LPFC_PCI_FUNC_MAX        5 /* Maximum number of PCI functions */
117da0436e9SJames Smart #define LPFC_VFR_PAGE_SIZE	0x1000 /* 4KB BAR2 per-VF register page size */
118da0436e9SJames Smart 
119da0436e9SJames Smart /* Define SLI4 Alignment requirements. */
120da0436e9SJames Smart #define LPFC_ALIGN_16_BYTE	16
121da0436e9SJames Smart #define LPFC_ALIGN_64_BYTE	64
122da0436e9SJames Smart 
123da0436e9SJames Smart /* Define SLI4 specific definitions. */
124da0436e9SJames Smart #define LPFC_MQ_CQE_BYTE_OFFSET	256
125da0436e9SJames Smart #define LPFC_MBX_CMD_HDR_LENGTH 16
126da0436e9SJames Smart #define LPFC_MBX_ERROR_RANGE	0x4000
127da0436e9SJames Smart #define LPFC_BMBX_BIT1_ADDR_HI	0x2
128da0436e9SJames Smart #define LPFC_BMBX_BIT1_ADDR_LO	0
129da0436e9SJames Smart #define LPFC_RPI_HDR_COUNT	64
130da0436e9SJames Smart #define LPFC_HDR_TEMPLATE_SIZE	4096
131da0436e9SJames Smart #define LPFC_RPI_ALLOC_ERROR 	0xFFFF
132da0436e9SJames Smart #define LPFC_FCF_RECORD_WD_CNT	132
133da0436e9SJames Smart #define LPFC_ENTIRE_FCF_DATABASE 0
134da0436e9SJames Smart #define LPFC_DFLT_FCF_INDEX	 0
135da0436e9SJames Smart 
136da0436e9SJames Smart /* Virtual function numbers */
137da0436e9SJames Smart #define LPFC_VF0		0
138da0436e9SJames Smart #define LPFC_VF1		1
139da0436e9SJames Smart #define LPFC_VF2		2
140da0436e9SJames Smart #define LPFC_VF3		3
141da0436e9SJames Smart #define LPFC_VF4		4
142da0436e9SJames Smart #define LPFC_VF5		5
143da0436e9SJames Smart #define LPFC_VF6		6
144da0436e9SJames Smart #define LPFC_VF7		7
145da0436e9SJames Smart #define LPFC_VF8		8
146da0436e9SJames Smart #define LPFC_VF9		9
147da0436e9SJames Smart #define LPFC_VF10		10
148da0436e9SJames Smart #define LPFC_VF11		11
149da0436e9SJames Smart #define LPFC_VF12		12
150da0436e9SJames Smart #define LPFC_VF13		13
151da0436e9SJames Smart #define LPFC_VF14		14
152da0436e9SJames Smart #define LPFC_VF15		15
153da0436e9SJames Smart #define LPFC_VF16		16
154da0436e9SJames Smart #define LPFC_VF17		17
155da0436e9SJames Smart #define LPFC_VF18		18
156da0436e9SJames Smart #define LPFC_VF19		19
157da0436e9SJames Smart #define LPFC_VF20		20
158da0436e9SJames Smart #define LPFC_VF21		21
159da0436e9SJames Smart #define LPFC_VF22		22
160da0436e9SJames Smart #define LPFC_VF23		23
161da0436e9SJames Smart #define LPFC_VF24		24
162da0436e9SJames Smart #define LPFC_VF25		25
163da0436e9SJames Smart #define LPFC_VF26		26
164da0436e9SJames Smart #define LPFC_VF27		27
165da0436e9SJames Smart #define LPFC_VF28		28
166da0436e9SJames Smart #define LPFC_VF29		29
167da0436e9SJames Smart #define LPFC_VF30		30
168da0436e9SJames Smart #define LPFC_VF31		31
169da0436e9SJames Smart 
170da0436e9SJames Smart /* PCI function numbers */
171da0436e9SJames Smart #define LPFC_PCI_FUNC0		0
172da0436e9SJames Smart #define LPFC_PCI_FUNC1		1
173da0436e9SJames Smart #define LPFC_PCI_FUNC2		2
174da0436e9SJames Smart #define LPFC_PCI_FUNC3		3
175da0436e9SJames Smart #define LPFC_PCI_FUNC4		4
176da0436e9SJames Smart 
17788a2cfbbSJames Smart /* SLI4 interface type-2 PDEV_CTL register */
178c0c11512SJames Smart #define LPFC_CTL_PDEV_CTL_OFFSET	0x414
179c0c11512SJames Smart #define LPFC_CTL_PDEV_CTL_DRST		0x00000001
180c0c11512SJames Smart #define LPFC_CTL_PDEV_CTL_FRST		0x00000002
181c0c11512SJames Smart #define LPFC_CTL_PDEV_CTL_DD		0x00000004
182c0c11512SJames Smart #define LPFC_CTL_PDEV_CTL_LC		0x00000008
183c0c11512SJames Smart #define LPFC_CTL_PDEV_CTL_FRL_ALL	0x00
184c0c11512SJames Smart #define LPFC_CTL_PDEV_CTL_FRL_FC_FCOE	0x10
185c0c11512SJames Smart #define LPFC_CTL_PDEV_CTL_FRL_NIC	0x20
186c0c11512SJames Smart 
187c0c11512SJames Smart #define LPFC_FW_DUMP_REQUEST    (LPFC_CTL_PDEV_CTL_DD | LPFC_CTL_PDEV_CTL_FRST)
188c0c11512SJames Smart 
189da0436e9SJames Smart /* Active interrupt test count */
190da0436e9SJames Smart #define LPFC_ACT_INTR_CNT	4
191da0436e9SJames Smart 
19249aa143dSJames Smart /* Algrithmns for scheduling FCP commands to WQs */
19349aa143dSJames Smart #define	LPFC_FCP_SCHED_ROUND_ROBIN	0
19449aa143dSJames Smart #define	LPFC_FCP_SCHED_BY_CPU		1
19549aa143dSJames Smart 
196da0436e9SJames Smart /* Delay Multiplier constant */
197da0436e9SJames Smart #define LPFC_DMULT_CONST       651042
198bf8dae83SJames Smart 
199bf8dae83SJames Smart /* Configuration of Interrupts / sec for entire HBA port */
200bf8dae83SJames Smart #define LPFC_MIN_IMAX          5000
201bf8dae83SJames Smart #define LPFC_MAX_IMAX          5000000
202895427bdSJames Smart #define LPFC_DEF_IMAX          150000
203da0436e9SJames Smart 
2047bb03bbfSJames Smart #define LPFC_MIN_CPU_MAP       0
2057bb03bbfSJames Smart #define LPFC_MAX_CPU_MAP       2
2067bb03bbfSJames Smart #define LPFC_HBA_CPU_MAP       1
2077bb03bbfSJames Smart #define LPFC_DRIVER_CPU_MAP    2  /* Default */
2087bb03bbfSJames Smart 
20928baac74SJames Smart /* PORT_CAPABILITIES constants. */
21028baac74SJames Smart #define LPFC_MAX_SUPPORTED_PAGES	8
21128baac74SJames Smart 
212da0436e9SJames Smart struct ulp_bde64 {
213da0436e9SJames Smart 	union ULP_BDE_TUS {
214da0436e9SJames Smart 		uint32_t w;
215da0436e9SJames Smart 		struct {
216da0436e9SJames Smart #ifdef __BIG_ENDIAN_BITFIELD
217da0436e9SJames Smart 			uint32_t bdeFlags:8;	/* BDE Flags 0 IS A SUPPORTED
218da0436e9SJames Smart 						   VALUE !! */
219da0436e9SJames Smart 			uint32_t bdeSize:24;	/* Size of buffer (in bytes) */
220da0436e9SJames Smart #else	/*  __LITTLE_ENDIAN_BITFIELD */
221da0436e9SJames Smart 			uint32_t bdeSize:24;	/* Size of buffer (in bytes) */
222da0436e9SJames Smart 			uint32_t bdeFlags:8;	/* BDE Flags 0 IS A SUPPORTED
223da0436e9SJames Smart 						   VALUE !! */
224da0436e9SJames Smart #endif
225da0436e9SJames Smart #define BUFF_TYPE_BDE_64    0x00	/* BDE (Host_resident) */
226da0436e9SJames Smart #define BUFF_TYPE_BDE_IMMED 0x01	/* Immediate Data BDE */
227da0436e9SJames Smart #define BUFF_TYPE_BDE_64P   0x02	/* BDE (Port-resident) */
228da0436e9SJames Smart #define BUFF_TYPE_BDE_64I   0x08	/* Input BDE (Host-resident) */
229da0436e9SJames Smart #define BUFF_TYPE_BDE_64IP  0x0A	/* Input BDE (Port-resident) */
230da0436e9SJames Smart #define BUFF_TYPE_BLP_64    0x40	/* BLP (Host-resident) */
231da0436e9SJames Smart #define BUFF_TYPE_BLP_64P   0x42	/* BLP (Port-resident) */
232da0436e9SJames Smart 		} f;
233da0436e9SJames Smart 	} tus;
234da0436e9SJames Smart 	uint32_t addrLow;
235da0436e9SJames Smart 	uint32_t addrHigh;
236da0436e9SJames Smart };
237da0436e9SJames Smart 
2380c651878SJames Smart /* Maximun size of immediate data that can fit into a 128 byte WQE */
2390c651878SJames Smart #define LPFC_MAX_BDE_IMM_SIZE	64
2400c651878SJames Smart 
241da0436e9SJames Smart struct lpfc_sli4_flags {
242da0436e9SJames Smart 	uint32_t word0;
2436d368e53SJames Smart #define lpfc_idx_rsrc_rdy_SHIFT		0
2446d368e53SJames Smart #define lpfc_idx_rsrc_rdy_MASK		0x00000001
2456d368e53SJames Smart #define lpfc_idx_rsrc_rdy_WORD		word0
2466d368e53SJames Smart #define LPFC_IDX_RSRC_RDY		1
2478a9d2e80SJames Smart #define lpfc_rpi_rsrc_rdy_SHIFT		1
2486d368e53SJames Smart #define lpfc_rpi_rsrc_rdy_MASK		0x00000001
2496d368e53SJames Smart #define lpfc_rpi_rsrc_rdy_WORD		word0
2506d368e53SJames Smart #define LPFC_RPI_RSRC_RDY		1
2518a9d2e80SJames Smart #define lpfc_vpi_rsrc_rdy_SHIFT		2
2526d368e53SJames Smart #define lpfc_vpi_rsrc_rdy_MASK		0x00000001
2536d368e53SJames Smart #define lpfc_vpi_rsrc_rdy_WORD		word0
2546d368e53SJames Smart #define LPFC_VPI_RSRC_RDY		1
2558a9d2e80SJames Smart #define lpfc_vfi_rsrc_rdy_SHIFT		3
2566d368e53SJames Smart #define lpfc_vfi_rsrc_rdy_MASK		0x00000001
2576d368e53SJames Smart #define lpfc_vfi_rsrc_rdy_WORD		word0
2586d368e53SJames Smart #define LPFC_VFI_RSRC_RDY		1
259da0436e9SJames Smart };
260da0436e9SJames Smart 
261546fc854SJames Smart struct sli4_bls_rsp {
2625ffc266eSJames Smart 	uint32_t word0_rsvd;      /* Word0 must be reserved */
2635ffc266eSJames Smart 	uint32_t word1;
2645ffc266eSJames Smart #define lpfc_abts_orig_SHIFT      0
2655ffc266eSJames Smart #define lpfc_abts_orig_MASK       0x00000001
2665ffc266eSJames Smart #define lpfc_abts_orig_WORD       word1
2675ffc266eSJames Smart #define LPFC_ABTS_UNSOL_RSP       1
2685ffc266eSJames Smart #define LPFC_ABTS_UNSOL_INT       0
2695ffc266eSJames Smart 	uint32_t word2;
2705ffc266eSJames Smart #define lpfc_abts_rxid_SHIFT      0
2715ffc266eSJames Smart #define lpfc_abts_rxid_MASK       0x0000FFFF
2725ffc266eSJames Smart #define lpfc_abts_rxid_WORD       word2
2735ffc266eSJames Smart #define lpfc_abts_oxid_SHIFT      16
2745ffc266eSJames Smart #define lpfc_abts_oxid_MASK       0x0000FFFF
2755ffc266eSJames Smart #define lpfc_abts_oxid_WORD       word2
2765ffc266eSJames Smart 	uint32_t word3;
277546fc854SJames Smart #define lpfc_vndr_code_SHIFT	0
278546fc854SJames Smart #define lpfc_vndr_code_MASK	0x000000FF
279546fc854SJames Smart #define lpfc_vndr_code_WORD	word3
280546fc854SJames Smart #define lpfc_rsn_expln_SHIFT	8
281546fc854SJames Smart #define lpfc_rsn_expln_MASK	0x000000FF
282546fc854SJames Smart #define lpfc_rsn_expln_WORD	word3
283546fc854SJames Smart #define lpfc_rsn_code_SHIFT	16
284546fc854SJames Smart #define lpfc_rsn_code_MASK	0x000000FF
285546fc854SJames Smart #define lpfc_rsn_code_WORD	word3
286546fc854SJames Smart 
2875ffc266eSJames Smart 	uint32_t word4;
2885ffc266eSJames Smart 	uint32_t word5_rsvd;	/* Word5 must be reserved */
2895ffc266eSJames Smart };
2905ffc266eSJames Smart 
291da0436e9SJames Smart /* event queue entry structure */
292da0436e9SJames Smart struct lpfc_eqe {
293da0436e9SJames Smart 	uint32_t word0;
294da0436e9SJames Smart #define lpfc_eqe_resource_id_SHIFT	16
29516f3b48dSJames Smart #define lpfc_eqe_resource_id_MASK	0x0000FFFF
296da0436e9SJames Smart #define lpfc_eqe_resource_id_WORD	word0
297da0436e9SJames Smart #define lpfc_eqe_minor_code_SHIFT	4
298da0436e9SJames Smart #define lpfc_eqe_minor_code_MASK	0x00000FFF
299da0436e9SJames Smart #define lpfc_eqe_minor_code_WORD	word0
300da0436e9SJames Smart #define lpfc_eqe_major_code_SHIFT	1
301da0436e9SJames Smart #define lpfc_eqe_major_code_MASK	0x00000007
302da0436e9SJames Smart #define lpfc_eqe_major_code_WORD	word0
303da0436e9SJames Smart #define lpfc_eqe_valid_SHIFT		0
304da0436e9SJames Smart #define lpfc_eqe_valid_MASK		0x00000001
305da0436e9SJames Smart #define lpfc_eqe_valid_WORD		word0
306da0436e9SJames Smart };
307da0436e9SJames Smart 
308da0436e9SJames Smart /* completion queue entry structure (common fields for all cqe types) */
309da0436e9SJames Smart struct lpfc_cqe {
310da0436e9SJames Smart 	uint32_t reserved0;
311da0436e9SJames Smart 	uint32_t reserved1;
312da0436e9SJames Smart 	uint32_t reserved2;
313da0436e9SJames Smart 	uint32_t word3;
314da0436e9SJames Smart #define lpfc_cqe_valid_SHIFT		31
315da0436e9SJames Smart #define lpfc_cqe_valid_MASK		0x00000001
316da0436e9SJames Smart #define lpfc_cqe_valid_WORD		word3
317da0436e9SJames Smart #define lpfc_cqe_code_SHIFT		16
318da0436e9SJames Smart #define lpfc_cqe_code_MASK		0x000000FF
319da0436e9SJames Smart #define lpfc_cqe_code_WORD		word3
320da0436e9SJames Smart };
321da0436e9SJames Smart 
322da0436e9SJames Smart /* Completion Queue Entry Status Codes */
323da0436e9SJames Smart #define CQE_STATUS_SUCCESS		0x0
324da0436e9SJames Smart #define CQE_STATUS_FCP_RSP_FAILURE	0x1
325da0436e9SJames Smart #define CQE_STATUS_REMOTE_STOP		0x2
326da0436e9SJames Smart #define CQE_STATUS_LOCAL_REJECT		0x3
327da0436e9SJames Smart #define CQE_STATUS_NPORT_RJT		0x4
328da0436e9SJames Smart #define CQE_STATUS_FABRIC_RJT		0x5
329da0436e9SJames Smart #define CQE_STATUS_NPORT_BSY		0x6
330da0436e9SJames Smart #define CQE_STATUS_FABRIC_BSY		0x7
331da0436e9SJames Smart #define CQE_STATUS_INTERMED_RSP		0x8
332da0436e9SJames Smart #define CQE_STATUS_LS_RJT		0x9
333da0436e9SJames Smart #define CQE_STATUS_CMD_REJECT		0xb
334da0436e9SJames Smart #define CQE_STATUS_FCP_TGT_LENCHECK	0xc
335da0436e9SJames Smart #define CQE_STATUS_NEED_BUFF_ENTRY	0xf
336acd6859bSJames Smart #define CQE_STATUS_DI_ERROR		0x16
337acd6859bSJames Smart 
338acd6859bSJames Smart /* Used when mapping CQE status to IOCB */
339acd6859bSJames Smart #define LPFC_IOCB_STATUS_MASK		0xf
340da0436e9SJames Smart 
341da0436e9SJames Smart /* Status returned by hardware (valid only if status = CQE_STATUS_SUCCESS). */
342da0436e9SJames Smart #define CQE_HW_STATUS_NO_ERR		0x0
343da0436e9SJames Smart #define CQE_HW_STATUS_UNDERRUN		0x1
344da0436e9SJames Smart #define CQE_HW_STATUS_OVERRUN		0x2
345da0436e9SJames Smart 
346da0436e9SJames Smart /* Completion Queue Entry Codes */
347da0436e9SJames Smart #define CQE_CODE_COMPL_WQE		0x1
348da0436e9SJames Smart #define CQE_CODE_RELEASE_WQE		0x2
349da0436e9SJames Smart #define CQE_CODE_RECEIVE		0x4
350da0436e9SJames Smart #define CQE_CODE_XRI_ABORTED		0x5
3517851fe2cSJames Smart #define CQE_CODE_RECEIVE_V1		0x9
352895427bdSJames Smart #define CQE_CODE_NVME_ERSP		0xd
353da0436e9SJames Smart 
3545c1db2acSJames Smart /*
3555c1db2acSJames Smart  * Define mask value for xri_aborted and wcqe completed CQE extended status.
3565c1db2acSJames Smart  * Currently, extended status is limited to 9 bits (0x0 -> 0x103) .
3575c1db2acSJames Smart  */
358e3d2b802SJames Smart #define WCQE_PARAM_MASK		0x1FF
3595c1db2acSJames Smart 
360da0436e9SJames Smart /* completion queue entry for wqe completions */
361da0436e9SJames Smart struct lpfc_wcqe_complete {
362da0436e9SJames Smart 	uint32_t word0;
363da0436e9SJames Smart #define lpfc_wcqe_c_request_tag_SHIFT	16
364da0436e9SJames Smart #define lpfc_wcqe_c_request_tag_MASK	0x0000FFFF
365da0436e9SJames Smart #define lpfc_wcqe_c_request_tag_WORD	word0
366da0436e9SJames Smart #define lpfc_wcqe_c_status_SHIFT	8
367da0436e9SJames Smart #define lpfc_wcqe_c_status_MASK		0x000000FF
368da0436e9SJames Smart #define lpfc_wcqe_c_status_WORD		word0
369da0436e9SJames Smart #define lpfc_wcqe_c_hw_status_SHIFT	0
370da0436e9SJames Smart #define lpfc_wcqe_c_hw_status_MASK	0x000000FF
371da0436e9SJames Smart #define lpfc_wcqe_c_hw_status_WORD	word0
372895427bdSJames Smart #define lpfc_wcqe_c_ersp0_SHIFT		0
373895427bdSJames Smart #define lpfc_wcqe_c_ersp0_MASK		0x0000FFFF
374895427bdSJames Smart #define lpfc_wcqe_c_ersp0_WORD		word0
375da0436e9SJames Smart 	uint32_t total_data_placed;
376da0436e9SJames Smart 	uint32_t parameter;
377acd6859bSJames Smart #define lpfc_wcqe_c_bg_edir_SHIFT	5
378acd6859bSJames Smart #define lpfc_wcqe_c_bg_edir_MASK	0x00000001
379acd6859bSJames Smart #define lpfc_wcqe_c_bg_edir_WORD	parameter
380acd6859bSJames Smart #define lpfc_wcqe_c_bg_tdpv_SHIFT	3
381acd6859bSJames Smart #define lpfc_wcqe_c_bg_tdpv_MASK	0x00000001
382acd6859bSJames Smart #define lpfc_wcqe_c_bg_tdpv_WORD	parameter
383acd6859bSJames Smart #define lpfc_wcqe_c_bg_re_SHIFT		2
384acd6859bSJames Smart #define lpfc_wcqe_c_bg_re_MASK		0x00000001
385acd6859bSJames Smart #define lpfc_wcqe_c_bg_re_WORD		parameter
386acd6859bSJames Smart #define lpfc_wcqe_c_bg_ae_SHIFT		1
387acd6859bSJames Smart #define lpfc_wcqe_c_bg_ae_MASK		0x00000001
388acd6859bSJames Smart #define lpfc_wcqe_c_bg_ae_WORD		parameter
389acd6859bSJames Smart #define lpfc_wcqe_c_bg_ge_SHIFT		0
390acd6859bSJames Smart #define lpfc_wcqe_c_bg_ge_MASK		0x00000001
391acd6859bSJames Smart #define lpfc_wcqe_c_bg_ge_WORD		parameter
392da0436e9SJames Smart 	uint32_t word3;
393da0436e9SJames Smart #define lpfc_wcqe_c_valid_SHIFT		lpfc_cqe_valid_SHIFT
394da0436e9SJames Smart #define lpfc_wcqe_c_valid_MASK		lpfc_cqe_valid_MASK
395da0436e9SJames Smart #define lpfc_wcqe_c_valid_WORD		lpfc_cqe_valid_WORD
396da0436e9SJames Smart #define lpfc_wcqe_c_xb_SHIFT		28
397da0436e9SJames Smart #define lpfc_wcqe_c_xb_MASK		0x00000001
398da0436e9SJames Smart #define lpfc_wcqe_c_xb_WORD		word3
399da0436e9SJames Smart #define lpfc_wcqe_c_pv_SHIFT		27
400da0436e9SJames Smart #define lpfc_wcqe_c_pv_MASK		0x00000001
401da0436e9SJames Smart #define lpfc_wcqe_c_pv_WORD		word3
402da0436e9SJames Smart #define lpfc_wcqe_c_priority_SHIFT	24
403da0436e9SJames Smart #define lpfc_wcqe_c_priority_MASK	0x00000007
404da0436e9SJames Smart #define lpfc_wcqe_c_priority_WORD	word3
405da0436e9SJames Smart #define lpfc_wcqe_c_code_SHIFT		lpfc_cqe_code_SHIFT
406da0436e9SJames Smart #define lpfc_wcqe_c_code_MASK		lpfc_cqe_code_MASK
407da0436e9SJames Smart #define lpfc_wcqe_c_code_WORD		lpfc_cqe_code_WORD
408895427bdSJames Smart #define lpfc_wcqe_c_sqhead_SHIFT	0
409895427bdSJames Smart #define lpfc_wcqe_c_sqhead_MASK		0x0000FFFF
410895427bdSJames Smart #define lpfc_wcqe_c_sqhead_WORD		word3
411da0436e9SJames Smart };
412da0436e9SJames Smart 
413da0436e9SJames Smart /* completion queue entry for wqe release */
414da0436e9SJames Smart struct lpfc_wcqe_release {
415da0436e9SJames Smart 	uint32_t reserved0;
416da0436e9SJames Smart 	uint32_t reserved1;
417da0436e9SJames Smart 	uint32_t word2;
418da0436e9SJames Smart #define lpfc_wcqe_r_wq_id_SHIFT		16
419da0436e9SJames Smart #define lpfc_wcqe_r_wq_id_MASK		0x0000FFFF
420da0436e9SJames Smart #define lpfc_wcqe_r_wq_id_WORD		word2
421da0436e9SJames Smart #define lpfc_wcqe_r_wqe_index_SHIFT	0
422da0436e9SJames Smart #define lpfc_wcqe_r_wqe_index_MASK	0x0000FFFF
423da0436e9SJames Smart #define lpfc_wcqe_r_wqe_index_WORD	word2
424da0436e9SJames Smart 	uint32_t word3;
425da0436e9SJames Smart #define lpfc_wcqe_r_valid_SHIFT		lpfc_cqe_valid_SHIFT
426da0436e9SJames Smart #define lpfc_wcqe_r_valid_MASK		lpfc_cqe_valid_MASK
427da0436e9SJames Smart #define lpfc_wcqe_r_valid_WORD		lpfc_cqe_valid_WORD
428da0436e9SJames Smart #define lpfc_wcqe_r_code_SHIFT		lpfc_cqe_code_SHIFT
429da0436e9SJames Smart #define lpfc_wcqe_r_code_MASK		lpfc_cqe_code_MASK
430da0436e9SJames Smart #define lpfc_wcqe_r_code_WORD		lpfc_cqe_code_WORD
431da0436e9SJames Smart };
432da0436e9SJames Smart 
433da0436e9SJames Smart struct sli4_wcqe_xri_aborted {
434da0436e9SJames Smart 	uint32_t word0;
435da0436e9SJames Smart #define lpfc_wcqe_xa_status_SHIFT		8
436da0436e9SJames Smart #define lpfc_wcqe_xa_status_MASK		0x000000FF
437da0436e9SJames Smart #define lpfc_wcqe_xa_status_WORD		word0
438da0436e9SJames Smart 	uint32_t parameter;
439da0436e9SJames Smart 	uint32_t word2;
440da0436e9SJames Smart #define lpfc_wcqe_xa_remote_xid_SHIFT	16
441da0436e9SJames Smart #define lpfc_wcqe_xa_remote_xid_MASK	0x0000FFFF
442da0436e9SJames Smart #define lpfc_wcqe_xa_remote_xid_WORD	word2
443da0436e9SJames Smart #define lpfc_wcqe_xa_xri_SHIFT		0
444da0436e9SJames Smart #define lpfc_wcqe_xa_xri_MASK		0x0000FFFF
445da0436e9SJames Smart #define lpfc_wcqe_xa_xri_WORD		word2
446da0436e9SJames Smart 	uint32_t word3;
447da0436e9SJames Smart #define lpfc_wcqe_xa_valid_SHIFT	lpfc_cqe_valid_SHIFT
448da0436e9SJames Smart #define lpfc_wcqe_xa_valid_MASK		lpfc_cqe_valid_MASK
449da0436e9SJames Smart #define lpfc_wcqe_xa_valid_WORD		lpfc_cqe_valid_WORD
450da0436e9SJames Smart #define lpfc_wcqe_xa_ia_SHIFT		30
451da0436e9SJames Smart #define lpfc_wcqe_xa_ia_MASK		0x00000001
452da0436e9SJames Smart #define lpfc_wcqe_xa_ia_WORD		word3
453da0436e9SJames Smart #define CQE_XRI_ABORTED_IA_REMOTE	0
454da0436e9SJames Smart #define CQE_XRI_ABORTED_IA_LOCAL	1
455da0436e9SJames Smart #define lpfc_wcqe_xa_br_SHIFT		29
456da0436e9SJames Smart #define lpfc_wcqe_xa_br_MASK		0x00000001
457da0436e9SJames Smart #define lpfc_wcqe_xa_br_WORD		word3
458da0436e9SJames Smart #define CQE_XRI_ABORTED_BR_BA_ACC	0
459da0436e9SJames Smart #define CQE_XRI_ABORTED_BR_BA_RJT	1
460da0436e9SJames Smart #define lpfc_wcqe_xa_eo_SHIFT		28
461da0436e9SJames Smart #define lpfc_wcqe_xa_eo_MASK		0x00000001
462da0436e9SJames Smart #define lpfc_wcqe_xa_eo_WORD		word3
463da0436e9SJames Smart #define CQE_XRI_ABORTED_EO_REMOTE	0
464da0436e9SJames Smart #define CQE_XRI_ABORTED_EO_LOCAL	1
465da0436e9SJames Smart #define lpfc_wcqe_xa_code_SHIFT		lpfc_cqe_code_SHIFT
466da0436e9SJames Smart #define lpfc_wcqe_xa_code_MASK		lpfc_cqe_code_MASK
467da0436e9SJames Smart #define lpfc_wcqe_xa_code_WORD		lpfc_cqe_code_WORD
468da0436e9SJames Smart };
469da0436e9SJames Smart 
470da0436e9SJames Smart /* completion queue entry structure for rqe completion */
471da0436e9SJames Smart struct lpfc_rcqe {
472da0436e9SJames Smart 	uint32_t word0;
473da0436e9SJames Smart #define lpfc_rcqe_bindex_SHIFT		16
474da0436e9SJames Smart #define lpfc_rcqe_bindex_MASK		0x0000FFF
475da0436e9SJames Smart #define lpfc_rcqe_bindex_WORD		word0
476da0436e9SJames Smart #define lpfc_rcqe_status_SHIFT		8
477da0436e9SJames Smart #define lpfc_rcqe_status_MASK		0x000000FF
478da0436e9SJames Smart #define lpfc_rcqe_status_WORD		word0
479da0436e9SJames Smart #define FC_STATUS_RQ_SUCCESS		0x10 /* Async receive successful */
480da0436e9SJames Smart #define FC_STATUS_RQ_BUF_LEN_EXCEEDED 	0x11 /* payload truncated */
481da0436e9SJames Smart #define FC_STATUS_INSUFF_BUF_NEED_BUF 	0x12 /* Insufficient buffers */
482da0436e9SJames Smart #define FC_STATUS_INSUFF_BUF_FRM_DISC 	0x13 /* Frame Discard */
4837851fe2cSJames Smart 	uint32_t word1;
4847851fe2cSJames Smart #define lpfc_rcqe_fcf_id_v1_SHIFT	0
4857851fe2cSJames Smart #define lpfc_rcqe_fcf_id_v1_MASK	0x0000003F
4867851fe2cSJames Smart #define lpfc_rcqe_fcf_id_v1_WORD	word1
487da0436e9SJames Smart 	uint32_t word2;
488da0436e9SJames Smart #define lpfc_rcqe_length_SHIFT		16
489da0436e9SJames Smart #define lpfc_rcqe_length_MASK		0x0000FFFF
490da0436e9SJames Smart #define lpfc_rcqe_length_WORD		word2
491da0436e9SJames Smart #define lpfc_rcqe_rq_id_SHIFT		6
492da0436e9SJames Smart #define lpfc_rcqe_rq_id_MASK		0x000003FF
493da0436e9SJames Smart #define lpfc_rcqe_rq_id_WORD		word2
494da0436e9SJames Smart #define lpfc_rcqe_fcf_id_SHIFT		0
495da0436e9SJames Smart #define lpfc_rcqe_fcf_id_MASK		0x0000003F
496da0436e9SJames Smart #define lpfc_rcqe_fcf_id_WORD		word2
4977851fe2cSJames Smart #define lpfc_rcqe_rq_id_v1_SHIFT	0
4987851fe2cSJames Smart #define lpfc_rcqe_rq_id_v1_MASK		0x0000FFFF
4997851fe2cSJames Smart #define lpfc_rcqe_rq_id_v1_WORD		word2
500da0436e9SJames Smart 	uint32_t word3;
501da0436e9SJames Smart #define lpfc_rcqe_valid_SHIFT		lpfc_cqe_valid_SHIFT
502da0436e9SJames Smart #define lpfc_rcqe_valid_MASK		lpfc_cqe_valid_MASK
503da0436e9SJames Smart #define lpfc_rcqe_valid_WORD		lpfc_cqe_valid_WORD
504da0436e9SJames Smart #define lpfc_rcqe_port_SHIFT		30
505da0436e9SJames Smart #define lpfc_rcqe_port_MASK		0x00000001
506da0436e9SJames Smart #define lpfc_rcqe_port_WORD		word3
507da0436e9SJames Smart #define lpfc_rcqe_hdr_length_SHIFT	24
508da0436e9SJames Smart #define lpfc_rcqe_hdr_length_MASK	0x0000001F
509da0436e9SJames Smart #define lpfc_rcqe_hdr_length_WORD	word3
510da0436e9SJames Smart #define lpfc_rcqe_code_SHIFT		lpfc_cqe_code_SHIFT
511da0436e9SJames Smart #define lpfc_rcqe_code_MASK		lpfc_cqe_code_MASK
512da0436e9SJames Smart #define lpfc_rcqe_code_WORD		lpfc_cqe_code_WORD
513da0436e9SJames Smart #define lpfc_rcqe_eof_SHIFT		8
514da0436e9SJames Smart #define lpfc_rcqe_eof_MASK		0x000000FF
515da0436e9SJames Smart #define lpfc_rcqe_eof_WORD		word3
516da0436e9SJames Smart #define FCOE_EOFn	0x41
517da0436e9SJames Smart #define FCOE_EOFt	0x42
518da0436e9SJames Smart #define FCOE_EOFni	0x49
519da0436e9SJames Smart #define FCOE_EOFa	0x50
520da0436e9SJames Smart #define lpfc_rcqe_sof_SHIFT		0
521da0436e9SJames Smart #define lpfc_rcqe_sof_MASK		0x000000FF
522da0436e9SJames Smart #define lpfc_rcqe_sof_WORD		word3
523da0436e9SJames Smart #define FCOE_SOFi2	0x2d
524da0436e9SJames Smart #define FCOE_SOFi3	0x2e
525da0436e9SJames Smart #define FCOE_SOFn2	0x35
526da0436e9SJames Smart #define FCOE_SOFn3	0x36
527da0436e9SJames Smart };
528da0436e9SJames Smart 
529da0436e9SJames Smart struct lpfc_rqe {
530da0436e9SJames Smart 	uint32_t address_hi;
531da0436e9SJames Smart 	uint32_t address_lo;
532da0436e9SJames Smart };
533da0436e9SJames Smart 
534da0436e9SJames Smart /* buffer descriptors */
535da0436e9SJames Smart struct lpfc_bde4 {
536da0436e9SJames Smart 	uint32_t addr_hi;
537da0436e9SJames Smart 	uint32_t addr_lo;
538da0436e9SJames Smart 	uint32_t word2;
539da0436e9SJames Smart #define lpfc_bde4_last_SHIFT		31
540da0436e9SJames Smart #define lpfc_bde4_last_MASK		0x00000001
541da0436e9SJames Smart #define lpfc_bde4_last_WORD		word2
542da0436e9SJames Smart #define lpfc_bde4_sge_offset_SHIFT	0
543da0436e9SJames Smart #define lpfc_bde4_sge_offset_MASK	0x000003FF
544da0436e9SJames Smart #define lpfc_bde4_sge_offset_WORD	word2
545da0436e9SJames Smart 	uint32_t word3;
546da0436e9SJames Smart #define lpfc_bde4_length_SHIFT		0
547da0436e9SJames Smart #define lpfc_bde4_length_MASK		0x000000FF
548da0436e9SJames Smart #define lpfc_bde4_length_WORD		word3
549da0436e9SJames Smart };
550da0436e9SJames Smart 
551da0436e9SJames Smart struct lpfc_register {
552da0436e9SJames Smart 	uint32_t word0;
553da0436e9SJames Smart };
554da0436e9SJames Smart 
55565791f1fSJames Smart #define LPFC_PORT_SEM_UE_RECOVERABLE    0xE000
55665791f1fSJames Smart #define LPFC_PORT_SEM_MASK		0xF000
557085c647cSJames Smart /* The following BAR0 Registers apply to SLI4 if_type 0 UCNAs. */
558da0436e9SJames Smart #define LPFC_UERR_STATUS_HI		0x00A4
559da0436e9SJames Smart #define LPFC_UERR_STATUS_LO		0x00A0
560a747c9ceSJames Smart #define LPFC_UE_MASK_HI			0x00AC
561a747c9ceSJames Smart #define LPFC_UE_MASK_LO			0x00A8
562da0436e9SJames Smart 
5632fcee4bfSJames Smart /* The following BAR0 register sets are defined for if_type 0 and 2 UCNAs. */
5642fcee4bfSJames Smart #define LPFC_SLI_INTF			0x0058
565da0436e9SJames Smart 
56688a2cfbbSJames Smart #define LPFC_CTL_PORT_SEM_OFFSET	0x400
5672fcee4bfSJames Smart #define lpfc_port_smphr_perr_SHIFT	31
5682fcee4bfSJames Smart #define lpfc_port_smphr_perr_MASK	0x1
5692fcee4bfSJames Smart #define lpfc_port_smphr_perr_WORD	word0
5702fcee4bfSJames Smart #define lpfc_port_smphr_sfi_SHIFT	30
5712fcee4bfSJames Smart #define lpfc_port_smphr_sfi_MASK	0x1
5722fcee4bfSJames Smart #define lpfc_port_smphr_sfi_WORD	word0
5732fcee4bfSJames Smart #define lpfc_port_smphr_nip_SHIFT	29
5742fcee4bfSJames Smart #define lpfc_port_smphr_nip_MASK	0x1
5752fcee4bfSJames Smart #define lpfc_port_smphr_nip_WORD	word0
5762fcee4bfSJames Smart #define lpfc_port_smphr_ipc_SHIFT	28
5772fcee4bfSJames Smart #define lpfc_port_smphr_ipc_MASK	0x1
5782fcee4bfSJames Smart #define lpfc_port_smphr_ipc_WORD	word0
5792fcee4bfSJames Smart #define lpfc_port_smphr_scr1_SHIFT	27
5802fcee4bfSJames Smart #define lpfc_port_smphr_scr1_MASK	0x1
5812fcee4bfSJames Smart #define lpfc_port_smphr_scr1_WORD	word0
5822fcee4bfSJames Smart #define lpfc_port_smphr_scr2_SHIFT	26
5832fcee4bfSJames Smart #define lpfc_port_smphr_scr2_MASK	0x1
5842fcee4bfSJames Smart #define lpfc_port_smphr_scr2_WORD	word0
5852fcee4bfSJames Smart #define lpfc_port_smphr_host_scratch_SHIFT	16
5862fcee4bfSJames Smart #define lpfc_port_smphr_host_scratch_MASK	0xFF
5872fcee4bfSJames Smart #define lpfc_port_smphr_host_scratch_WORD	word0
5882fcee4bfSJames Smart #define lpfc_port_smphr_port_status_SHIFT	0
5892fcee4bfSJames Smart #define lpfc_port_smphr_port_status_MASK	0xFFFF
5902fcee4bfSJames Smart #define lpfc_port_smphr_port_status_WORD	word0
5912fcee4bfSJames Smart 
592da0436e9SJames Smart #define LPFC_POST_STAGE_POWER_ON_RESET			0x0000
593da0436e9SJames Smart #define LPFC_POST_STAGE_AWAITING_HOST_RDY		0x0001
594da0436e9SJames Smart #define LPFC_POST_STAGE_HOST_RDY			0x0002
595da0436e9SJames Smart #define LPFC_POST_STAGE_BE_RESET			0x0003
596da0436e9SJames Smart #define LPFC_POST_STAGE_SEEPROM_CS_START		0x0100
597da0436e9SJames Smart #define LPFC_POST_STAGE_SEEPROM_CS_DONE			0x0101
598da0436e9SJames Smart #define LPFC_POST_STAGE_DDR_CONFIG_START		0x0200
599da0436e9SJames Smart #define LPFC_POST_STAGE_DDR_CONFIG_DONE			0x0201
600da0436e9SJames Smart #define LPFC_POST_STAGE_DDR_CALIBRATE_START		0x0300
601da0436e9SJames Smart #define LPFC_POST_STAGE_DDR_CALIBRATE_DONE		0x0301
602da0436e9SJames Smart #define LPFC_POST_STAGE_DDR_TEST_START			0x0400
603da0436e9SJames Smart #define LPFC_POST_STAGE_DDR_TEST_DONE			0x0401
604da0436e9SJames Smart #define LPFC_POST_STAGE_REDBOOT_INIT_START		0x0600
605da0436e9SJames Smart #define LPFC_POST_STAGE_REDBOOT_INIT_DONE		0x0601
606da0436e9SJames Smart #define LPFC_POST_STAGE_FW_IMAGE_LOAD_START		0x0700
607da0436e9SJames Smart #define LPFC_POST_STAGE_FW_IMAGE_LOAD_DONE		0x0701
608da0436e9SJames Smart #define LPFC_POST_STAGE_ARMFW_START			0x0800
609da0436e9SJames Smart #define LPFC_POST_STAGE_DHCP_QUERY_START		0x0900
610da0436e9SJames Smart #define LPFC_POST_STAGE_DHCP_QUERY_DONE			0x0901
611da0436e9SJames Smart #define LPFC_POST_STAGE_BOOT_TARGET_DISCOVERY_START	0x0A00
612da0436e9SJames Smart #define LPFC_POST_STAGE_BOOT_TARGET_DISCOVERY_DONE	0x0A01
613da0436e9SJames Smart #define LPFC_POST_STAGE_RC_OPTION_SET			0x0B00
614da0436e9SJames Smart #define LPFC_POST_STAGE_SWITCH_LINK			0x0B01
615da0436e9SJames Smart #define LPFC_POST_STAGE_SEND_ICDS_MESSAGE		0x0B02
616da0436e9SJames Smart #define LPFC_POST_STAGE_PERFROM_TFTP			0x0B03
617da0436e9SJames Smart #define LPFC_POST_STAGE_PARSE_XML			0x0B04
618da0436e9SJames Smart #define LPFC_POST_STAGE_DOWNLOAD_IMAGE			0x0B05
619da0436e9SJames Smart #define LPFC_POST_STAGE_FLASH_IMAGE			0x0B06
620da0436e9SJames Smart #define LPFC_POST_STAGE_RC_DONE				0x0B07
621da0436e9SJames Smart #define LPFC_POST_STAGE_REBOOT_SYSTEM			0x0B08
622da0436e9SJames Smart #define LPFC_POST_STAGE_MAC_ADDRESS			0x0C00
6232fcee4bfSJames Smart #define LPFC_POST_STAGE_PORT_READY			0xC000
6242fcee4bfSJames Smart #define LPFC_POST_STAGE_PORT_UE 			0xF000
625085c647cSJames Smart 
62688a2cfbbSJames Smart #define LPFC_CTL_PORT_STA_OFFSET	0x404
627085c647cSJames Smart #define lpfc_sliport_status_err_SHIFT	31
628085c647cSJames Smart #define lpfc_sliport_status_err_MASK	0x1
629085c647cSJames Smart #define lpfc_sliport_status_err_WORD	word0
630085c647cSJames Smart #define lpfc_sliport_status_end_SHIFT	30
631085c647cSJames Smart #define lpfc_sliport_status_end_MASK	0x1
632085c647cSJames Smart #define lpfc_sliport_status_end_WORD	word0
633085c647cSJames Smart #define lpfc_sliport_status_oti_SHIFT	29
634085c647cSJames Smart #define lpfc_sliport_status_oti_MASK	0x1
635085c647cSJames Smart #define lpfc_sliport_status_oti_WORD	word0
636085c647cSJames Smart #define lpfc_sliport_status_rn_SHIFT	24
637085c647cSJames Smart #define lpfc_sliport_status_rn_MASK	0x1
638085c647cSJames Smart #define lpfc_sliport_status_rn_WORD	word0
639085c647cSJames Smart #define lpfc_sliport_status_rdy_SHIFT	23
640085c647cSJames Smart #define lpfc_sliport_status_rdy_MASK	0x1
641085c647cSJames Smart #define lpfc_sliport_status_rdy_WORD	word0
642229adb0eSJames Smart #define MAX_IF_TYPE_2_RESETS		6
643085c647cSJames Smart 
64488a2cfbbSJames Smart #define LPFC_CTL_PORT_CTL_OFFSET	0x408
645085c647cSJames Smart #define lpfc_sliport_ctrl_end_SHIFT	30
646085c647cSJames Smart #define lpfc_sliport_ctrl_end_MASK	0x1
647085c647cSJames Smart #define lpfc_sliport_ctrl_end_WORD	word0
648085c647cSJames Smart #define LPFC_SLIPORT_LITTLE_ENDIAN 0
649085c647cSJames Smart #define LPFC_SLIPORT_BIG_ENDIAN	   1
650085c647cSJames Smart #define lpfc_sliport_ctrl_ip_SHIFT	27
651085c647cSJames Smart #define lpfc_sliport_ctrl_ip_MASK	0x1
652085c647cSJames Smart #define lpfc_sliport_ctrl_ip_WORD	word0
6532fcee4bfSJames Smart #define LPFC_SLIPORT_INIT_PORT	1
654085c647cSJames Smart 
65588a2cfbbSJames Smart #define LPFC_CTL_PORT_ER1_OFFSET	0x40C
65688a2cfbbSJames Smart #define LPFC_CTL_PORT_ER2_OFFSET	0x410
657085c647cSJames Smart 
6582fcee4bfSJames Smart /* The following Registers apply to SLI4 if_type 0 UCNAs. They typically
6592fcee4bfSJames Smart  * reside in BAR 2.
6602fcee4bfSJames Smart  */
6612fcee4bfSJames Smart #define LPFC_SLIPORT_IF0_SMPHR	0x00AC
6622fcee4bfSJames Smart 
663da0436e9SJames Smart #define LPFC_IMR_MASK_ALL	0xFFFFFFFF
664da0436e9SJames Smart #define LPFC_ISCR_CLEAR_ALL	0xFFFFFFFF
665da0436e9SJames Smart 
666da0436e9SJames Smart #define LPFC_HST_ISR0		0x0C18
667da0436e9SJames Smart #define LPFC_HST_ISR1		0x0C1C
668da0436e9SJames Smart #define LPFC_HST_ISR2		0x0C20
669da0436e9SJames Smart #define LPFC_HST_ISR3		0x0C24
670da0436e9SJames Smart #define LPFC_HST_ISR4		0x0C28
671da0436e9SJames Smart 
672da0436e9SJames Smart #define LPFC_HST_IMR0		0x0C48
673da0436e9SJames Smart #define LPFC_HST_IMR1		0x0C4C
674da0436e9SJames Smart #define LPFC_HST_IMR2		0x0C50
675da0436e9SJames Smart #define LPFC_HST_IMR3		0x0C54
676da0436e9SJames Smart #define LPFC_HST_IMR4		0x0C58
677da0436e9SJames Smart 
678da0436e9SJames Smart #define LPFC_HST_ISCR0		0x0C78
679da0436e9SJames Smart #define LPFC_HST_ISCR1		0x0C7C
680da0436e9SJames Smart #define LPFC_HST_ISCR2		0x0C80
681da0436e9SJames Smart #define LPFC_HST_ISCR3		0x0C84
682da0436e9SJames Smart #define LPFC_HST_ISCR4		0x0C88
683da0436e9SJames Smart 
684da0436e9SJames Smart #define LPFC_SLI4_INTR0			BIT0
685da0436e9SJames Smart #define LPFC_SLI4_INTR1			BIT1
686da0436e9SJames Smart #define LPFC_SLI4_INTR2			BIT2
687da0436e9SJames Smart #define LPFC_SLI4_INTR3			BIT3
688da0436e9SJames Smart #define LPFC_SLI4_INTR4			BIT4
689da0436e9SJames Smart #define LPFC_SLI4_INTR5			BIT5
690da0436e9SJames Smart #define LPFC_SLI4_INTR6			BIT6
691da0436e9SJames Smart #define LPFC_SLI4_INTR7			BIT7
692da0436e9SJames Smart #define LPFC_SLI4_INTR8			BIT8
693da0436e9SJames Smart #define LPFC_SLI4_INTR9			BIT9
694da0436e9SJames Smart #define LPFC_SLI4_INTR10		BIT10
695da0436e9SJames Smart #define LPFC_SLI4_INTR11		BIT11
696da0436e9SJames Smart #define LPFC_SLI4_INTR12		BIT12
697da0436e9SJames Smart #define LPFC_SLI4_INTR13		BIT13
698da0436e9SJames Smart #define LPFC_SLI4_INTR14		BIT14
699da0436e9SJames Smart #define LPFC_SLI4_INTR15		BIT15
700da0436e9SJames Smart #define LPFC_SLI4_INTR16		BIT16
701da0436e9SJames Smart #define LPFC_SLI4_INTR17		BIT17
702da0436e9SJames Smart #define LPFC_SLI4_INTR18		BIT18
703da0436e9SJames Smart #define LPFC_SLI4_INTR19		BIT19
704da0436e9SJames Smart #define LPFC_SLI4_INTR20		BIT20
705da0436e9SJames Smart #define LPFC_SLI4_INTR21		BIT21
706da0436e9SJames Smart #define LPFC_SLI4_INTR22		BIT22
707da0436e9SJames Smart #define LPFC_SLI4_INTR23		BIT23
708da0436e9SJames Smart #define LPFC_SLI4_INTR24		BIT24
709da0436e9SJames Smart #define LPFC_SLI4_INTR25		BIT25
710da0436e9SJames Smart #define LPFC_SLI4_INTR26		BIT26
711da0436e9SJames Smart #define LPFC_SLI4_INTR27		BIT27
712da0436e9SJames Smart #define LPFC_SLI4_INTR28		BIT28
713da0436e9SJames Smart #define LPFC_SLI4_INTR29		BIT29
714da0436e9SJames Smart #define LPFC_SLI4_INTR30		BIT30
715da0436e9SJames Smart #define LPFC_SLI4_INTR31		BIT31
716da0436e9SJames Smart 
717085c647cSJames Smart /*
718085c647cSJames Smart  * The Doorbell registers defined here exist in different BAR
719085c647cSJames Smart  * register sets depending on the UCNA Port's reported if_type
720085c647cSJames Smart  * value.  For UCNA ports running SLI4 and if_type 0, they reside in
7212fcee4bfSJames Smart  * BAR4.  For UCNA ports running SLI4 and if_type 2, they reside in
722085c647cSJames Smart  * BAR0.  The offsets are the same so the driver must account for
723085c647cSJames Smart  * any base address difference.
724085c647cSJames Smart  */
725962bc51bSJames Smart #define LPFC_ULP0_RQ_DOORBELL		0x00A0
726962bc51bSJames Smart #define LPFC_ULP1_RQ_DOORBELL		0x00C0
727962bc51bSJames Smart #define lpfc_rq_db_list_fm_num_posted_SHIFT	24
728962bc51bSJames Smart #define lpfc_rq_db_list_fm_num_posted_MASK	0x00FF
729962bc51bSJames Smart #define lpfc_rq_db_list_fm_num_posted_WORD	word0
730962bc51bSJames Smart #define lpfc_rq_db_list_fm_index_SHIFT		16
731962bc51bSJames Smart #define lpfc_rq_db_list_fm_index_MASK		0x00FF
732962bc51bSJames Smart #define lpfc_rq_db_list_fm_index_WORD		word0
733962bc51bSJames Smart #define lpfc_rq_db_list_fm_id_SHIFT		0
734962bc51bSJames Smart #define lpfc_rq_db_list_fm_id_MASK		0xFFFF
735962bc51bSJames Smart #define lpfc_rq_db_list_fm_id_WORD		word0
736962bc51bSJames Smart #define lpfc_rq_db_ring_fm_num_posted_SHIFT	16
737962bc51bSJames Smart #define lpfc_rq_db_ring_fm_num_posted_MASK	0x3FFF
738962bc51bSJames Smart #define lpfc_rq_db_ring_fm_num_posted_WORD	word0
739962bc51bSJames Smart #define lpfc_rq_db_ring_fm_id_SHIFT		0
740962bc51bSJames Smart #define lpfc_rq_db_ring_fm_id_MASK		0xFFFF
741962bc51bSJames Smart #define lpfc_rq_db_ring_fm_id_WORD		word0
742da0436e9SJames Smart 
743962bc51bSJames Smart #define LPFC_ULP0_WQ_DOORBELL		0x0040
744962bc51bSJames Smart #define LPFC_ULP1_WQ_DOORBELL		0x0060
745962bc51bSJames Smart #define lpfc_wq_db_list_fm_num_posted_SHIFT	24
746962bc51bSJames Smart #define lpfc_wq_db_list_fm_num_posted_MASK	0x00FF
747962bc51bSJames Smart #define lpfc_wq_db_list_fm_num_posted_WORD	word0
748962bc51bSJames Smart #define lpfc_wq_db_list_fm_index_SHIFT		16
749962bc51bSJames Smart #define lpfc_wq_db_list_fm_index_MASK		0x00FF
750962bc51bSJames Smart #define lpfc_wq_db_list_fm_index_WORD		word0
751962bc51bSJames Smart #define lpfc_wq_db_list_fm_id_SHIFT		0
752962bc51bSJames Smart #define lpfc_wq_db_list_fm_id_MASK		0xFFFF
753962bc51bSJames Smart #define lpfc_wq_db_list_fm_id_WORD		word0
754962bc51bSJames Smart #define lpfc_wq_db_ring_fm_num_posted_SHIFT     16
755962bc51bSJames Smart #define lpfc_wq_db_ring_fm_num_posted_MASK      0x3FFF
756962bc51bSJames Smart #define lpfc_wq_db_ring_fm_num_posted_WORD      word0
757962bc51bSJames Smart #define lpfc_wq_db_ring_fm_id_SHIFT             0
758962bc51bSJames Smart #define lpfc_wq_db_ring_fm_id_MASK              0xFFFF
759962bc51bSJames Smart #define lpfc_wq_db_ring_fm_id_WORD              word0
760da0436e9SJames Smart 
761da0436e9SJames Smart #define LPFC_EQCQ_DOORBELL		0x0120
762085c647cSJames Smart #define lpfc_eqcq_doorbell_se_SHIFT		31
763085c647cSJames Smart #define lpfc_eqcq_doorbell_se_MASK		0x0001
764085c647cSJames Smart #define lpfc_eqcq_doorbell_se_WORD		word0
765085c647cSJames Smart #define LPFC_EQCQ_SOLICIT_ENABLE_OFF	0
766085c647cSJames Smart #define LPFC_EQCQ_SOLICIT_ENABLE_ON	1
767da0436e9SJames Smart #define lpfc_eqcq_doorbell_arm_SHIFT		29
768da0436e9SJames Smart #define lpfc_eqcq_doorbell_arm_MASK		0x0001
769da0436e9SJames Smart #define lpfc_eqcq_doorbell_arm_WORD		word0
770da0436e9SJames Smart #define lpfc_eqcq_doorbell_num_released_SHIFT	16
771da0436e9SJames Smart #define lpfc_eqcq_doorbell_num_released_MASK	0x1FFF
772da0436e9SJames Smart #define lpfc_eqcq_doorbell_num_released_WORD	word0
773da0436e9SJames Smart #define lpfc_eqcq_doorbell_qt_SHIFT		10
774da0436e9SJames Smart #define lpfc_eqcq_doorbell_qt_MASK		0x0001
775da0436e9SJames Smart #define lpfc_eqcq_doorbell_qt_WORD		word0
776da0436e9SJames Smart #define LPFC_QUEUE_TYPE_COMPLETION	0
777da0436e9SJames Smart #define LPFC_QUEUE_TYPE_EVENT		1
778da0436e9SJames Smart #define lpfc_eqcq_doorbell_eqci_SHIFT		9
779da0436e9SJames Smart #define lpfc_eqcq_doorbell_eqci_MASK		0x0001
780da0436e9SJames Smart #define lpfc_eqcq_doorbell_eqci_WORD		word0
7816b5151fdSJames Smart #define lpfc_eqcq_doorbell_cqid_lo_SHIFT	0
7826b5151fdSJames Smart #define lpfc_eqcq_doorbell_cqid_lo_MASK		0x03FF
7836b5151fdSJames Smart #define lpfc_eqcq_doorbell_cqid_lo_WORD		word0
7846b5151fdSJames Smart #define lpfc_eqcq_doorbell_cqid_hi_SHIFT	11
7856b5151fdSJames Smart #define lpfc_eqcq_doorbell_cqid_hi_MASK		0x001F
7866b5151fdSJames Smart #define lpfc_eqcq_doorbell_cqid_hi_WORD		word0
7876b5151fdSJames Smart #define lpfc_eqcq_doorbell_eqid_lo_SHIFT	0
7886b5151fdSJames Smart #define lpfc_eqcq_doorbell_eqid_lo_MASK		0x01FF
7896b5151fdSJames Smart #define lpfc_eqcq_doorbell_eqid_lo_WORD		word0
7906b5151fdSJames Smart #define lpfc_eqcq_doorbell_eqid_hi_SHIFT	11
7916b5151fdSJames Smart #define lpfc_eqcq_doorbell_eqid_hi_MASK		0x001F
7926b5151fdSJames Smart #define lpfc_eqcq_doorbell_eqid_hi_WORD		word0
7936b5151fdSJames Smart #define LPFC_CQID_HI_FIELD_SHIFT		10
7946b5151fdSJames Smart #define LPFC_EQID_HI_FIELD_SHIFT		9
795da0436e9SJames Smart 
796da0436e9SJames Smart #define LPFC_BMBX			0x0160
797da0436e9SJames Smart #define lpfc_bmbx_addr_SHIFT		2
798da0436e9SJames Smart #define lpfc_bmbx_addr_MASK		0x3FFFFFFF
799da0436e9SJames Smart #define lpfc_bmbx_addr_WORD		word0
800da0436e9SJames Smart #define lpfc_bmbx_hi_SHIFT		1
801da0436e9SJames Smart #define lpfc_bmbx_hi_MASK		0x0001
802da0436e9SJames Smart #define lpfc_bmbx_hi_WORD		word0
803da0436e9SJames Smart #define lpfc_bmbx_rdy_SHIFT		0
804da0436e9SJames Smart #define lpfc_bmbx_rdy_MASK		0x0001
805da0436e9SJames Smart #define lpfc_bmbx_rdy_WORD		word0
806da0436e9SJames Smart 
807da0436e9SJames Smart #define LPFC_MQ_DOORBELL			0x0140
808da0436e9SJames Smart #define lpfc_mq_doorbell_num_posted_SHIFT	16
809da0436e9SJames Smart #define lpfc_mq_doorbell_num_posted_MASK	0x3FFF
810da0436e9SJames Smart #define lpfc_mq_doorbell_num_posted_WORD	word0
811da0436e9SJames Smart #define lpfc_mq_doorbell_id_SHIFT		0
812085c647cSJames Smart #define lpfc_mq_doorbell_id_MASK		0xFFFF
813da0436e9SJames Smart #define lpfc_mq_doorbell_id_WORD		word0
814da0436e9SJames Smart 
815da0436e9SJames Smart struct lpfc_sli4_cfg_mhdr {
816da0436e9SJames Smart 	uint32_t word1;
817da0436e9SJames Smart #define lpfc_mbox_hdr_emb_SHIFT		0
818da0436e9SJames Smart #define lpfc_mbox_hdr_emb_MASK		0x00000001
819da0436e9SJames Smart #define lpfc_mbox_hdr_emb_WORD		word1
820da0436e9SJames Smart #define lpfc_mbox_hdr_sge_cnt_SHIFT	3
821da0436e9SJames Smart #define lpfc_mbox_hdr_sge_cnt_MASK	0x0000001F
822da0436e9SJames Smart #define lpfc_mbox_hdr_sge_cnt_WORD	word1
823da0436e9SJames Smart 	uint32_t payload_length;
824da0436e9SJames Smart 	uint32_t tag_lo;
825da0436e9SJames Smart 	uint32_t tag_hi;
826da0436e9SJames Smart 	uint32_t reserved5;
827da0436e9SJames Smart };
828da0436e9SJames Smart 
829da0436e9SJames Smart union lpfc_sli4_cfg_shdr {
830da0436e9SJames Smart 	struct {
831da0436e9SJames Smart 		uint32_t word6;
832da0436e9SJames Smart #define lpfc_mbox_hdr_opcode_SHIFT	0
833da0436e9SJames Smart #define lpfc_mbox_hdr_opcode_MASK	0x000000FF
834da0436e9SJames Smart #define lpfc_mbox_hdr_opcode_WORD	word6
835da0436e9SJames Smart #define lpfc_mbox_hdr_subsystem_SHIFT	8
836da0436e9SJames Smart #define lpfc_mbox_hdr_subsystem_MASK	0x000000FF
837da0436e9SJames Smart #define lpfc_mbox_hdr_subsystem_WORD	word6
838da0436e9SJames Smart #define lpfc_mbox_hdr_port_number_SHIFT	16
839da0436e9SJames Smart #define lpfc_mbox_hdr_port_number_MASK	0x000000FF
840da0436e9SJames Smart #define lpfc_mbox_hdr_port_number_WORD	word6
841da0436e9SJames Smart #define lpfc_mbox_hdr_domain_SHIFT	24
842da0436e9SJames Smart #define lpfc_mbox_hdr_domain_MASK	0x000000FF
843da0436e9SJames Smart #define lpfc_mbox_hdr_domain_WORD	word6
844da0436e9SJames Smart 		uint32_t timeout;
845da0436e9SJames Smart 		uint32_t request_length;
8465a6f133eSJames Smart 		uint32_t word9;
8475a6f133eSJames Smart #define lpfc_mbox_hdr_version_SHIFT	0
8485a6f133eSJames Smart #define lpfc_mbox_hdr_version_MASK	0x000000FF
8495a6f133eSJames Smart #define lpfc_mbox_hdr_version_WORD	word9
850912e3acdSJames Smart #define lpfc_mbox_hdr_pf_num_SHIFT	16
851912e3acdSJames Smart #define lpfc_mbox_hdr_pf_num_MASK	0x000000FF
852912e3acdSJames Smart #define lpfc_mbox_hdr_pf_num_WORD	word9
853912e3acdSJames Smart #define lpfc_mbox_hdr_vh_num_SHIFT	24
854912e3acdSJames Smart #define lpfc_mbox_hdr_vh_num_MASK	0x000000FF
855912e3acdSJames Smart #define lpfc_mbox_hdr_vh_num_WORD	word9
8565a6f133eSJames Smart #define LPFC_Q_CREATE_VERSION_2	2
8575a6f133eSJames Smart #define LPFC_Q_CREATE_VERSION_1	1
8585a6f133eSJames Smart #define LPFC_Q_CREATE_VERSION_0	0
859cd1c8301SJames Smart #define LPFC_OPCODE_VERSION_0	0
860cd1c8301SJames Smart #define LPFC_OPCODE_VERSION_1	1
861da0436e9SJames Smart 	} request;
862da0436e9SJames Smart 	struct {
863da0436e9SJames Smart 		uint32_t word6;
864da0436e9SJames Smart #define lpfc_mbox_hdr_opcode_SHIFT		0
865da0436e9SJames Smart #define lpfc_mbox_hdr_opcode_MASK		0x000000FF
866da0436e9SJames Smart #define lpfc_mbox_hdr_opcode_WORD		word6
867da0436e9SJames Smart #define lpfc_mbox_hdr_subsystem_SHIFT		8
868da0436e9SJames Smart #define lpfc_mbox_hdr_subsystem_MASK		0x000000FF
869da0436e9SJames Smart #define lpfc_mbox_hdr_subsystem_WORD		word6
870da0436e9SJames Smart #define lpfc_mbox_hdr_domain_SHIFT		24
871da0436e9SJames Smart #define lpfc_mbox_hdr_domain_MASK		0x000000FF
872da0436e9SJames Smart #define lpfc_mbox_hdr_domain_WORD		word6
873da0436e9SJames Smart 		uint32_t word7;
874da0436e9SJames Smart #define lpfc_mbox_hdr_status_SHIFT		0
875da0436e9SJames Smart #define lpfc_mbox_hdr_status_MASK		0x000000FF
876da0436e9SJames Smart #define lpfc_mbox_hdr_status_WORD		word7
877da0436e9SJames Smart #define lpfc_mbox_hdr_add_status_SHIFT		8
878da0436e9SJames Smart #define lpfc_mbox_hdr_add_status_MASK		0x000000FF
879da0436e9SJames Smart #define lpfc_mbox_hdr_add_status_WORD		word7
880da0436e9SJames Smart 		uint32_t response_length;
881da0436e9SJames Smart 		uint32_t actual_response_length;
882da0436e9SJames Smart 	} response;
883da0436e9SJames Smart };
884da0436e9SJames Smart 
8856d368e53SJames Smart /* Mailbox Header structures.
8866d368e53SJames Smart  * struct mbox_header is defined for first generation SLI4_CFG mailbox
8876d368e53SJames Smart  * calls deployed for BE-based ports.
8886d368e53SJames Smart  *
8896d368e53SJames Smart  * struct sli4_mbox_header is defined for second generation SLI4
8906d368e53SJames Smart  * ports that don't deploy the SLI4_CFG mechanism.
8916d368e53SJames Smart  */
892da0436e9SJames Smart struct mbox_header {
893da0436e9SJames Smart 	struct lpfc_sli4_cfg_mhdr cfg_mhdr;
894da0436e9SJames Smart 	union  lpfc_sli4_cfg_shdr cfg_shdr;
895da0436e9SJames Smart };
896da0436e9SJames Smart 
8976d368e53SJames Smart #define LPFC_EXTENT_LOCAL		0
8986d368e53SJames Smart #define LPFC_TIMEOUT_DEFAULT		0
8996d368e53SJames Smart #define LPFC_EXTENT_VERSION_DEFAULT	0
9006d368e53SJames Smart 
901da0436e9SJames Smart /* Subsystem Definitions */
902a183a15fSJames Smart #define LPFC_MBOX_SUBSYSTEM_NA		0x0
903da0436e9SJames Smart #define LPFC_MBOX_SUBSYSTEM_COMMON	0x1
904da0436e9SJames Smart #define LPFC_MBOX_SUBSYSTEM_FCOE	0xC
905da0436e9SJames Smart 
906da0436e9SJames Smart /* Device Specific Definitions */
907da0436e9SJames Smart 
908da0436e9SJames Smart /* The HOST ENDIAN defines are in Big Endian format. */
909da0436e9SJames Smart #define HOST_ENDIAN_LOW_WORD0   0xFF3412FF
910da0436e9SJames Smart #define HOST_ENDIAN_HIGH_WORD1	0xFF7856FF
911da0436e9SJames Smart 
912da0436e9SJames Smart /* Common Opcodes */
913a183a15fSJames Smart #define LPFC_MBOX_OPCODE_NA				0x00
914da0436e9SJames Smart #define LPFC_MBOX_OPCODE_CQ_CREATE			0x0C
915da0436e9SJames Smart #define LPFC_MBOX_OPCODE_EQ_CREATE			0x0D
916da0436e9SJames Smart #define LPFC_MBOX_OPCODE_MQ_CREATE			0x15
917da0436e9SJames Smart #define LPFC_MBOX_OPCODE_GET_CNTL_ATTRIBUTES		0x20
918da0436e9SJames Smart #define LPFC_MBOX_OPCODE_NOP				0x21
919173edbb2SJames Smart #define LPFC_MBOX_OPCODE_MODIFY_EQ_DELAY		0x29
920da0436e9SJames Smart #define LPFC_MBOX_OPCODE_MQ_DESTROY			0x35
921da0436e9SJames Smart #define LPFC_MBOX_OPCODE_CQ_DESTROY			0x36
922da0436e9SJames Smart #define LPFC_MBOX_OPCODE_EQ_DESTROY			0x37
9236669f9bbSJames Smart #define LPFC_MBOX_OPCODE_QUERY_FW_CFG			0x3A
924da0436e9SJames Smart #define LPFC_MBOX_OPCODE_FUNCTION_RESET			0x3D
925940eb687SJames Smart #define LPFC_MBOX_OPCODE_SET_PHYSICAL_LINK_CONFIG	0x3E
926940eb687SJames Smart #define LPFC_MBOX_OPCODE_SET_BOOT_CONFIG		0x43
9278b017a30SJames Smart #define LPFC_MBOX_OPCODE_SET_BEACON_CONFIG              0x45
9288b017a30SJames Smart #define LPFC_MBOX_OPCODE_GET_BEACON_CONFIG              0x46
929cd1c8301SJames Smart #define LPFC_MBOX_OPCODE_GET_PORT_NAME			0x4D
930b19a061aSJames Smart #define LPFC_MBOX_OPCODE_MQ_CREATE_EXT			0x5A
931940eb687SJames Smart #define LPFC_MBOX_OPCODE_GET_VPD_DATA			0x5B
93261bda8f7SJames Smart #define LPFC_MBOX_OPCODE_SET_HOST_DATA			0x5D
933940eb687SJames Smart #define LPFC_MBOX_OPCODE_SEND_ACTIVATION		0x73
934940eb687SJames Smart #define LPFC_MBOX_OPCODE_RESET_LICENSES			0x74
9356d368e53SJames Smart #define LPFC_MBOX_OPCODE_GET_RSRC_EXTENT_INFO		0x9A
9366d368e53SJames Smart #define LPFC_MBOX_OPCODE_GET_ALLOC_RSRC_EXTENT		0x9B
9376d368e53SJames Smart #define LPFC_MBOX_OPCODE_ALLOC_RSRC_EXTENT		0x9C
9386d368e53SJames Smart #define LPFC_MBOX_OPCODE_DEALLOC_RSRC_EXTENT		0x9D
939912e3acdSJames Smart #define LPFC_MBOX_OPCODE_GET_FUNCTION_CONFIG		0xA0
940940eb687SJames Smart #define LPFC_MBOX_OPCODE_GET_PROFILE_CAPACITIES		0xA1
941912e3acdSJames Smart #define LPFC_MBOX_OPCODE_GET_PROFILE_CONFIG		0xA4
942a183a15fSJames Smart #define LPFC_MBOX_OPCODE_SET_PROFILE_CONFIG		0xA5
943a183a15fSJames Smart #define LPFC_MBOX_OPCODE_GET_PROFILE_LIST		0xA6
944a183a15fSJames Smart #define LPFC_MBOX_OPCODE_SET_ACT_PROFILE		0xA8
945a183a15fSJames Smart #define LPFC_MBOX_OPCODE_GET_FACTORY_PROFILE_CONFIG	0xA9
946a183a15fSJames Smart #define LPFC_MBOX_OPCODE_READ_OBJECT			0xAB
94752d52440SJames Smart #define LPFC_MBOX_OPCODE_WRITE_OBJECT			0xAC
948a183a15fSJames Smart #define LPFC_MBOX_OPCODE_READ_OBJECT_LIST		0xAD
949a183a15fSJames Smart #define LPFC_MBOX_OPCODE_DELETE_OBJECT			0xAE
950fedd3b7bSJames Smart #define LPFC_MBOX_OPCODE_GET_SLI4_PARAMETERS		0xB5
95165791f1fSJames Smart #define LPFC_MBOX_OPCODE_SET_FEATURES                   0xBF
952da0436e9SJames Smart 
953da0436e9SJames Smart /* FCoE Opcodes */
954da0436e9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_WQ_CREATE			0x01
955da0436e9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_WQ_DESTROY		0x02
956da0436e9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_POST_SGL_PAGES		0x03
957da0436e9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_REMOVE_SGL_PAGES		0x04
958da0436e9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_RQ_CREATE			0x05
959da0436e9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_RQ_DESTROY		0x06
960da0436e9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_READ_FCF_TABLE		0x08
961da0436e9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_ADD_FCF			0x09
962da0436e9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_DELETE_FCF		0x0A
963da0436e9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_POST_HDR_TEMPLATE		0x0B
964ecfd03c6SJames Smart #define LPFC_MBOX_OPCODE_FCOE_REDISCOVER_FCF		0x10
965a183a15fSJames Smart #define LPFC_MBOX_OPCODE_FCOE_SET_FCLINK_SETTINGS	0x21
9667ad20aa9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_STATE		0x22
9677ad20aa9SJames Smart #define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_LOOPBACK	0x23
968da0436e9SJames Smart 
969da0436e9SJames Smart /* Mailbox command structures */
970da0436e9SJames Smart struct eq_context {
971da0436e9SJames Smart 	uint32_t word0;
972da0436e9SJames Smart #define lpfc_eq_context_size_SHIFT	31
973da0436e9SJames Smart #define lpfc_eq_context_size_MASK	0x00000001
974da0436e9SJames Smart #define lpfc_eq_context_size_WORD	word0
975da0436e9SJames Smart #define LPFC_EQE_SIZE_4			0x0
976da0436e9SJames Smart #define LPFC_EQE_SIZE_16		0x1
977da0436e9SJames Smart #define lpfc_eq_context_valid_SHIFT	29
978da0436e9SJames Smart #define lpfc_eq_context_valid_MASK	0x00000001
979da0436e9SJames Smart #define lpfc_eq_context_valid_WORD	word0
980da0436e9SJames Smart 	uint32_t word1;
981da0436e9SJames Smart #define lpfc_eq_context_count_SHIFT	26
982da0436e9SJames Smart #define lpfc_eq_context_count_MASK	0x00000003
983da0436e9SJames Smart #define lpfc_eq_context_count_WORD	word1
984da0436e9SJames Smart #define LPFC_EQ_CNT_256		0x0
985da0436e9SJames Smart #define LPFC_EQ_CNT_512		0x1
986da0436e9SJames Smart #define LPFC_EQ_CNT_1024	0x2
987da0436e9SJames Smart #define LPFC_EQ_CNT_2048	0x3
988da0436e9SJames Smart #define LPFC_EQ_CNT_4096	0x4
989da0436e9SJames Smart 	uint32_t word2;
990da0436e9SJames Smart #define lpfc_eq_context_delay_multi_SHIFT	13
991da0436e9SJames Smart #define lpfc_eq_context_delay_multi_MASK	0x000003FF
992da0436e9SJames Smart #define lpfc_eq_context_delay_multi_WORD	word2
993da0436e9SJames Smart 	uint32_t reserved3;
994da0436e9SJames Smart };
995da0436e9SJames Smart 
996173edbb2SJames Smart struct eq_delay_info {
997173edbb2SJames Smart 	uint32_t eq_id;
998173edbb2SJames Smart 	uint32_t phase;
999173edbb2SJames Smart 	uint32_t delay_multi;
1000173edbb2SJames Smart };
1001173edbb2SJames Smart #define	LPFC_MAX_EQ_DELAY	8
1002173edbb2SJames Smart 
1003da0436e9SJames Smart struct sgl_page_pairs {
1004da0436e9SJames Smart 	uint32_t sgl_pg0_addr_lo;
1005da0436e9SJames Smart 	uint32_t sgl_pg0_addr_hi;
1006da0436e9SJames Smart 	uint32_t sgl_pg1_addr_lo;
1007da0436e9SJames Smart 	uint32_t sgl_pg1_addr_hi;
1008da0436e9SJames Smart };
1009da0436e9SJames Smart 
1010da0436e9SJames Smart struct lpfc_mbx_post_sgl_pages {
1011da0436e9SJames Smart 	struct mbox_header header;
1012da0436e9SJames Smart 	uint32_t word0;
1013da0436e9SJames Smart #define lpfc_post_sgl_pages_xri_SHIFT	0
1014da0436e9SJames Smart #define lpfc_post_sgl_pages_xri_MASK	0x0000FFFF
1015da0436e9SJames Smart #define lpfc_post_sgl_pages_xri_WORD	word0
1016da0436e9SJames Smart #define lpfc_post_sgl_pages_xricnt_SHIFT	16
1017da0436e9SJames Smart #define lpfc_post_sgl_pages_xricnt_MASK	0x0000FFFF
1018da0436e9SJames Smart #define lpfc_post_sgl_pages_xricnt_WORD	word0
1019da0436e9SJames Smart 	struct sgl_page_pairs  sgl_pg_pairs[1];
1020da0436e9SJames Smart };
1021da0436e9SJames Smart 
1022da0436e9SJames Smart /* word0 of page-1 struct shares the same SHIFT/MASK/WORD defines as above */
1023da0436e9SJames Smart struct lpfc_mbx_post_uembed_sgl_page1 {
1024da0436e9SJames Smart 	union  lpfc_sli4_cfg_shdr cfg_shdr;
1025da0436e9SJames Smart 	uint32_t word0;
1026da0436e9SJames Smart 	struct sgl_page_pairs sgl_pg_pairs;
1027da0436e9SJames Smart };
1028da0436e9SJames Smart 
1029da0436e9SJames Smart struct lpfc_mbx_sge {
1030da0436e9SJames Smart 	uint32_t pa_lo;
1031da0436e9SJames Smart 	uint32_t pa_hi;
1032da0436e9SJames Smart 	uint32_t length;
1033da0436e9SJames Smart };
1034da0436e9SJames Smart 
1035da0436e9SJames Smart struct lpfc_mbx_nembed_cmd {
1036da0436e9SJames Smart 	struct lpfc_sli4_cfg_mhdr cfg_mhdr;
1037da0436e9SJames Smart #define LPFC_SLI4_MBX_SGE_MAX_PAGES	19
1038da0436e9SJames Smart 	struct lpfc_mbx_sge sge[LPFC_SLI4_MBX_SGE_MAX_PAGES];
1039da0436e9SJames Smart };
1040da0436e9SJames Smart 
1041da0436e9SJames Smart struct lpfc_mbx_nembed_sge_virt {
1042da0436e9SJames Smart 	void *addr[LPFC_SLI4_MBX_SGE_MAX_PAGES];
1043da0436e9SJames Smart };
1044da0436e9SJames Smart 
1045da0436e9SJames Smart struct lpfc_mbx_eq_create {
1046da0436e9SJames Smart 	struct mbox_header header;
1047da0436e9SJames Smart 	union {
1048da0436e9SJames Smart 		struct {
1049da0436e9SJames Smart 			uint32_t word0;
1050da0436e9SJames Smart #define lpfc_mbx_eq_create_num_pages_SHIFT	0
1051da0436e9SJames Smart #define lpfc_mbx_eq_create_num_pages_MASK	0x0000FFFF
1052da0436e9SJames Smart #define lpfc_mbx_eq_create_num_pages_WORD	word0
1053da0436e9SJames Smart 			struct eq_context context;
1054da0436e9SJames Smart 			struct dma_address page[LPFC_MAX_EQ_PAGE];
1055da0436e9SJames Smart 		} request;
1056da0436e9SJames Smart 		struct {
1057da0436e9SJames Smart 			uint32_t word0;
1058da0436e9SJames Smart #define lpfc_mbx_eq_create_q_id_SHIFT	0
1059da0436e9SJames Smart #define lpfc_mbx_eq_create_q_id_MASK	0x0000FFFF
1060da0436e9SJames Smart #define lpfc_mbx_eq_create_q_id_WORD	word0
1061da0436e9SJames Smart 		} response;
1062da0436e9SJames Smart 	} u;
1063da0436e9SJames Smart };
1064da0436e9SJames Smart 
1065173edbb2SJames Smart struct lpfc_mbx_modify_eq_delay {
1066173edbb2SJames Smart 	struct mbox_header header;
1067173edbb2SJames Smart 	union {
1068173edbb2SJames Smart 		struct {
1069173edbb2SJames Smart 			uint32_t num_eq;
1070173edbb2SJames Smart 			struct eq_delay_info eq[LPFC_MAX_EQ_DELAY];
1071173edbb2SJames Smart 		} request;
1072173edbb2SJames Smart 		struct {
1073173edbb2SJames Smart 			uint32_t word0;
1074173edbb2SJames Smart 		} response;
1075173edbb2SJames Smart 	} u;
1076173edbb2SJames Smart };
1077173edbb2SJames Smart 
1078da0436e9SJames Smart struct lpfc_mbx_eq_destroy {
1079da0436e9SJames Smart 	struct mbox_header header;
1080da0436e9SJames Smart 	union {
1081da0436e9SJames Smart 		struct {
1082da0436e9SJames Smart 			uint32_t word0;
1083da0436e9SJames Smart #define lpfc_mbx_eq_destroy_q_id_SHIFT	0
1084da0436e9SJames Smart #define lpfc_mbx_eq_destroy_q_id_MASK	0x0000FFFF
1085da0436e9SJames Smart #define lpfc_mbx_eq_destroy_q_id_WORD	word0
1086da0436e9SJames Smart 		} request;
1087da0436e9SJames Smart 		struct {
1088da0436e9SJames Smart 			uint32_t word0;
1089da0436e9SJames Smart 		} response;
1090da0436e9SJames Smart 	} u;
1091da0436e9SJames Smart };
1092da0436e9SJames Smart 
1093da0436e9SJames Smart struct lpfc_mbx_nop {
1094da0436e9SJames Smart 	struct mbox_header header;
1095da0436e9SJames Smart 	uint32_t context[2];
1096da0436e9SJames Smart };
1097da0436e9SJames Smart 
1098da0436e9SJames Smart struct cq_context {
1099da0436e9SJames Smart 	uint32_t word0;
1100da0436e9SJames Smart #define lpfc_cq_context_event_SHIFT	31
1101da0436e9SJames Smart #define lpfc_cq_context_event_MASK	0x00000001
1102da0436e9SJames Smart #define lpfc_cq_context_event_WORD	word0
1103da0436e9SJames Smart #define lpfc_cq_context_valid_SHIFT	29
1104da0436e9SJames Smart #define lpfc_cq_context_valid_MASK	0x00000001
1105da0436e9SJames Smart #define lpfc_cq_context_valid_WORD	word0
1106da0436e9SJames Smart #define lpfc_cq_context_count_SHIFT	27
1107da0436e9SJames Smart #define lpfc_cq_context_count_MASK	0x00000003
1108da0436e9SJames Smart #define lpfc_cq_context_count_WORD	word0
1109da0436e9SJames Smart #define LPFC_CQ_CNT_256		0x0
1110da0436e9SJames Smart #define LPFC_CQ_CNT_512		0x1
1111da0436e9SJames Smart #define LPFC_CQ_CNT_1024	0x2
1112da0436e9SJames Smart 	uint32_t word1;
11135a6f133eSJames Smart #define lpfc_cq_eq_id_SHIFT		22	/* Version 0 Only */
1114da0436e9SJames Smart #define lpfc_cq_eq_id_MASK		0x000000FF
1115da0436e9SJames Smart #define lpfc_cq_eq_id_WORD		word1
11165a6f133eSJames Smart #define lpfc_cq_eq_id_2_SHIFT		0 	/* Version 2 Only */
11175a6f133eSJames Smart #define lpfc_cq_eq_id_2_MASK		0x0000FFFF
11185a6f133eSJames Smart #define lpfc_cq_eq_id_2_WORD		word1
1119da0436e9SJames Smart 	uint32_t reserved0;
1120da0436e9SJames Smart 	uint32_t reserved1;
1121da0436e9SJames Smart };
1122da0436e9SJames Smart 
1123da0436e9SJames Smart struct lpfc_mbx_cq_create {
1124da0436e9SJames Smart 	struct mbox_header header;
1125da0436e9SJames Smart 	union {
1126da0436e9SJames Smart 		struct {
1127da0436e9SJames Smart 			uint32_t word0;
11285a6f133eSJames Smart #define lpfc_mbx_cq_create_page_size_SHIFT	16	/* Version 2 Only */
11295a6f133eSJames Smart #define lpfc_mbx_cq_create_page_size_MASK	0x000000FF
11305a6f133eSJames Smart #define lpfc_mbx_cq_create_page_size_WORD	word0
1131da0436e9SJames Smart #define lpfc_mbx_cq_create_num_pages_SHIFT	0
1132da0436e9SJames Smart #define lpfc_mbx_cq_create_num_pages_MASK	0x0000FFFF
1133da0436e9SJames Smart #define lpfc_mbx_cq_create_num_pages_WORD	word0
1134da0436e9SJames Smart 			struct cq_context context;
1135da0436e9SJames Smart 			struct dma_address page[LPFC_MAX_CQ_PAGE];
1136da0436e9SJames Smart 		} request;
1137da0436e9SJames Smart 		struct {
1138da0436e9SJames Smart 			uint32_t word0;
1139da0436e9SJames Smart #define lpfc_mbx_cq_create_q_id_SHIFT	0
1140da0436e9SJames Smart #define lpfc_mbx_cq_create_q_id_MASK	0x0000FFFF
1141da0436e9SJames Smart #define lpfc_mbx_cq_create_q_id_WORD	word0
1142da0436e9SJames Smart 		} response;
1143da0436e9SJames Smart 	} u;
1144da0436e9SJames Smart };
1145da0436e9SJames Smart 
1146da0436e9SJames Smart struct lpfc_mbx_cq_destroy {
1147da0436e9SJames Smart 	struct mbox_header header;
1148da0436e9SJames Smart 	union {
1149da0436e9SJames Smart 		struct {
1150da0436e9SJames Smart 			uint32_t word0;
1151da0436e9SJames Smart #define lpfc_mbx_cq_destroy_q_id_SHIFT	0
1152da0436e9SJames Smart #define lpfc_mbx_cq_destroy_q_id_MASK	0x0000FFFF
1153da0436e9SJames Smart #define lpfc_mbx_cq_destroy_q_id_WORD	word0
1154da0436e9SJames Smart 		} request;
1155da0436e9SJames Smart 		struct {
1156da0436e9SJames Smart 			uint32_t word0;
1157da0436e9SJames Smart 		} response;
1158da0436e9SJames Smart 	} u;
1159da0436e9SJames Smart };
1160da0436e9SJames Smart 
1161da0436e9SJames Smart struct wq_context {
1162da0436e9SJames Smart 	uint32_t reserved0;
1163da0436e9SJames Smart 	uint32_t reserved1;
1164da0436e9SJames Smart 	uint32_t reserved2;
1165da0436e9SJames Smart 	uint32_t reserved3;
1166da0436e9SJames Smart };
1167da0436e9SJames Smart 
1168da0436e9SJames Smart struct lpfc_mbx_wq_create {
1169da0436e9SJames Smart 	struct mbox_header header;
1170da0436e9SJames Smart 	union {
11715a6f133eSJames Smart 		struct {	/* Version 0 Request */
1172da0436e9SJames Smart 			uint32_t word0;
1173da0436e9SJames Smart #define lpfc_mbx_wq_create_num_pages_SHIFT	0
1174962bc51bSJames Smart #define lpfc_mbx_wq_create_num_pages_MASK	0x000000FF
1175da0436e9SJames Smart #define lpfc_mbx_wq_create_num_pages_WORD	word0
1176962bc51bSJames Smart #define lpfc_mbx_wq_create_dua_SHIFT		8
1177962bc51bSJames Smart #define lpfc_mbx_wq_create_dua_MASK		0x00000001
1178962bc51bSJames Smart #define lpfc_mbx_wq_create_dua_WORD		word0
1179da0436e9SJames Smart #define lpfc_mbx_wq_create_cq_id_SHIFT		16
1180da0436e9SJames Smart #define lpfc_mbx_wq_create_cq_id_MASK		0x0000FFFF
1181da0436e9SJames Smart #define lpfc_mbx_wq_create_cq_id_WORD		word0
1182962bc51bSJames Smart 			struct dma_address page[LPFC_MAX_WQ_PAGE_V0];
1183962bc51bSJames Smart 			uint32_t word9;
1184962bc51bSJames Smart #define lpfc_mbx_wq_create_bua_SHIFT		0
1185962bc51bSJames Smart #define lpfc_mbx_wq_create_bua_MASK		0x00000001
1186962bc51bSJames Smart #define lpfc_mbx_wq_create_bua_WORD		word9
1187962bc51bSJames Smart #define lpfc_mbx_wq_create_ulp_num_SHIFT	8
1188962bc51bSJames Smart #define lpfc_mbx_wq_create_ulp_num_MASK		0x000000FF
1189962bc51bSJames Smart #define lpfc_mbx_wq_create_ulp_num_WORD		word9
1190da0436e9SJames Smart 		} request;
11915a6f133eSJames Smart 		struct {	/* Version 1 Request */
11925a6f133eSJames Smart 			uint32_t word0;	/* Word 0 is the same as in v0 */
11935a6f133eSJames Smart 			uint32_t word1;
11945a6f133eSJames Smart #define lpfc_mbx_wq_create_page_size_SHIFT	0
11955a6f133eSJames Smart #define lpfc_mbx_wq_create_page_size_MASK	0x000000FF
11965a6f133eSJames Smart #define lpfc_mbx_wq_create_page_size_WORD	word1
11978ea73db4SJames Smart #define LPFC_WQ_PAGE_SIZE_4096	0x1
11985a6f133eSJames Smart #define lpfc_mbx_wq_create_wqe_size_SHIFT	8
11995a6f133eSJames Smart #define lpfc_mbx_wq_create_wqe_size_MASK	0x0000000F
12005a6f133eSJames Smart #define lpfc_mbx_wq_create_wqe_size_WORD	word1
12015a6f133eSJames Smart #define LPFC_WQ_WQE_SIZE_64	0x5
12025a6f133eSJames Smart #define LPFC_WQ_WQE_SIZE_128	0x6
12035a6f133eSJames Smart #define lpfc_mbx_wq_create_wqe_count_SHIFT	16
12045a6f133eSJames Smart #define lpfc_mbx_wq_create_wqe_count_MASK	0x0000FFFF
12055a6f133eSJames Smart #define lpfc_mbx_wq_create_wqe_count_WORD	word1
12065a6f133eSJames Smart 			uint32_t word2;
12075a6f133eSJames Smart 			struct dma_address page[LPFC_MAX_WQ_PAGE-1];
12085a6f133eSJames Smart 		} request_1;
1209da0436e9SJames Smart 		struct {
1210da0436e9SJames Smart 			uint32_t word0;
1211da0436e9SJames Smart #define lpfc_mbx_wq_create_q_id_SHIFT	0
1212da0436e9SJames Smart #define lpfc_mbx_wq_create_q_id_MASK	0x0000FFFF
1213da0436e9SJames Smart #define lpfc_mbx_wq_create_q_id_WORD	word0
1214962bc51bSJames Smart 			uint32_t doorbell_offset;
1215962bc51bSJames Smart 			uint32_t word2;
1216962bc51bSJames Smart #define lpfc_mbx_wq_create_bar_set_SHIFT	0
1217962bc51bSJames Smart #define lpfc_mbx_wq_create_bar_set_MASK		0x0000FFFF
1218962bc51bSJames Smart #define lpfc_mbx_wq_create_bar_set_WORD		word2
1219962bc51bSJames Smart #define WQ_PCI_BAR_0_AND_1	0x00
1220962bc51bSJames Smart #define WQ_PCI_BAR_2_AND_3	0x01
1221962bc51bSJames Smart #define WQ_PCI_BAR_4_AND_5	0x02
1222962bc51bSJames Smart #define lpfc_mbx_wq_create_db_format_SHIFT	16
1223962bc51bSJames Smart #define lpfc_mbx_wq_create_db_format_MASK	0x0000FFFF
1224962bc51bSJames Smart #define lpfc_mbx_wq_create_db_format_WORD	word2
1225da0436e9SJames Smart 		} response;
1226da0436e9SJames Smart 	} u;
1227da0436e9SJames Smart };
1228da0436e9SJames Smart 
1229da0436e9SJames Smart struct lpfc_mbx_wq_destroy {
1230da0436e9SJames Smart 	struct mbox_header header;
1231da0436e9SJames Smart 	union {
1232da0436e9SJames Smart 		struct {
1233da0436e9SJames Smart 			uint32_t word0;
1234da0436e9SJames Smart #define lpfc_mbx_wq_destroy_q_id_SHIFT	0
1235da0436e9SJames Smart #define lpfc_mbx_wq_destroy_q_id_MASK	0x0000FFFF
1236da0436e9SJames Smart #define lpfc_mbx_wq_destroy_q_id_WORD	word0
1237da0436e9SJames Smart 		} request;
1238da0436e9SJames Smart 		struct {
1239da0436e9SJames Smart 			uint32_t word0;
1240da0436e9SJames Smart 		} response;
1241da0436e9SJames Smart 	} u;
1242da0436e9SJames Smart };
1243da0436e9SJames Smart 
1244da0436e9SJames Smart #define LPFC_HDR_BUF_SIZE 128
1245eeead811SJames Smart #define LPFC_DATA_BUF_SIZE 2048
1246da0436e9SJames Smart struct rq_context {
1247da0436e9SJames Smart 	uint32_t word0;
12485a6f133eSJames Smart #define lpfc_rq_context_rqe_count_SHIFT	16	/* Version 0 Only */
12495a6f133eSJames Smart #define lpfc_rq_context_rqe_count_MASK	0x0000000F
12505a6f133eSJames Smart #define lpfc_rq_context_rqe_count_WORD	word0
1251da0436e9SJames Smart #define LPFC_RQ_RING_SIZE_512		9	/* 512 entries */
1252da0436e9SJames Smart #define LPFC_RQ_RING_SIZE_1024		10	/* 1024 entries */
1253da0436e9SJames Smart #define LPFC_RQ_RING_SIZE_2048		11	/* 2048 entries */
1254da0436e9SJames Smart #define LPFC_RQ_RING_SIZE_4096		12	/* 4096 entries */
12555a6f133eSJames Smart #define lpfc_rq_context_rqe_count_1_SHIFT	16	/* Version 1 Only */
12565a6f133eSJames Smart #define lpfc_rq_context_rqe_count_1_MASK	0x0000FFFF
12575a6f133eSJames Smart #define lpfc_rq_context_rqe_count_1_WORD	word0
12585a6f133eSJames Smart #define lpfc_rq_context_rqe_size_SHIFT	8		/* Version 1 Only */
12595a6f133eSJames Smart #define lpfc_rq_context_rqe_size_MASK	0x0000000F
12605a6f133eSJames Smart #define lpfc_rq_context_rqe_size_WORD	word0
1261c31098ceSJames Smart #define LPFC_RQE_SIZE_8		2
1262c31098ceSJames Smart #define LPFC_RQE_SIZE_16	3
1263c31098ceSJames Smart #define LPFC_RQE_SIZE_32	4
1264c31098ceSJames Smart #define LPFC_RQE_SIZE_64	5
1265c31098ceSJames Smart #define LPFC_RQE_SIZE_128	6
12665a6f133eSJames Smart #define lpfc_rq_context_page_size_SHIFT	0		/* Version 1 Only */
12675a6f133eSJames Smart #define lpfc_rq_context_page_size_MASK	0x000000FF
12685a6f133eSJames Smart #define lpfc_rq_context_page_size_WORD	word0
12698ea73db4SJames Smart #define	LPFC_RQ_PAGE_SIZE_4096	0x1
1270da0436e9SJames Smart 	uint32_t reserved1;
1271da0436e9SJames Smart 	uint32_t word2;
1272da0436e9SJames Smart #define lpfc_rq_context_cq_id_SHIFT	16
1273da0436e9SJames Smart #define lpfc_rq_context_cq_id_MASK	0x000003FF
1274da0436e9SJames Smart #define lpfc_rq_context_cq_id_WORD	word2
1275da0436e9SJames Smart #define lpfc_rq_context_buf_size_SHIFT	0
1276da0436e9SJames Smart #define lpfc_rq_context_buf_size_MASK	0x0000FFFF
1277da0436e9SJames Smart #define lpfc_rq_context_buf_size_WORD	word2
12785a6f133eSJames Smart 	uint32_t buffer_size;				/* Version 1 Only */
1279da0436e9SJames Smart };
1280da0436e9SJames Smart 
1281da0436e9SJames Smart struct lpfc_mbx_rq_create {
1282da0436e9SJames Smart 	struct mbox_header header;
1283da0436e9SJames Smart 	union {
1284da0436e9SJames Smart 		struct {
1285da0436e9SJames Smart 			uint32_t word0;
1286da0436e9SJames Smart #define lpfc_mbx_rq_create_num_pages_SHIFT	0
1287da0436e9SJames Smart #define lpfc_mbx_rq_create_num_pages_MASK	0x0000FFFF
1288da0436e9SJames Smart #define lpfc_mbx_rq_create_num_pages_WORD	word0
1289962bc51bSJames Smart #define lpfc_mbx_rq_create_dua_SHIFT		16
1290962bc51bSJames Smart #define lpfc_mbx_rq_create_dua_MASK		0x00000001
1291962bc51bSJames Smart #define lpfc_mbx_rq_create_dua_WORD		word0
1292962bc51bSJames Smart #define lpfc_mbx_rq_create_bqu_SHIFT		17
1293962bc51bSJames Smart #define lpfc_mbx_rq_create_bqu_MASK		0x00000001
1294962bc51bSJames Smart #define lpfc_mbx_rq_create_bqu_WORD		word0
1295962bc51bSJames Smart #define lpfc_mbx_rq_create_ulp_num_SHIFT	24
1296962bc51bSJames Smart #define lpfc_mbx_rq_create_ulp_num_MASK		0x000000FF
1297962bc51bSJames Smart #define lpfc_mbx_rq_create_ulp_num_WORD		word0
1298da0436e9SJames Smart 			struct rq_context context;
1299da0436e9SJames Smart 			struct dma_address page[LPFC_MAX_WQ_PAGE];
1300da0436e9SJames Smart 		} request;
1301da0436e9SJames Smart 		struct {
1302da0436e9SJames Smart 			uint32_t word0;
1303da0436e9SJames Smart #define lpfc_mbx_rq_create_q_id_SHIFT		0
1304da0436e9SJames Smart #define lpfc_mbx_rq_create_q_id_MASK		0x0000FFFF
1305da0436e9SJames Smart #define lpfc_mbx_rq_create_q_id_WORD		word0
1306962bc51bSJames Smart 			uint32_t doorbell_offset;
1307962bc51bSJames Smart 			uint32_t word2;
1308962bc51bSJames Smart #define lpfc_mbx_rq_create_bar_set_SHIFT	0
1309962bc51bSJames Smart #define lpfc_mbx_rq_create_bar_set_MASK		0x0000FFFF
1310962bc51bSJames Smart #define lpfc_mbx_rq_create_bar_set_WORD		word2
1311962bc51bSJames Smart #define lpfc_mbx_rq_create_db_format_SHIFT	16
1312962bc51bSJames Smart #define lpfc_mbx_rq_create_db_format_MASK	0x0000FFFF
1313962bc51bSJames Smart #define lpfc_mbx_rq_create_db_format_WORD	word2
1314da0436e9SJames Smart 		} response;
1315da0436e9SJames Smart 	} u;
1316da0436e9SJames Smart };
1317da0436e9SJames Smart 
1318da0436e9SJames Smart struct lpfc_mbx_rq_destroy {
1319da0436e9SJames Smart 	struct mbox_header header;
1320da0436e9SJames Smart 	union {
1321da0436e9SJames Smart 		struct {
1322da0436e9SJames Smart 			uint32_t word0;
1323da0436e9SJames Smart #define lpfc_mbx_rq_destroy_q_id_SHIFT	0
1324da0436e9SJames Smart #define lpfc_mbx_rq_destroy_q_id_MASK	0x0000FFFF
1325da0436e9SJames Smart #define lpfc_mbx_rq_destroy_q_id_WORD	word0
1326da0436e9SJames Smart 		} request;
1327da0436e9SJames Smart 		struct {
1328da0436e9SJames Smart 			uint32_t word0;
1329da0436e9SJames Smart 		} response;
1330da0436e9SJames Smart 	} u;
1331da0436e9SJames Smart };
1332da0436e9SJames Smart 
1333da0436e9SJames Smart struct mq_context {
1334da0436e9SJames Smart 	uint32_t word0;
13355a6f133eSJames Smart #define lpfc_mq_context_cq_id_SHIFT	22 	/* Version 0 Only */
1336da0436e9SJames Smart #define lpfc_mq_context_cq_id_MASK	0x000003FF
1337da0436e9SJames Smart #define lpfc_mq_context_cq_id_WORD	word0
13385a6f133eSJames Smart #define lpfc_mq_context_ring_size_SHIFT	16
13395a6f133eSJames Smart #define lpfc_mq_context_ring_size_MASK	0x0000000F
13405a6f133eSJames Smart #define lpfc_mq_context_ring_size_WORD	word0
13415a6f133eSJames Smart #define LPFC_MQ_RING_SIZE_16		0x5
13425a6f133eSJames Smart #define LPFC_MQ_RING_SIZE_32		0x6
13435a6f133eSJames Smart #define LPFC_MQ_RING_SIZE_64		0x7
13445a6f133eSJames Smart #define LPFC_MQ_RING_SIZE_128		0x8
1345da0436e9SJames Smart 	uint32_t word1;
1346da0436e9SJames Smart #define lpfc_mq_context_valid_SHIFT	31
1347da0436e9SJames Smart #define lpfc_mq_context_valid_MASK	0x00000001
1348da0436e9SJames Smart #define lpfc_mq_context_valid_WORD	word1
1349da0436e9SJames Smart 	uint32_t reserved2;
1350da0436e9SJames Smart 	uint32_t reserved3;
1351da0436e9SJames Smart };
1352da0436e9SJames Smart 
1353da0436e9SJames Smart struct lpfc_mbx_mq_create {
1354da0436e9SJames Smart 	struct mbox_header header;
1355da0436e9SJames Smart 	union {
1356da0436e9SJames Smart 		struct {
1357da0436e9SJames Smart 			uint32_t word0;
1358da0436e9SJames Smart #define lpfc_mbx_mq_create_num_pages_SHIFT	0
1359da0436e9SJames Smart #define lpfc_mbx_mq_create_num_pages_MASK	0x0000FFFF
1360da0436e9SJames Smart #define lpfc_mbx_mq_create_num_pages_WORD	word0
1361da0436e9SJames Smart 			struct mq_context context;
1362da0436e9SJames Smart 			struct dma_address page[LPFC_MAX_MQ_PAGE];
1363da0436e9SJames Smart 		} request;
1364da0436e9SJames Smart 		struct {
1365da0436e9SJames Smart 			uint32_t word0;
1366da0436e9SJames Smart #define lpfc_mbx_mq_create_q_id_SHIFT	0
1367da0436e9SJames Smart #define lpfc_mbx_mq_create_q_id_MASK	0x0000FFFF
1368da0436e9SJames Smart #define lpfc_mbx_mq_create_q_id_WORD	word0
1369da0436e9SJames Smart 		} response;
1370da0436e9SJames Smart 	} u;
1371da0436e9SJames Smart };
1372da0436e9SJames Smart 
1373b19a061aSJames Smart struct lpfc_mbx_mq_create_ext {
1374b19a061aSJames Smart 	struct mbox_header header;
1375b19a061aSJames Smart 	union {
1376b19a061aSJames Smart 		struct {
1377b19a061aSJames Smart 			uint32_t word0;
1378b19a061aSJames Smart #define lpfc_mbx_mq_create_ext_num_pages_SHIFT	0
1379b19a061aSJames Smart #define lpfc_mbx_mq_create_ext_num_pages_MASK	0x0000FFFF
1380b19a061aSJames Smart #define lpfc_mbx_mq_create_ext_num_pages_WORD	word0
13815a6f133eSJames Smart #define lpfc_mbx_mq_create_ext_cq_id_SHIFT	16	/* Version 1 Only */
13825a6f133eSJames Smart #define lpfc_mbx_mq_create_ext_cq_id_MASK	0x0000FFFF
13835a6f133eSJames Smart #define lpfc_mbx_mq_create_ext_cq_id_WORD	word0
1384b19a061aSJames Smart 			uint32_t async_evt_bmap;
1385b19a061aSJames Smart #define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT	LPFC_TRAILER_CODE_LINK
1386b19a061aSJames Smart #define lpfc_mbx_mq_create_ext_async_evt_link_MASK	0x00000001
1387b19a061aSJames Smart #define lpfc_mbx_mq_create_ext_async_evt_link_WORD	async_evt_bmap
13888b68cd52SJames Smart #define LPFC_EVT_CODE_LINK_NO_LINK	0x0
13898b68cd52SJames Smart #define LPFC_EVT_CODE_LINK_10_MBIT	0x1
13908b68cd52SJames Smart #define LPFC_EVT_CODE_LINK_100_MBIT	0x2
13918b68cd52SJames Smart #define LPFC_EVT_CODE_LINK_1_GBIT	0x3
13928b68cd52SJames Smart #define LPFC_EVT_CODE_LINK_10_GBIT	0x4
139370f3c073SJames Smart #define lpfc_mbx_mq_create_ext_async_evt_fip_SHIFT	LPFC_TRAILER_CODE_FCOE
139470f3c073SJames Smart #define lpfc_mbx_mq_create_ext_async_evt_fip_MASK	0x00000001
139570f3c073SJames Smart #define lpfc_mbx_mq_create_ext_async_evt_fip_WORD	async_evt_bmap
1396b19a061aSJames Smart #define lpfc_mbx_mq_create_ext_async_evt_group5_SHIFT	LPFC_TRAILER_CODE_GRP5
1397b19a061aSJames Smart #define lpfc_mbx_mq_create_ext_async_evt_group5_MASK	0x00000001
1398b19a061aSJames Smart #define lpfc_mbx_mq_create_ext_async_evt_group5_WORD	async_evt_bmap
139970f3c073SJames Smart #define lpfc_mbx_mq_create_ext_async_evt_fc_SHIFT	LPFC_TRAILER_CODE_FC
140070f3c073SJames Smart #define lpfc_mbx_mq_create_ext_async_evt_fc_MASK	0x00000001
140170f3c073SJames Smart #define lpfc_mbx_mq_create_ext_async_evt_fc_WORD	async_evt_bmap
14028b68cd52SJames Smart #define LPFC_EVT_CODE_FC_NO_LINK	0x0
14038b68cd52SJames Smart #define LPFC_EVT_CODE_FC_1_GBAUD	0x1
14048b68cd52SJames Smart #define LPFC_EVT_CODE_FC_2_GBAUD	0x2
14058b68cd52SJames Smart #define LPFC_EVT_CODE_FC_4_GBAUD	0x4
14068b68cd52SJames Smart #define LPFC_EVT_CODE_FC_8_GBAUD	0x8
14078b68cd52SJames Smart #define LPFC_EVT_CODE_FC_10_GBAUD	0xA
14088b68cd52SJames Smart #define LPFC_EVT_CODE_FC_16_GBAUD	0x10
140970f3c073SJames Smart #define lpfc_mbx_mq_create_ext_async_evt_sli_SHIFT	LPFC_TRAILER_CODE_SLI
141070f3c073SJames Smart #define lpfc_mbx_mq_create_ext_async_evt_sli_MASK	0x00000001
141170f3c073SJames Smart #define lpfc_mbx_mq_create_ext_async_evt_sli_WORD	async_evt_bmap
1412b19a061aSJames Smart 			struct mq_context context;
1413b19a061aSJames Smart 			struct dma_address page[LPFC_MAX_MQ_PAGE];
1414b19a061aSJames Smart 		} request;
1415b19a061aSJames Smart 		struct {
1416b19a061aSJames Smart 			uint32_t word0;
1417b19a061aSJames Smart #define lpfc_mbx_mq_create_q_id_SHIFT	0
1418b19a061aSJames Smart #define lpfc_mbx_mq_create_q_id_MASK	0x0000FFFF
1419b19a061aSJames Smart #define lpfc_mbx_mq_create_q_id_WORD	word0
1420b19a061aSJames Smart 		} response;
1421b19a061aSJames Smart 	} u;
1422b19a061aSJames Smart #define LPFC_ASYNC_EVENT_LINK_STATE	0x2
1423b19a061aSJames Smart #define LPFC_ASYNC_EVENT_FCF_STATE	0x4
1424b19a061aSJames Smart #define LPFC_ASYNC_EVENT_GROUP5		0x20
1425b19a061aSJames Smart };
1426b19a061aSJames Smart 
1427da0436e9SJames Smart struct lpfc_mbx_mq_destroy {
1428da0436e9SJames Smart 	struct mbox_header header;
1429da0436e9SJames Smart 	union {
1430da0436e9SJames Smart 		struct {
1431da0436e9SJames Smart 			uint32_t word0;
1432da0436e9SJames Smart #define lpfc_mbx_mq_destroy_q_id_SHIFT	0
1433da0436e9SJames Smart #define lpfc_mbx_mq_destroy_q_id_MASK	0x0000FFFF
1434da0436e9SJames Smart #define lpfc_mbx_mq_destroy_q_id_WORD	word0
1435da0436e9SJames Smart 		} request;
1436da0436e9SJames Smart 		struct {
1437da0436e9SJames Smart 			uint32_t word0;
1438da0436e9SJames Smart 		} response;
1439da0436e9SJames Smart 	} u;
1440da0436e9SJames Smart };
1441da0436e9SJames Smart 
14426d368e53SJames Smart /* Start Gen 2 SLI4 Mailbox definitions: */
14436d368e53SJames Smart 
14446d368e53SJames Smart /* Define allocate-ready Gen 2 SLI4 FCoE Resource Extent Types. */
14456d368e53SJames Smart #define LPFC_RSC_TYPE_FCOE_VFI	0x20
14466d368e53SJames Smart #define LPFC_RSC_TYPE_FCOE_VPI	0x21
14476d368e53SJames Smart #define LPFC_RSC_TYPE_FCOE_RPI	0x22
14486d368e53SJames Smart #define LPFC_RSC_TYPE_FCOE_XRI	0x23
14496d368e53SJames Smart 
14506d368e53SJames Smart struct lpfc_mbx_get_rsrc_extent_info {
14516d368e53SJames Smart 	struct mbox_header header;
14526d368e53SJames Smart 	union {
14536d368e53SJames Smart 		struct {
14546d368e53SJames Smart 			uint32_t word4;
14556d368e53SJames Smart #define lpfc_mbx_get_rsrc_extent_info_type_SHIFT	0
14566d368e53SJames Smart #define lpfc_mbx_get_rsrc_extent_info_type_MASK		0x0000FFFF
14576d368e53SJames Smart #define lpfc_mbx_get_rsrc_extent_info_type_WORD		word4
14586d368e53SJames Smart 		} req;
14596d368e53SJames Smart 		struct {
14606d368e53SJames Smart 			uint32_t word4;
14616d368e53SJames Smart #define lpfc_mbx_get_rsrc_extent_info_cnt_SHIFT		0
14626d368e53SJames Smart #define lpfc_mbx_get_rsrc_extent_info_cnt_MASK		0x0000FFFF
14636d368e53SJames Smart #define lpfc_mbx_get_rsrc_extent_info_cnt_WORD		word4
14646d368e53SJames Smart #define lpfc_mbx_get_rsrc_extent_info_size_SHIFT	16
14656d368e53SJames Smart #define lpfc_mbx_get_rsrc_extent_info_size_MASK		0x0000FFFF
14666d368e53SJames Smart #define lpfc_mbx_get_rsrc_extent_info_size_WORD		word4
14676d368e53SJames Smart 		} rsp;
14686d368e53SJames Smart 	} u;
14696d368e53SJames Smart };
14706d368e53SJames Smart 
1471962bc51bSJames Smart struct lpfc_mbx_query_fw_config {
1472962bc51bSJames Smart 	struct mbox_header header;
1473962bc51bSJames Smart 	struct {
1474962bc51bSJames Smart 		uint32_t config_number;
1475962bc51bSJames Smart #define	LPFC_FC_FCOE		0x00000007
1476962bc51bSJames Smart 		uint32_t asic_revision;
1477962bc51bSJames Smart 		uint32_t physical_port;
1478962bc51bSJames Smart 		uint32_t function_mode;
1479962bc51bSJames Smart #define LPFC_FCOE_INI_MODE	0x00000040
1480962bc51bSJames Smart #define LPFC_FCOE_TGT_MODE	0x00000080
1481962bc51bSJames Smart #define LPFC_DUA_MODE		0x00000800
1482962bc51bSJames Smart 		uint32_t ulp0_mode;
1483962bc51bSJames Smart #define LPFC_ULP_FCOE_INIT_MODE	0x00000040
1484962bc51bSJames Smart #define LPFC_ULP_FCOE_TGT_MODE	0x00000080
1485962bc51bSJames Smart 		uint32_t ulp0_nap_words[12];
1486962bc51bSJames Smart 		uint32_t ulp1_mode;
1487962bc51bSJames Smart 		uint32_t ulp1_nap_words[12];
1488962bc51bSJames Smart 		uint32_t function_capabilities;
1489962bc51bSJames Smart 		uint32_t cqid_base;
1490962bc51bSJames Smart 		uint32_t cqid_tot;
1491962bc51bSJames Smart 		uint32_t eqid_base;
1492962bc51bSJames Smart 		uint32_t eqid_tot;
1493962bc51bSJames Smart 		uint32_t ulp0_nap2_words[2];
1494962bc51bSJames Smart 		uint32_t ulp1_nap2_words[2];
1495962bc51bSJames Smart 	} rsp;
1496962bc51bSJames Smart };
1497962bc51bSJames Smart 
14988b017a30SJames Smart struct lpfc_mbx_set_beacon_config {
14998b017a30SJames Smart 	struct mbox_header header;
15008b017a30SJames Smart 	uint32_t word4;
15018b017a30SJames Smart #define lpfc_mbx_set_beacon_port_num_SHIFT		0
15028b017a30SJames Smart #define lpfc_mbx_set_beacon_port_num_MASK		0x0000003F
15038b017a30SJames Smart #define lpfc_mbx_set_beacon_port_num_WORD		word4
15048b017a30SJames Smart #define lpfc_mbx_set_beacon_port_type_SHIFT		6
15058b017a30SJames Smart #define lpfc_mbx_set_beacon_port_type_MASK		0x00000003
15068b017a30SJames Smart #define lpfc_mbx_set_beacon_port_type_WORD		word4
15078b017a30SJames Smart #define lpfc_mbx_set_beacon_state_SHIFT			8
15088b017a30SJames Smart #define lpfc_mbx_set_beacon_state_MASK			0x000000FF
15098b017a30SJames Smart #define lpfc_mbx_set_beacon_state_WORD			word4
15108b017a30SJames Smart #define lpfc_mbx_set_beacon_duration_SHIFT		16
15118b017a30SJames Smart #define lpfc_mbx_set_beacon_duration_MASK		0x000000FF
15128b017a30SJames Smart #define lpfc_mbx_set_beacon_duration_WORD		word4
15138b017a30SJames Smart #define lpfc_mbx_set_beacon_status_duration_SHIFT	24
15148b017a30SJames Smart #define lpfc_mbx_set_beacon_status_duration_MASK	0x000000FF
15158b017a30SJames Smart #define lpfc_mbx_set_beacon_status_duration_WORD	word4
15168b017a30SJames Smart };
15178b017a30SJames Smart 
15186d368e53SJames Smart struct lpfc_id_range {
15196d368e53SJames Smart 	uint32_t word5;
15206d368e53SJames Smart #define lpfc_mbx_rsrc_id_word4_0_SHIFT	0
15216d368e53SJames Smart #define lpfc_mbx_rsrc_id_word4_0_MASK	0x0000FFFF
15226d368e53SJames Smart #define lpfc_mbx_rsrc_id_word4_0_WORD	word5
15236d368e53SJames Smart #define lpfc_mbx_rsrc_id_word4_1_SHIFT	16
15246d368e53SJames Smart #define lpfc_mbx_rsrc_id_word4_1_MASK	0x0000FFFF
15256d368e53SJames Smart #define lpfc_mbx_rsrc_id_word4_1_WORD	word5
15266d368e53SJames Smart };
15276d368e53SJames Smart 
15287ad20aa9SJames Smart struct lpfc_mbx_set_link_diag_state {
15297ad20aa9SJames Smart 	struct mbox_header header;
15307ad20aa9SJames Smart 	union {
15317ad20aa9SJames Smart 		struct {
15327ad20aa9SJames Smart 			uint32_t word0;
15337ad20aa9SJames Smart #define lpfc_mbx_set_diag_state_diag_SHIFT	0
15347ad20aa9SJames Smart #define lpfc_mbx_set_diag_state_diag_MASK	0x00000001
15357ad20aa9SJames Smart #define lpfc_mbx_set_diag_state_diag_WORD	word0
15369731592bSJames Smart #define lpfc_mbx_set_diag_state_diag_bit_valid_SHIFT	2
15379731592bSJames Smart #define lpfc_mbx_set_diag_state_diag_bit_valid_MASK	0x00000001
15389731592bSJames Smart #define lpfc_mbx_set_diag_state_diag_bit_valid_WORD	word0
15399731592bSJames Smart #define LPFC_DIAG_STATE_DIAG_BIT_VALID_NO_CHANGE	0
15409731592bSJames Smart #define LPFC_DIAG_STATE_DIAG_BIT_VALID_CHANGE		1
15417ad20aa9SJames Smart #define lpfc_mbx_set_diag_state_link_num_SHIFT	16
15427ad20aa9SJames Smart #define lpfc_mbx_set_diag_state_link_num_MASK	0x0000003F
15437ad20aa9SJames Smart #define lpfc_mbx_set_diag_state_link_num_WORD	word0
15447ad20aa9SJames Smart #define lpfc_mbx_set_diag_state_link_type_SHIFT 22
15457ad20aa9SJames Smart #define lpfc_mbx_set_diag_state_link_type_MASK	0x00000003
15467ad20aa9SJames Smart #define lpfc_mbx_set_diag_state_link_type_WORD	word0
15477ad20aa9SJames Smart 		} req;
15487ad20aa9SJames Smart 		struct {
15497ad20aa9SJames Smart 			uint32_t word0;
15507ad20aa9SJames Smart 		} rsp;
15517ad20aa9SJames Smart 	} u;
15527ad20aa9SJames Smart };
15537ad20aa9SJames Smart 
15547ad20aa9SJames Smart struct lpfc_mbx_set_link_diag_loopback {
15557ad20aa9SJames Smart 	struct mbox_header header;
15567ad20aa9SJames Smart 	union {
15577ad20aa9SJames Smart 		struct {
15587ad20aa9SJames Smart 			uint32_t word0;
15597ad20aa9SJames Smart #define lpfc_mbx_set_diag_lpbk_type_SHIFT	0
15601b51197dSJames Smart #define lpfc_mbx_set_diag_lpbk_type_MASK	0x00000003
15617ad20aa9SJames Smart #define lpfc_mbx_set_diag_lpbk_type_WORD	word0
15627ad20aa9SJames Smart #define LPFC_DIAG_LOOPBACK_TYPE_DISABLE		0x0
15637ad20aa9SJames Smart #define LPFC_DIAG_LOOPBACK_TYPE_INTERNAL	0x1
15641b51197dSJames Smart #define LPFC_DIAG_LOOPBACK_TYPE_SERDES		0x2
15657ad20aa9SJames Smart #define lpfc_mbx_set_diag_lpbk_link_num_SHIFT	16
15667ad20aa9SJames Smart #define lpfc_mbx_set_diag_lpbk_link_num_MASK	0x0000003F
15677ad20aa9SJames Smart #define lpfc_mbx_set_diag_lpbk_link_num_WORD	word0
15687ad20aa9SJames Smart #define lpfc_mbx_set_diag_lpbk_link_type_SHIFT	22
15697ad20aa9SJames Smart #define lpfc_mbx_set_diag_lpbk_link_type_MASK	0x00000003
15707ad20aa9SJames Smart #define lpfc_mbx_set_diag_lpbk_link_type_WORD	word0
15717ad20aa9SJames Smart 		} req;
15727ad20aa9SJames Smart 		struct {
15737ad20aa9SJames Smart 			uint32_t word0;
15747ad20aa9SJames Smart 		} rsp;
15757ad20aa9SJames Smart 	} u;
15767ad20aa9SJames Smart };
15777ad20aa9SJames Smart 
15787ad20aa9SJames Smart struct lpfc_mbx_run_link_diag_test {
15797ad20aa9SJames Smart 	struct mbox_header header;
15807ad20aa9SJames Smart 	union {
15817ad20aa9SJames Smart 		struct {
15827ad20aa9SJames Smart 			uint32_t word0;
15837ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_link_num_SHIFT	16
15847ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_link_num_MASK	0x0000003F
15857ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_link_num_WORD	word0
15867ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_link_type_SHIFT	22
15877ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_link_type_MASK	0x00000003
15887ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_link_type_WORD	word0
15897ad20aa9SJames Smart 			uint32_t word1;
15907ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_test_id_SHIFT	0
15917ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_test_id_MASK	0x0000FFFF
15927ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_test_id_WORD	word1
15937ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_loops_SHIFT	16
15947ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_loops_MASK	0x0000FFFF
15957ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_loops_WORD	word1
15967ad20aa9SJames Smart 			uint32_t word2;
15977ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_test_ver_SHIFT	0
15987ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_test_ver_MASK	0x0000FFFF
15997ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_test_ver_WORD	word2
16007ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_err_act_SHIFT	16
16017ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_err_act_MASK	0x000000FF
16027ad20aa9SJames Smart #define lpfc_mbx_run_diag_test_err_act_WORD	word2
16037ad20aa9SJames Smart 		} req;
16047ad20aa9SJames Smart 		struct {
16057ad20aa9SJames Smart 			uint32_t word0;
16067ad20aa9SJames Smart 		} rsp;
16077ad20aa9SJames Smart 	} u;
16087ad20aa9SJames Smart };
16097ad20aa9SJames Smart 
16106d368e53SJames Smart /*
16116d368e53SJames Smart  * struct lpfc_mbx_alloc_rsrc_extents:
16126d368e53SJames Smart  * A mbox is generically 256 bytes long. An SLI4_CONFIG mailbox requires
16136d368e53SJames Smart  * 6 words of header + 4 words of shared subcommand header +
16146d368e53SJames Smart  * 1 words of Extent-Opcode-specific header = 11 words or 44 bytes total.
16156d368e53SJames Smart  *
16166d368e53SJames Smart  * An embedded version of SLI4_CONFIG therefore has 256 - 44 = 212 bytes
16176d368e53SJames Smart  * for extents payload.
16186d368e53SJames Smart  *
16196d368e53SJames Smart  * 212/2 (bytes per extent) = 106 extents.
16206d368e53SJames Smart  * 106/2 (extents per word) = 53 words.
16216d368e53SJames Smart  * lpfc_id_range id is statically size to 53.
16226d368e53SJames Smart  *
16236d368e53SJames Smart  * This mailbox definition is used for ALLOC or GET_ALLOCATED
16246d368e53SJames Smart  * extent ranges.  For ALLOC, the type and cnt are required.
16256d368e53SJames Smart  * For GET_ALLOCATED, only the type is required.
16266d368e53SJames Smart  */
16276d368e53SJames Smart struct lpfc_mbx_alloc_rsrc_extents {
16286d368e53SJames Smart 	struct mbox_header header;
16296d368e53SJames Smart 	union {
16306d368e53SJames Smart 		struct {
16316d368e53SJames Smart 			uint32_t word4;
16326d368e53SJames Smart #define lpfc_mbx_alloc_rsrc_extents_type_SHIFT	0
16336d368e53SJames Smart #define lpfc_mbx_alloc_rsrc_extents_type_MASK	0x0000FFFF
16346d368e53SJames Smart #define lpfc_mbx_alloc_rsrc_extents_type_WORD	word4
16356d368e53SJames Smart #define lpfc_mbx_alloc_rsrc_extents_cnt_SHIFT	16
16366d368e53SJames Smart #define lpfc_mbx_alloc_rsrc_extents_cnt_MASK	0x0000FFFF
16376d368e53SJames Smart #define lpfc_mbx_alloc_rsrc_extents_cnt_WORD	word4
16386d368e53SJames Smart 		} req;
16396d368e53SJames Smart 		struct {
16406d368e53SJames Smart 			uint32_t word4;
16416d368e53SJames Smart #define lpfc_mbx_rsrc_cnt_SHIFT	0
16426d368e53SJames Smart #define lpfc_mbx_rsrc_cnt_MASK	0x0000FFFF
16436d368e53SJames Smart #define lpfc_mbx_rsrc_cnt_WORD	word4
16446d368e53SJames Smart 			struct lpfc_id_range id[53];
16456d368e53SJames Smart 		} rsp;
16466d368e53SJames Smart 	} u;
16476d368e53SJames Smart };
16486d368e53SJames Smart 
16496d368e53SJames Smart /*
16506d368e53SJames Smart  * This is the non-embedded version of ALLOC or GET RSRC_EXTENTS. Word4 in this
16516d368e53SJames Smart  * structure shares the same SHIFT/MASK/WORD defines provided in the
16526d368e53SJames Smart  * mbx_alloc_rsrc_extents and mbx_get_alloc_rsrc_extents, word4, provided in
16536d368e53SJames Smart  * the structures defined above.  This non-embedded structure provides for the
16546d368e53SJames Smart  * maximum number of extents supported by the port.
16556d368e53SJames Smart  */
16566d368e53SJames Smart struct lpfc_mbx_nembed_rsrc_extent {
16576d368e53SJames Smart 	union  lpfc_sli4_cfg_shdr cfg_shdr;
16586d368e53SJames Smart 	uint32_t word4;
16596d368e53SJames Smart 	struct lpfc_id_range id;
16606d368e53SJames Smart };
16616d368e53SJames Smart 
16626d368e53SJames Smart struct lpfc_mbx_dealloc_rsrc_extents {
16636d368e53SJames Smart 	struct mbox_header header;
16646d368e53SJames Smart 	struct {
16656d368e53SJames Smart 		uint32_t word4;
16666d368e53SJames Smart #define lpfc_mbx_dealloc_rsrc_extents_type_SHIFT	0
16676d368e53SJames Smart #define lpfc_mbx_dealloc_rsrc_extents_type_MASK		0x0000FFFF
16686d368e53SJames Smart #define lpfc_mbx_dealloc_rsrc_extents_type_WORD		word4
16696d368e53SJames Smart 	} req;
16706d368e53SJames Smart 
16716d368e53SJames Smart };
16726d368e53SJames Smart 
16736d368e53SJames Smart /* Start SLI4 FCoE specific mbox structures. */
16746d368e53SJames Smart 
1675da0436e9SJames Smart struct lpfc_mbx_post_hdr_tmpl {
1676da0436e9SJames Smart 	struct mbox_header header;
1677da0436e9SJames Smart 	uint32_t word10;
1678da0436e9SJames Smart #define lpfc_mbx_post_hdr_tmpl_rpi_offset_SHIFT  0
1679da0436e9SJames Smart #define lpfc_mbx_post_hdr_tmpl_rpi_offset_MASK   0x0000FFFF
1680da0436e9SJames Smart #define lpfc_mbx_post_hdr_tmpl_rpi_offset_WORD   word10
1681da0436e9SJames Smart #define lpfc_mbx_post_hdr_tmpl_page_cnt_SHIFT   16
1682da0436e9SJames Smart #define lpfc_mbx_post_hdr_tmpl_page_cnt_MASK    0x0000FFFF
1683da0436e9SJames Smart #define lpfc_mbx_post_hdr_tmpl_page_cnt_WORD    word10
1684da0436e9SJames Smart 	uint32_t rpi_paddr_lo;
1685da0436e9SJames Smart 	uint32_t rpi_paddr_hi;
1686da0436e9SJames Smart };
1687da0436e9SJames Smart 
1688da0436e9SJames Smart struct sli4_sge {	/* SLI-4 */
1689da0436e9SJames Smart 	uint32_t addr_hi;
1690da0436e9SJames Smart 	uint32_t addr_lo;
1691da0436e9SJames Smart 
1692da0436e9SJames Smart 	uint32_t word2;
1693f9bb2da1SJames Smart #define lpfc_sli4_sge_offset_SHIFT	0
1694f9bb2da1SJames Smart #define lpfc_sli4_sge_offset_MASK	0x07FFFFFF
1695da0436e9SJames Smart #define lpfc_sli4_sge_offset_WORD	word2
1696f9bb2da1SJames Smart #define lpfc_sli4_sge_type_SHIFT	27
1697f9bb2da1SJames Smart #define lpfc_sli4_sge_type_MASK		0x0000000F
1698f9bb2da1SJames Smart #define lpfc_sli4_sge_type_WORD		word2
1699f9bb2da1SJames Smart #define LPFC_SGE_TYPE_DATA		0x0
1700f9bb2da1SJames Smart #define LPFC_SGE_TYPE_DIF		0x4
1701f9bb2da1SJames Smart #define LPFC_SGE_TYPE_LSP		0x5
1702f9bb2da1SJames Smart #define LPFC_SGE_TYPE_PEDIF		0x6
1703f9bb2da1SJames Smart #define LPFC_SGE_TYPE_PESEED		0x7
1704f9bb2da1SJames Smart #define LPFC_SGE_TYPE_DISEED		0x8
1705f9bb2da1SJames Smart #define LPFC_SGE_TYPE_ENC		0x9
1706f9bb2da1SJames Smart #define LPFC_SGE_TYPE_ATM		0xA
1707f9bb2da1SJames Smart #define LPFC_SGE_TYPE_SKIP		0xC
1708f9bb2da1SJames Smart #define lpfc_sli4_sge_last_SHIFT	31 /* Last SEG in the SGL sets it */
1709da0436e9SJames Smart #define lpfc_sli4_sge_last_MASK		0x00000001
1710da0436e9SJames Smart #define lpfc_sli4_sge_last_WORD		word2
171128baac74SJames Smart 	uint32_t sge_len;
1712da0436e9SJames Smart };
1713da0436e9SJames Smart 
1714f9bb2da1SJames Smart struct sli4_sge_diseed {	/* SLI-4 */
1715f9bb2da1SJames Smart 	uint32_t ref_tag;
1716f9bb2da1SJames Smart 	uint32_t ref_tag_tran;
1717f9bb2da1SJames Smart 
1718f9bb2da1SJames Smart 	uint32_t word2;
1719f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_apptran_SHIFT	0
1720f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_apptran_MASK	0x0000FFFF
1721f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_apptran_WORD	word2
1722f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_af_SHIFT	24
1723f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_af_MASK	0x00000001
1724f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_af_WORD	word2
1725f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_na_SHIFT	25
1726f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_na_MASK	0x00000001
1727f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_na_WORD	word2
1728f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_hi_SHIFT	26
1729f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_hi_MASK	0x00000001
1730f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_hi_WORD	word2
1731f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_type_SHIFT	27
1732f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_type_MASK	0x0000000F
1733f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_type_WORD	word2
1734f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_last_SHIFT	31 /* Last SEG in the SGL sets it */
1735f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_last_MASK	0x00000001
1736f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_last_WORD	word2
1737f9bb2da1SJames Smart 	uint32_t word3;
1738f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_apptag_SHIFT	0
1739f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_apptag_MASK	0x0000FFFF
1740f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_apptag_WORD	word3
1741f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_bs_SHIFT	16
1742f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_bs_MASK	0x00000007
1743f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_bs_WORD	word3
1744f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_ai_SHIFT	19
1745f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_ai_MASK	0x00000001
1746f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_ai_WORD	word3
1747f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_me_SHIFT	20
1748f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_me_MASK	0x00000001
1749f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_me_WORD	word3
1750f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_re_SHIFT	21
1751f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_re_MASK	0x00000001
1752f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_re_WORD	word3
1753f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_ce_SHIFT	22
1754f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_ce_MASK	0x00000001
1755f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_ce_WORD	word3
1756f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_nr_SHIFT	23
1757f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_nr_MASK	0x00000001
1758f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_nr_WORD	word3
1759f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_oprx_SHIFT	24
1760f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_oprx_MASK	0x0000000F
1761f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_oprx_WORD	word3
1762f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_optx_SHIFT	28
1763f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_optx_MASK	0x0000000F
1764f9bb2da1SJames Smart #define lpfc_sli4_sge_dif_optx_WORD	word3
1765f9bb2da1SJames Smart /* optx and oprx use BG_OP_IN defines in lpfc_hw.h */
1766f9bb2da1SJames Smart };
1767f9bb2da1SJames Smart 
1768da0436e9SJames Smart struct fcf_record {
1769da0436e9SJames Smart 	uint32_t max_rcv_size;
1770da0436e9SJames Smart 	uint32_t fka_adv_period;
1771da0436e9SJames Smart 	uint32_t fip_priority;
1772da0436e9SJames Smart 	uint32_t word3;
1773da0436e9SJames Smart #define lpfc_fcf_record_mac_0_SHIFT		0
1774da0436e9SJames Smart #define lpfc_fcf_record_mac_0_MASK		0x000000FF
1775da0436e9SJames Smart #define lpfc_fcf_record_mac_0_WORD		word3
1776da0436e9SJames Smart #define lpfc_fcf_record_mac_1_SHIFT		8
1777da0436e9SJames Smart #define lpfc_fcf_record_mac_1_MASK		0x000000FF
1778da0436e9SJames Smart #define lpfc_fcf_record_mac_1_WORD		word3
1779da0436e9SJames Smart #define lpfc_fcf_record_mac_2_SHIFT		16
1780da0436e9SJames Smart #define lpfc_fcf_record_mac_2_MASK		0x000000FF
1781da0436e9SJames Smart #define lpfc_fcf_record_mac_2_WORD		word3
1782da0436e9SJames Smart #define lpfc_fcf_record_mac_3_SHIFT		24
1783da0436e9SJames Smart #define lpfc_fcf_record_mac_3_MASK		0x000000FF
1784da0436e9SJames Smart #define lpfc_fcf_record_mac_3_WORD		word3
1785da0436e9SJames Smart 	uint32_t word4;
1786da0436e9SJames Smart #define lpfc_fcf_record_mac_4_SHIFT		0
1787da0436e9SJames Smart #define lpfc_fcf_record_mac_4_MASK		0x000000FF
1788da0436e9SJames Smart #define lpfc_fcf_record_mac_4_WORD		word4
1789da0436e9SJames Smart #define lpfc_fcf_record_mac_5_SHIFT		8
1790da0436e9SJames Smart #define lpfc_fcf_record_mac_5_MASK		0x000000FF
1791da0436e9SJames Smart #define lpfc_fcf_record_mac_5_WORD		word4
1792da0436e9SJames Smart #define lpfc_fcf_record_fcf_avail_SHIFT		16
1793da0436e9SJames Smart #define lpfc_fcf_record_fcf_avail_MASK		0x000000FF
17940c287589SJames Smart #define lpfc_fcf_record_fcf_avail_WORD		word4
1795da0436e9SJames Smart #define lpfc_fcf_record_mac_addr_prov_SHIFT	24
1796da0436e9SJames Smart #define lpfc_fcf_record_mac_addr_prov_MASK	0x000000FF
1797da0436e9SJames Smart #define lpfc_fcf_record_mac_addr_prov_WORD	word4
1798da0436e9SJames Smart #define LPFC_FCF_FPMA           1 	/* Fabric Provided MAC Address */
1799da0436e9SJames Smart #define LPFC_FCF_SPMA           2       /* Server Provided MAC Address */
1800da0436e9SJames Smart 	uint32_t word5;
1801da0436e9SJames Smart #define lpfc_fcf_record_fab_name_0_SHIFT	0
1802da0436e9SJames Smart #define lpfc_fcf_record_fab_name_0_MASK		0x000000FF
1803da0436e9SJames Smart #define lpfc_fcf_record_fab_name_0_WORD		word5
1804da0436e9SJames Smart #define lpfc_fcf_record_fab_name_1_SHIFT	8
1805da0436e9SJames Smart #define lpfc_fcf_record_fab_name_1_MASK		0x000000FF
1806da0436e9SJames Smart #define lpfc_fcf_record_fab_name_1_WORD		word5
1807da0436e9SJames Smart #define lpfc_fcf_record_fab_name_2_SHIFT	16
1808da0436e9SJames Smart #define lpfc_fcf_record_fab_name_2_MASK		0x000000FF
1809da0436e9SJames Smart #define lpfc_fcf_record_fab_name_2_WORD		word5
1810da0436e9SJames Smart #define lpfc_fcf_record_fab_name_3_SHIFT	24
1811da0436e9SJames Smart #define lpfc_fcf_record_fab_name_3_MASK		0x000000FF
1812da0436e9SJames Smart #define lpfc_fcf_record_fab_name_3_WORD		word5
1813da0436e9SJames Smart 	uint32_t word6;
1814da0436e9SJames Smart #define lpfc_fcf_record_fab_name_4_SHIFT	0
1815da0436e9SJames Smart #define lpfc_fcf_record_fab_name_4_MASK		0x000000FF
1816da0436e9SJames Smart #define lpfc_fcf_record_fab_name_4_WORD		word6
1817da0436e9SJames Smart #define lpfc_fcf_record_fab_name_5_SHIFT	8
1818da0436e9SJames Smart #define lpfc_fcf_record_fab_name_5_MASK		0x000000FF
1819da0436e9SJames Smart #define lpfc_fcf_record_fab_name_5_WORD		word6
1820da0436e9SJames Smart #define lpfc_fcf_record_fab_name_6_SHIFT	16
1821da0436e9SJames Smart #define lpfc_fcf_record_fab_name_6_MASK		0x000000FF
1822da0436e9SJames Smart #define lpfc_fcf_record_fab_name_6_WORD		word6
1823da0436e9SJames Smart #define lpfc_fcf_record_fab_name_7_SHIFT	24
1824da0436e9SJames Smart #define lpfc_fcf_record_fab_name_7_MASK		0x000000FF
1825da0436e9SJames Smart #define lpfc_fcf_record_fab_name_7_WORD		word6
1826da0436e9SJames Smart 	uint32_t word7;
1827da0436e9SJames Smart #define lpfc_fcf_record_fc_map_0_SHIFT		0
1828da0436e9SJames Smart #define lpfc_fcf_record_fc_map_0_MASK		0x000000FF
1829da0436e9SJames Smart #define lpfc_fcf_record_fc_map_0_WORD		word7
1830da0436e9SJames Smart #define lpfc_fcf_record_fc_map_1_SHIFT		8
1831da0436e9SJames Smart #define lpfc_fcf_record_fc_map_1_MASK		0x000000FF
1832da0436e9SJames Smart #define lpfc_fcf_record_fc_map_1_WORD		word7
1833da0436e9SJames Smart #define lpfc_fcf_record_fc_map_2_SHIFT		16
1834da0436e9SJames Smart #define lpfc_fcf_record_fc_map_2_MASK		0x000000FF
1835da0436e9SJames Smart #define lpfc_fcf_record_fc_map_2_WORD		word7
1836da0436e9SJames Smart #define lpfc_fcf_record_fcf_valid_SHIFT		24
183726979cedSJames Smart #define lpfc_fcf_record_fcf_valid_MASK		0x00000001
1838da0436e9SJames Smart #define lpfc_fcf_record_fcf_valid_WORD		word7
183926979cedSJames Smart #define lpfc_fcf_record_fcf_fc_SHIFT		25
184026979cedSJames Smart #define lpfc_fcf_record_fcf_fc_MASK		0x00000001
184126979cedSJames Smart #define lpfc_fcf_record_fcf_fc_WORD		word7
184226979cedSJames Smart #define lpfc_fcf_record_fcf_sol_SHIFT		31
184326979cedSJames Smart #define lpfc_fcf_record_fcf_sol_MASK		0x00000001
184426979cedSJames Smart #define lpfc_fcf_record_fcf_sol_WORD		word7
1845da0436e9SJames Smart 	uint32_t word8;
1846da0436e9SJames Smart #define lpfc_fcf_record_fcf_index_SHIFT		0
1847da0436e9SJames Smart #define lpfc_fcf_record_fcf_index_MASK		0x0000FFFF
1848da0436e9SJames Smart #define lpfc_fcf_record_fcf_index_WORD		word8
1849da0436e9SJames Smart #define lpfc_fcf_record_fcf_state_SHIFT		16
1850da0436e9SJames Smart #define lpfc_fcf_record_fcf_state_MASK		0x0000FFFF
1851da0436e9SJames Smart #define lpfc_fcf_record_fcf_state_WORD		word8
1852da0436e9SJames Smart 	uint8_t vlan_bitmap[512];
18538fa38513SJames Smart 	uint32_t word137;
18548fa38513SJames Smart #define lpfc_fcf_record_switch_name_0_SHIFT	0
18558fa38513SJames Smart #define lpfc_fcf_record_switch_name_0_MASK	0x000000FF
18568fa38513SJames Smart #define lpfc_fcf_record_switch_name_0_WORD	word137
18578fa38513SJames Smart #define lpfc_fcf_record_switch_name_1_SHIFT	8
18588fa38513SJames Smart #define lpfc_fcf_record_switch_name_1_MASK	0x000000FF
18598fa38513SJames Smart #define lpfc_fcf_record_switch_name_1_WORD	word137
18608fa38513SJames Smart #define lpfc_fcf_record_switch_name_2_SHIFT	16
18618fa38513SJames Smart #define lpfc_fcf_record_switch_name_2_MASK	0x000000FF
18628fa38513SJames Smart #define lpfc_fcf_record_switch_name_2_WORD	word137
18638fa38513SJames Smart #define lpfc_fcf_record_switch_name_3_SHIFT	24
18648fa38513SJames Smart #define lpfc_fcf_record_switch_name_3_MASK	0x000000FF
18658fa38513SJames Smart #define lpfc_fcf_record_switch_name_3_WORD	word137
18668fa38513SJames Smart 	uint32_t word138;
18678fa38513SJames Smart #define lpfc_fcf_record_switch_name_4_SHIFT	0
18688fa38513SJames Smart #define lpfc_fcf_record_switch_name_4_MASK	0x000000FF
18698fa38513SJames Smart #define lpfc_fcf_record_switch_name_4_WORD	word138
18708fa38513SJames Smart #define lpfc_fcf_record_switch_name_5_SHIFT	8
18718fa38513SJames Smart #define lpfc_fcf_record_switch_name_5_MASK	0x000000FF
18728fa38513SJames Smart #define lpfc_fcf_record_switch_name_5_WORD	word138
18738fa38513SJames Smart #define lpfc_fcf_record_switch_name_6_SHIFT	16
18748fa38513SJames Smart #define lpfc_fcf_record_switch_name_6_MASK	0x000000FF
18758fa38513SJames Smart #define lpfc_fcf_record_switch_name_6_WORD	word138
18768fa38513SJames Smart #define lpfc_fcf_record_switch_name_7_SHIFT	24
18778fa38513SJames Smart #define lpfc_fcf_record_switch_name_7_MASK	0x000000FF
18788fa38513SJames Smart #define lpfc_fcf_record_switch_name_7_WORD	word138
1879da0436e9SJames Smart };
1880da0436e9SJames Smart 
1881da0436e9SJames Smart struct lpfc_mbx_read_fcf_tbl {
1882da0436e9SJames Smart 	union lpfc_sli4_cfg_shdr cfg_shdr;
1883da0436e9SJames Smart 	union {
1884da0436e9SJames Smart 		struct {
1885da0436e9SJames Smart 			uint32_t word10;
1886da0436e9SJames Smart #define lpfc_mbx_read_fcf_tbl_indx_SHIFT	0
1887da0436e9SJames Smart #define lpfc_mbx_read_fcf_tbl_indx_MASK		0x0000FFFF
1888da0436e9SJames Smart #define lpfc_mbx_read_fcf_tbl_indx_WORD		word10
1889da0436e9SJames Smart 		} request;
1890da0436e9SJames Smart 		struct {
1891da0436e9SJames Smart 			uint32_t eventag;
1892da0436e9SJames Smart 		} response;
1893da0436e9SJames Smart 	} u;
1894da0436e9SJames Smart 	uint32_t word11;
1895da0436e9SJames Smart #define lpfc_mbx_read_fcf_tbl_nxt_vindx_SHIFT	0
1896da0436e9SJames Smart #define lpfc_mbx_read_fcf_tbl_nxt_vindx_MASK	0x0000FFFF
1897da0436e9SJames Smart #define lpfc_mbx_read_fcf_tbl_nxt_vindx_WORD	word11
1898da0436e9SJames Smart };
1899da0436e9SJames Smart 
1900da0436e9SJames Smart struct lpfc_mbx_add_fcf_tbl_entry {
1901da0436e9SJames Smart 	union lpfc_sli4_cfg_shdr cfg_shdr;
1902da0436e9SJames Smart 	uint32_t word10;
1903da0436e9SJames Smart #define lpfc_mbx_add_fcf_tbl_fcfi_SHIFT        0
1904da0436e9SJames Smart #define lpfc_mbx_add_fcf_tbl_fcfi_MASK         0x0000FFFF
1905da0436e9SJames Smart #define lpfc_mbx_add_fcf_tbl_fcfi_WORD         word10
1906da0436e9SJames Smart 	struct lpfc_mbx_sge fcf_sge;
1907da0436e9SJames Smart };
1908da0436e9SJames Smart 
1909da0436e9SJames Smart struct lpfc_mbx_del_fcf_tbl_entry {
1910da0436e9SJames Smart 	struct mbox_header header;
1911da0436e9SJames Smart 	uint32_t word10;
1912da0436e9SJames Smart #define lpfc_mbx_del_fcf_tbl_count_SHIFT	0
1913da0436e9SJames Smart #define lpfc_mbx_del_fcf_tbl_count_MASK		0x0000FFFF
1914da0436e9SJames Smart #define lpfc_mbx_del_fcf_tbl_count_WORD		word10
1915da0436e9SJames Smart #define lpfc_mbx_del_fcf_tbl_index_SHIFT	16
1916da0436e9SJames Smart #define lpfc_mbx_del_fcf_tbl_index_MASK		0x0000FFFF
1917da0436e9SJames Smart #define lpfc_mbx_del_fcf_tbl_index_WORD		word10
1918da0436e9SJames Smart };
1919da0436e9SJames Smart 
1920ecfd03c6SJames Smart struct lpfc_mbx_redisc_fcf_tbl {
1921ecfd03c6SJames Smart 	struct mbox_header header;
1922ecfd03c6SJames Smart 	uint32_t word10;
1923ecfd03c6SJames Smart #define lpfc_mbx_redisc_fcf_count_SHIFT		0
1924ecfd03c6SJames Smart #define lpfc_mbx_redisc_fcf_count_MASK		0x0000FFFF
1925ecfd03c6SJames Smart #define lpfc_mbx_redisc_fcf_count_WORD		word10
1926ecfd03c6SJames Smart 	uint32_t resvd;
1927ecfd03c6SJames Smart 	uint32_t word12;
1928ecfd03c6SJames Smart #define lpfc_mbx_redisc_fcf_index_SHIFT		0
1929ecfd03c6SJames Smart #define lpfc_mbx_redisc_fcf_index_MASK		0x0000FFFF
1930ecfd03c6SJames Smart #define lpfc_mbx_redisc_fcf_index_WORD		word12
1931ecfd03c6SJames Smart };
1932ecfd03c6SJames Smart 
1933da0436e9SJames Smart /* Status field for embedded SLI_CONFIG mailbox command */
1934da0436e9SJames Smart #define STATUS_SUCCESS					0x0
1935da0436e9SJames Smart #define STATUS_FAILED 					0x1
1936da0436e9SJames Smart #define STATUS_ILLEGAL_REQUEST				0x2
1937da0436e9SJames Smart #define STATUS_ILLEGAL_FIELD				0x3
1938da0436e9SJames Smart #define STATUS_INSUFFICIENT_BUFFER 			0x4
1939da0436e9SJames Smart #define STATUS_UNAUTHORIZED_REQUEST			0x5
1940da0436e9SJames Smart #define STATUS_FLASHROM_SAVE_FAILED			0x17
1941da0436e9SJames Smart #define STATUS_FLASHROM_RESTORE_FAILED			0x18
1942da0436e9SJames Smart #define STATUS_ICCBINDEX_ALLOC_FAILED			0x1a
1943da0436e9SJames Smart #define STATUS_IOCTLHANDLE_ALLOC_FAILED 		0x1b
1944da0436e9SJames Smart #define STATUS_INVALID_PHY_ADDR_FROM_OSM		0x1c
1945da0436e9SJames Smart #define STATUS_INVALID_PHY_ADDR_LEN_FROM_OSM		0x1d
1946da0436e9SJames Smart #define STATUS_ASSERT_FAILED				0x1e
1947da0436e9SJames Smart #define STATUS_INVALID_SESSION				0x1f
1948da0436e9SJames Smart #define STATUS_INVALID_CONNECTION			0x20
1949da0436e9SJames Smart #define STATUS_BTL_PATH_EXCEEDS_OSM_LIMIT		0x21
1950da0436e9SJames Smart #define STATUS_BTL_NO_FREE_SLOT_PATH			0x24
1951da0436e9SJames Smart #define STATUS_BTL_NO_FREE_SLOT_TGTID			0x25
1952da0436e9SJames Smart #define STATUS_OSM_DEVSLOT_NOT_FOUND			0x26
1953da0436e9SJames Smart #define STATUS_FLASHROM_READ_FAILED			0x27
1954da0436e9SJames Smart #define STATUS_POLL_IOCTL_TIMEOUT			0x28
1955da0436e9SJames Smart #define STATUS_ERROR_ACITMAIN				0x2a
1956da0436e9SJames Smart #define STATUS_REBOOT_REQUIRED				0x2c
1957da0436e9SJames Smart #define STATUS_FCF_IN_USE				0x3a
1958def9c7a9SJames Smart #define STATUS_FCF_TABLE_EMPTY				0x43
1959da0436e9SJames Smart 
1960481ad967SJames Smart /*
1961481ad967SJames Smart  * Additional status field for embedded SLI_CONFIG mailbox
1962481ad967SJames Smart  * command.
1963481ad967SJames Smart  */
1964481ad967SJames Smart #define ADD_STATUS_OPERATION_ALREADY_ACTIVE		0x67
1965481ad967SJames Smart 
1966da0436e9SJames Smart struct lpfc_mbx_sli4_config {
1967da0436e9SJames Smart 	struct mbox_header header;
1968da0436e9SJames Smart };
1969da0436e9SJames Smart 
1970da0436e9SJames Smart struct lpfc_mbx_init_vfi {
1971da0436e9SJames Smart 	uint32_t word1;
1972da0436e9SJames Smart #define lpfc_init_vfi_vr_SHIFT		31
1973da0436e9SJames Smart #define lpfc_init_vfi_vr_MASK		0x00000001
1974da0436e9SJames Smart #define lpfc_init_vfi_vr_WORD		word1
1975da0436e9SJames Smart #define lpfc_init_vfi_vt_SHIFT		30
1976da0436e9SJames Smart #define lpfc_init_vfi_vt_MASK		0x00000001
1977da0436e9SJames Smart #define lpfc_init_vfi_vt_WORD		word1
1978da0436e9SJames Smart #define lpfc_init_vfi_vf_SHIFT		29
1979da0436e9SJames Smart #define lpfc_init_vfi_vf_MASK		0x00000001
1980da0436e9SJames Smart #define lpfc_init_vfi_vf_WORD		word1
198176a95d75SJames Smart #define lpfc_init_vfi_vp_SHIFT		28
198276a95d75SJames Smart #define lpfc_init_vfi_vp_MASK		0x00000001
198376a95d75SJames Smart #define lpfc_init_vfi_vp_WORD		word1
1984da0436e9SJames Smart #define lpfc_init_vfi_vfi_SHIFT		0
1985da0436e9SJames Smart #define lpfc_init_vfi_vfi_MASK		0x0000FFFF
1986da0436e9SJames Smart #define lpfc_init_vfi_vfi_WORD		word1
1987da0436e9SJames Smart 	uint32_t word2;
198876a95d75SJames Smart #define lpfc_init_vfi_vpi_SHIFT		16
198976a95d75SJames Smart #define lpfc_init_vfi_vpi_MASK		0x0000FFFF
199076a95d75SJames Smart #define lpfc_init_vfi_vpi_WORD		word2
1991da0436e9SJames Smart #define lpfc_init_vfi_fcfi_SHIFT	0
1992da0436e9SJames Smart #define lpfc_init_vfi_fcfi_MASK		0x0000FFFF
1993da0436e9SJames Smart #define lpfc_init_vfi_fcfi_WORD		word2
1994da0436e9SJames Smart 	uint32_t word3;
1995da0436e9SJames Smart #define lpfc_init_vfi_pri_SHIFT		13
1996da0436e9SJames Smart #define lpfc_init_vfi_pri_MASK		0x00000007
1997da0436e9SJames Smart #define lpfc_init_vfi_pri_WORD		word3
1998da0436e9SJames Smart #define lpfc_init_vfi_vf_id_SHIFT	1
1999da0436e9SJames Smart #define lpfc_init_vfi_vf_id_MASK	0x00000FFF
2000da0436e9SJames Smart #define lpfc_init_vfi_vf_id_WORD	word3
2001da0436e9SJames Smart 	uint32_t word4;
2002da0436e9SJames Smart #define lpfc_init_vfi_hop_count_SHIFT	24
2003da0436e9SJames Smart #define lpfc_init_vfi_hop_count_MASK	0x000000FF
2004da0436e9SJames Smart #define lpfc_init_vfi_hop_count_WORD	word4
2005da0436e9SJames Smart };
2006df9e1b59SJames Smart #define MBX_VFI_IN_USE			0x9F02
2007df9e1b59SJames Smart 
2008da0436e9SJames Smart 
2009da0436e9SJames Smart struct lpfc_mbx_reg_vfi {
2010da0436e9SJames Smart 	uint32_t word1;
2011ae05ebe3SJames Smart #define lpfc_reg_vfi_upd_SHIFT		29
2012ae05ebe3SJames Smart #define lpfc_reg_vfi_upd_MASK		0x00000001
2013ae05ebe3SJames Smart #define lpfc_reg_vfi_upd_WORD		word1
2014da0436e9SJames Smart #define lpfc_reg_vfi_vp_SHIFT		28
2015da0436e9SJames Smart #define lpfc_reg_vfi_vp_MASK		0x00000001
2016da0436e9SJames Smart #define lpfc_reg_vfi_vp_WORD		word1
2017da0436e9SJames Smart #define lpfc_reg_vfi_vfi_SHIFT		0
2018da0436e9SJames Smart #define lpfc_reg_vfi_vfi_MASK		0x0000FFFF
2019da0436e9SJames Smart #define lpfc_reg_vfi_vfi_WORD		word1
2020da0436e9SJames Smart 	uint32_t word2;
2021da0436e9SJames Smart #define lpfc_reg_vfi_vpi_SHIFT		16
2022da0436e9SJames Smart #define lpfc_reg_vfi_vpi_MASK		0x0000FFFF
2023da0436e9SJames Smart #define lpfc_reg_vfi_vpi_WORD		word2
2024da0436e9SJames Smart #define lpfc_reg_vfi_fcfi_SHIFT		0
2025da0436e9SJames Smart #define lpfc_reg_vfi_fcfi_MASK		0x0000FFFF
2026da0436e9SJames Smart #define lpfc_reg_vfi_fcfi_WORD		word2
2027c868595dSJames Smart 	uint32_t wwn[2];
2028da0436e9SJames Smart 	struct ulp_bde64 bde;
2029b19a061aSJames Smart 	uint32_t e_d_tov;
2030b19a061aSJames Smart 	uint32_t r_a_tov;
2031da0436e9SJames Smart 	uint32_t word10;
2032da0436e9SJames Smart #define lpfc_reg_vfi_nport_id_SHIFT		0
2033da0436e9SJames Smart #define lpfc_reg_vfi_nport_id_MASK		0x00FFFFFF
2034da0436e9SJames Smart #define lpfc_reg_vfi_nport_id_WORD		word10
2035da0436e9SJames Smart };
2036da0436e9SJames Smart 
2037da0436e9SJames Smart struct lpfc_mbx_init_vpi {
2038da0436e9SJames Smart 	uint32_t word1;
2039da0436e9SJames Smart #define lpfc_init_vpi_vfi_SHIFT		16
2040da0436e9SJames Smart #define lpfc_init_vpi_vfi_MASK		0x0000FFFF
2041da0436e9SJames Smart #define lpfc_init_vpi_vfi_WORD		word1
2042da0436e9SJames Smart #define lpfc_init_vpi_vpi_SHIFT		0
2043da0436e9SJames Smart #define lpfc_init_vpi_vpi_MASK		0x0000FFFF
2044da0436e9SJames Smart #define lpfc_init_vpi_vpi_WORD		word1
2045da0436e9SJames Smart };
2046da0436e9SJames Smart 
2047da0436e9SJames Smart struct lpfc_mbx_read_vpi {
2048da0436e9SJames Smart 	uint32_t word1_rsvd;
2049da0436e9SJames Smart 	uint32_t word2;
2050da0436e9SJames Smart #define lpfc_mbx_read_vpi_vnportid_SHIFT	0
2051da0436e9SJames Smart #define lpfc_mbx_read_vpi_vnportid_MASK		0x00FFFFFF
2052da0436e9SJames Smart #define lpfc_mbx_read_vpi_vnportid_WORD		word2
2053da0436e9SJames Smart 	uint32_t word3_rsvd;
2054da0436e9SJames Smart 	uint32_t word4;
2055da0436e9SJames Smart #define lpfc_mbx_read_vpi_acq_alpa_SHIFT	0
2056da0436e9SJames Smart #define lpfc_mbx_read_vpi_acq_alpa_MASK		0x000000FF
2057da0436e9SJames Smart #define lpfc_mbx_read_vpi_acq_alpa_WORD		word4
2058da0436e9SJames Smart #define lpfc_mbx_read_vpi_pb_SHIFT		15
2059da0436e9SJames Smart #define lpfc_mbx_read_vpi_pb_MASK		0x00000001
2060da0436e9SJames Smart #define lpfc_mbx_read_vpi_pb_WORD		word4
2061da0436e9SJames Smart #define lpfc_mbx_read_vpi_spec_alpa_SHIFT	16
2062da0436e9SJames Smart #define lpfc_mbx_read_vpi_spec_alpa_MASK	0x000000FF
2063da0436e9SJames Smart #define lpfc_mbx_read_vpi_spec_alpa_WORD	word4
2064da0436e9SJames Smart #define lpfc_mbx_read_vpi_ns_SHIFT		30
2065da0436e9SJames Smart #define lpfc_mbx_read_vpi_ns_MASK		0x00000001
2066da0436e9SJames Smart #define lpfc_mbx_read_vpi_ns_WORD		word4
2067da0436e9SJames Smart #define lpfc_mbx_read_vpi_hl_SHIFT		31
2068da0436e9SJames Smart #define lpfc_mbx_read_vpi_hl_MASK		0x00000001
2069da0436e9SJames Smart #define lpfc_mbx_read_vpi_hl_WORD		word4
2070da0436e9SJames Smart 	uint32_t word5_rsvd;
2071da0436e9SJames Smart 	uint32_t word6;
2072da0436e9SJames Smart #define lpfc_mbx_read_vpi_vpi_SHIFT		0
2073da0436e9SJames Smart #define lpfc_mbx_read_vpi_vpi_MASK		0x0000FFFF
2074da0436e9SJames Smart #define lpfc_mbx_read_vpi_vpi_WORD		word6
2075da0436e9SJames Smart 	uint32_t word7;
2076da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_0_SHIFT		0
2077da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_0_MASK		0x000000FF
2078da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_0_WORD		word7
2079da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_1_SHIFT		8
2080da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_1_MASK		0x000000FF
2081da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_1_WORD		word7
2082da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_2_SHIFT		16
2083da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_2_MASK		0x000000FF
2084da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_2_WORD		word7
2085da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_3_SHIFT		24
2086da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_3_MASK		0x000000FF
2087da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_3_WORD		word7
2088da0436e9SJames Smart 	uint32_t word8;
2089da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_4_SHIFT		0
2090da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_4_MASK		0x000000FF
2091da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_4_WORD		word8
2092da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_5_SHIFT		8
2093da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_5_MASK		0x000000FF
2094da0436e9SJames Smart #define lpfc_mbx_read_vpi_mac_5_WORD		word8
2095da0436e9SJames Smart #define lpfc_mbx_read_vpi_vlan_tag_SHIFT	16
2096da0436e9SJames Smart #define lpfc_mbx_read_vpi_vlan_tag_MASK		0x00000FFF
2097da0436e9SJames Smart #define lpfc_mbx_read_vpi_vlan_tag_WORD		word8
2098da0436e9SJames Smart #define lpfc_mbx_read_vpi_vv_SHIFT		28
2099da0436e9SJames Smart #define lpfc_mbx_read_vpi_vv_MASK		0x0000001
2100da0436e9SJames Smart #define lpfc_mbx_read_vpi_vv_WORD		word8
2101da0436e9SJames Smart };
2102da0436e9SJames Smart 
2103da0436e9SJames Smart struct lpfc_mbx_unreg_vfi {
2104da0436e9SJames Smart 	uint32_t word1_rsvd;
2105da0436e9SJames Smart 	uint32_t word2;
2106da0436e9SJames Smart #define lpfc_unreg_vfi_vfi_SHIFT	0
2107da0436e9SJames Smart #define lpfc_unreg_vfi_vfi_MASK		0x0000FFFF
2108da0436e9SJames Smart #define lpfc_unreg_vfi_vfi_WORD		word2
2109da0436e9SJames Smart };
2110da0436e9SJames Smart 
2111da0436e9SJames Smart struct lpfc_mbx_resume_rpi {
2112da0436e9SJames Smart 	uint32_t word1;
21138fa38513SJames Smart #define lpfc_resume_rpi_index_SHIFT	0
21148fa38513SJames Smart #define lpfc_resume_rpi_index_MASK	0x0000FFFF
21158fa38513SJames Smart #define lpfc_resume_rpi_index_WORD	word1
21168fa38513SJames Smart #define lpfc_resume_rpi_ii_SHIFT	30
21178fa38513SJames Smart #define lpfc_resume_rpi_ii_MASK		0x00000003
21188fa38513SJames Smart #define lpfc_resume_rpi_ii_WORD		word1
21198fa38513SJames Smart #define RESUME_INDEX_RPI		0
21208fa38513SJames Smart #define RESUME_INDEX_VPI		1
21218fa38513SJames Smart #define RESUME_INDEX_VFI		2
21228fa38513SJames Smart #define RESUME_INDEX_FCFI		3
2123da0436e9SJames Smart 	uint32_t event_tag;
2124da0436e9SJames Smart };
2125da0436e9SJames Smart 
2126da0436e9SJames Smart #define REG_FCF_INVALID_QID	0xFFFF
2127da0436e9SJames Smart struct lpfc_mbx_reg_fcfi {
2128da0436e9SJames Smart 	uint32_t word1;
2129da0436e9SJames Smart #define lpfc_reg_fcfi_info_index_SHIFT	0
2130da0436e9SJames Smart #define lpfc_reg_fcfi_info_index_MASK	0x0000FFFF
2131da0436e9SJames Smart #define lpfc_reg_fcfi_info_index_WORD	word1
2132da0436e9SJames Smart #define lpfc_reg_fcfi_fcfi_SHIFT	16
2133da0436e9SJames Smart #define lpfc_reg_fcfi_fcfi_MASK		0x0000FFFF
2134da0436e9SJames Smart #define lpfc_reg_fcfi_fcfi_WORD		word1
2135da0436e9SJames Smart 	uint32_t word2;
2136da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id1_SHIFT	0
2137da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id1_MASK	0x0000FFFF
2138da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id1_WORD	word2
2139da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id0_SHIFT	16
2140da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id0_MASK	0x0000FFFF
2141da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id0_WORD	word2
2142da0436e9SJames Smart 	uint32_t word3;
2143da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id3_SHIFT	0
2144da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id3_MASK	0x0000FFFF
2145da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id3_WORD	word3
2146da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id2_SHIFT	16
2147da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id2_MASK	0x0000FFFF
2148da0436e9SJames Smart #define lpfc_reg_fcfi_rq_id2_WORD	word3
2149da0436e9SJames Smart 	uint32_t word4;
2150da0436e9SJames Smart #define lpfc_reg_fcfi_type_match0_SHIFT	24
2151da0436e9SJames Smart #define lpfc_reg_fcfi_type_match0_MASK	0x000000FF
2152da0436e9SJames Smart #define lpfc_reg_fcfi_type_match0_WORD	word4
2153da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask0_SHIFT	16
2154da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask0_MASK	0x000000FF
2155da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask0_WORD	word4
2156da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match0_SHIFT	8
2157da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match0_MASK	0x000000FF
2158da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match0_WORD	word4
2159da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask0_SHIFT	0
2160da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask0_MASK	0x000000FF
2161da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask0_WORD	word4
2162da0436e9SJames Smart 	uint32_t word5;
2163da0436e9SJames Smart #define lpfc_reg_fcfi_type_match1_SHIFT	24
2164da0436e9SJames Smart #define lpfc_reg_fcfi_type_match1_MASK	0x000000FF
2165da0436e9SJames Smart #define lpfc_reg_fcfi_type_match1_WORD	word5
2166da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask1_SHIFT	16
2167da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask1_MASK	0x000000FF
2168da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask1_WORD	word5
2169da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match1_SHIFT	8
2170da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match1_MASK	0x000000FF
2171da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match1_WORD	word5
2172da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask1_SHIFT	0
2173da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask1_MASK	0x000000FF
2174da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask1_WORD	word5
2175da0436e9SJames Smart 	uint32_t word6;
2176da0436e9SJames Smart #define lpfc_reg_fcfi_type_match2_SHIFT	24
2177da0436e9SJames Smart #define lpfc_reg_fcfi_type_match2_MASK	0x000000FF
2178da0436e9SJames Smart #define lpfc_reg_fcfi_type_match2_WORD	word6
2179da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask2_SHIFT	16
2180da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask2_MASK	0x000000FF
2181da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask2_WORD	word6
2182da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match2_SHIFT	8
2183da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match2_MASK	0x000000FF
2184da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match2_WORD	word6
2185da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask2_SHIFT	0
2186da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask2_MASK	0x000000FF
2187da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask2_WORD	word6
2188da0436e9SJames Smart 	uint32_t word7;
2189da0436e9SJames Smart #define lpfc_reg_fcfi_type_match3_SHIFT	24
2190da0436e9SJames Smart #define lpfc_reg_fcfi_type_match3_MASK	0x000000FF
2191da0436e9SJames Smart #define lpfc_reg_fcfi_type_match3_WORD	word7
2192da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask3_SHIFT	16
2193da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask3_MASK	0x000000FF
2194da0436e9SJames Smart #define lpfc_reg_fcfi_type_mask3_WORD	word7
2195da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match3_SHIFT	8
2196da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match3_MASK	0x000000FF
2197da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_match3_WORD	word7
2198da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask3_SHIFT	0
2199da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask3_MASK	0x000000FF
2200da0436e9SJames Smart #define lpfc_reg_fcfi_rctl_mask3_WORD	word7
2201da0436e9SJames Smart 	uint32_t word8;
2202da0436e9SJames Smart #define lpfc_reg_fcfi_mam_SHIFT		13
2203da0436e9SJames Smart #define lpfc_reg_fcfi_mam_MASK		0x00000003
2204da0436e9SJames Smart #define lpfc_reg_fcfi_mam_WORD		word8
2205da0436e9SJames Smart #define LPFC_MAM_BOTH		0	/* Both SPMA and FPMA */
2206da0436e9SJames Smart #define LPFC_MAM_SPMA		1	/* Server Provided MAC Address */
2207da0436e9SJames Smart #define LPFC_MAM_FPMA		2	/* Fabric Provided MAC Address */
2208da0436e9SJames Smart #define lpfc_reg_fcfi_vv_SHIFT		12
2209da0436e9SJames Smart #define lpfc_reg_fcfi_vv_MASK		0x00000001
2210da0436e9SJames Smart #define lpfc_reg_fcfi_vv_WORD		word8
2211da0436e9SJames Smart #define lpfc_reg_fcfi_vlan_tag_SHIFT	0
2212da0436e9SJames Smart #define lpfc_reg_fcfi_vlan_tag_MASK	0x00000FFF
2213da0436e9SJames Smart #define lpfc_reg_fcfi_vlan_tag_WORD	word8
2214da0436e9SJames Smart };
2215da0436e9SJames Smart 
2216da0436e9SJames Smart struct lpfc_mbx_unreg_fcfi {
2217da0436e9SJames Smart 	uint32_t word1_rsv;
2218da0436e9SJames Smart 	uint32_t word2;
2219da0436e9SJames Smart #define lpfc_unreg_fcfi_SHIFT		0
2220da0436e9SJames Smart #define lpfc_unreg_fcfi_MASK		0x0000FFFF
2221da0436e9SJames Smart #define lpfc_unreg_fcfi_WORD		word2
2222da0436e9SJames Smart };
2223da0436e9SJames Smart 
2224da0436e9SJames Smart struct lpfc_mbx_read_rev {
2225da0436e9SJames Smart 	uint32_t word1;
2226da0436e9SJames Smart #define lpfc_mbx_rd_rev_sli_lvl_SHIFT  		16
2227da0436e9SJames Smart #define lpfc_mbx_rd_rev_sli_lvl_MASK   		0x0000000F
2228da0436e9SJames Smart #define lpfc_mbx_rd_rev_sli_lvl_WORD   		word1
2229da0436e9SJames Smart #define lpfc_mbx_rd_rev_fcoe_SHIFT		20
2230da0436e9SJames Smart #define lpfc_mbx_rd_rev_fcoe_MASK		0x00000001
2231da0436e9SJames Smart #define lpfc_mbx_rd_rev_fcoe_WORD		word1
223245ed1190SJames Smart #define lpfc_mbx_rd_rev_cee_ver_SHIFT		21
223345ed1190SJames Smart #define lpfc_mbx_rd_rev_cee_ver_MASK		0x00000003
223445ed1190SJames Smart #define lpfc_mbx_rd_rev_cee_ver_WORD		word1
223545ed1190SJames Smart #define LPFC_PREDCBX_CEE_MODE	0
223645ed1190SJames Smart #define LPFC_DCBX_CEE_MODE	1
2237da0436e9SJames Smart #define lpfc_mbx_rd_rev_vpd_SHIFT		29
2238da0436e9SJames Smart #define lpfc_mbx_rd_rev_vpd_MASK		0x00000001
2239da0436e9SJames Smart #define lpfc_mbx_rd_rev_vpd_WORD		word1
2240da0436e9SJames Smart 	uint32_t first_hw_rev;
2241da0436e9SJames Smart 	uint32_t second_hw_rev;
2242da0436e9SJames Smart 	uint32_t word4_rsvd;
2243da0436e9SJames Smart 	uint32_t third_hw_rev;
2244da0436e9SJames Smart 	uint32_t word6;
2245da0436e9SJames Smart #define lpfc_mbx_rd_rev_fcph_low_SHIFT		0
2246da0436e9SJames Smart #define lpfc_mbx_rd_rev_fcph_low_MASK		0x000000FF
2247da0436e9SJames Smart #define lpfc_mbx_rd_rev_fcph_low_WORD		word6
2248da0436e9SJames Smart #define lpfc_mbx_rd_rev_fcph_high_SHIFT		8
2249da0436e9SJames Smart #define lpfc_mbx_rd_rev_fcph_high_MASK		0x000000FF
2250da0436e9SJames Smart #define lpfc_mbx_rd_rev_fcph_high_WORD		word6
2251da0436e9SJames Smart #define lpfc_mbx_rd_rev_ftr_lvl_low_SHIFT	16
2252da0436e9SJames Smart #define lpfc_mbx_rd_rev_ftr_lvl_low_MASK	0x000000FF
2253da0436e9SJames Smart #define lpfc_mbx_rd_rev_ftr_lvl_low_WORD	word6
2254da0436e9SJames Smart #define lpfc_mbx_rd_rev_ftr_lvl_high_SHIFT	24
2255da0436e9SJames Smart #define lpfc_mbx_rd_rev_ftr_lvl_high_MASK	0x000000FF
2256da0436e9SJames Smart #define lpfc_mbx_rd_rev_ftr_lvl_high_WORD	word6
2257da0436e9SJames Smart 	uint32_t word7_rsvd;
2258da0436e9SJames Smart 	uint32_t fw_id_rev;
2259da0436e9SJames Smart 	uint8_t  fw_name[16];
2260da0436e9SJames Smart 	uint32_t ulp_fw_id_rev;
2261da0436e9SJames Smart 	uint8_t  ulp_fw_name[16];
2262da0436e9SJames Smart 	uint32_t word18_47_rsvd[30];
2263da0436e9SJames Smart 	uint32_t word48;
2264da0436e9SJames Smart #define lpfc_mbx_rd_rev_avail_len_SHIFT		0
2265da0436e9SJames Smart #define lpfc_mbx_rd_rev_avail_len_MASK		0x00FFFFFF
2266da0436e9SJames Smart #define lpfc_mbx_rd_rev_avail_len_WORD		word48
2267da0436e9SJames Smart 	uint32_t vpd_paddr_low;
2268da0436e9SJames Smart 	uint32_t vpd_paddr_high;
2269da0436e9SJames Smart 	uint32_t avail_vpd_len;
2270da0436e9SJames Smart 	uint32_t rsvd_52_63[12];
2271da0436e9SJames Smart };
2272da0436e9SJames Smart 
2273da0436e9SJames Smart struct lpfc_mbx_read_config {
2274da0436e9SJames Smart 	uint32_t word1;
22756d368e53SJames Smart #define lpfc_mbx_rd_conf_extnts_inuse_SHIFT	31
22766d368e53SJames Smart #define lpfc_mbx_rd_conf_extnts_inuse_MASK	0x00000001
22776d368e53SJames Smart #define lpfc_mbx_rd_conf_extnts_inuse_WORD	word1
2278da0436e9SJames Smart 	uint32_t word2;
2279cd1c8301SJames Smart #define lpfc_mbx_rd_conf_lnk_numb_SHIFT		0
2280cd1c8301SJames Smart #define lpfc_mbx_rd_conf_lnk_numb_MASK		0x0000003F
2281cd1c8301SJames Smart #define lpfc_mbx_rd_conf_lnk_numb_WORD		word2
2282cd1c8301SJames Smart #define lpfc_mbx_rd_conf_lnk_type_SHIFT		6
2283cd1c8301SJames Smart #define lpfc_mbx_rd_conf_lnk_type_MASK		0x00000003
2284cd1c8301SJames Smart #define lpfc_mbx_rd_conf_lnk_type_WORD		word2
2285026abb87SJames Smart #define LPFC_LNK_TYPE_GE	0
2286026abb87SJames Smart #define LPFC_LNK_TYPE_FC	1
2287cd1c8301SJames Smart #define lpfc_mbx_rd_conf_lnk_ldv_SHIFT		8
2288cd1c8301SJames Smart #define lpfc_mbx_rd_conf_lnk_ldv_MASK		0x00000001
2289cd1c8301SJames Smart #define lpfc_mbx_rd_conf_lnk_ldv_WORD		word2
2290da0436e9SJames Smart #define lpfc_mbx_rd_conf_topology_SHIFT		24
2291da0436e9SJames Smart #define lpfc_mbx_rd_conf_topology_MASK		0x000000FF
2292da0436e9SJames Smart #define lpfc_mbx_rd_conf_topology_WORD		word2
22936d368e53SJames Smart 	uint32_t rsvd_3;
2294da0436e9SJames Smart 	uint32_t word4;
2295da0436e9SJames Smart #define lpfc_mbx_rd_conf_e_d_tov_SHIFT		0
2296da0436e9SJames Smart #define lpfc_mbx_rd_conf_e_d_tov_MASK		0x0000FFFF
2297da0436e9SJames Smart #define lpfc_mbx_rd_conf_e_d_tov_WORD		word4
22986d368e53SJames Smart 	uint32_t rsvd_5;
2299da0436e9SJames Smart 	uint32_t word6;
2300da0436e9SJames Smart #define lpfc_mbx_rd_conf_r_a_tov_SHIFT		0
2301da0436e9SJames Smart #define lpfc_mbx_rd_conf_r_a_tov_MASK		0x0000FFFF
2302da0436e9SJames Smart #define lpfc_mbx_rd_conf_r_a_tov_WORD		word6
2303c691816eSJames Smart #define lpfc_mbx_rd_conf_link_speed_SHIFT	16
2304c691816eSJames Smart #define lpfc_mbx_rd_conf_link_speed_MASK	0x0000FFFF
2305c691816eSJames Smart #define lpfc_mbx_rd_conf_link_speed_WORD	word6
23066d368e53SJames Smart 	uint32_t rsvd_7;
23076d368e53SJames Smart 	uint32_t rsvd_8;
2308da0436e9SJames Smart 	uint32_t word9;
2309da0436e9SJames Smart #define lpfc_mbx_rd_conf_lmt_SHIFT		0
2310da0436e9SJames Smart #define lpfc_mbx_rd_conf_lmt_MASK		0x0000FFFF
2311da0436e9SJames Smart #define lpfc_mbx_rd_conf_lmt_WORD		word9
23126d368e53SJames Smart 	uint32_t rsvd_10;
23136d368e53SJames Smart 	uint32_t rsvd_11;
2314da0436e9SJames Smart 	uint32_t word12;
2315da0436e9SJames Smart #define lpfc_mbx_rd_conf_xri_base_SHIFT		0
2316da0436e9SJames Smart #define lpfc_mbx_rd_conf_xri_base_MASK		0x0000FFFF
2317da0436e9SJames Smart #define lpfc_mbx_rd_conf_xri_base_WORD		word12
2318da0436e9SJames Smart #define lpfc_mbx_rd_conf_xri_count_SHIFT	16
2319da0436e9SJames Smart #define lpfc_mbx_rd_conf_xri_count_MASK		0x0000FFFF
2320da0436e9SJames Smart #define lpfc_mbx_rd_conf_xri_count_WORD		word12
2321da0436e9SJames Smart 	uint32_t word13;
2322da0436e9SJames Smart #define lpfc_mbx_rd_conf_rpi_base_SHIFT		0
2323da0436e9SJames Smart #define lpfc_mbx_rd_conf_rpi_base_MASK		0x0000FFFF
2324da0436e9SJames Smart #define lpfc_mbx_rd_conf_rpi_base_WORD		word13
2325da0436e9SJames Smart #define lpfc_mbx_rd_conf_rpi_count_SHIFT	16
2326da0436e9SJames Smart #define lpfc_mbx_rd_conf_rpi_count_MASK		0x0000FFFF
2327da0436e9SJames Smart #define lpfc_mbx_rd_conf_rpi_count_WORD		word13
2328da0436e9SJames Smart 	uint32_t word14;
2329da0436e9SJames Smart #define lpfc_mbx_rd_conf_vpi_base_SHIFT		0
2330da0436e9SJames Smart #define lpfc_mbx_rd_conf_vpi_base_MASK		0x0000FFFF
2331da0436e9SJames Smart #define lpfc_mbx_rd_conf_vpi_base_WORD		word14
2332da0436e9SJames Smart #define lpfc_mbx_rd_conf_vpi_count_SHIFT	16
2333da0436e9SJames Smart #define lpfc_mbx_rd_conf_vpi_count_MASK		0x0000FFFF
2334da0436e9SJames Smart #define lpfc_mbx_rd_conf_vpi_count_WORD		word14
2335da0436e9SJames Smart 	uint32_t word15;
2336da0436e9SJames Smart #define lpfc_mbx_rd_conf_vfi_base_SHIFT         0
2337da0436e9SJames Smart #define lpfc_mbx_rd_conf_vfi_base_MASK          0x0000FFFF
2338da0436e9SJames Smart #define lpfc_mbx_rd_conf_vfi_base_WORD          word15
2339da0436e9SJames Smart #define lpfc_mbx_rd_conf_vfi_count_SHIFT        16
2340da0436e9SJames Smart #define lpfc_mbx_rd_conf_vfi_count_MASK         0x0000FFFF
2341da0436e9SJames Smart #define lpfc_mbx_rd_conf_vfi_count_WORD         word15
2342da0436e9SJames Smart 	uint32_t word16;
2343da0436e9SJames Smart #define lpfc_mbx_rd_conf_fcfi_count_SHIFT	16
2344da0436e9SJames Smart #define lpfc_mbx_rd_conf_fcfi_count_MASK	0x0000FFFF
2345da0436e9SJames Smart #define lpfc_mbx_rd_conf_fcfi_count_WORD	word16
2346da0436e9SJames Smart 	uint32_t word17;
2347da0436e9SJames Smart #define lpfc_mbx_rd_conf_rq_count_SHIFT		0
2348da0436e9SJames Smart #define lpfc_mbx_rd_conf_rq_count_MASK		0x0000FFFF
2349da0436e9SJames Smart #define lpfc_mbx_rd_conf_rq_count_WORD		word17
2350da0436e9SJames Smart #define lpfc_mbx_rd_conf_eq_count_SHIFT		16
2351da0436e9SJames Smart #define lpfc_mbx_rd_conf_eq_count_MASK		0x0000FFFF
2352da0436e9SJames Smart #define lpfc_mbx_rd_conf_eq_count_WORD		word17
2353da0436e9SJames Smart 	uint32_t word18;
2354da0436e9SJames Smart #define lpfc_mbx_rd_conf_wq_count_SHIFT		0
2355da0436e9SJames Smart #define lpfc_mbx_rd_conf_wq_count_MASK		0x0000FFFF
2356da0436e9SJames Smart #define lpfc_mbx_rd_conf_wq_count_WORD		word18
2357da0436e9SJames Smart #define lpfc_mbx_rd_conf_cq_count_SHIFT		16
2358da0436e9SJames Smart #define lpfc_mbx_rd_conf_cq_count_MASK		0x0000FFFF
2359da0436e9SJames Smart #define lpfc_mbx_rd_conf_cq_count_WORD		word18
2360da0436e9SJames Smart };
2361da0436e9SJames Smart 
2362da0436e9SJames Smart struct lpfc_mbx_request_features {
2363da0436e9SJames Smart 	uint32_t word1;
2364da0436e9SJames Smart #define lpfc_mbx_rq_ftr_qry_SHIFT		0
2365da0436e9SJames Smart #define lpfc_mbx_rq_ftr_qry_MASK		0x00000001
2366da0436e9SJames Smart #define lpfc_mbx_rq_ftr_qry_WORD		word1
2367da0436e9SJames Smart 	uint32_t word2;
2368da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_iaab_SHIFT		0
2369da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_iaab_MASK		0x00000001
2370da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_iaab_WORD		word2
2371da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_npiv_SHIFT		1
2372da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_npiv_MASK		0x00000001
2373da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_npiv_WORD		word2
2374da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_dif_SHIFT		2
2375da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_dif_MASK		0x00000001
2376da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_dif_WORD		word2
2377da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_vf_SHIFT		3
2378da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_vf_MASK		0x00000001
2379da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_vf_WORD		word2
2380da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_fcpi_SHIFT		4
2381da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_fcpi_MASK		0x00000001
2382da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_fcpi_WORD		word2
2383da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_fcpt_SHIFT		5
2384da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_fcpt_MASK		0x00000001
2385da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_fcpt_WORD		word2
2386da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_fcpc_SHIFT		6
2387da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_fcpc_MASK		0x00000001
2388da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_fcpc_WORD		word2
2389da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_ifip_SHIFT		7
2390da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_ifip_MASK		0x00000001
2391da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rq_ifip_WORD		word2
2392fedd3b7bSJames Smart #define lpfc_mbx_rq_ftr_rq_perfh_SHIFT		11
2393fedd3b7bSJames Smart #define lpfc_mbx_rq_ftr_rq_perfh_MASK		0x00000001
2394fedd3b7bSJames Smart #define lpfc_mbx_rq_ftr_rq_perfh_WORD		word2
2395da0436e9SJames Smart 	uint32_t word3;
2396da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_iaab_SHIFT		0
2397da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_iaab_MASK		0x00000001
2398da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_iaab_WORD		word3
2399da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_npiv_SHIFT		1
2400da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_npiv_MASK		0x00000001
2401da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_npiv_WORD		word3
2402da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_dif_SHIFT		2
2403da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_dif_MASK		0x00000001
2404da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_dif_WORD		word3
2405da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_vf_SHIFT		3
2406da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_vf__MASK		0x00000001
2407da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_vf_WORD		word3
2408da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_fcpi_SHIFT		4
2409da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_fcpi_MASK		0x00000001
2410da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_fcpi_WORD		word3
2411da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_fcpt_SHIFT		5
2412da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_fcpt_MASK		0x00000001
2413da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_fcpt_WORD		word3
2414da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_fcpc_SHIFT		6
2415da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_fcpc_MASK		0x00000001
2416da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_fcpc_WORD		word3
2417da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_ifip_SHIFT		7
2418da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_ifip_MASK		0x00000001
2419da0436e9SJames Smart #define lpfc_mbx_rq_ftr_rsp_ifip_WORD		word3
2420fedd3b7bSJames Smart #define lpfc_mbx_rq_ftr_rsp_perfh_SHIFT		11
2421fedd3b7bSJames Smart #define lpfc_mbx_rq_ftr_rsp_perfh_MASK		0x00000001
2422fedd3b7bSJames Smart #define lpfc_mbx_rq_ftr_rsp_perfh_WORD		word3
2423da0436e9SJames Smart };
2424da0436e9SJames Smart 
242528baac74SJames Smart struct lpfc_mbx_supp_pages {
242628baac74SJames Smart 	uint32_t word1;
242728baac74SJames Smart #define qs_SHIFT 				0
242828baac74SJames Smart #define qs_MASK					0x00000001
242928baac74SJames Smart #define qs_WORD					word1
243028baac74SJames Smart #define wr_SHIFT				1
243128baac74SJames Smart #define wr_MASK 				0x00000001
243228baac74SJames Smart #define wr_WORD					word1
243328baac74SJames Smart #define pf_SHIFT				8
243428baac74SJames Smart #define pf_MASK					0x000000ff
243528baac74SJames Smart #define pf_WORD					word1
243628baac74SJames Smart #define cpn_SHIFT				16
243728baac74SJames Smart #define cpn_MASK				0x000000ff
243828baac74SJames Smart #define cpn_WORD				word1
243928baac74SJames Smart 	uint32_t word2;
244028baac74SJames Smart #define list_offset_SHIFT 			0
244128baac74SJames Smart #define list_offset_MASK			0x000000ff
244228baac74SJames Smart #define list_offset_WORD			word2
244328baac74SJames Smart #define next_offset_SHIFT			8
244428baac74SJames Smart #define next_offset_MASK			0x000000ff
244528baac74SJames Smart #define next_offset_WORD			word2
244628baac74SJames Smart #define elem_cnt_SHIFT				16
244728baac74SJames Smart #define elem_cnt_MASK				0x000000ff
244828baac74SJames Smart #define elem_cnt_WORD				word2
244928baac74SJames Smart 	uint32_t word3;
245028baac74SJames Smart #define pn_0_SHIFT				24
245128baac74SJames Smart #define pn_0_MASK  				0x000000ff
245228baac74SJames Smart #define pn_0_WORD				word3
245328baac74SJames Smart #define pn_1_SHIFT				16
245428baac74SJames Smart #define pn_1_MASK				0x000000ff
245528baac74SJames Smart #define pn_1_WORD				word3
245628baac74SJames Smart #define pn_2_SHIFT				8
245728baac74SJames Smart #define pn_2_MASK				0x000000ff
245828baac74SJames Smart #define pn_2_WORD				word3
245928baac74SJames Smart #define pn_3_SHIFT				0
246028baac74SJames Smart #define pn_3_MASK				0x000000ff
246128baac74SJames Smart #define pn_3_WORD				word3
246228baac74SJames Smart 	uint32_t word4;
246328baac74SJames Smart #define pn_4_SHIFT				24
246428baac74SJames Smart #define pn_4_MASK				0x000000ff
246528baac74SJames Smart #define pn_4_WORD				word4
246628baac74SJames Smart #define pn_5_SHIFT				16
246728baac74SJames Smart #define pn_5_MASK				0x000000ff
246828baac74SJames Smart #define pn_5_WORD				word4
246928baac74SJames Smart #define pn_6_SHIFT				8
247028baac74SJames Smart #define pn_6_MASK				0x000000ff
247128baac74SJames Smart #define pn_6_WORD				word4
247228baac74SJames Smart #define pn_7_SHIFT				0
247328baac74SJames Smart #define pn_7_MASK				0x000000ff
247428baac74SJames Smart #define pn_7_WORD				word4
247528baac74SJames Smart 	uint32_t rsvd[27];
247628baac74SJames Smart #define LPFC_SUPP_PAGES			0
247728baac74SJames Smart #define LPFC_BLOCK_GUARD_PROFILES	1
247828baac74SJames Smart #define LPFC_SLI4_PARAMETERS		2
247928baac74SJames Smart };
248028baac74SJames Smart 
248186478875SJames Smart struct lpfc_mbx_memory_dump_type3 {
248286478875SJames Smart 	uint32_t word1;
248386478875SJames Smart #define lpfc_mbx_memory_dump_type3_type_SHIFT    0
248486478875SJames Smart #define lpfc_mbx_memory_dump_type3_type_MASK     0x0000000f
248586478875SJames Smart #define lpfc_mbx_memory_dump_type3_type_WORD     word1
248686478875SJames Smart #define lpfc_mbx_memory_dump_type3_link_SHIFT    24
248786478875SJames Smart #define lpfc_mbx_memory_dump_type3_link_MASK     0x000000ff
248886478875SJames Smart #define lpfc_mbx_memory_dump_type3_link_WORD     word1
248986478875SJames Smart 	uint32_t word2;
249086478875SJames Smart #define lpfc_mbx_memory_dump_type3_page_no_SHIFT  0
249186478875SJames Smart #define lpfc_mbx_memory_dump_type3_page_no_MASK   0x0000ffff
249286478875SJames Smart #define lpfc_mbx_memory_dump_type3_page_no_WORD   word2
249386478875SJames Smart #define lpfc_mbx_memory_dump_type3_offset_SHIFT   16
249486478875SJames Smart #define lpfc_mbx_memory_dump_type3_offset_MASK    0x0000ffff
249586478875SJames Smart #define lpfc_mbx_memory_dump_type3_offset_WORD    word2
249686478875SJames Smart 	uint32_t word3;
249786478875SJames Smart #define lpfc_mbx_memory_dump_type3_length_SHIFT  0
249886478875SJames Smart #define lpfc_mbx_memory_dump_type3_length_MASK   0x00ffffff
249986478875SJames Smart #define lpfc_mbx_memory_dump_type3_length_WORD   word3
250086478875SJames Smart 	uint32_t addr_lo;
250186478875SJames Smart 	uint32_t addr_hi;
250286478875SJames Smart 	uint32_t return_len;
250386478875SJames Smart };
250486478875SJames Smart 
250586478875SJames Smart #define DMP_PAGE_A0             0xa0
250686478875SJames Smart #define DMP_PAGE_A2             0xa2
250786478875SJames Smart #define DMP_SFF_PAGE_A0_SIZE	256
250886478875SJames Smart #define DMP_SFF_PAGE_A2_SIZE	256
250986478875SJames Smart 
251086478875SJames Smart #define SFP_WAVELENGTH_LC1310	1310
251186478875SJames Smart #define SFP_WAVELENGTH_LL1550	1550
251286478875SJames Smart 
251386478875SJames Smart 
251486478875SJames Smart /*
251586478875SJames Smart  *  * SFF-8472 TABLE 3.4
251686478875SJames Smart  *   */
251786478875SJames Smart #define  SFF_PG0_CONNECTOR_UNKNOWN    0x00   /* Unknown  */
251886478875SJames Smart #define  SFF_PG0_CONNECTOR_SC         0x01   /* SC       */
251986478875SJames Smart #define  SFF_PG0_CONNECTOR_FC_COPPER1 0x02   /* FC style 1 copper connector */
252086478875SJames Smart #define  SFF_PG0_CONNECTOR_FC_COPPER2 0x03   /* FC style 2 copper connector */
252186478875SJames Smart #define  SFF_PG0_CONNECTOR_BNC        0x04   /* BNC / TNC */
252286478875SJames Smart #define  SFF_PG0_CONNECTOR__FC_COAX   0x05   /* FC coaxial headers */
252386478875SJames Smart #define  SFF_PG0_CONNECTOR_FIBERJACK  0x06   /* FiberJack */
252486478875SJames Smart #define  SFF_PG0_CONNECTOR_LC         0x07   /* LC        */
252586478875SJames Smart #define  SFF_PG0_CONNECTOR_MT         0x08   /* MT - RJ   */
252686478875SJames Smart #define  SFF_PG0_CONNECTOR_MU         0x09   /* MU        */
252786478875SJames Smart #define  SFF_PG0_CONNECTOR_SF         0x0A   /* SG        */
252886478875SJames Smart #define  SFF_PG0_CONNECTOR_OPTICAL_PIGTAIL 0x0B /* Optical pigtail */
252986478875SJames Smart #define  SFF_PG0_CONNECTOR_OPTICAL_PARALLEL 0x0C /* MPO Parallel Optic */
253086478875SJames Smart #define  SFF_PG0_CONNECTOR_HSSDC_II   0x20   /* HSSDC II */
253186478875SJames Smart #define  SFF_PG0_CONNECTOR_COPPER_PIGTAIL 0x21 /* Copper pigtail */
253286478875SJames Smart #define  SFF_PG0_CONNECTOR_RJ45       0x22  /* RJ45 */
253386478875SJames Smart 
253486478875SJames Smart /* SFF-8472 Table 3.1 Diagnostics: Data Fields Address/Page A0 */
253586478875SJames Smart 
253686478875SJames Smart #define SSF_IDENTIFIER			0
253786478875SJames Smart #define SSF_EXT_IDENTIFIER		1
253886478875SJames Smart #define SSF_CONNECTOR			2
253986478875SJames Smart #define SSF_TRANSCEIVER_CODE_B0		3
254086478875SJames Smart #define SSF_TRANSCEIVER_CODE_B1		4
254186478875SJames Smart #define SSF_TRANSCEIVER_CODE_B2		5
254286478875SJames Smart #define SSF_TRANSCEIVER_CODE_B3		6
254386478875SJames Smart #define SSF_TRANSCEIVER_CODE_B4		7
254486478875SJames Smart #define SSF_TRANSCEIVER_CODE_B5		8
254586478875SJames Smart #define SSF_TRANSCEIVER_CODE_B6		9
254686478875SJames Smart #define SSF_TRANSCEIVER_CODE_B7		10
254786478875SJames Smart #define SSF_ENCODING			11
254886478875SJames Smart #define SSF_BR_NOMINAL			12
254986478875SJames Smart #define SSF_RATE_IDENTIFIER		13
255086478875SJames Smart #define SSF_LENGTH_9UM_KM		14
255186478875SJames Smart #define SSF_LENGTH_9UM			15
255286478875SJames Smart #define SSF_LENGTH_50UM_OM2		16
255386478875SJames Smart #define SSF_LENGTH_62UM_OM1		17
255486478875SJames Smart #define SFF_LENGTH_COPPER		18
255586478875SJames Smart #define SSF_LENGTH_50UM_OM3		19
255686478875SJames Smart #define SSF_VENDOR_NAME			20
255786478875SJames Smart #define SSF_VENDOR_OUI			36
255886478875SJames Smart #define SSF_VENDOR_PN			40
255986478875SJames Smart #define SSF_VENDOR_REV			56
256086478875SJames Smart #define SSF_WAVELENGTH_B1		60
256186478875SJames Smart #define SSF_WAVELENGTH_B0		61
256286478875SJames Smart #define SSF_CC_BASE			63
256386478875SJames Smart #define SSF_OPTIONS_B1			64
256486478875SJames Smart #define SSF_OPTIONS_B0			65
256586478875SJames Smart #define SSF_BR_MAX			66
256686478875SJames Smart #define SSF_BR_MIN			67
256786478875SJames Smart #define SSF_VENDOR_SN			68
256886478875SJames Smart #define SSF_DATE_CODE			84
256986478875SJames Smart #define SSF_MONITORING_TYPEDIAGNOSTIC	92
257086478875SJames Smart #define SSF_ENHANCED_OPTIONS		93
257186478875SJames Smart #define SFF_8472_COMPLIANCE		94
257286478875SJames Smart #define SSF_CC_EXT			95
257386478875SJames Smart #define SSF_A0_VENDOR_SPECIFIC		96
257486478875SJames Smart 
257586478875SJames Smart /* SFF-8472 Table 3.1a Diagnostics: Data Fields Address/Page A2 */
257686478875SJames Smart 
257756204984SJames Smart #define SSF_TEMP_HIGH_ALARM		0
257856204984SJames Smart #define SSF_TEMP_LOW_ALARM		2
257956204984SJames Smart #define SSF_TEMP_HIGH_WARNING		4
258056204984SJames Smart #define SSF_TEMP_LOW_WARNING		6
258156204984SJames Smart #define SSF_VOLTAGE_HIGH_ALARM		8
258256204984SJames Smart #define SSF_VOLTAGE_LOW_ALARM		10
258356204984SJames Smart #define SSF_VOLTAGE_HIGH_WARNING	12
258456204984SJames Smart #define SSF_VOLTAGE_LOW_WARNING		14
258556204984SJames Smart #define SSF_BIAS_HIGH_ALARM		16
258656204984SJames Smart #define SSF_BIAS_LOW_ALARM		18
258756204984SJames Smart #define SSF_BIAS_HIGH_WARNING		20
258856204984SJames Smart #define SSF_BIAS_LOW_WARNING		22
258956204984SJames Smart #define SSF_TXPOWER_HIGH_ALARM		24
259056204984SJames Smart #define SSF_TXPOWER_LOW_ALARM		26
259156204984SJames Smart #define SSF_TXPOWER_HIGH_WARNING	28
259256204984SJames Smart #define SSF_TXPOWER_LOW_WARNING		30
259356204984SJames Smart #define SSF_RXPOWER_HIGH_ALARM		32
259456204984SJames Smart #define SSF_RXPOWER_LOW_ALARM		34
259556204984SJames Smart #define SSF_RXPOWER_HIGH_WARNING	36
259656204984SJames Smart #define SSF_RXPOWER_LOW_WARNING		38
259786478875SJames Smart #define SSF_EXT_CAL_CONSTANTS		56
259886478875SJames Smart #define SSF_CC_DMI			95
259986478875SJames Smart #define SFF_TEMPERATURE_B1		96
260086478875SJames Smart #define SFF_TEMPERATURE_B0		97
260186478875SJames Smart #define SFF_VCC_B1			98
260286478875SJames Smart #define SFF_VCC_B0			99
260386478875SJames Smart #define SFF_TX_BIAS_CURRENT_B1		100
260486478875SJames Smart #define SFF_TX_BIAS_CURRENT_B0		101
260586478875SJames Smart #define SFF_TXPOWER_B1			102
260686478875SJames Smart #define SFF_TXPOWER_B0			103
260786478875SJames Smart #define SFF_RXPOWER_B1			104
260886478875SJames Smart #define SFF_RXPOWER_B0			105
260986478875SJames Smart #define SSF_STATUS_CONTROL		110
2610310429efSJames Smart #define SSF_ALARM_FLAGS			112
2611310429efSJames Smart #define SSF_WARNING_FLAGS		116
261286478875SJames Smart #define SSF_EXT_TATUS_CONTROL_B1	118
261386478875SJames Smart #define SSF_EXT_TATUS_CONTROL_B0	119
261486478875SJames Smart #define SSF_A2_VENDOR_SPECIFIC		120
261586478875SJames Smart #define SSF_USER_EEPROM			128
261686478875SJames Smart #define SSF_VENDOR_CONTROL		148
261786478875SJames Smart 
261886478875SJames Smart 
261986478875SJames Smart /*
262086478875SJames Smart  * Tranceiver codes Fibre Channel SFF-8472
262186478875SJames Smart  * Table 3.5.
262286478875SJames Smart  */
262386478875SJames Smart 
262486478875SJames Smart struct sff_trasnceiver_codes_byte0 {
262586478875SJames Smart 	uint8_t inifiband:4;
262686478875SJames Smart 	uint8_t teng_ethernet:4;
262786478875SJames Smart };
262886478875SJames Smart 
262986478875SJames Smart struct sff_trasnceiver_codes_byte1 {
263086478875SJames Smart 	uint8_t  sonet:6;
263186478875SJames Smart 	uint8_t  escon:2;
263286478875SJames Smart };
263386478875SJames Smart 
263486478875SJames Smart struct sff_trasnceiver_codes_byte2 {
263586478875SJames Smart 	uint8_t  soNet:8;
263686478875SJames Smart };
263786478875SJames Smart 
263886478875SJames Smart struct sff_trasnceiver_codes_byte3 {
263986478875SJames Smart 	uint8_t ethernet:8;
264086478875SJames Smart };
264186478875SJames Smart 
264286478875SJames Smart struct sff_trasnceiver_codes_byte4 {
264386478875SJames Smart 	uint8_t fc_el_lo:1;
264486478875SJames Smart 	uint8_t fc_lw_laser:1;
264586478875SJames Smart 	uint8_t fc_sw_laser:1;
264686478875SJames Smart 	uint8_t fc_md_distance:1;
264786478875SJames Smart 	uint8_t fc_lg_distance:1;
264886478875SJames Smart 	uint8_t fc_int_distance:1;
264986478875SJames Smart 	uint8_t fc_short_distance:1;
265086478875SJames Smart 	uint8_t fc_vld_distance:1;
265186478875SJames Smart };
265286478875SJames Smart 
265386478875SJames Smart struct sff_trasnceiver_codes_byte5 {
265486478875SJames Smart 	uint8_t reserved1:1;
265586478875SJames Smart 	uint8_t reserved2:1;
265686478875SJames Smart 	uint8_t fc_sfp_active:1;  /* Active cable   */
265786478875SJames Smart 	uint8_t fc_sfp_passive:1; /* Passive cable  */
265886478875SJames Smart 	uint8_t fc_lw_laser:1;     /* Longwave laser */
265986478875SJames Smart 	uint8_t fc_sw_laser_sl:1;
266086478875SJames Smart 	uint8_t fc_sw_laser_sn:1;
266186478875SJames Smart 	uint8_t fc_el_hi:1;        /* Electrical enclosure high bit */
266286478875SJames Smart };
266386478875SJames Smart 
266486478875SJames Smart struct sff_trasnceiver_codes_byte6 {
266586478875SJames Smart 	uint8_t fc_tm_sm:1;      /* Single Mode */
266686478875SJames Smart 	uint8_t reserved:1;
266786478875SJames Smart 	uint8_t fc_tm_m6:1;       /* Multimode, 62.5um (M6) */
266886478875SJames Smart 	uint8_t fc_tm_tv:1;      /* Video Coax (TV) */
266986478875SJames Smart 	uint8_t fc_tm_mi:1;      /* Miniature Coax (MI) */
267086478875SJames Smart 	uint8_t fc_tm_tp:1;      /* Twisted Pair (TP) */
267186478875SJames Smart 	uint8_t fc_tm_tw:1;      /* Twin Axial Pair  */
267286478875SJames Smart };
267386478875SJames Smart 
267486478875SJames Smart struct sff_trasnceiver_codes_byte7 {
267586478875SJames Smart 	uint8_t fc_sp_100MB:1;   /*  100 MB/sec */
267686478875SJames Smart 	uint8_t reserve:1;
267786478875SJames Smart 	uint8_t fc_sp_200mb:1;   /*  200 MB/sec */
267886478875SJames Smart 	uint8_t fc_sp_3200MB:1;  /* 3200 MB/sec */
267986478875SJames Smart 	uint8_t fc_sp_400MB:1;   /*  400 MB/sec */
268086478875SJames Smart 	uint8_t fc_sp_1600MB:1;  /* 1600 MB/sec */
268186478875SJames Smart 	uint8_t fc_sp_800MB:1;   /*  800 MB/sec */
268286478875SJames Smart 	uint8_t fc_sp_1200MB:1;  /* 1200 MB/sec */
268386478875SJames Smart };
268486478875SJames Smart 
268586478875SJames Smart /* User writable non-volatile memory, SFF-8472 Table 3.20 */
268686478875SJames Smart struct user_eeprom {
268786478875SJames Smart 	uint8_t vendor_name[16];
268886478875SJames Smart 	uint8_t vendor_oui[3];
268986478875SJames Smart 	uint8_t vendor_pn[816];
269086478875SJames Smart 	uint8_t vendor_rev[4];
269186478875SJames Smart 	uint8_t vendor_sn[16];
269286478875SJames Smart 	uint8_t datecode[6];
269386478875SJames Smart 	uint8_t lot_code[2];
269486478875SJames Smart 	uint8_t reserved191[57];
269586478875SJames Smart };
269686478875SJames Smart 
2697fedd3b7bSJames Smart struct lpfc_mbx_pc_sli4_params {
269828baac74SJames Smart 	uint32_t word1;
269928baac74SJames Smart #define qs_SHIFT				0
270028baac74SJames Smart #define qs_MASK					0x00000001
270128baac74SJames Smart #define qs_WORD					word1
270228baac74SJames Smart #define wr_SHIFT				1
270328baac74SJames Smart #define wr_MASK					0x00000001
270428baac74SJames Smart #define wr_WORD					word1
270528baac74SJames Smart #define pf_SHIFT				8
270628baac74SJames Smart #define pf_MASK					0x000000ff
270728baac74SJames Smart #define pf_WORD					word1
270828baac74SJames Smart #define cpn_SHIFT				16
270928baac74SJames Smart #define cpn_MASK				0x000000ff
271028baac74SJames Smart #define cpn_WORD				word1
271128baac74SJames Smart 	uint32_t word2;
271228baac74SJames Smart #define if_type_SHIFT				0
271328baac74SJames Smart #define if_type_MASK				0x00000007
271428baac74SJames Smart #define if_type_WORD				word2
271528baac74SJames Smart #define sli_rev_SHIFT				4
271628baac74SJames Smart #define sli_rev_MASK				0x0000000f
271728baac74SJames Smart #define sli_rev_WORD				word2
271828baac74SJames Smart #define sli_family_SHIFT			8
271928baac74SJames Smart #define sli_family_MASK				0x000000ff
272028baac74SJames Smart #define sli_family_WORD				word2
272128baac74SJames Smart #define featurelevel_1_SHIFT			16
272228baac74SJames Smart #define featurelevel_1_MASK			0x000000ff
272328baac74SJames Smart #define featurelevel_1_WORD			word2
272428baac74SJames Smart #define featurelevel_2_SHIFT			24
272528baac74SJames Smart #define featurelevel_2_MASK			0x0000001f
272628baac74SJames Smart #define featurelevel_2_WORD			word2
272728baac74SJames Smart 	uint32_t word3;
272828baac74SJames Smart #define fcoe_SHIFT 				0
272928baac74SJames Smart #define fcoe_MASK				0x00000001
273028baac74SJames Smart #define fcoe_WORD				word3
273128baac74SJames Smart #define fc_SHIFT				1
273228baac74SJames Smart #define fc_MASK					0x00000001
273328baac74SJames Smart #define fc_WORD					word3
273428baac74SJames Smart #define nic_SHIFT				2
273528baac74SJames Smart #define nic_MASK				0x00000001
273628baac74SJames Smart #define nic_WORD				word3
273728baac74SJames Smart #define iscsi_SHIFT				3
273828baac74SJames Smart #define iscsi_MASK				0x00000001
273928baac74SJames Smart #define iscsi_WORD				word3
274028baac74SJames Smart #define rdma_SHIFT				4
274128baac74SJames Smart #define rdma_MASK				0x00000001
274228baac74SJames Smart #define rdma_WORD				word3
274328baac74SJames Smart 	uint32_t sge_supp_len;
2744cb5172eaSJames Smart #define SLI4_PAGE_SIZE 4096
274528baac74SJames Smart 	uint32_t word5;
274628baac74SJames Smart #define if_page_sz_SHIFT			0
274728baac74SJames Smart #define if_page_sz_MASK				0x0000ffff
274828baac74SJames Smart #define if_page_sz_WORD				word5
274928baac74SJames Smart #define loopbk_scope_SHIFT			24
275028baac74SJames Smart #define loopbk_scope_MASK			0x0000000f
275128baac74SJames Smart #define loopbk_scope_WORD			word5
275228baac74SJames Smart #define rq_db_window_SHIFT			28
275328baac74SJames Smart #define rq_db_window_MASK			0x0000000f
275428baac74SJames Smart #define rq_db_window_WORD			word5
275528baac74SJames Smart 	uint32_t word6;
275628baac74SJames Smart #define eq_pages_SHIFT				0
275728baac74SJames Smart #define eq_pages_MASK				0x0000000f
275828baac74SJames Smart #define eq_pages_WORD				word6
275928baac74SJames Smart #define eqe_size_SHIFT				8
276028baac74SJames Smart #define eqe_size_MASK				0x000000ff
276128baac74SJames Smart #define eqe_size_WORD				word6
276228baac74SJames Smart 	uint32_t word7;
276328baac74SJames Smart #define cq_pages_SHIFT				0
276428baac74SJames Smart #define cq_pages_MASK				0x0000000f
276528baac74SJames Smart #define cq_pages_WORD				word7
276628baac74SJames Smart #define cqe_size_SHIFT				8
276728baac74SJames Smart #define cqe_size_MASK				0x000000ff
276828baac74SJames Smart #define cqe_size_WORD				word7
276928baac74SJames Smart 	uint32_t word8;
277028baac74SJames Smart #define mq_pages_SHIFT				0
277128baac74SJames Smart #define mq_pages_MASK				0x0000000f
277228baac74SJames Smart #define mq_pages_WORD				word8
277328baac74SJames Smart #define mqe_size_SHIFT				8
277428baac74SJames Smart #define mqe_size_MASK				0x000000ff
277528baac74SJames Smart #define mqe_size_WORD				word8
277628baac74SJames Smart #define mq_elem_cnt_SHIFT			16
277728baac74SJames Smart #define mq_elem_cnt_MASK			0x000000ff
277828baac74SJames Smart #define mq_elem_cnt_WORD			word8
277928baac74SJames Smart 	uint32_t word9;
278028baac74SJames Smart #define wq_pages_SHIFT				0
278128baac74SJames Smart #define wq_pages_MASK				0x0000ffff
278228baac74SJames Smart #define wq_pages_WORD				word9
278328baac74SJames Smart #define wqe_size_SHIFT				8
278428baac74SJames Smart #define wqe_size_MASK				0x000000ff
278528baac74SJames Smart #define wqe_size_WORD				word9
278628baac74SJames Smart 	uint32_t word10;
278728baac74SJames Smart #define rq_pages_SHIFT				0
278828baac74SJames Smart #define rq_pages_MASK				0x0000ffff
278928baac74SJames Smart #define rq_pages_WORD				word10
279028baac74SJames Smart #define rqe_size_SHIFT				8
279128baac74SJames Smart #define rqe_size_MASK				0x000000ff
279228baac74SJames Smart #define rqe_size_WORD				word10
279328baac74SJames Smart 	uint32_t word11;
279428baac74SJames Smart #define hdr_pages_SHIFT				0
279528baac74SJames Smart #define hdr_pages_MASK				0x0000000f
279628baac74SJames Smart #define hdr_pages_WORD				word11
279728baac74SJames Smart #define hdr_size_SHIFT				8
279828baac74SJames Smart #define hdr_size_MASK				0x0000000f
279928baac74SJames Smart #define hdr_size_WORD				word11
280028baac74SJames Smart #define hdr_pp_align_SHIFT			16
280128baac74SJames Smart #define hdr_pp_align_MASK			0x0000ffff
280228baac74SJames Smart #define hdr_pp_align_WORD			word11
280328baac74SJames Smart 	uint32_t word12;
280428baac74SJames Smart #define sgl_pages_SHIFT				0
280528baac74SJames Smart #define sgl_pages_MASK				0x0000000f
280628baac74SJames Smart #define sgl_pages_WORD				word12
280728baac74SJames Smart #define sgl_pp_align_SHIFT			16
280828baac74SJames Smart #define sgl_pp_align_MASK			0x0000ffff
280928baac74SJames Smart #define sgl_pp_align_WORD			word12
281028baac74SJames Smart 	uint32_t rsvd_13_63[51];
281128baac74SJames Smart };
28129589b062SJames Smart #define SLI4_PAGE_ALIGN(addr) (((addr)+((SLI4_PAGE_SIZE)-1)) \
28139589b062SJames Smart 			       &(~((SLI4_PAGE_SIZE)-1)))
281428baac74SJames Smart 
2815fedd3b7bSJames Smart struct lpfc_sli4_parameters {
2816fedd3b7bSJames Smart 	uint32_t word0;
2817fedd3b7bSJames Smart #define cfg_prot_type_SHIFT			0
2818fedd3b7bSJames Smart #define cfg_prot_type_MASK			0x000000FF
2819fedd3b7bSJames Smart #define cfg_prot_type_WORD			word0
2820fedd3b7bSJames Smart 	uint32_t word1;
2821fedd3b7bSJames Smart #define cfg_ft_SHIFT				0
2822fedd3b7bSJames Smart #define cfg_ft_MASK				0x00000001
2823fedd3b7bSJames Smart #define cfg_ft_WORD				word1
2824fedd3b7bSJames Smart #define cfg_sli_rev_SHIFT			4
2825fedd3b7bSJames Smart #define cfg_sli_rev_MASK			0x0000000f
2826fedd3b7bSJames Smart #define cfg_sli_rev_WORD			word1
2827fedd3b7bSJames Smart #define cfg_sli_family_SHIFT			8
2828fedd3b7bSJames Smart #define cfg_sli_family_MASK			0x0000000f
2829fedd3b7bSJames Smart #define cfg_sli_family_WORD			word1
2830fedd3b7bSJames Smart #define cfg_if_type_SHIFT			12
2831fedd3b7bSJames Smart #define cfg_if_type_MASK			0x0000000f
2832fedd3b7bSJames Smart #define cfg_if_type_WORD			word1
2833fedd3b7bSJames Smart #define cfg_sli_hint_1_SHIFT			16
2834fedd3b7bSJames Smart #define cfg_sli_hint_1_MASK			0x000000ff
2835fedd3b7bSJames Smart #define cfg_sli_hint_1_WORD			word1
2836fedd3b7bSJames Smart #define cfg_sli_hint_2_SHIFT			24
2837fedd3b7bSJames Smart #define cfg_sli_hint_2_MASK			0x0000001f
2838fedd3b7bSJames Smart #define cfg_sli_hint_2_WORD			word1
2839fedd3b7bSJames Smart 	uint32_t word2;
2840fedd3b7bSJames Smart 	uint32_t word3;
2841fedd3b7bSJames Smart 	uint32_t word4;
2842fedd3b7bSJames Smart #define cfg_cqv_SHIFT				14
2843fedd3b7bSJames Smart #define cfg_cqv_MASK				0x00000003
2844fedd3b7bSJames Smart #define cfg_cqv_WORD				word4
2845fedd3b7bSJames Smart 	uint32_t word5;
2846fedd3b7bSJames Smart 	uint32_t word6;
2847fedd3b7bSJames Smart #define cfg_mqv_SHIFT				14
2848fedd3b7bSJames Smart #define cfg_mqv_MASK				0x00000003
2849fedd3b7bSJames Smart #define cfg_mqv_WORD				word6
2850fedd3b7bSJames Smart 	uint32_t word7;
2851fedd3b7bSJames Smart 	uint32_t word8;
2852895427bdSJames Smart #define cfg_wqpcnt_SHIFT			0
2853895427bdSJames Smart #define cfg_wqpcnt_MASK				0x0000000f
2854895427bdSJames Smart #define cfg_wqpcnt_WORD				word8
28550c651878SJames Smart #define cfg_wqsize_SHIFT			8
28560c651878SJames Smart #define cfg_wqsize_MASK				0x0000000f
28570c651878SJames Smart #define cfg_wqsize_WORD				word8
2858fedd3b7bSJames Smart #define cfg_wqv_SHIFT				14
2859fedd3b7bSJames Smart #define cfg_wqv_MASK				0x00000003
2860fedd3b7bSJames Smart #define cfg_wqv_WORD				word8
2861895427bdSJames Smart #define cfg_wqpsize_SHIFT			16
2862895427bdSJames Smart #define cfg_wqpsize_MASK			0x000000ff
2863895427bdSJames Smart #define cfg_wqpsize_WORD			word8
2864fedd3b7bSJames Smart 	uint32_t word9;
2865fedd3b7bSJames Smart 	uint32_t word10;
2866fedd3b7bSJames Smart #define cfg_rqv_SHIFT				14
2867fedd3b7bSJames Smart #define cfg_rqv_MASK				0x00000003
2868fedd3b7bSJames Smart #define cfg_rqv_WORD				word10
2869fedd3b7bSJames Smart 	uint32_t word11;
2870fedd3b7bSJames Smart #define cfg_rq_db_window_SHIFT			28
2871fedd3b7bSJames Smart #define cfg_rq_db_window_MASK			0x0000000f
2872fedd3b7bSJames Smart #define cfg_rq_db_window_WORD			word11
2873fedd3b7bSJames Smart 	uint32_t word12;
2874fedd3b7bSJames Smart #define cfg_fcoe_SHIFT				0
2875fedd3b7bSJames Smart #define cfg_fcoe_MASK				0x00000001
2876fedd3b7bSJames Smart #define cfg_fcoe_WORD				word12
28776d368e53SJames Smart #define cfg_ext_SHIFT				1
28786d368e53SJames Smart #define cfg_ext_MASK				0x00000001
28796d368e53SJames Smart #define cfg_ext_WORD				word12
28806d368e53SJames Smart #define cfg_hdrr_SHIFT				2
28816d368e53SJames Smart #define cfg_hdrr_MASK				0x00000001
28826d368e53SJames Smart #define cfg_hdrr_WORD				word12
2883fedd3b7bSJames Smart #define cfg_phwq_SHIFT				15
2884fedd3b7bSJames Smart #define cfg_phwq_MASK				0x00000001
2885fedd3b7bSJames Smart #define cfg_phwq_WORD				word12
28861ba981fdSJames Smart #define cfg_oas_SHIFT				25
28871ba981fdSJames Smart #define cfg_oas_MASK				0x00000001
28881ba981fdSJames Smart #define cfg_oas_WORD				word12
2889fedd3b7bSJames Smart #define cfg_loopbk_scope_SHIFT			28
2890fedd3b7bSJames Smart #define cfg_loopbk_scope_MASK			0x0000000f
2891fedd3b7bSJames Smart #define cfg_loopbk_scope_WORD			word12
2892fedd3b7bSJames Smart 	uint32_t sge_supp_len;
2893fedd3b7bSJames Smart 	uint32_t word14;
2894fedd3b7bSJames Smart #define cfg_sgl_page_cnt_SHIFT			0
2895fedd3b7bSJames Smart #define cfg_sgl_page_cnt_MASK			0x0000000f
2896fedd3b7bSJames Smart #define cfg_sgl_page_cnt_WORD			word14
2897fedd3b7bSJames Smart #define cfg_sgl_page_size_SHIFT			8
2898fedd3b7bSJames Smart #define cfg_sgl_page_size_MASK			0x000000ff
2899fedd3b7bSJames Smart #define cfg_sgl_page_size_WORD			word14
2900fedd3b7bSJames Smart #define cfg_sgl_pp_align_SHIFT			16
2901fedd3b7bSJames Smart #define cfg_sgl_pp_align_MASK			0x000000ff
2902fedd3b7bSJames Smart #define cfg_sgl_pp_align_WORD			word14
2903fedd3b7bSJames Smart 	uint32_t word15;
2904fedd3b7bSJames Smart 	uint32_t word16;
2905fedd3b7bSJames Smart 	uint32_t word17;
2906fedd3b7bSJames Smart 	uint32_t word18;
2907fedd3b7bSJames Smart 	uint32_t word19;
2908b5c53958SJames Smart #define cfg_ext_embed_cb_SHIFT			0
2909b5c53958SJames Smart #define cfg_ext_embed_cb_MASK			0x00000001
2910b5c53958SJames Smart #define cfg_ext_embed_cb_WORD			word19
29117bdedb34SJames Smart #define cfg_mds_diags_SHIFT			1
29127bdedb34SJames Smart #define cfg_mds_diags_MASK			0x00000001
29137bdedb34SJames Smart #define cfg_mds_diags_WORD			word19
2914895427bdSJames Smart #define cfg_nvme_SHIFT				3
2915895427bdSJames Smart #define cfg_nvme_MASK				0x00000001
2916895427bdSJames Smart #define cfg_nvme_WORD				word19
2917895427bdSJames Smart #define cfg_xib_SHIFT				4
2918895427bdSJames Smart #define cfg_xib_MASK				0x00000001
2919895427bdSJames Smart #define cfg_xib_WORD				word19
2920fedd3b7bSJames Smart };
2921fedd3b7bSJames Smart 
292265791f1fSJames Smart #define LPFC_SET_UE_RECOVERY		0x10
29237bdedb34SJames Smart #define LPFC_SET_MDS_DIAGS		0x11
292465791f1fSJames Smart struct lpfc_mbx_set_feature {
292565791f1fSJames Smart 	struct mbox_header header;
292665791f1fSJames Smart 	uint32_t feature;
292765791f1fSJames Smart 	uint32_t param_len;
292865791f1fSJames Smart 	uint32_t word6;
292965791f1fSJames Smart #define lpfc_mbx_set_feature_UER_SHIFT  0
293065791f1fSJames Smart #define lpfc_mbx_set_feature_UER_MASK   0x00000001
293165791f1fSJames Smart #define lpfc_mbx_set_feature_UER_WORD   word6
29327bdedb34SJames Smart #define lpfc_mbx_set_feature_mds_SHIFT  0
29337bdedb34SJames Smart #define lpfc_mbx_set_feature_mds_MASK   0x00000001
29347bdedb34SJames Smart #define lpfc_mbx_set_feature_mds_WORD   word6
29357bdedb34SJames Smart #define lpfc_mbx_set_feature_mds_deep_loopbk_SHIFT  1
29367bdedb34SJames Smart #define lpfc_mbx_set_feature_mds_deep_loopbk_MASK   0x00000001
29377bdedb34SJames Smart #define lpfc_mbx_set_feature_mds_deep_loopbk_WORD   word6
293865791f1fSJames Smart 	uint32_t word7;
293965791f1fSJames Smart #define lpfc_mbx_set_feature_UERP_SHIFT 0
294065791f1fSJames Smart #define lpfc_mbx_set_feature_UERP_MASK  0x0000ffff
294165791f1fSJames Smart #define lpfc_mbx_set_feature_UERP_WORD  word7
294265791f1fSJames Smart #define lpfc_mbx_set_feature_UESR_SHIFT 16
294365791f1fSJames Smart #define lpfc_mbx_set_feature_UESR_MASK  0x0000ffff
294465791f1fSJames Smart #define lpfc_mbx_set_feature_UESR_WORD  word7
294565791f1fSJames Smart };
294665791f1fSJames Smart 
294765791f1fSJames Smart 
294861bda8f7SJames Smart #define LPFC_SET_HOST_OS_DRIVER_VERSION    0x2
294961bda8f7SJames Smart struct lpfc_mbx_set_host_data {
295061bda8f7SJames Smart #define LPFC_HOST_OS_DRIVER_VERSION_SIZE   48
295161bda8f7SJames Smart 	struct mbox_header header;
295261bda8f7SJames Smart 	uint32_t param_id;
295361bda8f7SJames Smart 	uint32_t param_len;
295461bda8f7SJames Smart 	uint8_t  data[LPFC_HOST_OS_DRIVER_VERSION_SIZE];
295561bda8f7SJames Smart };
295661bda8f7SJames Smart 
295761bda8f7SJames Smart 
2958fedd3b7bSJames Smart struct lpfc_mbx_get_sli4_parameters {
2959fedd3b7bSJames Smart 	struct mbox_header header;
2960fedd3b7bSJames Smart 	struct lpfc_sli4_parameters sli4_parameters;
2961fedd3b7bSJames Smart };
2962fedd3b7bSJames Smart 
2963912e3acdSJames Smart struct lpfc_rscr_desc_generic {
29648aa134a8SJames Smart #define LPFC_RSRC_DESC_WSIZE			22
2965912e3acdSJames Smart 	uint32_t desc[LPFC_RSRC_DESC_WSIZE];
2966912e3acdSJames Smart };
2967912e3acdSJames Smart 
2968912e3acdSJames Smart struct lpfc_rsrc_desc_pcie {
2969912e3acdSJames Smart 	uint32_t word0;
2970912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_type_SHIFT		0
2971912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_type_MASK		0x000000ff
2972912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_type_WORD		word0
2973912e3acdSJames Smart #define LPFC_RSRC_DESC_TYPE_PCIE		0x40
29748aa134a8SJames Smart #define lpfc_rsrc_desc_pcie_length_SHIFT	8
29758aa134a8SJames Smart #define lpfc_rsrc_desc_pcie_length_MASK		0x000000ff
29768aa134a8SJames Smart #define lpfc_rsrc_desc_pcie_length_WORD		word0
2977912e3acdSJames Smart 	uint32_t word1;
2978912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_pfnum_SHIFT		0
2979912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_pfnum_MASK		0x000000ff
2980912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_pfnum_WORD		word1
2981912e3acdSJames Smart 	uint32_t reserved;
2982912e3acdSJames Smart 	uint32_t word3;
2983912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_sriov_sta_SHIFT	0
2984912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_sriov_sta_MASK	0x000000ff
2985912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_sriov_sta_WORD	word3
2986912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_pf_sta_SHIFT	8
2987912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_pf_sta_MASK		0x000000ff
2988912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_pf_sta_WORD		word3
2989912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_pf_type_SHIFT	16
2990912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_pf_type_MASK	0x000000ff
2991912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_pf_type_WORD	word3
2992912e3acdSJames Smart 	uint32_t word4;
2993912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_nr_virtfn_SHIFT	0
2994912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_nr_virtfn_MASK	0x0000ffff
2995912e3acdSJames Smart #define lpfc_rsrc_desc_pcie_nr_virtfn_WORD	word4
2996912e3acdSJames Smart };
2997912e3acdSJames Smart 
2998912e3acdSJames Smart struct lpfc_rsrc_desc_fcfcoe {
2999912e3acdSJames Smart 	uint32_t word0;
3000912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_type_SHIFT	0
3001912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_type_MASK		0x000000ff
3002912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_type_WORD		word0
3003912e3acdSJames Smart #define LPFC_RSRC_DESC_TYPE_FCFCOE		0x43
30048aa134a8SJames Smart #define lpfc_rsrc_desc_fcfcoe_length_SHIFT	8
30058aa134a8SJames Smart #define lpfc_rsrc_desc_fcfcoe_length_MASK	0x000000ff
30068aa134a8SJames Smart #define lpfc_rsrc_desc_fcfcoe_length_WORD	word0
30078aa134a8SJames Smart #define LPFC_RSRC_DESC_TYPE_FCFCOE_V0_RSVD	0
30088aa134a8SJames Smart #define LPFC_RSRC_DESC_TYPE_FCFCOE_V0_LENGTH	72
30098aa134a8SJames Smart #define LPFC_RSRC_DESC_TYPE_FCFCOE_V1_LENGTH	88
3010912e3acdSJames Smart 	uint32_t word1;
3011912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_vfnum_SHIFT	0
3012912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_vfnum_MASK	0x000000ff
3013912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_vfnum_WORD	word1
3014912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_pfnum_SHIFT	16
3015912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_pfnum_MASK        0x000007ff
3016912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_pfnum_WORD        word1
3017912e3acdSJames Smart 	uint32_t word2;
3018912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_rpi_cnt_SHIFT	0
3019912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_rpi_cnt_MASK	0x0000ffff
3020912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_rpi_cnt_WORD	word2
3021912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_xri_cnt_SHIFT	16
3022912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_xri_cnt_MASK	0x0000ffff
3023912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_xri_cnt_WORD	word2
3024912e3acdSJames Smart 	uint32_t word3;
3025912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_wq_cnt_SHIFT	0
3026912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_wq_cnt_MASK	0x0000ffff
3027912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_wq_cnt_WORD	word3
3028912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_rq_cnt_SHIFT	16
3029912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_rq_cnt_MASK	0x0000ffff
3030912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_rq_cnt_WORD	word3
3031912e3acdSJames Smart 	uint32_t word4;
3032912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_cq_cnt_SHIFT	0
3033912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_cq_cnt_MASK	0x0000ffff
3034912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_cq_cnt_WORD	word4
3035912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_vpi_cnt_SHIFT	16
3036912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_vpi_cnt_MASK	0x0000ffff
3037912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_vpi_cnt_WORD	word4
3038912e3acdSJames Smart 	uint32_t word5;
3039912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_fcfi_cnt_SHIFT	0
3040912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_fcfi_cnt_MASK	0x0000ffff
3041912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_fcfi_cnt_WORD	word5
3042912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_vfi_cnt_SHIFT	16
3043912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_vfi_cnt_MASK	0x0000ffff
3044912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_vfi_cnt_WORD	word5
3045912e3acdSJames Smart 	uint32_t word6;
3046912e3acdSJames Smart 	uint32_t word7;
3047912e3acdSJames Smart 	uint32_t word8;
3048912e3acdSJames Smart 	uint32_t word9;
3049912e3acdSJames Smart 	uint32_t word10;
3050912e3acdSJames Smart 	uint32_t word11;
3051912e3acdSJames Smart 	uint32_t word12;
3052912e3acdSJames Smart 	uint32_t word13;
3053912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lnk_nr_SHIFT	0
3054912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lnk_nr_MASK	0x0000003f
3055912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lnk_nr_WORD	word13
3056912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lnk_tp_SHIFT      6
3057912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lnk_tp_MASK	0x00000003
3058912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lnk_tp_WORD	word13
3059912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lmc_SHIFT		8
3060912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lmc_MASK		0x00000001
3061912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lmc_WORD		word13
3062912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lld_SHIFT		9
3063912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lld_MASK		0x00000001
3064912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_lld_WORD		word13
3065912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_eq_cnt_SHIFT	16
3066912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_eq_cnt_MASK	0x0000ffff
3067912e3acdSJames Smart #define lpfc_rsrc_desc_fcfcoe_eq_cnt_WORD	word13
30688aa134a8SJames Smart /* extended FC/FCoE Resource Descriptor when length = 88 bytes */
30698aa134a8SJames Smart 	uint32_t bw_min;
30708aa134a8SJames Smart 	uint32_t bw_max;
30718aa134a8SJames Smart 	uint32_t iops_min;
30728aa134a8SJames Smart 	uint32_t iops_max;
30738aa134a8SJames Smart 	uint32_t reserved[4];
3074912e3acdSJames Smart };
3075912e3acdSJames Smart 
3076912e3acdSJames Smart struct lpfc_func_cfg {
3077912e3acdSJames Smart #define LPFC_RSRC_DESC_MAX_NUM			2
3078912e3acdSJames Smart 	uint32_t rsrc_desc_count;
3079912e3acdSJames Smart 	struct lpfc_rscr_desc_generic desc[LPFC_RSRC_DESC_MAX_NUM];
3080912e3acdSJames Smart };
3081912e3acdSJames Smart 
3082912e3acdSJames Smart struct lpfc_mbx_get_func_cfg {
3083912e3acdSJames Smart 	struct mbox_header header;
3084912e3acdSJames Smart #define LPFC_CFG_TYPE_PERSISTENT_OVERRIDE	0x0
3085912e3acdSJames Smart #define LPFC_CFG_TYPE_FACTURY_DEFAULT		0x1
3086912e3acdSJames Smart #define LPFC_CFG_TYPE_CURRENT_ACTIVE		0x2
3087912e3acdSJames Smart 	struct lpfc_func_cfg func_cfg;
3088912e3acdSJames Smart };
3089912e3acdSJames Smart 
3090912e3acdSJames Smart struct lpfc_prof_cfg {
3091912e3acdSJames Smart #define LPFC_RSRC_DESC_MAX_NUM			2
3092912e3acdSJames Smart 	uint32_t rsrc_desc_count;
3093912e3acdSJames Smart 	struct lpfc_rscr_desc_generic desc[LPFC_RSRC_DESC_MAX_NUM];
3094912e3acdSJames Smart };
3095912e3acdSJames Smart 
3096912e3acdSJames Smart struct lpfc_mbx_get_prof_cfg {
3097912e3acdSJames Smart 	struct mbox_header header;
3098912e3acdSJames Smart #define LPFC_CFG_TYPE_PERSISTENT_OVERRIDE	0x0
3099912e3acdSJames Smart #define LPFC_CFG_TYPE_FACTURY_DEFAULT		0x1
3100912e3acdSJames Smart #define LPFC_CFG_TYPE_CURRENT_ACTIVE		0x2
3101912e3acdSJames Smart 	union {
3102912e3acdSJames Smart 		struct {
3103912e3acdSJames Smart 			uint32_t word10;
3104912e3acdSJames Smart #define lpfc_mbx_get_prof_cfg_prof_id_SHIFT	0
3105912e3acdSJames Smart #define lpfc_mbx_get_prof_cfg_prof_id_MASK	0x000000ff
3106912e3acdSJames Smart #define lpfc_mbx_get_prof_cfg_prof_id_WORD	word10
3107912e3acdSJames Smart #define lpfc_mbx_get_prof_cfg_prof_tp_SHIFT	8
3108912e3acdSJames Smart #define lpfc_mbx_get_prof_cfg_prof_tp_MASK	0x00000003
3109912e3acdSJames Smart #define lpfc_mbx_get_prof_cfg_prof_tp_WORD	word10
3110912e3acdSJames Smart 		} request;
3111912e3acdSJames Smart 		struct {
3112912e3acdSJames Smart 			struct lpfc_prof_cfg prof_cfg;
3113912e3acdSJames Smart 		} response;
3114912e3acdSJames Smart 	} u;
3115912e3acdSJames Smart };
3116912e3acdSJames Smart 
3117cd1c8301SJames Smart struct lpfc_controller_attribute {
3118cd1c8301SJames Smart 	uint32_t version_string[8];
3119cd1c8301SJames Smart 	uint32_t manufacturer_name[8];
3120cd1c8301SJames Smart 	uint32_t supported_modes;
3121cd1c8301SJames Smart 	uint32_t word17;
3122cd1c8301SJames Smart #define lpfc_cntl_attr_eprom_ver_lo_SHIFT	0
3123cd1c8301SJames Smart #define lpfc_cntl_attr_eprom_ver_lo_MASK	0x000000ff
3124cd1c8301SJames Smart #define lpfc_cntl_attr_eprom_ver_lo_WORD	word17
3125cd1c8301SJames Smart #define lpfc_cntl_attr_eprom_ver_hi_SHIFT	8
3126cd1c8301SJames Smart #define lpfc_cntl_attr_eprom_ver_hi_MASK	0x000000ff
3127cd1c8301SJames Smart #define lpfc_cntl_attr_eprom_ver_hi_WORD	word17
3128cd1c8301SJames Smart 	uint32_t mbx_da_struct_ver;
3129cd1c8301SJames Smart 	uint32_t ep_fw_da_struct_ver;
3130cd1c8301SJames Smart 	uint32_t ncsi_ver_str[3];
3131cd1c8301SJames Smart 	uint32_t dflt_ext_timeout;
3132cd1c8301SJames Smart 	uint32_t model_number[8];
3133cd1c8301SJames Smart 	uint32_t description[16];
3134cd1c8301SJames Smart 	uint32_t serial_number[8];
3135cd1c8301SJames Smart 	uint32_t ip_ver_str[8];
3136cd1c8301SJames Smart 	uint32_t fw_ver_str[8];
3137cd1c8301SJames Smart 	uint32_t bios_ver_str[8];
3138cd1c8301SJames Smart 	uint32_t redboot_ver_str[8];
3139cd1c8301SJames Smart 	uint32_t driver_ver_str[8];
3140cd1c8301SJames Smart 	uint32_t flash_fw_ver_str[8];
3141cd1c8301SJames Smart 	uint32_t functionality;
3142cd1c8301SJames Smart 	uint32_t word105;
3143cd1c8301SJames Smart #define lpfc_cntl_attr_max_cbd_len_SHIFT	0
3144cd1c8301SJames Smart #define lpfc_cntl_attr_max_cbd_len_MASK		0x0000ffff
3145cd1c8301SJames Smart #define lpfc_cntl_attr_max_cbd_len_WORD		word105
3146cd1c8301SJames Smart #define lpfc_cntl_attr_asic_rev_SHIFT		16
3147cd1c8301SJames Smart #define lpfc_cntl_attr_asic_rev_MASK		0x000000ff
3148cd1c8301SJames Smart #define lpfc_cntl_attr_asic_rev_WORD		word105
3149cd1c8301SJames Smart #define lpfc_cntl_attr_gen_guid0_SHIFT		24
3150cd1c8301SJames Smart #define lpfc_cntl_attr_gen_guid0_MASK		0x000000ff
3151cd1c8301SJames Smart #define lpfc_cntl_attr_gen_guid0_WORD		word105
3152cd1c8301SJames Smart 	uint32_t gen_guid1_12[3];
3153cd1c8301SJames Smart 	uint32_t word109;
3154cd1c8301SJames Smart #define lpfc_cntl_attr_gen_guid13_14_SHIFT	0
3155cd1c8301SJames Smart #define lpfc_cntl_attr_gen_guid13_14_MASK	0x0000ffff
3156cd1c8301SJames Smart #define lpfc_cntl_attr_gen_guid13_14_WORD	word109
3157cd1c8301SJames Smart #define lpfc_cntl_attr_gen_guid15_SHIFT		16
3158cd1c8301SJames Smart #define lpfc_cntl_attr_gen_guid15_MASK		0x000000ff
3159cd1c8301SJames Smart #define lpfc_cntl_attr_gen_guid15_WORD		word109
3160cd1c8301SJames Smart #define lpfc_cntl_attr_hba_port_cnt_SHIFT	24
3161cd1c8301SJames Smart #define lpfc_cntl_attr_hba_port_cnt_MASK	0x000000ff
3162cd1c8301SJames Smart #define lpfc_cntl_attr_hba_port_cnt_WORD	word109
3163cd1c8301SJames Smart 	uint32_t word110;
3164cd1c8301SJames Smart #define lpfc_cntl_attr_dflt_lnk_tmo_SHIFT	0
3165cd1c8301SJames Smart #define lpfc_cntl_attr_dflt_lnk_tmo_MASK	0x0000ffff
3166cd1c8301SJames Smart #define lpfc_cntl_attr_dflt_lnk_tmo_WORD	word110
3167cd1c8301SJames Smart #define lpfc_cntl_attr_multi_func_dev_SHIFT	24
3168cd1c8301SJames Smart #define lpfc_cntl_attr_multi_func_dev_MASK	0x000000ff
3169cd1c8301SJames Smart #define lpfc_cntl_attr_multi_func_dev_WORD	word110
3170cd1c8301SJames Smart 	uint32_t word111;
3171cd1c8301SJames Smart #define lpfc_cntl_attr_cache_valid_SHIFT	0
3172cd1c8301SJames Smart #define lpfc_cntl_attr_cache_valid_MASK		0x000000ff
3173cd1c8301SJames Smart #define lpfc_cntl_attr_cache_valid_WORD		word111
3174cd1c8301SJames Smart #define lpfc_cntl_attr_hba_status_SHIFT		8
3175cd1c8301SJames Smart #define lpfc_cntl_attr_hba_status_MASK		0x000000ff
3176cd1c8301SJames Smart #define lpfc_cntl_attr_hba_status_WORD		word111
3177cd1c8301SJames Smart #define lpfc_cntl_attr_max_domain_SHIFT		16
3178cd1c8301SJames Smart #define lpfc_cntl_attr_max_domain_MASK		0x000000ff
3179cd1c8301SJames Smart #define lpfc_cntl_attr_max_domain_WORD		word111
3180cd1c8301SJames Smart #define lpfc_cntl_attr_lnk_numb_SHIFT		24
3181cd1c8301SJames Smart #define lpfc_cntl_attr_lnk_numb_MASK		0x0000003f
3182cd1c8301SJames Smart #define lpfc_cntl_attr_lnk_numb_WORD		word111
3183cd1c8301SJames Smart #define lpfc_cntl_attr_lnk_type_SHIFT		30
3184cd1c8301SJames Smart #define lpfc_cntl_attr_lnk_type_MASK		0x00000003
3185cd1c8301SJames Smart #define lpfc_cntl_attr_lnk_type_WORD		word111
3186cd1c8301SJames Smart 	uint32_t fw_post_status;
3187cd1c8301SJames Smart 	uint32_t hba_mtu[8];
3188cd1c8301SJames Smart 	uint32_t word121;
3189cd1c8301SJames Smart 	uint32_t reserved1[3];
3190cd1c8301SJames Smart 	uint32_t word125;
3191cd1c8301SJames Smart #define lpfc_cntl_attr_pci_vendor_id_SHIFT	0
3192cd1c8301SJames Smart #define lpfc_cntl_attr_pci_vendor_id_MASK	0x0000ffff
3193cd1c8301SJames Smart #define lpfc_cntl_attr_pci_vendor_id_WORD	word125
3194cd1c8301SJames Smart #define lpfc_cntl_attr_pci_device_id_SHIFT	16
3195cd1c8301SJames Smart #define lpfc_cntl_attr_pci_device_id_MASK	0x0000ffff
3196cd1c8301SJames Smart #define lpfc_cntl_attr_pci_device_id_WORD	word125
3197cd1c8301SJames Smart 	uint32_t word126;
3198cd1c8301SJames Smart #define lpfc_cntl_attr_pci_subvdr_id_SHIFT	0
3199cd1c8301SJames Smart #define lpfc_cntl_attr_pci_subvdr_id_MASK	0x0000ffff
3200cd1c8301SJames Smart #define lpfc_cntl_attr_pci_subvdr_id_WORD	word126
3201cd1c8301SJames Smart #define lpfc_cntl_attr_pci_subsys_id_SHIFT	16
3202cd1c8301SJames Smart #define lpfc_cntl_attr_pci_subsys_id_MASK	0x0000ffff
3203cd1c8301SJames Smart #define lpfc_cntl_attr_pci_subsys_id_WORD	word126
3204cd1c8301SJames Smart 	uint32_t word127;
3205cd1c8301SJames Smart #define lpfc_cntl_attr_pci_bus_num_SHIFT	0
3206cd1c8301SJames Smart #define lpfc_cntl_attr_pci_bus_num_MASK		0x000000ff
3207cd1c8301SJames Smart #define lpfc_cntl_attr_pci_bus_num_WORD		word127
3208cd1c8301SJames Smart #define lpfc_cntl_attr_pci_dev_num_SHIFT	8
3209cd1c8301SJames Smart #define lpfc_cntl_attr_pci_dev_num_MASK		0x000000ff
3210cd1c8301SJames Smart #define lpfc_cntl_attr_pci_dev_num_WORD		word127
3211cd1c8301SJames Smart #define lpfc_cntl_attr_pci_fnc_num_SHIFT	16
3212cd1c8301SJames Smart #define lpfc_cntl_attr_pci_fnc_num_MASK		0x000000ff
3213cd1c8301SJames Smart #define lpfc_cntl_attr_pci_fnc_num_WORD		word127
3214cd1c8301SJames Smart #define lpfc_cntl_attr_inf_type_SHIFT		24
3215cd1c8301SJames Smart #define lpfc_cntl_attr_inf_type_MASK		0x000000ff
3216cd1c8301SJames Smart #define lpfc_cntl_attr_inf_type_WORD		word127
3217cd1c8301SJames Smart 	uint32_t unique_id[2];
3218cd1c8301SJames Smart 	uint32_t word130;
3219cd1c8301SJames Smart #define lpfc_cntl_attr_num_netfil_SHIFT		0
3220cd1c8301SJames Smart #define lpfc_cntl_attr_num_netfil_MASK		0x000000ff
3221cd1c8301SJames Smart #define lpfc_cntl_attr_num_netfil_WORD		word130
3222cd1c8301SJames Smart 	uint32_t reserved2[4];
3223cd1c8301SJames Smart };
3224cd1c8301SJames Smart 
3225cd1c8301SJames Smart struct lpfc_mbx_get_cntl_attributes {
3226cd1c8301SJames Smart 	union  lpfc_sli4_cfg_shdr cfg_shdr;
3227cd1c8301SJames Smart 	struct lpfc_controller_attribute cntl_attr;
3228cd1c8301SJames Smart };
3229cd1c8301SJames Smart 
3230cd1c8301SJames Smart struct lpfc_mbx_get_port_name {
3231cd1c8301SJames Smart 	struct mbox_header header;
3232cd1c8301SJames Smart 	union {
3233cd1c8301SJames Smart 		struct {
3234cd1c8301SJames Smart 			uint32_t word4;
3235cd1c8301SJames Smart #define lpfc_mbx_get_port_name_lnk_type_SHIFT	0
3236cd1c8301SJames Smart #define lpfc_mbx_get_port_name_lnk_type_MASK	0x00000003
3237cd1c8301SJames Smart #define lpfc_mbx_get_port_name_lnk_type_WORD	word4
3238cd1c8301SJames Smart 		} request;
3239cd1c8301SJames Smart 		struct {
3240cd1c8301SJames Smart 			uint32_t word4;
3241cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name0_SHIFT	0
3242cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name0_MASK	0x000000FF
3243cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name0_WORD	word4
3244cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name1_SHIFT	8
3245cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name1_MASK	0x000000FF
3246cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name1_WORD	word4
3247cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name2_SHIFT	16
3248cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name2_MASK	0x000000FF
3249cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name2_WORD	word4
3250cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name3_SHIFT	24
3251cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name3_MASK	0x000000FF
3252cd1c8301SJames Smart #define lpfc_mbx_get_port_name_name3_WORD	word4
3253cd1c8301SJames Smart #define LPFC_LINK_NUMBER_0			0
3254cd1c8301SJames Smart #define LPFC_LINK_NUMBER_1			1
3255cd1c8301SJames Smart #define LPFC_LINK_NUMBER_2			2
3256cd1c8301SJames Smart #define LPFC_LINK_NUMBER_3			3
3257cd1c8301SJames Smart 		} response;
3258cd1c8301SJames Smart 	} u;
3259cd1c8301SJames Smart };
3260cd1c8301SJames Smart 
3261da0436e9SJames Smart /* Mailbox Completion Queue Error Messages */
3262da0436e9SJames Smart #define MB_CQE_STATUS_SUCCESS			0x0
3263da0436e9SJames Smart #define MB_CQE_STATUS_INSUFFICIENT_PRIVILEGES	0x1
3264da0436e9SJames Smart #define MB_CQE_STATUS_INVALID_PARAMETER		0x2
3265da0436e9SJames Smart #define MB_CQE_STATUS_INSUFFICIENT_RESOURCES	0x3
3266da0436e9SJames Smart #define MB_CEQ_STATUS_QUEUE_FLUSHING		0x4
3267da0436e9SJames Smart #define MB_CQE_STATUS_DMA_FAILED		0x5
3268da0436e9SJames Smart 
326952d52440SJames Smart #define LPFC_MBX_WR_CONFIG_MAX_BDE		8
327052d52440SJames Smart struct lpfc_mbx_wr_object {
327152d52440SJames Smart 	struct mbox_header header;
327252d52440SJames Smart 	union {
327352d52440SJames Smart 		struct {
327452d52440SJames Smart 			uint32_t word4;
327552d52440SJames Smart #define lpfc_wr_object_eof_SHIFT		31
327652d52440SJames Smart #define lpfc_wr_object_eof_MASK			0x00000001
327752d52440SJames Smart #define lpfc_wr_object_eof_WORD			word4
327852d52440SJames Smart #define lpfc_wr_object_write_length_SHIFT	0
327952d52440SJames Smart #define lpfc_wr_object_write_length_MASK	0x00FFFFFF
328052d52440SJames Smart #define lpfc_wr_object_write_length_WORD	word4
328152d52440SJames Smart 			uint32_t write_offset;
328252d52440SJames Smart 			uint32_t object_name[26];
328352d52440SJames Smart 			uint32_t bde_count;
328452d52440SJames Smart 			struct ulp_bde64 bde[LPFC_MBX_WR_CONFIG_MAX_BDE];
328552d52440SJames Smart 		} request;
328652d52440SJames Smart 		struct {
328752d52440SJames Smart 			uint32_t actual_write_length;
328852d52440SJames Smart 		} response;
328952d52440SJames Smart 	} u;
329052d52440SJames Smart };
329152d52440SJames Smart 
3292da0436e9SJames Smart /* mailbox queue entry structure */
3293da0436e9SJames Smart struct lpfc_mqe {
3294da0436e9SJames Smart 	uint32_t word0;
3295da0436e9SJames Smart #define lpfc_mqe_status_SHIFT		16
3296da0436e9SJames Smart #define lpfc_mqe_status_MASK		0x0000FFFF
3297da0436e9SJames Smart #define lpfc_mqe_status_WORD		word0
3298da0436e9SJames Smart #define lpfc_mqe_command_SHIFT		8
3299da0436e9SJames Smart #define lpfc_mqe_command_MASK		0x000000FF
3300da0436e9SJames Smart #define lpfc_mqe_command_WORD		word0
3301da0436e9SJames Smart 	union {
3302da0436e9SJames Smart 		uint32_t mb_words[LPFC_SLI4_MB_WORD_COUNT - 1];
3303da0436e9SJames Smart 		/* sli4 mailbox commands */
3304da0436e9SJames Smart 		struct lpfc_mbx_sli4_config sli4_config;
3305da0436e9SJames Smart 		struct lpfc_mbx_init_vfi init_vfi;
3306da0436e9SJames Smart 		struct lpfc_mbx_reg_vfi reg_vfi;
3307da0436e9SJames Smart 		struct lpfc_mbx_reg_vfi unreg_vfi;
3308da0436e9SJames Smart 		struct lpfc_mbx_init_vpi init_vpi;
3309da0436e9SJames Smart 		struct lpfc_mbx_resume_rpi resume_rpi;
3310da0436e9SJames Smart 		struct lpfc_mbx_read_fcf_tbl read_fcf_tbl;
3311da0436e9SJames Smart 		struct lpfc_mbx_add_fcf_tbl_entry add_fcf_entry;
3312da0436e9SJames Smart 		struct lpfc_mbx_del_fcf_tbl_entry del_fcf_entry;
3313ecfd03c6SJames Smart 		struct lpfc_mbx_redisc_fcf_tbl redisc_fcf_tbl;
3314da0436e9SJames Smart 		struct lpfc_mbx_reg_fcfi reg_fcfi;
3315da0436e9SJames Smart 		struct lpfc_mbx_unreg_fcfi unreg_fcfi;
3316da0436e9SJames Smart 		struct lpfc_mbx_mq_create mq_create;
3317b19a061aSJames Smart 		struct lpfc_mbx_mq_create_ext mq_create_ext;
3318da0436e9SJames Smart 		struct lpfc_mbx_eq_create eq_create;
3319173edbb2SJames Smart 		struct lpfc_mbx_modify_eq_delay eq_delay;
3320da0436e9SJames Smart 		struct lpfc_mbx_cq_create cq_create;
3321da0436e9SJames Smart 		struct lpfc_mbx_wq_create wq_create;
3322da0436e9SJames Smart 		struct lpfc_mbx_rq_create rq_create;
3323da0436e9SJames Smart 		struct lpfc_mbx_mq_destroy mq_destroy;
3324da0436e9SJames Smart 		struct lpfc_mbx_eq_destroy eq_destroy;
3325da0436e9SJames Smart 		struct lpfc_mbx_cq_destroy cq_destroy;
3326da0436e9SJames Smart 		struct lpfc_mbx_wq_destroy wq_destroy;
3327da0436e9SJames Smart 		struct lpfc_mbx_rq_destroy rq_destroy;
33286d368e53SJames Smart 		struct lpfc_mbx_get_rsrc_extent_info rsrc_extent_info;
33296d368e53SJames Smart 		struct lpfc_mbx_alloc_rsrc_extents alloc_rsrc_extents;
33306d368e53SJames Smart 		struct lpfc_mbx_dealloc_rsrc_extents dealloc_rsrc_extents;
3331da0436e9SJames Smart 		struct lpfc_mbx_post_sgl_pages post_sgl_pages;
3332da0436e9SJames Smart 		struct lpfc_mbx_nembed_cmd nembed_cmd;
3333da0436e9SJames Smart 		struct lpfc_mbx_read_rev read_rev;
3334da0436e9SJames Smart 		struct lpfc_mbx_read_vpi read_vpi;
3335da0436e9SJames Smart 		struct lpfc_mbx_read_config rd_config;
3336da0436e9SJames Smart 		struct lpfc_mbx_request_features req_ftrs;
3337da0436e9SJames Smart 		struct lpfc_mbx_post_hdr_tmpl hdr_tmpl;
3338962bc51bSJames Smart 		struct lpfc_mbx_query_fw_config query_fw_cfg;
33398b017a30SJames Smart 		struct lpfc_mbx_set_beacon_config beacon_config;
334028baac74SJames Smart 		struct lpfc_mbx_supp_pages supp_pages;
3341fedd3b7bSJames Smart 		struct lpfc_mbx_pc_sli4_params sli4_params;
3342fedd3b7bSJames Smart 		struct lpfc_mbx_get_sli4_parameters get_sli4_parameters;
33437ad20aa9SJames Smart 		struct lpfc_mbx_set_link_diag_state link_diag_state;
33447ad20aa9SJames Smart 		struct lpfc_mbx_set_link_diag_loopback link_diag_loopback;
33457ad20aa9SJames Smart 		struct lpfc_mbx_run_link_diag_test link_diag_test;
3346912e3acdSJames Smart 		struct lpfc_mbx_get_func_cfg get_func_cfg;
3347912e3acdSJames Smart 		struct lpfc_mbx_get_prof_cfg get_prof_cfg;
334852d52440SJames Smart 		struct lpfc_mbx_wr_object wr_object;
3349cd1c8301SJames Smart 		struct lpfc_mbx_get_port_name get_port_name;
335065791f1fSJames Smart 		struct lpfc_mbx_set_feature  set_feature;
335186478875SJames Smart 		struct lpfc_mbx_memory_dump_type3 mem_dump_type3;
335261bda8f7SJames Smart 		struct lpfc_mbx_set_host_data set_host_data;
3353cd1c8301SJames Smart 		struct lpfc_mbx_nop nop;
3354da0436e9SJames Smart 	} un;
3355da0436e9SJames Smart };
3356da0436e9SJames Smart 
3357da0436e9SJames Smart struct lpfc_mcqe {
3358da0436e9SJames Smart 	uint32_t word0;
3359da0436e9SJames Smart #define lpfc_mcqe_status_SHIFT		0
3360da0436e9SJames Smart #define lpfc_mcqe_status_MASK		0x0000FFFF
3361da0436e9SJames Smart #define lpfc_mcqe_status_WORD		word0
3362da0436e9SJames Smart #define lpfc_mcqe_ext_status_SHIFT	16
3363da0436e9SJames Smart #define lpfc_mcqe_ext_status_MASK	0x0000FFFF
3364da0436e9SJames Smart #define lpfc_mcqe_ext_status_WORD	word0
3365da0436e9SJames Smart 	uint32_t mcqe_tag0;
3366da0436e9SJames Smart 	uint32_t mcqe_tag1;
3367da0436e9SJames Smart 	uint32_t trailer;
3368da0436e9SJames Smart #define lpfc_trailer_valid_SHIFT	31
3369da0436e9SJames Smart #define lpfc_trailer_valid_MASK		0x00000001
3370da0436e9SJames Smart #define lpfc_trailer_valid_WORD		trailer
3371da0436e9SJames Smart #define lpfc_trailer_async_SHIFT	30
3372da0436e9SJames Smart #define lpfc_trailer_async_MASK		0x00000001
3373da0436e9SJames Smart #define lpfc_trailer_async_WORD		trailer
3374da0436e9SJames Smart #define lpfc_trailer_hpi_SHIFT		29
3375da0436e9SJames Smart #define lpfc_trailer_hpi_MASK		0x00000001
3376da0436e9SJames Smart #define lpfc_trailer_hpi_WORD		trailer
3377da0436e9SJames Smart #define lpfc_trailer_completed_SHIFT	28
3378da0436e9SJames Smart #define lpfc_trailer_completed_MASK	0x00000001
3379da0436e9SJames Smart #define lpfc_trailer_completed_WORD	trailer
3380da0436e9SJames Smart #define lpfc_trailer_consumed_SHIFT	27
3381da0436e9SJames Smart #define lpfc_trailer_consumed_MASK	0x00000001
3382da0436e9SJames Smart #define lpfc_trailer_consumed_WORD	trailer
3383da0436e9SJames Smart #define lpfc_trailer_type_SHIFT		16
3384da0436e9SJames Smart #define lpfc_trailer_type_MASK		0x000000FF
3385da0436e9SJames Smart #define lpfc_trailer_type_WORD		trailer
3386da0436e9SJames Smart #define lpfc_trailer_code_SHIFT		8
3387da0436e9SJames Smart #define lpfc_trailer_code_MASK		0x000000FF
3388da0436e9SJames Smart #define lpfc_trailer_code_WORD		trailer
3389da0436e9SJames Smart #define LPFC_TRAILER_CODE_LINK	0x1
3390da0436e9SJames Smart #define LPFC_TRAILER_CODE_FCOE	0x2
3391da0436e9SJames Smart #define LPFC_TRAILER_CODE_DCBX	0x3
3392b19a061aSJames Smart #define LPFC_TRAILER_CODE_GRP5	0x5
339376a95d75SJames Smart #define LPFC_TRAILER_CODE_FC	0x10
339470f3c073SJames Smart #define LPFC_TRAILER_CODE_SLI	0x11
3395da0436e9SJames Smart };
3396da0436e9SJames Smart 
3397da0436e9SJames Smart struct lpfc_acqe_link {
3398da0436e9SJames Smart 	uint32_t word0;
3399da0436e9SJames Smart #define lpfc_acqe_link_speed_SHIFT		24
3400da0436e9SJames Smart #define lpfc_acqe_link_speed_MASK		0x000000FF
3401da0436e9SJames Smart #define lpfc_acqe_link_speed_WORD		word0
3402da0436e9SJames Smart #define LPFC_ASYNC_LINK_SPEED_ZERO		0x0
3403da0436e9SJames Smart #define LPFC_ASYNC_LINK_SPEED_10MBPS		0x1
3404da0436e9SJames Smart #define LPFC_ASYNC_LINK_SPEED_100MBPS		0x2
3405da0436e9SJames Smart #define LPFC_ASYNC_LINK_SPEED_1GBPS		0x3
3406da0436e9SJames Smart #define LPFC_ASYNC_LINK_SPEED_10GBPS		0x4
340726d830ecSJames Smart #define LPFC_ASYNC_LINK_SPEED_20GBPS		0x5
340826d830ecSJames Smart #define LPFC_ASYNC_LINK_SPEED_25GBPS		0x6
340926d830ecSJames Smart #define LPFC_ASYNC_LINK_SPEED_40GBPS		0x7
3410a085e87cSJames Smart #define LPFC_ASYNC_LINK_SPEED_100GBPS		0x8
3411da0436e9SJames Smart #define lpfc_acqe_link_duplex_SHIFT		16
3412da0436e9SJames Smart #define lpfc_acqe_link_duplex_MASK		0x000000FF
3413da0436e9SJames Smart #define lpfc_acqe_link_duplex_WORD		word0
3414da0436e9SJames Smart #define LPFC_ASYNC_LINK_DUPLEX_NONE		0x0
3415da0436e9SJames Smart #define LPFC_ASYNC_LINK_DUPLEX_HALF		0x1
3416da0436e9SJames Smart #define LPFC_ASYNC_LINK_DUPLEX_FULL		0x2
3417da0436e9SJames Smart #define lpfc_acqe_link_status_SHIFT		8
3418da0436e9SJames Smart #define lpfc_acqe_link_status_MASK		0x000000FF
3419da0436e9SJames Smart #define lpfc_acqe_link_status_WORD		word0
3420da0436e9SJames Smart #define LPFC_ASYNC_LINK_STATUS_DOWN		0x0
3421da0436e9SJames Smart #define LPFC_ASYNC_LINK_STATUS_UP		0x1
3422da0436e9SJames Smart #define LPFC_ASYNC_LINK_STATUS_LOGICAL_DOWN	0x2
3423da0436e9SJames Smart #define LPFC_ASYNC_LINK_STATUS_LOGICAL_UP	0x3
342470f3c073SJames Smart #define lpfc_acqe_link_type_SHIFT		6
342570f3c073SJames Smart #define lpfc_acqe_link_type_MASK		0x00000003
342670f3c073SJames Smart #define lpfc_acqe_link_type_WORD		word0
342770f3c073SJames Smart #define lpfc_acqe_link_number_SHIFT		0
342870f3c073SJames Smart #define lpfc_acqe_link_number_MASK		0x0000003F
342970f3c073SJames Smart #define lpfc_acqe_link_number_WORD		word0
3430da0436e9SJames Smart 	uint32_t word1;
3431da0436e9SJames Smart #define lpfc_acqe_link_fault_SHIFT	0
3432da0436e9SJames Smart #define lpfc_acqe_link_fault_MASK	0x000000FF
3433da0436e9SJames Smart #define lpfc_acqe_link_fault_WORD	word1
3434da0436e9SJames Smart #define LPFC_ASYNC_LINK_FAULT_NONE	0x0
3435da0436e9SJames Smart #define LPFC_ASYNC_LINK_FAULT_LOCAL	0x1
3436da0436e9SJames Smart #define LPFC_ASYNC_LINK_FAULT_REMOTE	0x2
343770f3c073SJames Smart #define lpfc_acqe_logical_link_speed_SHIFT	16
343870f3c073SJames Smart #define lpfc_acqe_logical_link_speed_MASK	0x0000FFFF
343970f3c073SJames Smart #define lpfc_acqe_logical_link_speed_WORD	word1
3440da0436e9SJames Smart 	uint32_t event_tag;
3441da0436e9SJames Smart 	uint32_t trailer;
344270f3c073SJames Smart #define LPFC_LINK_EVENT_TYPE_PHYSICAL	0x0
344370f3c073SJames Smart #define LPFC_LINK_EVENT_TYPE_VIRTUAL	0x1
3444da0436e9SJames Smart };
3445da0436e9SJames Smart 
344670f3c073SJames Smart struct lpfc_acqe_fip {
34476669f9bbSJames Smart 	uint32_t index;
3448da0436e9SJames Smart 	uint32_t word1;
344970f3c073SJames Smart #define lpfc_acqe_fip_fcf_count_SHIFT		0
345070f3c073SJames Smart #define lpfc_acqe_fip_fcf_count_MASK		0x0000FFFF
345170f3c073SJames Smart #define lpfc_acqe_fip_fcf_count_WORD		word1
345270f3c073SJames Smart #define lpfc_acqe_fip_event_type_SHIFT		16
345370f3c073SJames Smart #define lpfc_acqe_fip_event_type_MASK		0x0000FFFF
345470f3c073SJames Smart #define lpfc_acqe_fip_event_type_WORD		word1
3455da0436e9SJames Smart 	uint32_t event_tag;
3456da0436e9SJames Smart 	uint32_t trailer;
345770f3c073SJames Smart #define LPFC_FIP_EVENT_TYPE_NEW_FCF		0x1
345870f3c073SJames Smart #define LPFC_FIP_EVENT_TYPE_FCF_TABLE_FULL	0x2
345970f3c073SJames Smart #define LPFC_FIP_EVENT_TYPE_FCF_DEAD		0x3
346070f3c073SJames Smart #define LPFC_FIP_EVENT_TYPE_CVL			0x4
346170f3c073SJames Smart #define LPFC_FIP_EVENT_TYPE_FCF_PARAM_MOD	0x5
3462da0436e9SJames Smart };
3463da0436e9SJames Smart 
3464da0436e9SJames Smart struct lpfc_acqe_dcbx {
3465da0436e9SJames Smart 	uint32_t tlv_ttl;
3466da0436e9SJames Smart 	uint32_t reserved;
3467da0436e9SJames Smart 	uint32_t event_tag;
3468da0436e9SJames Smart 	uint32_t trailer;
3469da0436e9SJames Smart };
3470da0436e9SJames Smart 
3471b19a061aSJames Smart struct lpfc_acqe_grp5 {
3472b19a061aSJames Smart 	uint32_t word0;
347370f3c073SJames Smart #define lpfc_acqe_grp5_type_SHIFT		6
347470f3c073SJames Smart #define lpfc_acqe_grp5_type_MASK		0x00000003
347570f3c073SJames Smart #define lpfc_acqe_grp5_type_WORD		word0
347670f3c073SJames Smart #define lpfc_acqe_grp5_number_SHIFT		0
347770f3c073SJames Smart #define lpfc_acqe_grp5_number_MASK		0x0000003F
347870f3c073SJames Smart #define lpfc_acqe_grp5_number_WORD		word0
3479b19a061aSJames Smart 	uint32_t word1;
3480b19a061aSJames Smart #define lpfc_acqe_grp5_llink_spd_SHIFT	16
3481b19a061aSJames Smart #define lpfc_acqe_grp5_llink_spd_MASK	0x0000FFFF
3482b19a061aSJames Smart #define lpfc_acqe_grp5_llink_spd_WORD	word1
3483b19a061aSJames Smart 	uint32_t event_tag;
3484b19a061aSJames Smart 	uint32_t trailer;
3485b19a061aSJames Smart };
3486b19a061aSJames Smart 
348770f3c073SJames Smart struct lpfc_acqe_fc_la {
348870f3c073SJames Smart 	uint32_t word0;
348970f3c073SJames Smart #define lpfc_acqe_fc_la_speed_SHIFT		24
349070f3c073SJames Smart #define lpfc_acqe_fc_la_speed_MASK		0x000000FF
349170f3c073SJames Smart #define lpfc_acqe_fc_la_speed_WORD		word0
349226d830ecSJames Smart #define LPFC_FC_LA_SPEED_UNKNOWN		0x0
349370f3c073SJames Smart #define LPFC_FC_LA_SPEED_1G		0x1
349470f3c073SJames Smart #define LPFC_FC_LA_SPEED_2G		0x2
349570f3c073SJames Smart #define LPFC_FC_LA_SPEED_4G		0x4
349670f3c073SJames Smart #define LPFC_FC_LA_SPEED_8G		0x8
349770f3c073SJames Smart #define LPFC_FC_LA_SPEED_10G		0xA
349870f3c073SJames Smart #define LPFC_FC_LA_SPEED_16G		0x10
349986478875SJames Smart #define LPFC_FC_LA_SPEED_32G            0x20
350070f3c073SJames Smart #define lpfc_acqe_fc_la_topology_SHIFT		16
350170f3c073SJames Smart #define lpfc_acqe_fc_la_topology_MASK		0x000000FF
350270f3c073SJames Smart #define lpfc_acqe_fc_la_topology_WORD		word0
350370f3c073SJames Smart #define LPFC_FC_LA_TOP_UNKOWN		0x0
350470f3c073SJames Smart #define LPFC_FC_LA_TOP_P2P		0x1
350570f3c073SJames Smart #define LPFC_FC_LA_TOP_FCAL		0x2
350670f3c073SJames Smart #define LPFC_FC_LA_TOP_INTERNAL_LOOP	0x3
350770f3c073SJames Smart #define LPFC_FC_LA_TOP_SERDES_LOOP	0x4
350870f3c073SJames Smart #define lpfc_acqe_fc_la_att_type_SHIFT		8
350970f3c073SJames Smart #define lpfc_acqe_fc_la_att_type_MASK		0x000000FF
351070f3c073SJames Smart #define lpfc_acqe_fc_la_att_type_WORD		word0
351170f3c073SJames Smart #define LPFC_FC_LA_TYPE_LINK_UP		0x1
351270f3c073SJames Smart #define LPFC_FC_LA_TYPE_LINK_DOWN	0x2
351370f3c073SJames Smart #define LPFC_FC_LA_TYPE_NO_HARD_ALPA	0x3
35147bdedb34SJames Smart #define LPFC_FC_LA_TYPE_MDS_LINK_DOWN	0x4
35157bdedb34SJames Smart #define LPFC_FC_LA_TYPE_MDS_LOOPBACK	0x5
351670f3c073SJames Smart #define lpfc_acqe_fc_la_port_type_SHIFT		6
351770f3c073SJames Smart #define lpfc_acqe_fc_la_port_type_MASK		0x00000003
351870f3c073SJames Smart #define lpfc_acqe_fc_la_port_type_WORD		word0
351970f3c073SJames Smart #define LPFC_LINK_TYPE_ETHERNET		0x0
352070f3c073SJames Smart #define LPFC_LINK_TYPE_FC		0x1
352170f3c073SJames Smart #define lpfc_acqe_fc_la_port_number_SHIFT	0
352270f3c073SJames Smart #define lpfc_acqe_fc_la_port_number_MASK	0x0000003F
352370f3c073SJames Smart #define lpfc_acqe_fc_la_port_number_WORD	word0
352470f3c073SJames Smart 	uint32_t word1;
352570f3c073SJames Smart #define lpfc_acqe_fc_la_llink_spd_SHIFT		16
352670f3c073SJames Smart #define lpfc_acqe_fc_la_llink_spd_MASK		0x0000FFFF
352770f3c073SJames Smart #define lpfc_acqe_fc_la_llink_spd_WORD		word1
352870f3c073SJames Smart #define lpfc_acqe_fc_la_fault_SHIFT		0
352970f3c073SJames Smart #define lpfc_acqe_fc_la_fault_MASK		0x000000FF
353070f3c073SJames Smart #define lpfc_acqe_fc_la_fault_WORD		word1
353170f3c073SJames Smart #define LPFC_FC_LA_FAULT_NONE		0x0
353270f3c073SJames Smart #define LPFC_FC_LA_FAULT_LOCAL		0x1
353370f3c073SJames Smart #define LPFC_FC_LA_FAULT_REMOTE		0x2
353470f3c073SJames Smart 	uint32_t event_tag;
353570f3c073SJames Smart 	uint32_t trailer;
353670f3c073SJames Smart #define LPFC_FC_LA_EVENT_TYPE_FC_LINK		0x1
353770f3c073SJames Smart #define LPFC_FC_LA_EVENT_TYPE_SHARED_LINK	0x2
353870f3c073SJames Smart };
353970f3c073SJames Smart 
35404b8bae08SJames Smart struct lpfc_acqe_misconfigured_event {
35414b8bae08SJames Smart 	struct {
35424b8bae08SJames Smart 	uint32_t word0;
3543448193b5SJames Smart #define lpfc_sli_misconfigured_port0_state_SHIFT	0
3544448193b5SJames Smart #define lpfc_sli_misconfigured_port0_state_MASK		0x000000FF
3545448193b5SJames Smart #define lpfc_sli_misconfigured_port0_state_WORD		word0
3546448193b5SJames Smart #define lpfc_sli_misconfigured_port1_state_SHIFT	8
3547448193b5SJames Smart #define lpfc_sli_misconfigured_port1_state_MASK		0x000000FF
3548448193b5SJames Smart #define lpfc_sli_misconfigured_port1_state_WORD		word0
3549448193b5SJames Smart #define lpfc_sli_misconfigured_port2_state_SHIFT	16
3550448193b5SJames Smart #define lpfc_sli_misconfigured_port2_state_MASK		0x000000FF
3551448193b5SJames Smart #define lpfc_sli_misconfigured_port2_state_WORD		word0
3552448193b5SJames Smart #define lpfc_sli_misconfigured_port3_state_SHIFT	24
3553448193b5SJames Smart #define lpfc_sli_misconfigured_port3_state_MASK		0x000000FF
3554448193b5SJames Smart #define lpfc_sli_misconfigured_port3_state_WORD		word0
3555448193b5SJames Smart 	uint32_t word1;
3556448193b5SJames Smart #define lpfc_sli_misconfigured_port0_op_SHIFT		0
3557448193b5SJames Smart #define lpfc_sli_misconfigured_port0_op_MASK		0x00000001
3558448193b5SJames Smart #define lpfc_sli_misconfigured_port0_op_WORD		word1
3559448193b5SJames Smart #define lpfc_sli_misconfigured_port0_severity_SHIFT	1
3560448193b5SJames Smart #define lpfc_sli_misconfigured_port0_severity_MASK	0x00000003
3561448193b5SJames Smart #define lpfc_sli_misconfigured_port0_severity_WORD	word1
3562448193b5SJames Smart #define lpfc_sli_misconfigured_port1_op_SHIFT		8
3563448193b5SJames Smart #define lpfc_sli_misconfigured_port1_op_MASK		0x00000001
3564448193b5SJames Smart #define lpfc_sli_misconfigured_port1_op_WORD		word1
3565448193b5SJames Smart #define lpfc_sli_misconfigured_port1_severity_SHIFT	9
3566448193b5SJames Smart #define lpfc_sli_misconfigured_port1_severity_MASK	0x00000003
3567448193b5SJames Smart #define lpfc_sli_misconfigured_port1_severity_WORD	word1
3568448193b5SJames Smart #define lpfc_sli_misconfigured_port2_op_SHIFT		16
3569448193b5SJames Smart #define lpfc_sli_misconfigured_port2_op_MASK		0x00000001
3570448193b5SJames Smart #define lpfc_sli_misconfigured_port2_op_WORD		word1
3571448193b5SJames Smart #define lpfc_sli_misconfigured_port2_severity_SHIFT	17
3572448193b5SJames Smart #define lpfc_sli_misconfigured_port2_severity_MASK	0x00000003
3573448193b5SJames Smart #define lpfc_sli_misconfigured_port2_severity_WORD	word1
3574448193b5SJames Smart #define lpfc_sli_misconfigured_port3_op_SHIFT		24
3575448193b5SJames Smart #define lpfc_sli_misconfigured_port3_op_MASK		0x00000001
3576448193b5SJames Smart #define lpfc_sli_misconfigured_port3_op_WORD		word1
3577448193b5SJames Smart #define lpfc_sli_misconfigured_port3_severity_SHIFT	25
3578448193b5SJames Smart #define lpfc_sli_misconfigured_port3_severity_MASK	0x00000003
3579448193b5SJames Smart #define lpfc_sli_misconfigured_port3_severity_WORD	word1
35804b8bae08SJames Smart 	} theEvent;
35814b8bae08SJames Smart #define LPFC_SLI_EVENT_STATUS_VALID			0x00
35824b8bae08SJames Smart #define LPFC_SLI_EVENT_STATUS_NOT_PRESENT	0x01
35834b8bae08SJames Smart #define LPFC_SLI_EVENT_STATUS_WRONG_TYPE	0x02
35844b8bae08SJames Smart #define LPFC_SLI_EVENT_STATUS_UNSUPPORTED	0x03
3585448193b5SJames Smart #define LPFC_SLI_EVENT_STATUS_UNQUALIFIED	0x04
3586448193b5SJames Smart #define LPFC_SLI_EVENT_STATUS_UNCERTIFIED	0x05
35874b8bae08SJames Smart };
35884b8bae08SJames Smart 
358970f3c073SJames Smart struct lpfc_acqe_sli {
359070f3c073SJames Smart 	uint32_t event_data1;
359170f3c073SJames Smart 	uint32_t event_data2;
359270f3c073SJames Smart 	uint32_t reserved;
359370f3c073SJames Smart 	uint32_t trailer;
359470f3c073SJames Smart #define LPFC_SLI_EVENT_TYPE_PORT_ERROR		0x1
359570f3c073SJames Smart #define LPFC_SLI_EVENT_TYPE_OVER_TEMP		0x2
359670f3c073SJames Smart #define LPFC_SLI_EVENT_TYPE_NORM_TEMP		0x3
359770f3c073SJames Smart #define LPFC_SLI_EVENT_TYPE_NVLOG_POST		0x4
359870f3c073SJames Smart #define LPFC_SLI_EVENT_TYPE_DIAG_DUMP		0x5
35994b8bae08SJames Smart #define LPFC_SLI_EVENT_TYPE_MISCONFIGURED	0x9
3600946727dcSJames Smart #define LPFC_SLI_EVENT_TYPE_REMOTE_DPORT	0xA
360170f3c073SJames Smart };
360270f3c073SJames Smart 
3603da0436e9SJames Smart /*
3604da0436e9SJames Smart  * Define the bootstrap mailbox (bmbx) region used to communicate
3605da0436e9SJames Smart  * mailbox command between the host and port. The mailbox consists
3606da0436e9SJames Smart  * of a payload area of 256 bytes and a completion queue of length
3607da0436e9SJames Smart  * 16 bytes.
3608da0436e9SJames Smart  */
3609da0436e9SJames Smart struct lpfc_bmbx_create {
3610da0436e9SJames Smart 	struct lpfc_mqe mqe;
3611da0436e9SJames Smart 	struct lpfc_mcqe mcqe;
3612da0436e9SJames Smart };
3613da0436e9SJames Smart 
3614da0436e9SJames Smart #define SGL_ALIGN_SZ 64
3615da0436e9SJames Smart #define SGL_PAGE_SIZE 4096
3616da0436e9SJames Smart /* align SGL addr on a size boundary - adjust address up */
36176d368e53SJames Smart #define NO_XRI  0xffff
36185ffc266eSJames Smart 
3619da0436e9SJames Smart struct wqe_common {
3620da0436e9SJames Smart 	uint32_t word6;
36216669f9bbSJames Smart #define wqe_xri_tag_SHIFT     0
36226669f9bbSJames Smart #define wqe_xri_tag_MASK      0x0000FFFF
36236669f9bbSJames Smart #define wqe_xri_tag_WORD      word6
3624da0436e9SJames Smart #define wqe_ctxt_tag_SHIFT    16
3625da0436e9SJames Smart #define wqe_ctxt_tag_MASK     0x0000FFFF
3626da0436e9SJames Smart #define wqe_ctxt_tag_WORD     word6
3627da0436e9SJames Smart 	uint32_t word7;
3628f9bb2da1SJames Smart #define wqe_dif_SHIFT         0
3629f9bb2da1SJames Smart #define wqe_dif_MASK          0x00000003
3630f9bb2da1SJames Smart #define wqe_dif_WORD          word7
36318012cc38SJames Smart #define LPFC_WQE_DIF_PASSTHRU	1
36328012cc38SJames Smart #define LPFC_WQE_DIF_STRIP	2
36338012cc38SJames Smart #define LPFC_WQE_DIF_INSERT	3
3634da0436e9SJames Smart #define wqe_ct_SHIFT          2
3635da0436e9SJames Smart #define wqe_ct_MASK           0x00000003
3636da0436e9SJames Smart #define wqe_ct_WORD           word7
3637da0436e9SJames Smart #define wqe_status_SHIFT      4
3638da0436e9SJames Smart #define wqe_status_MASK       0x0000000f
3639da0436e9SJames Smart #define wqe_status_WORD       word7
3640da0436e9SJames Smart #define wqe_cmnd_SHIFT        8
3641da0436e9SJames Smart #define wqe_cmnd_MASK         0x000000ff
3642da0436e9SJames Smart #define wqe_cmnd_WORD         word7
3643da0436e9SJames Smart #define wqe_class_SHIFT       16
3644da0436e9SJames Smart #define wqe_class_MASK        0x00000007
3645da0436e9SJames Smart #define wqe_class_WORD        word7
3646f9bb2da1SJames Smart #define wqe_ar_SHIFT          19
3647f9bb2da1SJames Smart #define wqe_ar_MASK           0x00000001
3648f9bb2da1SJames Smart #define wqe_ar_WORD           word7
3649f9bb2da1SJames Smart #define wqe_ag_SHIFT          wqe_ar_SHIFT
3650f9bb2da1SJames Smart #define wqe_ag_MASK           wqe_ar_MASK
3651f9bb2da1SJames Smart #define wqe_ag_WORD           wqe_ar_WORD
3652da0436e9SJames Smart #define wqe_pu_SHIFT          20
3653da0436e9SJames Smart #define wqe_pu_MASK           0x00000003
3654da0436e9SJames Smart #define wqe_pu_WORD           word7
3655da0436e9SJames Smart #define wqe_erp_SHIFT         22
3656da0436e9SJames Smart #define wqe_erp_MASK          0x00000001
3657da0436e9SJames Smart #define wqe_erp_WORD          word7
3658f9bb2da1SJames Smart #define wqe_conf_SHIFT        wqe_erp_SHIFT
3659f9bb2da1SJames Smart #define wqe_conf_MASK         wqe_erp_MASK
3660f9bb2da1SJames Smart #define wqe_conf_WORD         wqe_erp_WORD
3661da0436e9SJames Smart #define wqe_lnk_SHIFT         23
3662da0436e9SJames Smart #define wqe_lnk_MASK          0x00000001
3663da0436e9SJames Smart #define wqe_lnk_WORD          word7
3664da0436e9SJames Smart #define wqe_tmo_SHIFT         24
3665da0436e9SJames Smart #define wqe_tmo_MASK          0x000000ff
3666da0436e9SJames Smart #define wqe_tmo_WORD          word7
3667da0436e9SJames Smart 	uint32_t abort_tag; /* word 8 in WQE */
3668da0436e9SJames Smart 	uint32_t word9;
3669da0436e9SJames Smart #define wqe_reqtag_SHIFT      0
3670da0436e9SJames Smart #define wqe_reqtag_MASK       0x0000FFFF
3671da0436e9SJames Smart #define wqe_reqtag_WORD       word9
3672c31098ceSJames Smart #define wqe_temp_rpi_SHIFT    16
3673c31098ceSJames Smart #define wqe_temp_rpi_MASK     0x0000FFFF
3674c31098ceSJames Smart #define wqe_temp_rpi_WORD     word9
3675da0436e9SJames Smart #define wqe_rcvoxid_SHIFT     16
3676da0436e9SJames Smart #define wqe_rcvoxid_MASK      0x0000FFFF
3677da0436e9SJames Smart #define wqe_rcvoxid_WORD      word9
3678da0436e9SJames Smart 	uint32_t word10;
3679f0d9bcccSJames Smart #define wqe_ebde_cnt_SHIFT    0
36802fcee4bfSJames Smart #define wqe_ebde_cnt_MASK     0x0000000f
3681f0d9bcccSJames Smart #define wqe_ebde_cnt_WORD     word10
3682895427bdSJames Smart #define wqe_nvme_SHIFT        4
3683895427bdSJames Smart #define wqe_nvme_MASK         0x00000001
3684895427bdSJames Smart #define wqe_nvme_WORD         word10
36851ba981fdSJames Smart #define wqe_oas_SHIFT         6
36861ba981fdSJames Smart #define wqe_oas_MASK          0x00000001
36871ba981fdSJames Smart #define wqe_oas_WORD          word10
3688f0d9bcccSJames Smart #define wqe_lenloc_SHIFT      7
3689f0d9bcccSJames Smart #define wqe_lenloc_MASK       0x00000003
3690f0d9bcccSJames Smart #define wqe_lenloc_WORD       word10
3691f0d9bcccSJames Smart #define LPFC_WQE_LENLOC_NONE		0
3692f0d9bcccSJames Smart #define LPFC_WQE_LENLOC_WORD3	1
3693f0d9bcccSJames Smart #define LPFC_WQE_LENLOC_WORD12	2
3694f0d9bcccSJames Smart #define LPFC_WQE_LENLOC_WORD4	3
3695f0d9bcccSJames Smart #define wqe_qosd_SHIFT        9
3696f0d9bcccSJames Smart #define wqe_qosd_MASK         0x00000001
3697f0d9bcccSJames Smart #define wqe_qosd_WORD         word10
3698f0d9bcccSJames Smart #define wqe_xbl_SHIFT         11
3699f0d9bcccSJames Smart #define wqe_xbl_MASK          0x00000001
3700f0d9bcccSJames Smart #define wqe_xbl_WORD          word10
3701f0d9bcccSJames Smart #define wqe_iod_SHIFT         13
3702f0d9bcccSJames Smart #define wqe_iod_MASK          0x00000001
3703f0d9bcccSJames Smart #define wqe_iod_WORD          word10
3704f0d9bcccSJames Smart #define LPFC_WQE_IOD_WRITE	0
3705f0d9bcccSJames Smart #define LPFC_WQE_IOD_READ	1
3706f0d9bcccSJames Smart #define wqe_dbde_SHIFT        14
3707f0d9bcccSJames Smart #define wqe_dbde_MASK         0x00000001
3708f0d9bcccSJames Smart #define wqe_dbde_WORD         word10
3709f0d9bcccSJames Smart #define wqe_wqes_SHIFT        15
3710f0d9bcccSJames Smart #define wqe_wqes_MASK         0x00000001
3711f0d9bcccSJames Smart #define wqe_wqes_WORD         word10
3712fedd3b7bSJames Smart /* Note that this field overlaps above fields */
3713fedd3b7bSJames Smart #define wqe_wqid_SHIFT        1
37149589b062SJames Smart #define wqe_wqid_MASK         0x00007fff
3715fedd3b7bSJames Smart #define wqe_wqid_WORD         word10
3716da0436e9SJames Smart #define wqe_pri_SHIFT         16
3717da0436e9SJames Smart #define wqe_pri_MASK          0x00000007
3718da0436e9SJames Smart #define wqe_pri_WORD          word10
3719da0436e9SJames Smart #define wqe_pv_SHIFT          19
3720da0436e9SJames Smart #define wqe_pv_MASK           0x00000001
3721da0436e9SJames Smart #define wqe_pv_WORD           word10
3722da0436e9SJames Smart #define wqe_xc_SHIFT          21
3723da0436e9SJames Smart #define wqe_xc_MASK           0x00000001
3724da0436e9SJames Smart #define wqe_xc_WORD           word10
3725f9bb2da1SJames Smart #define wqe_sr_SHIFT          22
3726f9bb2da1SJames Smart #define wqe_sr_MASK           0x00000001
3727f9bb2da1SJames Smart #define wqe_sr_WORD           word10
3728da0436e9SJames Smart #define wqe_ccpe_SHIFT        23
3729da0436e9SJames Smart #define wqe_ccpe_MASK         0x00000001
3730da0436e9SJames Smart #define wqe_ccpe_WORD         word10
3731da0436e9SJames Smart #define wqe_ccp_SHIFT         24
3732da0436e9SJames Smart #define wqe_ccp_MASK          0x000000ff
3733da0436e9SJames Smart #define wqe_ccp_WORD          word10
3734da0436e9SJames Smart 	uint32_t word11;
3735da0436e9SJames Smart #define wqe_cmd_type_SHIFT    0
3736da0436e9SJames Smart #define wqe_cmd_type_MASK     0x0000000f
3737da0436e9SJames Smart #define wqe_cmd_type_WORD     word11
3738f0d9bcccSJames Smart #define wqe_els_id_SHIFT      4
3739f0d9bcccSJames Smart #define wqe_els_id_MASK       0x00000003
3740f0d9bcccSJames Smart #define wqe_els_id_WORD       word11
3741f0d9bcccSJames Smart #define LPFC_ELS_ID_FLOGI	3
3742f0d9bcccSJames Smart #define LPFC_ELS_ID_FDISC	2
3743f0d9bcccSJames Smart #define LPFC_ELS_ID_LOGO	1
3744f0d9bcccSJames Smart #define LPFC_ELS_ID_DEFAULT	0
3745*f358dd0cSJames Smart #define wqe_irsp_SHIFT        4
3746*f358dd0cSJames Smart #define wqe_irsp_MASK         0x00000001
3747*f358dd0cSJames Smart #define wqe_irsp_WORD         word11
3748*f358dd0cSJames Smart #define wqe_sup_SHIFT         6
3749*f358dd0cSJames Smart #define wqe_sup_MASK          0x00000001
3750*f358dd0cSJames Smart #define wqe_sup_WORD          word11
3751da0436e9SJames Smart #define wqe_wqec_SHIFT        7
3752da0436e9SJames Smart #define wqe_wqec_MASK         0x00000001
3753da0436e9SJames Smart #define wqe_wqec_WORD         word11
3754*f358dd0cSJames Smart #define wqe_irsplen_SHIFT     8
3755*f358dd0cSJames Smart #define wqe_irsplen_MASK      0x0000000f
3756*f358dd0cSJames Smart #define wqe_irsplen_WORD      word11
3757da0436e9SJames Smart #define wqe_cqid_SHIFT        16
37586669f9bbSJames Smart #define wqe_cqid_MASK         0x0000ffff
3759da0436e9SJames Smart #define wqe_cqid_WORD         word11
3760f0d9bcccSJames Smart #define LPFC_WQE_CQ_ID_DEFAULT	0xffff
3761da0436e9SJames Smart };
3762da0436e9SJames Smart 
3763da0436e9SJames Smart struct wqe_did {
3764da0436e9SJames Smart 	uint32_t word5;
3765da0436e9SJames Smart #define wqe_els_did_SHIFT         0
3766da0436e9SJames Smart #define wqe_els_did_MASK          0x00FFFFFF
3767da0436e9SJames Smart #define wqe_els_did_WORD          word5
37686669f9bbSJames Smart #define wqe_xmit_bls_pt_SHIFT         28
37696669f9bbSJames Smart #define wqe_xmit_bls_pt_MASK          0x00000003
37706669f9bbSJames Smart #define wqe_xmit_bls_pt_WORD          word5
3771da0436e9SJames Smart #define wqe_xmit_bls_ar_SHIFT         30
3772da0436e9SJames Smart #define wqe_xmit_bls_ar_MASK          0x00000001
3773da0436e9SJames Smart #define wqe_xmit_bls_ar_WORD          word5
3774da0436e9SJames Smart #define wqe_xmit_bls_xo_SHIFT         31
3775da0436e9SJames Smart #define wqe_xmit_bls_xo_MASK          0x00000001
3776da0436e9SJames Smart #define wqe_xmit_bls_xo_WORD          word5
3777da0436e9SJames Smart };
3778da0436e9SJames Smart 
3779f0d9bcccSJames Smart struct lpfc_wqe_generic{
3780f0d9bcccSJames Smart 	struct ulp_bde64 bde;
3781f0d9bcccSJames Smart 	uint32_t word3;
3782f0d9bcccSJames Smart 	uint32_t word4;
3783f0d9bcccSJames Smart 	uint32_t word5;
3784f0d9bcccSJames Smart 	struct wqe_common wqe_com;
3785f0d9bcccSJames Smart 	uint32_t payload[4];
3786f0d9bcccSJames Smart };
3787f0d9bcccSJames Smart 
3788da0436e9SJames Smart struct els_request64_wqe {
3789da0436e9SJames Smart 	struct ulp_bde64 bde;
3790da0436e9SJames Smart 	uint32_t payload_len;
3791da0436e9SJames Smart 	uint32_t word4;
3792da0436e9SJames Smart #define els_req64_sid_SHIFT         0
3793da0436e9SJames Smart #define els_req64_sid_MASK          0x00FFFFFF
3794da0436e9SJames Smart #define els_req64_sid_WORD          word4
3795da0436e9SJames Smart #define els_req64_sp_SHIFT          24
3796da0436e9SJames Smart #define els_req64_sp_MASK           0x00000001
3797da0436e9SJames Smart #define els_req64_sp_WORD           word4
3798da0436e9SJames Smart #define els_req64_vf_SHIFT          25
3799da0436e9SJames Smart #define els_req64_vf_MASK           0x00000001
3800da0436e9SJames Smart #define els_req64_vf_WORD           word4
3801da0436e9SJames Smart 	struct wqe_did	wqe_dest;
3802da0436e9SJames Smart 	struct wqe_common wqe_com; /* words 6-11 */
3803da0436e9SJames Smart 	uint32_t word12;
3804da0436e9SJames Smart #define els_req64_vfid_SHIFT        1
3805da0436e9SJames Smart #define els_req64_vfid_MASK         0x00000FFF
3806da0436e9SJames Smart #define els_req64_vfid_WORD         word12
3807da0436e9SJames Smart #define els_req64_pri_SHIFT         13
3808da0436e9SJames Smart #define els_req64_pri_MASK          0x00000007
3809da0436e9SJames Smart #define els_req64_pri_WORD          word12
3810da0436e9SJames Smart 	uint32_t word13;
3811da0436e9SJames Smart #define els_req64_hopcnt_SHIFT      24
3812da0436e9SJames Smart #define els_req64_hopcnt_MASK       0x000000ff
3813da0436e9SJames Smart #define els_req64_hopcnt_WORD       word13
3814af22741cSJames Smart 	uint32_t word14;
3815af22741cSJames Smart 	uint32_t max_response_payload_len;
3816da0436e9SJames Smart };
3817da0436e9SJames Smart 
3818da0436e9SJames Smart struct xmit_els_rsp64_wqe {
3819da0436e9SJames Smart 	struct ulp_bde64 bde;
3820f0d9bcccSJames Smart 	uint32_t response_payload_len;
3821939723a4SJames Smart 	uint32_t word4;
3822939723a4SJames Smart #define els_rsp64_sid_SHIFT         0
3823939723a4SJames Smart #define els_rsp64_sid_MASK          0x00FFFFFF
3824939723a4SJames Smart #define els_rsp64_sid_WORD          word4
3825939723a4SJames Smart #define els_rsp64_sp_SHIFT          24
3826939723a4SJames Smart #define els_rsp64_sp_MASK           0x00000001
3827939723a4SJames Smart #define els_rsp64_sp_WORD           word4
3828da0436e9SJames Smart 	struct wqe_did wqe_dest;
3829da0436e9SJames Smart 	struct wqe_common wqe_com; /* words 6-11 */
3830c31098ceSJames Smart 	uint32_t word12;
3831c31098ceSJames Smart #define wqe_rsp_temp_rpi_SHIFT    0
3832c31098ceSJames Smart #define wqe_rsp_temp_rpi_MASK     0x0000FFFF
3833c31098ceSJames Smart #define wqe_rsp_temp_rpi_WORD     word12
3834c31098ceSJames Smart 	uint32_t rsvd_13_15[3];
3835da0436e9SJames Smart };
3836da0436e9SJames Smart 
3837da0436e9SJames Smart struct xmit_bls_rsp64_wqe {
3838da0436e9SJames Smart 	uint32_t payload0;
38396669f9bbSJames Smart /* Payload0 for BA_ACC */
38406669f9bbSJames Smart #define xmit_bls_rsp64_acc_seq_id_SHIFT        16
38416669f9bbSJames Smart #define xmit_bls_rsp64_acc_seq_id_MASK         0x000000ff
38426669f9bbSJames Smart #define xmit_bls_rsp64_acc_seq_id_WORD         payload0
38436669f9bbSJames Smart #define xmit_bls_rsp64_acc_seq_id_vald_SHIFT   24
38446669f9bbSJames Smart #define xmit_bls_rsp64_acc_seq_id_vald_MASK    0x000000ff
38456669f9bbSJames Smart #define xmit_bls_rsp64_acc_seq_id_vald_WORD    payload0
38466669f9bbSJames Smart /* Payload0 for BA_RJT */
38476669f9bbSJames Smart #define xmit_bls_rsp64_rjt_vspec_SHIFT   0
38486669f9bbSJames Smart #define xmit_bls_rsp64_rjt_vspec_MASK    0x000000ff
38496669f9bbSJames Smart #define xmit_bls_rsp64_rjt_vspec_WORD    payload0
38506669f9bbSJames Smart #define xmit_bls_rsp64_rjt_expc_SHIFT    8
38516669f9bbSJames Smart #define xmit_bls_rsp64_rjt_expc_MASK     0x000000ff
38526669f9bbSJames Smart #define xmit_bls_rsp64_rjt_expc_WORD     payload0
38536669f9bbSJames Smart #define xmit_bls_rsp64_rjt_rsnc_SHIFT    16
38546669f9bbSJames Smart #define xmit_bls_rsp64_rjt_rsnc_MASK     0x000000ff
38556669f9bbSJames Smart #define xmit_bls_rsp64_rjt_rsnc_WORD     payload0
3856da0436e9SJames Smart 	uint32_t word1;
3857da0436e9SJames Smart #define xmit_bls_rsp64_rxid_SHIFT  0
3858da0436e9SJames Smart #define xmit_bls_rsp64_rxid_MASK   0x0000ffff
3859da0436e9SJames Smart #define xmit_bls_rsp64_rxid_WORD   word1
3860da0436e9SJames Smart #define xmit_bls_rsp64_oxid_SHIFT  16
3861da0436e9SJames Smart #define xmit_bls_rsp64_oxid_MASK   0x0000ffff
3862da0436e9SJames Smart #define xmit_bls_rsp64_oxid_WORD   word1
3863da0436e9SJames Smart 	uint32_t word2;
38646669f9bbSJames Smart #define xmit_bls_rsp64_seqcnthi_SHIFT  0
3865da0436e9SJames Smart #define xmit_bls_rsp64_seqcnthi_MASK   0x0000ffff
3866da0436e9SJames Smart #define xmit_bls_rsp64_seqcnthi_WORD   word2
38676669f9bbSJames Smart #define xmit_bls_rsp64_seqcntlo_SHIFT  16
38686669f9bbSJames Smart #define xmit_bls_rsp64_seqcntlo_MASK   0x0000ffff
38696669f9bbSJames Smart #define xmit_bls_rsp64_seqcntlo_WORD   word2
3870da0436e9SJames Smart 	uint32_t rsrvd3;
3871da0436e9SJames Smart 	uint32_t rsrvd4;
3872da0436e9SJames Smart 	struct wqe_did	wqe_dest;
3873da0436e9SJames Smart 	struct wqe_common wqe_com; /* words 6-11 */
38746b5151fdSJames Smart 	uint32_t word12;
38756b5151fdSJames Smart #define xmit_bls_rsp64_temprpi_SHIFT  0
38766b5151fdSJames Smart #define xmit_bls_rsp64_temprpi_MASK   0x0000ffff
38776b5151fdSJames Smart #define xmit_bls_rsp64_temprpi_WORD   word12
38786b5151fdSJames Smart 	uint32_t rsvd_13_15[3];
3879da0436e9SJames Smart };
38806669f9bbSJames Smart 
3881da0436e9SJames Smart struct wqe_rctl_dfctl {
3882da0436e9SJames Smart 	uint32_t word5;
3883da0436e9SJames Smart #define wqe_si_SHIFT 2
3884da0436e9SJames Smart #define wqe_si_MASK  0x000000001
3885da0436e9SJames Smart #define wqe_si_WORD  word5
3886da0436e9SJames Smart #define wqe_la_SHIFT 3
3887da0436e9SJames Smart #define wqe_la_MASK  0x000000001
3888da0436e9SJames Smart #define wqe_la_WORD  word5
38891b51197dSJames Smart #define wqe_xo_SHIFT	6
38901b51197dSJames Smart #define wqe_xo_MASK	0x000000001
38911b51197dSJames Smart #define wqe_xo_WORD	word5
3892da0436e9SJames Smart #define wqe_ls_SHIFT 7
3893da0436e9SJames Smart #define wqe_ls_MASK  0x000000001
3894da0436e9SJames Smart #define wqe_ls_WORD  word5
3895da0436e9SJames Smart #define wqe_dfctl_SHIFT 8
3896da0436e9SJames Smart #define wqe_dfctl_MASK  0x0000000ff
3897da0436e9SJames Smart #define wqe_dfctl_WORD  word5
3898da0436e9SJames Smart #define wqe_type_SHIFT 16
3899da0436e9SJames Smart #define wqe_type_MASK  0x0000000ff
3900da0436e9SJames Smart #define wqe_type_WORD  word5
3901da0436e9SJames Smart #define wqe_rctl_SHIFT 24
3902da0436e9SJames Smart #define wqe_rctl_MASK  0x0000000ff
3903da0436e9SJames Smart #define wqe_rctl_WORD  word5
3904da0436e9SJames Smart };
3905da0436e9SJames Smart 
3906da0436e9SJames Smart struct xmit_seq64_wqe {
3907da0436e9SJames Smart 	struct ulp_bde64 bde;
3908f0d9bcccSJames Smart 	uint32_t rsvd3;
3909da0436e9SJames Smart 	uint32_t relative_offset;
3910da0436e9SJames Smart 	struct wqe_rctl_dfctl wge_ctl;
3911da0436e9SJames Smart 	struct wqe_common wqe_com; /* words 6-11 */
3912da0436e9SJames Smart 	uint32_t xmit_len;
3913da0436e9SJames Smart 	uint32_t rsvd_12_15[3];
3914da0436e9SJames Smart };
3915da0436e9SJames Smart struct xmit_bcast64_wqe {
3916da0436e9SJames Smart 	struct ulp_bde64 bde;
3917f0d9bcccSJames Smart 	uint32_t seq_payload_len;
3918da0436e9SJames Smart 	uint32_t rsvd4;
3919da0436e9SJames Smart 	struct wqe_rctl_dfctl wge_ctl; /* word 5 */
3920da0436e9SJames Smart 	struct wqe_common wqe_com;     /* words 6-11 */
3921da0436e9SJames Smart 	uint32_t rsvd_12_15[4];
3922da0436e9SJames Smart };
3923da0436e9SJames Smart 
3924da0436e9SJames Smart struct gen_req64_wqe {
3925da0436e9SJames Smart 	struct ulp_bde64 bde;
3926f0d9bcccSJames Smart 	uint32_t request_payload_len;
3927f0d9bcccSJames Smart 	uint32_t relative_offset;
3928da0436e9SJames Smart 	struct wqe_rctl_dfctl wge_ctl; /* word 5 */
3929da0436e9SJames Smart 	struct wqe_common wqe_com;     /* words 6-11 */
3930af22741cSJames Smart 	uint32_t rsvd_12_14[3];
3931af22741cSJames Smart 	uint32_t max_response_payload_len;
3932da0436e9SJames Smart };
3933da0436e9SJames Smart 
3934a0f2d3efSJames Smart /* Define NVME PRLI request to fabric. NVME is a
3935a0f2d3efSJames Smart  * fabric-only protocol.
3936a0f2d3efSJames Smart  * Updated to red-lined v1.08 on Sept 16, 2016
3937a0f2d3efSJames Smart  */
3938a0f2d3efSJames Smart struct lpfc_nvme_prli {
3939a0f2d3efSJames Smart 	uint32_t word1;
3940a0f2d3efSJames Smart 	/* The Response Code is defined in the FCP PRLI lpfc_hw.h */
3941a0f2d3efSJames Smart #define prli_acc_rsp_code_SHIFT         8
3942a0f2d3efSJames Smart #define prli_acc_rsp_code_MASK          0x0000000f
3943a0f2d3efSJames Smart #define prli_acc_rsp_code_WORD          word1
3944a0f2d3efSJames Smart #define prli_estabImagePair_SHIFT       13
3945a0f2d3efSJames Smart #define prli_estabImagePair_MASK        0x00000001
3946a0f2d3efSJames Smart #define prli_estabImagePair_WORD        word1
3947a0f2d3efSJames Smart #define prli_type_code_ext_SHIFT        16
3948a0f2d3efSJames Smart #define prli_type_code_ext_MASK         0x000000ff
3949a0f2d3efSJames Smart #define prli_type_code_ext_WORD         word1
3950a0f2d3efSJames Smart #define prli_type_code_SHIFT            24
3951a0f2d3efSJames Smart #define prli_type_code_MASK             0x000000ff
3952a0f2d3efSJames Smart #define prli_type_code_WORD             word1
3953a0f2d3efSJames Smart 	uint32_t word_rsvd2;
3954a0f2d3efSJames Smart 	uint32_t word_rsvd3;
3955a0f2d3efSJames Smart 	uint32_t word4;
3956a0f2d3efSJames Smart #define prli_fba_SHIFT                  0
3957a0f2d3efSJames Smart #define prli_fba_MASK                   0x00000001
3958a0f2d3efSJames Smart #define prli_fba_WORD                   word4
3959a0f2d3efSJames Smart #define prli_disc_SHIFT                 3
3960a0f2d3efSJames Smart #define prli_disc_MASK                  0x00000001
3961a0f2d3efSJames Smart #define prli_disc_WORD                  word4
3962a0f2d3efSJames Smart #define prli_tgt_SHIFT                  4
3963a0f2d3efSJames Smart #define prli_tgt_MASK                   0x00000001
3964a0f2d3efSJames Smart #define prli_tgt_WORD                   word4
3965a0f2d3efSJames Smart #define prli_init_SHIFT                 5
3966a0f2d3efSJames Smart #define prli_init_MASK                  0x00000001
3967a0f2d3efSJames Smart #define prli_init_WORD                  word4
3968a0f2d3efSJames Smart #define prli_recov_SHIFT                8
3969a0f2d3efSJames Smart #define prli_recov_MASK                 0x00000001
3970a0f2d3efSJames Smart #define prli_recov_WORD                 word4
3971a0f2d3efSJames Smart 	uint32_t word5;
3972a0f2d3efSJames Smart #define prli_fb_sz_SHIFT                0
3973a0f2d3efSJames Smart #define prli_fb_sz_MASK                 0x0000ffff
3974a0f2d3efSJames Smart #define prli_fb_sz_WORD                 word5
3975a0f2d3efSJames Smart };
3976a0f2d3efSJames Smart 
3977da0436e9SJames Smart struct create_xri_wqe {
3978da0436e9SJames Smart 	uint32_t rsrvd[5];           /* words 0-4 */
3979da0436e9SJames Smart 	struct wqe_did	wqe_dest;  /* word 5 */
3980da0436e9SJames Smart 	struct wqe_common wqe_com; /* words 6-11 */
3981da0436e9SJames Smart 	uint32_t rsvd_12_15[4];         /* word 12-15 */
3982da0436e9SJames Smart };
3983da0436e9SJames Smart 
3984da0436e9SJames Smart #define T_REQUEST_TAG 3
3985da0436e9SJames Smart #define T_XRI_TAG 1
3986da0436e9SJames Smart 
3987da0436e9SJames Smart struct abort_cmd_wqe {
3988da0436e9SJames Smart 	uint32_t rsrvd[3];
3989da0436e9SJames Smart 	uint32_t word3;
3990da0436e9SJames Smart #define	abort_cmd_ia_SHIFT  0
3991da0436e9SJames Smart #define	abort_cmd_ia_MASK  0x000000001
3992da0436e9SJames Smart #define	abort_cmd_ia_WORD  word3
3993da0436e9SJames Smart #define	abort_cmd_criteria_SHIFT  8
3994da0436e9SJames Smart #define	abort_cmd_criteria_MASK  0x0000000ff
3995da0436e9SJames Smart #define	abort_cmd_criteria_WORD  word3
3996da0436e9SJames Smart 	uint32_t rsrvd4;
3997da0436e9SJames Smart 	uint32_t rsrvd5;
3998da0436e9SJames Smart 	struct wqe_common wqe_com;     /* words 6-11 */
3999da0436e9SJames Smart 	uint32_t rsvd_12_15[4];         /* word 12-15 */
4000da0436e9SJames Smart };
4001da0436e9SJames Smart 
4002da0436e9SJames Smart struct fcp_iwrite64_wqe {
4003da0436e9SJames Smart 	struct ulp_bde64 bde;
40040ba4b219SJames Smart 	uint32_t word3;
40050ba4b219SJames Smart #define	cmd_buff_len_SHIFT  16
40060ba4b219SJames Smart #define	cmd_buff_len_MASK  0x00000ffff
40070ba4b219SJames Smart #define	cmd_buff_len_WORD  word3
40080ba4b219SJames Smart #define payload_offset_len_SHIFT 0
40090ba4b219SJames Smart #define payload_offset_len_MASK 0x0000ffff
40100ba4b219SJames Smart #define payload_offset_len_WORD word3
4011da0436e9SJames Smart 	uint32_t total_xfer_len;
4012da0436e9SJames Smart 	uint32_t initial_xfer_len;
4013da0436e9SJames Smart 	struct wqe_common wqe_com;     /* words 6-11 */
4014fedd3b7bSJames Smart 	uint32_t rsrvd12;
4015fedd3b7bSJames Smart 	struct ulp_bde64 ph_bde;       /* words 13-15 */
4016da0436e9SJames Smart };
4017da0436e9SJames Smart 
4018da0436e9SJames Smart struct fcp_iread64_wqe {
4019da0436e9SJames Smart 	struct ulp_bde64 bde;
40200ba4b219SJames Smart 	uint32_t word3;
40210ba4b219SJames Smart #define	cmd_buff_len_SHIFT  16
40220ba4b219SJames Smart #define	cmd_buff_len_MASK  0x00000ffff
40230ba4b219SJames Smart #define	cmd_buff_len_WORD  word3
40240ba4b219SJames Smart #define payload_offset_len_SHIFT 0
40250ba4b219SJames Smart #define payload_offset_len_MASK 0x0000ffff
40260ba4b219SJames Smart #define payload_offset_len_WORD word3
4027da0436e9SJames Smart 	uint32_t total_xfer_len;       /* word 4 */
4028da0436e9SJames Smart 	uint32_t rsrvd5;               /* word 5 */
4029da0436e9SJames Smart 	struct wqe_common wqe_com;     /* words 6-11 */
4030fedd3b7bSJames Smart 	uint32_t rsrvd12;
4031fedd3b7bSJames Smart 	struct ulp_bde64 ph_bde;       /* words 13-15 */
4032da0436e9SJames Smart };
4033da0436e9SJames Smart 
4034da0436e9SJames Smart struct fcp_icmnd64_wqe {
4035da0436e9SJames Smart 	struct ulp_bde64 bde;          /* words 0-2 */
40360ba4b219SJames Smart 	uint32_t word3;
40370ba4b219SJames Smart #define	cmd_buff_len_SHIFT  16
40380ba4b219SJames Smart #define	cmd_buff_len_MASK  0x00000ffff
40390ba4b219SJames Smart #define	cmd_buff_len_WORD  word3
40400ba4b219SJames Smart #define payload_offset_len_SHIFT 0
40410ba4b219SJames Smart #define payload_offset_len_MASK 0x0000ffff
40420ba4b219SJames Smart #define payload_offset_len_WORD word3
4043f0d9bcccSJames Smart 	uint32_t rsrvd4;               /* word 4 */
4044f0d9bcccSJames Smart 	uint32_t rsrvd5;               /* word 5 */
4045da0436e9SJames Smart 	struct wqe_common wqe_com;     /* words 6-11 */
4046da0436e9SJames Smart 	uint32_t rsvd_12_15[4];        /* word 12-15 */
4047da0436e9SJames Smart };
4048da0436e9SJames Smart 
4049*f358dd0cSJames Smart struct fcp_trsp64_wqe {
4050*f358dd0cSJames Smart 	struct ulp_bde64 bde;
4051*f358dd0cSJames Smart 	uint32_t response_len;
4052*f358dd0cSJames Smart 	uint32_t rsvd_4_5[2];
4053*f358dd0cSJames Smart 	struct wqe_common wqe_com;      /* words 6-11 */
4054*f358dd0cSJames Smart 	uint32_t rsvd_12_15[4];         /* word 12-15 */
4055*f358dd0cSJames Smart };
4056*f358dd0cSJames Smart 
4057*f358dd0cSJames Smart struct fcp_tsend64_wqe {
4058*f358dd0cSJames Smart 	struct ulp_bde64 bde;
4059*f358dd0cSJames Smart 	uint32_t payload_offset_len;
4060*f358dd0cSJames Smart 	uint32_t relative_offset;
4061*f358dd0cSJames Smart 	uint32_t reserved;
4062*f358dd0cSJames Smart 	struct wqe_common wqe_com;     /* words 6-11 */
4063*f358dd0cSJames Smart 	uint32_t fcp_data_len;         /* word 12 */
4064*f358dd0cSJames Smart 	uint32_t rsvd_13_15[3];        /* word 13-15 */
4065*f358dd0cSJames Smart };
4066*f358dd0cSJames Smart 
4067*f358dd0cSJames Smart struct fcp_treceive64_wqe {
4068*f358dd0cSJames Smart 	struct ulp_bde64 bde;
4069*f358dd0cSJames Smart 	uint32_t payload_offset_len;
4070*f358dd0cSJames Smart 	uint32_t relative_offset;
4071*f358dd0cSJames Smart 	uint32_t reserved;
4072*f358dd0cSJames Smart 	struct wqe_common wqe_com;     /* words 6-11 */
4073*f358dd0cSJames Smart 	uint32_t fcp_data_len;         /* word 12 */
4074*f358dd0cSJames Smart 	uint32_t rsvd_13_15[3];        /* word 13-15 */
4075*f358dd0cSJames Smart };
4076*f358dd0cSJames Smart #define TXRDY_PAYLOAD_LEN      12
4077*f358dd0cSJames Smart 
4078da0436e9SJames Smart 
4079da0436e9SJames Smart union lpfc_wqe {
4080da0436e9SJames Smart 	uint32_t words[16];
4081da0436e9SJames Smart 	struct lpfc_wqe_generic generic;
4082da0436e9SJames Smart 	struct fcp_icmnd64_wqe fcp_icmd;
4083da0436e9SJames Smart 	struct fcp_iread64_wqe fcp_iread;
4084da0436e9SJames Smart 	struct fcp_iwrite64_wqe fcp_iwrite;
4085da0436e9SJames Smart 	struct abort_cmd_wqe abort_cmd;
4086da0436e9SJames Smart 	struct create_xri_wqe create_xri;
4087da0436e9SJames Smart 	struct xmit_bcast64_wqe xmit_bcast64;
4088da0436e9SJames Smart 	struct xmit_seq64_wqe xmit_sequence;
4089da0436e9SJames Smart 	struct xmit_bls_rsp64_wqe xmit_bls_rsp;
4090da0436e9SJames Smart 	struct xmit_els_rsp64_wqe xmit_els_rsp;
4091da0436e9SJames Smart 	struct els_request64_wqe els_req;
4092da0436e9SJames Smart 	struct gen_req64_wqe gen_req;
4093*f358dd0cSJames Smart 	struct fcp_trsp64_wqe fcp_trsp;
4094*f358dd0cSJames Smart 	struct fcp_tsend64_wqe fcp_tsend;
4095*f358dd0cSJames Smart 	struct fcp_treceive64_wqe fcp_treceive;
4096*f358dd0cSJames Smart 
4097da0436e9SJames Smart };
4098da0436e9SJames Smart 
40990c651878SJames Smart union lpfc_wqe128 {
41000c651878SJames Smart 	uint32_t words[32];
41010c651878SJames Smart 	struct lpfc_wqe_generic generic;
4102b5c53958SJames Smart 	struct fcp_icmnd64_wqe fcp_icmd;
4103b5c53958SJames Smart 	struct fcp_iread64_wqe fcp_iread;
4104b5c53958SJames Smart 	struct fcp_iwrite64_wqe fcp_iwrite;
4105*f358dd0cSJames Smart 	struct fcp_trsp64_wqe fcp_trsp;
4106*f358dd0cSJames Smart 	struct fcp_tsend64_wqe fcp_tsend;
4107*f358dd0cSJames Smart 	struct fcp_treceive64_wqe fcp_treceive;
41080c651878SJames Smart 	struct xmit_seq64_wqe xmit_sequence;
41090c651878SJames Smart 	struct gen_req64_wqe gen_req;
41100c651878SJames Smart };
41110c651878SJames Smart 
41126b6ef5dbSJames Smart #define LPFC_GROUP_OJECT_MAGIC_G5		0xfeaa0001
41136b6ef5dbSJames Smart #define LPFC_GROUP_OJECT_MAGIC_G6		0xfeaa0003
411452d52440SJames Smart #define LPFC_FILE_TYPE_GROUP			0xf7
411552d52440SJames Smart #define LPFC_FILE_ID_GROUP			0xa2
411652d52440SJames Smart struct lpfc_grp_hdr {
411752d52440SJames Smart 	uint32_t size;
411852d52440SJames Smart 	uint32_t magic_number;
411952d52440SJames Smart 	uint32_t word2;
412052d52440SJames Smart #define lpfc_grp_hdr_file_type_SHIFT	24
412152d52440SJames Smart #define lpfc_grp_hdr_file_type_MASK	0x000000FF
412252d52440SJames Smart #define lpfc_grp_hdr_file_type_WORD	word2
412352d52440SJames Smart #define lpfc_grp_hdr_id_SHIFT		16
412452d52440SJames Smart #define lpfc_grp_hdr_id_MASK		0x000000FF
412552d52440SJames Smart #define lpfc_grp_hdr_id_WORD		word2
412652d52440SJames Smart 	uint8_t rev_name[128];
412788a2cfbbSJames Smart 	uint8_t date[12];
412888a2cfbbSJames Smart 	uint8_t revision[32];
412952d52440SJames Smart };
413052d52440SJames Smart 
4131895427bdSJames Smart /* Defines for WQE command type */
4132da0436e9SJames Smart #define FCP_COMMAND		0x0
4133895427bdSJames Smart #define NVME_READ_CMD		0x0
4134da0436e9SJames Smart #define FCP_COMMAND_DATA_OUT	0x1
4135895427bdSJames Smart #define NVME_WRITE_CMD		0x1
4136895427bdSJames Smart #define FCP_COMMAND_TRECEIVE	0x2
4137895427bdSJames Smart #define FCP_COMMAND_TRSP	0x3
4138895427bdSJames Smart #define FCP_COMMAND_TSEND	0x7
4139895427bdSJames Smart #define OTHER_COMMAND		0x8
4140da0436e9SJames Smart #define ELS_COMMAND_NON_FIP	0xC
4141da0436e9SJames Smart #define ELS_COMMAND_FIP		0xD
4142895427bdSJames Smart 
4143895427bdSJames Smart #define LPFC_NVME_EMBED_CMD	0x0
4144895427bdSJames Smart #define LPFC_NVME_EMBED_WRITE	0x1
4145895427bdSJames Smart #define LPFC_NVME_EMBED_READ	0x2
4146895427bdSJames Smart 
4147895427bdSJames Smart /* WQE Commands */
4148895427bdSJames Smart #define CMD_ABORT_XRI_WQE       0x0F
4149895427bdSJames Smart #define CMD_XMIT_SEQUENCE64_WQE 0x82
4150895427bdSJames Smart #define CMD_XMIT_BCAST64_WQE    0x84
4151895427bdSJames Smart #define CMD_ELS_REQUEST64_WQE   0x8A
4152895427bdSJames Smart #define CMD_XMIT_ELS_RSP64_WQE  0x95
4153895427bdSJames Smart #define CMD_XMIT_BLS_RSP64_WQE  0x97
4154895427bdSJames Smart #define CMD_FCP_IWRITE64_WQE    0x98
4155895427bdSJames Smart #define CMD_FCP_IREAD64_WQE     0x9A
4156895427bdSJames Smart #define CMD_FCP_ICMND64_WQE     0x9C
4157895427bdSJames Smart #define CMD_FCP_TSEND64_WQE     0x9F
4158895427bdSJames Smart #define CMD_FCP_TRECEIVE64_WQE  0xA1
4159895427bdSJames Smart #define CMD_FCP_TRSP64_WQE      0xA3
4160895427bdSJames Smart #define CMD_GEN_REQUEST64_WQE   0xC2
4161895427bdSJames Smart 
4162895427bdSJames Smart #define CMD_WQE_MASK            0xff
4163895427bdSJames Smart 
4164da0436e9SJames Smart 
416552d52440SJames Smart #define LPFC_FW_DUMP	1
416652d52440SJames Smart #define LPFC_FW_RESET	2
416752d52440SJames Smart #define LPFC_DV_RESET	3
4168