xref: /freebsd/sys/dev/xen/bus/intr-internal.h (revision d32d65276b201d2abe963aa69cc2cfc951ddb278)
1ab7ce14bSJulien Grall /*-
2ab7ce14bSJulien Grall  * SPDX-License-Identifier: MIT OR GPL-2.0-only
3ab7ce14bSJulien Grall  *
4ab7ce14bSJulien Grall  * Copyright © 2002-2005 K A Fraser
5ab7ce14bSJulien Grall  * Copyright © 2005 Intel Corporation <xiaofeng.ling@intel.com>
6*d32d6527SElliott Mitchell  * Copyright © 2005-2006 Kip Macy
7ab7ce14bSJulien Grall  * Copyright © 2013 Spectra Logic Corporation
8ab7ce14bSJulien Grall  * Copyright © 2015 Julien Grall
9ab7ce14bSJulien Grall  * Copyright © 2021,2022 Elliott Mitchell
10ab7ce14bSJulien Grall  *
11ab7ce14bSJulien Grall  * This file may be distributed separately from the Linux kernel, or
12ab7ce14bSJulien Grall  * incorporated into other software packages, subject to the following license:
13ab7ce14bSJulien Grall  *
14ab7ce14bSJulien Grall  * Permission is hereby granted, free of charge, to any person obtaining a copy
15ab7ce14bSJulien Grall  * of this source file (the "Software"), to deal in the Software without
16ab7ce14bSJulien Grall  * restriction, including without limitation the rights to use, copy, modify,
17ab7ce14bSJulien Grall  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18ab7ce14bSJulien Grall  * and to permit persons to whom the Software is furnished to do so, subject to
19ab7ce14bSJulien Grall  * the following conditions:
20ab7ce14bSJulien Grall  *
21ab7ce14bSJulien Grall  * The above copyright notice and this permission notice shall be included in
22ab7ce14bSJulien Grall  * all copies or substantial portions of the Software.
23ab7ce14bSJulien Grall  *
24ab7ce14bSJulien Grall  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25ab7ce14bSJulien Grall  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26ab7ce14bSJulien Grall  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27ab7ce14bSJulien Grall  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28ab7ce14bSJulien Grall  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29ab7ce14bSJulien Grall  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30ab7ce14bSJulien Grall  * IN THE SOFTWARE.
31ab7ce14bSJulien Grall  */
32ab7ce14bSJulien Grall 
33ab7ce14bSJulien Grall #ifndef	_XEN_INTR_INTERNAL_H_
34ab7ce14bSJulien Grall #define	_XEN_INTR_INTERNAL_H_
35ab7ce14bSJulien Grall 
36ab7ce14bSJulien Grall #ifndef	_MACHINE__XEN_ARCH_INTR_H_
37ab7ce14bSJulien Grall #error	"do not #include intr-internal.h, #include machine/arch-intr.h instead"
38ab7ce14bSJulien Grall #endif
39ab7ce14bSJulien Grall 
40ab7ce14bSJulien Grall /* Current implementation only supports 2L event channels. */
41ab7ce14bSJulien Grall #define NR_EVENT_CHANNELS EVTCHN_2L_NR_CHANNELS
42ab7ce14bSJulien Grall 
43*d32d6527SElliott Mitchell enum evtchn_type {
44*d32d6527SElliott Mitchell 	EVTCHN_TYPE_UNBOUND,
45*d32d6527SElliott Mitchell 	EVTCHN_TYPE_VIRQ,
46*d32d6527SElliott Mitchell 	EVTCHN_TYPE_IPI,
47*d32d6527SElliott Mitchell 	EVTCHN_TYPE_PORT,
48*d32d6527SElliott Mitchell 	EVTCHN_TYPE_COUNT
49*d32d6527SElliott Mitchell };
50*d32d6527SElliott Mitchell 
51ab7ce14bSJulien Grall struct xenisrc {
52ab7ce14bSJulien Grall 	xen_arch_isrc_t		xi_arch;	/* @TOP -> *xi_arch=*xenisrc */
53ab7ce14bSJulien Grall 	enum evtchn_type	xi_type;
54ab7ce14bSJulien Grall 	u_int			xi_cpu;		/* VCPU for delivery */
55ab7ce14bSJulien Grall 	evtchn_port_t		xi_port;
56ab7ce14bSJulien Grall 	u_int			xi_virq;
57ab7ce14bSJulien Grall 	void			*xi_cookie;
58ab7ce14bSJulien Grall 	bool			xi_close:1;	/* close on unbind? */
59ab7ce14bSJulien Grall 	bool			xi_masked:1;
60ab7ce14bSJulien Grall 	volatile u_int		xi_refcount;
61ab7ce14bSJulien Grall };
62ab7ce14bSJulien Grall 
63ab7ce14bSJulien Grall #endif	/* _XEN_INTR_INTERNAL_H_ */
64