[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.31.10.1

1.31.10.1! cherry      1: /*     $NetBSD: intr.h,v 1.31 2009/07/29 12:02:06 cegger 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:  *
                     20:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     21:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     22:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     23:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     24:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     25:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     26:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     27:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     28:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     29:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     30:  * POSSIBILITY OF SUCH DAMAGE.
                     31:  */
1.1       cl         32:
                     33: #ifndef _XEN_INTR_H_
                     34: #define        _XEN_INTR_H_
                     35:
1.31.10.1! cherry     36: #ifndef _LOCORE
        !            37: #include <machine/cpu.h>
        !            38: #include <machine/pic.h>
1.22      bouyer     39: #include <machine/intrdefs.h>
1.1       cl         40:
1.31.10.1! cherry     41: #include <sys/evcnt.h>
        !            42: #include <sys/types.h>
        !            43: #include <sys/simplelock.h>
        !            44:
1.19      bouyer     45: #include <xen/xen.h>
                     46: #include <xen/hypervisor.h>
                     47: #include <xen/evtchn.h>
1.3       bouyer     48:
1.10      bouyer     49: #include "opt_xen.h"
                     50:
1.3       bouyer     51: /*
                     52:  * Struct describing an event channel.
                     53:  */
                     54:
                     55: struct evtsource {
                     56:        int ev_maxlevel;                /* max. IPL for this source */
1.24      cegger     57:        uint32_t ev_imask;              /* interrupt mask */
1.3       bouyer     58:        struct intrhand *ev_handlers;   /* handler chain */
                     59:        struct evcnt ev_evcnt;          /* interrupt counter */
                     60:        char ev_evname[32];             /* event counter name */
1.31.10.1! cherry     61:        struct simplelock ev_lock;      /* protects this structure */
        !            62:
        !            63:        /*
        !            64:         * XXX: The lock is quite coursegrained ( for the entire
        !            65:         * handler list ), but contention is expected to be low. See
        !            66:         * how this performs and revisit.
        !            67:         */
1.3       bouyer     68: };
                     69:
                     70: /*
                     71:  * Structure describing an interrupt level. struct cpu_info has an array of
                     72:  * IPL_MAX of theses. The index in the array is equal to the stub number of
                     73:  * the stubcode as present in vector.s
                     74:  */
                     75:
                     76: struct intrstub {
                     77: #if 0
                     78:        void *ist_entry;
                     79: #endif
                     80:        void *ist_recurse;
                     81:        void *ist_resume;
                     82: };
                     83:
1.11      dogcow     84: /* for x86 compatibility */
                     85: extern struct intrstub i8259_stubs[];
1.12      bouyer     86: extern struct intrstub ioapic_edge_stubs[];
                     87: extern struct intrstub ioapic_level_stubs[];
1.11      dogcow     88:
1.3       bouyer     89: struct iplsource {
                     90:        struct intrhand *ipl_handlers;   /* handler chain */
                     91:        void *ipl_recurse;               /* entry for spllower */
                     92:        void *ipl_resume;                /* entry for doreti */
1.20      ad         93:        struct lwp *ipl_lwp;
1.23      bouyer     94:        u_long ipl_evt_mask1;   /* pending events for this IPL */
                     95:        u_long ipl_evt_mask2[NR_EVENT_CHANNELS];
1.3       bouyer     96: };
                     97:
                     98:
                     99:
                    100: /*
                    101:  * Interrupt handler chains. These are linked in both the evtsource and
                    102:  * the iplsource.
                    103:  * The handler is called with its (single) argument.
                    104:  */
                    105:
                    106: struct intrhand {
                    107:        int     (*ih_fun)(void *);
                    108:        void    *ih_arg;
                    109:        int     ih_level;
1.25      cegger    110:        int     (*ih_realfun)(void *);
                    111:        void    *ih_realarg;
1.3       bouyer    112:        struct  intrhand *ih_ipl_next;
                    113:        struct  intrhand *ih_evt_next;
                    114:        struct cpu_info *ih_cpu;
                    115: };
1.1       cl        116:
1.12      bouyer    117: struct xen_intr_handle {
                    118:        int pirq; /* also contains the  APIC_INT_* flags if NIOAPIC > 0 */
                    119:        int evtch;
                    120: };
1.1       cl        121:
                    122: extern struct intrstub xenev_stubs[];
                    123:
1.3       bouyer    124: #define IUNMASK(ci,level) (ci)->ci_iunmask[(level)]
                    125:
                    126: extern void Xspllower(int);
                    127:
1.16      yamt      128: int splraise(int);
                    129: void spllower(int);
1.3       bouyer    130:
                    131: #define SPL_ASSERT_BELOW(x) KDASSERT(curcpu()->ci_ilevel < (x))
                    132:
                    133: /*
                    134:  * Miscellaneous
                    135:  */
                    136: #define        spl0()          spllower(IPL_NONE)
                    137: #define        splx(x)         spllower(x)
                    138:
1.14      ad        139: typedef uint8_t ipl_t;
1.13      yamt      140: typedef struct {
                    141:        ipl_t _ipl;
                    142: } ipl_cookie_t;
                    143:
                    144: static inline ipl_cookie_t
                    145: makeiplcookie(ipl_t ipl)
                    146: {
                    147:
                    148:        return (ipl_cookie_t){._ipl = ipl};
                    149: }
                    150:
                    151: static inline int
                    152: splraiseipl(ipl_cookie_t icookie)
                    153: {
                    154:
                    155:        return splraise(icookie._ipl);
                    156: }
                    157:
1.6       yamt      158: #include <sys/spl.h>
                    159:
1.3       bouyer    160: /*
                    161:  * Stub declarations.
                    162:  */
                    163:
                    164: struct cpu_info;
                    165:
                    166: struct pcibus_attach_args;
1.1       cl        167:
1.25      cegger    168: #ifdef MULTIPROCESSOR
                    169: int intr_biglock_wrapper(void *);
                    170: #endif
                    171:
1.3       bouyer    172: void intr_default_setup(void);
                    173: int x86_nmi(void);
                    174: void intr_calculatemasks(struct evtsource *);
1.10      bouyer    175:
1.29      ad        176: void *intr_establish(int, struct pic *, int, int, int, int (*)(void *), void *, bool);
1.3       bouyer    177: void intr_disestablish(struct intrhand *);
                    178: const char *intr_string(int);
                    179: void cpu_intr_init(struct cpu_info *);
1.12      bouyer    180: int xen_intr_map(int *, int);
1.3       bouyer    181: #ifdef INTRDEBUG
                    182: void intr_printconfig(void);
1.2       yamt      183: #endif
1.12      bouyer    184: int intr_find_mpmapping(int, int, struct xen_intr_handle *);
                    185: struct pic *intr_findpic(int);
                    186: void intr_add_pcibus(struct pcibus_attach_args *);
1.10      bouyer    187:
1.31.10.1! cherry    188: void xen_ipi_init(void);
        !           189: int xen_send_ipi(struct cpu_info *, uint32_t);
        !           190: void xen_broadcast_ipi(uint32_t);
1.26      ad        191:
1.3       bouyer    192: #endif /* !_LOCORE */
                    193:
1.1       cl        194: #endif /* _XEN_INTR_H_ */

CVSweb <webmaster@jp.NetBSD.org>