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