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