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
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.
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]
23 * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
37 #include <sys/param.h>
38 #include <sys/rsm/rsm_common.h>
39 #include <sys/rsm/rsmapi_common.h>
44 RSM_MAP_RESERVED
= 0x2
48 * Topology data structures - The primary structure is struct rsm_topology_t
50 * The key interconnect data required for segment operations includes the
51 * cluster nodeids and the controllers (name, hardware address); with
52 * the fundamental constraint that the controller specified for a segment
53 * import must have a physical connection with the contorller used in the
54 * export of the segment. To facilitate applications in the establishment
55 * of proper and efficient export and import policies, a delineation of the
56 * interconnect topology is provided by these data structures.
61 #define RSM_CONNECTION_ACTIVE 3
64 typedef struct rsm_topology_hdr
{
65 rsm_node_id_t local_nodeid
;
66 uint_t local_cntlr_count
;
70 typedef struct rsm_connections_hdr
{
71 char cntlr_name
[MAXNAMELEN
]; /* <cntlr_type><unit> */
72 rsm_addr_t local_hwaddr
;
73 int remote_cntlr_count
;
74 } rsm_connections_hdr_t
;
78 * The remote cntrlname element should be used for matching with the
79 * cntrlname of an exported segment.
81 * An application must not attempt to use a connection unless the
82 * the connection_state element of struct rsm_remote_cntlr_t is equal to
83 * RSM_CONNECTION_ACTIVE
85 typedef struct rsm_remote_cntlr
{
86 rsm_node_id_t remote_nodeid
;
87 char remote_cntlrname
[MAXNAMELEN
];
88 rsm_addr_t remote_hwaddr
;
89 uint_t connection_state
;
94 * The actual size of the remote_cntlr array is equal to the remote_cntlr_count
95 * of the rsm_connections_hdr_t struct.
97 typedef struct rsm_connection
{
98 rsm_connections_hdr_t hdr
;
99 rsm_remote_cntlr_t remote_cntlr
[1];
104 * A pointer to an instance of this structure type is returned by a call
105 * to rsm_get_interconnect_topology(). The actual size of the connections
106 * array is equal to the local_cntlr_count of the rsm_topology_hdr_t struct.
108 typedef struct rsm_topology
{
109 rsm_topology_hdr_t topology_hdr
;
110 rsm_connections_t
*connections
[1];
114 * function templates:
117 int rsm_get_controller(char *name
, rsmapi_controller_handle_t
*controller
);
119 int rsm_get_controller_attr(rsmapi_controller_handle_t chdl
,
120 rsmapi_controller_attr_t
*attr
);
122 int rsm_release_controller(rsmapi_controller_handle_t controller
);
125 * Export side memory segment operations
127 int rsm_memseg_export_create(rsmapi_controller_handle_t controller
,
128 rsm_memseg_export_handle_t
*memseg
,
129 void *vaddr
, size_t size
, uint_t flags
);
132 int rsm_memseg_export_destroy(rsm_memseg_export_handle_t memseg
);
136 int rsm_memseg_export_rebind(rsm_memseg_export_handle_t memseg
,
137 void *vaddr
, offset_t off
, size_t size
);
141 int rsm_memseg_export_publish(rsm_memseg_export_handle_t memseg
,
142 rsm_memseg_id_t
*segment_id
,
143 rsmapi_access_entry_t access_list
[],
144 uint_t access_list_length
);
147 int rsm_memseg_export_unpublish(rsm_memseg_export_handle_t memseg
);
149 int rsm_memseg_export_republish(rsm_memseg_export_handle_t memseg
,
150 rsmapi_access_entry_t access_list
[],
151 uint_t access_list_length
);
160 * import side memory segment operations:
163 int rsm_memseg_import_connect(rsmapi_controller_handle_t controller
,
164 rsm_node_id_t node_id
,
165 rsm_memseg_id_t segment_id
,
166 rsm_permission_t perm
,
167 rsm_memseg_import_handle_t
*im_memseg
);
170 int rsm_memseg_import_disconnect(rsm_memseg_import_handle_t im_memseg
);
175 * import side memory segment operations (read access functions):
177 int rsm_memseg_import_get8(rsm_memseg_import_handle_t im_memseg
,
181 int rsm_memseg_import_get16(rsm_memseg_import_handle_t im_memseg
,
185 int rsm_memseg_import_get32(rsm_memseg_import_handle_t im_memseg
,
189 int rsm_memseg_import_get64(rsm_memseg_import_handle_t im_memseg
,
193 int rsm_memseg_import_get(rsm_memseg_import_handle_t im_memseg
,
198 int rsm_memseg_import_getv(rsm_scat_gath_t
*);
203 * import side memory segment operations (write access functions):
205 int rsm_memseg_import_put8(rsm_memseg_import_handle_t im_memseg
,
209 int rsm_memseg_import_put16(rsm_memseg_import_handle_t im_memseg
,
213 int rsm_memseg_import_put32(rsm_memseg_import_handle_t im_memseg
,
217 int rsm_memseg_import_put64(rsm_memseg_import_handle_t im_memseg
,
221 int rsm_memseg_import_put(rsm_memseg_import_handle_t im_memseg
,
226 int rsm_memseg_import_putv(rsm_scat_gath_t
*);
230 * import side memory segment operations (mapping):
232 int rsm_memseg_import_map(rsm_memseg_import_handle_t im_memseg
,
234 rsm_attribute_t attr
,
235 rsm_permission_t perm
,
236 off_t offset
, size_t length
);
241 int rsm_memseg_import_unmap(rsm_memseg_import_handle_t im_memseg
);
246 * import side memory segment operations (barriers):
249 int rsm_memseg_import_init_barrier(rsm_memseg_import_handle_t im_memseg
,
250 rsm_barrier_type_t type
,
251 rsmapi_barrier_t
*barrier
);
254 int rsm_memseg_import_open_barrier(rsmapi_barrier_t
*barrier
);
257 int rsm_memseg_import_close_barrier(rsmapi_barrier_t
*barrier
);
259 int rsm_memseg_import_order_barrier(rsmapi_barrier_t
*barrier
);
261 int rsm_memseg_import_destroy_barrier(rsmapi_barrier_t
*barrier
);
263 int rsm_memseg_import_get_mode(rsm_memseg_import_handle_t im_memseg
,
264 rsm_barrier_mode_t
*mode
);
266 int rsm_memseg_import_set_mode(rsm_memseg_import_handle_t im_memseg
,
267 rsm_barrier_mode_t mode
);
272 int rsm_intr_signal_post(void * im_memseg
, uint_t flags
);
274 int rsm_intr_signal_wait(void * im_memseg
, int timeout
);
276 int rsm_memseg_get_pollfd(void *, struct pollfd
*);
277 int rsm_memseg_release_pollfd(void *);
279 int rsm_get_interconnect_topology(rsm_topology_t
**);
280 void rsm_free_interconnect_topology(rsm_topology_t
*);
282 int rsm_create_localmemory_handle(rsmapi_controller_handle_t
,
283 rsm_localmemory_handle_t
*,
286 int rsm_free_localmemory_handle(rsmapi_controller_handle_t
,
287 rsm_localmemory_handle_t
);
289 int rsm_get_segmentid_range(const char *, rsm_memseg_id_t
*, uint32_t *);
291 int rsm_intr_signal_wait_pollfd(struct pollfd
[], nfds_t
, int, int *);
297 #endif /* _RSMAPI_H */