1*fcf3ce44SJohn Forte /*
2*fcf3ce44SJohn Forte  * CDDL HEADER START
3*fcf3ce44SJohn Forte  *
4*fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5*fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6*fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7*fcf3ce44SJohn Forte  *
8*fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10*fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11*fcf3ce44SJohn Forte  * and limitations under the License.
12*fcf3ce44SJohn Forte  *
13*fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14*fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16*fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17*fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18*fcf3ce44SJohn Forte  *
19*fcf3ce44SJohn Forte  * CDDL HEADER END
20*fcf3ce44SJohn Forte  */
21*fcf3ce44SJohn Forte /*
22*fcf3ce44SJohn Forte  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*fcf3ce44SJohn Forte  * Use is subject to license terms.
24*fcf3ce44SJohn Forte  */
25*fcf3ce44SJohn Forte 
26*fcf3ce44SJohn Forte #ifndef	_FC_TYPES_H
27*fcf3ce44SJohn Forte #define	_FC_TYPES_H
28*fcf3ce44SJohn Forte 
29*fcf3ce44SJohn Forte 
30*fcf3ce44SJohn Forte 
31*fcf3ce44SJohn Forte /*
32*fcf3ce44SJohn Forte  * Types for FC Transport subsystems.
33*fcf3ce44SJohn Forte  *
34*fcf3ce44SJohn Forte  * This file picks up specific as well as generic type
35*fcf3ce44SJohn Forte  * defines, and also serves as a wrapper for many common
36*fcf3ce44SJohn Forte  * includes.
37*fcf3ce44SJohn Forte  */
38*fcf3ce44SJohn Forte 
39*fcf3ce44SJohn Forte #include <sys/types.h>
40*fcf3ce44SJohn Forte #include <sys/param.h>
41*fcf3ce44SJohn Forte 
42*fcf3ce44SJohn Forte #ifdef	__cplusplus
43*fcf3ce44SJohn Forte extern "C" {
44*fcf3ce44SJohn Forte #endif
45*fcf3ce44SJohn Forte 
46*fcf3ce44SJohn Forte #if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL)
47*fcf3ce44SJohn Forte #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
48*fcf3ce44SJohn Forte #endif	/* _BIT_FIELDS_LTOH */
49*fcf3ce44SJohn Forte 
50*fcf3ce44SJohn Forte #ifdef	_KERNEL
51*fcf3ce44SJohn Forte #include <sys/systm.h>
52*fcf3ce44SJohn Forte #include <sys/cmn_err.h>
53*fcf3ce44SJohn Forte #include <sys/debug.h>
54*fcf3ce44SJohn Forte #include <sys/devops.h>
55*fcf3ce44SJohn Forte #include <sys/callb.h>
56*fcf3ce44SJohn Forte #include <sys/disp.h>
57*fcf3ce44SJohn Forte #include <sys/taskq.h>
58*fcf3ce44SJohn Forte #endif	/* _KERNEL */
59*fcf3ce44SJohn Forte 
60*fcf3ce44SJohn Forte #ifndef	_SYS_SCSI_SCSI_TYPES_H
61*fcf3ce44SJohn Forte 
62*fcf3ce44SJohn Forte 
63*fcf3ce44SJohn Forte #ifdef	__STDC__
64*fcf3ce44SJohn Forte typedef void *opaque_t;
65*fcf3ce44SJohn Forte #else	/* __STDC__ */
66*fcf3ce44SJohn Forte typedef char *opaque_t;
67*fcf3ce44SJohn Forte #endif	/* __STDC__ */
68*fcf3ce44SJohn Forte 
69*fcf3ce44SJohn Forte #endif /* _SYS_SCSI_SCSI_TYPES_H */
70*fcf3ce44SJohn Forte 
71*fcf3ce44SJohn Forte /* Sysevent defs */
72*fcf3ce44SJohn Forte #define	EC_SUNFC		"EC_sunfc"
73*fcf3ce44SJohn Forte #define	ESC_SUNFC_PORT_ATTACH	"ESC_sunfc_port_attach"
74*fcf3ce44SJohn Forte #define	ESC_SUNFC_PORT_DETACH	"ESC_sunfc_port_detach"
75*fcf3ce44SJohn Forte #define	ESC_SUNFC_PORT_ONLINE	"ESC_sunfc_port_online"
76*fcf3ce44SJohn Forte #define	ESC_SUNFC_PORT_OFFLINE	"ESC_sunfc_port_offline"
77*fcf3ce44SJohn Forte #define	ESC_SUNFC_PORT_RSCN	"ESC_sunfc_port_rscn"
78*fcf3ce44SJohn Forte #define	ESC_SUNFC_TARGET_ADD	"ESC_sunfc_target_add"
79*fcf3ce44SJohn Forte #define	ESC_SUNFC_TARGET_REMOVE	"ESC_sunfc_target_remove"
80*fcf3ce44SJohn Forte #define	ESC_SUNFC_DEVICE_ONLINE	"ESC_sunfc_device_online"
81*fcf3ce44SJohn Forte #define	ESC_SUNFC_DEVICE_OFFLINE	"ESC_sunfc_device_offline"
82*fcf3ce44SJohn Forte 
83*fcf3ce44SJohn Forte /* T11 FC-HBA state change tracking */
84*fcf3ce44SJohn Forte typedef uint64_t    fc_hba_state_change_t;
85*fcf3ce44SJohn Forte 
86*fcf3ce44SJohn Forte typedef struct port_id {
87*fcf3ce44SJohn Forte #if	defined(_BIT_FIELDS_LTOH)
88*fcf3ce44SJohn Forte 	uint32_t	port_id : 24,		/* Port Identifier */
89*fcf3ce44SJohn Forte 			priv_lilp_posit : 8;	/* LILP map position */
90*fcf3ce44SJohn Forte #else
91*fcf3ce44SJohn Forte 	uint32_t	priv_lilp_posit : 8,	/* LILP map position */
92*fcf3ce44SJohn Forte 			port_id : 24;		/* Port Identifier */
93*fcf3ce44SJohn Forte #endif	/* _BIT_FIELDS_LTOH */
94*fcf3ce44SJohn Forte } fc_portid_t;
95*fcf3ce44SJohn Forte 
96*fcf3ce44SJohn Forte typedef struct hard_addr {
97*fcf3ce44SJohn Forte #if	defined(_BIT_FIELDS_LTOH)
98*fcf3ce44SJohn Forte 	uint32_t	hard_addr : 24,		/* hard address */
99*fcf3ce44SJohn Forte 			rsvd : 8;		/* reserved */
100*fcf3ce44SJohn Forte #else
101*fcf3ce44SJohn Forte 	uint32_t	rsvd : 8,
102*fcf3ce44SJohn Forte 			hard_addr : 24;		/* hard address */
103*fcf3ce44SJohn Forte #endif	/* _BIT_FIELDS_LTOH */
104*fcf3ce44SJohn Forte } fc_hardaddr_t;
105*fcf3ce44SJohn Forte 
106*fcf3ce44SJohn Forte typedef struct port_type {
107*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_LTOH)
108*fcf3ce44SJohn Forte 	uint32_t	rsvd   		: 24,
109*fcf3ce44SJohn Forte 			port_type	: 8;
110*fcf3ce44SJohn Forte #else
111*fcf3ce44SJohn Forte 	uint32_t	port_type   	: 8,
112*fcf3ce44SJohn Forte 			rsvd		: 24;
113*fcf3ce44SJohn Forte #endif	/* _BIT_FIELDS_LTOH */
114*fcf3ce44SJohn Forte } fc_porttype_t;
115*fcf3ce44SJohn Forte 
116*fcf3ce44SJohn Forte /*
117*fcf3ce44SJohn Forte  * FCA post reset behavior
118*fcf3ce44SJohn Forte  */
119*fcf3ce44SJohn Forte typedef enum fc_reset_action {
120*fcf3ce44SJohn Forte 	FC_RESET_RETURN_NONE,		/* Can't return any */
121*fcf3ce44SJohn Forte 	FC_RESET_RETURN_ALL,		/* Return all commands reached here */
122*fcf3ce44SJohn Forte 	FC_RESET_RETURN_OUTSTANDING	/* Return ones that haven't gone out */
123*fcf3ce44SJohn Forte } fc_reset_action_t;
124*fcf3ce44SJohn Forte 
125*fcf3ce44SJohn Forte /*
126*fcf3ce44SJohn Forte  * FCA DMA behavior on Unaligned buffers
127*fcf3ce44SJohn Forte  */
128*fcf3ce44SJohn Forte typedef enum fc_dma_behavior {
129*fcf3ce44SJohn Forte 	FC_ALLOW_STREAMING,		/* Streaming mode for all xfers */
130*fcf3ce44SJohn Forte 	FC_NO_STREAMING			/* Disable Streaming on unaligned */
131*fcf3ce44SJohn Forte 					/* buffer or byte counts */
132*fcf3ce44SJohn Forte } fc_dma_behavior_t;
133*fcf3ce44SJohn Forte 
134*fcf3ce44SJohn Forte 
135*fcf3ce44SJohn Forte /*
136*fcf3ce44SJohn Forte  * FCA FCP command and response allocation in DVMA space
137*fcf3ce44SJohn Forte  */
138*fcf3ce44SJohn Forte typedef enum fc_fcp_dma {
139*fcf3ce44SJohn Forte 	FC_DVMA_SPACE,			/* allocation should be in DVMA mem */
140*fcf3ce44SJohn Forte 	FC_NO_DVMA_SPACE		/* allocation shouldn't be DVMA mem */
141*fcf3ce44SJohn Forte } fc_fcp_dma_t;
142*fcf3ce44SJohn Forte 
143*fcf3ce44SJohn Forte 
144*fcf3ce44SJohn Forte /*
145*fcf3ce44SJohn Forte  * struct to track rscn info both within the transport layer
146*fcf3ce44SJohn Forte  * and between the ULPs and transport.
147*fcf3ce44SJohn Forte  */
148*fcf3ce44SJohn Forte typedef	struct		fc_ulp_rscn_info {
149*fcf3ce44SJohn Forte 	uint32_t	ulp_rscn_count;
150*fcf3ce44SJohn Forte } fc_ulp_rscn_info_t;
151*fcf3ce44SJohn Forte 
152*fcf3ce44SJohn Forte /*
153*fcf3ce44SJohn Forte  * Define a value for ulp_rscn_count to indicate that the contents
154*fcf3ce44SJohn Forte  * of the fc_ulp_rscn_info_t struct are invalid. Note that some parts of the
155*fcf3ce44SJohn Forte  * code assume that this value is zero, i.e., they use kmem_zalloc().
156*fcf3ce44SJohn Forte  */
157*fcf3ce44SJohn Forte #define	FC_INVALID_RSCN_COUNT		((uint32_t)0)
158*fcf3ce44SJohn Forte 
159*fcf3ce44SJohn Forte /*
160*fcf3ce44SJohn Forte  * FC Transport exported header files to all Consumers
161*fcf3ce44SJohn Forte  */
162*fcf3ce44SJohn Forte 
163*fcf3ce44SJohn Forte #ifdef	_KERNEL
164*fcf3ce44SJohn Forte #include <sys/fibre-channel/impl/fcph.h>
165*fcf3ce44SJohn Forte #include <sys/fibre-channel/fc_appif.h>
166*fcf3ce44SJohn Forte #include <sys/fibre-channel/impl/fc_linkapp.h>
167*fcf3ce44SJohn Forte #include <sys/fibre-channel/impl/fcgs2.h>
168*fcf3ce44SJohn Forte #include <sys/fibre-channel/impl/fc_fla.h>
169*fcf3ce44SJohn Forte #include <sys/fibre-channel/impl/fcal.h>
170*fcf3ce44SJohn Forte #include <sys/fibre-channel/impl/fctl.h>
171*fcf3ce44SJohn Forte #include <sys/fibre-channel/impl/fc_error.h>
172*fcf3ce44SJohn Forte #include <sys/fibre-channel/fcio.h>
173*fcf3ce44SJohn Forte #include <sys/fibre-channel/ulp/fcp.h>
174*fcf3ce44SJohn Forte #include <sys/fibre-channel/ulp/fcp_util.h>
175*fcf3ce44SJohn Forte 
176*fcf3ce44SJohn Forte /*
177*fcf3ce44SJohn Forte  * For drivers which do not include these - must be last
178*fcf3ce44SJohn Forte  */
179*fcf3ce44SJohn Forte #include <sys/ddi.h>
180*fcf3ce44SJohn Forte #include <sys/sunddi.h>
181*fcf3ce44SJohn Forte #include <sys/stat.h>
182*fcf3ce44SJohn Forte #include <sys/sunndi.h>
183*fcf3ce44SJohn Forte #include <sys/devctl.h>
184*fcf3ce44SJohn Forte #endif	/* _KERNEL */
185*fcf3ce44SJohn Forte 
186*fcf3ce44SJohn Forte #ifdef	__cplusplus
187*fcf3ce44SJohn Forte }
188*fcf3ce44SJohn Forte #endif
189*fcf3ce44SJohn Forte 
190*fcf3ce44SJohn Forte #endif	/* _FC_TYPES_H */
191