xref: /titanic_50/usr/src/uts/i86pc/sys/x_call.h (revision 03831d35f7499c87d51205817c93e9a8d42c4bae)
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 2005 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 /*
34  * For x86, we only have three cross call levels:
35  * a low, med and high. (see xc_levels.h)
36  */
37 #include <sys/xc_levels.h>
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * States of a cross-call session. (stored in xc_state field of the
45  * per-CPU area).
46  */
47 #define	XC_DONE		0	/* x-call session done */
48 #define	XC_HOLD		1	/* spin doing nothing */
49 #define	XC_SYNC_OP	2	/* perform a synchronous operation */
50 #define	XC_CALL_OP	3	/* perform a call operation */
51 #define	XC_WAIT		4	/* capture/release. callee has seen wait */
52 
53 #ifndef _ASM
54 
55 #include <sys/cpuvar.h>
56 
57 typedef intptr_t xc_arg_t;
58 typedef int (*xc_func_t)(xc_arg_t, xc_arg_t, xc_arg_t);
59 
60 struct	xc_mbox {
61 	xc_func_t	func;
62 	xc_arg_t	arg1;
63 	xc_arg_t	arg2;
64 	xc_arg_t	arg3;
65 	cpuset_t	set;
66 	int		saved_pri;
67 };
68 
69 /*
70  * Cross-call routines.
71  */
72 #if defined(_KERNEL)
73 
74 extern void	xc_init(void);
75 extern uint_t	xc_serv(caddr_t, caddr_t);
76 extern void	xc_call(xc_arg_t, xc_arg_t, xc_arg_t, int, cpuset_t, xc_func_t);
77 extern void	xc_trycall(xc_arg_t, xc_arg_t, xc_arg_t, cpuset_t, xc_func_t);
78 extern void	xc_sync(xc_arg_t, xc_arg_t, xc_arg_t, int, cpuset_t, xc_func_t);
79 extern void	xc_wait_sync(xc_arg_t, xc_arg_t, xc_arg_t, int, cpuset_t,
80     xc_func_t);
81 extern void	xc_capture_cpus(cpuset_t);
82 extern void	xc_release_cpus(void);
83 
84 #endif	/* _KERNEL */
85 
86 #endif	/* !_ASM */
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif	/* _SYS_X_CALL_H */
93