xref: /illumos-gate/usr/src/uts/common/sys/rsm/rsm.h (revision 2d6eb4a5)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1999-2002 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_RSM_RSM_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_RSM_RSM_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
31*7c478bd9Sstevel@tonic-gate extern "C" {
32*7c478bd9Sstevel@tonic-gate #endif
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #include <sys/rsm/rsm_common.h>
35*7c478bd9Sstevel@tonic-gate #include <sys/rsm/rsmapi_common.h>
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_CONTROLLER	0x00
38*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_EXPORT_SEG	0x10
39*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_IMPORT_SEG	0x20
40*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_QUEUE		0x30
41*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_TOPOLOGY	0x40
42*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_BAR		0x50
43*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_ERRCNT	0x60
44*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_BELL		0x70
45*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_IOVEC		0x80
46*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_MAP_ADDR	0x90
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_ATTR	RSM_IOCTL_CONTROLLER + 0x0 /* get device attribute */
49*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_BAR_INFO RSM_IOCTL_CONTROLLER + 0x1 /* get barrier info */
50*7c478bd9Sstevel@tonic-gate 
51*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_CREATE	RSM_IOCTL_EXPORT_SEG + 0x1
52*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_BIND		RSM_IOCTL_EXPORT_SEG + 0x3
53*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_REBIND	RSM_IOCTL_EXPORT_SEG + 0x4
54*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_UNBIND	RSM_IOCTL_EXPORT_SEG + 0x5
55*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_PUBLISH	RSM_IOCTL_EXPORT_SEG + 0x6
56*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_REPUBLISH	RSM_IOCTL_EXPORT_SEG + 0x7
57*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_UNPUBLISH	RSM_IOCTL_EXPORT_SEG + 0x8
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_CONNECT	RSM_IOCTL_IMPORT_SEG + 0x0
60*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_DISCONNECT	RSM_IOCTL_IMPORT_SEG + 0x1
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_TOPOLOGY_SIZE	RSM_IOCTL_TOPOLOGY + 0x1
63*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_TOPOLOGY_DATA	RSM_IOCTL_TOPOLOGY + 0x2
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_GETV		RSM_IOCTL_IOVEC	+ 0x1
66*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_PUTV		RSM_IOCTL_IOVEC	+ 0x2
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_BAR_OPEN	RSM_IOCTL_BAR + 0x1
69*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_BAR_ORDER	RSM_IOCTL_BAR + 0x2
70*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_BAR_CLOSE	RSM_IOCTL_BAR + 0x3
71*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_BAR_CHECK	RSM_IOCTL_BAR + 0x4
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_RING_BELL	RSM_IOCTL_BELL + 0x1
74*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_CONSUMEEVENT	RSM_IOCTL_BELL + 0x2
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_MAP_TO_ADDR		RSM_IOCTL_MAP_ADDR + 0x1
77*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_MAP_TO_NODEID	RSM_IOCTL_MAP_ADDR + 0x2
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL_CMDGRP(cmd)	((cmd) & 0xfffffff0)
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate #define	BETWEEN(x, lo, hi)	(((x) >= (lo)) && ((x) <= (hi)))
82*7c478bd9Sstevel@tonic-gate 
83*7c478bd9Sstevel@tonic-gate #define	RSM_MAX_IOVLEN	4
84*7c478bd9Sstevel@tonic-gate /*
85*7c478bd9Sstevel@tonic-gate  * DEBUG message categories
86*7c478bd9Sstevel@tonic-gate  * 0xABCD:  A=module, B=functionality C=operation D=misc
87*7c478bd9Sstevel@tonic-gate  *
88*7c478bd9Sstevel@tonic-gate  */
89*7c478bd9Sstevel@tonic-gate #define	RSM_KERNEL_AGENT	0x1000  /* kernel agent messages	*/
90*7c478bd9Sstevel@tonic-gate #define	RSM_LIBRARY		0x2000  /* rsmapi library messages	*/
91*7c478bd9Sstevel@tonic-gate #define	RSM_OPS			0x4000	/* rsmops module messages	*/
92*7c478bd9Sstevel@tonic-gate #define	RSM_PATH_MANAGER	0x8000	/* path manager messages	*/
93*7c478bd9Sstevel@tonic-gate #define	RSM_MODULE_ALL		0xF000
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate #define	RSM_IMPORT		0x0100  /* import operations		*/
96*7c478bd9Sstevel@tonic-gate #define	RSM_EXPORT		0x0200	/* export operations		*/
97*7c478bd9Sstevel@tonic-gate #define	RSM_LOOPBACK		0x0400	/* loopback mode		*/
98*7c478bd9Sstevel@tonic-gate #define	RSM_FUNC_ALL		0x0F00
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate #define	RSM_DDI			0x0010	/* dev driver infrastructure    */
101*7c478bd9Sstevel@tonic-gate #define	RSM_IO_ROUTINES		0x0020	/* put/get processing		*/
102*7c478bd9Sstevel@tonic-gate #define	RSM_IOCTL		0x0040	/* ioctl processing		*/
103*7c478bd9Sstevel@tonic-gate #define	RSM_INTR_CALLBACK	0x0080	/* interrupt processing		*/
104*7c478bd9Sstevel@tonic-gate #define	RSM_OPER_ALL		0x00F0
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate #define	RSM_FLOWCONTROL		0x0001	/* flow control related		*/
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate #define	RSM_KERNEL_ALL		(RSM_KERNEL_AGENT | RSM_PATH_MANAGER | 0x0FFF)
109*7c478bd9Sstevel@tonic-gate #define	RSM_ALL			0xFFFF  /* All of the above		*/
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate /*
112*7c478bd9Sstevel@tonic-gate  * DEBUG message levels
113*7c478bd9Sstevel@tonic-gate  */
114*7c478bd9Sstevel@tonic-gate #define	RSM_DEBUG_VERBOSE	6
115*7c478bd9Sstevel@tonic-gate #define	RSM_DEBUG_LVL2		5
116*7c478bd9Sstevel@tonic-gate #define	RSM_DEBUG_LVL1		4
117*7c478bd9Sstevel@tonic-gate #define	RSM_DEBUG		3
118*7c478bd9Sstevel@tonic-gate #define	RSM_NOTICE		2
119*7c478bd9Sstevel@tonic-gate #define	RSM_WARNING		1
120*7c478bd9Sstevel@tonic-gate #define	RSM_ERR			0
121*7c478bd9Sstevel@tonic-gate 
122*7c478bd9Sstevel@tonic-gate #ifdef	DEBUG
123*7c478bd9Sstevel@tonic-gate extern void dbg_printf(int category, int level, char *fmt, ...);
124*7c478bd9Sstevel@tonic-gate #define	DBG_DEFINE(var, value) int var = (value)
125*7c478bd9Sstevel@tonic-gate #define	DBG_DEFINE_STR(var, value) char *var = (value)
126*7c478bd9Sstevel@tonic-gate #define	DBG_ADDCATEGORY(var, category) (var |= (category))
127*7c478bd9Sstevel@tonic-gate #define	DBG_PRINTF(message) dbg_printf message
128*7c478bd9Sstevel@tonic-gate #else
129*7c478bd9Sstevel@tonic-gate #define	DBG_DEFINE(var, value)
130*7c478bd9Sstevel@tonic-gate #define	DBG_DEFINE_STR(var, value)
131*7c478bd9Sstevel@tonic-gate #define	DBG_ADDCATEGORY(var, category)
132*7c478bd9Sstevel@tonic-gate #define	DBG_PRINTF(message)
133*7c478bd9Sstevel@tonic-gate #endif /* DEBUG */
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate typedef	uint16_t	rsm_gnum_t;
136*7c478bd9Sstevel@tonic-gate 
137*7c478bd9Sstevel@tonic-gate /*
138*7c478bd9Sstevel@tonic-gate  * data struct used between rsm base library and kernel agent for IOCTLS
139*7c478bd9Sstevel@tonic-gate  */
140*7c478bd9Sstevel@tonic-gate typedef struct {
141*7c478bd9Sstevel@tonic-gate 	/* following fields should be identical to rsmapi_controller_attr_t */
142*7c478bd9Sstevel@tonic-gate 	uint_t		attr_direct_access_sizes;
143*7c478bd9Sstevel@tonic-gate 	uint_t		attr_atomic_sizes;
144*7c478bd9Sstevel@tonic-gate 	size_t		attr_page_size;
145*7c478bd9Sstevel@tonic-gate 	size_t		attr_max_export_segment_size;
146*7c478bd9Sstevel@tonic-gate 	size_t		attr_tot_export_segment_size;
147*7c478bd9Sstevel@tonic-gate 	ulong_t		attr_max_export_segments;
148*7c478bd9Sstevel@tonic-gate 	size_t		attr_max_import_map_size;
149*7c478bd9Sstevel@tonic-gate 	size_t		attr_tot_import_map_size;
150*7c478bd9Sstevel@tonic-gate 	ulong_t		attr_max_import_segments;
151*7c478bd9Sstevel@tonic-gate 	/* following fields are for internal use */
152*7c478bd9Sstevel@tonic-gate 	rsm_addr_t	attr_controller_addr;
153*7c478bd9Sstevel@tonic-gate } rsmka_int_controller_attr_t;
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
156*7c478bd9Sstevel@tonic-gate typedef struct {
157*7c478bd9Sstevel@tonic-gate 	/* following fields should be identical to rsmapi_controller_attr_t */
158*7c478bd9Sstevel@tonic-gate 	uint32_t	attr_direct_access_sizes;
159*7c478bd9Sstevel@tonic-gate 	uint32_t	attr_atomic_sizes;
160*7c478bd9Sstevel@tonic-gate 	uint32_t	attr_page_size;
161*7c478bd9Sstevel@tonic-gate 	uint32_t	attr_max_export_segment_size;
162*7c478bd9Sstevel@tonic-gate 	uint32_t	attr_tot_export_segment_size;
163*7c478bd9Sstevel@tonic-gate 	uint32_t	attr_max_export_segments;
164*7c478bd9Sstevel@tonic-gate 	uint32_t	attr_max_import_map_size;
165*7c478bd9Sstevel@tonic-gate 	uint32_t	attr_tot_import_map_size;
166*7c478bd9Sstevel@tonic-gate 	uint32_t	attr_max_import_segments;
167*7c478bd9Sstevel@tonic-gate 	/* the following fields are for internal use */
168*7c478bd9Sstevel@tonic-gate 	rsm_addr_t	attr_controller_addr;
169*7c478bd9Sstevel@tonic-gate } rsmka_int_controller_attr32_t;
170*7c478bd9Sstevel@tonic-gate #endif
171*7c478bd9Sstevel@tonic-gate 
172*7c478bd9Sstevel@tonic-gate /* kernel agent equivalents of rsm_iovec_t and rsm_scat_gath_t */
173*7c478bd9Sstevel@tonic-gate typedef struct {
174*7c478bd9Sstevel@tonic-gate 	int					io_type;
175*7c478bd9Sstevel@tonic-gate 	union {
176*7c478bd9Sstevel@tonic-gate 		rsm_localmemory_handle_t	handle;
177*7c478bd9Sstevel@tonic-gate 		rsm_memseg_id_t			segid;
178*7c478bd9Sstevel@tonic-gate 		caddr_t				vaddr;
179*7c478bd9Sstevel@tonic-gate 	} local;
180*7c478bd9Sstevel@tonic-gate 	size_t					local_offset;
181*7c478bd9Sstevel@tonic-gate 	size_t					remote_offset;
182*7c478bd9Sstevel@tonic-gate 	size_t					transfer_len;
183*7c478bd9Sstevel@tonic-gate } rsmka_iovec_t;
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
186*7c478bd9Sstevel@tonic-gate typedef struct {
187*7c478bd9Sstevel@tonic-gate 	int32_t					io_type;
188*7c478bd9Sstevel@tonic-gate 	uint32_t				local;
189*7c478bd9Sstevel@tonic-gate 	uint32_t				local_offset;
190*7c478bd9Sstevel@tonic-gate 	uint32_t				remote_offset;
191*7c478bd9Sstevel@tonic-gate 	uint32_t				transfer_len;
192*7c478bd9Sstevel@tonic-gate } rsmka_iovec32_t;
193*7c478bd9Sstevel@tonic-gate #endif
194*7c478bd9Sstevel@tonic-gate 
195*7c478bd9Sstevel@tonic-gate /*
196*7c478bd9Sstevel@tonic-gate  * The following 2 structures represent the scatter-gather structures used
197*7c478bd9Sstevel@tonic-gate  * within the kernel agent. Note that the io_residual_count and the flags fields
198*7c478bd9Sstevel@tonic-gate  * fields must be contiguous within these structures due to this assumption
199*7c478bd9Sstevel@tonic-gate  * made by the kernel agent when updating them in ddi_copyout.
200*7c478bd9Sstevel@tonic-gate  */
201*7c478bd9Sstevel@tonic-gate typedef struct {
202*7c478bd9Sstevel@tonic-gate 	rsm_node_id_t			local_nodeid;
203*7c478bd9Sstevel@tonic-gate 	ulong_t				io_request_count;
204*7c478bd9Sstevel@tonic-gate 	ulong_t				io_residual_count;
205*7c478bd9Sstevel@tonic-gate 	uint_t				flags;
206*7c478bd9Sstevel@tonic-gate 	rsm_memseg_import_handle_t	remote_handle;
207*7c478bd9Sstevel@tonic-gate 	rsmka_iovec_t			*iovec;
208*7c478bd9Sstevel@tonic-gate } rsmka_scat_gath_t;
209*7c478bd9Sstevel@tonic-gate 
210*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
211*7c478bd9Sstevel@tonic-gate typedef struct {
212*7c478bd9Sstevel@tonic-gate 	rsm_node_id_t		local_nodeid;
213*7c478bd9Sstevel@tonic-gate 	uint32_t		io_request_count;
214*7c478bd9Sstevel@tonic-gate 	uint32_t		io_residual_count;
215*7c478bd9Sstevel@tonic-gate 	uint32_t		flags;
216*7c478bd9Sstevel@tonic-gate 	caddr32_t		remote_handle;
217*7c478bd9Sstevel@tonic-gate 	caddr32_t		iovec;
218*7c478bd9Sstevel@tonic-gate } rsmka_scat_gath32_t;
219*7c478bd9Sstevel@tonic-gate #endif
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate /*
222*7c478bd9Sstevel@tonic-gate  * Define the number of pollfds upto which we don't allocate memory on heap
223*7c478bd9Sstevel@tonic-gate  *
224*7c478bd9Sstevel@tonic-gate  */
225*7c478bd9Sstevel@tonic-gate #define	RSM_MAX_POLLFDS	4
226*7c478bd9Sstevel@tonic-gate 
227*7c478bd9Sstevel@tonic-gate typedef struct {
228*7c478bd9Sstevel@tonic-gate 	minor_t		rnum;	/* segment's resource number */
229*7c478bd9Sstevel@tonic-gate 	int		fdsidx; /* index of the fd in the pollfd array */
230*7c478bd9Sstevel@tonic-gate 	int		revent; /* returned event */
231*7c478bd9Sstevel@tonic-gate } rsm_poll_event_t;
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
234*7c478bd9Sstevel@tonic-gate typedef struct {
235*7c478bd9Sstevel@tonic-gate 	minor_t		rnum;
236*7c478bd9Sstevel@tonic-gate 	int32_t		fdsidx;
237*7c478bd9Sstevel@tonic-gate 	int32_t		revent;
238*7c478bd9Sstevel@tonic-gate } rsm_poll_event32_t;
239*7c478bd9Sstevel@tonic-gate #endif
240*7c478bd9Sstevel@tonic-gate 
241*7c478bd9Sstevel@tonic-gate typedef struct {
242*7c478bd9Sstevel@tonic-gate 	caddr_t		seglist; /* array of rsm_poll_event_t */
243*7c478bd9Sstevel@tonic-gate 	uint32_t	numents;
244*7c478bd9Sstevel@tonic-gate } rsm_consume_event_msg_t;
245*7c478bd9Sstevel@tonic-gate 
246*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
247*7c478bd9Sstevel@tonic-gate typedef struct {
248*7c478bd9Sstevel@tonic-gate 	caddr32_t	seglist; /* array of rsm_poll_event32_t */
249*7c478bd9Sstevel@tonic-gate 	uint32_t	numents;
250*7c478bd9Sstevel@tonic-gate } rsm_consume_event_msg32_t;
251*7c478bd9Sstevel@tonic-gate #endif
252*7c478bd9Sstevel@tonic-gate 
253*7c478bd9Sstevel@tonic-gate typedef struct {
254*7c478bd9Sstevel@tonic-gate 	int			cnum;
255*7c478bd9Sstevel@tonic-gate 	caddr_t			cname;
256*7c478bd9Sstevel@tonic-gate 	int			cname_len;
257*7c478bd9Sstevel@tonic-gate 	caddr_t			arg;
258*7c478bd9Sstevel@tonic-gate 	int			len;	/* size as well */
259*7c478bd9Sstevel@tonic-gate 	caddr_t			vaddr;
260*7c478bd9Sstevel@tonic-gate 	int			off;
261*7c478bd9Sstevel@tonic-gate 	rsm_memseg_id_t		key;
262*7c478bd9Sstevel@tonic-gate 	int			acl_len;
263*7c478bd9Sstevel@tonic-gate 	rsmapi_access_entry_t	*acl;
264*7c478bd9Sstevel@tonic-gate 	rsm_node_id_t		nodeid;
265*7c478bd9Sstevel@tonic-gate 	rsm_addr_t		hwaddr;
266*7c478bd9Sstevel@tonic-gate 	rsm_permission_t	perm;
267*7c478bd9Sstevel@tonic-gate 	rsm_barrier_t		bar;
268*7c478bd9Sstevel@tonic-gate 	rsm_gnum_t		gnum; /* segment generation number */
269*7c478bd9Sstevel@tonic-gate 	minor_t			rnum; /* segment resource number */
270*7c478bd9Sstevel@tonic-gate } rsm_ioctlmsg_t;
271*7c478bd9Sstevel@tonic-gate 
272*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
273*7c478bd9Sstevel@tonic-gate typedef struct {
274*7c478bd9Sstevel@tonic-gate 	int32_t			cnum;
275*7c478bd9Sstevel@tonic-gate 	caddr32_t		cname;
276*7c478bd9Sstevel@tonic-gate 	int32_t			cname_len;
277*7c478bd9Sstevel@tonic-gate 	caddr32_t		arg;
278*7c478bd9Sstevel@tonic-gate 	int32_t			len;	/* size as well */
279*7c478bd9Sstevel@tonic-gate 	caddr32_t		vaddr;
280*7c478bd9Sstevel@tonic-gate 	int32_t			off;
281*7c478bd9Sstevel@tonic-gate 	rsm_memseg_id_t		key;
282*7c478bd9Sstevel@tonic-gate 	int32_t			acl_len;
283*7c478bd9Sstevel@tonic-gate 	caddr32_t		acl;
284*7c478bd9Sstevel@tonic-gate 	rsm_node_id_t		nodeid;
285*7c478bd9Sstevel@tonic-gate 	rsm_addr_t		hwaddr;
286*7c478bd9Sstevel@tonic-gate 	rsm_permission_t	perm;
287*7c478bd9Sstevel@tonic-gate 	rsm_barrier_t		bar;
288*7c478bd9Sstevel@tonic-gate 	rsm_gnum_t		gnum; /* segment generation number */
289*7c478bd9Sstevel@tonic-gate 	minor_t			rnum; /* segment resource number */
290*7c478bd9Sstevel@tonic-gate } rsm_ioctlmsg32_t;
291*7c478bd9Sstevel@tonic-gate #endif
292*7c478bd9Sstevel@tonic-gate 
293*7c478bd9Sstevel@tonic-gate /*
294*7c478bd9Sstevel@tonic-gate  * Remote messaging structures
295*7c478bd9Sstevel@tonic-gate  */
296*7c478bd9Sstevel@tonic-gate 
297*7c478bd9Sstevel@tonic-gate /* cookie to exchange between sender and receiver */
298*7c478bd9Sstevel@tonic-gate typedef union {
299*7c478bd9Sstevel@tonic-gate 	struct {
300*7c478bd9Sstevel@tonic-gate 		uint_t		index : 8;		/* slot number */
301*7c478bd9Sstevel@tonic-gate 		uint_t		sequence : 24;		/* seq. number */
302*7c478bd9Sstevel@tonic-gate 	} ic;
303*7c478bd9Sstevel@tonic-gate 	uint_t			value;
304*7c478bd9Sstevel@tonic-gate }rsmipc_cookie_t;
305*7c478bd9Sstevel@tonic-gate 
306*7c478bd9Sstevel@tonic-gate /*  IPC msg types */
307*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_SEGCONNECT	0	/* connect seg	    */
308*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_DISCONNECT	1	/* disconnect seg   */
309*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_IMPORTING	2
310*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_NOTIMPORTING	3
311*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_REPLY	4	/* reply msg	    */
312*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_BELL		5	/* post an event    */
313*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_REPUBLISH	6	/* seg republished  */
314*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_SUSPEND	7	/* tell importers to SUSPEND	*/
315*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_SUSPEND_DONE	8	/* tell exporters - SUSPEND done */
316*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_RESUME	9	/* tell importers to RESUME	*/
317*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_SQREADY	10	/* sendq ready = I am up	*/
318*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_SQREADY_ACK	11	/* sendq ready ack = I am up too */
319*7c478bd9Sstevel@tonic-gate #define	RSMIPC_MSG_CREDIT	12	/* credits to sender	*/
320*7c478bd9Sstevel@tonic-gate 
321*7c478bd9Sstevel@tonic-gate /*
322*7c478bd9Sstevel@tonic-gate  * Dummy message header
323*7c478bd9Sstevel@tonic-gate  */
324*7c478bd9Sstevel@tonic-gate typedef struct rsmipc_msg {
325*7c478bd9Sstevel@tonic-gate 	int		rsmipc_version;
326*7c478bd9Sstevel@tonic-gate 	rsm_node_id_t	rsmipc_src;
327*7c478bd9Sstevel@tonic-gate 	int		rsmipc_type;
328*7c478bd9Sstevel@tonic-gate 	rsmipc_cookie_t	rsmipc_cookie;
329*7c478bd9Sstevel@tonic-gate 	int64_t		rsmipc_incn;
330*7c478bd9Sstevel@tonic-gate }rsmipc_msghdr_t;
331*7c478bd9Sstevel@tonic-gate 
332*7c478bd9Sstevel@tonic-gate 
333*7c478bd9Sstevel@tonic-gate #define	RSM_NO_REPLY	0	/* for rsmipc_send when no reply is expected */
334*7c478bd9Sstevel@tonic-gate 
335*7c478bd9Sstevel@tonic-gate /*
336*7c478bd9Sstevel@tonic-gate  * Request message of connect operation
337*7c478bd9Sstevel@tonic-gate  */
338*7c478bd9Sstevel@tonic-gate typedef struct rsmipc_request {
339*7c478bd9Sstevel@tonic-gate 	rsmipc_msghdr_t		rsmipc_hdr;
340*7c478bd9Sstevel@tonic-gate 	rsm_memseg_id_t		rsmipc_key;	/* user key or segid */
341*7c478bd9Sstevel@tonic-gate 	rsm_permission_t	rsmipc_perm;
342*7c478bd9Sstevel@tonic-gate 	rsm_addr_t		rsmipc_adapter_hwaddr;
343*7c478bd9Sstevel@tonic-gate 	void			*rsmipc_segment_cookie;
344*7c478bd9Sstevel@tonic-gate }rsmipc_request_t;
345*7c478bd9Sstevel@tonic-gate 
346*7c478bd9Sstevel@tonic-gate /*
347*7c478bd9Sstevel@tonic-gate  * Message format of the flow control messages
348*7c478bd9Sstevel@tonic-gate  */
349*7c478bd9Sstevel@tonic-gate typedef struct rsmipc_controlmsg {
350*7c478bd9Sstevel@tonic-gate 	rsmipc_msghdr_t		rsmipc_hdr;
351*7c478bd9Sstevel@tonic-gate 	int64_t			rsmipc_local_incn;
352*7c478bd9Sstevel@tonic-gate 	rsm_addr_t		rsmipc_adapter_hwaddr;
353*7c478bd9Sstevel@tonic-gate 	int32_t			rsmipc_credits;	/* credits */
354*7c478bd9Sstevel@tonic-gate }rsmipc_controlmsg_t;
355*7c478bd9Sstevel@tonic-gate 
356*7c478bd9Sstevel@tonic-gate /*
357*7c478bd9Sstevel@tonic-gate  * Reply message for connect operation
358*7c478bd9Sstevel@tonic-gate  */
359*7c478bd9Sstevel@tonic-gate typedef struct rsmipc_reply {
360*7c478bd9Sstevel@tonic-gate 	rsmipc_msghdr_t	rsmipc_hdr;
361*7c478bd9Sstevel@tonic-gate 	short		rsmipc_status;	/* error code of remote call */
362*7c478bd9Sstevel@tonic-gate 	uint16_t	rsmipc_cnum;	/* exported controller addr */
363*7c478bd9Sstevel@tonic-gate 	rsm_memseg_id_t	rsmipc_segid;	/* segid from remote node */
364*7c478bd9Sstevel@tonic-gate 	size_t		rsmipc_seglen;	/* exporter segment size */
365*7c478bd9Sstevel@tonic-gate 	mode_t		rsmipc_mode;
366*7c478bd9Sstevel@tonic-gate 	uid_t		rsmipc_uid;
367*7c478bd9Sstevel@tonic-gate 	gid_t		rsmipc_gid;
368*7c478bd9Sstevel@tonic-gate }rsmipc_reply_t;
369*7c478bd9Sstevel@tonic-gate 
370*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
371*7c478bd9Sstevel@tonic-gate }
372*7c478bd9Sstevel@tonic-gate #endif
373*7c478bd9Sstevel@tonic-gate 
374*7c478bd9Sstevel@tonic-gate 
375*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_RSM_RSM_H */
376