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