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