1 1.61 andvar /* $NetBSD: intr.h,v 1.61 2025/08/18 20:59:54 andvar Exp $ */ 2 1.3 bouyer /* NetBSD intr.h,v 1.15 2004/10/31 10:39:34 yamt Exp */ 3 1.3 bouyer 4 1.3 bouyer /*- 5 1.3 bouyer * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. 6 1.3 bouyer * All rights reserved. 7 1.3 bouyer * 8 1.3 bouyer * This code is derived from software contributed to The NetBSD Foundation 9 1.3 bouyer * by Charles M. Hannum, and by Jason R. Thorpe. 10 1.3 bouyer * 11 1.3 bouyer * Redistribution and use in source and binary forms, with or without 12 1.3 bouyer * modification, are permitted provided that the following conditions 13 1.3 bouyer * are met: 14 1.3 bouyer * 1. Redistributions of source code must retain the above copyright 15 1.3 bouyer * notice, this list of conditions and the following disclaimer. 16 1.3 bouyer * 2. Redistributions in binary form must reproduce the above copyright 17 1.3 bouyer * notice, this list of conditions and the following disclaimer in the 18 1.3 bouyer * documentation and/or other materials provided with the distribution. 19 1.3 bouyer * 20 1.3 bouyer * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21 1.3 bouyer * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 1.3 bouyer * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 1.3 bouyer * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 1.3 bouyer * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 1.3 bouyer * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 1.3 bouyer * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 1.3 bouyer * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 1.3 bouyer * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 1.3 bouyer * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 1.3 bouyer * POSSIBILITY OF SUCH DAMAGE. 31 1.3 bouyer */ 32 1.1 cl 33 1.1 cl #ifndef _XEN_INTR_H_ 34 1.1 cl #define _XEN_INTR_H_ 35 1.1 cl 36 1.55 bouyer #include <xen/intrdefs.h> 37 1.1 cl 38 1.1 cl #ifndef _LOCORE 39 1.52 cherry #include <xen/include/public/xen.h> 40 1.52 cherry #include <xen/include/public/event_channel.h> 41 1.42 cherry #include <x86/intr.h> 42 1.19 bouyer #include <xen/xen.h> 43 1.19 bouyer #include <xen/hypervisor.h> 44 1.3 bouyer #include <machine/pic.h> 45 1.30 dyoung #include <sys/evcnt.h> 46 1.3 bouyer 47 1.10 bouyer #include "opt_xen.h" 48 1.10 bouyer 49 1.34 bouyer 50 1.34 bouyer struct cpu_info; 51 1.3 bouyer /* 52 1.3 bouyer * Struct describing an event channel. 53 1.3 bouyer */ 54 1.3 bouyer 55 1.3 bouyer struct evtsource { 56 1.3 bouyer int ev_maxlevel; /* max. IPL for this source */ 57 1.60 knakahar uint64_t ev_imask; /* interrupt mask */ 58 1.3 bouyer struct intrhand *ev_handlers; /* handler chain */ 59 1.3 bouyer struct evcnt ev_evcnt; /* interrupt counter */ 60 1.33 cherry struct cpu_info *ev_cpu; /* cpu on which this event is bound */ 61 1.55 bouyer char ev_intrname[INTRIDBUF]; /* interrupt string */ 62 1.55 bouyer char ev_xname[INTRDEVNAMEBUF]; /* handler device list */ 63 1.55 bouyer struct intrsource *ev_isl; /* entry in intr sources list */ 64 1.3 bouyer }; 65 1.3 bouyer 66 1.1 cl extern struct intrstub xenev_stubs[]; 67 1.61 andvar extern short irq2port[NR_EVENT_CHANNELS]; /* actually port + 1, so that 0 is invalid */ 68 1.36 knakahar 69 1.25 cegger #ifdef MULTIPROCESSOR 70 1.42 cherry int xen_intr_biglock_wrapper(void *); 71 1.25 cegger #endif 72 1.25 cegger 73 1.43 cherry #if defined(DOM0OPS) || NPCI > 0 74 1.48 cherry int xen_pic_to_gsi(struct pic *, int); 75 1.59 bouyer int xen_map_msi_pirq(struct pic *, int); 76 1.59 bouyer int xen_map_msix_pirq(struct pic *, int); 77 1.59 bouyer void xen_pci_msi_release(struct pic *, int); 78 1.43 cherry #endif /* defined(DOM0OPS) || NPCI > 0 */ 79 1.10 bouyer 80 1.32 cherry #ifdef MULTIPROCESSOR 81 1.32 cherry void xen_ipi_init(void); 82 1.32 cherry int xen_send_ipi(struct cpu_info *, uint32_t); 83 1.32 cherry void xen_broadcast_ipi(uint32_t); 84 1.32 cherry #else 85 1.33 cherry #define xen_ipi_init(_1) ((void) 0) /* nothing */ 86 1.33 cherry #define xen_send_ipi(_i1, _i2) (0) /* nothing */ 87 1.33 cherry #define xen_broadcast_ipi(_i1) ((void) 0) /* nothing */ 88 1.32 cherry #endif /* MULTIPROCESSOR */ 89 1.50 cherry 90 1.50 cherry void *xen_intr_establish_xname(int, struct pic *, int, int, int, int (*)(void *), 91 1.50 cherry void *, bool, const char *); 92 1.50 cherry void *xen_intr_establish(int, struct pic *, int, int, int, int (*)(void *), 93 1.50 cherry void *, bool); 94 1.53 thorpej void xen_intr_mask(struct intrhand *); 95 1.53 thorpej void xen_intr_unmask(struct intrhand *); 96 1.50 cherry void xen_intr_disestablish(struct intrhand *); 97 1.50 cherry 98 1.54 jdolecek struct intrsource *xen_intr_allocate_io_intrsource(const char *); 99 1.54 jdolecek void xen_intr_free_io_intrsource(const char *); 100 1.54 jdolecek 101 1.3 bouyer #endif /* !_LOCORE */ 102 1.3 bouyer 103 1.1 cl #endif /* _XEN_INTR_H_ */ 104