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/intr.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) 2015-2016 Svatopluk Kraus
    3  * Copyright (c) 2015-2016 Michal Meloun
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following 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 AND CONTRIBUTORS ``AS IS'' AND
   16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   25  * SUCH DAMAGE.
   26  *
   27  * $FreeBSD: releng/11.2/sys/sys/intr.h 308333 2016-11-05 10:23:02Z mmel $
   28  */
   29 
   30 #ifndef _SYS_INTR_H_
   31 #define _SYS_INTR_H_
   32 #ifndef INTRNG
   33 #error Need INTRNG for this file
   34 #endif
   35 
   36 #include <sys/systm.h>
   37 
   38 #define INTR_IRQ_INVALID        0xFFFFFFFF
   39 
   40 enum intr_map_data_type {
   41         INTR_MAP_DATA_ACPI = 0,
   42         INTR_MAP_DATA_FDT,
   43         INTR_MAP_DATA_GPIO,
   44         INTR_MAP_DATA_MSI,
   45         
   46         /* Placeholders for platform specific types */
   47         INTR_MAP_DATA_PLAT_1 = 1000,
   48         INTR_MAP_DATA_PLAT_2,
   49         INTR_MAP_DATA_PLAT_3,
   50         INTR_MAP_DATA_PLAT_4,
   51         INTR_MAP_DATA_PLAT_5,
   52 };
   53 
   54 struct intr_map_data {
   55         size_t                  len;
   56         enum intr_map_data_type type;
   57 };
   58 
   59 struct intr_map_data_msi {
   60         struct intr_map_data    hdr;
   61         struct intr_irqsrc      *isrc;
   62 };
   63 
   64 #ifdef notyet
   65 #define INTR_SOLO       INTR_MD1
   66 typedef int intr_irq_filter_t(void *arg, struct trapframe *tf);
   67 #else
   68 typedef int intr_irq_filter_t(void *arg);
   69 #endif
   70 typedef int intr_child_irq_filter_t(void *arg, uintptr_t irq);
   71 
   72 #define INTR_ISRC_NAMELEN       (MAXCOMLEN + 1)
   73 
   74 #define INTR_ISRCF_IPI          0x01    /* IPI interrupt */
   75 #define INTR_ISRCF_PPI          0x02    /* PPI interrupt */
   76 #define INTR_ISRCF_BOUND        0x04    /* bound to a CPU */
   77 
   78 struct intr_pic;
   79 
   80 /* Interrupt source definition. */
   81 struct intr_irqsrc {
   82         device_t                isrc_dev;       /* where isrc is mapped */
   83         u_int                   isrc_irq;       /* unique identificator */
   84         u_int                   isrc_flags;
   85         char                    isrc_name[INTR_ISRC_NAMELEN];
   86         cpuset_t                isrc_cpu;       /* on which CPUs is enabled */
   87         u_int                   isrc_index;
   88         u_long *                isrc_count;
   89         u_int                   isrc_handlers;
   90         struct intr_event *     isrc_event;
   91 #ifdef INTR_SOLO
   92         intr_irq_filter_t *     isrc_filter;
   93         void *                  isrc_arg;
   94 #endif
   95 };
   96 
   97 /* Intr interface for PIC. */
   98 int intr_isrc_deregister(struct intr_irqsrc *);
   99 int intr_isrc_register(struct intr_irqsrc *, device_t, u_int, const char *, ...)
  100     __printflike(4, 5);
  101 
  102 #ifdef SMP
  103 bool intr_isrc_init_on_cpu(struct intr_irqsrc *isrc, u_int cpu);
  104 #endif
  105 
  106 int intr_isrc_dispatch(struct intr_irqsrc *, struct trapframe *);
  107 u_int intr_irq_next_cpu(u_int current_cpu, cpuset_t *cpumask);
  108 
  109 struct intr_pic *intr_pic_register(device_t, intptr_t);
  110 int intr_pic_deregister(device_t, intptr_t);
  111 int intr_pic_claim_root(device_t, intptr_t, intr_irq_filter_t *, void *, u_int);
  112 struct intr_pic *intr_pic_add_handler(device_t, struct intr_pic *,
  113     intr_child_irq_filter_t *, void *, uintptr_t, uintptr_t);
  114 
  115 extern device_t intr_irq_root_dev;
  116 
  117 /* Intr interface for BUS. */
  118 
  119 int intr_activate_irq(device_t, struct resource *);
  120 int intr_deactivate_irq(device_t, struct resource *);
  121 
  122 int intr_setup_irq(device_t, struct resource *, driver_filter_t, driver_intr_t,
  123     void *, int, void **);
  124 int intr_teardown_irq(device_t, struct resource *, void *);
  125 
  126 int intr_describe_irq(device_t, struct resource *, void *, const char *);
  127 int intr_child_irq_handler(struct intr_pic *, uintptr_t);
  128 
  129 /* Intr resources  mapping. */
  130 struct intr_map_data *intr_alloc_map_data(enum intr_map_data_type, size_t, int);
  131 void intr_free_intr_map_data(struct intr_map_data *);
  132 u_int intr_map_irq(device_t, intptr_t, struct intr_map_data *);
  133 void intr_unmap_irq(u_int );
  134 u_int intr_map_clone_irq(u_int );
  135 
  136 /* MSI/MSI-X handling */
  137 int intr_msi_register(device_t, intptr_t);
  138 int intr_alloc_msi(device_t, device_t, intptr_t, int, int, int *);
  139 int intr_release_msi(device_t, device_t, intptr_t, int, int *);
  140 int intr_map_msi(device_t, device_t, intptr_t, int, uint64_t *, uint32_t *);
  141 int intr_alloc_msix(device_t, device_t, intptr_t, int *);
  142 int intr_release_msix(device_t, device_t, intptr_t, int);
  143 
  144 #ifdef SMP
  145 int intr_bind_irq(device_t, struct resource *, int);
  146 
  147 void intr_pic_init_secondary(void);
  148 
  149 /* Virtualization for interrupt source IPI counter increment. */
  150 static inline void
  151 intr_ipi_increment_count(u_long *counter, u_int cpu)
  152 {
  153 
  154         KASSERT(cpu < MAXCPU, ("%s: too big cpu %u", __func__, cpu));
  155         counter[cpu]++;
  156 }
  157 
  158 /* Virtualization for interrupt source IPI counters setup. */
  159 u_long * intr_ipi_setup_counters(const char *name);
  160 
  161 #endif
  162 #endif  /* _SYS_INTR_H */

Cache object: 379717556cfccb7f436c69803e9568ab


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