xref: /titanic_53/usr/src/uts/common/sys/fibre-channel/impl/fctl.h (revision 7ff836697c120cb94bd30d5c2204eb9b74718e4c)
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 /*
221787f503SReed  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23fcf3ce44SJohn Forte  * Use is subject to license terms.
24fcf3ce44SJohn Forte  */
25fcf3ce44SJohn Forte 
26fcf3ce44SJohn Forte #ifndef	_FCTL_H
27fcf3ce44SJohn Forte #define	_FCTL_H
28fcf3ce44SJohn Forte 
29fcf3ce44SJohn Forte 
30fcf3ce44SJohn Forte #include <sys/note.h>
31fcf3ce44SJohn Forte #include <sys/time.h>
32fcf3ce44SJohn Forte 
33fcf3ce44SJohn Forte #ifdef	__cplusplus
34fcf3ce44SJohn Forte extern "C" {
35fcf3ce44SJohn Forte #endif
36fcf3ce44SJohn Forte 
37fcf3ce44SJohn Forte /*
38fcf3ce44SJohn Forte  * These are the legal values for the fp_state member of the fc_local_port_t
39fcf3ce44SJohn Forte  * struct. These values are understood by ULPs, FCA drivers, and fp/fctl.
40fcf3ce44SJohn Forte  *
41fcf3ce44SJohn Forte  * The link state value is kept the least significant byte, and the link speed
42fcf3ce44SJohn Forte  * value is kept in the next most significant byte:
43fcf3ce44SJohn Forte  *
44fcf3ce44SJohn Forte  *  +------------+------------+
45fcf3ce44SJohn Forte  *  | link speed | link state |
46fcf3ce44SJohn Forte  *  +------------+------------+
47fcf3ce44SJohn Forte  */
48fcf3ce44SJohn Forte /* Values for the link state (least significant byte as above) */
49fcf3ce44SJohn Forte #define	FC_STATE_OFFLINE		0x0000	/* Link is offline or not */
50fcf3ce44SJohn Forte 						/* initialized. */
51fcf3ce44SJohn Forte #define	FC_STATE_ONLINE			0x0001	/* Link is up, the topology */
52fcf3ce44SJohn Forte 						/* is given in fp_topology. */
53fcf3ce44SJohn Forte #define	FC_STATE_LOOP			0x0002	/* Link is up, the topology */
54fcf3ce44SJohn Forte 						/* is a private loop. */
55fcf3ce44SJohn Forte #define	FC_STATE_NAMESERVICE		0x0003	/* Not really used */
56fcf3ce44SJohn Forte #define	FC_STATE_RESET			0x0004
57fcf3ce44SJohn Forte #define	FC_STATE_RESET_REQUESTED	0x0005
58fcf3ce44SJohn Forte #define	FC_STATE_LIP			0x0006
59fcf3ce44SJohn Forte #define	FC_STATE_LIP_LBIT_SET		0x0007
60fcf3ce44SJohn Forte #define	FC_STATE_DEVICE_CHANGE		0x0008	/* For ULPs */
61fcf3ce44SJohn Forte #define	FC_STATE_TARGET_PORT_RESET	0x0009
62fcf3ce44SJohn Forte 
63fcf3ce44SJohn Forte /* Values for the link speed (next least significant byte as above) */
64fcf3ce44SJohn Forte #define	FC_STATE_1GBIT_SPEED		0x0100	/* 1 Gbit/sec */
65fcf3ce44SJohn Forte #define	FC_STATE_2GBIT_SPEED		0x0400	/* 2 Gbit/sec */
66fcf3ce44SJohn Forte #define	FC_STATE_4GBIT_SPEED		0x0500	/* 4 Gbit/sec */
67fcf3ce44SJohn Forte #define	FC_STATE_10GBIT_SPEED		0x0600	/* 10 Gbit/sec */
68fcf3ce44SJohn Forte #define	FC_STATE_8GBIT_SPEED		0x0700	/* 8 Gbit/sec */
69fcf3ce44SJohn Forte #define	FC_STATE_16GBIT_SPEED		0x0800	/* 16 Gbit/sec */
70fcf3ce44SJohn Forte #define	FC_STATE_FULL_SPEED		FC_STATE_1GBIT_SPEED
71fcf3ce44SJohn Forte #define	FC_STATE_DOUBLE_SPEED		FC_STATE_2GBIT_SPEED
72fcf3ce44SJohn Forte 
73*7ff83669SZhong Wang /* pi_port_state, used only when binding port */
74*7ff83669SZhong Wang #define	FC_STATE_FCA_IS_NODMA		0x80000000
75*7ff83669SZhong Wang 
76fcf3ce44SJohn Forte /*
77fcf3ce44SJohn Forte  * Macros to discriminate between the link state byte and the link speed
78fcf3ce44SJohn Forte  * byte in fp_state (also good for improved code obfuscation and job security
79fcf3ce44SJohn Forte  * even during a good economy).
80fcf3ce44SJohn Forte  */
81fcf3ce44SJohn Forte #define	FC_PORT_SPEED_MASK(state)	((state) & 0xFF00)
82fcf3ce44SJohn Forte #define	FC_PORT_STATE_MASK(state)	((state) & 0xFF)
83fcf3ce44SJohn Forte 
84fcf3ce44SJohn Forte 
85fcf3ce44SJohn Forte /*
86fcf3ce44SJohn Forte  * Notify flags passed between ULPs and FCAs
87fcf3ce44SJohn Forte  *
88fcf3ce44SJohn Forte  *	3 bytes			1 byte
89fcf3ce44SJohn Forte  *  +-----------------------+---------------+
90fcf3ce44SJohn Forte  *  | Flag specific values  |  Notify flag  |
91fcf3ce44SJohn Forte  *  +-----------------------+---------------+
92fcf3ce44SJohn Forte  */
93fcf3ce44SJohn Forte #define	FC_NOTIFY_RECOVERY_DONE		0x01
94fcf3ce44SJohn Forte #define	FC_NOTIFY_TARGET_MODE		0x02
95fcf3ce44SJohn Forte #define	FC_NOTIFY_NO_TARGET_MODE	0x03
96fcf3ce44SJohn Forte #define	FC_NOTIFY_RECOVERY_CLEANUP	0x04
97fcf3ce44SJohn Forte #define	FC_NOTIFY_THROTTLE		0x80
98fcf3ce44SJohn Forte 
99fcf3ce44SJohn Forte #define	FC_NOTIFY_FLAG_MASK(cmd)	((cmd) & 0xFF)
100fcf3ce44SJohn Forte #define	FC_NOTIFY_VALUE_MASK(cmd)	((cmd) & 0xFFFFFF00)
101fcf3ce44SJohn Forte #define	FC_NOTIFY_GET_FLAG(cmd)		FC_NOTIFY_FLAG_MASK(cmd)
102fcf3ce44SJohn Forte #define	FC_NOTIFY_GET_VALUE(cmd)	(FC_NOTIFY_VALUE_MASK(cmd) >> 8)
103fcf3ce44SJohn Forte 
104fcf3ce44SJohn Forte /*
105fcf3ce44SJohn Forte  * pkt_tran_flags definitions
106fcf3ce44SJohn Forte  */
107fcf3ce44SJohn Forte #define	FC_TRAN_CLASS(flag)		((flag) & 0xF0)
108fcf3ce44SJohn Forte #define	FC_TRAN_INTR			0x01
109fcf3ce44SJohn Forte #define	FC_TRAN_NO_INTR			0x02
110fcf3ce44SJohn Forte #define	FC_TRAN_HI_PRIORITY		0x04
111fcf3ce44SJohn Forte #define	FC_TRAN_DUMPING			0x08
112fcf3ce44SJohn Forte #define	FC_TRAN_CLASS1			0x10
113fcf3ce44SJohn Forte #define	FC_TRAN_CLASS2			0x20
114fcf3ce44SJohn Forte #define	FC_TRAN_CLASS3			0x30
115fcf3ce44SJohn Forte #define	FC_TRAN_CLASS_INVALID		0xF0
116fcf3ce44SJohn Forte #define	FC_TRAN_IMMEDIATE_CB		0x100
117fcf3ce44SJohn Forte 
118fcf3ce44SJohn Forte 
119fcf3ce44SJohn Forte /*
120fcf3ce44SJohn Forte  * pkt_tran_type definitions
121fcf3ce44SJohn Forte  */
122fcf3ce44SJohn Forte #define	FC_PKT_NOP			0
123fcf3ce44SJohn Forte #define	FC_PKT_INBOUND			1
124fcf3ce44SJohn Forte #define	FC_PKT_OUTBOUND			2
125fcf3ce44SJohn Forte #define	FC_PKT_EXCHANGE			3
126fcf3ce44SJohn Forte #define	FC_PKT_FCP_READ			4
127fcf3ce44SJohn Forte #define	FC_PKT_FCP_WRITE		5
128fcf3ce44SJohn Forte #define	FC_PKT_IP_WRITE			6
129fcf3ce44SJohn Forte #define	FC_PKT_BROADCAST		7
130fcf3ce44SJohn Forte 
131fcf3ce44SJohn Forte 
132fcf3ce44SJohn Forte #define	FC_TRACE_LOG_MASK		0xF00000
133fcf3ce44SJohn Forte #define	FC_TRACE_LOG_MSG		0x100000
134fcf3ce44SJohn Forte #define	FC_TRACE_LOG_CONSOLE		0x200000
135fcf3ce44SJohn Forte #define	FC_TRACE_LOG_CONSOLE_MSG	0x400000
136fcf3ce44SJohn Forte #define	FC_TRACE_LOG_BUF		0x080000
137fcf3ce44SJohn Forte 
138fcf3ce44SJohn Forte 
139fcf3ce44SJohn Forte /*
140fcf3ce44SJohn Forte  * The fc_packet_t represents an FC Exchange and is the primary unit of
141fcf3ce44SJohn Forte  * information exchange between FC driver modules.
142fcf3ce44SJohn Forte  */
143fcf3ce44SJohn Forte typedef struct fc_packet {
144fcf3ce44SJohn Forte 	uint16_t		pkt_tran_flags;		/* transport flag */
145fcf3ce44SJohn Forte 	uint16_t		pkt_tran_type;		/* transport type */
146fcf3ce44SJohn Forte 	uint32_t		pkt_timeout;		/* time-out length */
147fcf3ce44SJohn Forte 	uint32_t		pkt_cmdlen;		/* command length */
148fcf3ce44SJohn Forte 	uint32_t		pkt_rsplen;		/* response length */
149fcf3ce44SJohn Forte 	uint32_t		pkt_datalen;		/* data length */
150fcf3ce44SJohn Forte 	caddr_t			pkt_cmd;		/* command */
151fcf3ce44SJohn Forte 	caddr_t			pkt_resp;		/* response */
152fcf3ce44SJohn Forte 	caddr_t			pkt_data;		/* data */
153fcf3ce44SJohn Forte 	struct buf		*pkt_data_buf;		/* reserved */
154fcf3ce44SJohn Forte 	void			(*pkt_ulp_comp)(struct fc_packet *);
155fcf3ce44SJohn Forte 							/* framework private */
156fcf3ce44SJohn Forte 	opaque_t		pkt_ulp_private;	/* caller's private */
157fcf3ce44SJohn Forte 	void			(*pkt_comp)(struct fc_packet *); /* callback */
158fcf3ce44SJohn Forte 	struct fc_remote_port	*pkt_pd;		/* port device */
159fcf3ce44SJohn Forte 	ddi_dma_handle_t	pkt_cmd_dma;		/* command DMA */
160fcf3ce44SJohn Forte 	ddi_acc_handle_t	pkt_cmd_acc;		/* command access */
161fcf3ce44SJohn Forte 	ddi_dma_cookie_t	*pkt_cmd_cookie;	/* command cookie */
162fcf3ce44SJohn Forte 	ddi_dma_handle_t	pkt_resp_dma;		/* response DMA */
163fcf3ce44SJohn Forte 	ddi_acc_handle_t	pkt_resp_acc;		/* response access */
164fcf3ce44SJohn Forte 	ddi_dma_cookie_t	*pkt_resp_cookie;	/* response cookie */
165fcf3ce44SJohn Forte 	ddi_dma_handle_t	pkt_data_dma;		/* data DMA */
166fcf3ce44SJohn Forte 	ddi_acc_handle_t	pkt_data_acc;		/* data access */
167fcf3ce44SJohn Forte 	ddi_dma_cookie_t	*pkt_data_cookie;	/* data cookie */
168fcf3ce44SJohn Forte 	uint_t			pkt_cmd_cookie_cnt;
169fcf3ce44SJohn Forte 	uint_t			pkt_resp_cookie_cnt;
170fcf3ce44SJohn Forte 	uint_t			pkt_data_cookie_cnt;	/* of a window */
171fcf3ce44SJohn Forte 	fc_frame_hdr_t		pkt_cmd_fhdr;		/* command frame hdr */
172fcf3ce44SJohn Forte 	opaque_t		pkt_fca_private;	/* FCA private */
173fcf3ce44SJohn Forte 	uchar_t			pkt_state;		/* packet state */
174fcf3ce44SJohn Forte 	uchar_t			pkt_action;		/* packet action */
175fcf3ce44SJohn Forte 	uchar_t			pkt_expln;		/* reason explanation */
176fcf3ce44SJohn Forte 	uint32_t		pkt_reason;		/* expln of state */
177fcf3ce44SJohn Forte 	uint64_t		pkt_ena;		/* ENA in case of err */
178fcf3ce44SJohn Forte 	fc_frame_hdr_t		pkt_resp_fhdr;		/* response frame hdr */
179fcf3ce44SJohn Forte 	uint32_t		pkt_data_resid;		/* data resid length */
180fcf3ce44SJohn Forte 	uint32_t		pkt_resp_resid;		/* resp resid length */
181fcf3ce44SJohn Forte 	opaque_t		pkt_fca_device;		/* FCA device ptr */
182fcf3ce44SJohn Forte 	opaque_t		pkt_ub_resp_token;	/* UB resp token */
183fcf3ce44SJohn Forte 	opaque_t		pkt_session;		/* reserved */
184fcf3ce44SJohn Forte 	opaque_t		pkt_security1;		/* reserved */
185fcf3ce44SJohn Forte 	opaque_t		pkt_security2;		/* reserved */
186fcf3ce44SJohn Forte 	opaque_t		pkt_qos1;		/* reserved */
187fcf3ce44SJohn Forte 	opaque_t		pkt_qos2;		/* reserved */
188fcf3ce44SJohn Forte 	opaque_t		pkt_ulp_rsvd1;		/* ULP reserved */
189fcf3ce44SJohn Forte 
190fcf3ce44SJohn Forte 	/*
191fcf3ce44SJohn Forte 	 * The pkt_ulp_rscn_infop (aka pkt_ulp_rsvd1) field is used to carry
192fcf3ce44SJohn Forte 	 * the rscn info (of type fc_ulp_rscn_info_t) down to the transport so
193fcf3ce44SJohn Forte 	 * that the transport can determine (in some cases) whether or not the
194fcf3ce44SJohn Forte 	 * requested operation was aware of the latest state change
195fcf3ce44SJohn Forte 	 * notification.
196fcf3ce44SJohn Forte 	 *
197fcf3ce44SJohn Forte 	 * If not NULL, then the pkt_ulp_rscn_infop (aka pkt_ulp_rsvd1) may
198fcf3ce44SJohn Forte 	 * point to an fc_ulp_rscn_info_t struct that contains the rscn count
199fcf3ce44SJohn Forte 	 * information for this fc_packet_t.
200fcf3ce44SJohn Forte 	 */
201fcf3ce44SJohn Forte #define	pkt_ulp_rscn_infop	pkt_ulp_rsvd1		/* tracks rscn counts */
202fcf3ce44SJohn Forte 
203fcf3ce44SJohn Forte 	opaque_t		pkt_ulp_rsvd2;		/* ULP reserved */
204fcf3ce44SJohn Forte 	opaque_t		pkt_fctl_rsvd1;		/* Transport reserved */
205fcf3ce44SJohn Forte 	opaque_t		pkt_fctl_rsvd2;		/* Transport reserved */
206fcf3ce44SJohn Forte 	opaque_t		pkt_fca_rsvd1;		/* FCA reserved */
207fcf3ce44SJohn Forte 	opaque_t		pkt_fca_rsvd2;		/* FCA reserved */
208fcf3ce44SJohn Forte 	uint64_t		pkt_rsvd;		/* should be last */
209fcf3ce44SJohn Forte } fc_packet_t;
210fcf3ce44SJohn Forte 
211fcf3ce44SJohn Forte #if	!defined(__lint)
212fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("not messed with after transport", fc_packet))
213fcf3ce44SJohn Forte #endif	/* __lint */
214fcf3ce44SJohn Forte 
215fcf3ce44SJohn Forte 
216fcf3ce44SJohn Forte typedef struct fca_hba_fru_details {
217fcf3ce44SJohn Forte 	uint32_t    port_index;
218fcf3ce44SJohn Forte 	uint64_t    high;
219fcf3ce44SJohn Forte 	uint64_t    low;
220fcf3ce44SJohn Forte } fca_hba_fru_details_t;
221fcf3ce44SJohn Forte 
222fcf3ce44SJohn Forte /*
223fcf3ce44SJohn Forte  * HBA/Port attributes tracked for the T11 FC-HBA specification
224fcf3ce44SJohn Forte  */
225fcf3ce44SJohn Forte #define	FC_HBA_PORTSPEED_UNKNOWN	0    /* Unknown - transceiver incable */
226fcf3ce44SJohn Forte 					    /* of reporting */
227fcf3ce44SJohn Forte #define	FC_HBA_PORTSPEED_1GBIT		1    /* 1 GBit/sec */
228fcf3ce44SJohn Forte #define	FC_HBA_PORTSPEED_2GBIT		2    /* 2 GBit/sec */
229fcf3ce44SJohn Forte #define	FC_HBA_PORTSPEED_10GBIT		4    /* 10 GBit/sec */
230fcf3ce44SJohn Forte #define	FC_HBA_PORTSPEED_4GBIT		8    /* 4 GBit/sec */
231fcf3ce44SJohn Forte #define	FC_HBA_PORTSPEED_8GBIT		16   /* 8 GBit/sec */
232fcf3ce44SJohn Forte #define	FC_HBA_PORTSPEED_16GBIT		32   /* 16 GBit/sec */
233fcf3ce44SJohn Forte #define	FC_HBA_PORTSPEED_NOT_NEGOTIATED	(1<<15)	  /* Speed not established */
234fcf3ce44SJohn Forte 
235fcf3ce44SJohn Forte #define	FCHBA_MANUFACTURER_LEN		64
236fcf3ce44SJohn Forte #define	FCHBA_SERIAL_NUMBER_LEN		64
237fcf3ce44SJohn Forte #define	FCHBA_MODEL_LEN			256
238fcf3ce44SJohn Forte #define	FCHBA_MODEL_DESCRIPTION_LEN	256
239fcf3ce44SJohn Forte #define	FCHBA_HARDWARE_VERSION_LEN	256
240fcf3ce44SJohn Forte #define	FCHBA_DRIVER_VERSION_LEN	256
241fcf3ce44SJohn Forte #define	FCHBA_OPTION_ROM_VERSION_LEN	256
242fcf3ce44SJohn Forte #define	FCHBA_FIRMWARE_VERSION_LEN	256
243fcf3ce44SJohn Forte #define	FCHBA_DRIVER_NAME_LEN		256
244fcf3ce44SJohn Forte #define	FCHBA_SYMB_NAME_LEN		255
245fcf3ce44SJohn Forte 
246fcf3ce44SJohn Forte typedef struct fca_port_attrs {
247fcf3ce44SJohn Forte 	char		manufacturer[FCHBA_MANUFACTURER_LEN];
248fcf3ce44SJohn Forte 	char		serial_number[FCHBA_SERIAL_NUMBER_LEN];
249fcf3ce44SJohn Forte 	char		model[FCHBA_MODEL_LEN];
250fcf3ce44SJohn Forte 	char		model_description[FCHBA_MODEL_DESCRIPTION_LEN];
251fcf3ce44SJohn Forte 	char		hardware_version[FCHBA_HARDWARE_VERSION_LEN];
252fcf3ce44SJohn Forte 	char		driver_version[FCHBA_DRIVER_VERSION_LEN];
253fcf3ce44SJohn Forte 	char		option_rom_version[FCHBA_OPTION_ROM_VERSION_LEN];
254fcf3ce44SJohn Forte 	char		firmware_version[FCHBA_FIRMWARE_VERSION_LEN];
255fcf3ce44SJohn Forte 	char		driver_name[FCHBA_DRIVER_NAME_LEN];
256fcf3ce44SJohn Forte 	uint32_t	vendor_specific_id;
257fcf3ce44SJohn Forte 	uint32_t	supported_cos;
258fcf3ce44SJohn Forte 	uint32_t	supported_speed;
259fcf3ce44SJohn Forte 	uint32_t	max_frame_size;
260fcf3ce44SJohn Forte 	fca_hba_fru_details_t	hba_fru_details;
261fcf3ce44SJohn Forte 	uchar_t		sym_node_name[FCHBA_SYMB_NAME_LEN];
262fcf3ce44SJohn Forte 	uchar_t		sym_port_name[FCHBA_SYMB_NAME_LEN];
263fcf3ce44SJohn Forte } fca_port_attrs_t;
264fcf3ce44SJohn Forte 
265fcf3ce44SJohn Forte 
266fcf3ce44SJohn Forte 
267fcf3ce44SJohn Forte typedef struct unsolicited_buffer {
268fcf3ce44SJohn Forte 	uchar_t		ub_class;
269fcf3ce44SJohn Forte 	uchar_t		ub_resvd1;
270fcf3ce44SJohn Forte 	ushort_t	ub_resp_flags;		/* ULP-specific flags */
271fcf3ce44SJohn Forte 	ushort_t	ub_resp_key;		/* ULP-specific key */
272fcf3ce44SJohn Forte 	ushort_t	ub_resvd2;
273fcf3ce44SJohn Forte 	uint32_t	ub_bufsize;
274fcf3ce44SJohn Forte 	caddr_t		ub_buffer;
275fcf3ce44SJohn Forte 	void		*ub_port_private;
276fcf3ce44SJohn Forte 	void		*ub_fca_private;
277fcf3ce44SJohn Forte 	opaque_t	ub_port_handle;
278fcf3ce44SJohn Forte 	opaque_t	ub_resp_token;		/* Response token */
279fcf3ce44SJohn Forte 	uint64_t	ub_token;
280fcf3ce44SJohn Forte 	fc_frame_hdr_t	ub_frame;
281fcf3ce44SJohn Forte } fc_unsol_buf_t;
282fcf3ce44SJohn Forte 
283fcf3ce44SJohn Forte #define	FC_UB_RESP_LOGIN_REQUIRED	0x4000
284fcf3ce44SJohn Forte 
285fcf3ce44SJohn Forte typedef struct fc_trace_dmsg {
286fcf3ce44SJohn Forte 	int			id_size;	/* message size */
287fcf3ce44SJohn Forte 	int			id_flag;	/* for future */
288fcf3ce44SJohn Forte 	timespec_t		id_time;	/* timestamp */
289fcf3ce44SJohn Forte 	caddr_t			id_buf;		/* message buffer */
290fcf3ce44SJohn Forte 	struct fc_trace_dmsg	*id_next;	/* next message in queue */
291fcf3ce44SJohn Forte } fc_trace_dmsg_t;
292fcf3ce44SJohn Forte 
293fcf3ce44SJohn Forte #define	FC_TRACE_LOGQ_V2		0x1
294fcf3ce44SJohn Forte 
295fcf3ce44SJohn Forte typedef struct fc_trace_logq {
296fcf3ce44SJohn Forte 	kmutex_t	il_lock;	/* lock to avoid clutter */
297fcf3ce44SJohn Forte 	int		il_hiwat;	/* maximum queue size */
298fcf3ce44SJohn Forte 	int		il_flags;
299fcf3ce44SJohn Forte 	int		il_size;	/* current size */
300fcf3ce44SJohn Forte 	int		il_afail;	/* count of allocation failures */
301fcf3ce44SJohn Forte 	int		il_lfail;	/* general logging failures */
302fcf3ce44SJohn Forte 	int		il_id;		/* message Id */
303fcf3ce44SJohn Forte 	fc_trace_dmsg_t	*il_msgh;	/* messages head */
304fcf3ce44SJohn Forte 	fc_trace_dmsg_t	*il_msgt;	/* messages tail */
305fcf3ce44SJohn Forte } fc_trace_logq_t;
306fcf3ce44SJohn Forte 
307fcf3ce44SJohn Forte 
308fcf3ce44SJohn Forte /*
309fcf3ce44SJohn Forte  * Values for the pd_type field in the fc_remote_port_t struct below.
310fcf3ce44SJohn Forte  * (Also used in map_type and changelist determination)
311fcf3ce44SJohn Forte  */
312fcf3ce44SJohn Forte #define	PORT_DEVICE_NOCHANGE		0x0 /* Event occurred on link, but */
313fcf3ce44SJohn Forte 					    /* no change on the remote port */
314fcf3ce44SJohn Forte #define	PORT_DEVICE_NEW			0x1 /* Newly created remote port, or */
315fcf3ce44SJohn Forte 					    /* port has come back after being */
316fcf3ce44SJohn Forte 					    /* marked as PORT_DEVICE_OLD */
317fcf3ce44SJohn Forte #define	PORT_DEVICE_OLD			0x2 /* RSCN or Reset has occurred, */
318fcf3ce44SJohn Forte 					    /* the remote port may come back */
319fcf3ce44SJohn Forte #define	PORT_DEVICE_CHANGED		0x3 /* D_ID, PWWN, or other change */
320fcf3ce44SJohn Forte 					    /* has occurred (hot swap?) */
321fcf3ce44SJohn Forte #define	PORT_DEVICE_DELETE		0x4 /* Not used? */
322fcf3ce44SJohn Forte #define	PORT_DEVICE_USER_LOGIN		0x5 /* only for changelist->map_type */
323fcf3ce44SJohn Forte #define	PORT_DEVICE_USER_LOGOUT		0x6 /* only for changelist->map_type */
324fcf3ce44SJohn Forte #define	PORT_DEVICE_USER_CREATE		0x7 /* only for changelist->map_type */
325fcf3ce44SJohn Forte #define	PORT_DEVICE_USER_DELETE		0x8 /* only for changelist->map_type */
3261787f503SReed #define	PORT_DEVICE_REPORTLUN_CHANGED	0x9 /* only for changelist->map_type */
327fcf3ce44SJohn Forte 
328fcf3ce44SJohn Forte /*
329fcf3ce44SJohn Forte  * Flags used for fc_portmap->map_type
330fcf3ce44SJohn Forte  */
331fcf3ce44SJohn Forte 
332fcf3ce44SJohn Forte #define	PORT_DEVICE_DUPLICATE_MAP_ENTRY 0x00000001 /* map entry has another */
333fcf3ce44SJohn Forte 						/* entry for this target */
334fcf3ce44SJohn Forte 						/* later in the list */
335fcf3ce44SJohn Forte #define	PORT_DEVICE_NO_SKIP_DEVICE_DISCOVERY	0x00000002
336fcf3ce44SJohn Forte 
337fcf3ce44SJohn Forte 
338fcf3ce44SJohn Forte /*
339fcf3ce44SJohn Forte  * Logging and Debugging support
340fcf3ce44SJohn Forte  */
341fcf3ce44SJohn Forte void fc_trace_debug(fc_trace_logq_t *logq, caddr_t name, int dflag, int dlevel,
342fcf3ce44SJohn Forte     int errno, const char *fmt, ...);
343fcf3ce44SJohn Forte 
344fcf3ce44SJohn Forte fc_trace_logq_t *fc_trace_alloc_logq(int maxsize);
345fcf3ce44SJohn Forte void fc_trace_free_logq(fc_trace_logq_t *logq);
346fcf3ce44SJohn Forte void fc_trace_logmsg(fc_trace_logq_t *logq, caddr_t buf, int level);
347fcf3ce44SJohn Forte caddr_t fc_trace_msg(int fc_trace_error);
348fcf3ce44SJohn Forte 
349fcf3ce44SJohn Forte /*
350fcf3ce44SJohn Forte  * Common utility routines
351fcf3ce44SJohn Forte  */
352fcf3ce44SJohn Forte 
353fcf3ce44SJohn Forte void fc_wwn_to_str(la_wwn_t *wwn, caddr_t string);
354fcf3ce44SJohn Forte void fc_str_to_wwn(caddr_t string, la_wwn_t *wwn);
355fcf3ce44SJohn Forte 
356fcf3ce44SJohn Forte #if	!defined(__lint)
357fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", unsolicited_buffer))
358fcf3ce44SJohn Forte #endif	/* __lint */
359fcf3ce44SJohn Forte 
360fcf3ce44SJohn Forte #ifdef	__cplusplus
361fcf3ce44SJohn Forte }
362fcf3ce44SJohn Forte #endif
363fcf3ce44SJohn Forte 
364fcf3ce44SJohn Forte #endif	/* _FCTL_H */
365