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