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

Cache object: e13b5962d12d17253f75165c30489a2b


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