2 * SPDX-License-Identifier: MIT OR GPL-2.0-only
4 * Copyright © 2015 Julien Grall
5 * Copyright © 2021 Elliott Mitchell
7 * This file may be distributed separately from the Linux kernel, or
8 * incorporated into other software packages, subject to the following license:
10 * Permission is hereby granted, free of charge, to any person obtaining a copy
11 * of this source file (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use, copy, modify,
13 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
14 * and to permit persons to whom the Software is furnished to do so, subject to
15 * the following conditions:
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
29 #ifndef _MACHINE__XEN_ARCH_INTR_H_
30 #define _MACHINE__XEN_ARCH_INTR_H_
32 #include <x86/intr_machdep.h>
33 #include <x86/apicvar.h>
36 struct intsrc intsrc; /* @TOP -> *xen_arch_isrc */
37 u_int vector; /* Global isrc vector number */
40 #include <dev/xen/bus/intr-internal.h>
42 /******************************* ARCH wrappers *******************************/
44 extern void xen_arch_intr_init(void);
46 extern struct xenisrc *xen_arch_intr_alloc(void);
47 extern void xen_arch_intr_release(struct xenisrc *isrc);
50 xen_arch_intr_next_cpu(struct xenisrc *isrc)
53 return (apic_cpuid(intr_next_cpu(0)));
57 xen_arch_intr_execute_handlers(struct xenisrc *isrc, struct trapframe *frame)
60 intr_execute_handlers(&isrc->xi_arch.intsrc, frame);
65 xen_arch_intr_add_handler(const char *name, driver_filter_t filter,
66 driver_intr_t handler, void *arg, enum intr_type flags,
67 struct xenisrc *isrc, void **cookiep)
70 return (intr_add_handler(name, isrc->xi_arch.vector, filter, handler,
71 arg, flags, cookiep, 0));
75 xen_arch_intr_describe(struct xenisrc *isrc, void *cookie, const char *descr)
78 return (intr_describe(isrc->xi_arch.vector, cookie, descr));
82 xen_arch_intr_remove_handler(struct xenisrc *isrc, void *cookie)
85 return (intr_remove_handler(cookie));
89 xen_arch_intr_event_bind(struct xenisrc *isrc, u_int cpu)
92 return (intr_event_bind(isrc->xi_arch.intsrc.is_event, cpu));
95 #endif /* _MACHINE__XEN_ARCH_INTR_H_ */