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-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
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/6.4/sys/sys/interrupt.h 169202 2007-05-02 06:15:13Z njl $
   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 /* Compatibility shims */
   36 #define tty_intr_event  tty_ithd
   37 #define clk_intr_event  clk_ithd
   38 #define ithd            intr_event
   39 #define ithread_destroy         intr_event_destroy
   40 #define ithread_remove_handler  intr_event_remove_handler
   41 
   42 struct intr_event;
   43 struct intr_thread;
   44 
   45 /*
   46  * Describe a hardware interrupt handler.
   47  *
   48  * Multiple interrupt handlers for a specific event can be chained
   49  * together.
   50  */
   51 struct intr_handler {
   52         driver_intr_t   *ih_handler;    /* Handler function. */
   53         void            *ih_argument;   /* Argument to pass to handler. */
   54         int              ih_flags;
   55         const char      *ih_name;       /* Name of handler. */
   56         struct intr_event *ih_event;    /* Event we are connected to. */
   57         int              ih_need;       /* Needs service. */
   58         TAILQ_ENTRY(intr_handler) ih_next; /* Next handler for this event. */
   59         u_char           ih_pri;        /* Priority of this handler. */
   60 };
   61 
   62 /* Interrupt handle flags kept in ih_flags */
   63 #define IH_FAST         0x00000001      /* Fast interrupt. */
   64 #define IH_EXCLUSIVE    0x00000002      /* Exclusive interrupt. */
   65 #define IH_ENTROPY      0x00000004      /* Device is a good entropy source. */
   66 #define IH_DEAD         0x00000008      /* Handler should be removed. */
   67 #define IH_MPSAFE       0x80000000      /* Handler does not need Giant. */
   68 
   69 /*
   70  * Describe an interrupt event.  An event holds a list of handlers.
   71  */
   72 struct intr_event {
   73         TAILQ_ENTRY(intr_event) ie_list;
   74         TAILQ_HEAD(, intr_handler) ie_handlers; /* Interrupt handlers. */
   75         char            ie_name[MAXCOMLEN]; /* Individual event name. */
   76         char            ie_fullname[MAXCOMLEN];
   77         struct mtx      ie_lock;
   78         void            *ie_source;     /* Cookie used by MD code. */
   79         struct intr_thread *ie_thread;  /* Thread we are connected to. */
   80         void            (*ie_enable)(void *);
   81         int             ie_flags;
   82         int             ie_count;       /* Loop counter. */
   83         int             ie_warncnt;     /* Rate-check interrupt storm warns. */
   84         struct timeval  ie_warntm;
   85 };
   86 
   87 /* Interrupt event flags kept in ie_flags. */
   88 #define IE_SOFT         0x000001        /* Software interrupt. */
   89 #define IE_ENTROPY      0x000002        /* Interrupt is an entropy source. */
   90 #define IE_ADDING_THREAD 0x000004       /* Currently building an ithread. */
   91 
   92 /* Flags to pass to sched_swi. */
   93 #define SWI_DELAY       0x2
   94 
   95 /*
   96  * Software interrupt numbers in priority order.  The priority determines
   97  * the priority of the corresponding interrupt thread.
   98  */
   99 #define SWI_TTY         0
  100 #define SWI_NET         1
  101 #define SWI_CAMBIO      2
  102 #define SWI_VM          3
  103 #define SWI_CLOCK       4
  104 #define SWI_TQ_FAST     5
  105 #define SWI_TQ          6
  106 #define SWI_TQ_GIANT    6
  107 
  108 extern struct   intr_event *tty_intr_event;
  109 extern struct   intr_event *clk_intr_event;
  110 extern void     *softclock_ih;
  111 extern void     *vm_ih;
  112 
  113 /* Counts and names for statistics (defined in MD code). */
  114 extern u_long   eintrcnt[];     /* end of intrcnt[] */
  115 extern char     eintrnames[];   /* end of intrnames[] */
  116 extern u_long   intrcnt[];      /* counts for for each device and stray */
  117 extern char     intrnames[];    /* string table containing device names */
  118 
  119 #ifdef DDB
  120 void    db_dump_intr_event(struct intr_event *ie, int handlers);
  121 #endif
  122 u_char  intr_priority(enum intr_type flags);
  123 int     intr_event_add_handler(struct intr_event *ie, const char *name,
  124             driver_intr_t handler, void *arg, u_char pri, enum intr_type flags,
  125             void **cookiep);
  126 int     intr_event_create(struct intr_event **event, void *source,
  127             int flags, void (*enable)(void *), const char *fmt, ...)
  128             __printflike(5, 6);
  129 int     intr_event_destroy(struct intr_event *ie);
  130 int     intr_event_remove_handler(void *cookie);
  131 int     intr_event_schedule_thread(struct intr_event *ie);
  132 int     swi_add(struct intr_event **eventp, const char *name,
  133             driver_intr_t handler, void *arg, int pri, enum intr_type flags,
  134             void **cookiep);
  135 void    swi_sched(void *cookie, int flags);
  136 int     swi_remove(void *cookie);
  137 
  138 #endif

Cache object: 0fa0c61c8628315f4cd2dcaa2528849b


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