Index: sys/mips/mips/mips_pic.c =================================================================== --- sys/mips/mips/mips_pic.c +++ sys/mips/mips/mips_pic.c @@ -68,6 +68,7 @@ #define NHARD_IRQS 6 #define NSOFT_IRQS 2 #define NREAL_IRQS (NHARD_IRQS + NSOFT_IRQS) +#define NFDT_CELLS 1 static int mips_pic_intr(void *); @@ -383,6 +384,37 @@ { } +static int +cpu_create_intr_map(int irq) +{ + struct intr_map_data_fdt *fdt_data; + size_t len; + phandle_t iparent; + u_int new_irq; + + iparent = pic_xref(pic_sc->pic_dev); + len = sizeof(*fdt_data) + NFDT_CELLS * sizeof(pcell_t); + + /* Allocate artificial FDT data and fill it in */ + fdt_data = (struct intr_map_data_fdt *)intr_alloc_map_data( + INTR_MAP_DATA_FDT, len, M_WAITOK | M_ZERO); + fdt_data->hdr.type = INTR_MAP_DATA_FDT; + fdt_data->iparent = iparent; + fdt_data->ncells = NFDT_CELLS; + fdt_data->cells[0] = irq; + + /* Get the new irq number */ + new_irq = intr_map_irq(pic_sc->pic_dev, iparent, + (struct intr_map_data *)fdt_data); + + /* Adjust the resource accordingly */ + rman_set_start(pic_sc->pic_irqs[irq].res, new_irq); + rman_set_end(pic_sc->pic_irqs[irq].res, new_irq); + + /* Activate the new irq */ + return (intr_activate_irq(pic_sc->pic_dev, pic_sc->pic_irqs[irq].res)); +} + void cpu_establish_hardintr(const char *name, driver_filter_t *filt, void (*handler)(void*), void *arg, int irq, int flags, void **cookiep) @@ -398,6 +430,10 @@ KASSERT(pic_sc != NULL, ("%s: no pic", __func__)); irq += NSOFT_IRQS; + + res = cpu_create_intr_map(irq); + if (res != 0) panic("Unable to create map for hard IRQ %d", irq); + res = intr_setup_irq(pic_sc->pic_dev, pic_sc->pic_irqs[irq].res, filt, handler, arg, flags, cookiep); if (res != 0) panic("Unable to add hard IRQ %d handler", irq); @@ -415,6 +451,9 @@ KASSERT(pic_sc != NULL, ("%s: no pic", __func__)); + res = cpu_create_intr_map(irq); + if (res != 0) panic("Unable to create map for soft IRQ %d", irq); + res = intr_setup_irq(pic_sc->pic_dev, pic_sc->pic_irqs[irq].res, filt, handler, arg, flags, cookiep); if (res != 0) panic("Unable to add soft IRQ %d handler", irq);