* Create interrupt controller. */
| 760 | * Create interrupt controller. |
| 761 | */ |
| 762 | static struct intr_pic * |
| 763 | pic_create(device_t dev, intptr_t xref, int flags) |
| 764 | { |
| 765 | struct intr_pic *pic; |
| 766 | |
| 767 | mtx_lock(&pic_list_lock); |
| 768 | pic = pic_lookup_locked(dev, xref, flags); |
| 769 | if (pic != NULL) { |
| 770 | mtx_unlock(&pic_list_lock); |
| 771 | return (pic); |
| 772 | } |
| 773 | pic = malloc(sizeof(*pic), M_INTRNG, M_NOWAIT | M_ZERO); |
| 774 | if (pic == NULL) { |
| 775 | mtx_unlock(&pic_list_lock); |
| 776 | return (NULL); |
| 777 | } |
| 778 | pic->pic_xref = xref; |
| 779 | pic->pic_dev = dev; |
| 780 | pic->pic_flags = flags; |
| 781 | mtx_init(&pic->pic_child_lock, "pic child lock", NULL, MTX_SPIN); |
| 782 | SLIST_INSERT_HEAD(&pic_list, pic, pic_next); |
| 783 | mtx_unlock(&pic_list_lock); |
| 784 | |
| 785 | return (pic); |
| 786 | } |
| 787 | #ifdef notyet |
| 788 | /* |
| 789 | * Destroy interrupt controller. |
no test coverage detected