xref: /onnv-gate/usr/src/lib/storage/libg_fc/common/hdrs/gfc.h (revision 7836:4e95154b5b7a)
1*7836SJohn.Forte@Sun.COM /*
2*7836SJohn.Forte@Sun.COM  * CDDL HEADER START
3*7836SJohn.Forte@Sun.COM  *
4*7836SJohn.Forte@Sun.COM  * The contents of this file are subject to the terms of the
5*7836SJohn.Forte@Sun.COM  * Common Development and Distribution License (the "License").
6*7836SJohn.Forte@Sun.COM  * You may not use this file except in compliance with the License.
7*7836SJohn.Forte@Sun.COM  *
8*7836SJohn.Forte@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7836SJohn.Forte@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*7836SJohn.Forte@Sun.COM  * See the License for the specific language governing permissions
11*7836SJohn.Forte@Sun.COM  * and limitations under the License.
12*7836SJohn.Forte@Sun.COM  *
13*7836SJohn.Forte@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*7836SJohn.Forte@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7836SJohn.Forte@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*7836SJohn.Forte@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*7836SJohn.Forte@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*7836SJohn.Forte@Sun.COM  *
19*7836SJohn.Forte@Sun.COM  * CDDL HEADER END
20*7836SJohn.Forte@Sun.COM  */
21*7836SJohn.Forte@Sun.COM /*
22*7836SJohn.Forte@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*7836SJohn.Forte@Sun.COM  * Use is subject to license terms.
24*7836SJohn.Forte@Sun.COM  */
25*7836SJohn.Forte@Sun.COM 
26*7836SJohn.Forte@Sun.COM /*
27*7836SJohn.Forte@Sun.COM  *	Generic Fibre Channel Library definitions
28*7836SJohn.Forte@Sun.COM  */
29*7836SJohn.Forte@Sun.COM 
30*7836SJohn.Forte@Sun.COM /*
31*7836SJohn.Forte@Sun.COM  * I18N message number ranges
32*7836SJohn.Forte@Sun.COM  *  This file: 19500 - 19999
33*7836SJohn.Forte@Sun.COM  *  Shared common messages: 1 - 1999
34*7836SJohn.Forte@Sun.COM  */
35*7836SJohn.Forte@Sun.COM 
36*7836SJohn.Forte@Sun.COM #ifndef	_GFC_H
37*7836SJohn.Forte@Sun.COM #define	_GFC_H
38*7836SJohn.Forte@Sun.COM 
39*7836SJohn.Forte@Sun.COM 
40*7836SJohn.Forte@Sun.COM #ifdef	__cplusplus
41*7836SJohn.Forte@Sun.COM extern "C" {
42*7836SJohn.Forte@Sun.COM #endif
43*7836SJohn.Forte@Sun.COM 
44*7836SJohn.Forte@Sun.COM /*
45*7836SJohn.Forte@Sun.COM  * Put your include files here
46*7836SJohn.Forte@Sun.COM  */
47*7836SJohn.Forte@Sun.COM #include 	<sys/types.h>
48*7836SJohn.Forte@Sun.COM #include 	<sys/fibre-channel/fcio.h>
49*7836SJohn.Forte@Sun.COM #include	<sys/sunmdi.h>
50*7836SJohn.Forte@Sun.COM #include	<sys/scsi/generic/inquiry.h>
51*7836SJohn.Forte@Sun.COM /*
52*7836SJohn.Forte@Sun.COM  * sys/fc4/fcio.h includes sys/fc4/fcal_linkapp.h.  The following #define
53*7836SJohn.Forte@Sun.COM  * keeps from actually including the contents of sys/fc4/fcal_linkapp.h
54*7836SJohn.Forte@Sun.COM  * since that file contains the same structure definitions as sys/fc4/fcio.h.
55*7836SJohn.Forte@Sun.COM  */
56*7836SJohn.Forte@Sun.COM #define		_SYS_FC4_FCAL_LINKAPP_H
57*7836SJohn.Forte@Sun.COM #include	<sys/fc4/fcio.h>
58*7836SJohn.Forte@Sun.COM 
59*7836SJohn.Forte@Sun.COM 
60*7836SJohn.Forte@Sun.COM /* Defines */
61*7836SJohn.Forte@Sun.COM #define		WWN_S_LEN	17 	/* NULL terminated string */
62*7836SJohn.Forte@Sun.COM #define		WWN_SIZE	8
63*7836SJohn.Forte@Sun.COM #define		MAX_HBA_PORT	256
64*7836SJohn.Forte@Sun.COM 
65*7836SJohn.Forte@Sun.COM /* Constants used by g_wwn_in_dev_list() */
66*7836SJohn.Forte@Sun.COM #define		MATCH_NODE_WWN	0
67*7836SJohn.Forte@Sun.COM #define		MATCH_PORT_WWN	1
68*7836SJohn.Forte@Sun.COM 
69*7836SJohn.Forte@Sun.COM /*
70*7836SJohn.Forte@Sun.COM  * The masks defined below are for the Fibre channel transport and FCAs.
71*7836SJohn.Forte@Sun.COM  * Mask names starting with FC4 are for the non-fabric fibre channel driver
72*7836SJohn.Forte@Sun.COM  * stack and those starting with FC are for the fabric fibre channel driver
73*7836SJohn.Forte@Sun.COM  * stack.
74*7836SJohn.Forte@Sun.COM  *
75*7836SJohn.Forte@Sun.COM  * The transport values are represented in the low order 16 bits and FCA
76*7836SJohn.Forte@Sun.COM  * values represented in the high order 16 bits.
77*7836SJohn.Forte@Sun.COM  *
78*7836SJohn.Forte@Sun.COM  * The notation used is as shown below :
79*7836SJohn.Forte@Sun.COM  * (starting from the low order byte)
80*7836SJohn.Forte@Sun.COM  * Byte 1 - holds the non-fabric FC transport driver defines
81*7836SJohn.Forte@Sun.COM  * Byte 2 - holds the fabric FC transport driver defines
82*7836SJohn.Forte@Sun.COM  * Byte 3 - holds the non-fabric FC FCA defines
83*7836SJohn.Forte@Sun.COM  * Byte 4 - holds the fabric FC FCA defines
84*7836SJohn.Forte@Sun.COM  */
85*7836SJohn.Forte@Sun.COM /* Recognized Transport categories */
86*7836SJohn.Forte@Sun.COM #define	FC4_SF_XPORT	0x00000001
87*7836SJohn.Forte@Sun.COM #define	FC4_IFP_XPORT	0x00000002
88*7836SJohn.Forte@Sun.COM #define	FC_GEN_XPORT	0x00000100
89*7836SJohn.Forte@Sun.COM 
90*7836SJohn.Forte@Sun.COM /* Transport masks */
91*7836SJohn.Forte@Sun.COM #define	FC4_XPORT_MASK	0x000000FF
92*7836SJohn.Forte@Sun.COM #define	FC_XPORT_MASK	0x0000FF00
93*7836SJohn.Forte@Sun.COM #define	XPORT_MASK	(FC_XPORT_MASK | FC4_XPORT_MASK)
94*7836SJohn.Forte@Sun.COM 
95*7836SJohn.Forte@Sun.COM /* Recognized Fibre Channel Adapters */
96*7836SJohn.Forte@Sun.COM #define	FC4_SOCAL_FCA	0x00010000
97*7836SJohn.Forte@Sun.COM #define	FC4_PCI_FCA	0x00020000
98*7836SJohn.Forte@Sun.COM #define	FC_PCI_FCA	0x02000000
99*7836SJohn.Forte@Sun.COM 
100*7836SJohn.Forte@Sun.COM /* FCA masks */
101*7836SJohn.Forte@Sun.COM #define	FC4_FCA_MASK	0x00FF0000
102*7836SJohn.Forte@Sun.COM #define	FC_FCA_MASK	0xFF000000
103*7836SJohn.Forte@Sun.COM #define	FCA_MASK	(FC_FCA_MASK | FC4_FCA_MASK)
104*7836SJohn.Forte@Sun.COM 
105*7836SJohn.Forte@Sun.COM /*
106*7836SJohn.Forte@Sun.COM  * Disk ports
107*7836SJohn.Forte@Sun.COM  */
108*7836SJohn.Forte@Sun.COM #define	PORT_B			0x00
109*7836SJohn.Forte@Sun.COM #define	PORT_A			0x01
110*7836SJohn.Forte@Sun.COM #define	FC_PORT_A		0x00
111*7836SJohn.Forte@Sun.COM #define	FC_PORT_B		0x01
112*7836SJohn.Forte@Sun.COM #define	PORT_A_B		0x02
113*7836SJohn.Forte@Sun.COM 
114*7836SJohn.Forte@Sun.COM /* Constants used by g_set_port_state() */
115*7836SJohn.Forte@Sun.COM #define	PORT_OFFLINE	0
116*7836SJohn.Forte@Sun.COM #define	PORT_ONLINE	1
117*7836SJohn.Forte@Sun.COM 
118*7836SJohn.Forte@Sun.COM /* Constants used by g_loopback_mode() */
119*7836SJohn.Forte@Sun.COM #define	NO_LPBACK		0x00
120*7836SJohn.Forte@Sun.COM #define	EXT_LPBACK		0x01
121*7836SJohn.Forte@Sun.COM #define	INT_LPBACK		0x02
122*7836SJohn.Forte@Sun.COM 
123*7836SJohn.Forte@Sun.COM /* Constants for port state */
124*7836SJohn.Forte@Sun.COM #define	PORT_CONNECTED		0x00
125*7836SJohn.Forte@Sun.COM #define	PORT_NOTCONNECTED	0x01
126*7836SJohn.Forte@Sun.COM 
127*7836SJohn.Forte@Sun.COM /* Extended pathinfo node states */
128*7836SJohn.Forte@Sun.COM #define	MDI_PATHINFO_STATE_TRANSIENT			0x00010000
129*7836SJohn.Forte@Sun.COM #define	MDI_PATHINFO_STATE_USER_DISABLE			0x00100000
130*7836SJohn.Forte@Sun.COM #define	MDI_PATHINFO_STATE_DRV_DISABLE			0x00200000
131*7836SJohn.Forte@Sun.COM #define	MDI_PATHINFO_STATE_DRV_DISABLE_TRANSIENT	0x00400000
132*7836SJohn.Forte@Sun.COM #define	MDI_PATHINFO_STATE_MASK				0x0000FFFF
133*7836SJohn.Forte@Sun.COM #define	MDI_PATHINFO_EXT_STATE_MASK			0xFFF00000
134*7836SJohn.Forte@Sun.COM 
135*7836SJohn.Forte@Sun.COM /*
136*7836SJohn.Forte@Sun.COM  * Error inq dtype for g_get_dev_list partial failure.
137*7836SJohn.Forte@Sun.COM  * choose E0 since Solaris has #define DTYPE_MASK 0x1F.
138*7836SJohn.Forte@Sun.COM  */
139*7836SJohn.Forte@Sun.COM #define	GFC_ERR_INQ_DTYPE	(0xFF & ~DTYPE_MASK)
140*7836SJohn.Forte@Sun.COM 
141*7836SJohn.Forte@Sun.COM /* Exported Variables */
142*7836SJohn.Forte@Sun.COM extern uchar_t g_switch_to_alpa[];
143*7836SJohn.Forte@Sun.COM extern uchar_t g_sf_alpa_to_switch[];
144*7836SJohn.Forte@Sun.COM 
145*7836SJohn.Forte@Sun.COM 
146*7836SJohn.Forte@Sun.COM /* Exported Structures */
147*7836SJohn.Forte@Sun.COM 
148*7836SJohn.Forte@Sun.COM /*	Device Map	*/
149*7836SJohn.Forte@Sun.COM typedef struct	al_rls {
150*7836SJohn.Forte@Sun.COM 	char			driver_path[MAXNAMELEN];
151*7836SJohn.Forte@Sun.COM 	uint_t			al_ha;
152*7836SJohn.Forte@Sun.COM 	struct rls_payload	payload;
153*7836SJohn.Forte@Sun.COM 	struct al_rls		*next;
154*7836SJohn.Forte@Sun.COM } AL_rls;
155*7836SJohn.Forte@Sun.COM 
156*7836SJohn.Forte@Sun.COM 
157*7836SJohn.Forte@Sun.COM /* Multi path list */
158*7836SJohn.Forte@Sun.COM struct	dlist	{
159*7836SJohn.Forte@Sun.COM 	char	*dev_path;
160*7836SJohn.Forte@Sun.COM 	char	*logical_path;
161*7836SJohn.Forte@Sun.COM 	struct	dlist *multipath;
162*7836SJohn.Forte@Sun.COM 	struct	dlist *next;
163*7836SJohn.Forte@Sun.COM 	struct	dlist *prev;
164*7836SJohn.Forte@Sun.COM };
165*7836SJohn.Forte@Sun.COM 
166*7836SJohn.Forte@Sun.COM 
167*7836SJohn.Forte@Sun.COM /* Individual drive state */
168*7836SJohn.Forte@Sun.COM typedef struct g_disk_state_struct {
169*7836SJohn.Forte@Sun.COM 	uint_t		num_blocks;		 /* Capacity */
170*7836SJohn.Forte@Sun.COM 	char		physical_path[MAXNAMELEN];	/* First one found */
171*7836SJohn.Forte@Sun.COM 	struct dlist	*multipath_list;
172*7836SJohn.Forte@Sun.COM 	char		node_wwn_s[WWN_S_LEN];	 /* NULL terminated str */
173*7836SJohn.Forte@Sun.COM 	int		persistent_reserv_flag;
174*7836SJohn.Forte@Sun.COM 	int		persistent_active, persistent_registered;
175*7836SJohn.Forte@Sun.COM 	int		d_state_flags[2];	 /* Disk state */
176*7836SJohn.Forte@Sun.COM 	int		port_a_valid;		 /* If disk state is valid */
177*7836SJohn.Forte@Sun.COM 	int		port_b_valid;		 /* If disk state is valid */
178*7836SJohn.Forte@Sun.COM 	char		port_a_wwn_s[WWN_S_LEN]; /* NULL terminated string */
179*7836SJohn.Forte@Sun.COM 	char		port_b_wwn_s[WWN_S_LEN]; /* NULL terminated string */
180*7836SJohn.Forte@Sun.COM } G_disk_state;
181*7836SJohn.Forte@Sun.COM 
182*7836SJohn.Forte@Sun.COM 
183*7836SJohn.Forte@Sun.COM typedef	struct hotplug_disk_list {
184*7836SJohn.Forte@Sun.COM 	struct dlist		*seslist;
185*7836SJohn.Forte@Sun.COM 	struct dlist		*dlhead;
186*7836SJohn.Forte@Sun.COM 	char			box_name[33];
187*7836SJohn.Forte@Sun.COM 	char			dev_name[MAXPATHLEN];
188*7836SJohn.Forte@Sun.COM 	char			node_wwn_s[17];
189*7836SJohn.Forte@Sun.COM 	int			tid;
190*7836SJohn.Forte@Sun.COM 	int			slot;
191*7836SJohn.Forte@Sun.COM 	int			f_flag; /* Front flag */
192*7836SJohn.Forte@Sun.COM 	int			dev_type;
193*7836SJohn.Forte@Sun.COM 	int			dev_location; /* device in A5000 or not */
194*7836SJohn.Forte@Sun.COM 	int			busy_flag;
195*7836SJohn.Forte@Sun.COM 	int			reserve_flag;
196*7836SJohn.Forte@Sun.COM 	struct hotplug_disk_list	*next;
197*7836SJohn.Forte@Sun.COM 	struct hotplug_disk_list	*prev;
198*7836SJohn.Forte@Sun.COM } Hotplug_Devlist;
199*7836SJohn.Forte@Sun.COM 
200*7836SJohn.Forte@Sun.COM typedef struct l_inquiry_inq_2 {
201*7836SJohn.Forte@Sun.COM 	uchar_t inq_2_reladdr	: 1,	/* relative addressing */
202*7836SJohn.Forte@Sun.COM 		inq_wbus32	: 1,	/* 32 bit wide data xfers */
203*7836SJohn.Forte@Sun.COM 		inq_wbus16	: 1,	/* 16 bit wide data xfers */
204*7836SJohn.Forte@Sun.COM 		inq_sync	: 1,	/* synchronous data xfers */
205*7836SJohn.Forte@Sun.COM 		inq_linked	: 1,	/* linked commands */
206*7836SJohn.Forte@Sun.COM 		inq_res1	: 1,	/* reserved */
207*7836SJohn.Forte@Sun.COM 		inq_cmdque	: 1,	/* command queueing */
208*7836SJohn.Forte@Sun.COM 		inq_sftre	: 1;	/* Soft Reset option */
209*7836SJohn.Forte@Sun.COM } L_inq_2;
210*7836SJohn.Forte@Sun.COM typedef struct l_inquiry_inq_3 {
211*7836SJohn.Forte@Sun.COM 	uchar_t inq_3_reladdr	: 1,	/* relative addressing */
212*7836SJohn.Forte@Sun.COM 		inq_SIP_2	: 3,	/* Interlocked Protocol */
213*7836SJohn.Forte@Sun.COM 		inq_3_linked	: 1,	/* linked commands */
214*7836SJohn.Forte@Sun.COM 		inq_trandis	: 1,	/* Transfer Disable */
215*7836SJohn.Forte@Sun.COM 		inq_3_cmdque	: 1,	/* command queueing */
216*7836SJohn.Forte@Sun.COM 		inq_SIP_3	: 1;	/* Interlocked Protocol */
217*7836SJohn.Forte@Sun.COM } L_inq_3;
218*7836SJohn.Forte@Sun.COM 
219*7836SJohn.Forte@Sun.COM typedef struct l_inquiry_struct {
220*7836SJohn.Forte@Sun.COM 	/*
221*7836SJohn.Forte@Sun.COM 	 * byte 0
222*7836SJohn.Forte@Sun.COM 	 *
223*7836SJohn.Forte@Sun.COM 	 * Bits 7-5 are the Peripheral Device Qualifier
224*7836SJohn.Forte@Sun.COM 	 * Bits 4-0 are the Peripheral Device Type
225*7836SJohn.Forte@Sun.COM 	 *
226*7836SJohn.Forte@Sun.COM 	 */
227*7836SJohn.Forte@Sun.COM 	uchar_t	inq_dtype;
228*7836SJohn.Forte@Sun.COM 	/* byte 1 */
229*7836SJohn.Forte@Sun.COM 	uchar_t	inq_rmb		: 1,	/* removable media */
230*7836SJohn.Forte@Sun.COM 		inq_qual	: 7;	/* device type qualifier */
231*7836SJohn.Forte@Sun.COM 
232*7836SJohn.Forte@Sun.COM 	/* byte 2 */
233*7836SJohn.Forte@Sun.COM 	uchar_t	inq_iso		: 2,	/* ISO version */
234*7836SJohn.Forte@Sun.COM 		inq_ecma	: 3,	/* ECMA version */
235*7836SJohn.Forte@Sun.COM 		inq_ansi	: 3;	/* ANSI version */
236*7836SJohn.Forte@Sun.COM 
237*7836SJohn.Forte@Sun.COM 	/* byte 3 */
238*7836SJohn.Forte@Sun.COM #define	inq_aerc inq_aenc	/* SCSI-3 */
239*7836SJohn.Forte@Sun.COM 	uchar_t	inq_aenc	: 1,	/* async event notification cap. */
240*7836SJohn.Forte@Sun.COM 		inq_trmiop	: 1,	/* supports TERMINATE I/O PROC msg */
241*7836SJohn.Forte@Sun.COM 		inq_normaca	: 1,	/* Normal ACA Supported */
242*7836SJohn.Forte@Sun.COM 				: 1,	/* reserved */
243*7836SJohn.Forte@Sun.COM 		inq_rdf		: 4;	/* response data format */
244*7836SJohn.Forte@Sun.COM 
245*7836SJohn.Forte@Sun.COM 	/* bytes 4-7 */
246*7836SJohn.Forte@Sun.COM 	uchar_t	inq_len;		/* additional length */
247*7836SJohn.Forte@Sun.COM 	uchar_t			: 8;	/* reserved */
248*7836SJohn.Forte@Sun.COM 	uchar_t			: 2,	/* reserved */
249*7836SJohn.Forte@Sun.COM 		inq_port	: 1,	/* Only defined when dual_p set */
250*7836SJohn.Forte@Sun.COM 		inq_dual_p	: 1,	/* Dual Port */
251*7836SJohn.Forte@Sun.COM 		inq_mchngr	: 1,	/* Medium Changer */
252*7836SJohn.Forte@Sun.COM 		inq_SIP_1	: 3;	/* Interlocked Protocol */
253*7836SJohn.Forte@Sun.COM 
254*7836SJohn.Forte@Sun.COM 	union {
255*7836SJohn.Forte@Sun.COM 		L_inq_2 inq_2;
256*7836SJohn.Forte@Sun.COM 		L_inq_3 inq_3;
257*7836SJohn.Forte@Sun.COM 	} ui;
258*7836SJohn.Forte@Sun.COM 
259*7836SJohn.Forte@Sun.COM 
260*7836SJohn.Forte@Sun.COM 	/* bytes 8-35 */
261*7836SJohn.Forte@Sun.COM 
262*7836SJohn.Forte@Sun.COM 	uchar_t	inq_vid[8];		/* vendor ID */
263*7836SJohn.Forte@Sun.COM 
264*7836SJohn.Forte@Sun.COM 	uchar_t	inq_pid[16];		/* product ID */
265*7836SJohn.Forte@Sun.COM 
266*7836SJohn.Forte@Sun.COM 	uchar_t	inq_revision[4];	/* product revision level */
267*7836SJohn.Forte@Sun.COM 
268*7836SJohn.Forte@Sun.COM 	/*
269*7836SJohn.Forte@Sun.COM 	 * Bytes 36-55 are vendor-specific parameter bytes
270*7836SJohn.Forte@Sun.COM 	 */
271*7836SJohn.Forte@Sun.COM 
272*7836SJohn.Forte@Sun.COM 	/* SSA specific definitions */
273*7836SJohn.Forte@Sun.COM 	/* bytes 36 - 39 */
274*7836SJohn.Forte@Sun.COM #define	inq_ven_specific_1 inq_firmware_rev
275*7836SJohn.Forte@Sun.COM 	uchar_t	inq_firmware_rev[4];	/* firmware revision level */
276*7836SJohn.Forte@Sun.COM 
277*7836SJohn.Forte@Sun.COM 	/* bytes 40 - 51 */
278*7836SJohn.Forte@Sun.COM 	uchar_t	inq_serial[12];		/* serial number, not used any more */
279*7836SJohn.Forte@Sun.COM 
280*7836SJohn.Forte@Sun.COM 	/* bytes 52-53 */
281*7836SJohn.Forte@Sun.COM 	uchar_t	inq_res2[2];
282*7836SJohn.Forte@Sun.COM 
283*7836SJohn.Forte@Sun.COM 	/* byte 54, 55 */
284*7836SJohn.Forte@Sun.COM 	uchar_t	inq_ssa_ports;		/* number of ports */
285*7836SJohn.Forte@Sun.COM 	uchar_t	inq_ssa_tgts;		/* number of targets */
286*7836SJohn.Forte@Sun.COM 
287*7836SJohn.Forte@Sun.COM 	/*
288*7836SJohn.Forte@Sun.COM 	 * Bytes 56-95 are reserved.
289*7836SJohn.Forte@Sun.COM 	 */
290*7836SJohn.Forte@Sun.COM 	uchar_t	inq_res3[40];
291*7836SJohn.Forte@Sun.COM 	/*
292*7836SJohn.Forte@Sun.COM 	 * 96 to 'n' are vendor-specific parameter bytes
293*7836SJohn.Forte@Sun.COM 	 */
294*7836SJohn.Forte@Sun.COM 	uchar_t	inq_box_name[32];
295*7836SJohn.Forte@Sun.COM 	uchar_t	inq_avu[256];
296*7836SJohn.Forte@Sun.COM } L_inquiry;
297*7836SJohn.Forte@Sun.COM 
298*7836SJohn.Forte@Sun.COM 
299*7836SJohn.Forte@Sun.COM typedef struct wwn_list_struct {
300*7836SJohn.Forte@Sun.COM 	char	*logical_path;
301*7836SJohn.Forte@Sun.COM 	char	*physical_path;
302*7836SJohn.Forte@Sun.COM 	char	node_wwn_s[WWN_S_LEN];	/* NULL terminated string */
303*7836SJohn.Forte@Sun.COM 	uchar_t	w_node_wwn[WWN_SIZE];
304*7836SJohn.Forte@Sun.COM 	char	port_wwn_s[WWN_S_LEN];	/* NULL terminated string */
305*7836SJohn.Forte@Sun.COM 	uchar_t	device_type;	/* disk or tape (Peripheral Device Type) */
306*7836SJohn.Forte@Sun.COM 	struct	wwn_list_struct	*wwn_prev;
307*7836SJohn.Forte@Sun.COM 	struct	wwn_list_struct	*wwn_next;
308*7836SJohn.Forte@Sun.COM } WWN_list;
309*7836SJohn.Forte@Sun.COM 
310*7836SJohn.Forte@Sun.COM 
311*7836SJohn.Forte@Sun.COM /* HBA port list */
312*7836SJohn.Forte@Sun.COM typedef struct portlist {
313*7836SJohn.Forte@Sun.COM 	int hbacnt;
314*7836SJohn.Forte@Sun.COM 	char *physpath[MAX_HBA_PORT];
315*7836SJohn.Forte@Sun.COM } portlist_t;
316*7836SJohn.Forte@Sun.COM /* union for capturing sf and fp strucures */
317*7836SJohn.Forte@Sun.COM typedef union gfc_port_dev_u {
318*7836SJohn.Forte@Sun.COM 	sf_al_addr_pair_t	priv_port; /* private loop */
319*7836SJohn.Forte@Sun.COM 	fc_port_dev_t		pub_port;  /* fabric/public loop */
320*7836SJohn.Forte@Sun.COM } gfc_port_dev_ut;
321*7836SJohn.Forte@Sun.COM 
322*7836SJohn.Forte@Sun.COM 
323*7836SJohn.Forte@Sun.COM /* FC device sturcure with topology */
324*7836SJohn.Forte@Sun.COM typedef struct gfc_port_dev_info {
325*7836SJohn.Forte@Sun.COM 	uint32_t	port_topology;
326*7836SJohn.Forte@Sun.COM 	gfc_port_dev_ut gfc_port_dev;
327*7836SJohn.Forte@Sun.COM } gfc_port_dev_info_t;
328*7836SJohn.Forte@Sun.COM 
329*7836SJohn.Forte@Sun.COM 
330*7836SJohn.Forte@Sun.COM /* strucure for FC map */
331*7836SJohn.Forte@Sun.COM typedef struct gfc_map {
332*7836SJohn.Forte@Sun.COM 	int	count;
333*7836SJohn.Forte@Sun.COM 	gfc_port_dev_info_t	*dev_addr;
334*7836SJohn.Forte@Sun.COM 	gfc_port_dev_info_t	hba_addr;
335*7836SJohn.Forte@Sun.COM } gfc_map_t;
336*7836SJohn.Forte@Sun.COM 
337*7836SJohn.Forte@Sun.COM /* g_dev_map_init related declaration */
338*7836SJohn.Forte@Sun.COM 
339*7836SJohn.Forte@Sun.COM typedef void *gfc_dev_t; /* opaque type for map device */
340*7836SJohn.Forte@Sun.COM typedef void *gfc_prop_t; /* opaque type for map device property */
341*7836SJohn.Forte@Sun.COM 
342*7836SJohn.Forte@Sun.COM #define	MAP_FORMAT_STANDARD	0
343*7836SJohn.Forte@Sun.COM #define	MAP_FORMAT_LILP		0x00000001
344*7836SJohn.Forte@Sun.COM #define	MAP_XPORT_PROP_ONLY	0x00000010
345*7836SJohn.Forte@Sun.COM 
346*7836SJohn.Forte@Sun.COM /* property name for g_dev_prop_lookup */
347*7836SJohn.Forte@Sun.COM #define	PORT_WWN_PROP "port-wwn"
348*7836SJohn.Forte@Sun.COM #define	NODE_WWN_PROP "node-wwn"
349*7836SJohn.Forte@Sun.COM #define	INQ_DTYPE_PROP "inq-dtype"
350*7836SJohn.Forte@Sun.COM #define	PORT_ADDR_PROP "port-addr"
351*7836SJohn.Forte@Sun.COM #define	HARD_ADDR_PROP "hard-addr"
352*7836SJohn.Forte@Sun.COM 
353*7836SJohn.Forte@Sun.COM /* property type for g_dev_prop_next */
354*7836SJohn.Forte@Sun.COM #define	GFC_PROP_TYPE_BOOLEAN	0
355*7836SJohn.Forte@Sun.COM #define	GFC_PROP_TYPE_INT	1
356*7836SJohn.Forte@Sun.COM #define	GFC_PROP_TYPE_STRING	2
357*7836SJohn.Forte@Sun.COM #define	GFC_PROP_TYPE_BYTES	3
358*7836SJohn.Forte@Sun.COM #define	GFC_PROP_TYPE_UNKNOWN	4
359*7836SJohn.Forte@Sun.COM 
360*7836SJohn.Forte@Sun.COM typedef struct mp_pathinfo {
361*7836SJohn.Forte@Sun.COM 	mdi_pathinfo_state_t path_state;
362*7836SJohn.Forte@Sun.COM 	char	path_class[MAXNAMELEN];
363*7836SJohn.Forte@Sun.COM 	char	path_hba[MAXPATHLEN];
364*7836SJohn.Forte@Sun.COM 	char	path_dev[MAXPATHLEN];
365*7836SJohn.Forte@Sun.COM 	char	path_addr[MAXNAMELEN];
366*7836SJohn.Forte@Sun.COM } mp_pathinfo_t;
367*7836SJohn.Forte@Sun.COM 
368*7836SJohn.Forte@Sun.COM /* structure for mpxio pathlist */
369*7836SJohn.Forte@Sun.COM typedef struct mp_pathlist {
370*7836SJohn.Forte@Sun.COM 	uint_t		path_count;
371*7836SJohn.Forte@Sun.COM 	mp_pathinfo_t	*path_info;
372*7836SJohn.Forte@Sun.COM } mp_pathlist_t;
373*7836SJohn.Forte@Sun.COM 
374*7836SJohn.Forte@Sun.COM /*
375*7836SJohn.Forte@Sun.COM  * Prototypes of Exported functions which are defined in libg_fc
376*7836SJohn.Forte@Sun.COM  * They are all CONTRACT PRIVATE
377*7836SJohn.Forte@Sun.COM  */
378*7836SJohn.Forte@Sun.COM 
379*7836SJohn.Forte@Sun.COM #if defined(__STDC__)
380*7836SJohn.Forte@Sun.COM 
381*7836SJohn.Forte@Sun.COM extern int	g_dev_start(char *, int);
382*7836SJohn.Forte@Sun.COM extern int	g_dev_stop(char *, struct wwn_list_struct *, int);
383*7836SJohn.Forte@Sun.COM extern int	g_force_lip(char *, int);
384*7836SJohn.Forte@Sun.COM extern int	g_forcelip_all(struct hotplug_disk_list *);
385*7836SJohn.Forte@Sun.COM extern void	g_free_multipath(struct dlist *);
386*7836SJohn.Forte@Sun.COM extern void	g_free_wwn_list(struct wwn_list_struct **);
387*7836SJohn.Forte@Sun.COM extern int	g_get_dev_map(char *, gfc_map_t *, int);
388*7836SJohn.Forte@Sun.COM extern int	g_get_lilp_map(char *, gfc_map_t *, int);
389*7836SJohn.Forte@Sun.COM extern int	g_get_inq_dtype(char *, la_wwn_t, uchar_t *);
390*7836SJohn.Forte@Sun.COM extern int	g_get_dev_list(char *, fc_port_dev_t **, int *);
391*7836SJohn.Forte@Sun.COM extern int	g_wwn_in_dev_list(char *, la_wwn_t, int);
392*7836SJohn.Forte@Sun.COM extern char 	*g_get_dev_or_bus_phys_name(char *);
393*7836SJohn.Forte@Sun.COM extern char 	*g_get_errString(int);
394*7836SJohn.Forte@Sun.COM extern int	g_get_inquiry(char *, L_inquiry *);
395*7836SJohn.Forte@Sun.COM extern int	g_get_serial_number(char *, uchar_t *, size_t *);
396*7836SJohn.Forte@Sun.COM extern int	g_get_limited_map(char *, struct lilpmap *, int);
397*7836SJohn.Forte@Sun.COM extern int	g_get_multipath(char *, struct dlist **,
398*7836SJohn.Forte@Sun.COM 		struct wwn_list_struct *, int);
399*7836SJohn.Forte@Sun.COM extern int	g_get_nexus_path(char *, char **);
400*7836SJohn.Forte@Sun.COM extern char 	*g_get_physical_name_from_link(char *);
401*7836SJohn.Forte@Sun.COM extern char 	*g_get_physical_name(char *);
402*7836SJohn.Forte@Sun.COM extern int	g_get_wwn(char *, uchar_t *, uchar_t *, int *, int);
403*7836SJohn.Forte@Sun.COM extern int	g_get_wwn_list(struct wwn_list_struct **, int);
404*7836SJohn.Forte@Sun.COM extern int	g_i18n_catopen(void);
405*7836SJohn.Forte@Sun.COM extern int	g_offline_drive(struct dlist *, int);
406*7836SJohn.Forte@Sun.COM extern void	g_online_drive(struct dlist *, int);
407*7836SJohn.Forte@Sun.COM extern int	g_rdls(char *, struct al_rls **, int);
408*7836SJohn.Forte@Sun.COM extern uint_t	g_get_path_type(char *);
409*7836SJohn.Forte@Sun.COM extern int	g_get_host_params(char *, fc_port_dev_t *, int);
410*7836SJohn.Forte@Sun.COM extern int	g_port_offline(char *);
411*7836SJohn.Forte@Sun.COM extern int	g_port_online(char *);
412*7836SJohn.Forte@Sun.COM extern int	g_get_port_path(char *, portlist_t *);
413*7836SJohn.Forte@Sun.COM extern void	g_free_portlist(portlist_t *);
414*7836SJohn.Forte@Sun.COM extern int	g_loopback_mode(char *, int);
415*7836SJohn.Forte@Sun.COM extern int	g_get_port_state(char *, int *, int);
416*7836SJohn.Forte@Sun.COM extern int	g_get_fca_port_topology(char *, uint32_t *, int);
417*7836SJohn.Forte@Sun.COM extern int	g_dev_login(char *, la_wwn_t);
418*7836SJohn.Forte@Sun.COM extern int	g_dev_logout(char *, la_wwn_t);
419*7836SJohn.Forte@Sun.COM extern int	g_get_pathlist(char *, struct mp_pathlist *);
420*7836SJohn.Forte@Sun.COM extern int	g_failover(char *, char *);
421*7836SJohn.Forte@Sun.COM 
422*7836SJohn.Forte@Sun.COM /* g_dev_map_init related routines. */
423*7836SJohn.Forte@Sun.COM extern gfc_dev_t	g_dev_map_init(char *, int *, int);
424*7836SJohn.Forte@Sun.COM extern void		g_dev_map_fini(gfc_dev_t);
425*7836SJohn.Forte@Sun.COM extern int		g_get_map_topology(gfc_dev_t, uint_t *);
426*7836SJohn.Forte@Sun.COM extern gfc_dev_t	g_get_first_dev(gfc_dev_t, int *);
427*7836SJohn.Forte@Sun.COM extern gfc_dev_t	g_get_next_dev(gfc_dev_t, int *);
428*7836SJohn.Forte@Sun.COM extern int	g_dev_prop_lookup_bytes(gfc_dev_t, const char *, int *,
429*7836SJohn.Forte@Sun.COM 		uchar_t **);
430*7836SJohn.Forte@Sun.COM extern int g_dev_prop_lookup_ints(gfc_dev_t, const char *, int **);
431*7836SJohn.Forte@Sun.COM extern int g_dev_prop_lookup_strings(gfc_dev_t, const char *, char **);
432*7836SJohn.Forte@Sun.COM extern gfc_prop_t g_get_first_dev_prop(gfc_dev_t, int *);
433*7836SJohn.Forte@Sun.COM extern gfc_prop_t g_get_next_dev_prop(gfc_prop_t, int *);
434*7836SJohn.Forte@Sun.COM extern char *g_get_dev_prop_name(gfc_prop_t, int *);
435*7836SJohn.Forte@Sun.COM extern int g_get_dev_prop_type(gfc_prop_t, int *);
436*7836SJohn.Forte@Sun.COM extern int g_get_dev_prop_bytes(gfc_prop_t, int *, uchar_t **);
437*7836SJohn.Forte@Sun.COM extern int g_get_dev_prop_ints(gfc_prop_t, int **);
438*7836SJohn.Forte@Sun.COM extern int g_get_dev_prop_strings(gfc_prop_t, char **);
439*7836SJohn.Forte@Sun.COM extern int g_stms_path_disable(char *, char *);
440*7836SJohn.Forte@Sun.COM extern int g_stms_path_enable(char *, char *);
441*7836SJohn.Forte@Sun.COM extern int g_stms_path_disable_all(char *);
442*7836SJohn.Forte@Sun.COM extern int g_stms_path_enable_all(char *);
443*7836SJohn.Forte@Sun.COM extern int g_stms_get_path_state(char *, char *, int *, int *);
444*7836SJohn.Forte@Sun.COM 
445*7836SJohn.Forte@Sun.COM 
446*7836SJohn.Forte@Sun.COM #else /* __STDC__ */
447*7836SJohn.Forte@Sun.COM 
448*7836SJohn.Forte@Sun.COM extern int	g_dev_start();
449*7836SJohn.Forte@Sun.COM extern int	g_dev_stop();
450*7836SJohn.Forte@Sun.COM extern int	g_force_lip();
451*7836SJohn.Forte@Sun.COM extern int	g_forcelip_all();
452*7836SJohn.Forte@Sun.COM extern void	g_free_multipath();
453*7836SJohn.Forte@Sun.COM extern void	g_free_wwn_list();
454*7836SJohn.Forte@Sun.COM extern int	g_get_inq_dtype();
455*7836SJohn.Forte@Sun.COM extern int	g_get_dev_list();
456*7836SJohn.Forte@Sun.COM extern int	g_wwn_in_dev_list();
457*7836SJohn.Forte@Sun.COM extern int	g_get_dev_map();
458*7836SJohn.Forte@Sun.COM extern int	g_get_lilp_map();
459*7836SJohn.Forte@Sun.COM extern char 	*g_get_dev_or_bus_phys_name();
460*7836SJohn.Forte@Sun.COM extern char 	*g_get_errString();
461*7836SJohn.Forte@Sun.COM extern int	g_get_inquiry();
462*7836SJohn.Forte@Sun.COM extern int	g_get_serial_number();
463*7836SJohn.Forte@Sun.COM extern int	g_get_limited_map();
464*7836SJohn.Forte@Sun.COM extern int	g_get_multipath();
465*7836SJohn.Forte@Sun.COM extern int	g_get_nexus_path();
466*7836SJohn.Forte@Sun.COM extern int	g_get_wwn_list();
467*7836SJohn.Forte@Sun.COM extern int	g_offline_drive();
468*7836SJohn.Forte@Sun.COM extern void	g_online_drive();
469*7836SJohn.Forte@Sun.COM extern char 	*g_get_physical_name();
470*7836SJohn.Forte@Sun.COM extern char 	*g_get_physical_name_from_link();
471*7836SJohn.Forte@Sun.COM extern int	g_get_wwn();
472*7836SJohn.Forte@Sun.COM extern int	g_i18n_catopen();
473*7836SJohn.Forte@Sun.COM extern int	g_rdls();
474*7836SJohn.Forte@Sun.COM extern uint_t	g_get_path_type();
475*7836SJohn.Forte@Sun.COM extern int	g_get_host_params();
476*7836SJohn.Forte@Sun.COM extern int	g_port_offline();
477*7836SJohn.Forte@Sun.COM extern int	g_port_online();
478*7836SJohn.Forte@Sun.COM extern int	g_get_port_path();
479*7836SJohn.Forte@Sun.COM extern void	g_free_portlist();
480*7836SJohn.Forte@Sun.COM extern int	g_loopback_mode();
481*7836SJohn.Forte@Sun.COM extern int	g_get_port_state();
482*7836SJohn.Forte@Sun.COM extern int	g_get_fca_port_topology();
483*7836SJohn.Forte@Sun.COM extern int	g_dev_login();
484*7836SJohn.Forte@Sun.COM extern int	g_dev_logout();
485*7836SJohn.Forte@Sun.COM extern int	g_get_pathlist();
486*7836SJohn.Forte@Sun.COM extern int	g_failover();
487*7836SJohn.Forte@Sun.COM 
488*7836SJohn.Forte@Sun.COM /* g_dev_map_init related routines. */
489*7836SJohn.Forte@Sun.COM extern gfc_dev_t	g_dev_map_init();
490*7836SJohn.Forte@Sun.COM extern void		g_dev_map_fini();
491*7836SJohn.Forte@Sun.COM extern int		g_get_map_topology();
492*7836SJohn.Forte@Sun.COM extern gfc_dev_t	g_get_first_dev();
493*7836SJohn.Forte@Sun.COM extern gfc_dev_t	g_get_next_dev();
494*7836SJohn.Forte@Sun.COM extern int	g_dev_prop_lookup_bytes();
495*7836SJohn.Forte@Sun.COM extern int g_dev_prop_lookup_ints();
496*7836SJohn.Forte@Sun.COM extern int g_dev_prop_lookup_strings();
497*7836SJohn.Forte@Sun.COM extern gfc_prop_t g_get_first_dev_prop();
498*7836SJohn.Forte@Sun.COM extern gfc_prop_t g_get_next_dev_prop();
499*7836SJohn.Forte@Sun.COM extern char *g_get_dev_prop_name();
500*7836SJohn.Forte@Sun.COM extern int g_get_dev_prop_type();
501*7836SJohn.Forte@Sun.COM extern int g_get_dev_prop_bytes();
502*7836SJohn.Forte@Sun.COM extern int g_get_dev_prop_ints();
503*7836SJohn.Forte@Sun.COM extern int g_get_dev_prop_strings();
504*7836SJohn.Forte@Sun.COM extern int g_stms_path_disable();
505*7836SJohn.Forte@Sun.COM extern int g_stms_path_enable();
506*7836SJohn.Forte@Sun.COM extern int g_stms_path_disable_all();
507*7836SJohn.Forte@Sun.COM extern int g_stms_path_enable_all();
508*7836SJohn.Forte@Sun.COM extern int g_stms_get_path_state();
509*7836SJohn.Forte@Sun.COM 
510*7836SJohn.Forte@Sun.COM #endif /* __STDC__ */
511*7836SJohn.Forte@Sun.COM 
512*7836SJohn.Forte@Sun.COM #ifdef	__cplusplus
513*7836SJohn.Forte@Sun.COM }
514*7836SJohn.Forte@Sun.COM #endif
515*7836SJohn.Forte@Sun.COM 
516*7836SJohn.Forte@Sun.COM #endif /* _GFC_H */
517