[BACK]Return to intr.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / xen / include

Annotation of src/sys/arch/xen/include/intr.h, Revision 1.20

1.20    ! ad          1: /*     $NetBSD: intr.h,v 1.19 2007/11/22 16:16:57 bouyer Exp $ */
1.3       bouyer      2: /*     NetBSD intr.h,v 1.15 2004/10/31 10:39:34 yamt Exp       */
                      3:
                      4: /*-
                      5:  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
                      6:  * All rights reserved.
                      7:  *
                      8:  * This code is derived from software contributed to The NetBSD Foundation
                      9:  * by Charles M. Hannum, and by Jason R. Thorpe.
                     10:  *
                     11:  * Redistribution and use in source and binary forms, with or without
                     12:  * modification, are permitted provided that the following conditions
                     13:  * are met:
                     14:  * 1. Redistributions of source code must retain the above copyright
                     15:  *    notice, this list of conditions and the following disclaimer.
                     16:  * 2. Redistributions in binary form must reproduce the above copyright
                     17:  *    notice, this list of conditions and the following disclaimer in the
                     18:  *    documentation and/or other materials provided with the distribution.
                     19:  * 3. All advertising materials mentioning features or use of this software
                     20:  *    must display the following acknowledgement:
                     21:  *        This product includes software developed by the NetBSD
                     22:  *        Foundation, Inc. and its contributors.
                     23:  * 4. Neither the name of The NetBSD Foundation nor the names of its
                     24:  *    contributors may be used to endorse or promote products derived
                     25:  *    from this software without specific prior written permission.
                     26:  *
                     27:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     28:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     29:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     30:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     31:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     32:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     33:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     34:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     35:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     36:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     37:  * POSSIBILITY OF SUCH DAMAGE.
                     38:  */
1.1       cl         39:
                     40: #ifndef _XEN_INTR_H_
                     41: #define        _XEN_INTR_H_
                     42:
1.19      bouyer     43: #include <xen/intrdefs.h>
1.1       cl         44:
                     45: #ifndef _LOCORE
1.19      bouyer     46: #include <xen/xen.h>
                     47: #include <xen/hypervisor.h>
                     48: #include <xen/evtchn.h>
1.3       bouyer     49: #include <machine/cpu.h>
                     50: #include <machine/pic.h>
                     51:
1.10      bouyer     52: #include "opt_xen.h"
                     53:
1.3       bouyer     54: /*
                     55:  * Struct describing an event channel.
                     56:  */
                     57:
                     58: struct evtsource {
                     59:        int ev_maxlevel;                /* max. IPL for this source */
                     60:        u_int32_t ev_imask;             /* interrupt mask */
                     61:        struct intrhand *ev_handlers;   /* handler chain */
                     62:        struct evcnt ev_evcnt;          /* interrupt counter */
                     63:        char ev_evname[32];             /* event counter name */
                     64: };
                     65:
                     66: /*
                     67:  * Structure describing an interrupt level. struct cpu_info has an array of
                     68:  * IPL_MAX of theses. The index in the array is equal to the stub number of
                     69:  * the stubcode as present in vector.s
                     70:  */
                     71:
                     72: struct intrstub {
                     73: #if 0
                     74:        void *ist_entry;
                     75: #endif
                     76:        void *ist_recurse;
                     77:        void *ist_resume;
                     78: };
                     79:
1.11      dogcow     80: #ifdef XEN3
                     81: /* for x86 compatibility */
                     82: extern struct intrstub i8259_stubs[];
1.12      bouyer     83: extern struct intrstub ioapic_edge_stubs[];
                     84: extern struct intrstub ioapic_level_stubs[];
1.11      dogcow     85: #endif
                     86:
