xref: /titanic_41/usr/src/uts/i86pc/sys/x_call.h (revision a31148363f598def767ac48c5d82e1572e44b935)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5ae115bc7Smrj  * Common Development and Distribution License (the "License").
6ae115bc7Smrj  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21ae115bc7Smrj 
227c478bd9Sstevel@tonic-gate /*
23f34a7178SJoe Bonasera  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_SYS_X_CALL_H
287c478bd9Sstevel@tonic-gate #define	_SYS_X_CALL_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
317c478bd9Sstevel@tonic-gate extern "C" {
327c478bd9Sstevel@tonic-gate #endif
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifndef _ASM
357c478bd9Sstevel@tonic-gate 
36f34a7178SJoe Bonasera typedef uintptr_t xc_arg_t;
377c478bd9Sstevel@tonic-gate typedef int (*xc_func_t)(xc_arg_t, xc_arg_t, xc_arg_t);
387c478bd9Sstevel@tonic-gate 
39f34a7178SJoe Bonasera /*
40f34a7178SJoe Bonasera  * One of these is stored in each CPU's machcpu data, plus one extra for
41f34a7178SJoe Bonasera  * priority (ie panic) messages
42f34a7178SJoe Bonasera  */
43f34a7178SJoe Bonasera typedef struct xc_data {
44f34a7178SJoe Bonasera 	xc_func_t	xc_func;
45f34a7178SJoe Bonasera 	xc_arg_t	xc_a1;
46f34a7178SJoe Bonasera 	xc_arg_t	xc_a2;
47f34a7178SJoe Bonasera 	xc_arg_t	xc_a3;
48f34a7178SJoe Bonasera } xc_data_t;
497c478bd9Sstevel@tonic-gate 
50f34a7178SJoe Bonasera /*
51f34a7178SJoe Bonasera  * This is kept as small as possible, since for N CPUs we need N * N of them.
52f34a7178SJoe Bonasera  */
53f34a7178SJoe Bonasera typedef struct xc_msg {
54f34a7178SJoe Bonasera 	uint8_t		xc_command;
55f34a7178SJoe Bonasera #ifdef __amd64
56f34a7178SJoe Bonasera 	uint16_t	xc_master;
57f34a7178SJoe Bonasera 	uint16_t	xc_slave;
58f34a7178SJoe Bonasera #else
59f34a7178SJoe Bonasera 	uint8_t		xc_master;
60f34a7178SJoe Bonasera 	uint8_t		xc_slave;
61ae115bc7Smrj #endif
62f34a7178SJoe Bonasera 	struct xc_msg	*xc_next;
63f34a7178SJoe Bonasera } xc_msg_t;
64ae115bc7Smrj 
657c478bd9Sstevel@tonic-gate /*
667c478bd9Sstevel@tonic-gate  * Cross-call routines.
677c478bd9Sstevel@tonic-gate  */
687c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
697c478bd9Sstevel@tonic-gate 
70f34a7178SJoe Bonasera extern void	xc_init_cpu(struct cpu *);
71*a3114836SGerry Liu extern void	xc_fini_cpu(struct cpu *);
72*a3114836SGerry Liu extern int	xc_flush_cpu(struct cpu *);
737c478bd9Sstevel@tonic-gate extern uint_t	xc_serv(caddr_t, caddr_t);
747c478bd9Sstevel@tonic-gate 
75f34a7178SJoe Bonasera #define	CPUSET2BV(set)	((ulong_t *)(void *)&(set))
76f34a7178SJoe Bonasera extern void	xc_call(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t);
77f34a7178SJoe Bonasera extern void	xc_call_nowait(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *,
78f34a7178SJoe Bonasera     xc_func_t);
79f34a7178SJoe Bonasera extern void	xc_sync(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t);
80f34a7178SJoe Bonasera extern void	xc_priority(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t);
81ae115bc7Smrj 
827c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #endif	/* !_ASM */
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
877c478bd9Sstevel@tonic-gate }
887c478bd9Sstevel@tonic-gate #endif
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #endif	/* _SYS_X_CALL_H */
91