Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_intr.c
Show First 20 Lines • Show All 892 Lines • ▼ Show 20 Lines | intr_pic_claim_root(device_t dev, intptr_t xref, intr_irq_filter_t *filter, | ||||
debugf("irq root set to %s\n", device_get_nameunit(dev)); | debugf("irq root set to %s\n", device_get_nameunit(dev)); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Add a handler to manage a sub range of a parents interrupts. | * Add a handler to manage a sub range of a parents interrupts. | ||||
*/ | */ | ||||
struct intr_pic * | int | ||||
intr_pic_add_handler(device_t parent, struct intr_pic *pic, | intr_pic_add_handler(device_t parent, struct intr_pic *pic, | ||||
intr_child_irq_filter_t *filter, void *arg, uintptr_t start, | intr_child_irq_filter_t *filter, void *arg, uintptr_t start, | ||||
uintptr_t length) | uintptr_t length) | ||||
{ | { | ||||
struct intr_pic *parent_pic; | struct intr_pic *parent_pic; | ||||
struct intr_pic_child *newchild; | struct intr_pic_child *newchild; | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
struct intr_pic_child *child; | struct intr_pic_child *child; | ||||
#endif | #endif | ||||
/* Find the parent PIC */ | /* Find the parent PIC */ | ||||
parent_pic = pic_lookup(parent, 0, FLAG_PIC); | parent_pic = pic_lookup(parent, 0, FLAG_PIC); | ||||
if (parent_pic == NULL) | if (parent_pic == NULL) | ||||
return (NULL); | return (ENXIO); | ||||
newchild = malloc(sizeof(*newchild), M_INTRNG, M_WAITOK | M_ZERO); | newchild = malloc(sizeof(*newchild), M_INTRNG, M_WAITOK | M_ZERO); | ||||
newchild->pc_pic = pic; | newchild->pc_pic = pic; | ||||
newchild->pc_filter = filter; | newchild->pc_filter = filter; | ||||
newchild->pc_filter_arg = arg; | newchild->pc_filter_arg = arg; | ||||
newchild->pc_start = start; | newchild->pc_start = start; | ||||
newchild->pc_length = length; | newchild->pc_length = length; | ||||
mtx_lock_spin(&parent_pic->pic_child_lock); | mtx_lock_spin(&parent_pic->pic_child_lock); | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
SLIST_FOREACH(child, &parent_pic->pic_children, pc_next) { | SLIST_FOREACH(child, &parent_pic->pic_children, pc_next) { | ||||
KASSERT(child->pc_pic != pic, ("%s: Adding a child PIC twice", | KASSERT(child->pc_pic != pic, ("%s: Adding a child PIC twice", | ||||
__func__)); | __func__)); | ||||
} | } | ||||
#endif | #endif | ||||
SLIST_INSERT_HEAD(&parent_pic->pic_children, newchild, pc_next); | SLIST_INSERT_HEAD(&parent_pic->pic_children, newchild, pc_next); | ||||
mtx_unlock_spin(&parent_pic->pic_child_lock); | mtx_unlock_spin(&parent_pic->pic_child_lock); | ||||
return (pic); | return (0); | ||||
} | } | ||||
static int | static int | ||||
intr_resolve_irq(device_t dev, intptr_t xref, struct intr_map_data *data, | intr_resolve_irq(device_t dev, intptr_t xref, struct intr_map_data *data, | ||||
struct intr_irqsrc **isrc) | struct intr_irqsrc **isrc) | ||||
{ | { | ||||
struct intr_pic *pic; | struct intr_pic *pic; | ||||
struct intr_map_data_msi *msi; | struct intr_map_data_msi *msi; | ||||
▲ Show 20 Lines • Show All 801 Lines • Show Last 20 Lines |