Index: dev/msk/if_msk.c =================================================================== --- dev/msk/if_msk.c (revision 310641) +++ dev/msk/if_msk.c (working copy) @@ -1990,7 +1990,7 @@ error = bus_setup_intr(dev, sc->msk_irq[0], INTR_TYPE_NET | INTR_MPSAFE, NULL, msk_intr, sc, &sc->msk_intrhand); if (error != 0) { - device_printf(dev, "couldn't set up interrupt handler\n"); + device_printf(dev, "couldn't set up interrupt handler: %d\n", error); goto fail; } fail: Index: arm/arm/gic.c =================================================================== --- arm/arm/gic.c (revision 310641) +++ arm/arm/gic.c (working copy) @@ -1426,10 +1426,13 @@ psc = device_get_softc(device_get_parent(dev)); sc = device_get_softc(dev); + device_printf(dev, "alloc msi: count=%u, maxcount=%u\n", count, maxcount); + mtx_lock(&sc->sc_mutex); found = false; for (irq = sc->sc_spi_start; irq < sc->sc_spi_end && !found; irq++) { + device_printf(dev, "checking irq %d\n", irq); /* Start on an aligned interrupt */ if ((irq & (maxcount - 1)) != 0) continue; @@ -1438,18 +1441,19 @@ found = true; /* Check this range is valid */ - for (end_irq = irq; end_irq != irq + count - 1; end_irq++) { - /* No free interrupts */ - if (end_irq == sc->sc_spi_end) { + for (end_irq = irq; end_irq < irq + count; end_irq++) { + device_printf(dev, "checking end_irq %d\n", end_irq); + KASSERT((psc->gic_irqs[end_irq].gi_flags & GI_FLAG_MSI)!= 0, + ("%s: Non-MSI interrupt found", __func__)); + + /* Range does not fit */ + if (end_irq >= sc->sc_spi_end) { found = false; break; } - KASSERT((psc->gic_irqs[irq].gi_flags & GI_FLAG_MSI)!= 0, - ("%s: Non-MSI interrupt found", __func__)); - /* This is already used */ - if ((psc->gic_irqs[irq].gi_flags & GI_FLAG_MSI_USED) == + if ((psc->gic_irqs[end_irq].gi_flags & GI_FLAG_MSI_USED) == GI_FLAG_MSI_USED) { found = false; break; @@ -1458,6 +1462,7 @@ } /* Not enough interrupts were found */ + device_printf(dev, "found=%d, irq=%d\n", found, irq); if (!found || irq == sc->sc_spi_end) { mtx_unlock(&sc->sc_mutex); return (ENXIO);