FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include "opt_hwpmc_hooks.h"
#include "opt_iommu.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/syslog.h>
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/bus.h>
#include <sys/interrupt.h>
#include <sys/taskqueue.h>
#include <sys/tree.h>
#include <sys/conf.h>
#include <sys/cpuset.h>
#include <sys/rman.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/vmmeter.h>
#include <machine/atomic.h>
#include <machine/intr.h>
#include <machine/cpu.h>
#include <machine/smp.h>
#include <machine/stdarg.h>
#include "pic_if.h"
#include "msi_if.h"
Go to the source code of this file.
Data Structures | |
struct | intr_pic_child |
struct | intr_pic |
struct | intr_map_entry |
Macros | |
#define | INTRNAME_LEN (2*MAXCOMLEN + 1) |
#define | debugf(fmt, args...) |
#define | FLAG_PIC (1 << 0) |
#define | FLAG_MSI (1 << 1) |
#define | FLAG_TYPE_MASK (FLAG_PIC | FLAG_MSI) |
Functions | |
__FBSDID ("$FreeBSD$") | |
MALLOC_DECLARE (M_INTRNG) | |
MALLOC_DEFINE (M_INTRNG, "intr", "intr interrupt handling") | |
void | intr_irq_handler (struct trapframe *tf) |
static | SLIST_HEAD (intr_pic) |
SYSINIT (intr_irq_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_irq_init, NULL) | |
static void | intrcnt_setname (const char *name, int index) |
static void | intrcnt_updatename (struct intr_irqsrc *isrc) |
static void | isrc_increment_count (struct intr_irqsrc *isrc) |
static void | isrc_increment_straycount (struct intr_irqsrc *isrc) |
static void | isrc_update_name (struct intr_irqsrc *isrc, const char *name) |
static void | isrc_setup_counters (struct intr_irqsrc *isrc) |
static void | isrc_release_counters (struct intr_irqsrc *isrc) |
int | intr_child_irq_handler (struct intr_pic *parent, uintptr_t irq) |
int | intr_isrc_dispatch (struct intr_irqsrc *isrc, struct trapframe *tf) |
static int | isrc_alloc_irq (struct intr_irqsrc *isrc) |
static int | isrc_free_irq (struct intr_irqsrc *isrc) |
int | intr_isrc_register (struct intr_irqsrc *isrc, device_t dev, u_int flags, const char *fmt,...) |
int | intr_isrc_deregister (struct intr_irqsrc *isrc) |
static void | intr_isrc_pre_ithread (void *arg) |
static void | intr_isrc_post_ithread (void *arg) |
static void | intr_isrc_post_filter (void *arg) |
static int | intr_isrc_assign_cpu (void *arg, int cpu) |
static int | isrc_event_create (struct intr_irqsrc *isrc) |
static int | isrc_add_handler (struct intr_irqsrc *isrc, const char *name, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep) |
static struct intr_pic * | pic_lookup_locked (device_t dev, intptr_t xref, int flags) |
static struct intr_pic * | pic_lookup (device_t dev, intptr_t xref, int flags) |
static struct intr_pic * | pic_create (device_t dev, intptr_t xref, int flags) |
struct intr_pic * | intr_pic_register (device_t dev, intptr_t xref) |
int | intr_pic_deregister (device_t dev, intptr_t xref) |
int | intr_pic_claim_root (device_t dev, intptr_t xref, intr_irq_filter_t *filter, void *arg, u_int ipicount) |
int | intr_pic_add_handler (device_t parent, struct intr_pic *pic, intr_child_irq_filter_t *filter, void *arg, uintptr_t start, uintptr_t length) |
static int | intr_resolve_irq (device_t dev, intptr_t xref, struct intr_map_data *data, struct intr_irqsrc **isrc) |
bool | intr_is_per_cpu (struct resource *res) |
int | intr_activate_irq (device_t dev, struct resource *res) |
int | intr_deactivate_irq (device_t dev, struct resource *res) |
int | intr_setup_irq (device_t dev, struct resource *res, driver_filter_t filt, driver_intr_t hand, void *arg, int flags, void **cookiep) |
int | intr_teardown_irq (device_t dev, struct resource *res, void *cookie) |
int | intr_describe_irq (device_t dev, struct resource *res, void *cookie, const char *descr) |
u_int | intr_irq_next_cpu (u_int current_cpu, cpuset_t *cpumask) |
struct intr_map_data * | intr_alloc_map_data (enum intr_map_data_type type, size_t len, int flags) |
void | intr_free_intr_map_data (struct intr_map_data *data) |
int | intr_msi_register (device_t dev, intptr_t xref) |
int | intr_alloc_msi (device_t pci, device_t child, intptr_t xref, int count, int maxcount, int *irqs) |
int | intr_release_msi (device_t pci, device_t child, intptr_t xref, int count, int *irqs) |
int | intr_alloc_msix (device_t pci, device_t child, intptr_t xref, int *irq) |
int | intr_release_msix (device_t pci, device_t child, intptr_t xref, int irq) |
int | intr_map_msi (device_t pci, device_t child, intptr_t xref, int irq, uint64_t *addr, uint32_t *data) |
void | dosoftints (void) |
static struct intr_irqsrc * | intr_map_get_isrc (u_int res_id) |
static void | intr_map_set_isrc (u_int res_id, struct intr_irqsrc *isrc) |
static struct intr_map_data * | intr_map_get_map_data (u_int res_id) |
static void | intr_map_copy_map_data (u_int res_id, device_t *map_dev, intptr_t *map_xref, struct intr_map_data **data) |
u_int | intr_map_irq (device_t dev, intptr_t xref, struct intr_map_data *data) |
void | intr_unmap_irq (u_int res_id) |
u_int | intr_map_clone_irq (u_int old_res_id) |
static void | intr_map_init (void *dummy __unused) |
SYSINIT (intr_map_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_map_init, NULL) | |
Variables | |
device_t | intr_irq_root_dev |
static intr_irq_filter_t * | irq_root_filter |
static void * | irq_root_arg |
static u_int | irq_root_ipicount |
static struct mtx | pic_list_lock |
static struct intr_map_entry ** | irq_map |
static u_int | irq_map_count |
static u_int | irq_map_first_free_idx |
static struct mtx | irq_map_lock |
#define debugf | ( | fmt, | |
args... | |||
) |
Definition at line 90 of file subr_intr.c.
#define FLAG_MSI (1 << 1) |
#define FLAG_PIC (1 << 0) |
#define INTRNAME_LEN (2*MAXCOMLEN + 1) |
Definition at line 84 of file subr_intr.c.
__FBSDID | ( | "$FreeBSD$" | ) |
void dosoftints | ( | void | ) |
Definition at line 1525 of file subr_intr.c.
int intr_activate_irq | ( | device_t | dev, |
struct resource * | res | ||
) |
Definition at line 985 of file subr_intr.c.
References data, free(), intr_map_copy_map_data(), intr_map_get_isrc(), intr_map_set_isrc(), intr_resolve_irq(), isrc, panic(), res, rman_get_end(), rman_get_start(), and rman_set_virtual().
struct intr_map_data * intr_alloc_map_data | ( | enum intr_map_data_type | type, |
size_t | len, | ||
int | flags | ||
) |
Definition at line 1296 of file subr_intr.c.
References data, flags, malloc(), and type.
Referenced by intr_alloc_msi(), and intr_alloc_msix().
int intr_alloc_msi | ( | device_t | pci, |
device_t | child, | ||
intptr_t | xref, | ||
int | count, | ||
int | maxcount, | ||
int * | irqs | ||
) |
Definition at line 1332 of file subr_intr.c.
References child, count, device_get_name(), domain, FLAG_MSI, FLAG_TYPE_MASK, free(), intr_alloc_map_data(), intr_map_irq(), isrc, malloc(), maxcount, msi, pic, and pic_lookup().
int intr_alloc_msix | ( | device_t | pci, |
device_t | child, | ||
intptr_t | xref, | ||
int * | irq | ||
) |
Definition at line 1421 of file subr_intr.c.
References child, device_get_name(), domain, FLAG_MSI, FLAG_TYPE_MASK, intr_alloc_map_data(), intr_map_irq(), isrc, msi, pic, and pic_lookup().
int intr_child_irq_handler | ( | struct intr_pic * | parent, |
uintptr_t | irq | ||
) |
Definition at line 338 of file subr_intr.c.
int intr_deactivate_irq | ( | device_t | dev, |
struct resource * | res | ||
) |
Definition at line 1015 of file subr_intr.c.
References data, free(), intr_map_get_isrc(), intr_map_set_isrc(), isrc, panic(), res, rman_get_end(), rman_get_start(), rman_get_virtual(), and rman_set_virtual().
int intr_describe_irq | ( | device_t | dev, |
struct resource * | res, | ||
void * | cookie, | ||
const char * | descr | ||
) |
Definition at line 1157 of file subr_intr.c.
References intr_event_describe_handler(), intr_map_get_isrc(), intrcnt_updatename(), isrc, isrc_update_name(), res, rman_get_end(), and rman_get_start().
void intr_free_intr_map_data | ( | struct intr_map_data * | data | ) |
Definition at line 1306 of file subr_intr.c.
Referenced by intr_unmap_irq().
void intr_irq_handler | ( | struct trapframe * | tf | ) |
Definition at line 315 of file subr_intr.c.
References irq_root_arg, irq_root_filter, and pmc_hook.
u_int intr_irq_next_cpu | ( | u_int | current_cpu, |
cpuset_t * | cpumask | ||
) |
Definition at line 1284 of file subr_intr.c.
bool intr_is_per_cpu | ( | struct resource * | res | ) |
Definition at line 970 of file subr_intr.c.
References intr_map_get_isrc(), isrc, panic(), res, and rman_get_start().
|
static |
Definition at line 608 of file subr_intr.c.
References isrc.
Referenced by isrc_event_create().
int intr_isrc_deregister | ( | struct intr_irqsrc * | isrc | ) |
Definition at line 502 of file subr_intr.c.
References isrc, isrc_free_irq(), and isrc_release_counters().
int intr_isrc_dispatch | ( | struct intr_irqsrc * | isrc, |
struct trapframe * | tf | ||
) |
Definition at line 366 of file subr_intr.c.
References intr_event_handle(), isrc, isrc_increment_count(), and isrc_increment_straycount().
|
static |
Definition at line 597 of file subr_intr.c.
References isrc.
Referenced by isrc_event_create().
|
static |
Definition at line 586 of file subr_intr.c.
References isrc.
Referenced by isrc_event_create().
|
static |
Definition at line 575 of file subr_intr.c.
References isrc.
Referenced by isrc_event_create().
int intr_isrc_register | ( | struct intr_irqsrc * | isrc, |
device_t | dev, | ||
u_int | flags, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 466 of file subr_intr.c.
References flags, isrc, isrc_alloc_irq(), isrc_setup_counters(), and vsnprintf().
u_int intr_map_clone_irq | ( | u_int | old_res_id | ) |
Definition at line 1723 of file subr_intr.c.
References data, intr_map_copy_map_data(), and intr_map_irq().
|
static |
Definition at line 1638 of file subr_intr.c.
References data, intr_map_entry::dev, irq_map, irq_map_count, irq_map_lock, malloc(), intr_map_entry::map_data, panic(), and intr_map_entry::xref.
Referenced by intr_activate_irq(), and intr_map_clone_irq().
|
static |
Definition at line 1593 of file subr_intr.c.
References irq_map, irq_map_count, irq_map_lock, isrc, and intr_map_entry::isrc.
Referenced by intr_activate_irq(), intr_deactivate_irq(), intr_describe_irq(), intr_is_per_cpu(), intr_map_msi(), intr_setup_irq(), and intr_teardown_irq().
|
static |
Definition at line 1620 of file subr_intr.c.
References data, irq_map, irq_map_count, irq_map_lock, intr_map_entry::map_data, and panic().
Referenced by intr_release_msi(), and intr_release_msix().
|
static |
Definition at line 1734 of file subr_intr.c.
References irq_map, irq_map_count, irq_map_lock, and mallocarray().
u_int intr_map_irq | ( | device_t | dev, |
intptr_t | xref, | ||
struct intr_map_data * | data | ||
) |
Definition at line 1672 of file subr_intr.c.
References data, intr_map_entry::dev, irq_map, irq_map_count, irq_map_first_free_idx, irq_map_lock, intr_map_entry::isrc, malloc(), intr_map_entry::map_data, panic(), and intr_map_entry::xref.
Referenced by intr_alloc_msi(), intr_alloc_msix(), and intr_map_clone_irq().
int intr_map_msi | ( | device_t | pci, |
device_t | child, | ||
intptr_t | xref, | ||
int | irq, | ||
uint64_t * | addr, | ||
uint32_t * | data | ||
) |
Definition at line 1494 of file subr_intr.c.
References addr, child, data, device_get_name(), FLAG_MSI, FLAG_TYPE_MASK, intr_map_get_isrc(), isrc, pic, and pic_lookup().
|
static |
Definition at line 1607 of file subr_intr.c.
References irq_map, irq_map_count, irq_map_lock, isrc, and intr_map_entry::isrc.
Referenced by intr_activate_irq(), and intr_deactivate_irq().
int intr_msi_register | ( | device_t | dev, |
intptr_t | xref | ||
) |
Definition at line 1316 of file subr_intr.c.
References debugf, device_get_nameunit(), FLAG_MSI, pic, and pic_create().
int intr_pic_add_handler | ( | device_t | parent, |
struct intr_pic * | pic, | ||
intr_child_irq_filter_t * | filter, | ||
void * | arg, | ||
uintptr_t | start, | ||
uintptr_t | length | ||
) |
Definition at line 902 of file subr_intr.c.
References child, FLAG_PIC, malloc(), parent, pic, pic_lookup(), and start.
int intr_pic_claim_root | ( | device_t | dev, |
intptr_t | xref, | ||
intr_irq_filter_t * | filter, | ||
void * | arg, | ||
u_int | ipicount | ||
) |
Definition at line 859 of file subr_intr.c.
References debugf, device_get_name(), device_get_nameunit(), device_printf(), FLAG_PIC, FLAG_TYPE_MASK, intr_irq_root_dev, irq_root_arg, irq_root_filter, irq_root_ipicount, pic, and pic_lookup().
int intr_pic_deregister | ( | device_t | dev, |
intptr_t | xref | ||
) |
Definition at line 840 of file subr_intr.c.
References panic().
struct intr_pic * intr_pic_register | ( | device_t | dev, |
intptr_t | xref | ||
) |
Definition at line 821 of file subr_intr.c.
References debugf, device_get_nameunit(), FLAG_PIC, pic, and pic_create().
int intr_release_msi | ( | device_t | pci, |
device_t | child, | ||
intptr_t | xref, | ||
int | count, | ||
int * | irqs | ||
) |
Definition at line 1380 of file subr_intr.c.
References child, count, device_get_name(), FLAG_MSI, FLAG_TYPE_MASK, free(), intr_map_get_map_data(), intr_unmap_irq(), isrc, malloc(), msi, pic, and pic_lookup().
int intr_release_msix | ( | device_t | pci, |
device_t | child, | ||
intptr_t | xref, | ||
int | irq | ||
) |
Definition at line 1459 of file subr_intr.c.
References child, device_get_name(), FLAG_MSI, FLAG_TYPE_MASK, intr_map_get_map_data(), intr_unmap_irq(), isrc, msi, pic, and pic_lookup().
|
static |
Definition at line 938 of file subr_intr.c.
References data, device_get_name(), FLAG_MSI, FLAG_PIC, FLAG_TYPE_MASK, isrc, msi, pic, and pic_lookup().
Referenced by intr_activate_irq().
int intr_setup_irq | ( | device_t | dev, |
struct resource * | res, | ||
driver_filter_t | filt, | ||
driver_intr_t | hand, | ||
void * | arg, | ||
int | flags, | ||
void ** | cookiep | ||
) |
Definition at line 1040 of file subr_intr.c.
References data, debugf, device_get_nameunit(), flags, intr_event_remove_handler(), intr_map_get_isrc(), isrc, isrc_add_handler(), name, res, rman_get_end(), rman_get_start(), and rman_get_virtual().
int intr_teardown_irq | ( | device_t | dev, |
struct resource * | res, | ||
void * | cookie | ||
) |
Definition at line 1107 of file subr_intr.c.
References data, intr_event_remove_handler(), intr_handler_source(), intr_map_get_isrc(), intrcnt_updatename(), isrc, isrc_update_name(), res, rman_get_end(), rman_get_start(), and rman_get_virtual().
void intr_unmap_irq | ( | u_int | res_id | ) |
Definition at line 1704 of file subr_intr.c.
References free(), intr_free_intr_map_data(), irq_map, irq_map_count, irq_map_first_free_idx, irq_map_lock, intr_map_entry::map_data, and panic().
Referenced by intr_release_msi(), and intr_release_msix().
|
static |
Definition at line 197 of file subr_intr.c.
References INTRNAME_LEN, name, and snprintf().
Referenced by intrcnt_updatename(), and isrc_update_name().
|
static |
Definition at line 208 of file subr_intr.c.
References intrcnt_setname(), and isrc.
Referenced by intr_describe_irq(), intr_teardown_irq(), and isrc_add_handler().
|
static |
Definition at line 700 of file subr_intr.c.
References flags, intr_event_add_handler(), intrcnt_updatename(), isrc, isrc_event_create(), and name.
Referenced by intr_setup_irq().
|
inlinestatic |
Definition at line 402 of file subr_intr.c.
References isrc.
Referenced by intr_isrc_register().
|
static |
Definition at line 648 of file subr_intr.c.
References intr_event_create(), intr_event_destroy(), intr_isrc_assign_cpu(), intr_isrc_post_filter(), intr_isrc_post_ithread(), intr_isrc_pre_ithread(), and isrc.
Referenced by isrc_add_handler().
|
inlinestatic |
Definition at line 437 of file subr_intr.c.
References isrc.
Referenced by intr_isrc_deregister().
|
inlinestatic |
Definition at line 220 of file subr_intr.c.
References isrc.
Referenced by intr_isrc_dispatch().
|
inlinestatic |
Definition at line 233 of file subr_intr.c.
References isrc.
Referenced by intr_isrc_dispatch().
|
static |
Definition at line 285 of file subr_intr.c.
References panic().
Referenced by intr_isrc_deregister().
|
static |
Definition at line 267 of file subr_intr.c.
References isrc, and isrc_update_name().
Referenced by intr_isrc_register().
|
static |
Definition at line 243 of file subr_intr.c.
References intrcnt_setname(), INTRNAME_LEN, isrc, name, and snprintf().
Referenced by intr_describe_irq(), intr_teardown_irq(), and isrc_setup_counters().
MALLOC_DECLARE | ( | M_INTRNG | ) |
MALLOC_DEFINE | ( | M_INTRNG | , |
"intr" | , | ||
"intr interrupt handling" | |||
) |
|
static |
Definition at line 772 of file subr_intr.c.
References flags, malloc(), pic, pic_list_lock, and pic_lookup_locked().
Referenced by intr_msi_register(), and intr_pic_register().
|
static |
Definition at line 758 of file subr_intr.c.
References flags, pic, pic_list_lock, and pic_lookup_locked().
Referenced by intr_alloc_msi(), intr_alloc_msix(), intr_map_msi(), intr_pic_add_handler(), intr_pic_claim_root(), intr_release_msi(), intr_release_msix(), and intr_resolve_irq().
|
inlinestatic |
Definition at line 727 of file subr_intr.c.
References FLAG_TYPE_MASK, flags, pic, and pic_list_lock.
Referenced by pic_create(), and pic_lookup().
|
static |
Definition at line 129 of file subr_intr.c.
SYSINIT | ( | intr_irq_init | , |
SI_SUB_INTR | , | ||
SI_ORDER_FIRST | , | ||
intr_irq_init | , | ||
NULL | |||
) |
SYSINIT | ( | intr_map_init | , |
SI_SUB_INTR | , | ||
SI_ORDER_FIRST | , | ||
intr_map_init | , | ||
NULL | |||
) |
device_t intr_irq_root_dev |
Definition at line 100 of file subr_intr.c.
Referenced by intr_pic_claim_root().
|
static |
Definition at line 1587 of file subr_intr.c.
Referenced by intr_map_copy_map_data(), intr_map_get_isrc(), intr_map_get_map_data(), intr_map_init(), intr_map_irq(), intr_map_set_isrc(), and intr_unmap_irq().
|
static |
Definition at line 1588 of file subr_intr.c.
Referenced by intr_map_copy_map_data(), intr_map_get_isrc(), intr_map_get_map_data(), intr_map_init(), intr_map_irq(), intr_map_set_isrc(), and intr_unmap_irq().
|
static |
Definition at line 1589 of file subr_intr.c.
Referenced by intr_map_irq(), and intr_unmap_irq().
|
static |
Definition at line 1590 of file subr_intr.c.
Referenced by intr_map_copy_map_data(), intr_map_get_isrc(), intr_map_get_map_data(), intr_map_init(), intr_map_irq(), intr_map_set_isrc(), and intr_unmap_irq().
|
static |
Definition at line 102 of file subr_intr.c.
Referenced by intr_irq_handler(), and intr_pic_claim_root().
|
static |
Definition at line 101 of file subr_intr.c.
Referenced by intr_irq_handler(), and intr_pic_claim_root().
|
static |
Definition at line 103 of file subr_intr.c.
Referenced by intr_pic_claim_root().
|
static |
Definition at line 128 of file subr_intr.c.
Referenced by pic_create(), pic_lookup(), and pic_lookup_locked().