1.3       bouyer     87: struct iplsource {
                     88:        struct intrhand *ipl_handlers;   /* handler chain */
                     89:        void *ipl_recurse;               /* entry for spllower */
                     90:        void *ipl_resume;                /* entry for doreti */
1.20    ! ad         91:        struct lwp *ipl_lwp;
1.3       bouyer     92:        u_int32_t ipl_evt_mask1;        /* pending events for this IPL */
                     93:        u_int32_t ipl_evt_mask2[NR_EVENT_CHANNELS];
                     94: };
                     95:
                     96:
                     97:
                     98: /*
                     99:  * Interrupt handler chains. These are linked in both the evtsource and
                    100:  * the iplsource.
                    101:  * The handler is called with its (single) argument.
                    102:  */
                    103:
                    104: struct intrhand {
                    105:        int     (*ih_fun)(void *);
                    106:        void    *ih_arg;
                    107:        int     ih_level;
                    108:        struct  intrhand *ih_ipl_next;
                    109:        struct  intrhand *ih_evt_next;
                    110:        struct cpu_info *ih_cpu;
                    111: };
1.1       cl        112:
1.12      bouyer    113: struct xen_intr_handle {
                    114:        int pirq; /* also contains the  APIC_INT_* flags if NIOAPIC > 0 */
                    115:        int evtch;
                    116: };
1.1       cl        117:
                    118: extern struct intrstub xenev_stubs[];
                    119:
1.3       bouyer    120: #define IUNMASK(ci,level) (ci)->ci_iunmask[(level)]
                    121:
                    122: extern void Xspllower(int);
                    123:
1.16      yamt      124: int splraise(int);
                    125: void spllower(int);
                    126: void softintr(int);
1.3       bouyer    127:
                    128: #define SPL_ASSERT_BELOW(x) KDASSERT(curcpu()->ci_ilevel < (x))
                    129:
                    130: /*
                    131:  * Software interrupt masks
                    132:  */
                    133: #define splsoftxenevt()        splraise(IPL_SOFTXENEVT)
                    134:
                    135: /*
                    136:  * Miscellaneous
                    137:  */
                    138: #define        spl0()          spllower(IPL_NONE)
                    139: #define        splx(x)         spllower(x)
                    140:
1.14      ad        141: typedef uint8_t ipl_t;
1.13      yamt      142: typedef struct {
                    143:        ipl_t _ipl;
                    144: } ipl_cookie_t;
                    145:
                    146: static inline ipl_cookie_t
                    147: makeiplcookie(ipl_t ipl)
                    148: {
                    149:
                    150:        return (ipl_cookie_t){._ipl = ipl};
                    151: }
                    152:
                    153: static inline int
                    154: splraiseipl(ipl_cookie_t icookie)
                    155: {
                    156:
                    157:        return splraise(icookie._ipl);
                    158: }
                    159:
1.6       yamt      160: #include <sys/spl.h>
                    161:
1.3       bouyer    162: /*
                    163:  * XXX
                    164:  */
                    165: #define        setsoftnet()    softintr(SIR_NET)
                    166:
                    167: /*
                    168:  * Stub declarations.
                    169:  */
                    170:
1.20    ! ad        171: extern void Xsoftintr(void);
1.3       bouyer    172:
                    173: struct cpu_info;
                    174:
                    175: extern char idt_allocmap[];
                    176:
                    177: struct pcibus_attach_args;
1.1       cl        178:
1.3       bouyer    179: void intr_default_setup(void);
                    180: int x86_nmi(void);
                    181: void intr_calculatemasks(struct evtsource *);
1.10      bouyer    182:
1.3       bouyer    183: void *intr_establish(int, struct pic *, int, int, int, int (*)(void *), void *);
                    184: void intr_disestablish(struct intrhand *);
                    185: const char *intr_string(int);
                    186: void cpu_intr_init(struct cpu_info *);
1.12      bouyer    187: int xen_intr_map(int *, int);
1.3       bouyer    188: #ifdef INTRDEBUG
                    189: void intr_printconfig(void);
1.2       yamt      190: #endif
1.12      bouyer    191: int intr_find_mpmapping(int, int, struct xen_intr_handle *);
                    192: struct pic *intr_findpic(int);
                    193: void intr_add_pcibus(struct pcibus_attach_args *);
1.10      bouyer    194:
1.3       bouyer    195: #endif /* !_LOCORE */
                    196:
1.1       cl        197: #endif /* _XEN_INTR_H_ */

CVSweb <webmaster@jp.NetBSD.org>