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