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-2001, 2003 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_RSMAPI_COMMON_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_RSM_RSMAPI_COMMON_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 
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * Applications must provide a handle for each region of local memory
38*7c478bd9Sstevel@tonic-gate  * specified in the scatter/gather list used for an rsm_memseg_putv
39*7c478bd9Sstevel@tonic-gate  * rsm_memseg_getv operation.
40*7c478bd9Sstevel@tonic-gate  */
41*7c478bd9Sstevel@tonic-gate struct __rsm_localmemory_handle;
42*7c478bd9Sstevel@tonic-gate typedef struct __rsm_localmemory_handle *rsm_localmemory_handle_t;
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate struct __rsmapi_controller_handle;
45*7c478bd9Sstevel@tonic-gate typedef struct __rsmapi_controller_handle *rsmapi_controller_handle_t;
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate typedef struct {
48*7c478bd9Sstevel@tonic-gate 	uint_t	attr_direct_access_sizes;
49*7c478bd9Sstevel@tonic-gate 	uint_t	attr_atomic_sizes;
50*7c478bd9Sstevel@tonic-gate 	size_t	attr_page_size;
51*7c478bd9Sstevel@tonic-gate 	size_t	attr_max_export_segment_size;
52*7c478bd9Sstevel@tonic-gate 	size_t	attr_tot_export_segment_size;
53*7c478bd9Sstevel@tonic-gate 	ulong_t	attr_max_export_segments;
54*7c478bd9Sstevel@tonic-gate 	size_t	attr_max_import_map_size;
55*7c478bd9Sstevel@tonic-gate 	size_t	attr_tot_import_map_size;
56*7c478bd9Sstevel@tonic-gate 	ulong_t	attr_max_import_segments;
57*7c478bd9Sstevel@tonic-gate } rsmapi_controller_attr_t;
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate typedef struct {
60*7c478bd9Sstevel@tonic-gate 	rsm_node_id_t	 ae_node;	/* node id allowed access */
61*7c478bd9Sstevel@tonic-gate 	rsm_permission_t ae_permission;	/* permissions for node */
62*7c478bd9Sstevel@tonic-gate } rsmapi_access_entry_t;
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate typedef struct {
65*7c478bd9Sstevel@tonic-gate 	void		*seg;
66*7c478bd9Sstevel@tonic-gate 	uint16_t 	gnum;
67*7c478bd9Sstevel@tonic-gate 	void 		*privdata;
68*7c478bd9Sstevel@tonic-gate }rsmapi_barrier_t;
69*7c478bd9Sstevel@tonic-gate 
70*7c478bd9Sstevel@tonic-gate /*
71*7c478bd9Sstevel@tonic-gate  * The scatter/gather list contains a pointer (iovec) to an io vector array.
72*7c478bd9Sstevel@tonic-gate  * Each array element is of type rsm_io_vect_t
73*7c478bd9Sstevel@tonic-gate  */
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate typedef struct {
76*7c478bd9Sstevel@tonic-gate 	int				io_type;
77*7c478bd9Sstevel@tonic-gate 	union {
78*7c478bd9Sstevel@tonic-gate 		rsm_localmemory_handle_t	handle;
79*7c478bd9Sstevel@tonic-gate 		caddr_t				vaddr;
80*7c478bd9Sstevel@tonic-gate 	} local;
81*7c478bd9Sstevel@tonic-gate 	size_t					local_offset;
82*7c478bd9Sstevel@tonic-gate 	size_t					remote_offset;
83*7c478bd9Sstevel@tonic-gate 	size_t					transfer_length;
84*7c478bd9Sstevel@tonic-gate } rsm_iovec_t;
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate typedef struct {
87*7c478bd9Sstevel@tonic-gate 	rsm_node_id_t			local_nodeid;
88*7c478bd9Sstevel@tonic-gate 	ulong_t				io_request_count;
89*7c478bd9Sstevel@tonic-gate 	ulong_t				io_residual_count;
90*7c478bd9Sstevel@tonic-gate 	uint_t				flags;
91*7c478bd9Sstevel@tonic-gate 	rsm_memseg_import_handle_t	remote_handle;
92*7c478bd9Sstevel@tonic-gate 	rsm_iovec_t			*iovec;
93*7c478bd9Sstevel@tonic-gate } rsm_scat_gath_t;
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate /* scatter/gather I/O  types */
96*7c478bd9Sstevel@tonic-gate #define	RSM_HANDLE_TYPE	0x01
97*7c478bd9Sstevel@tonic-gate #define	RSM_VA_TYPE	0x02
98*7c478bd9Sstevel@tonic-gate 
99*7c478bd9Sstevel@tonic-gate /*
100*7c478bd9Sstevel@tonic-gate  * The following macro can be used to indicate that rebind and unbind is
101*7c478bd9Sstevel@tonic-gate  * allowed for an exported segment. This flag is used during the export
102*7c478bd9Sstevel@tonic-gate  * segment creation.
103*7c478bd9Sstevel@tonic-gate  */
104*7c478bd9Sstevel@tonic-gate #define	RSM_ALLOW_REBIND	0x01
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate /*
107*7c478bd9Sstevel@tonic-gate  * This new flag will be used in rsm_memseg_export_create
108*7c478bd9Sstevel@tonic-gate  * to control blocking/noblocking resource allocation
109*7c478bd9Sstevel@tonic-gate  * from RSMAPI layer/interface
110*7c478bd9Sstevel@tonic-gate  */
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate #define	RSM_CREATE_SEG_DONTWAIT	0x02
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate /*
115*7c478bd9Sstevel@tonic-gate  * The bits in the flags field in the scatter gather structure can be
116*7c478bd9Sstevel@tonic-gate  * initialized using the following macros. An RSM_SIGPOST_NO_ACCUMULATE
117*7c478bd9Sstevel@tonic-gate  * flag can be ored into the flags value to indicate that when an implicit
118*7c478bd9Sstevel@tonic-gate  * signal post is being done, the events are not to be accumulated.
119*7c478bd9Sstevel@tonic-gate  * This flag is defined below.
120*7c478bd9Sstevel@tonic-gate  */
121*7c478bd9Sstevel@tonic-gate #define	RSM_IMPLICIT_SIGPOST	0x01
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate /*
124*7c478bd9Sstevel@tonic-gate  * The following macro can be used as the flags argument in
125*7c478bd9Sstevel@tonic-gate  * rsm_intr_signal_post to indicate that the events should not be
126*7c478bd9Sstevel@tonic-gate  * accumulated and then serviced individually. The default value of the
127*7c478bd9Sstevel@tonic-gate  * flags argument for the rsm_intr_signal_post is 0, which indicates that
128*7c478bd9Sstevel@tonic-gate  * the events are accumulated and serviced individually.
129*7c478bd9Sstevel@tonic-gate  * It is important to note here that the value of this macro is 0x02 and
130*7c478bd9Sstevel@tonic-gate  * should not be changed without checking for consistency of use in the
131*7c478bd9Sstevel@tonic-gate  * rsm_memseg_import_getv and rsm_memseg_import_putv calls for an implicit
132*7c478bd9Sstevel@tonic-gate  * signal post.
133*7c478bd9Sstevel@tonic-gate  */
134*7c478bd9Sstevel@tonic-gate #define	RSM_SIGPOST_NO_ACCUMULATE	0x02
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
137*7c478bd9Sstevel@tonic-gate }
138*7c478bd9Sstevel@tonic-gate #endif
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate #endif /* _SYS_RSM_RSMAPI_COMMON_H */
141