xref: /titanic_41/usr/src/uts/common/sys/rsm/rsm_common.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 (c) 1999-2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _SYS_RSM_RSM_COMMON_H
28 #define	_SYS_RSM_RSM_COMMON_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	RSM_VERSION	5
37 
38 /* Return values for RSMAPI */
39 #define	RSM_SUCCESS 0
40 #define	RSMERR_BAD_LIBRARY_VERSION		1
41 #define	RSMERR_BAD_TOPOLOGY_PTR			2
42 #define	RSMERR_BAD_CTLR_HNDL			3
43 #define	RSMERR_CTLR_NOT_PRESENT			4
44 #define	RSMERR_BAD_SEG_HNDL			5
45 #define	RSMERR_SEG_ALREADY_PUBLISHED		6
46 #define	RSMERR_SEG_NOT_PUBLISHED		7
47 #define	RSMERR_SEG_NOT_PUBLISHED_TO_NODE	8
48 #define	RSMERR_SEG_ALREADY_MAPPED		9
49 #define	RSMERR_SEG_STILL_MAPPED			10
50 #define	RSMERR_SEG_NOT_MAPPED			11
51 #define	RSMERR_NOT_CREATOR			12
52 #define	RSMERR_BAD_BARRIER_PTR			13
53 #define	RSMERR_BAD_SGIO				14
54 #define	RSMERR_BAD_LOCALMEM_HNDL		15
55 #define	RSMERR_BAD_ADDR				16
56 #define	RSMERR_BAD_MEM_ALIGNMENT		17
57 #define	RSMERR_BAD_OFFSET			18
58 #define	RSMERR_MISALIGNED_OFFSET		19
59 #define	RSMERR_BAD_LENGTH			20
60 #define	RSMERR_BAD_ACL				21
61 #define	RSMERR_BAD_SEGID			22
62 #define	RSMERR_RESERVED_SEGID			23
63 #define	RSMERR_SEGID_IN_USE			24
64 #define	RSMERR_BAD_MODE				25
65 #define	RSMERR_BAD_PERMS			26
66 #define	RSMERR_PERM_DENIED			27
67 #define	RSMERR_LOCKS_NOT_SUPPORTED		28
68 #define	RSMERR_LOCKS_NOT_ENABLED		29
69 #define	RSMERR_REBIND_NOT_ALLOWED		30
70 #define	RSMERR_INSUFFICIENT_RESOURCES		31
71 #define	RSMERR_INSUFFICIENT_MEM			32
72 #define	RSMERR_MAP_FAILED			33
73 #define	RSMERR_POLLFD_IN_USE			34
74 #define	RSMERR_BARRIER_UNINITIALIZED		35
75 #define	RSMERR_BARRIER_OPEN_FAILED		36
76 #define	RSMERR_BARRIER_NOT_OPENED		37
77 #define	RSMERR_BARRIER_FAILURE			38
78 #define	RSMERR_REMOTE_NODE_UNREACHABLE		39
79 #define	RSMERR_CONN_ABORTED			40
80 #define	RSMERR_INTERRUPTED			41
81 #define	RSMERR_TIMEOUT				42
82 #define	RSMERR_BAD_APPID			43
83 #define	RSMERR_BAD_CONF				44
84 #define	RSMERR_SEG_NOT_CONNECTED		45
85 
86 /* Additional return values for RSMPI */
87 #define	RSMERR_BAD_DRIVER_VERSION		101
88 #define	RSMERR_UNSUPPORTED_VERSION		102
89 #define	RSMERR_DRIVER_NAME_IN_USE		103
90 #define	RSMERR_DRIVER_NOT_REGISTERED		104
91 #define	RSMERR_DRIVER_THREAD_RUNNING		105
92 #define	RSMERR_NEED_THREAD_INIT			106
93 #define	RSMERR_THREAD_NOT_INITED		107
94 #define	RSMERR_CTLRS_REGISTERED			108
95 #define	RSMERR_CTLR_NOT_REGISTERED		109
96 #define	RSMERR_CTLR_ALREADY_REGISTERED		110
97 #define	RSMERR_CTLR_IN_USE			111
98 #define	RSMERR_NAME_TOO_LONG			112
99 #define	RSMERR_SEG_PUBLISHED			113
100 #define	RSMERR_SEG_NOT_PUBLISHED_TO_RSM_ADDR	114
101 #define	RSMERR_SEG_IN_USE			115
102 #define	RSMERR_BAD_SENDQ_HNDL			116
103 #define	RSMERR_BAD_ARGS_ERRORS			117
104 #define	RSMERR_BAD_MSTYPE			118
105 #define	RSMERR_NO_BACKING_MEM			119
106 #define	RSMERR_NOT_MEM				120
107 #define	RSMERR_MEM_ALREADY_BOUND		121
108 #define	RSMERR_MEM_NOT_BOUND			122
109 #define	RSMERR_HANDLER_NOT_REGISTERED		123
110 #define	RSMERR_NO_HANDLER			124
111 #define	RSMERR_UNBIND_REBIND_NOT_ALLOWED	125
112 #define	RSMERR_CALLBACKS_NOT_SUPPORTED		126
113 #define	RSMERR_UNSUPPORTED_OPERATION		127
114 #define	RSMERR_RSM_ADDR_UNREACHABLE		128
115 #define	RSMERR_UNKNOWN_RSM_ADDR			129
116 #define	RSMERR_BAD_BARRIER_HNDL			130
117 #define	RSMERR_COMM_ERR_MAYBE_DELIVERED		131
118 #define	RSMERR_COMM_ERR_NOT_DELIVERED		132
119 #define	RSMERR_QUEUE_FENCE_UP			133
120 #define	RSMERR_QUEUE_FULL			134
121 
122 #define	RSMERR_INTERNAL_ERROR			100
123 
124 /*
125  * Partition segment id and service id space
126  * users should only create segments or register handlers
127  * using segment and service id's from the correct range below
128  * RSM_DRIVER_PRIVATE enforced in rsm_memseg_export_publish
129  * and rsm_memseg_import_connect
130  */
131 
132 #define	RSM_DRIVER_PRIVATE_ID_BASE	0
133 #define	RSM_DRIVER_PRIVATE_ID_END	0x0FFFFF
134 
135 #define	RSM_CLUSTER_TRANSPORT_ID_BASE	0x100000
136 #define	RSM_CLUSTER_TRANSPORT_ID_END	0x1FFFFF
137 #define	RSM_RSMLIB_ID_BASE		0x200000
138 #define	RSM_RSMLIB_ID_END		0x2FFFFF
139 #define	RSM_DLPI_ID_BASE		0x300000
140 #define	RSM_DLPI_ID_END			0x3FFFFF
141 #define	RSM_HPC_ID_BASE			0x400000
142 #define	RSM_HPC_ID_END			0x4FFFFF
143 #define	RSM_OPS_ID_BASE			0x500000
144 #define	RSM_OPS_ID_END			0x5FFFFF
145 
146 #define	RSM_USER_APP_ID_BASE		0x80000000
147 #define	RSM_USER_APP_ID_END		0xFFFFFFFF
148 
149 /*
150  * The following definitions and typedef are used to describe the
151  * permissions associated with all or part of a memory segment.
152  */
153 #define	RSM_PERM_NONE				0
154 #define	RSM_PERM_READ				0400
155 #define	RSM_PERM_WRITE				0200
156 #define	RSM_PERM_RDWR				(RSM_PERM_READ|RSM_PERM_WRITE)
157 
158 /* Maximum io_request_count value in rsm_scat_gath_t */
159 #define	RSM_MAX_SGIOREQS	16
160 
161 /*
162  * Direct access sizes bits
163  */
164 typedef enum {
165 	RSM_DAS8	=	1,
166 	RSM_DAS16	=	2,
167 	RSM_DAS32	=	4,
168 	RSM_DAS64	=	8
169 }rsm_access_size_t;
170 
171 typedef uint64_t rsm_addr_t;
172 typedef uint32_t rsm_node_id_t;
173 typedef uint32_t rsm_memseg_id_t;
174 typedef uint32_t rsm_permission_t;
175 
176 struct __rsm_memseg_import_handle;
177 typedef struct __rsm_memseg_import_handle *rsm_memseg_import_handle_t;
178 
179 struct __rsm_memseg_export_handle;
180 typedef struct __rsm_memseg_export_handle *rsm_memseg_export_handle_t;
181 
182 typedef enum {
183 	RSM_BARRIER_SEGMENT = 0x01,
184 	RSM_BARRIER_NODE    = 0x02,
185 	RSM_BARRIER_SEGMENT_THREAD = 0x11,
186 	RSM_BARRIER_NODE_THREAD = 0x12
187 }rsm_barrier_type_t;
188 
189 typedef union {
190 	uint64_t u64;
191 	int64_t i64;
192 	uint32_t u32[2];
193 	int32_t i32[2];
194 	uint16_t u16[4];
195 	int16_t i16[4];
196 	uint8_t u8[8];
197 	int8_t i8[8];
198 	uchar_t uc[8];
199 	char c[8];
200 	void *vp;
201 } rsm_barrier_component_t;
202 
203 typedef struct {
204 	rsm_barrier_component_t comp[4];
205 } rsm_barrier_t;
206 
207 typedef enum {
208 	RSM_BARRIER_MODE_EXPLICIT, RSM_BARRIER_MODE_IMPLICIT
209 } rsm_barrier_mode_t;
210 
211 #ifdef	__cplusplus
212 }
213 #endif
214 
215 #endif /* _SYS_RSM_RSM_COMMON_H */
216