1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * CDDL HEADER START
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7fcf3ce44SJohn Forte  *
88f23e9faSHans Rosenfeld  * You can obtain a copy of the license at
98f23e9faSHans Rosenfeld  * http://www.opensource.org/licenses/cddl1.txt.
10fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11fcf3ce44SJohn Forte  * and limitations under the License.
12fcf3ce44SJohn Forte  *
13fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18fcf3ce44SJohn Forte  *
19fcf3ce44SJohn Forte  * CDDL HEADER END
20fcf3ce44SJohn Forte  */
21fcf3ce44SJohn Forte 
22fcf3ce44SJohn Forte /*
238f23e9faSHans Rosenfeld  * Copyright (c) 2004-2012 Emulex. All rights reserved.
2482527734SSukumar Swaminathan  * Use is subject to license terms.
25*a3170057SPaul Winder  * Copyright 2020 RackTop Systems, Inc.
26fcf3ce44SJohn Forte  */
27fcf3ce44SJohn Forte 
28291a2b48SSukumar Swaminathan #define	DEF_ICFG	1
29fcf3ce44SJohn Forte 
30291a2b48SSukumar Swaminathan #include <emlxs.h>
31291a2b48SSukumar Swaminathan #include <emlxs_version.h>
32fcf3ce44SJohn Forte 
3382527734SSukumar Swaminathan 
348f23e9faSHans Rosenfeld static char emlxs_copyright[] = EMLXS_COPYRIGHT;
35291a2b48SSukumar Swaminathan char emlxs_revision[] = EMLXS_REVISION;
36291a2b48SSukumar Swaminathan char emlxs_version[] = EMLXS_VERSION;
37291a2b48SSukumar Swaminathan char emlxs_name[] = EMLXS_NAME;
38291a2b48SSukumar Swaminathan char emlxs_label[] = EMLXS_LABEL;
39fcf3ce44SJohn Forte 
40fcf3ce44SJohn Forte /* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
41fcf3ce44SJohn Forte EMLXS_MSG_DEF(EMLXS_SOLARIS_C);
42fcf3ce44SJohn Forte 
43fcf3ce44SJohn Forte #ifdef MENLO_SUPPORT
44291a2b48SSukumar Swaminathan static int32_t  emlxs_send_menlo(emlxs_port_t *port, emlxs_buf_t *sbp);
45291a2b48SSukumar Swaminathan #endif /* MENLO_SUPPORT */
46291a2b48SSukumar Swaminathan 
47291a2b48SSukumar Swaminathan static void	emlxs_fca_attach(emlxs_hba_t *hba);
48291a2b48SSukumar Swaminathan static void	emlxs_fca_detach(emlxs_hba_t *hba);
49291a2b48SSukumar Swaminathan static void	emlxs_drv_banner(emlxs_hba_t *hba);
50291a2b48SSukumar Swaminathan 
51291a2b48SSukumar Swaminathan static int32_t	emlxs_get_props(emlxs_hba_t *hba);
52a9800bebSGarrett D'Amore static int32_t	emlxs_send_fcp_cmd(emlxs_port_t *port, emlxs_buf_t *sbp,
53a9800bebSGarrett D'Amore 		    uint32_t *pkt_flags);
54291a2b48SSukumar Swaminathan static int32_t	emlxs_send_fct_status(emlxs_port_t *port, emlxs_buf_t *sbp);
55291a2b48SSukumar Swaminathan static int32_t	emlxs_send_fct_abort(emlxs_port_t *port, emlxs_buf_t *sbp);
56291a2b48SSukumar Swaminathan static int32_t	emlxs_send_ip(emlxs_port_t *port, emlxs_buf_t *sbp);
57291a2b48SSukumar Swaminathan static int32_t	emlxs_send_els(emlxs_port_t *port, emlxs_buf_t *sbp);
58291a2b48SSukumar Swaminathan static int32_t	emlxs_send_els_rsp(emlxs_port_t *port, emlxs_buf_t *sbp);
59291a2b48SSukumar Swaminathan static int32_t	emlxs_send_ct(emlxs_port_t *port, emlxs_buf_t *sbp);
60291a2b48SSukumar Swaminathan static int32_t	emlxs_send_ct_rsp(emlxs_port_t *port, emlxs_buf_t *sbp);
61fcf3ce44SJohn Forte static uint32_t emlxs_add_instance(int32_t ddiinst);
62291a2b48SSukumar Swaminathan static void	emlxs_iodone(emlxs_buf_t *sbp);
63291a2b48SSukumar Swaminathan static int	emlxs_pm_lower_power(dev_info_t *dip);
64291a2b48SSukumar Swaminathan static int	emlxs_pm_raise_power(dev_info_t *dip);
65291a2b48SSukumar Swaminathan static void	emlxs_driver_remove(dev_info_t *dip, uint32_t init_flag,
66291a2b48SSukumar Swaminathan 		    uint32_t failed);
67291a2b48SSukumar Swaminathan static void	emlxs_iodone_server(void *arg1, void *arg2, void *arg3);
68291a2b48SSukumar Swaminathan static uint32_t	emlxs_integrity_check(emlxs_hba_t *hba);
69291a2b48SSukumar Swaminathan static uint32_t	emlxs_test(emlxs_hba_t *hba, uint32_t test_code,
70291a2b48SSukumar Swaminathan 		    uint32_t args, uint32_t *arg);
71fcf3ce44SJohn Forte 
72a9800bebSGarrett D'Amore #if (EMLXS_MODREV >= EMLXS_MODREV3) && (EMLXS_MODREV <= EMLXS_MODREV4)
73291a2b48SSukumar Swaminathan static void	emlxs_read_vport_prop(emlxs_hba_t *hba);
748f23e9faSHans Rosenfeld #endif	/* EMLXS_MODREV3 && EMLXS_MODREV4 */
7582527734SSukumar Swaminathan 
768f23e9faSHans Rosenfeld static void	emlxs_mode_init_masks(emlxs_hba_t *hba);
77fcf3ce44SJohn Forte 
78fcf3ce44SJohn Forte 
79a9800bebSGarrett D'Amore extern int
80a9800bebSGarrett D'Amore emlxs_msiid_to_chan(emlxs_hba_t *hba, int msi_id);
81a9800bebSGarrett D'Amore extern int
82a9800bebSGarrett D'Amore emlxs_select_msiid(emlxs_hba_t *hba);
838f23e9faSHans Rosenfeld extern void
848f23e9faSHans Rosenfeld emlxs_sli4_zero_queue_stat(emlxs_hba_t *hba);
85a9800bebSGarrett D'Amore 
86fcf3ce44SJohn Forte /*
87fcf3ce44SJohn Forte  * Driver Entry Routines.
88fcf3ce44SJohn Forte  */
89291a2b48SSukumar Swaminathan static int32_t	emlxs_detach(dev_info_t *, ddi_detach_cmd_t);
90291a2b48SSukumar Swaminathan static int32_t	emlxs_attach(dev_info_t *, ddi_attach_cmd_t);
91291a2b48SSukumar Swaminathan static int32_t	emlxs_open(dev_t *, int32_t, int32_t, cred_t *);
92291a2b48SSukumar Swaminathan static int32_t	emlxs_close(dev_t, int32_t, int32_t, cred_t *);
93291a2b48SSukumar Swaminathan static int32_t	emlxs_ioctl(dev_t, int32_t, intptr_t, int32_t,
94291a2b48SSukumar Swaminathan 		    cred_t *, int32_t *);
95291a2b48SSukumar Swaminathan static int32_t	emlxs_info(dev_info_t *, ddi_info_cmd_t, void *, void **);
96fcf3ce44SJohn Forte 
97fcf3ce44SJohn Forte 
98fcf3ce44SJohn Forte /*
99fcf3ce44SJohn Forte  * FC_AL Transport Functions.
100fcf3ce44SJohn Forte  */
101a9800bebSGarrett D'Amore static opaque_t	emlxs_fca_bind_port(dev_info_t *, fc_fca_port_info_t *,
102291a2b48SSukumar Swaminathan 		    fc_fca_bind_info_t *);
103a9800bebSGarrett D'Amore static void	emlxs_fca_unbind_port(opaque_t);
104291a2b48SSukumar Swaminathan static void	emlxs_initialize_pkt(emlxs_port_t *, emlxs_buf_t *);
105a9800bebSGarrett D'Amore static int32_t	emlxs_fca_get_cap(opaque_t, char *, void *);
106a9800bebSGarrett D'Amore static int32_t	emlxs_fca_set_cap(opaque_t, char *, void *);
107a9800bebSGarrett D'Amore static int32_t	emlxs_fca_get_map(opaque_t, fc_lilpmap_t *);
108a9800bebSGarrett D'Amore static int32_t	emlxs_fca_ub_alloc(opaque_t, uint64_t *, uint32_t,
109291a2b48SSukumar Swaminathan 		    uint32_t *, uint32_t);
110a9800bebSGarrett D'Amore static int32_t	emlxs_fca_ub_free(opaque_t, uint32_t, uint64_t *);
111291a2b48SSukumar Swaminathan 
112a9800bebSGarrett D'Amore static opaque_t	emlxs_fca_get_device(opaque_t, fc_portid_t);
113a9800bebSGarrett D'Amore static int32_t	emlxs_fca_notify(opaque_t, uint32_t);
114291a2b48SSukumar Swaminathan static void	emlxs_ub_els_reject(emlxs_port_t *, fc_unsol_buf_t *);
115fcf3ce44SJohn Forte 
116fcf3ce44SJohn Forte /*
117fcf3ce44SJohn Forte  * Driver Internal Functions.
118fcf3ce44SJohn Forte  */
119fcf3ce44SJohn Forte 
120291a2b48SSukumar Swaminathan static void	emlxs_poll(emlxs_port_t *, emlxs_buf_t *);
121291a2b48SSukumar Swaminathan static int32_t	emlxs_power(dev_info_t *, int32_t, int32_t);
122291a2b48SSukumar Swaminathan #ifdef EMLXS_I386
123291a2b48SSukumar Swaminathan #ifdef S11
124291a2b48SSukumar Swaminathan static int32_t	emlxs_quiesce(dev_info_t *);
1258f23e9faSHans Rosenfeld #endif /* S11 */
1268f23e9faSHans Rosenfeld #endif /* EMLXS_I386 */
127291a2b48SSukumar Swaminathan static int32_t	emlxs_hba_resume(dev_info_t *);
128291a2b48SSukumar Swaminathan static int32_t	emlxs_hba_suspend(dev_info_t *);
129291a2b48SSukumar Swaminathan static int32_t	emlxs_hba_detach(dev_info_t *);
130291a2b48SSukumar Swaminathan static int32_t	emlxs_hba_attach(dev_info_t *);
131291a2b48SSukumar Swaminathan static void	emlxs_lock_destroy(emlxs_hba_t *);
132291a2b48SSukumar Swaminathan static void	emlxs_lock_init(emlxs_hba_t *);
133291a2b48SSukumar Swaminathan 
134291a2b48SSukumar Swaminathan char *emlxs_pm_components[] = {
1358f23e9faSHans Rosenfeld 	"NAME=" DRIVER_NAME "000",
136fcf3ce44SJohn Forte 	"0=Device D3 State",
137fcf3ce44SJohn Forte 	"1=Device D0 State"
138fcf3ce44SJohn Forte };
139fcf3ce44SJohn Forte 
140fcf3ce44SJohn Forte 
141fcf3ce44SJohn Forte /*
142fcf3ce44SJohn Forte  * Default emlx dma limits
143fcf3ce44SJohn Forte  */
144291a2b48SSukumar Swaminathan ddi_dma_lim_t emlxs_dma_lim = {
145291a2b48SSukumar Swaminathan 	(uint32_t)0,				/* dlim_addr_lo */
146291a2b48SSukumar Swaminathan 	(uint32_t)0xffffffff,			/* dlim_addr_hi */
147291a2b48SSukumar Swaminathan 	(uint_t)0x00ffffff,			/* dlim_cntr_max */
148fcf3ce44SJohn Forte 	DEFAULT_BURSTSIZE | BURST32 | BURST64,	/* dlim_burstsizes */
149291a2b48SSukumar Swaminathan 	1,					/* dlim_minxfer */
150291a2b48SSukumar Swaminathan 	0x00ffffff				/* dlim_dmaspeed */
151fcf3ce44SJohn Forte };
152fcf3ce44SJohn Forte 
153fcf3ce44SJohn Forte /*
154fcf3ce44SJohn Forte  * Be careful when using these attributes; the defaults listed below are
155291a2b48SSukumar Swaminathan  * (almost) the most general case, permitting allocation in almost any
156291a2b48SSukumar Swaminathan  * way supported by the LightPulse family.  The sole exception is the
157291a2b48SSukumar Swaminathan  * alignment specified as requiring memory allocation on a 4-byte boundary;
158fcf3ce44SJohn Forte  * the Lightpulse can DMA memory on any byte boundary.
159fcf3ce44SJohn Forte  *
160fcf3ce44SJohn Forte  * The LightPulse family currently is limited to 16M transfers;
161291a2b48SSukumar Swaminathan  * this restriction affects the dma_attr_count_max and dma_attr_maxxfer fields.
162fcf3ce44SJohn Forte  */
163291a2b48SSukumar Swaminathan ddi_dma_attr_t emlxs_dma_attr = {
164291a2b48SSukumar Swaminathan 	DMA_ATTR_V0,				/* dma_attr_version */
165291a2b48SSukumar Swaminathan 	(uint64_t)0,				/* dma_attr_addr_lo */
166291a2b48SSukumar Swaminathan 	(uint64_t)0xffffffffffffffff,		/* dma_attr_addr_hi */
167291a2b48SSukumar Swaminathan 	(uint64_t)0x00ffffff,			/* dma_attr_count_max */
168291a2b48SSukumar Swaminathan 	1,					/* dma_attr_align */
169fcf3ce44SJohn Forte 	DEFAULT_BURSTSIZE | BURST32 | BURST64,	/* dma_attr_burstsizes */
170291a2b48SSukumar Swaminathan 	1,					/* dma_attr_minxfer */
171291a2b48SSukumar Swaminathan 	(uint64_t)0x00ffffff,			/* dma_attr_maxxfer */
172291a2b48SSukumar Swaminathan 	(uint64_t)0xffffffff,			/* dma_attr_seg */
1738f23e9faSHans Rosenfeld 	1,					/* dma_attr_sgllen */
174291a2b48SSukumar Swaminathan 	1,					/* dma_attr_granular */
175291a2b48SSukumar Swaminathan 	0					/* dma_attr_flags */
176fcf3ce44SJohn Forte };
177fcf3ce44SJohn Forte 
178291a2b48SSukumar Swaminathan ddi_dma_attr_t emlxs_dma_attr_ro = {
179291a2b48SSukumar Swaminathan 	DMA_ATTR_V0,				/* dma_attr_version */
180291a2b48SSukumar Swaminathan 	(uint64_t)0,				/* dma_attr_addr_lo */
181291a2b48SSukumar Swaminathan 	(uint64_t)0xffffffffffffffff,		/* dma_attr_addr_hi */
182291a2b48SSukumar Swaminathan 	(uint64_t)0x00ffffff,			/* dma_attr_count_max */
183291a2b48SSukumar Swaminathan 	1,					/* dma_attr_align */
184fcf3ce44SJohn Forte 	DEFAULT_BURSTSIZE | BURST32 | BURST64,	/* dma_attr_burstsizes */
185291a2b48SSukumar Swaminathan 	1,					/* dma_attr_minxfer */
186291a2b48SSukumar Swaminathan 	(uint64_t)0x00ffffff,			/* dma_attr_maxxfer */
187291a2b48SSukumar Swaminathan 	(uint64_t)0xffffffff,			/* dma_attr_seg */
1888f23e9faSHans Rosenfeld 	1,					/* dma_attr_sgllen */
189291a2b48SSukumar Swaminathan 	1,					/* dma_attr_granular */
190291a2b48SSukumar Swaminathan 	DDI_DMA_RELAXED_ORDERING		/* dma_attr_flags */
191fcf3ce44SJohn Forte };
192fcf3ce44SJohn Forte 
193291a2b48SSukumar Swaminathan ddi_dma_attr_t emlxs_dma_attr_1sg = {
194291a2b48SSukumar Swaminathan 	DMA_ATTR_V0,				/* dma_attr_version */
195291a2b48SSukumar Swaminathan 	(uint64_t)0,				/* dma_attr_addr_lo */
196291a2b48SSukumar Swaminathan 	(uint64_t)0xffffffffffffffff,		/* dma_attr_addr_hi */
197291a2b48SSukumar Swaminathan 	(uint64_t)0x00ffffff,			/* dma_attr_count_max */
198291a2b48SSukumar Swaminathan 	1,					/* dma_attr_align */
199fcf3ce44SJohn Forte 	DEFAULT_BURSTSIZE | BURST32 | BURST64,	/* dma_attr_burstsizes */
200291a2b48SSukumar Swaminathan 	1,					/* dma_attr_minxfer */
201291a2b48SSukumar Swaminathan 	(uint64_t)0x00ffffff,			/* dma_attr_maxxfer */
202291a2b48SSukumar Swaminathan 	(uint64_t)0xffffffff,			/* dma_attr_seg */
203291a2b48SSukumar Swaminathan 	1,					/* dma_attr_sgllen */
204291a2b48SSukumar Swaminathan 	1,					/* dma_attr_granular */
205291a2b48SSukumar Swaminathan 	0					/* dma_attr_flags */
206fcf3ce44SJohn Forte };
207fcf3ce44SJohn Forte 
208fcf3ce44SJohn Forte #if (EMLXS_MODREV >= EMLXS_MODREV3)
209291a2b48SSukumar Swaminathan ddi_dma_attr_t emlxs_dma_attr_fcip_rsp = {
210291a2b48SSukumar Swaminathan 	DMA_ATTR_V0,				/* dma_attr_version */
211291a2b48SSukumar Swaminathan 	(uint64_t)0,				/* dma_attr_addr_lo */
212291a2b48SSukumar Swaminathan 	(uint64_t)0xffffffffffffffff,		/* dma_attr_addr_hi */
213291a2b48SSukumar Swaminathan 	(uint64_t)0x00ffffff,			/* dma_attr_count_max */
214291a2b48SSukumar Swaminathan 	1,					/* dma_attr_align */
215fcf3ce44SJohn Forte 	DEFAULT_BURSTSIZE | BURST32 | BURST64,	/* dma_attr_burstsizes */
216291a2b48SSukumar Swaminathan 	1,					/* dma_attr_minxfer */
217291a2b48SSukumar Swaminathan 	(uint64_t)0x00ffffff,			/* dma_attr_maxxfer */
218291a2b48SSukumar Swaminathan 	(uint64_t)0xffffffff,			/* dma_attr_seg */
2198f23e9faSHans Rosenfeld 	1,					/* dma_attr_sgllen */
220291a2b48SSukumar Swaminathan 	1,					/* dma_attr_granular */
221291a2b48SSukumar Swaminathan 	0					/* dma_attr_flags */
222fcf3ce44SJohn Forte };
223fcf3ce44SJohn Forte #endif	/* >= EMLXS_MODREV3 */
224fcf3ce44SJohn Forte 
225fcf3ce44SJohn Forte /*
226fcf3ce44SJohn Forte  * DDI access attributes for device
227fcf3ce44SJohn Forte  */
228291a2b48SSukumar Swaminathan ddi_device_acc_attr_t emlxs_dev_acc_attr = {
229bb63f56eSSukumar Swaminathan 	DDI_DEVICE_ATTR_V1,	/* devacc_attr_version		*/
230bb63f56eSSukumar Swaminathan 	DDI_STRUCTURE_LE_ACC,	/* PCI is Little Endian		*/
231bb63f56eSSukumar Swaminathan 	DDI_STRICTORDER_ACC,	/* devacc_attr_dataorder	*/
232bb63f56eSSukumar Swaminathan 	DDI_DEFAULT_ACC		/* devacc_attr_access		*/
233fcf3ce44SJohn Forte };
234fcf3ce44SJohn Forte 
235fcf3ce44SJohn Forte /*
236fcf3ce44SJohn Forte  * DDI access attributes for data
237fcf3ce44SJohn Forte  */
238291a2b48SSukumar Swaminathan ddi_device_acc_attr_t emlxs_data_acc_attr = {
239bb63f56eSSukumar Swaminathan 	DDI_DEVICE_ATTR_V1,	/* devacc_attr_version		*/
240bb63f56eSSukumar Swaminathan 	DDI_NEVERSWAP_ACC,	/* don't swap for Data		*/
241bb63f56eSSukumar Swaminathan 	DDI_STRICTORDER_ACC,	/* devacc_attr_dataorder	*/
242bb63f56eSSukumar Swaminathan 	DDI_DEFAULT_ACC		/* devacc_attr_access		*/
243fcf3ce44SJohn Forte };
244fcf3ce44SJohn Forte 
245fcf3ce44SJohn Forte /*
246291a2b48SSukumar Swaminathan  * Fill in the FC Transport structure,
247291a2b48SSukumar Swaminathan  * as defined in the Fibre Channel Transport Programmming Guide.
248fcf3ce44SJohn Forte  */
249fcf3ce44SJohn Forte #if (EMLXS_MODREV == EMLXS_MODREV5)
250291a2b48SSukumar Swaminathan 	static fc_fca_tran_t emlxs_fca_tran = {
2518bb4c5a6SToomas Soome 	FCTL_FCA_MODREV_5,		/* fca_version, with SUN NPIV support */
252291a2b48SSukumar Swaminathan 	MAX_VPORTS,			/* fca numerb of ports */
253291a2b48SSukumar Swaminathan 	sizeof (emlxs_buf_t),		/* fca pkt size */
254291a2b48SSukumar Swaminathan 	2048,				/* fca cmd max */
255291a2b48SSukumar Swaminathan 	&emlxs_dma_lim,			/* fca dma limits */
256291a2b48SSukumar Swaminathan 	0,				/* fca iblock, to be filled in later */
257291a2b48SSukumar Swaminathan 	&emlxs_dma_attr,		/* fca dma attributes */
258291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcp cmd attributes */
259291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcp rsp attributes */
260291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_ro,		/* fca dma fcp data attributes */
261291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcip cmd attributes */
262fcf3ce44SJohn Forte 	&emlxs_dma_attr_fcip_rsp,	/* fca dma fcip rsp attributes */
263291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcsm cmd attributes */
264291a2b48SSukumar Swaminathan 	&emlxs_dma_attr,		/* fca dma fcsm rsp attributes */
2658bb4c5a6SToomas Soome 	&emlxs_data_acc_attr,		/* fca access atributes */
266291a2b48SSukumar Swaminathan 	0,				/* fca_num_npivports */
267fcf3ce44SJohn Forte 	{0, 0, 0, 0, 0, 0, 0, 0},	/* Physical port WWPN */
268a9800bebSGarrett D'Amore 	emlxs_fca_bind_port,
269a9800bebSGarrett D'Amore 	emlxs_fca_unbind_port,
270a9800bebSGarrett D'Amore 	emlxs_fca_pkt_init,
271a9800bebSGarrett D'Amore 	emlxs_fca_pkt_uninit,
272a9800bebSGarrett D'Amore 	emlxs_fca_transport,
273a9800bebSGarrett D'Amore 	emlxs_fca_get_cap,
274a9800bebSGarrett D'Amore 	emlxs_fca_set_cap,
275a9800bebSGarrett D'Amore 	emlxs_fca_get_map,
276a9800bebSGarrett D'Amore 	emlxs_fca_transport,
277a9800bebSGarrett D'Amore 	emlxs_fca_ub_alloc,
278a9800bebSGarrett D'Amore 	emlxs_fca_ub_free,
279a9800bebSGarrett D'Amore 	emlxs_fca_ub_release,
280a9800bebSGarrett D'Amore 	emlxs_fca_pkt_abort,
2816a573d82SSukumar Swaminathan 	emlxs_fca_reset,
282a9800bebSGarrett D'Amore 	emlxs_fca_port_manage,
283a9800bebSGarrett D'Amore 	emlxs_fca_get_device,
284a9800bebSGarrett D'Amore 	emlxs_fca_notify
285fcf3ce44SJohn Forte };
286fcf3ce44SJohn Forte #endif	/* EMLXS_MODREV5 */
287fcf3ce44SJohn Forte 
288fcf3ce44SJohn Forte 
289fcf3ce44SJohn Forte #if (EMLXS_MODREV == EMLXS_MODREV4)
290291a2b48SSukumar Swaminathan static fc_fca_tran_t emlxs_fca_tran = {
291291a2b48SSukumar Swaminathan 	FCTL_FCA_MODREV_4,		/* fca_version */
292291a2b48SSukumar Swaminathan 	MAX_VPORTS,			/* fca numerb of ports */
293291a2b48SSukumar Swaminathan 	sizeof (emlxs_buf_t),		/* fca pkt size */
294291a2b48SSukumar Swaminathan 	2048,				/* fca cmd max */
295291a2b48SSukumar Swaminathan 	&emlxs_dma_lim,			/* fca dma limits */
296291a2b48SSukumar Swaminathan 	0,				/* fca iblock, to be filled in later */
297291a2b48SSukumar Swaminathan 	&emlxs_dma_attr,		/* fca dma attributes */
298291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcp cmd attributes */
299291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcp rsp attributes */
300291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_ro,		/* fca dma fcp data attributes */
301291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcip cmd attributes */
302fcf3ce44SJohn Forte 	&emlxs_dma_attr_fcip_rsp,	/* fca dma fcip rsp attributes */
303291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcsm cmd attributes */
304291a2b48SSukumar Swaminathan 	&emlxs_dma_attr,		/* fca dma fcsm rsp attributes */
305291a2b48SSukumar Swaminathan 	&emlxs_data_acc_attr,		/* fca access atributes */
306a9800bebSGarrett D'Amore 	emlxs_fca_bind_port,
307a9800bebSGarrett D'Amore 	emlxs_fca_unbind_port,
308a9800bebSGarrett D'Amore 	emlxs_fca_pkt_init,
309a9800bebSGarrett D'Amore 	emlxs_fca_pkt_uninit,
310a9800bebSGarrett D'Amore 	emlxs_fca_transport,
311a9800bebSGarrett D'Amore 	emlxs_fca_get_cap,
312a9800bebSGarrett D'Amore 	emlxs_fca_set_cap,
313a9800bebSGarrett D'Amore 	emlxs_fca_get_map,
314a9800bebSGarrett D'Amore 	emlxs_fca_transport,
315a9800bebSGarrett D'Amore 	emlxs_fca_ub_alloc,
316a9800bebSGarrett D'Amore 	emlxs_fca_ub_free,
317a9800bebSGarrett D'Amore 	emlxs_fca_ub_release,
318a9800bebSGarrett D'Amore 	emlxs_fca_pkt_abort,
3196a573d82SSukumar Swaminathan 	emlxs_fca_reset,
320a9800bebSGarrett D'Amore 	emlxs_fca_port_manage,
321a9800bebSGarrett D'Amore 	emlxs_fca_get_device,
322a9800bebSGarrett D'Amore 	emlxs_fca_notify
323fcf3ce44SJohn Forte };
324fcf3ce44SJohn Forte #endif	/* EMLXS_MODEREV4 */
325fcf3ce44SJohn Forte 
326fcf3ce44SJohn Forte 
327fcf3ce44SJohn Forte #if (EMLXS_MODREV == EMLXS_MODREV3)
328291a2b48SSukumar Swaminathan static fc_fca_tran_t emlxs_fca_tran = {
329291a2b48SSukumar Swaminathan 	FCTL_FCA_MODREV_3,		/* fca_version */
330291a2b48SSukumar Swaminathan 	MAX_VPORTS,			/* fca numerb of ports */
331291a2b48SSukumar Swaminathan 	sizeof (emlxs_buf_t),		/* fca pkt size */
332291a2b48SSukumar Swaminathan 	2048,				/* fca cmd max */
333291a2b48SSukumar Swaminathan 	&emlxs_dma_lim,			/* fca dma limits */
334291a2b48SSukumar Swaminathan 	0,				/* fca iblock, to be filled in later */
335291a2b48SSukumar Swaminathan 	&emlxs_dma_attr,		/* fca dma attributes */
336291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcp cmd attributes */
337291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcp rsp attributes */
338291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_ro,		/* fca dma fcp data attributes */
339291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcip cmd attributes */
340fcf3ce44SJohn Forte 	&emlxs_dma_attr_fcip_rsp,	/* fca dma fcip rsp attributes */
341291a2b48SSukumar Swaminathan 	&emlxs_dma_attr_1sg,		/* fca dma fcsm cmd attributes */
342291a2b48SSukumar Swaminathan 	&emlxs_dma_attr,		/* fca dma fcsm rsp attributes */
343291a2b48SSukumar Swaminathan 	&emlxs_data_acc_attr,		/* fca access atributes */
344a9800bebSGarrett D'Amore 	emlxs_fca_bind_port,
345a9800bebSGarrett D'Amore 	emlxs_fca_unbind_port,
346a9800bebSGarrett D'Amore 	emlxs_fca_pkt_init,
347a9800bebSGarrett D'Amore 	emlxs_fca_pkt_uninit,
348a9800bebSGarrett D'Amore 	emlxs_fca_transport,
349a9800bebSGarrett D'Amore 	emlxs_fca_get_cap,
350a9800bebSGarrett D'Amore 	emlxs_fca_set_cap,
351a9800bebSGarrett D'Amore 	emlxs_fca_get_map,
352a9800bebSGarrett D'Amore 	emlxs_fca_transport,
353a9800bebSGarrett D'Amore 	emlxs_fca_ub_alloc,
354a9800bebSGarrett D'Amore 	emlxs_fca_ub_free,
355a9800bebSGarrett D'Amore 	emlxs_fca_ub_release,
356a9800bebSGarrett D'Amore 	emlxs_fca_pkt_abort,
3576a573d82SSukumar Swaminathan 	emlxs_fca_reset,
358a9800bebSGarrett D'Amore 	emlxs_fca_port_manage,
359a9800bebSGarrett D'Amore 	emlxs_fca_get_device,
360a9800bebSGarrett D'Amore 	emlxs_fca_notify
361fcf3ce44SJohn Forte };
362fcf3ce44SJohn Forte #endif	/* EMLXS_MODREV3 */
363fcf3ce44SJohn Forte 
364fcf3ce44SJohn Forte 
365fcf3ce44SJohn Forte #if (EMLXS_MODREV == EMLXS_MODREV2)
366291a2b48SSukumar Swaminathan static fc_fca_tran_t emlxs_fca_tran = {
367291a2b48SSukumar Swaminathan 	FCTL_FCA_MODREV_2,		/* fca_version */
368291a2b48SSukumar Swaminathan 	MAX_VPORTS,			/* number of ports */
369291a2b48SSukumar Swaminathan 	sizeof (emlxs_buf_t),		/* pkt size */
370291a2b48SSukumar Swaminathan 	2048,				/* max cmds */
371291a2b48SSukumar Swaminathan 	&emlxs_dma_lim,			/* DMA limits */
372291a2b48SSukumar Swaminathan 	0,				/* iblock, to be filled in later */
373291a2b48SSukumar Swaminathan 	&emlxs_dma_attr,		/* dma attributes */
374291a2b48SSukumar Swaminathan 	&emlxs_data_acc_attr,		/* access atributes */
375a9800bebSGarrett D'Amore 	emlxs_fca_bind_port,
376a9800bebSGarrett D'Amore 	emlxs_fca_unbind_port,
377a9800bebSGarrett D'Amore 	emlxs_fca_pkt_init,
378a9800bebSGarrett D'Amore 	emlxs_fca_pkt_uninit,
379a9800bebSGarrett D'Amore 	emlxs_fca_transport,
380a9800bebSGarrett D'Amore 	emlxs_fca_get_cap,
381a9800bebSGarrett D'Amore 	emlxs_fca_set_cap,
382a9800bebSGarrett D'Amore 	emlxs_fca_get_map,
383a9800bebSGarrett D'Amore 	emlxs_fca_transport,
384a9800bebSGarrett D'Amore 	emlxs_fca_ub_alloc,
385a9800bebSGarrett D'Amore 	emlxs_fca_ub_free,
386a9800bebSGarrett D'Amore 	emlxs_fca_ub_release,
387a9800bebSGarrett D'Amore 	emlxs_fca_pkt_abort,
3886a573d82SSukumar Swaminathan 	emlxs_fca_reset,
389a9800bebSGarrett D'Amore 	emlxs_fca_port_manage,
390a9800bebSGarrett D'Amore 	emlxs_fca_get_device,
391a9800bebSGarrett D'Amore 	emlxs_fca_notify
392fcf3ce44SJohn Forte };
393fcf3ce44SJohn Forte #endif	/* EMLXS_MODREV2 */
394fcf3ce44SJohn Forte 
3958f23e9faSHans Rosenfeld 
396fcf3ce44SJohn Forte /*
397291a2b48SSukumar Swaminathan  * state pointer which the implementation uses as a place to
398291a2b48SSukumar Swaminathan  * hang a set of per-driver structures;
399291a2b48SSukumar Swaminathan  *
400fcf3ce44SJohn Forte  */
401291a2b48SSukumar Swaminathan void		*emlxs_soft_state = NULL;
402fcf3ce44SJohn Forte 
403fcf3ce44SJohn Forte /*
404fcf3ce44SJohn Forte  * Driver Global variables.
405fcf3ce44SJohn Forte  */
406291a2b48SSukumar Swaminathan int32_t		emlxs_scsi_reset_delay = 3000;	/* milliseconds */
407fcf3ce44SJohn Forte 
408291a2b48SSukumar Swaminathan emlxs_device_t  emlxs_device;
409fcf3ce44SJohn Forte 
410291a2b48SSukumar Swaminathan uint32_t	emlxs_instance[MAX_FC_BRDS];	/* uses emlxs_device.lock */
411291a2b48SSukumar Swaminathan uint32_t	emlxs_instance_count = 0;	/* uses emlxs_device.lock */
412a9800bebSGarrett D'Amore uint32_t	emlxs_instance_flag = 0;	/* uses emlxs_device.lock */
413a9800bebSGarrett D'Amore #define	EMLXS_FW_SHOW		0x00000001
414fcf3ce44SJohn Forte 
415fcf3ce44SJohn Forte 
416fcf3ce44SJohn Forte /*
417fcf3ce44SJohn Forte  * CB ops vector.  Used for administration only.
418fcf3ce44SJohn Forte  */
419291a2b48SSukumar Swaminathan static struct cb_ops emlxs_cb_ops = {
420291a2b48SSukumar Swaminathan 	emlxs_open,	/* cb_open	*/
421291a2b48SSukumar Swaminathan 	emlxs_close,	/* cb_close	*/
422291a2b48SSukumar Swaminathan 	nodev,		/* cb_strategy	*/
423291a2b48SSukumar Swaminathan 	nodev,		/* cb_print	*/
424291a2b48SSukumar Swaminathan 	nodev,		/* cb_dump	*/
425291a2b48SSukumar Swaminathan 	nodev,		/* cb_read	*/
426291a2b48SSukumar Swaminathan 	nodev,		/* cb_write	*/
427291a2b48SSukumar Swaminathan 	emlxs_ioctl,	/* cb_ioctl	*/
428291a2b48SSukumar Swaminathan 	nodev,		/* cb_devmap	*/
429291a2b48SSukumar Swaminathan 	nodev,		/* cb_mmap	*/
430291a2b48SSukumar Swaminathan 	nodev,		/* cb_segmap	*/
431291a2b48SSukumar Swaminathan 	nochpoll,	/* cb_chpoll	*/
432291a2b48SSukumar Swaminathan 	ddi_prop_op,	/* cb_prop_op	*/
433291a2b48SSukumar Swaminathan 	0,		/* cb_stream	*/
434fcf3ce44SJohn Forte #ifdef _LP64
435fcf3ce44SJohn Forte 	D_64BIT | D_HOTPLUG | D_MP | D_NEW,	/* cb_flag */
436fcf3ce44SJohn Forte #else
437291a2b48SSukumar Swaminathan 	D_HOTPLUG | D_MP | D_NEW,		/* cb_flag */
438fcf3ce44SJohn Forte #endif
439291a2b48SSukumar Swaminathan 	CB_REV,		/* rev		*/
440291a2b48SSukumar Swaminathan 	nodev,		/* cb_aread	*/
441291a2b48SSukumar Swaminathan 	nodev		/* cb_awrite	*/
442fcf3ce44SJohn Forte };
443fcf3ce44SJohn Forte 
444291a2b48SSukumar Swaminathan static struct dev_ops emlxs_ops = {
445fcf3ce44SJohn Forte 	DEVO_REV,	/* rev */
446fcf3ce44SJohn Forte 	0,	/* refcnt */
447291a2b48SSukumar Swaminathan 	emlxs_info,	/* getinfo	*/
448291a2b48SSukumar Swaminathan 	nulldev,	/* identify	*/
449291a2b48SSukumar Swaminathan 	nulldev,	/* probe	*/
450291a2b48SSukumar Swaminathan 	emlxs_attach,	/* attach	*/
451291a2b48SSukumar Swaminathan 	emlxs_detach,	/* detach	*/
452291a2b48SSukumar Swaminathan 	nodev,		/* reset	*/
453291a2b48SSukumar Swaminathan 	&emlxs_cb_ops,	/* devo_cb_ops	*/
4544baa2c25SSukumar Swaminathan 	NULL,		/* devo_bus_ops */
455291a2b48SSukumar Swaminathan 	emlxs_power,	/* power ops	*/
456291a2b48SSukumar Swaminathan #ifdef EMLXS_I386
457291a2b48SSukumar Swaminathan #ifdef S11
458291a2b48SSukumar Swaminathan 	emlxs_quiesce,	/* quiesce	*/
4598f23e9faSHans Rosenfeld #endif /* S11 */
4608f23e9faSHans Rosenfeld #endif /* EMLXS_I386 */
461fcf3ce44SJohn Forte };
462fcf3ce44SJohn Forte 
463fcf3ce44SJohn Forte #include <sys/modctl.h>
464fcf3ce44SJohn Forte extern struct mod_ops mod_driverops;
465fcf3ce44SJohn Forte 
466291a2b48SSukumar Swaminathan #ifdef SAN_DIAG_SUPPORT
4678f23e9faSHans Rosenfeld extern kmutex_t		emlxs_sd_bucket_mutex;
4688f23e9faSHans Rosenfeld extern sd_bucket_info_t	emlxs_sd_bucket;
469291a2b48SSukumar Swaminathan #endif /* SAN_DIAG_SUPPORT */
470291a2b48SSukumar Swaminathan 
471fcf3ce44SJohn Forte /*
472fcf3ce44SJohn Forte  * Module linkage information for the kernel.
473fcf3ce44SJohn Forte  */
474291a2b48SSukumar Swaminathan static struct modldrv emlxs_modldrv = {
475fcf3ce44SJohn Forte 	&mod_driverops,	/* module type - driver */
476fcf3ce44SJohn Forte 	emlxs_name,	/* module name */
477fcf3ce44SJohn Forte 	&emlxs_ops,	/* driver ops */
478fcf3ce44SJohn Forte };
479fcf3ce44SJohn Forte 
480fcf3ce44SJohn Forte 
481fcf3ce44SJohn Forte /*
482fcf3ce44SJohn Forte  * Driver module linkage structure
483fcf3ce44SJohn Forte  */
484fcf3ce44SJohn Forte static struct modlinkage emlxs_modlinkage = {
485fcf3ce44SJohn Forte 	MODREV_1,	/* ml_rev - must be MODREV_1 */
486fcf3ce44SJohn Forte 	&emlxs_modldrv,	/* ml_linkage */
487fcf3ce44SJohn Forte 	NULL	/* end of driver linkage */
488fcf3ce44SJohn Forte };
489fcf3ce44SJohn Forte 
490fcf3ce44SJohn Forte 
491fcf3ce44SJohn Forte /* We only need to add entries for non-default return codes. */
492fcf3ce44SJohn Forte /* Entries do not need to be in order. */
493291a2b48SSukumar Swaminathan /* Default:	FC_PKT_TRAN_ERROR,	FC_REASON_ABORTED, */
494291a2b48SSukumar Swaminathan /*		FC_EXPLN_NONE,		FC_ACTION_RETRYABLE */
495291a2b48SSukumar Swaminathan 
496291a2b48SSukumar Swaminathan emlxs_xlat_err_t emlxs_iostat_tbl[] = {
4978bb4c5a6SToomas Soome /*	{f/w code, pkt_state, pkt_reason,	*/
4988bb4c5a6SToomas Soome /*		pkt_expln, pkt_action}		*/
499fcf3ce44SJohn Forte 
500fcf3ce44SJohn Forte 	/* 0x00 - Do not remove */
501fcf3ce44SJohn Forte 	{IOSTAT_SUCCESS, FC_PKT_SUCCESS, FC_REASON_NONE,
502291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
503fcf3ce44SJohn Forte 
504fcf3ce44SJohn Forte 	/* 0x01 - Do not remove */
505fcf3ce44SJohn Forte 	{IOSTAT_FCP_RSP_ERROR, FC_PKT_SUCCESS, FC_REASON_NONE,
506291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
507fcf3ce44SJohn Forte 
508fcf3ce44SJohn Forte 	/* 0x02 */
509fcf3ce44SJohn Forte 	{IOSTAT_REMOTE_STOP, FC_PKT_REMOTE_STOP, FC_REASON_ABTS,
510291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_NON_RETRYABLE},
511fcf3ce44SJohn Forte 
512fcf3ce44SJohn Forte 	/*
513291a2b48SSukumar Swaminathan 	 * This is a default entry.
514291a2b48SSukumar Swaminathan 	 * The real codes are written dynamically in emlxs_els.c
515fcf3ce44SJohn Forte 	 */
516291a2b48SSukumar Swaminathan 	/* 0x09 */
517291a2b48SSukumar Swaminathan 	{IOSTAT_LS_RJT, FC_PKT_LS_RJT, FC_REASON_CMD_UNABLE,
518291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
519fcf3ce44SJohn Forte 
520fcf3ce44SJohn Forte 	/* Special error code */
521fcf3ce44SJohn Forte 	/* 0x10 */
522fcf3ce44SJohn Forte 	{IOSTAT_DATA_OVERRUN, FC_PKT_TRAN_ERROR, FC_REASON_OVERRUN,
523291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
524fcf3ce44SJohn Forte 
525fcf3ce44SJohn Forte 	/* Special error code */
526fcf3ce44SJohn Forte 	/* 0x11 */
527fcf3ce44SJohn Forte 	{IOSTAT_DATA_UNDERRUN, FC_PKT_TRAN_ERROR, FC_REASON_ABORTED,
528291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
529fcf3ce44SJohn Forte 
5308f23e9faSHans Rosenfeld 	/* Special error code */
5318f23e9faSHans Rosenfeld 	/* 0x12 */
5328f23e9faSHans Rosenfeld 	{IOSTAT_RSP_INVALID, FC_PKT_TRAN_ERROR, FC_REASON_ABORTED,
5338f23e9faSHans Rosenfeld 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
5348f23e9faSHans Rosenfeld 
535fcf3ce44SJohn Forte 	/* CLASS 2 only */
536fcf3ce44SJohn Forte 	/* 0x04 */
537fcf3ce44SJohn Forte 	{IOSTAT_NPORT_RJT, FC_PKT_NPORT_RJT, FC_REASON_PROTOCOL_ERROR,
538291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
539fcf3ce44SJohn Forte 
540fcf3ce44SJohn Forte 	/* CLASS 2 only */
541fcf3ce44SJohn Forte 	/* 0x05 */
542fcf3ce44SJohn Forte 	{IOSTAT_FABRIC_RJT, FC_PKT_FABRIC_RJT, FC_REASON_PROTOCOL_ERROR,
543291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
544fcf3ce44SJohn Forte 
545fcf3ce44SJohn Forte 	/* CLASS 2 only */
546fcf3ce44SJohn Forte 	/* 0x06 */
547fcf3ce44SJohn Forte 	{IOSTAT_NPORT_BSY, FC_PKT_NPORT_BSY, FC_REASON_PHYSICAL_BUSY,
548291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_SEQ_TERM_RETRY},
549fcf3ce44SJohn Forte 
550fcf3ce44SJohn Forte 	/* CLASS 2 only */
551fcf3ce44SJohn Forte 	/* 0x07 */
552fcf3ce44SJohn Forte 	{IOSTAT_FABRIC_BSY, FC_PKT_FABRIC_BSY, FC_REASON_FABRIC_BSY,
553291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_SEQ_TERM_RETRY},
554fcf3ce44SJohn Forte };
555291a2b48SSukumar Swaminathan 
556291a2b48SSukumar Swaminathan #define	IOSTAT_MAX (sizeof (emlxs_iostat_tbl)/sizeof (emlxs_xlat_err_t))
557fcf3ce44SJohn Forte 
558fcf3ce44SJohn Forte 
559fcf3ce44SJohn Forte /* We only need to add entries for non-default return codes. */
560fcf3ce44SJohn Forte /* Entries do not need to be in order. */
561291a2b48SSukumar Swaminathan /* Default:	FC_PKT_TRAN_ERROR,	FC_REASON_ABORTED, */
562291a2b48SSukumar Swaminathan /*		FC_EXPLN_NONE,		FC_ACTION_RETRYABLE} */
563291a2b48SSukumar Swaminathan 
564291a2b48SSukumar Swaminathan emlxs_xlat_err_t emlxs_ioerr_tbl[] = {
565291a2b48SSukumar Swaminathan /*	{f/w code, pkt_state, pkt_reason,	*/
566291a2b48SSukumar Swaminathan /*		pkt_expln, pkt_action}		*/
567291a2b48SSukumar Swaminathan 
568fcf3ce44SJohn Forte 	/* 0x01 */
569fcf3ce44SJohn Forte 	{IOERR_MISSING_CONTINUE, FC_PKT_TRAN_ERROR, FC_REASON_OVERRUN,
570291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
571fcf3ce44SJohn Forte 
572fcf3ce44SJohn Forte 	/* 0x02 */
573fcf3ce44SJohn Forte 	{IOERR_SEQUENCE_TIMEOUT, FC_PKT_TIMEOUT, FC_REASON_SEQ_TIMEOUT,
574291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
575fcf3ce44SJohn Forte 
576fcf3ce44SJohn Forte 	/* 0x04 */
577fcf3ce44SJohn Forte 	{IOERR_INVALID_RPI, FC_PKT_PORT_OFFLINE, FC_REASON_OFFLINE,
578291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
579fcf3ce44SJohn Forte 
580fcf3ce44SJohn Forte 	/* 0x05 */
581fcf3ce44SJohn Forte 	{IOERR_NO_XRI, FC_PKT_LOCAL_RJT, FC_REASON_XCHG_DROPPED,
582291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
583fcf3ce44SJohn Forte 
584fcf3ce44SJohn Forte 	/* 0x06 */
585291a2b48SSukumar Swaminathan 	{IOERR_ILLEGAL_COMMAND,	FC_PKT_LOCAL_RJT, FC_REASON_ILLEGAL_REQ,
586291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
587fcf3ce44SJohn Forte 
588fcf3ce44SJohn Forte 	/* 0x07 */
589291a2b48SSukumar Swaminathan 	{IOERR_XCHG_DROPPED, FC_PKT_LOCAL_RJT,	FC_REASON_XCHG_DROPPED,
590291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
591fcf3ce44SJohn Forte 
592fcf3ce44SJohn Forte 	/* 0x08 */
593291a2b48SSukumar Swaminathan 	{IOERR_ILLEGAL_FIELD, FC_PKT_LOCAL_RJT,	FC_REASON_ILLEGAL_REQ,
594291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
595fcf3ce44SJohn Forte 
596fcf3ce44SJohn Forte 	/* 0x0B */
597fcf3ce44SJohn Forte 	{IOERR_RCV_BUFFER_WAITING, FC_PKT_LOCAL_RJT, FC_REASON_NOMEM,
598291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
599fcf3ce44SJohn Forte 
600fcf3ce44SJohn Forte 	/* 0x0D */
601291a2b48SSukumar Swaminathan 	{IOERR_TX_DMA_FAILED, FC_PKT_LOCAL_RJT,	FC_REASON_DMA_ERROR,
602291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
603fcf3ce44SJohn Forte 
604fcf3ce44SJohn Forte 	/* 0x0E */
605291a2b48SSukumar Swaminathan 	{IOERR_RX_DMA_FAILED, FC_PKT_LOCAL_RJT,	FC_REASON_DMA_ERROR,
606291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
607fcf3ce44SJohn Forte 
608fcf3ce44SJohn Forte 	/* 0x0F */
609291a2b48SSukumar Swaminathan 	{IOERR_ILLEGAL_FRAME, FC_PKT_LOCAL_RJT,	FC_REASON_ILLEGAL_FRAME,
610291a2b48SSukumar Swaminathan 		FC_EXPLN_NONE, FC_ACTION_RETRYABLE},
611fcf3ce44SJohn Forte 
612fcf3ce44SJohn Forte 	/* 0x11 */
613291a2b48SSukumar Swaminathan 	{IOERR_NO_RESOURCES, FC_PKT_LOCAL_RJT,