xref: /illumos-gate/usr/src/uts/common/sys/rsm/rsmpi.h (revision 9b9d39d2a32ff806d2431dbcc50968ef1e6d46b2)
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 (c) 1998-2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _SYS_RSM_RSMPI_H
28 #define	_SYS_RSM_RSMPI_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #ifndef _KERNEL
35 typedef void * ddi_as_handle_t;
36 #endif
37 
38 #include <sys/sunddi.h>
39 #include <sys/rsm/rsm_common.h>
40 
41 struct __rsm_resource_callback_arg;
42 typedef struct __rsm_resource_callback_arg *rsm_resource_callback_arg_t;
43 
44 typedef void (*rsm_resource_callback_t)(rsm_resource_callback_arg_t);
45 
46 struct __rsm_callback_arg;
47 typedef struct __rsm_callback_arg *rsm_callback_arg_t;
48 
49 typedef void (*rsm_callback_t)(rsm_callback_arg_t);
50 
51 /* Values for resource callback function pointer */
52 #define	RSM_RESOURCE_SLEEP	(rsm_resource_callback_t)0
53 #define	RSM_RESOURCE_DONTWAIT	(rsm_resource_callback_t)-1
54 
55 /* rsm_seg_create() flags values */
56 #define	RSM_ALLOW_UNBIND_REBIND		0x01
57 
58 typedef uint_t rsm_intr_t;
59 typedef rsm_intr_t rsm_intr_service_t;
60 /* The following definitions used to describe the ranges fro rsm_intr_t */
61 #define	RSM_INTR_T_DRV_BASE		0
62 #define	RSM_INTR_T_DRV_END		0x3F
63 #define	RSM_INTR_T_FRM_BASE		0x40
64 #define	RSM_INTR_T_FRM_END		0x4F
65 #define	RSM_INTR_T_RESERVED_BASE	0x50
66 #define	RSM_INTR_T_RESERVED_END		0x5F
67 #define	RSM_INTR_T_SUN_BASE		0x60
68 #define	RSM_INTR_T_SUN_END		0xDF
69 #define	RSM_INTR_T_USR_BASE		0xE0
70 #define	RSM_INTR_T_USR_END		0xFF
71 #define	RSM_INTR_T_NSVC			0x100
72 
73 /* kstat's ks_name for RSMPI controller drivers */
74 #define	RSM_KS_NAME			"rsmpi_stat"
75 
76 /* named kstat component names */
77 #define	RSM_KS_CTLR_STATE		"ctlr_state"	/* CHAR */
78 #define	RSM_KS_ADDR			"addr"		/* UINT64 */
79 #define	RSM_KS_EX_MEMSEGS		"ex_memsegs"	/* UINT32 */
80 #define	RSM_KS_EX_MEMSEGS_PUB		"ex_memsegs_pub"	/* UINT32 */
81 #define	RSM_KS_EX_MEMSEGS_CON		"ex_memsegs_con"	/* UINT32 */
82 #define	RSM_KS_BYTES_BOUND		"bytes_bound"		/* UINT64 */
83 #define	RSM_KS_IM_MEMSEGS_CON		"im_memsegs_con"	/* UINT32 */
84 #define	RSM_KS_SENDQS			"sendqs"		/* UINT64 */
85 #define	RSM_KS_HANDLERS			"handlers"		/* UINT64 */
86 
87 /* The following are the possible values of RSM_KS_CTLR_STATE */
88 #define	RSM_AE_CTLR_DOWN	"rsm_down"
89 #define	RSM_AE_CTLR_UP		"rsm_up"
90 
91 
92 struct __rsm_send_q_handle;
93 typedef struct __rsm_send_q_handle *rsm_send_q_handle_t;
94 
95 /* rsm_intr_send_q_create flags values */
96 #define	RSM_INTR_SEND_Q_NO_FENCE	0x1
97 #define	RSM_INTR_SEND_Q_FULL_FAIL	0x2
98 #define	RSM_INTR_SEND_Q_UNRELIABLE	0x4
99 
100 typedef struct {
101 	void	*is_data;
102 	size_t	is_size;
103 	int	is_flags;
104 	clock_t	is_wait;
105 } rsm_send_t;
106 
107 /* rsm_send_t flags values */
108 #define	RSM_INTR_SEND_QUEUE		0x1
109 #define	RSM_INTR_SEND_DELIVER		0x2
110 #define	RSM_INTR_SEND_POLL		0x4
111 #define	RSM_INTR_SEND_SLEEP		0x8
112 #define	RSM_INTR_SEND_LOWER_FENCE	0x10
113 
114 typedef enum {
115 	RSM_INTR_HAND_UNCLAIMED = 0,
116 	RSM_INTR_HAND_CLAIMED = 1,
117 	RSM_INTR_HAND_CLAIMED_EXCLUSIVE = 2
118 } rsm_intr_hand_ret_t;
119 
120 typedef enum {
121 	RSM_INTR_Q_OP_CREATE,
122 	RSM_INTR_Q_OP_CONFIGURE,
123 	RSM_INTR_Q_OP_DESTROY,
124 	RSM_INTR_Q_OP_RECEIVE,
125 	RSM_INTR_Q_OP_DROP
126 } rsm_intr_q_op_t;
127 
128 struct __rsm_intr_hand_arg;
129 typedef struct __rsm_intr_hand_arg *rsm_intr_hand_arg_t;
130 
131 struct __rsm_registry_item;
132 typedef struct __rsm_registry_item *rsm_registry_item_t;
133 
134 typedef int   rsm_intr_pri_t;
135 
136 typedef struct {
137 	rsm_addr_t	 ae_addr;	/* node hwaddr allowed access */
138 	rsm_permission_t ae_permission;	/* permissions for node */
139 } rsm_access_entry_t;
140 /*
141  * ae_addr can be set to the following value to mean that the permissions
142  * should apply to all nodes accessible through this RSM controller
143  */
144 #define	RSM_ACCESS_PUBLIC	0xFFFF
145 
146 struct __rsm_controller_handle;
147 typedef struct __rsm_controller_handle *rsm_controller_handle_t;
148 
149 /*
150  * The following typedef is used to represent a controller object.
151  */
152 typedef struct rsm_controller_object {
153 	struct rsm_ops *ops;
154 	rsm_controller_handle_t handle;
155 } rsm_controller_object_t;
156 
157 typedef rsm_intr_hand_ret_t (*rsm_intr_hand_t)(
158     rsm_controller_object_t *controller,
159     rsm_intr_q_op_t operation,
160     rsm_addr_t sender,
161     void *data,
162     size_t size,
163     rsm_intr_hand_arg_t arg);
164 
165 typedef struct {
166 	enum { RSM_MEM_VADDR,
167 		RSM_MEM_BUF,
168 		RSM_MEM_HANDLE,
169 		RSM_MEM_INVALID } ms_type;
170 	union {
171 		struct {
172 			void *vaddr;
173 			size_t length;
174 			ddi_as_handle_t as;
175 		} vr;
176 		struct buf *bp;
177 		rsm_memseg_export_handle_t	handle;
178 	} ms_memory;
179 #define	ms_bp		ms_memory.bp
180 #define	ms_vaddr	ms_memory.vr.vaddr
181 #define	ms_length	ms_memory.vr.length
182 #define	ms_as		ms_memory.vr.as
183 } rsm_memory_local_t;
184 
185 typedef struct {
186 	rsm_memory_local_t		local_mem;
187 	size_t				local_offset;
188 	rsm_memseg_import_handle_t	remote_handle;
189 	size_t				remote_offset;
190 	size_t				transfer_length;
191 } rsmpi_iovec_t;
192 
193 typedef struct {
194 	ulong_t		io_request_count;	/* size of iovec array */
195 	ulong_t		io_residual_count;	/* zero for success    */
196 	uio_seg_t	io_segflg;		/* user/kernel addr    */
197 	rsmpi_iovec_t	*iovec;			/* ptr to array		*/
198 } rsmpi_scat_gath_t;
199 
200 typedef struct {
201 	char			*attr_name;
202 	rsm_addr_t		attr_controller_addr;
203 	uint_t			attr_direct_access_sizes;
204 	uint_t			attr_atomic_sizes;
205 	uint_t			attr_error_sizes;
206 	uint_t			attr_error_behavior;
207 	boolean_t		attr_mmu_protections;
208 	size_t			attr_page_size;
209 	size_t			attr_max_export_segment_size;
210 	size_t			attr_tot_export_segment_size;
211 	ulong_t			attr_max_export_segments;
212 	size_t			attr_max_import_map_size;
213 	size_t			attr_tot_import_map_size;
214 	ulong_t			attr_max_import_segments;
215 	boolean_t		attr_io_space_exportable;
216 	boolean_t		attr_imported_space_ioable;
217 	boolean_t		attr_intr_sender_ident;
218 	size_t			attr_intr_data_size_max;
219 	uint_t			attr_intr_data_align;
220 	boolean_t		attr_intr_piggyback;
221 	boolean_t	attr_resource_callbacks;
222 } rsm_controller_attr_t;
223 
224 /*
225  * The following three defines are possible values for attr_error_behavior
226  * field of the rsm_controller_attr_t struct.
227  */
228 #define	RSM_ERR_NOCHANGE	0
229 #define	RSM_ERR_ZEROES		0x1
230 #define	RSM_ERR_RANDOM		0x2
231 
232 typedef struct rsm_ops {
233 
234 	/*
235 	 * structure revision number:
236 	 */
237 	uint_t rsm_version;
238 
239 	/*
240 	 * export side memory segment operations:
241 	 */
242 	int (*rsm_seg_create)
243 	    (rsm_controller_handle_t controller,
244 	    rsm_memseg_export_handle_t *memseg,
245 	    size_t	size,
246 	    uint_t	flags,
247 	    rsm_memory_local_t *memory,
248 	    rsm_resource_callback_t callback,
249 	    rsm_resource_callback_arg_t callback_arg);
250 	int (*rsm_seg_destroy)
251 	    (rsm_memseg_export_handle_t handle);
252 	int (*rsm_bind)
253 	    (rsm_memseg_export_handle_t memseg,
254 	    off_t offset,
255 	    rsm_memory_local_t *memory,
256 	    rsm_resource_callback_t callback,
257 	    rsm_resource_callback_arg_t callback_arg);
258 	int (*rsm_unbind)
259 	    (rsm_memseg_export_handle_t memseg,
260 	    off_t offset,
261 	    size_t length);
262 	int (*rsm_rebind)
263 	    (rsm_memseg_export_handle_t memseg,
264 	    off_t offset,
265 	    rsm_memory_local_t *memory,
266 	    rsm_resource_callback_t callback,
267 	    rsm_resource_callback_arg_t callback_arg);
268 	int (*rsm_publish)
269 	    (rsm_memseg_export_handle_t memseg,
270 	    rsm_access_entry_t access_list[],
271 	    uint_t access_list_length,
272 	    rsm_memseg_id_t segment_id,
273 	    rsm_resource_callback_t callback,
274 	    rsm_resource_callback_arg_t callback_arg);
275 	int (*rsm_unpublish)
276 	    (rsm_memseg_export_handle_t memseg);
277 	int (*rsm_republish)
278 	    (rsm_memseg_export_handle_t memseg,
279 	    rsm_access_entry_t access_list[],
280 	    uint_t access_list_length,
281 	    rsm_resource_callback_t callback,
282 	    rsm_resource_callback_arg_t callback_arg);
283 
284 	/*
285 	 * import side memory segment operations
286 	 */
287 	int (*rsm_connect)
288 	    (rsm_controller_handle_t controller,
289 	    rsm_addr_t addr,
290 	    rsm_memseg_id_t segment_id,
291 	    rsm_memseg_import_handle_t *im_memseg);
292 
293 	int (*rsm_disconnect)
294 	    (rsm_memseg_import_handle_t im_memseg);
295 
296 	/*
297 	 * import side memory segment operations (read access functions):
298 	 */
299 	int (* rsm_get8)
300 	    (rsm_memseg_import_handle_t im_memseg,
301 	    off_t offset,
302 	    uint8_t *datap,
303 	    ulong_t rep_cnt,
304 	    boolean_t byte_swap);
305 	int (* rsm_get16)
306 	    (rsm_memseg_import_handle_t im_memseg,
307 	    off_t offset,
308 	    uint16_t *datap,
309 	    ulong_t rep_cnt,
310 	    boolean_t byte_swap);
311 	int (* rsm_get32)
312 	    (rsm_memseg_import_handle_t im_memseg,
313 	    off_t offset,
314 	    uint32_t *datap,
315 	    ulong_t rep_cnt,
316 	    boolean_t byte_swap);
317 	int (* rsm_get64)
318 	    (rsm_memseg_import_handle_t im_memseg,
319 	    off_t offset,
320 	    uint64_t *datap,
321 	    ulong_t rep_cnt,
322 	    boolean_t byte_swap);
323 	int (* rsm_get)
324 	    (rsm_memseg_import_handle_t im_memseg,
325 	    off_t offset,
326 	    void *datap,
327 	    size_t length);
328 
329 	/*
330 	 * import side memory segment operations (write access functions)
331 	 */
332 	int (* rsm_put8)
333 	    (rsm_memseg_import_handle_t im_memseg,
334 	    off_t offset,
335 	    uint8_t *datap,
336 	    ulong_t rep_cnt,
337 	    boolean_t byte_swap);
338 	int (* rsm_put16)
339 	    (rsm_memseg_import_handle_t im_memseg,
340 	    off_t offset,
341 	    uint16_t *datap,
342 	    ulong_t rep_cnt,
343 	    boolean_t byte_swap);
344 	int (* rsm_put32)
345 	    (rsm_memseg_import_handle_t im_memseg,
346 	    off_t offset,
347 	    uint32_t *datap,
348 	    ulong_t rep_cnt,
349 	    boolean_t byte_swap);
350 	int (* rsm_put64)
351 	    (rsm_memseg_import_handle_t im_memseg,
352 	    off_t offset,
353 	    uint64_t *datap,
354 	    ulong_t rep_cnt,
355 	    boolean_t byte_swap);
356 	int (* rsm_put)
357 	    (rsm_memseg_import_handle_t im_memseg,
358 	    off_t offset,
359 	    void *datap,
360 	    size_t length);
361 
362 	/*
363 	 * import side memory segment operations (mapping)
364 	 */
365 	int (*rsm_map)(rsm_memseg_import_handle_t im_memseg,
366 	    off_t offset,
367 	    size_t len,
368 	    size_t *maplen,
369 	    dev_info_t **dipp,
370 	    uint_t *register_number,
371 	    off_t *register_offset,
372 	    rsm_resource_callback_t callback,
373 	    rsm_resource_callback_arg_t callback_arg);
374 
375 	int (*rsm_unmap)
376 	    (rsm_memseg_import_handle_t im_memseg);
377 
378 	/*
379 	 * import side memory segment operations (barriers):
380 	 */
381 	int (* rsm_open_barrier_region)
382 	    (rsm_memseg_import_handle_t region,
383 	    rsm_barrier_t *barrier);
384 	int (* rsm_open_barrier_regions)
385 	    (rsm_memseg_import_handle_t regions[],
386 	    uint_t num_regions,
387 	    rsm_barrier_t *barrier);
388 	int (* rsm_open_barrier_node)
389 	    (rsm_controller_handle_t controller,
390 	    rsm_addr_t addr,
391 	    rsm_barrier_t *barrier);
392 	int (* rsm_open_barrier_ctrl)
393 	    (rsm_controller_handle_t controller,
394 	    rsm_barrier_t *barrier);
395 	int (* rsm_open_barrier_region_thr)
396 	    (rsm_memseg_import_handle_t region,
397 	    rsm_barrier_t *barrier);
398 	int (* rsm_open_barrier_regions_thr)
399 	    (rsm_memseg_import_handle_t regions[],
400 	    uint_t num_regions,
401 	    rsm_barrier_t *barrier);
402 	int (* rsm_open_barrier_node_thr)
403 	    (rsm_controller_handle_t controller,
404 	    rsm_addr_t addr,
405 	    rsm_barrier_t *barrier);
406 	int (* rsm_open_barrier_ctrl_thr)
407 	    (rsm_controller_handle_t controller,
408 	    rsm_barrier_t *barrier);
409 	int (* rsm_close_barrier)
410 	    (rsm_barrier_t *barrier);
411 	int (* rsm_reopen_barrier)
412 	    (rsm_barrier_t *barrier);
413 	int (* rsm_order_barrier)
414 	    (rsm_barrier_t *barrier);
415 	int (* rsm_thread_init)
416 	    (rsm_controller_handle_t controller);
417 	int (* rsm_thread_fini)
418 	    (rsm_controller_handle_t controller);
419 	int (* rsm_get_barrier_mode)
420 	    (rsm_memseg_import_handle_t im_memseg,
421 	    rsm_barrier_mode_t *mode);
422 	int (* rsm_set_barrier_mode)
423 	    (rsm_memseg_import_handle_t im_memseg,
424 	    rsm_barrier_mode_t mode);
425 
426 	/*
427 	 * sending side interrupt operations:
428 	 */
429 	int (* rsm_sendq_create)
430 	    (rsm_controller_handle_t controller,
431 	    rsm_addr_t addr,
432 	    rsm_intr_service_t service,
433 	    rsm_intr_pri_t pri,
434 	    ulong_t qdepth,
435 	    uint_t flags,
436 	    rsm_resource_callback_t callback,
437 	    rsm_resource_callback_arg_t arg,
438 	    rsm_send_q_handle_t *iqp);
439 	int (* rsm_sendq_config)
440 	    (rsm_send_q_handle_t iq,
441 	    rsm_intr_pri_t pri,
442 	    ulong_t qdepth,
443 	    uint_t flags,
444 	    rsm_resource_callback_t callback,
445 	    rsm_resource_callback_arg_t arg);
446 	int (* rsm_sendq_destroy)
447 	    (rsm_send_q_handle_t iq);
448 	int (* rsm_send)
449 	    (rsm_send_q_handle_t iq,
450 	    rsm_send_t *is,
451 	    rsm_barrier_t *barrier);
452 
453 
454 	/*
455 	 * receiving side interrupt operations:
456 	 */
457 	int (* rsm_register_handler)
458 	    (rsm_controller_handle_t controller,
459 	    rsm_controller_object_t *controller_obj,
460 	    rsm_intr_t type,
461 	    rsm_intr_hand_t handler,
462 	    rsm_intr_hand_arg_t handler_arg,
463 	    rsm_addr_t senders_list[],
464 	    uint_t senders_list_length);
465 
466 	int (* rsm_unregister_handler)
467 	    (rsm_controller_handle_t controller,
468 	    rsm_intr_t type,
469 	    rsm_intr_hand_t handler,
470 	    rsm_intr_hand_arg_t handler_arg);
471 
472 
473 	/* scatter-gather I/O */
474 	int (* rsm_memseg_import_getv)
475 	    (rsm_controller_handle_t cp,
476 	    rsmpi_scat_gath_t *sg_io);
477 	int (* rsm_memseg_import_putv)
478 	    (rsm_controller_handle_t cp,
479 	    rsmpi_scat_gath_t *sg_io);
480 
481 	/* Management operation */
482 	int (*rsm_get_peers)
483 	    (rsm_controller_handle_t controller,
484 	    rsm_addr_t *addr_list,
485 	    uint_t count,
486 	    uint_t *num_addrs);
487 
488 	/* Extension operation */
489 	int (*rsm_extension)
490 	    (rsm_controller_handle_t controller,
491 	    char *extname,
492 	    void *extobj);
493 
494 } rsm_ops_t;
495 
496 /*
497  * service module function templates:
498  */
499 
500 int rsm_get_controller(const char *name, uint_t number,
501     rsm_controller_object_t *controller,
502     uint_t version);
503 
504 int rsm_release_controller(const char *name, uint_t number,
505     rsm_controller_object_t *controller);
506 
507 int rsm_get_controller_attr(rsm_controller_handle_t,
508     rsm_controller_attr_t **attrp);
509 /*
510  * MACROS for Clients requesting services via RSMPI module
511  */
512 
513 /*
514  * Export Side segment operations
515  */
516 
517 #define	RSM_SEG_CREATE(controller, memseg, size, flags, memory, callback, \
518 	callback_arg) \
519 	(*((controller).ops->rsm_seg_create)) \
520 	((controller).handle, (memseg), (size), (flags), (memory), \
521 	(callback), (callback_arg))
522 #define	RSM_SEG_DESTROY(controller, memseg) \
523 	(*((controller).ops->rsm_seg_destroy)) \
524 	((memseg))
525 #define	RSM_BIND(controller, memseg, offset, memory, callback, \
526 	callback_arg) \
527 	(*((controller).ops->rsm_bind)) \
528 	((memseg), offset, (memory), (callback), (callback_arg))
529 #define	RSM_UNBIND(controller, memseg, offset, length) \
530 	(*((controller).ops->rsm_unbind)) \
531 	((memseg), (offset), (length))
532 #define	RSM_REBIND(controller, memseg, offset, memory, callback, \
533 	callback_arg) \
534 	(*((controller).ops->rsm_rebind)) \
535 	((memseg), offset, (memory), (callback), (callback_arg))
536 #define	RSM_PUBLISH(controller, memseg, access_list, access_list_length, \
537 	segment_id, callback, callback_arg) \
538 	(*((controller).ops->rsm_publish)) \
539 	((memseg), access_list,	access_list_length, segment_id, \
540 	(callback), (callback_arg))
541 #define	RSM_UNPUBLISH(controller, memseg) \
542 	(*((controller).ops->rsm_unpublish)) \
543 	((memseg))
544 #define	RSM_REPUBLISH(controller, memseg,  access_list, access_list_length, \
545 	callback, callback_arg) \
546 	(*((controller).ops->rsm_republish)) \
547 	((memseg), (access_list), (access_list_length), (callback), \
548 	(callback_arg))
549 #define	RSM_CONNECT(controller, addr, segment_id, im_memseg) \
550 	(*((controller).ops->rsm_connect)) \
551 	((controller).handle, (addr), (segment_id), (im_memseg))
552 #define	RSM_DISCONNECT(controller, im_memseg) \
553 	(*((controller).ops->rsm_disconnect))  \
554 	((im_memseg))
555 
556 	/*
557 	 * import side memory segment operations (read access functions)
558 	 */
559 
560 #define	RSM_GET8(controller, im_memseg, offset, datap, rep_cnt, byte_swap) \
561 	(*((controller).ops->rsm_get8)) \
562 	((im_memseg), (offset), (datap), (rep_cnt), (byte_swap))
563 #define	RSM_GET16(controller, im_memseg, offset, datap, rep_cnt, byte_swap) \
564 	(*((controller).ops->rsm_get16)) \
565 	((im_memseg), (offset), (datap), (rep_cnt), (byte_swap))
566 #define	RSM_GET32(controller, im_memseg, offset, datap, rep_cnt, byte_swap) \
567 	(*((controller).ops->rsm_get32)) \
568 	((im_memseg), (offset), (datap), (rep_cnt), (byte_swap))
569 #define	RSM_GET64(controller, im_memseg, offset, datap, rep_cnt, byte_swap) \
570 	(*((controller).ops->rsm_get64)) \
571 	((im_memseg), (offset), (datap), (rep_cnt), (byte_swap))
572 #define	RSM_GET(controller, im_memseg, offset, dst_addr, length) \
573 	(*((controller).ops->rsm_get)) \
574 	((im_memseg), (offset), (dst_addr), (length))
575 
576 	/*
577 	 * import side memory segment operations (write access functions)
578 	 */
579 
580 #define	RSM_PUT8(controller, im_memseg, offset, datap, rep_cnt, byte_swap) \
581 	(*((controller).ops->rsm_put8)) \
582 	((im_memseg), (offset), (datap), (rep_cnt), (byte_swap))
583 #define	RSM_PUT16(controller, im_memseg, offset, datap, rep_cnt, byte_swap) \
584 	(*((controller).ops->rsm_put16)) \
585 	((im_memseg), (offset), (datap), (rep_cnt), (byte_swap))
586 #define	RSM_PUT32(controller, im_memseg, offset, datap, rep_cnt, byte_swap) \
587 	(*((controller).ops->rsm_put32)) \
588 	((im_memseg), (offset), (datap), (rep_cnt), (byte_swap))
589 #define	RSM_PUT64(controller, im_memseg, offset, datap, rep_cnt, byte_swap) \
590 	(*((controller).ops->rsm_put64)) \
591 	((im_memseg), (offset), (datap), (rep_cnt), (byte_swap))
592 #define	RSM_PUT(controller, im_memseg, offset, datap, length) \
593 	(*((controller).ops->rsm_put)) \
594 	((im_memseg), (offset), (datap), (length))
595 
596 	/*
597 	 * import side memory segment operations (mapping):
598 	 */
599 
600 #define	RSM_MAP(controller, im_memseg, offset, length, maplen, dipp, \
601 	dev_register, dev_offset, callback, arg) \
602 	(*((controller).ops->rsm_map)) \
603 	((im_memseg), (offset), (length), (maplen), (dipp), (dev_register), \
604 	(dev_offset), (callback), (arg))
605 #define	RSM_UNMAP(controller, im_memseg) \
606 	(*((controller).ops->rsm_unmap)) \
607 	((im_memseg))
608 
609 	/*
610 	 * import side memory segment operations (barriers):
611 	 */
612 
613 #define	RSM_OPEN_BARRIER_REGION(controller, region, barrier) \
614 	(*((controller).ops->rsm_open_barrier_region)) \
615 	((region), (barrier))
616 #define	RSM_OPEN_BARRIER_REGIONS(controller, regions, num_regions, barrier) \
617 	(*((controller).ops->rsm_open_barrier_regions)) \
618 	((regions), (num_regions), (barrier))
619 #define	RSM_OPEN_BARRIER_NODE(controller, addr, barrier) \
620 	(*((controller).ops-> rsm_open_barrier_node)) \
621 	((controller).handle, (addr), (barrier))
622 #define	RSM_OPEN_BARRIER_CTRL(controller, barrier) \
623 	(*((controller).ops->rsm_open_barrier_ctrl)) \
624 	((controller).handle, (barrier))
625 #define	RSM_OPEN_BARRIER_REGION_THR(controller, region, barrier) \
626 	(*((controller).ops->rsm_open_barrier_region_thr)) \
627 	((region), (barrier))
628 #define	RSM_OPEN_BARRIER_REGIONS_THR(controller, regions, num_regions, barrier)\
629 	(*((controller).ops->rsm_open_barrier_regions_thr)) \
630 	((regions), (num_regions), (barrier))
631 #define	RSM_OPEN_BARRIER_NODE_THR(controller, addr, barrier) \
632 	(*((controller).ops->rsm_open_barrier_node_thr)) \
633 	((controller).handle, (addr), (barrier))
634 #define	RSM_OPEN_BARRIER_CTRL_THR(controller, barrier) \
635 	(*((controller).ops->rsm_open_barrier_ctrl_thr)) \
636 	((controller).handle, (barrier));
637 #define	RSM_CLOSE_BARRIER(controller, barrier) \
638 	(*((controller).ops->rsm_close_barrier)) \
639 	((barrier))
640 #define	RSM_REOPEN_BARRIER(controller, barrier) \
641 	(*((controller).ops->rsm_reopen_barrier)) \
642 	((barrier));
643 #define	RSM_ORDER_BARRIER(controller, barrier) \
644 	(*((controller).ops->rsm_order_barrier)) \
645 	((barrier))
646 #define	RSM_THREAD_INIT(controller) \
647 	(*((controller).ops->rsm_thread_init)) \
648 	((controller).handle)
649 #define	RSM_THREAD_FINI(controller) \
650 	(*((controller).ops->rsm_thread_fini)) \
651 	((controller).handle)
652 #define	RSM_GET_BARRIER_MODE(controller, im_memseg, mode) \
653 	(*((controller).ops->rsm_get_barrier_mode)) \
654 	((im_memseg), (mode))
655 #define	RSM_SET_BARRIER_MODE(controller, im_memseg, mode) \
656 	(*((controller).ops->rsm_set_barrier_mode)) \
657 	((im_memseg), (mode))
658 	/*
659 	 * sending side interrupt operations:
660 	 */
661 
662 #define	RSM_SENDQ_CREATE(controller, addr, service, pri, qdepth, flags, \
663 	callback, arg, iqp) \
664 	(*((controller).ops->rsm_sendq_create)) \
665 	((controller).handle, (addr), (service), (pri), (qdepth), (flags), \
666 	(callback), (arg),  (iqp))
667 #define	RSM_SENDQ_CONFIG(controller, iq, pri, qdepth, flags, callback, arg) \
668 	(*((controller).ops->rsm_sendq_config)) \
669 	((iq),  (pri),  (qdepth), (flags), \
670 	(callback), (arg))
671 #define	RSM_SENDQ_DESTROY(controller, iq) \
672 	(*((controller).ops->rsm_sendq_destroy)) \
673 	((iq))
674 #define	RSM_SEND(controller, iq, is, barrier) \
675 	(*((controller).ops->rsm_send)) \
676 	((iq), (is), (barrier))
677 
678 	/*
679 	 * receiving side interrupt operations:
680 	 */
681 #define	RSM_REGISTER_HANDLER(controller, type, handler, handler_arg, \
682 	senders_list, senders_list_length) \
683 	(*((controller).ops->rsm_register_handler)) \
684 	((controller).handle, &(controller), (type), (handler), (handler_arg), \
685 	(senders_list), (senders_list_length))
686 #define	RSM_UNREGISTER_HANDLER(controller, type, handler, handler_arg) \
687 	(*((controller).ops->rsm_unregister_handler))  \
688 	((controller).handle, (type), (handler), (handler_arg))
689 #define	RSM_GETV(controller, sg_io) \
690 	(*((controller).ops->rsm_memseg_import_getv)) \
691 	((controller).handle, (sg_io))
692 #define	RSM_PUTV(controller, sg_io) \
693 	(*((controller).ops->rsm_memseg_import_putv)) \
694 	((controller).handle, (sg_io))
695 #define	RSM_GET_PEERS(controller, addr_list, count, num_addrs) \
696 	(*((controller).ops->rsm_get_peers)) \
697 	((controller).handle, (addr_list), (count), (num_addrs))
698 #define	RSM_EXTENSION(controller, extname, extobj) \
699 	(*((controller).ops->rsm_extension)) \
700 	((controller).handle, (extname), (extobj))
701 
702 #ifdef	__cplusplus
703 }
704 #endif
705 
706 
707 #endif	/* _SYS_RSM_RSMPI_H */
708