xref: /illumos-gate/usr/src/uts/common/sys/ib/mgt/ib_dm_attr.h (revision 2d6eb4a5e0a47d30189497241345dc5466bb68ab)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_IB_MGT_IB_DM_ATTR_H
28 #define	_SYS_IB_MGT_IB_DM_ATTR_H
29 
30 /*
31  * ib_dm_attr.h
32  *
33  * This file contains definitions for Device Management data structures
34  * defined in the IB specification (Section 16.3).
35  */
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /* Device management Methods */
42 #define	IB_DM_DEVMGT_METHOD_GET			0x01
43 #define	IB_DM_DEVMGT_METHOD_SET			0x02
44 #define	IB_DM_DEVMGT_METHOD_GET_RESP		0x81
45 #define	IB_DM_DEVMGT_METHOD_TRAP		0x05
46 #define	IB_DM_DEVMGT_METHOD_TRAP_REPRESS	0x07
47 
48 /* Device Class version */
49 #define	IB_DM_CLASS_VERSION_1			0x1
50 
51 /* Device Management Status field */
52 #define	IB_DM_DEVMGT_MAD_STAT_NORESP		0x0100
53 #define	IB_DM_DEVMGT_MAD_STAT_NOSVC_ENTRIES	0x0200
54 #define	IB_DM_DEVMGT_MAD_STAT_GEN_FAILURE	0x8000
55 
56 /* Device Management attributes */
57 #define	IB_DM_ATTR_CLASSPORTINFO		0x1
58 #define	IB_DM_ATTR_NOTICE			0x2
59 #define	IB_DM_ATTR_IO_UNITINFO			0x10
60 #define	IB_DM_ATTR_IOC_CTRL_PROFILE		0x11
61 #define	IB_DM_ATTR_SERVICE_ENTRIES		0x12
62 #define	IB_DM_ATTR_DIAG_TIMEOUT			0x20
63 #define	IB_DM_ATTR_PREPARE_TO_TEST		0x21
64 #define	IB_DM_ATTR_TEST_DEV_ONCE		0x22
65 #define	IB_DM_ATTR_TEST_DEV_LOOP		0x23
66 #define	IB_DM_ATTR_DIAG_CODE			0x24
67 
68 /* IOUnitInfo DM attribute (Section 16.3.3.3 in vol1a) definition */
69 #define	IB_DM_MAX_IOCS_IN_IOU			256
70 
71 typedef struct ib_dm_io_unitinfo_s {
72 	/* Incremented, with rollover, by any change in the controller list */
73 	uint16_t	iou_changeid;
74 	uint8_t		iou_num_ctrl_slots;	/* # controllers in the IOU */
75 
76 	/*
77 	 * Bit 0 : Option ROM present
78 	 * Bit 1 : Diag Device ID
79 	 */
80 	uint8_t		iou_flag;
81 
82 	/*
83 	 *  List of nibbles representing a slot in the IOU
84 	 *  Contains iou_num_ctrl_slots valid entries
85 	 *  0x0 = IOC not installed
86 	 *  0x1 = IOC present
87 	 *  0xf = Slot does not exist
88 	 *  Note: Bits 7-4 of the first byte represent slot 1 and
89 	 *	bits 3-0 of first byte represents slot 2, bits 7-4 of
90 	 *	second byte represents slot 3, and so on
91 	 */
92 	uint8_t	iou_ctrl_list[128];
93 } ib_dm_io_unitinfo_t;
94 
95 /* values for iou_flag */
96 #define	IB_DM_IOU_OPTIONROM_ABSENT	0x0
97 #define	IB_DM_IOU_OPTIONROM_PRESENT	0x1
98 
99 /* masks for iou_flag */
100 #define	IB_DM_IOU_OPTIONROM_MASK	0x1
101 #define	IB_DM_IOU_DEVICEID_MASK		0x2
102 
103 #define	IB_DM_IOC_ID_STRING_LEN		64	/* see ioc_id_string later */
104 #define	IB_DM_VENDORID_MASK		0xFFFFFF00
105 #define	IB_DM_VENDORID_SHIFT		8
106 
107 typedef struct ib_dm_ioc_ctrl_profile_s {
108 	ib_guid_t	ioc_guid;		/* GUID of the IOC */
109 	uint32_t	ioc_vendorid;		/* Vendor ID of the IOC */
110 	uint32_t	ioc_deviceid;		/* Device ID/Product ID */
111 	uint16_t	ioc_device_ver;		/* Device Version */
112 	uint16_t	ioc_rsvd1;		/* RESERVED */
113 	uint32_t	ioc_subsys_vendorid;	/* Subsystem vendor ID */
114 	uint32_t	ioc_subsys_id;		/* Subsystem ID */
115 	uint16_t	ioc_io_class;		/* I/O Class */
116 	uint16_t	ioc_io_subclass;	/* I/O Sub Class */
117 	uint16_t	ioc_protocol;		/* Type of protocol */
118 	uint16_t	ioc_protocol_ver;	/* Protocol version */
119 	uint16_t	ioc_rsvd2;		/* RESERVED */
120 	uint16_t	ioc_rsvd3;		/* RESERVED */
121 	uint16_t	ioc_send_msg_qdepth;	/* Send message Q depth */
122 	uint8_t		ioc_rsvd4;		/* RESERVED */
123 	uint8_t		ioc_rdma_read_qdepth;	/* RDMA read Q depth */
124 	uint32_t	ioc_send_msg_sz;	/* Send message Size */
125 	uint32_t	ioc_rdma_xfer_sz;	/* RDMA transfer size */
126 	uint8_t		ioc_ctrl_opcap_mask;	/* Ctrl operations */
127 						/* capability mask */
128 	uint8_t		ioc_rsvd5;		/* RESERVED */
129 	uint8_t		ioc_service_entries;	/* Number of service entries */
130 	uint8_t		ioc_rsvd6[9];		/* RESERVED */
131 	uint8_t		ioc_id_string[IB_DM_IOC_ID_STRING_LEN];
132 						/* ID string, UTF-8 format */
133 } ib_dm_ioc_ctrl_profile_t;
134 
135 /* I/O class definitions as defined in the I/O annex A0 Table 4 */
136 #define	IB_DM_IO_CLASS_VENDOR_SPECIFIC		0xFFFF
137 #define	IB_DM_IO_CLASS_NONE			0x00FF
138 #define	IB_DM_IO_CLASS_STORAGE			0x10FF
139 #define	IB_DM_IO_CLASS_NETWORK			0x20FF
140 #define	IB_DM_IO_CLASS_VEDIO_MULTIMEDIA		0x40FF
141 #define	IB_DM_IO_CLASS_UNKNOWN_OR_MULTIPLE	0xF0FF
142 #define	IB_DM_IO_SUBCLASS_VENDOR_SPECIFIC	0xFFFF
143 
144 /* Controller Capability Mask values */
145 #define	IB_DM_CTRL_CAP_MASK_ST			0x0
146 #define	IB_DM_CTRL_CAP_MASK_SF			0x1
147 #define	IB_DM_CTRL_CAP_MASK_RT			0x2
148 #define	IB_DM_CTRL_CAP_MASK_RF			0x3
149 #define	IB_DM_CTRL_CAP_MASK_WT			0x4
150 #define	IB_DM_CTRL_CAP_MASK_WF			0x5
151 #define	IB_DM_CTRL_CAP_MASK_AT			0x6
152 #define	IB_DM_CTRL_CAP_MASK_AF			0x7
153 
154 /* Controller Service Capability Mask */
155 #define	IB_DM_CTRL_SRVC_MASK_CS			0x0
156 #define	IB_DM_CTRL_SRVC_MASK_SBWP		0x1
157 #define	IB_DM_CTRL_SRVC_MASK_NBWP		0x2
158 
159 /* Definition for service entry table 219, 16.3.3.5 */
160 #define	IB_DM_MAX_SVC_ENTS_PER_REQ		4
161 #define	IB_DM_MAX_SVC_NAME_LEN			40
162 #define	IB_DM_MAX_SVC_ENTRIES			0x100
163 
164 typedef struct ib_dm_srv_s {
165 	/* Service name string in UTF-8 format */
166 	uint8_t		srv_name[IB_DM_MAX_SVC_NAME_LEN];
167 	ib_svc_id_t	srv_id;			/* Service Identifier   */
168 } ib_dm_srv_t;
169 
170 #ifdef __cplusplus
171 }
172 #endif
173 
174 #endif	/* _SYS_IB_MGT_IB_DM_ATTR_H */
175