1*fcf3ce44SJohn Forte /*
2*fcf3ce44SJohn Forte  * CDDL HEADER START
3*fcf3ce44SJohn Forte  *
4*fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5*fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6*fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7*fcf3ce44SJohn Forte  *
8*fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10*fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11*fcf3ce44SJohn Forte  * and limitations under the License.
12*fcf3ce44SJohn Forte  *
13*fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14*fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16*fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17*fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18*fcf3ce44SJohn Forte  *
19*fcf3ce44SJohn Forte  * CDDL HEADER END
20*fcf3ce44SJohn Forte  */
21*fcf3ce44SJohn Forte /*
22*fcf3ce44SJohn Forte  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*fcf3ce44SJohn Forte  * Use is subject to license terms.
24*fcf3ce44SJohn Forte  */
25*fcf3ce44SJohn Forte 
26*fcf3ce44SJohn Forte #ifndef	_FCIO_H
27*fcf3ce44SJohn Forte #define	_FCIO_H
28*fcf3ce44SJohn Forte 
29*fcf3ce44SJohn Forte 
30*fcf3ce44SJohn Forte #include <sys/note.h>
31*fcf3ce44SJohn Forte #include <sys/fibre-channel/fc_types.h>
32*fcf3ce44SJohn Forte #include <sys/fibre-channel/fc_appif.h>
33*fcf3ce44SJohn Forte 
34*fcf3ce44SJohn Forte #ifdef	__cplusplus
35*fcf3ce44SJohn Forte extern "C" {
36*fcf3ce44SJohn Forte #endif
37*fcf3ce44SJohn Forte 
38*fcf3ce44SJohn Forte /*
39*fcf3ce44SJohn Forte  * ioctl definitions
40*fcf3ce44SJohn Forte  */
41*fcf3ce44SJohn Forte #define	FCTIO				('F'<< 8)
42*fcf3ce44SJohn Forte 
43*fcf3ce44SJohn Forte /*
44*fcf3ce44SJohn Forte  * New ioctl definitions
45*fcf3ce44SJohn Forte  */
46*fcf3ce44SJohn Forte #define	FCIO_CMD			(FCTIO | 1998)
47*fcf3ce44SJohn Forte #define	FCIO_SUB_CMD			('Z' << 8)
48*fcf3ce44SJohn Forte #define	FCIO_GET_NUM_DEVS		(FCIO_SUB_CMD + 0x01)
49*fcf3ce44SJohn Forte #define	FCIO_GET_DEV_LIST		(FCIO_SUB_CMD + 0x02)
50*fcf3ce44SJohn Forte #define	FCIO_GET_SYM_PNAME		(FCIO_SUB_CMD + 0x03)
51*fcf3ce44SJohn Forte #define	FCIO_GET_SYM_NNAME		(FCIO_SUB_CMD + 0x04)
52*fcf3ce44SJohn Forte #define	FCIO_SET_SYM_PNAME		(FCIO_SUB_CMD + 0x05)
53*fcf3ce44SJohn Forte #define	FCIO_SET_SYM_NNAME		(FCIO_SUB_CMD + 0x06)
54*fcf3ce44SJohn Forte #define	FCIO_GET_LOGI_PARAMS		(FCIO_SUB_CMD + 0x07)
55*fcf3ce44SJohn Forte #define	FCIO_DEV_LOGIN			(FCIO_SUB_CMD + 0x08)
56*fcf3ce44SJohn Forte #define	FCIO_DEV_LOGOUT			(FCIO_SUB_CMD + 0x09)
57*fcf3ce44SJohn Forte #define	FCIO_GET_STATE			(FCIO_SUB_CMD + 0x0A)
58*fcf3ce44SJohn Forte #define	FCIO_DEV_REMOVE			(FCIO_SUB_CMD + 0x0B)
59*fcf3ce44SJohn Forte #define	FCIO_GET_FCODE_REV		(FCIO_SUB_CMD + 0x0C)
60*fcf3ce44SJohn Forte #define	FCIO_GET_FW_REV			(FCIO_SUB_CMD + 0x0D)
61*fcf3ce44SJohn Forte #define	FCIO_GET_DUMP_SIZE		(FCIO_SUB_CMD + 0x0E)
62*fcf3ce44SJohn Forte #define	FCIO_FORCE_DUMP			(FCIO_SUB_CMD + 0x0F)
63*fcf3ce44SJohn Forte #define	FCIO_GET_DUMP			(FCIO_SUB_CMD + 0x10)
64*fcf3ce44SJohn Forte #define	FCIO_GET_TOPOLOGY		(FCIO_SUB_CMD + 0x11)
65*fcf3ce44SJohn Forte #define	FCIO_RESET_LINK			(FCIO_SUB_CMD + 0x12)
66*fcf3ce44SJohn Forte #define	FCIO_RESET_HARD			(FCIO_SUB_CMD + 0x13)
67*fcf3ce44SJohn Forte #define	FCIO_RESET_HARD_CORE		(FCIO_SUB_CMD + 0x14)
68*fcf3ce44SJohn Forte #define	FCIO_DIAG			(FCIO_SUB_CMD + 0x15)
69*fcf3ce44SJohn Forte #define	FCIO_NS				(FCIO_SUB_CMD + 0x16)
70*fcf3ce44SJohn Forte #define	FCIO_DOWNLOAD_FW		(FCIO_SUB_CMD + 0x17)
71*fcf3ce44SJohn Forte #define	FCIO_GET_HOST_PARAMS		(FCIO_SUB_CMD + 0x18)
72*fcf3ce44SJohn Forte #define	FCIO_LINK_STATUS		(FCIO_SUB_CMD + 0x19)
73*fcf3ce44SJohn Forte #define	FCIO_DOWNLOAD_FCODE		(FCIO_SUB_CMD + 0x1A)
74*fcf3ce44SJohn Forte #define	FCIO_GET_NODE_ID		(FCIO_SUB_CMD + 0x1B)
75*fcf3ce44SJohn Forte #define	FCIO_SET_NODE_ID		(FCIO_SUB_CMD + 0x1C)
76*fcf3ce44SJohn Forte #define	FCIO_SEND_NODE_ID		(FCIO_SUB_CMD + 0x1D)
77*fcf3ce44SJohn Forte 
78*fcf3ce44SJohn Forte /*
79*fcf3ce44SJohn Forte  * IOCTLs to handle T11's FC-HBA library
80*fcf3ce44SJohn Forte  */
81*fcf3ce44SJohn Forte #define	FCIO_GET_ADAPTER_ATTRIBUTES	(FCIO_SUB_CMD + 0x1E)
82*fcf3ce44SJohn Forte #define	FCIO_GET_OTHER_ADAPTER_PORTS	(FCIO_SUB_CMD + 0x1F)
83*fcf3ce44SJohn Forte #define	FCIO_GET_ADAPTER_PORT_ATTRIBUTES    (FCIO_SUB_CMD + 0x20)
84*fcf3ce44SJohn Forte #define	FCIO_GET_DISCOVERED_PORT_ATTRIBUTES (FCIO_SUB_CMD + 0x21)
85*fcf3ce44SJohn Forte #define	FCIO_GET_PORT_ATTRIBUTES	(FCIO_SUB_CMD + 0x22)
86*fcf3ce44SJohn Forte #define	FCIO_GET_ADAPTER_PORT_STATS	(FCIO_SUB_CMD + 0x23)
87*fcf3ce44SJohn Forte #define	FCIO_GET_ADAPTER_PORT_NPIV_ATTRIBUTES   (FCIO_SUB_CMD + 0x24)
88*fcf3ce44SJohn Forte #define	FCIO_CREATE_NPIV_PORT		(FCIO_SUB_CMD + 0x25)
89*fcf3ce44SJohn Forte #define	FCIO_GET_NPIV_ATTRIBUTES	(FCIO_SUB_CMD + 0x26)
90*fcf3ce44SJohn Forte #define	FCIO_GET_DISCOVERED_NPIV_ATTRIBUTES	(FCIO_SUB_CMD + 0x27)
91*fcf3ce44SJohn Forte #define	FCIO_GET_NPIV_PORT_LIST		(FCIO_SUB_CMD + 0x28)
92*fcf3ce44SJohn Forte #define	FCIO_DELETE_NPIV_PORT		(FCIO_SUB_CMD + 0x29)
93*fcf3ce44SJohn Forte #define	FCIO_NPIV_GET_ADAPTER_ATTRIBUTES	(FCIO_SUB_CMD + 0x2a)
94*fcf3ce44SJohn Forte 
95*fcf3ce44SJohn Forte 
96*fcf3ce44SJohn Forte /*
97*fcf3ce44SJohn Forte  * Fixed diag_codes for FCIO_DIAG. These is supported by all FCAs.
98*fcf3ce44SJohn Forte  * No FCA should define ioctls in this range.
99*fcf3ce44SJohn Forte  */
100*fcf3ce44SJohn Forte #define	FCIO_DIAG_PORT_DISABLE		(FCIO_SUB_CMD + 0x80)
101*fcf3ce44SJohn Forte #define	FCIO_DIAG_PORT_ENABLE		(FCIO_SUB_CMD + 0x81)
102*fcf3ce44SJohn Forte 
103*fcf3ce44SJohn Forte /* cmd_flags for FCIO_LINK_STATUS ioctl */
104*fcf3ce44SJohn Forte #define	FCIO_CFLAGS_RLS_DEST_NPORT	0x0000
105*fcf3ce44SJohn Forte #define	FCIO_CFLAGS_RLS_DEST_FPORT	0x0001
106*fcf3ce44SJohn Forte 
107*fcf3ce44SJohn Forte /*
108*fcf3ce44SJohn Forte  * Note about fc_port_dev_t structure : The dev_did.priv_lilp_posit field will
109*fcf3ce44SJohn Forte  * return the lilp map position of the port for diagnostics to use.
110*fcf3ce44SJohn Forte  * It is important to note that dev_did.priv_lilp_posit field will only have
111*fcf3ce44SJohn Forte  * valid loop position for Private Loop devices ONLY and the value
112*fcf3ce44SJohn Forte  * contained in this field for other topologies will be undetermined.
113*fcf3ce44SJohn Forte  */
114*fcf3ce44SJohn Forte typedef struct fc_port_dev {
115*fcf3ce44SJohn Forte 	uchar_t		dev_dtype;		/* SCSI device type */
116*fcf3ce44SJohn Forte 	uint32_t	dev_type[8];		/* protocol specific */
117*fcf3ce44SJohn Forte 	uint32_t	dev_state;		/* port state */
118*fcf3ce44SJohn Forte 	fc_portid_t	dev_did;		/* Destination Identifier */
119*fcf3ce44SJohn Forte 	fc_hardaddr_t	dev_hard_addr;		/* Hard address */
120*fcf3ce44SJohn Forte 	la_wwn_t	dev_pwwn;		/* port WWN */
121*fcf3ce44SJohn Forte 	la_wwn_t	dev_nwwn;		/* node WWN */
122*fcf3ce44SJohn Forte } fc_port_dev_t;
123*fcf3ce44SJohn Forte 
124*fcf3ce44SJohn Forte #if defined(_SYSCALL32)
125*fcf3ce44SJohn Forte 
126*fcf3ce44SJohn Forte #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
127*fcf3ce44SJohn Forte #pragma pack(4)
128*fcf3ce44SJohn Forte #endif
129*fcf3ce44SJohn Forte 
130*fcf3ce44SJohn Forte typedef struct fc_port_dev32 {
131*fcf3ce44SJohn Forte 	uchar_t		dev_dtype;		/* SCSI device type */
132*fcf3ce44SJohn Forte 	uint32_t	dev_type[8];		/* protocol specific */
133*fcf3ce44SJohn Forte 	uint32_t	dev_state;		/* port state */
134*fcf3ce44SJohn Forte 	fc_portid_t	dev_did;		/* Destination Identifier */
135*fcf3ce44SJohn Forte 	fc_hardaddr_t	dev_hard_addr;		/* Hard address */
136*fcf3ce44SJohn Forte 	la_wwn_t	dev_pwwn;		/* port WWN */
137*fcf3ce44SJohn Forte 	la_wwn_t	dev_nwwn;		/* node WWN */
138*fcf3ce44SJohn Forte } fc_port_dev32_t;
139*fcf3ce44SJohn Forte 
140*fcf3ce44SJohn Forte #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
141*fcf3ce44SJohn Forte #pragma pack()
142*fcf3ce44SJohn Forte #endif
143*fcf3ce44SJohn Forte 
144*fcf3ce44SJohn Forte #endif	/* _SYSCALL32 */
145*fcf3ce44SJohn Forte 
146*fcf3ce44SJohn Forte typedef struct fc_port_dev fc_ns_map_entry_t;
147*fcf3ce44SJohn Forte 
148*fcf3ce44SJohn Forte /*
149*fcf3ce44SJohn Forte  * fcio_xfer definitions
150*fcf3ce44SJohn Forte  */
151*fcf3ce44SJohn Forte #define	FCIO_XFER_NONE		0x00
152*fcf3ce44SJohn Forte #define	FCIO_XFER_READ		0x01
153*fcf3ce44SJohn Forte #define	FCIO_XFER_WRITE		0x02
154*fcf3ce44SJohn Forte #define	FCIO_XFER_RW		(FCIO_XFER_READ | FCIO_XFER_WRITE)
155*fcf3ce44SJohn Forte 
156*fcf3ce44SJohn Forte typedef struct fcio {
157*fcf3ce44SJohn Forte 	uint16_t	fcio_xfer;	/* direction */
158*fcf3ce44SJohn Forte 	uint16_t	fcio_cmd;	/* sub command */
159*fcf3ce44SJohn Forte 	uint16_t	fcio_flags;	/* flags */
160*fcf3ce44SJohn Forte 	uint16_t	fcio_cmd_flags;	/* command specific flags */
161*fcf3ce44SJohn Forte 	size_t		fcio_ilen;	/* Input buffer length */
162*fcf3ce44SJohn Forte 	caddr_t		fcio_ibuf;	/* Input buffer */
163*fcf3ce44SJohn Forte 	size_t		fcio_olen;	/* Output buffer length */
164*fcf3ce44SJohn Forte 	caddr_t		fcio_obuf;	/* Output buffer */
165*fcf3ce44SJohn Forte 	size_t		fcio_alen;	/* Auxillary buffer length */
166*fcf3ce44SJohn Forte 	caddr_t		fcio_abuf;	/* Auxillary buffer */
167*fcf3ce44SJohn Forte 	int		fcio_errno;	/* FC internal error code */
168*fcf3ce44SJohn Forte } fcio_t;
169*fcf3ce44SJohn Forte 
170*fcf3ce44SJohn Forte /*
171*fcf3ce44SJohn Forte  * T11 FC-HBA exchange structures
172*fcf3ce44SJohn Forte  */
173*fcf3ce44SJohn Forte #define	FC_HBA_LIST_VERSION		    1
174*fcf3ce44SJohn Forte typedef struct fc_hba_list {
175*fcf3ce44SJohn Forte 	uint32_t		version;    /* Set to FC_HBA_LIST_VERSION */
176*fcf3ce44SJohn Forte 	uint32_t		numAdapters;
177*fcf3ce44SJohn Forte 	uint64_t		reserved;
178*fcf3ce44SJohn Forte 	char			hbaPaths[1][MAXPATHLEN]; /* numAdapters long */
179*fcf3ce44SJohn Forte } fc_hba_list_t;
180*fcf3ce44SJohn Forte 
181*fcf3ce44SJohn Forte #define	FC_HBA_NPIV_PORT_LIST_VERSION	1
182*fcf3ce44SJohn Forte typedef struct fc_hba_npiv_port_list {
183*fcf3ce44SJohn Forte 	uint32_t		version;
184*fcf3ce44SJohn Forte 	uint32_t		numAdapters;
185*fcf3ce44SJohn Forte 	uint64_t		reserved;
186*fcf3ce44SJohn Forte 	char			hbaPaths[1][MAXPATHLEN];
187*fcf3ce44SJohn Forte } fc_hba_npiv_port_list_t;
188*fcf3ce44SJohn Forte 
189*fcf3ce44SJohn Forte #define	FC_HBA_NPIV_ATTRIBUTES_VERSION	1
190*fcf3ce44SJohn Forte typedef struct fc_hba_npiv_attributes {
191*fcf3ce44SJohn Forte 	uint32_t		version;
192*fcf3ce44SJohn Forte 	la_wwn_t		NodeWWN;
193*fcf3ce44SJohn Forte 	la_wwn_t		PortWWN;
194*fcf3ce44SJohn Forte 	fc_hba_state_change_t	lastChange;
195*fcf3ce44SJohn Forte } fc_hba_npiv_attributes_t;
196*fcf3ce44SJohn Forte 
197*fcf3ce44SJohn Forte #define	FC_HBA_PORT_NPIV_ATTRIBUTES_VERSION	1
198*fcf3ce44SJohn Forte typedef struct fc_hba_port_npiv_attributes {
199*fcf3ce44SJohn Forte 	uint32_t		version;
200*fcf3ce44SJohn Forte 	int			npivflag;
201*fcf3ce44SJohn Forte 	fc_hba_state_change_t	lastChange;
202*fcf3ce44SJohn Forte 	la_wwn_t		NodeWWN;
203*fcf3ce44SJohn Forte 	la_wwn_t		PortWWN;
204*fcf3ce44SJohn Forte 	uint32_t		MaxNumberOfNPIVPorts;
205*fcf3ce44SJohn Forte 	uint32_t		NumberOfNPIVPorts;
206*fcf3ce44SJohn Forte } fc_hba_port_npiv_attributes_t;
207*fcf3ce44SJohn Forte 
208*fcf3ce44SJohn Forte #define	FC_HBA_SINGLE_VERSION		    1
209*fcf3ce44SJohn Forte typedef struct fc_hba_single {
210*fcf3ce44SJohn Forte 	uint32_t		version;    /* Set to FC_HBA_SINGLE_VERSION */
211*fcf3ce44SJohn Forte 	uint64_t		reserved;
212*fcf3ce44SJohn Forte 	char			hbaPath[MAXPATHLEN];
213*fcf3ce44SJohn Forte } fc_hba_single_t;
214*fcf3ce44SJohn Forte 
215*fcf3ce44SJohn Forte #define	FC_HBA_ADAPTER_ATTRIBUTES_VERSION   1
216*fcf3ce44SJohn Forte typedef struct fc_hba_adapter_attributes {
217*fcf3ce44SJohn Forte 	uint32_t    version;	/* Set to FC_HBA_ADAPTER_ATTRIBUTES_VERSION */
218*fcf3ce44SJohn Forte 	char	    Manufacturer[64];
219*fcf3ce44SJohn Forte 	char	    SerialNumber[64];
220*fcf3ce44SJohn Forte 	char	    Model[256];
221*fcf3ce44SJohn Forte 	char	    ModelDescription[256];
222*fcf3ce44SJohn Forte 	la_wwn_t    NodeWWN;
223*fcf3ce44SJohn Forte 	char	    NodeSymbolicName[256];
224*fcf3ce44SJohn Forte 	char	    HardwareVersion[256];
225*fcf3ce44SJohn Forte 	char	    DriverVersion[256];
226*fcf3ce44SJohn Forte 	char	    OptionROMVersion[256];
227*fcf3ce44SJohn Forte 	char	    FirmwareVersion[256];
228*fcf3ce44SJohn Forte 	uint32_t    VendorSpecificID;
229*fcf3ce44SJohn Forte 	uint32_t    NumberOfPorts;
230*fcf3ce44SJohn Forte 	char	    DriverName[256];
231*fcf3ce44SJohn Forte 	uint64_t    reserved;
232*fcf3ce44SJohn Forte } fc_hba_adapter_attributes_t;
233*fcf3ce44SJohn Forte 
234*fcf3ce44SJohn Forte #if defined(_SYSCALL32)
235*fcf3ce44SJohn Forte 
236*fcf3ce44SJohn Forte #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
237*fcf3ce44SJohn Forte #pragma pack(4)
238*fcf3ce44SJohn Forte #endif
239*fcf3ce44SJohn Forte 
240*fcf3ce44SJohn Forte typedef struct fc_hba_adapter_attributes32 {
241*fcf3ce44SJohn Forte 	uint32_t    version;	/* Set to FC_HBA_ADAPTER_ATTRIBUTES_VERSION */
242*fcf3ce44SJohn Forte 	char	    Manufacturer[64];
243*fcf3ce44SJohn Forte 	char	    SerialNumber[64];
244*fcf3ce44SJohn Forte 	char	    Model[256];
245*fcf3ce44SJohn Forte 	char	    ModelDescription[256];
246*fcf3ce44SJohn Forte 	la_wwn_t    NodeWWN;
247*fcf3ce44SJohn Forte 	char	    NodeSymbolicName[256];
248*fcf3ce44SJohn Forte 	char	    HardwareVersion[256];
249*fcf3ce44SJohn Forte 	char	    DriverVersion[256];
250*fcf3ce44SJohn Forte 	char	    OptionROMVersion[256];
251*fcf3ce44SJohn Forte 	char	    FirmwareVersion[256];
252*fcf3ce44SJohn Forte 	uint32_t    VendorSpecificID;
253*fcf3ce44SJohn Forte 	uint32_t    NumberOfPorts;
254*fcf3ce44SJohn Forte 	char	    DriverName[256];
255*fcf3ce44SJohn Forte 	uint64_t    reserved;
256*fcf3ce44SJohn Forte } fc_hba_adapter_attributes32_t;
257*fcf3ce44SJohn Forte 
258*fcf3ce44SJohn Forte #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
259*fcf3ce44SJohn Forte #pragma pack()
260*fcf3ce44SJohn Forte #endif
261*fcf3ce44SJohn Forte 
262*fcf3ce44SJohn Forte #endif	/* defined(_SYSCALL32) */
263*fcf3ce44SJohn Forte 
264*fcf3ce44SJohn Forte #define	FC_HBA_PORT_ATTRIBUTES_VERSION	    1
265*fcf3ce44SJohn Forte typedef struct fc_hba_port_attributes {
266*fcf3ce44SJohn Forte 	uint32_t		version; /* FC_HBA_PORT_ATTRIBUTES_VERSION */
267*fcf3ce44SJohn Forte 	fc_hba_state_change_t	lastChange;
268*fcf3ce44SJohn Forte 	minor_t			fp_minor;
269*fcf3ce44SJohn Forte 	la_wwn_t		NodeWWN;
270*fcf3ce44SJohn Forte 	la_wwn_t		PortWWN;
271*fcf3ce44SJohn Forte 	uint32_t		PortFcId;
272*fcf3ce44SJohn Forte 	uint32_t		PortType;
273*fcf3ce44SJohn Forte 	uint32_t		PortState;
274*fcf3ce44SJohn Forte 	uint32_t		PortSupportedClassofService;
275*fcf3ce44SJohn Forte 	uint8_t			PortSupportedFc4Types[32];
276*fcf3ce44SJohn Forte 	uint8_t			PortActiveFc4Types[32];
277*fcf3ce44SJohn Forte 	char			PortSymbolicName[256];
278*fcf3ce44SJohn Forte 	uint32_t		PortSupportedSpeed;
279*fcf3ce44SJohn Forte 	uint32_t		PortSpeed;
280*fcf3ce44SJohn Forte 	uint32_t		PortMaxFrameSize;
281*fcf3ce44SJohn Forte 	la_wwn_t		FabricName;
282*fcf3ce44SJohn Forte 	uint32_t		NumberofDiscoveredPorts;
283*fcf3ce44SJohn Forte 	uint64_t		reserved;
284*fcf3ce44SJohn Forte } fc_hba_port_attributes_t;
285*fcf3ce44SJohn Forte 
286*fcf3ce44SJohn Forte #if defined(_SYSCALL32)
287*fcf3ce44SJohn Forte 
288*fcf3ce44SJohn Forte #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
289*fcf3ce44SJohn Forte #pragma pack(4)
290*fcf3ce44SJohn Forte #endif
291*fcf3ce44SJohn Forte 
292*fcf3ce44SJohn Forte typedef struct fc_hba_port_attributes32 {
293*fcf3ce44SJohn Forte 	uint32_t		version; /* FC_HBA_PORT_ATTRIBUTES_VERSION */
294*fcf3ce44SJohn Forte 	fc_hba_state_change_t	lastChange;
295*fcf3ce44SJohn Forte 	minor_t			fp_minor;
296*fcf3ce44SJohn Forte 	la_wwn_t		NodeWWN;
297*fcf3ce44SJohn Forte 	la_wwn_t		PortWWN;
298*fcf3ce44SJohn Forte 	uint32_t		PortFcId;
299*fcf3ce44SJohn Forte 	uint32_t		PortType;
300*fcf3ce44SJohn Forte 	uint32_t		PortState;
301*fcf3ce44SJohn Forte 	uint32_t		PortSupportedClassofService;
302*fcf3ce44SJohn Forte 	uint8_t			PortSupportedFc4Types[32];
303*fcf3ce44SJohn Forte 	uint8_t			PortActiveFc4Types[32];
304*fcf3ce44SJohn Forte 	char			PortSymbolicName[256];
305*fcf3ce44SJohn Forte 	uint32_t		PortSupportedSpeed;
306*fcf3ce44SJohn Forte 	uint32_t		PortSpeed;
307*fcf3ce44SJohn Forte 	uint32_t		PortMaxFrameSize;
308*fcf3ce44SJohn Forte 	la_wwn_t		FabricName;
309*fcf3ce44SJohn Forte 	uint32_t		NumberofDiscoveredPorts;
310*fcf3ce44SJohn Forte 	uint64_t		reserved;
311*fcf3ce44SJohn Forte } fc_hba_port_attributes32_t;
312*fcf3ce44SJohn Forte 
313*fcf3ce44SJohn Forte #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
314*fcf3ce44SJohn Forte #pragma pack()
315*fcf3ce44SJohn Forte #endif
316*fcf3ce44SJohn Forte 
317*fcf3ce44SJohn Forte #endif	/* defined(_SYSCALL32) */
318*fcf3ce44SJohn Forte 
319*fcf3ce44SJohn Forte #define	FC_HBA_ADAPTER_PORT_STATS_VERSION   1
320*fcf3ce44SJohn Forte typedef struct fc_hba_adapter_port_stats {
321*fcf3ce44SJohn Forte 	uint32_t	    version; /* FC_HBA_ADAPTER_PORT_STATS_VERSION */
322*fcf3ce44SJohn Forte 	uint64_t	    SecondsSinceLastReset;
323*fcf3ce44SJohn Forte 	uint64_t	    TxFrames;
324*fcf3ce44SJohn Forte 	uint64_t	    TxWords;
325*fcf3ce44SJohn Forte 	uint64_t	    RxFrames;
326*fcf3ce44SJohn Forte 	uint64_t	    RxWords;
327*fcf3ce44SJohn Forte 	uint64_t	    LIPCount;
328*fcf3ce44SJohn Forte 	uint64_t	    NOSCount;
329*fcf3ce44SJohn Forte 	uint64_t	    ErrorFrames;
330*fcf3ce44SJohn Forte 	uint64_t	    DumpedFrames;
331*fcf3ce44SJohn Forte 	uint64_t	    LinkFailureCount;
332*fcf3ce44SJohn Forte 	uint64_t	    LossOfSyncCount;
333*fcf3ce44SJohn Forte 	uint64_t	    LossOfSignalCount;
334*fcf3ce44SJohn Forte 	uint64_t	    PrimitiveSeqProtocolErrCount;
335*fcf3ce44SJohn Forte 	uint64_t	    InvalidTxWordCount;
336*fcf3ce44SJohn Forte 	uint64_t	    InvalidCRCCount;
337*fcf3ce44SJohn Forte 	uint64_t	    reserved;
338*fcf3ce44SJohn Forte } fc_hba_adapter_port_stats_t;
339*fcf3ce44SJohn Forte 
340*fcf3ce44SJohn Forte 
341*fcf3ce44SJohn Forte /*
342*fcf3ce44SJohn Forte  * Constant values derived from T11 FC-HBA
343*fcf3ce44SJohn Forte  */
344*fcf3ce44SJohn Forte #define	FC_HBA_PORTTYPE_UNKNOWN		1   /* Unknown */
345*fcf3ce44SJohn Forte #define	FC_HBA_PORTTYPE_OTHER		2   /* Other */
346*fcf3ce44SJohn Forte #define	FC_HBA_PORTTYPE_NOTPRESENT	3   /* Not present */
347*fcf3ce44SJohn Forte #define	FC_HBA_PORTTYPE_NPORT		5   /* Fabric  */
348*fcf3ce44SJohn Forte #define	FC_HBA_PORTTYPE_NLPORT		6   /* Public Loop */
349*fcf3ce44SJohn Forte #define	FC_HBA_PORTTYPE_FLPORT		7
350*fcf3ce44SJohn Forte #define	FC_HBA_PORTTYPE_FPORT		8   /* Fabric Port */
351*fcf3ce44SJohn Forte #define	FC_HBA_PORTTYPE_EPORT		9   /* Fabric expansion port */
352*fcf3ce44SJohn Forte #define	FC_HBA_PORTTYPE_GPORT		10  /* Generic Fabric Port */
353*fcf3ce44SJohn Forte #define	FC_HBA_PORTTYPE_LPORT		20  /* Private Loop */
354*fcf3ce44SJohn Forte #define	FC_HBA_PORTTYPE_PTP		21  /* Point to Point */
355*fcf3ce44SJohn Forte 
356*fcf3ce44SJohn Forte #define	FC_HBA_PORTSTATE_UNKNOWN	1   /* Unknown */
357*fcf3ce44SJohn Forte #define	FC_HBA_PORTSTATE_ONLINE		2   /* Operational */
358*fcf3ce44SJohn Forte #define	FC_HBA_PORTSTATE_OFFLINE	3   /* User Offline */
359*fcf3ce44SJohn Forte #define	FC_HBA_PORTSTATE_BYPASSED	4   /* Bypassed */
360*fcf3ce44SJohn Forte #define	FC_HBA_PORTSTATE_DIAGNOSTICS	5   /* In diagnostics mode */
361*fcf3ce44SJohn Forte #define	FC_HBA_PORTSTATE_LINKDOWN	6   /* Link Down */
362*fcf3ce44SJohn Forte #define	FC_HBA_PORTSTATE_ERROR		7   /* Port Error */
363*fcf3ce44SJohn Forte #define	FC_HBA_PORTSTATE_LOOPBACK	8   /* Loopback */
364*fcf3ce44SJohn Forte 
365*fcf3ce44SJohn Forte 
366*fcf3ce44SJohn Forte 
367*fcf3ce44SJohn Forte #if defined(_SYSCALL32)
368*fcf3ce44SJohn Forte /*
369*fcf3ce44SJohn Forte  * 32 bit varient of fcio_t; to be used
370*fcf3ce44SJohn Forte  * only in the driver and NOT applications
371*fcf3ce44SJohn Forte  */
372*fcf3ce44SJohn Forte struct fcio32 {
373*fcf3ce44SJohn Forte 	uint16_t	fcio_xfer;	/* direction */
374*fcf3ce44SJohn Forte 	uint16_t	fcio_cmd;	/* sub command */
375*fcf3ce44SJohn Forte 	uint16_t	fcio_flags;	/* flags */
376*fcf3ce44SJohn Forte 	uint16_t	fcio_cmd_flags;	/* command specific flags */
377*fcf3ce44SJohn Forte 	size32_t	fcio_ilen;	/* Input buffer length */
378*fcf3ce44SJohn Forte 	caddr32_t	fcio_ibuf;	/* Input buffer */
379*fcf3ce44SJohn Forte 	size32_t	fcio_olen;	/* Output buffer length */
380*fcf3ce44SJohn Forte 	caddr32_t	fcio_obuf;	/* Output buffer */
381*fcf3ce44SJohn Forte 	size32_t	fcio_alen;	/* Auxillary buffer length */
382*fcf3ce44SJohn Forte 	caddr32_t	fcio_abuf;	/* Auxillary buffer */
383*fcf3ce44SJohn Forte 	int		fcio_errno;	/* FC internal error code */
384*fcf3ce44SJohn Forte };
385*fcf3ce44SJohn Forte 
386*fcf3ce44SJohn Forte #if	!defined(__lint)
387*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", fcio32))
388*fcf3ce44SJohn Forte #endif /* __lint */
389*fcf3ce44SJohn Forte 
390*fcf3ce44SJohn Forte #endif /* _SYSCALL32 */
391*fcf3ce44SJohn Forte 
392*fcf3ce44SJohn Forte #if	!defined(__lint)
393*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", fcio fc_port_dev))
394*fcf3ce44SJohn Forte #endif /* __lint */
395*fcf3ce44SJohn Forte 
396*fcf3ce44SJohn Forte #ifdef	__cplusplus
397*fcf3ce44SJohn Forte }
398*fcf3ce44SJohn Forte #endif
399*fcf3ce44SJohn Forte 
400*fcf3ce44SJohn Forte #endif	/* _FCIO_H */
401