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