diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -753,7 +753,7 @@ /* Note that pic->pic_dev is never NULL on registered PIC. */ STAILQ_FOREACH(pic, &pic_list, pic_next) { - if ((pic->pic_flags & FLAG_TYPE_MASK) != + if ((pic->pic_flags & flags & FLAG_TYPE_MASK) != (flags & FLAG_TYPE_MASK)) continue; @@ -792,8 +792,9 @@ struct intr_pic *pic; mtx_lock(&pic_list_lock); - pic = pic_lookup_locked(dev, xref, flags); + pic = pic_lookup_locked(dev, xref, flags & ~FLAG_TYPE_MASK); if (pic != NULL) { + pic->pic_flags |= flags & FLAG_TYPE_MASK; mtx_unlock(&pic_list_lock); return (pic); } @@ -885,7 +886,7 @@ return (EINVAL); } - KASSERT((pic->pic_flags & FLAG_TYPE_MASK) == FLAG_PIC, + KASSERT((pic->pic_flags & FLAG_PIC) == FLAG_PIC, ("%s: Found a non-PIC controller: %s", __func__, device_get_name(pic->pic_dev))); @@ -968,7 +969,7 @@ switch (data->type) { case INTR_MAP_DATA_MSI: - KASSERT((pic->pic_flags & FLAG_TYPE_MASK) == FLAG_MSI, + KASSERT((pic->pic_flags & FLAG_MSI) == FLAG_MSI, ("%s: Found a non-MSI controller: %s", __func__, device_get_name(pic->pic_dev))); msi = (struct intr_map_data_msi *)data; @@ -976,7 +977,7 @@ return (0); default: - KASSERT((pic->pic_flags & FLAG_TYPE_MASK) == FLAG_PIC, + KASSERT((pic->pic_flags & FLAG_PIC) == FLAG_PIC, ("%s: Found a non-PIC controller: %s", __func__, device_get_name(pic->pic_dev))); return (PIC_MAP_INTR(pic->pic_dev, data, isrc)); @@ -1360,7 +1361,7 @@ if (pic == NULL) return (ESRCH); - KASSERT((pic->pic_flags & FLAG_TYPE_MASK) == FLAG_MSI, + KASSERT((pic->pic_flags & FLAG_MSI) == FLAG_MSI, ("%s: Found a non-MSI controller: %s", __func__, device_get_name(pic->pic_dev))); @@ -1406,7 +1407,7 @@ if (pic == NULL) return (ESRCH); - KASSERT((pic->pic_flags & FLAG_TYPE_MASK) == FLAG_MSI, + KASSERT((pic->pic_flags & FLAG_MSI) == FLAG_MSI, ("%s: Found a non-MSI controller: %s", __func__, device_get_name(pic->pic_dev))); @@ -1448,7 +1449,7 @@ if (pic == NULL) return (ESRCH); - KASSERT((pic->pic_flags & FLAG_TYPE_MASK) == FLAG_MSI, + KASSERT((pic->pic_flags & FLAG_MSI) == FLAG_MSI, ("%s: Found a non-MSI controller: %s", __func__, device_get_name(pic->pic_dev))); @@ -1484,7 +1485,7 @@ if (pic == NULL) return (ESRCH); - KASSERT((pic->pic_flags & FLAG_TYPE_MASK) == FLAG_MSI, + KASSERT((pic->pic_flags & FLAG_MSI) == FLAG_MSI, ("%s: Found a non-MSI controller: %s", __func__, device_get_name(pic->pic_dev))); @@ -1519,7 +1520,7 @@ if (pic == NULL) return (ESRCH); - KASSERT((pic->pic_flags & FLAG_TYPE_MASK) == FLAG_MSI, + KASSERT((pic->pic_flags & FLAG_MSI) == FLAG_MSI, ("%s: Found a non-MSI controller: %s", __func__, device_get_name(pic->pic_dev)));