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) 1999-2001 by Sun Microsystems, Inc. 24 * All rights reserved. 25 */ 26 27 #ifndef _SYS_RSM_RSM_COMMON_H 28 #define _SYS_RSM_RSM_COMMON_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #define RSM_VERSION 5 35 36 /* Return values for RSMAPI */ 37 #define RSM_SUCCESS 0 38 #define RSMERR_BAD_LIBRARY_VERSION 1 39 #define RSMERR_BAD_TOPOLOGY_PTR 2 40 #define RSMERR_BAD_CTLR_HNDL 3 41 #define RSMERR_CTLR_NOT_PRESENT 4 42 #define RSMERR_BAD_SEG_HNDL 5 43 #define RSMERR_SEG_ALREADY_PUBLISHED 6 44 #define RSMERR_SEG_NOT_PUBLISHED 7 45 #define RSMERR_SEG_NOT_PUBLISHED_TO_NODE 8 46 #define RSMERR_SEG_ALREADY_MAPPED 9 47 #define RSMERR_SEG_STILL_MAPPED 10 48 #define RSMERR_SEG_NOT_MAPPED 11 49 #define RSMERR_NOT_CREATOR 12 50 #define RSMERR_BAD_BARRIER_PTR 13 51 #define RSMERR_BAD_SGIO 14 52 #define RSMERR_BAD_LOCALMEM_HNDL 15 53 #define RSMERR_BAD_ADDR 16 54 #define RSMERR_BAD_MEM_ALIGNMENT 17 55 #define RSMERR_BAD_OFFSET 18 56 #define RSMERR_MISALIGNED_OFFSET 19 57 #define RSMERR_BAD_LENGTH 20 58 #define RSMERR_BAD_ACL 21 59 #define RSMERR_BAD_SEGID 22 60 #define RSMERR_RESERVED_SEGID 23 61 #define RSMERR_SEGID_IN_USE 24 62 #define RSMERR_BAD_MODE 25 63 #define RSMERR_BAD_PERMS 26 64 #define RSMERR_PERM_DENIED 27 65 #define RSMERR_LOCKS_NOT_SUPPORTED 28 66 #define RSMERR_LOCKS_NOT_ENABLED 29 67 #define RSMERR_REBIND_NOT_ALLOWED 30 68 #define RSMERR_INSUFFICIENT_RESOURCES 31 69 #define RSMERR_INSUFFICIENT_MEM 32 70 #define RSMERR_MAP_FAILED 33 71 #define RSMERR_POLLFD_IN_USE 34 72 #define RSMERR_BARRIER_UNINITIALIZED 35 73 #define RSMERR_BARRIER_OPEN_FAILED 36 74 #define RSMERR_BARRIER_NOT_OPENED 37 75 #define RSMERR_BARRIER_FAILURE 38 76 #define RSMERR_REMOTE_NODE_UNREACHABLE 39 77 #define RSMERR_CONN_ABORTED 40 78 #define RSMERR_INTERRUPTED 41 79 #define RSMERR_TIMEOUT 42 80 #define RSMERR_BAD_APPID 43 81 #define RSMERR_BAD_CONF 44 82 #define RSMERR_SEG_NOT_CONNECTED 45 83 84 /* Additional return values for RSMPI */ 85 #define RSMERR_BAD_DRIVER_VERSION 101 86 #define RSMERR_UNSUPPORTED_VERSION 102 87 #define RSMERR_DRIVER_NAME_IN_USE 103 88 #define RSMERR_DRIVER_NOT_REGISTERED 104 89 #define RSMERR_DRIVER_THREAD_RUNNING 105 90 #define RSMERR_NEED_THREAD_INIT 106 91 #define RSMERR_THREAD_NOT_INITED 107 92 #define RSMERR_CTLRS_REGISTERED 108 93 #define RSMERR_CTLR_NOT_REGISTERED 109 94 #define RSMERR_CTLR_ALREADY_REGISTERED 110 95 #define RSMERR_CTLR_IN_USE 111 96 #define RSMERR_NAME_TOO_LONG 112 97 #define RSMERR_SEG_PUBLISHED 113 98 #define RSMERR_SEG_NOT_PUBLISHED_TO_RSM_ADDR 114 99 #define RSMERR_SEG_IN_USE 115 100 #define RSMERR_BAD_SENDQ_HNDL 116 101 #define RSMERR_BAD_ARGS_ERRORS 117 102 #define RSMERR_BAD_MSTYPE 118 103 #define RSMERR_NO_BACKING_MEM 119 104 #define RSMERR_NOT_MEM 120 105 #define RSMERR_MEM_ALREADY_BOUND 121 106 #define RSMERR_MEM_NOT_BOUND 122 107 #define RSMERR_HANDLER_NOT_REGISTERED 123 108 #define RSMERR_NO_HANDLER 124 109 #define RSMERR_UNBIND_REBIND_NOT_ALLOWED 125 110 #define RSMERR_CALLBACKS_NOT_SUPPORTED 126 111 #define RSMERR_UNSUPPORTED_OPERATION 127 112 #define RSMERR_RSM_ADDR_UNREACHABLE 128 113 #define RSMERR_UNKNOWN_RSM_ADDR 129 114 #define RSMERR_BAD_BARRIER_HNDL 130 115 #define RSMERR_COMM_ERR_MAYBE_DELIVERED 131 116 #define RSMERR_COMM_ERR_NOT_DELIVERED 132 117 #define RSMERR_QUEUE_FENCE_UP 133 118 #define RSMERR_QUEUE_FULL 134 119 120 #define RSMERR_INTERNAL_ERROR 100 121 122 /* 123 * Partition segment id and service id space 124 * users should only create segments or register handlers 125 * using segment and service id's from the correct range below 126 * RSM_DRIVER_PRIVATE enforced in rsm_memseg_export_publish 127 * and rsm_memseg_import_connect 128 */ 129 130 #define RSM_DRIVER_PRIVATE_ID_BASE 0 131 #define RSM_DRIVER_PRIVATE_ID_END 0x0FFFFF 132 133 #define RSM_CLUSTER_TRANSPORT_ID_BASE 0x100000 134 #define RSM_CLUSTER_TRANSPORT_ID_END 0x1FFFFF 135 #define RSM_RSMLIB_ID_BASE 0x200000 136 #define RSM_RSMLIB_ID_END 0x2FFFFF 137 #define RSM_DLPI_ID_BASE 0x300000 138 #define RSM_DLPI_ID_END 0x3FFFFF 139 #define RSM_HPC_ID_BASE 0x400000 140 #define RSM_HPC_ID_END 0x4FFFFF 141 #define RSM_OPS_ID_BASE 0x500000 142 #define RSM_OPS_ID_END 0x5FFFFF 143 144 #define RSM_USER_APP_ID_BASE 0x80000000 145 #define RSM_USER_APP_ID_END 0xFFFFFFFF 146 147 /* 148 * The following definitions and typedef are used to describe the 149 * permissions associated with all or part of a memory segment. 150 */ 151 #define RSM_PERM_NONE 0 152 #define RSM_PERM_READ 0400 153 #define RSM_PERM_WRITE 0200 154 #define RSM_PERM_RDWR (RSM_PERM_READ|RSM_PERM_WRITE) 155 156 /* Maximum io_request_count value in rsm_scat_gath_t */ 157 #define RSM_MAX_SGIOREQS 16 158 159 /* 160 * Direct access sizes bits 161 */ 162 typedef enum { 163 RSM_DAS8 = 1, 164 RSM_DAS16 = 2, 165 RSM_DAS32 = 4, 166 RSM_DAS64 = 8 167 }rsm_access_size_t; 168 169 typedef uint64_t rsm_addr_t; 170 typedef uint32_t rsm_node_id_t; 171 typedef uint32_t rsm_memseg_id_t; 172 typedef uint32_t rsm_permission_t; 173 174 struct __rsm_memseg_import_handle; 175 typedef struct __rsm_memseg_import_handle *rsm_memseg_import_handle_t; 176 177 struct __rsm_memseg_export_handle; 178 typedef struct __rsm_memseg_export_handle *rsm_memseg_export_handle_t; 179 180 typedef enum { 181 RSM_BARRIER_SEGMENT = 0x01, 182 RSM_BARRIER_NODE = 0x02, 183 RSM_BARRIER_SEGMENT_THREAD = 0x11, 184 RSM_BARRIER_NODE_THREAD = 0x12 185 }rsm_barrier_type_t; 186 187 typedef union { 188 uint64_t u64; 189 int64_t i64; 190 uint32_t u32[2]; 191 int32_t i32[2]; 192 uint16_t u16[4]; 193 int16_t i16[4]; 194 uint8_t u8[8]; 195 int8_t i8[8]; 196 uchar_t uc[8]; 197 char c[8]; 198 void *vp; 199 } rsm_barrier_component_t; 200 201 typedef struct { 202 rsm_barrier_component_t comp[4]; 203 } rsm_barrier_t; 204 205 typedef enum { 206 RSM_BARRIER_MODE_EXPLICIT, RSM_BARRIER_MODE_IMPLICIT 207 } rsm_barrier_mode_t; 208 209 #ifdef __cplusplus 210 } 211 #endif 212 213 #endif /* _SYS_RSM_RSM_COMMON_H */ 214