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