* Add a handler to manage a sub range of a parents interrupts. */
| 890 | * Add a handler to manage a sub range of a parents interrupts. |
| 891 | */ |
| 892 | struct intr_pic * |
| 893 | intr_pic_add_handler(device_t parent, struct intr_pic *pic, |
| 894 | intr_child_irq_filter_t *filter, void *arg, uintptr_t start, |
| 895 | uintptr_t length) |
| 896 | { |
| 897 | struct intr_pic *parent_pic; |
| 898 | struct intr_pic_child *newchild; |
| 899 | #ifdef INVARIANTS |
| 900 | struct intr_pic_child *child; |
| 901 | #endif |
| 902 | |
| 903 | /* Find the parent PIC */ |
| 904 | parent_pic = pic_lookup(parent, 0, FLAG_PIC); |
| 905 | if (parent_pic == NULL) |
| 906 | return (NULL); |
| 907 | |
| 908 | newchild = malloc(sizeof(*newchild), M_INTRNG, M_WAITOK | M_ZERO); |
| 909 | newchild->pc_pic = pic; |
| 910 | newchild->pc_filter = filter; |
| 911 | newchild->pc_filter_arg = arg; |
| 912 | newchild->pc_start = start; |
| 913 | newchild->pc_length = length; |
| 914 | |
| 915 | mtx_lock_spin(&parent_pic->pic_child_lock); |
| 916 | #ifdef INVARIANTS |
| 917 | SLIST_FOREACH(child, &parent_pic->pic_children, pc_next) { |
| 918 | KASSERT(child->pc_pic != pic, ("%s: Adding a child PIC twice", |
| 919 | __func__)); |
| 920 | } |
| 921 | #endif |
| 922 | SLIST_INSERT_HEAD(&parent_pic->pic_children, newchild, pc_next); |
| 923 | mtx_unlock_spin(&parent_pic->pic_child_lock); |
| 924 | |
| 925 | return (pic); |
| 926 | } |
| 927 | |
| 928 | static int |
| 929 | intr_resolve_irq(device_t dev, intptr_t xref, struct intr_map_data *data, |
no test coverage detected