xref: /titanic_52/usr/src/uts/i86pc/sys/x_call.h (revision 53dbcc5939527e6d5d52d814e51e364b5e8bb532)
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 2009 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 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #ifndef _ASM
35 
36 typedef uintptr_t xc_arg_t;
37 typedef int (*xc_func_t)(xc_arg_t, xc_arg_t, xc_arg_t);
38 
39 /*
40  * One of these is stored in each CPU's machcpu data, plus one extra for
41  * priority (ie panic) messages
42  */
43 typedef struct xc_data {
44 	xc_func_t	xc_func;
45 	xc_arg_t	xc_a1;
46 	xc_arg_t	xc_a2;
47 	xc_arg_t	xc_a3;
48 } xc_data_t;
49 
50 /*
51  * This is kept as small as possible, since for N CPUs we need N * N of them.
52  */
53 typedef struct xc_msg {
54 	uint8_t		xc_command;
55 #ifdef __amd64
56 	uint16_t	xc_master;
57 	uint16_t	xc_slave;
58 #else
59 	uint8_t		xc_master;
60 	uint8_t		xc_slave;
61 #endif
62 	struct xc_msg	*xc_next;
63 } xc_msg_t;
64 
65 /*
66  * Cross-call routines.
67  */
68 #if defined(_KERNEL)
69 
70 extern void	xc_init_cpu(struct cpu *);
71 extern uint_t	xc_serv(caddr_t, caddr_t);
72 
73 #define	CPUSET2BV(set)	((ulong_t *)(void *)&(set))
74 extern void	xc_call(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t);
75 extern void	xc_call_nowait(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *,
76     xc_func_t);
77 extern void	xc_sync(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t);
78 extern void	xc_priority(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t);
79 
80 #endif	/* _KERNEL */
81 
82 #endif	/* !_ASM */
83 
84 #ifdef	__cplusplus
85 }
86 #endif
87 
88 #endif	/* _SYS_X_CALL_H */
89