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. 25*a8ea0c9dSJohn Levon * Copyright 2018 Joyent, Inc. 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #ifndef _SYS_X_CALL_H 297c478bd9Sstevel@tonic-gate #define _SYS_X_CALL_H 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #ifndef _ASM 367c478bd9Sstevel@tonic-gate 37*a8ea0c9dSJohn Levon #define XC_MSG_FREE (0) /* msg in xc_free queue */ 38*a8ea0c9dSJohn Levon #define XC_MSG_ASYNC (1) /* msg in slave xc_msgbox */ 39*a8ea0c9dSJohn Levon #define XC_MSG_CALL (2) /* msg in slave xc_msgbox */ 40*a8ea0c9dSJohn Levon #define XC_MSG_SYNC (3) /* msg in slave xc_msgbox */ 41*a8ea0c9dSJohn Levon #define XC_MSG_WAITING (4) /* msg in master xc_msgbox or xc_waiters */ 42*a8ea0c9dSJohn Levon #define XC_MSG_RELEASED (5) /* msg in slave xc_msgbox */ 43*a8ea0c9dSJohn Levon #define XC_MSG_DONE (6) /* msg in master xc_msgbox */ 44*a8ea0c9dSJohn Levon 45f34a7178SJoe Bonasera typedef uintptr_t xc_arg_t; 467c478bd9Sstevel@tonic-gate typedef int (*xc_func_t)(xc_arg_t, xc_arg_t, xc_arg_t); 477c478bd9Sstevel@tonic-gate 48f34a7178SJoe Bonasera /* 49f34a7178SJoe Bonasera * One of these is stored in each CPU's machcpu data, plus one extra for 50f34a7178SJoe Bonasera * priority (ie panic) messages 51f34a7178SJoe Bonasera */ 52f34a7178SJoe Bonasera typedef struct xc_data { 53f34a7178SJoe Bonasera xc_func_t xc_func; 54f34a7178SJoe Bonasera xc_arg_t xc_a1; 55f34a7178SJoe Bonasera xc_arg_t xc_a2; 56f34a7178SJoe Bonasera xc_arg_t xc_a3; 57f34a7178SJoe Bonasera } xc_data_t; 587c478bd9Sstevel@tonic-gate 59f34a7178SJoe Bonasera /* 60f34a7178SJoe Bonasera * This is kept as small as possible, since for N CPUs we need N * N of them. 61f34a7178SJoe Bonasera */ 62f34a7178SJoe Bonasera typedef struct xc_msg { 63f34a7178SJoe Bonasera uint8_t xc_command; 64f34a7178SJoe Bonasera uint16_t xc_master; 65f34a7178SJoe Bonasera uint16_t xc_slave; 66f34a7178SJoe Bonasera struct xc_msg *xc_next; 67f34a7178SJoe Bonasera } xc_msg_t; 68ae115bc7Smrj 697c478bd9Sstevel@tonic-gate /* 707c478bd9Sstevel@tonic-gate * Cross-call routines. 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate #if defined(_KERNEL) 737c478bd9Sstevel@tonic-gate 74f34a7178SJoe Bonasera extern void xc_init_cpu(struct cpu *); 75a3114836SGerry Liu extern void xc_fini_cpu(struct cpu *); 76a3114836SGerry Liu extern int xc_flush_cpu(struct cpu *); 777c478bd9Sstevel@tonic-gate extern uint_t xc_serv(caddr_t, caddr_t); 787c478bd9Sstevel@tonic-gate 79f34a7178SJoe Bonasera #define CPUSET2BV(set) ((ulong_t *)(void *)&(set)) 80f34a7178SJoe Bonasera extern void xc_call(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t); 81f34a7178SJoe Bonasera extern void xc_call_nowait(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, 82f34a7178SJoe Bonasera xc_func_t); 83f34a7178SJoe Bonasera extern void xc_sync(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t); 84f34a7178SJoe Bonasera extern void xc_priority(xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t); 85ae115bc7Smrj 867c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate #endif /* !_ASM */ 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate #ifdef __cplusplus 917c478bd9Sstevel@tonic-gate } 927c478bd9Sstevel@tonic-gate #endif 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate #endif /* _SYS_X_CALL_H */ 95