xref: /onnv-gate/usr/src/uts/common/sys/fibre-channel/impl/fctl.h (revision 10264:1196af6129ec)
17836SJohn.Forte@Sun.COM /*
27836SJohn.Forte@Sun.COM  * CDDL HEADER START
37836SJohn.Forte@Sun.COM  *
47836SJohn.Forte@Sun.COM  * The contents of this file are subject to the terms of the
57836SJohn.Forte@Sun.COM  * Common Development and Distribution License (the "License").
67836SJohn.Forte@Sun.COM  * You may not use this file except in compliance with the License.
77836SJohn.Forte@Sun.COM  *
87836SJohn.Forte@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97836SJohn.Forte@Sun.COM  * or http://www.opensolaris.org/os/licensing.
107836SJohn.Forte@Sun.COM  * See the License for the specific language governing permissions
117836SJohn.Forte@Sun.COM  * and limitations under the License.
127836SJohn.Forte@Sun.COM  *
137836SJohn.Forte@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
147836SJohn.Forte@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157836SJohn.Forte@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
167836SJohn.Forte@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
177836SJohn.Forte@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
187836SJohn.Forte@Sun.COM  *
197836SJohn.Forte@Sun.COM  * CDDL HEADER END
207836SJohn.Forte@Sun.COM  */
217836SJohn.Forte@Sun.COM /*
229362SReed.Liu@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237836SJohn.Forte@Sun.COM  * Use is subject to license terms.
247836SJohn.Forte@Sun.COM  */
257836SJohn.Forte@Sun.COM 
267836SJohn.Forte@Sun.COM #ifndef	_FCTL_H
277836SJohn.Forte@Sun.COM #define	_FCTL_H
287836SJohn.Forte@Sun.COM 
297836SJohn.Forte@Sun.COM 
307836SJohn.Forte@Sun.COM #include <sys/note.h>
317836SJohn.Forte@Sun.COM #include <sys/time.h>
327836SJohn.Forte@Sun.COM 
337836SJohn.Forte@Sun.COM #ifdef	__cplusplus
347836SJohn.Forte@Sun.COM extern "C" {
357836SJohn.Forte@Sun.COM #endif
367836SJohn.Forte@Sun.COM 
377836SJohn.Forte@Sun.COM /*
387836SJohn.Forte@Sun.COM  * These are the legal values for the fp_state member of the fc_local_port_t
397836SJohn.Forte@Sun.COM  * struct. These values are understood by ULPs, FCA drivers, and fp/fctl.
407836SJohn.Forte@Sun.COM  *
417836SJohn.Forte@Sun.COM  * The link state value is kept the least significant byte, and the link speed
427836SJohn.Forte@Sun.COM  * value is kept in the next most significant byte:
437836SJohn.Forte@Sun.COM  *
447836SJohn.Forte@Sun.COM  *  +------------+------------+
457836SJohn.Forte@Sun.COM  *  | link speed | link state |
467836SJohn.Forte@Sun.COM  *  +------------+------------+
477836SJohn.Forte@Sun.COM  */
487836SJohn.Forte@Sun.COM /* Values for the link state (least significant byte as above) */
497836SJohn.Forte@Sun.COM #define	FC_STATE_OFFLINE		0x0000	/* Link is offline or not */
507836SJohn.Forte@Sun.COM 						/* initialized. */
517836SJohn.Forte@Sun.COM #define	FC_STATE_ONLINE			0x0001	/* Link is up, the topology */
527836SJohn.Forte@Sun.COM 						/* is given in fp_topology. */
537836SJohn.Forte@Sun.COM #define	FC_STATE_LOOP			0x0002	/* Link is up, the topology */
547836SJohn.Forte@Sun.COM 						/* is a private loop. */
557836SJohn.Forte@Sun.COM #define	FC_STATE_NAMESERVICE		0x0003	/* Not really used */
567836SJohn.Forte@Sun.COM #define	FC_STATE_RESET			0x0004
577836SJohn.Forte@Sun.COM #define	FC_STATE_RESET_REQUESTED	0x0005
587836SJohn.Forte@Sun.COM #define	FC_STATE_LIP			0x0006
597836SJohn.Forte@Sun.COM #define	FC_STATE_LIP_LBIT_SET		0x0007
607836SJohn.Forte@Sun.COM #define	FC_STATE_DEVICE_CHANGE		0x0008	/* For ULPs */
617836SJohn.Forte@Sun.COM #define	FC_STATE_TARGET_PORT_RESET	0x0009
627836SJohn.Forte@Sun.COM 
637836SJohn.Forte@Sun.COM /* Values for the link speed (next least significant byte as above) */
647836SJohn.Forte@Sun.COM #define	FC_STATE_1GBIT_SPEED		0x0100	/* 1 Gbit/sec */
657836SJohn.Forte@Sun.COM #define	FC_STATE_2GBIT_SPEED		0x0400	/* 2 Gbit/sec */
667836SJohn.Forte@Sun.COM #define	FC_STATE_4GBIT_SPEED		0x0500	/* 4 Gbit/sec */
677836SJohn.Forte@Sun.COM #define	FC_STATE_10GBIT_SPEED		0x0600	/* 10 Gbit/sec */
687836SJohn.Forte@Sun.COM #define	FC_STATE_8GBIT_SPEED		0x0700	/* 8 Gbit/sec */
697836SJohn.Forte@Sun.COM #define	FC_STATE_16GBIT_SPEED		0x0800	/* 16 Gbit/sec */
707836SJohn.Forte@Sun.COM #define	FC_STATE_FULL_SPEED		FC_STATE_1GBIT_SPEED
717836SJohn.Forte@Sun.COM #define	FC_STATE_DOUBLE_SPEED		FC_STATE_2GBIT_SPEED
727836SJohn.Forte@Sun.COM 
73*10264SZhong.Wang@Sun.COM /* pi_port_state, used only when binding port */
74*10264SZhong.Wang@Sun.COM #define	FC_STATE_FCA_IS_NODMA		0x80000000
75*10264SZhong.Wang@Sun.COM 
767836SJohn.Forte@Sun.COM /*
777836SJohn.Forte@Sun.COM  * Macros to discriminate between the link state byte and the link speed
787836SJohn.Forte@Sun.COM  * byte in fp_state (also good for improved code obfuscation and job security
797836SJohn.Forte@Sun.COM  * even during a good economy).
807836SJohn.Forte@Sun.COM  */
817836SJohn.Forte@Sun.COM #define	FC_PORT_SPEED_MASK(state)	((state) & 0xFF00)
827836SJohn.Forte@Sun.COM #define	FC_PORT_STATE_MASK(state)	((state) & 0xFF)
837836SJohn.Forte@Sun.COM 
847836SJohn.Forte@Sun.COM 
857836SJohn.Forte@Sun.COM /*
867836SJohn.Forte@Sun.COM  * Notify flags passed between ULPs and FCAs
877836SJohn.Forte@Sun.COM  *
887836SJohn.Forte@Sun.COM  *	3 bytes			1 byte
897836SJohn.Forte@Sun.COM  *  +-----------------------+---------------+
907836SJohn.Forte@Sun.COM  *  | Flag specific values  |  Notify flag  |
917836SJohn.Forte@Sun.COM  *  +-----------------------+---------------+
927836SJohn.Forte@Sun.COM  */
937836SJohn.Forte@Sun.COM #define	FC_NOTIFY_RECOVERY_DONE		0x01
947836SJohn.Forte@Sun.COM #define	FC_NOTIFY_TARGET_MODE		0x02
957836SJohn.Forte@Sun.COM #define	FC_NOTIFY_NO_TARGET_MODE	0x03
967836SJohn.Forte@Sun.COM #define	FC_NOTIFY_RECOVERY_CLEANUP	0x04
977836SJohn.Forte@Sun.COM #define	FC_NOTIFY_THROTTLE		0x80
987836SJohn.Forte@Sun.COM 
997836SJohn.Forte@Sun.COM #define	FC_NOTIFY_FLAG_MASK(cmd)	((cmd) & 0xFF)
1007836SJohn.Forte@Sun.COM #define	FC_NOTIFY_VALUE_MASK(cmd)	((cmd) & 0xFFFFFF00)
1017836SJohn.Forte@Sun.COM #define	FC_NOTIFY_GET_FLAG(cmd)		FC_NOTIFY_FLAG_MASK(cmd)
1027836SJohn.Forte@Sun.COM #define	FC_NOTIFY_GET_VALUE(cmd)	(FC_NOTIFY_VALUE_MASK(cmd) >> 8)
1037836SJohn.Forte@Sun.COM 
1047836SJohn.Forte@Sun.COM /*
1057836SJohn.Forte@Sun.COM  * pkt_tran_flags definitions
1067836SJohn.Forte@Sun.COM  */
1077836SJohn.Forte@Sun.COM #define	FC_TRAN_CLASS(flag)		((flag) & 0xF0)
1087836SJohn.Forte@Sun.COM #define	FC_TRAN_INTR			0x01
1097836SJohn.Forte@Sun.COM #define	FC_TRAN_NO_INTR			0x02
1107836SJohn.Forte@Sun.COM #define	FC_TRAN_HI_PRIORITY		0x04
1117836SJohn.Forte@Sun.COM #define	FC_TRAN_DUMPING			0x08
1127836SJohn.Forte@Sun.COM #define	FC_TRAN_CLASS1			0x10
1137836SJohn.Forte@Sun.COM #define	FC_TRAN_CLASS2			0x20
1147836SJohn.Forte@Sun.COM #define	FC_TRAN_CLASS3			0x30
1157836SJohn.Forte@Sun.COM #define	FC_TRAN_CLASS_INVALID		0xF0
1167836SJohn.Forte@Sun.COM #define	FC_TRAN_IMMEDIATE_CB		0x100
1177836SJohn.Forte@Sun.COM 
1187836SJohn.Forte@Sun.COM 
1197836SJohn.Forte@Sun.COM /*
1207836SJohn.Forte@Sun.COM  * pkt_tran_type definitions
1217836SJohn.Forte@Sun.COM  */
1227836SJohn.Forte@Sun.COM #define	FC_PKT_NOP			0
1237836SJohn.Forte@Sun.COM #define	FC_PKT_INBOUND			1
1247836SJohn.Forte@Sun.COM #define	FC_PKT_OUTBOUND			2
1257836SJohn.Forte@Sun.COM #define	FC_PKT_EXCHANGE			3
1267836SJohn.Forte@Sun.COM #define	FC_PKT_FCP_READ			4
1277836SJohn.Forte@Sun.COM #define	FC_PKT_FCP_WRITE		5
1287836SJohn.Forte@Sun.COM #define	FC_PKT_IP_WRITE			6
1297836SJohn.Forte@Sun.COM #define	FC_PKT_BROADCAST		7
1307836SJohn.Forte@Sun.COM 
1317836SJohn.Forte@Sun.COM 
1327836SJohn.Forte@Sun.COM #define	FC_TRACE_LOG_MASK		0xF00000
1337836SJohn.Forte@Sun.COM #define	FC_TRACE_LOG_MSG		0x100000
1347836SJohn.Forte@Sun.COM #define	FC_TRACE_LOG_CONSOLE		0x200000
1357836SJohn.Forte@Sun.COM #define	FC_TRACE_LOG_CONSOLE_MSG	0x400000
1367836SJohn.Forte@Sun.COM #define	FC_TRACE_LOG_BUF		0x080000
1377836SJohn.Forte@Sun.COM 
1387836SJohn.Forte@Sun.COM 
1397836SJohn.Forte@Sun.COM /*
1407836SJohn.Forte@Sun.COM  * The fc_packet_t represents an FC Exchange and is the primary unit of
1417836SJohn.Forte@Sun.COM  * information exchange between FC driver modules.
1427836SJohn.Forte@Sun.COM  */
1437836SJohn.Forte@Sun.COM typedef struct fc_packet {
1447836SJohn.Forte@Sun.COM 	uint16_t		pkt_tran_flags;		/* transport flag */
1457836SJohn.Forte@Sun.COM 	uint16_t		pkt_tran_type;		/* transport type */
1467836SJohn.Forte@Sun.COM 	uint32_t		pkt_timeout;		/* time-out length */
1477836SJohn.Forte@Sun.COM 	uint32_t		pkt_cmdlen;		/* command length */
1487836SJohn.Forte@Sun.COM 	uint32_t		pkt_rsplen;		/* response length */
1497836SJohn.Forte@Sun.COM 	uint32_t		pkt_datalen;		/* data length */
1507836SJohn.Forte@Sun.COM 	caddr_t			pkt_cmd;		/* command */
1517836SJohn.Forte@Sun.COM 	caddr_t			pkt_resp;		/* response */
1527836SJohn.Forte@Sun.COM 	caddr_t			pkt_data;		/* data */
1537836SJohn.Forte@Sun.COM 	struct buf		*pkt_data_buf;		/* reserved */
1547836SJohn.Forte@Sun.COM 	void			(*pkt_ulp_comp)(struct fc_packet *);
1557836SJohn.Forte@Sun.COM 							/* framework private */
156*10264SZhong.Wang@Sun.COM 	opaque_t		pkt_ulp_private;	/* caller's private */
1577836SJohn.Forte@Sun.COM 	void			(*pkt_comp)(struct fc_packet *); /* callback */
1587836SJohn.Forte@Sun.COM 	struct fc_remote_port	*pkt_pd;		/* port device */
1597836SJohn.Forte@Sun.COM 	ddi_dma_handle_t	pkt_cmd_dma;		/* command DMA */
1607836SJohn.Forte@Sun.COM 	ddi_acc_handle_t	pkt_cmd_acc;		/* command access */
1617836SJohn.Forte@Sun.COM 	ddi_dma_cookie_t	*pkt_cmd_cookie;	/* command cookie */
1627836SJohn.Forte@Sun.COM 	ddi_dma_handle_t	pkt_resp_dma;		/* response DMA */
1637836SJohn.Forte@Sun.COM 	ddi_acc_handle_t	pkt_resp_acc;		/* response access */
1647836SJohn.Forte@Sun.COM 	ddi_dma_cookie_t	*pkt_resp_cookie;	/* response cookie */
1657836SJohn.Forte@Sun.COM 	ddi_dma_handle_t	pkt_data_dma;		/* data DMA */
1667836SJohn.Forte@Sun.COM 	ddi_acc_handle_t	pkt_data_acc;		/* data access */
167*10264SZhong.Wang@Sun.COM 	ddi_dma_cookie_t	*pkt_data_cookie;	/* data cookie */
1687836SJohn.Forte@Sun.COM 	uint_t			pkt_cmd_cookie_cnt;
1697836SJohn.Forte@Sun.COM 	uint_t			pkt_resp_cookie_cnt;
1707836SJohn.Forte@Sun.COM 	uint_t			pkt_data_cookie_cnt;	/* of a window */
1717836SJohn.Forte@Sun.COM 	fc_frame_hdr_t		pkt_cmd_fhdr;		/* command frame hdr */
172*10264SZhong.Wang@Sun.COM 	opaque_t		pkt_fca_private;	/* FCA private */
1737836SJohn.Forte@Sun.COM 	uchar_t			pkt_state;		/* packet state */
1747836SJohn.Forte@Sun.COM 	uchar_t			pkt_action;		/* packet action */
1757836SJohn.Forte@Sun.COM 	uchar_t			pkt_expln;		/* reason explanation */
1767836SJohn.Forte@Sun.COM 	uint32_t		pkt_reason;		/* expln of state */
1777836SJohn.Forte@Sun.COM 	uint64_t		pkt_ena;		/* ENA in case of err */
1787836SJohn.Forte@Sun.COM 	fc_frame_hdr_t		pkt_resp_fhdr;		/* response frame hdr */
1797836SJohn.Forte@Sun.COM 	uint32_t		pkt_data_resid;		/* data resid length */
1807836SJohn.Forte@Sun.COM 	uint32_t		pkt_resp_resid;		/* resp resid length */
1817836SJohn.Forte@Sun.COM 	opaque_t		pkt_fca_device;		/* FCA device ptr */
1827836SJohn.Forte@Sun.COM 	opaque_t		pkt_ub_resp_token;	/* UB resp token */
1837836SJohn.Forte@Sun.COM 	opaque_t		pkt_session;		/* reserved */
1847836SJohn.Forte@Sun.COM 	opaque_t		pkt_security1;		/* reserved */
1857836SJohn.Forte@Sun.COM 	opaque_t		pkt_security2;		/* reserved */
1867836SJohn.Forte@Sun.COM 	opaque_t		pkt_qos1;		/* reserved */
1877836SJohn.Forte@Sun.COM 	opaque_t		pkt_qos2;		/* reserved */
1887836SJohn.Forte@Sun.COM 	opaque_t		pkt_ulp_rsvd1;		/* ULP reserved */
1897836SJohn.Forte@Sun.COM 
1907836SJohn.Forte@Sun.COM 	/*
1917836SJohn.Forte@Sun.COM 	 * The pkt_ulp_rscn_infop (aka pkt_ulp_rsvd1) field is used to carry
1927836SJohn.Forte@Sun.COM 	 * the rscn info (of type fc_ulp_rscn_info_t) down to the transport so
1937836SJohn.Forte@Sun.COM 	 * that the transport can determine (in some cases) whether or not the
1947836SJohn.Forte@Sun.COM 	 * requested operation was aware of the latest state change
1957836SJohn.Forte@Sun.COM 	 * notification.
1967836SJohn.Forte@Sun.COM 	 *
1977836SJohn.Forte@Sun.COM 	 * If not NULL, then the pkt_ulp_rscn_infop (aka pkt_ulp_rsvd1) may
1987836SJohn.Forte@Sun.COM 	 * point to an fc_ulp_rscn_info_t struct that contains the rscn count
1997836SJohn.Forte@Sun.COM 	 * information for this fc_packet_t.
2007836SJohn.Forte@Sun.COM 	 */
2017836SJohn.Forte@Sun.COM #define	pkt_ulp_rscn_infop	pkt_ulp_rsvd1		/* tracks rscn counts */
2027836SJohn.Forte@Sun.COM 
2037836SJohn.Forte@Sun.COM 	opaque_t		pkt_ulp_rsvd2;		/* ULP reserved */
2047836SJohn.Forte@Sun.COM 	opaque_t		pkt_fctl_rsvd1;		/* Transport reserved */
2057836SJohn.Forte@Sun.COM 	opaque_t		pkt_fctl_rsvd2;		/* Transport reserved */
2067836SJohn.Forte@Sun.COM 	opaque_t		pkt_fca_rsvd1;		/* FCA reserved */
2077836SJohn.Forte@Sun.COM 	opaque_t		pkt_fca_rsvd2;		/* FCA reserved */
2087836SJohn.Forte@Sun.COM 	uint64_t		pkt_rsvd;		/* should be last */
2097836SJohn.Forte@Sun.COM } fc_packet_t;
2107836SJohn.Forte@Sun.COM 
2117836SJohn.Forte@Sun.COM #if	!defined(__lint)
2127836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("not messed with after transport", fc_packet))
2137836SJohn.Forte@Sun.COM #endif	/* __lint */
2147836SJohn.Forte@Sun.COM 
2157836SJohn.Forte@Sun.COM 
2167836SJohn.Forte@Sun.COM typedef struct fca_hba_fru_details {
2177836SJohn.Forte@Sun.COM 	uint32_t    port_index;
2187836SJohn.Forte@Sun.COM 	uint64_t    high;
2197836SJohn.Forte@Sun.COM 	uint64_t    low;
2207836SJohn.Forte@Sun.COM } fca_hba_fru_details_t;
2217836SJohn.Forte@Sun.COM 
2227836SJohn.Forte@Sun.COM /*
2237836SJohn.Forte@Sun.COM  * HBA/Port attributes tracked for the T11 FC-HBA specification
2247836SJohn.Forte@Sun.COM  */
2257836SJohn.Forte@Sun.COM #define	FC_HBA_PORTSPEED_UNKNOWN	0    /* Unknown - transceiver incable */
2267836SJohn.Forte@Sun.COM 					    /* of reporting */
2277836SJohn.Forte@Sun.COM #define	FC_HBA_PORTSPEED_1GBIT		1    /* 1 GBit/sec */
2287836SJohn.Forte@Sun.COM #define	FC_HBA_PORTSPEED_2GBIT		2    /* 2 GBit/sec */
2297836SJohn.Forte@Sun.COM #define	FC_HBA_PORTSPEED_10GBIT		4    /* 10 GBit/sec */
2307836SJohn.Forte@Sun.COM #define	FC_HBA_PORTSPEED_4GBIT		8    /* 4 GBit/sec */
2317836SJohn.Forte@Sun.COM #define	FC_HBA_PORTSPEED_8GBIT		16   /* 8 GBit/sec */
2327836SJohn.Forte@Sun.COM #define	FC_HBA_PORTSPEED_16GBIT		32   /* 16 GBit/sec */
233*10264SZhong.Wang@Sun.COM #define	FC_HBA_PORTSPEED_NOT_NEGOTIATED	(1<<15)	  /* Speed not established */
2347836SJohn.Forte@Sun.COM 
2357836SJohn.Forte@Sun.COM #define	FCHBA_MANUFACTURER_LEN		64
2367836SJohn.Forte@Sun.COM #define	FCHBA_SERIAL_NUMBER_LEN		64
2377836SJohn.Forte@Sun.COM #define	FCHBA_MODEL_LEN			256
2387836SJohn.Forte@Sun.COM #define	FCHBA_MODEL_DESCRIPTION_LEN	256
2397836SJohn.Forte@Sun.COM #define	FCHBA_HARDWARE_VERSION_LEN	256
2407836SJohn.Forte@Sun.COM #define	FCHBA_DRIVER_VERSION_LEN	256
2417836SJohn.Forte@Sun.COM #define	FCHBA_OPTION_ROM_VERSION_LEN	256
2427836SJohn.Forte@Sun.COM #define	FCHBA_FIRMWARE_VERSION_LEN	256
2437836SJohn.Forte@Sun.COM #define	FCHBA_DRIVER_NAME_LEN		256
2447836SJohn.Forte@Sun.COM #define	FCHBA_SYMB_NAME_LEN		255
2457836SJohn.Forte@Sun.COM 
2467836SJohn.Forte@Sun.COM typedef struct fca_port_attrs {
2477836SJohn.Forte@Sun.COM 	char		manufacturer[FCHBA_MANUFACTURER_LEN];
2487836SJohn.Forte@Sun.COM 	char		serial_number[FCHBA_SERIAL_NUMBER_LEN];
2497836SJohn.Forte@Sun.COM 	char		model[FCHBA_MODEL_LEN];
2507836SJohn.Forte@Sun.COM 	char		model_description[FCHBA_MODEL_DESCRIPTION_LEN];
2517836SJohn.Forte@Sun.COM 	char		hardware_version[FCHBA_HARDWARE_VERSION_LEN];
2527836SJohn.Forte@Sun.COM 	char		driver_version[FCHBA_DRIVER_VERSION_LEN];
2537836SJohn.Forte@Sun.COM 	char		option_rom_version[FCHBA_OPTION_ROM_VERSION_LEN];
2547836SJohn.Forte@Sun.COM 	char		firmware_version[FCHBA_FIRMWARE_VERSION_LEN];
2557836SJohn.Forte@Sun.COM 	char		driver_name[FCHBA_DRIVER_NAME_LEN];
2567836SJohn.Forte@Sun.COM 	uint32_t	vendor_specific_id;
2577836SJohn.Forte@Sun.COM 	uint32_t	supported_cos;
2587836SJohn.Forte@Sun.COM 	uint32_t	supported_speed;
2597836SJohn.Forte@Sun.COM 	uint32_t	max_frame_size;
2607836SJohn.Forte@Sun.COM 	fca_hba_fru_details_t	hba_fru_details;
2617836SJohn.Forte@Sun.COM 	uchar_t		sym_node_name[FCHBA_SYMB_NAME_LEN];
2627836SJohn.Forte@Sun.COM 	uchar_t		sym_port_name[FCHBA_SYMB_NAME_LEN];
2637836SJohn.Forte@Sun.COM } fca_port_attrs_t;
2647836SJohn.Forte@Sun.COM 
2657836SJohn.Forte@Sun.COM 
2667836SJohn.Forte@Sun.COM 
2677836SJohn.Forte@Sun.COM typedef struct unsolicited_buffer {
2687836SJohn.Forte@Sun.COM 	uchar_t		ub_class;
2697836SJohn.Forte@Sun.COM 	uchar_t		ub_resvd1;
2707836SJohn.Forte@Sun.COM 	ushort_t	ub_resp_flags;		/* ULP-specific flags */
2717836SJohn.Forte@Sun.COM 	ushort_t	ub_resp_key;		/* ULP-specific key */
2727836SJohn.Forte@Sun.COM 	ushort_t	ub_resvd2;
2737836SJohn.Forte@Sun.COM 	uint32_t	ub_bufsize;
2747836SJohn.Forte@Sun.COM 	caddr_t		ub_buffer;
2757836SJohn.Forte@Sun.COM 	void		*ub_port_private;
2767836SJohn.Forte@Sun.COM 	void		*ub_fca_private;
2777836SJohn.Forte@Sun.COM 	opaque_t	ub_port_handle;
2787836SJohn.Forte@Sun.COM 	opaque_t	ub_resp_token;		/* Response token */
2797836SJohn.Forte@Sun.COM 	uint64_t	ub_token;
280*10264SZhong.Wang@Sun.COM 	fc_frame_hdr_t	ub_frame;
2817836SJohn.Forte@Sun.COM } fc_unsol_buf_t;
2827836SJohn.Forte@Sun.COM 
2837836SJohn.Forte@Sun.COM #define	FC_UB_RESP_LOGIN_REQUIRED	0x4000
2847836SJohn.Forte@Sun.COM 
2857836SJohn.Forte@Sun.COM typedef struct fc_trace_dmsg {
2867836SJohn.Forte@Sun.COM 	int			id_size;	/* message size */
2877836SJohn.Forte@Sun.COM 	int			id_flag;	/* for future */
2887836SJohn.Forte@Sun.COM 	timespec_t		id_time;	/* timestamp */
2897836SJohn.Forte@Sun.COM 	caddr_t			id_buf;		/* message buffer */
2907836SJohn.Forte@Sun.COM 	struct fc_trace_dmsg	*id_next;	/* next message in queue */
2917836SJohn.Forte@Sun.COM } fc_trace_dmsg_t;
2927836SJohn.Forte@Sun.COM 
2937836SJohn.Forte@Sun.COM #define	FC_TRACE_LOGQ_V2		0x1
2947836SJohn.Forte@Sun.COM 
2957836SJohn.Forte@Sun.COM typedef struct fc_trace_logq {
2967836SJohn.Forte@Sun.COM 	kmutex_t	il_lock;	/* lock to avoid clutter */
2977836SJohn.Forte@Sun.COM 	int		il_hiwat;	/* maximum queue size */
2987836SJohn.Forte@Sun.COM 	int		il_flags;
2997836SJohn.Forte@Sun.COM 	int		il_size;	/* current size */
3007836SJohn.Forte@Sun.COM 	int		il_afail;	/* count of allocation failures */
3017836SJohn.Forte@Sun.COM 	int		il_lfail;	/* general logging failures */
3027836SJohn.Forte@Sun.COM 	int		il_id;		/* message Id */
3037836SJohn.Forte@Sun.COM 	fc_trace_dmsg_t	*il_msgh;	/* messages head */
3047836SJohn.Forte@Sun.COM 	fc_trace_dmsg_t	*il_msgt;	/* messages tail */
3057836SJohn.Forte@Sun.COM } fc_trace_logq_t;
3067836SJohn.Forte@Sun.COM 
3077836SJohn.Forte@Sun.COM 
3087836SJohn.Forte@Sun.COM /*
3097836SJohn.Forte@Sun.COM  * Values for the pd_type field in the fc_remote_port_t struct below.
3107836SJohn.Forte@Sun.COM  * (Also used in map_type and changelist determination)
3117836SJohn.Forte@Sun.COM  */
3127836SJohn.Forte@Sun.COM #define	PORT_DEVICE_NOCHANGE		0x0 /* Event occurred on link, but */
3137836SJohn.Forte@Sun.COM 					    /* no change on the remote port */
3147836SJohn.Forte@Sun.COM #define	PORT_DEVICE_NEW			0x1 /* Newly created remote port, or */
3157836SJohn.Forte@Sun.COM 					    /* port has come back after being */
3167836SJohn.Forte@Sun.COM 					    /* marked as PORT_DEVICE_OLD */
3177836SJohn.Forte@Sun.COM #define	PORT_DEVICE_OLD			0x2 /* RSCN or Reset has occurred, */
3187836SJohn.Forte@Sun.COM 					    /* the remote port may come back */
3197836SJohn.Forte@Sun.COM #define	PORT_DEVICE_CHANGED		0x3 /* D_ID, PWWN, or other change */
3207836SJohn.Forte@Sun.COM 					    /* has occurred (hot swap?) */
3217836SJohn.Forte@Sun.COM #define	PORT_DEVICE_DELETE		0x4 /* Not used? */
3227836SJohn.Forte@Sun.COM #define	PORT_DEVICE_USER_LOGIN		0x5 /* only for changelist->map_type */
3237836SJohn.Forte@Sun.COM #define	PORT_DEVICE_USER_LOGOUT		0x6 /* only for changelist->map_type */
3247836SJohn.Forte@Sun.COM #define	PORT_DEVICE_USER_CREATE		0x7 /* only for changelist->map_type */
3257836SJohn.Forte@Sun.COM #define	PORT_DEVICE_USER_DELETE		0x8 /* only for changelist->map_type */
3269362SReed.Liu@Sun.COM #define	PORT_DEVICE_REPORTLUN_CHANGED	0x9 /* only for changelist->map_type */
3277836SJohn.Forte@Sun.COM 
3287836SJohn.Forte@Sun.COM /*
3297836SJohn.Forte@Sun.COM  * Flags used for fc_portmap->map_type
3307836SJohn.Forte@Sun.COM  */
3317836SJohn.Forte@Sun.COM 
3327836SJohn.Forte@Sun.COM #define	PORT_DEVICE_DUPLICATE_MAP_ENTRY 0x00000001 /* map entry has another */
3337836SJohn.Forte@Sun.COM 						/* entry for this target */
3347836SJohn.Forte@Sun.COM 						/* later in the list */
3357836SJohn.Forte@Sun.COM #define	PORT_DEVICE_NO_SKIP_DEVICE_DISCOVERY	0x00000002
3367836SJohn.Forte@Sun.COM 
3377836SJohn.Forte@Sun.COM 
3387836SJohn.Forte@Sun.COM /*
3397836SJohn.Forte@Sun.COM  * Logging and Debugging support
3407836SJohn.Forte@Sun.COM  */
3417836SJohn.Forte@Sun.COM void fc_trace_debug(fc_trace_logq_t *logq, caddr_t name, int dflag, int dlevel,
3427836SJohn.Forte@Sun.COM     int errno, const char *fmt, ...);
3437836SJohn.Forte@Sun.COM 
3447836SJohn.Forte@Sun.COM fc_trace_logq_t *fc_trace_alloc_logq(int maxsize);
3457836SJohn.Forte@Sun.COM void fc_trace_free_logq(fc_trace_logq_t *logq);
3467836SJohn.Forte@Sun.COM void fc_trace_logmsg(fc_trace_logq_t *logq, caddr_t buf, int level);
3477836SJohn.Forte@Sun.COM caddr_t fc_trace_msg(int fc_trace_error);
3487836SJohn.Forte@Sun.COM 
3497836SJohn.Forte@Sun.COM /*
3507836SJohn.Forte@Sun.COM  * Common utility routines
3517836SJohn.Forte@Sun.COM  */
3527836SJohn.Forte@Sun.COM 
3537836SJohn.Forte@Sun.COM void fc_wwn_to_str(la_wwn_t *wwn, caddr_t string);
3547836SJohn.Forte@Sun.COM void fc_str_to_wwn(caddr_t string, la_wwn_t *wwn);
3557836SJohn.Forte@Sun.COM 
3567836SJohn.Forte@Sun.COM #if	!defined(__lint)
3577836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique per request", unsolicited_buffer))
3587836SJohn.Forte@Sun.COM #endif	/* __lint */
3597836SJohn.Forte@Sun.COM 
3607836SJohn.Forte@Sun.COM #ifdef	__cplusplus
3617836SJohn.Forte@Sun.COM }
3627836SJohn.Forte@Sun.COM #endif
3637836SJohn.Forte@Sun.COM 
3647836SJohn.Forte@Sun.COM #endif	/* _FCTL_H */
365