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 (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_X_CALL_H 28 #define _SYS_X_CALL_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 /* 33 * For x86, we only have three cross call levels: 34 * a low, med and high. (see xc_levels.h) 35 */ 36 #include <sys/xc_levels.h> 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 /* 43 * States of a cross-call session. (stored in xc_state field of the 44 * per-CPU area). 45 */ 46 #define XC_DONE 0 /* x-call session done */ 47 #define XC_HOLD 1 /* spin doing nothing */ 48 #define XC_SYNC_OP 2 /* perform a synchronous operation */ 49 #define XC_CALL_OP 3 /* perform a call operation */ 50 #define XC_WAIT 4 /* capture/release. callee has seen wait */ 51 52 #ifndef _ASM 53 54 #include <sys/cpuvar.h> 55 56 typedef intptr_t xc_arg_t; 57 typedef int (*xc_func_t)(xc_arg_t, xc_arg_t, xc_arg_t); 58 59 struct xc_mbox { 60 xc_func_t func; 61 xc_arg_t arg1; 62 xc_arg_t arg2; 63 xc_arg_t arg3; 64 cpuset_t set; 65 int saved_pri; 66 }; 67 68 #if defined(_MACHDEP) 69 extern cpuset_t cpu_ready_set; 70 #endif 71 72 /* 73 * Cross-call routines. 74 */ 75 #if defined(_KERNEL) 76 77 extern void xc_init(void); 78 extern uint_t xc_serv(caddr_t, caddr_t); 79 extern void xc_call(xc_arg_t, xc_arg_t, xc_arg_t, int, cpuset_t, xc_func_t); 80 extern void xc_trycall(xc_arg_t, xc_arg_t, xc_arg_t, cpuset_t, xc_func_t); 81 extern void xc_sync(xc_arg_t, xc_arg_t, xc_arg_t, int, cpuset_t, xc_func_t); 82 extern void xc_capture_cpus(cpuset_t); 83 extern void xc_release_cpus(void); 84 85 #if defined(TRAPTRACE) 86 87 /* 88 * X-call tracing can be interleaved with trap tracing 89 */ 90 extern void xc_make_trap_trace_entry(uint8_t, int, ulong_t); 91 #define XC_TRACE(m, pri, arg) xc_make_trap_trace_entry(m, pri, arg) 92 93 #else /* TRAPTRACE */ 94 95 #define XC_TRACE(m, pri, arg) /* nothing */ 96 97 #endif /* TRAPTRACE */ 98 99 #endif /* _KERNEL */ 100 101 #endif /* !_ASM */ 102 103 #ifdef __cplusplus 104 } 105 #endif 106 107 #endif /* _SYS_X_CALL_H */ 108