1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_IB_IBNEX_IBNEX_DEVCTL_H
28 #define	_SYS_IB_IBNEX_IBNEX_DEVCTL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * This file contains info for devctls issued by IB cfgadm plugin.
38  * The only devctl of interest is DEVCTL_AP_CONTROL which uses
39  * these defines and data structures.
40  */
41 
42 #define	IBNEX_HCAGUID_STRSZ	17
43 
44 /*
45  * types of attachment point Identifiers (APID)s supported
46  */
47 #define	IBNEX_BASE_APID		0x01	/* Base static attachment point */
48 #define	IBNEX_HCA_APID		0x02	/* HCA static attachment point */
49 #define	IBNEX_DYN_APID		0x04	/* Dynamic IOC/DLPI attachment point */
50 #define	IBNEX_UNKNOWN_APID	0x08	/* Unknown attachment point */
51 
52 
53 /* defines for dynamic APID handling */
54 #define	DYN_SEP		"::"
55 #define	GET_DYN(a)	(((a) != NULL) ? strstr((a), DYN_SEP) : (void *)0)
56 
57 #define	IBNEX_FABRIC		"fabric"
58 #define	IBNEX_VPPA_STR		"vppa"
59 #define	IBNEX_PORT_STR		"port"
60 #define	IBNEX_HCASVC_STR	"hca-svc"
61 
62 /* Enums while reading ib.conf file */
63 typedef enum ib_service_type_e {
64 	IB_NAME,		/* name = */
65 	IB_CLASS,		/* class = */
66 	IB_PORT_SERVICE,	/* port-svc-list = */
67 	IB_VPPA_SERVICE,	/* vppa-svc-list = */
68 	IB_HCASVC_SERVICE,	/* hca-svc-list = */
69 	IB_NONE
70 } ib_service_type_t;
71 
72 /*
73  * defines for nvlist types: (for PORT devices and IOCs)
74  * The first 6 are common to both IOC and PORT devices.
75  * The last 9 are used only for IOC devices.
76  */
77 #define	IBNEX_NODE_INFO_NVL		"node_info"
78 #define	IBNEX_NODE_APID_NVL		"node_apid"
79 #define	IBNEX_NODE_TYPE_NVL		"node_type"
80 #define	IBNEX_NODE_RSTATE_NVL		"node_rstate"
81 #define	IBNEX_NODE_OSTATE_NVL		"node_ostate"
82 #define	IBNEX_NODE_COND_NVL		"node_condition"
83 
84 /*
85  * This flag is passed from cfgadm to ib(7d) to convey that it
86  * need not attempt to probe the fabric.
87  *
88  * The value of these flags should be same as flags in enum
89  * ibdm_ibnex_get_ioclist_mtd_t.
90  */
91 #define	IBNEX_DONOT_PROBE_FLAG	1
92 #define	IBNEX_NORMAL_PROBE	0	/* flag used by ib(7d) only */
93 
94 /*
95  * The following are sub-commands to DEVCTL_AP_CONTROL.
96  * NOTE: IBNEX_NUM_DEVICE_NODES and IBNEX_NUM_HCA_NODES need to be
97  * separate. The former is used to figure out the dynamic ap_ids for
98  * the IB fabric. The latter is used for a HCA count on a given host only.
99  */
100 #define	IBNEX_NUM_DEVICE_NODES	0x00010	/* how many device nodes exist? */
101 #define	IBNEX_NUM_HCA_NODES	0x00020	/* how many HCAs exist in the host? */
102 #define	IBNEX_SNAPSHOT_SIZE	0x00040	/* What is the "snapshot" size? */
103 #define	IBNEX_GET_SNAPSHOT	0x00080	/* Get the actual dynamic "snapshot" */
104 #define	IBNEX_DEVICE_PATH_SZ	0x00100	/* Given APID's device path size */
105 #define	IBNEX_GET_DEVICE_PATH	0x00200	/* Get device path for a Dynamic APID */
106 #define	IBNEX_HCA_LIST_SZ	0x00400	/* -x list_clients size for HCA APID */
107 #define	IBNEX_HCA_LIST_INFO	0x00800	/* -x list_clients info for HCA APID */
108 #define	IBNEX_UNCFG_CLNTS_SZ	0x01000	/* -x unconfig_clients option size */
109 #define	IBNEX_UNCFG_CLNTS_INFO	0x02000	/* -x unconfig_clients option data */
110 #define	IBNEX_UPDATE_PKEY_TBLS	0x04000	/* -x update_pkey_tbls */
111 #define	IBNEX_CONF_ENTRY_ADD	0x08000	/* -x conf_file add_service */
112 #define	IBNEX_CONF_ENTRY_DEL	0x10000	/* -x conf_file delete_service */
113 #define	IBNEX_HCA_VERBOSE_SZ	0x20000	/* -alv hca_apid devctl size */
114 #define	IBNEX_HCA_VERBOSE_INFO	0x40000	/* -alv hca_apid devctl data */
115 #define	IBNEX_UPDATE_IOC_CONF	0x80000	/* -x update_ioc_conf */
116 
117 /*
118  * Data structure passed back and forth user/kernel w/ DEVCTL_AP_CONTROL
119  * devctl. Note that these are separate structures as some fields are pointers.
120  */
121 typedef struct ibnex_ioctl_data {
122 	uint_t		cmd;		/* one of the above commands */
123 	caddr_t		buf;		/* data buffer */
124 	uint_t		bufsiz;		/* data buffer size */
125 	caddr_t		ap_id;		/* Search based on this AP_ID name */
126 	uint_t		ap_id_len;	/* AP_ID name len */
127 	uint_t		misc_arg;	/* reserved */
128 } ibnex_ioctl_data_t;
129 
130 
131 /* For 32-bit app/64-bit kernel */
132 typedef struct ibnex_ioctl_data_32 {
133 	uint32_t	cmd;		/* one of the above commands */
134 	caddr32_t	buf;		/* data buffer */
135 	uint32_t	bufsiz;		/* data buffer size */
136 	caddr32_t	ap_id;		/* Search based on this AP_ID name */
137 	uint32_t	ap_id_len;	/* AP_ID name len */
138 	uint32_t	misc_arg;	/* reserved */
139 } ibnex_ioctl_data_32_t;
140 
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif	/* _SYS_IB_IBNEX_IBNEX_DEVCTL_H */
147