xref: /illumos-gate/usr/src/uts/i86pc/sys/x_call.h (revision f34a71784df3fbc5d1227a7b6201fd318ad1667e)
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 /*
23*f34a7178SJoe 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 
36*f34a7178SJoe 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 
39*f34a7178SJoe Bonasera /*
40*f34a7178SJoe Bonasera  * One of these is stored in each CPU's machcpu data, plus one extra for
41*f34a7178SJoe Bonasera  * priority (ie panic) messages
42*f34a7178SJoe Bonasera  */
43*f34a7178SJoe Bonasera typedef struct xc_data {
44*f34a7178SJoe Bonasera 	xc_func_t	xc_func;
45*f34a7178SJoe Bonasera 	xc_arg_t	xc_a1;
46*f34a7178SJoe Bonasera 	xc_arg_t	xc_a2;
47*f34a7178SJoe Bonasera 	xc_arg_t	xc_a3;
48*f34a7178SJoe Bonasera } xc_data_t;
497c478bd9Sstevel@tonic-gate 
50*f34a7178SJoe Bonasera /*
51*f34a7178SJoe Bonasera  * This is kept as small as possible, since for N CPUs we need N * N of them.
52*f34a7178SJoe Bonasera  */
53*f34a7178SJoe Bonasera typedef struct xc_msg {
54*f34a7178SJoe Bonasera 	uint8_t		xc_command;
55*f34a7178SJoe Bonasera #ifdef __amd64
56*f34a7178SJoe Bonasera 	uint16_t	xc_master;
57*f34a7178SJoe Bonasera 	uint16_t	xc_slave;
58*f34a7178SJoe Bonasera #else
59*f34a7178SJoe Bonasera 	uint8_t		xc_master;
60*f34a7178SJoe Bonasera 	uint8_t		xc_slave;
61ae115bc7Smrj #endif
62*f34a7178SJoe Bonasera 	struct xc_msg	*xc_next;
63*f34a7178SJoe 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 
70*f34a7178SJoe Bonasera extern void	xc_init_cpu(struct cpu *);
717c478bd9Sstevel@tonic-gate extern uint_t	xc_serv(caddr_t, caddr_t);
727c478bd9Sstevel@tonic-gate 
73*f34a7178SJoe Bonasera #define	CPUSET2BV(set)	((ulong_t *)(void *)&(set))
74*f34a7178SJoe Bonasera extern void	xc_call(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t);
75*f34a7178SJoe Bonasera extern void	xc_call_nowait(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *,
76*f34a7178SJoe Bonasera     xc_func_t);
77*f34a7178SJoe Bonasera extern void	xc_sync(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t);
78*f34a7178SJoe Bonasera extern void	xc_priority(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t);
79ae115bc7Smrj 
807c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #endif	/* !_ASM */
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
857c478bd9Sstevel@tonic-gate }
867c478bd9Sstevel@tonic-gate #endif
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate #endif	/* _SYS_X_CALL_H */
89