The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/interrupt.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice unmodified, this list of conditions, and the following
   10  *    disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/5.2/sys/sys/interrupt.h 122840 2003-11-17 06:08:10Z peter $
   27  */
   28 
   29 #ifndef _SYS_INTERRUPT_H_
   30 #define _SYS_INTERRUPT_H_
   31 
   32 #include <sys/_lock.h>
   33 #include <sys/_mutex.h>
   34 
   35 /*
   36  * Describe a hardware interrupt handler.
   37  *
   38  * Multiple interrupt handlers for a specific vector can be chained
   39  * together.
   40  */
   41 struct intrhand {
   42         driver_intr_t   *ih_handler;    /* Handler function. */
   43         void            *ih_argument;   /* Argument to pass to handler. */
   44         int              ih_flags;
   45         const char      *ih_name;       /* Name of handler. */
   46         struct ithd     *ih_ithread;    /* Ithread we are connected to. */
   47         int              ih_need;       /* Needs service. */
   48         TAILQ_ENTRY(intrhand) ih_next;  /* Next handler for this vector. */
   49         u_char           ih_pri;        /* Priority of this handler. */
   50 };
   51 
   52 /* Interrupt handle flags kept in ih_flags */
   53 #define IH_FAST         0x00000001      /* Fast interrupt. */
   54 #define IH_EXCLUSIVE    0x00000002      /* Exclusive interrupt. */
   55 #define IH_ENTROPY      0x00000004      /* Device is a good entropy source. */
   56 #define IH_DEAD         0x00000008      /* Handler should be removed. */
   57 #define IH_MPSAFE       0x80000000      /* Handler does not need Giant. */
   58 
   59 /*
   60  * Describe an interrupt thread.  There is one of these per interrupt vector.
   61  * Note that this actually describes an interrupt source.  There may or may
   62  * not be an actual kernel thread attached to a given source.
   63  */
   64 struct ithd {
   65         struct  mtx it_lock;
   66         struct  thread *it_td;          /* Interrupt process. */
   67         LIST_ENTRY(ithd) it_list;       /* All interrupt threads. */
   68         TAILQ_HEAD(, intrhand) it_handlers; /* Interrupt handlers. */
   69         struct  ithd *it_interrupted;   /* Who we interrupted. */
   70         void    (*it_disable)(uintptr_t); /* Enable interrupt source. */
   71         void    (*it_enable)(uintptr_t); /* Disable interrupt source. */
   72         void    *it_md;                 /* Hook for MD interrupt code. */
   73         int     it_flags;               /* Interrupt-specific flags. */
   74         int     it_need;                /* Needs service. */
   75         uintptr_t it_vector;
   76         char    it_name[MAXCOMLEN + 1];
   77 };
   78 
   79 /* Interrupt thread flags kept in it_flags */
   80 #define IT_SOFT         0x000001        /* Software interrupt. */
   81 #define IT_ENTROPY      0x000002        /* Interrupt is an entropy source. */
   82 #define IT_DEAD         0x000004        /* Thread is waiting to exit. */
   83 
   84 /* Flags to pass to sched_swi. */
   85 #define SWI_DELAY       0x2
   86 
   87 /*
   88  * Software interrupt bit numbers in priority order.  The priority only
   89  * determines which swi will be dispatched next; a higher priority swi
   90  * may be dispatched when a nested h/w interrupt handler returns.
   91  */
   92 #define SWI_TTY         0
   93 #define SWI_NET         1
   94 #define SWI_CAMNET      2
   95 #define SWI_CAMBIO      3
   96 #define SWI_VM          4
   97 #define SWI_TQ_FAST     5
   98 #define SWI_TQ_GIANT    6
   99 #define SWI_TQ          7
  100 #define SWI_CLOCK       8
  101 
  102 extern struct   ithd *tty_ithd;
  103 extern struct   ithd *clk_ithd;
  104 extern void     *net_ih;
  105 extern void     *softclock_ih;
  106 extern void     *vm_ih;
  107 
  108 /* Counts and names for statistics (defined in MD code). */
  109 extern u_long   eintrcnt[];     /* end of intrcnt[] */
  110 extern char     eintrnames[];   /* end of intrnames[] */
  111 extern u_long   intrcnt[];      /* counts for for each device and stray */
  112 extern char     intrnames[];    /* string table containing device names */
  113 
  114 #ifdef DDB
  115 void    db_dump_ithread(struct ithd *ithd, int handlers);
  116 #endif
  117 int     ithread_create(struct ithd **ithread, uintptr_t vector, int flags,
  118             void (*disable)(uintptr_t), void (*enable)(uintptr_t),
  119             const char *fmt, ...) __printflike(6, 7);
  120 int     ithread_destroy(struct ithd *ithread);
  121 u_char  ithread_priority(enum intr_type flags);
  122 int     ithread_add_handler(struct ithd *ithread, const char *name,
  123             driver_intr_t handler, void *arg, u_char pri, enum intr_type flags,
  124             void **cookiep);
  125 int     ithread_remove_handler(void *cookie);
  126 int     ithread_schedule(struct ithd *ithread, int do_switch);
  127 int     swi_add(struct ithd **ithdp, const char *name,
  128             driver_intr_t handler, void *arg, int pri, enum intr_type flags,
  129             void **cookiep);
  130 void    swi_sched(void *cookie, int flags);
  131 
  132 #endif

Cache object: 0d0136b06d51bfe93435e02d29668183


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.