/* * Currently this uses the really grody interface from kern/kern_intr.c * (which really doesn't belong in kern/anything.c). Eventually, all of * the code in kern_intr.c and machdep_intr.c should get moved here, since * this is going to be the official interface. */ static int nexus_setup_intr(device_t bus, device_t child, struct resource *irq, int flags, void (*ihand)(void *), void *arg, void **cookiep) { driver_t *driver; int error; /* somebody tried to setup an irq that failed to allocate! */ if (irq == NULL) panic("nexus_setup_intr: NULL irq resource!"); *cookiep = 0; if ((irq->r_flags & RF_SHAREABLE) == 0) flags |= INTR_EXCL; driver = device_get_driver(child); /* * We depend here on rman_activate_resource() being idempotent. */ error = rman_activate_resource(irq); if (error) return (error); error = inthand_add(device_get_nameunit(child), irq->r_start, ihand, arg, flags, cookiep); return (error); }
static int nexus_setup_intr(device_t bus __unused, device_t child, struct resource *r, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { int error; if (r == NULL) panic("%s: NULL interrupt resource!", __func__); if ((rman_get_flags(r) & RF_SHAREABLE) == 0) flags |= INTR_EXCL; /* We depend here on rman_activate_resource() being idempotent. */ error = rman_activate_resource(r); if (error) return (error); error = inthand_add(device_get_nameunit(child), rman_get_start(r), filt, intr, arg, flags, cookiep); /* * XXX in case of the AFB/FFB interrupt and a Psycho, Sabre or U2S * bridge enable the interrupt in the respective bridge. */ return (error); }
static int vnex_setup_intr(device_t dev, device_t child, struct resource *res, int flags, driver_filter_t *filt,driver_intr_t *intr, void *arg, void **cookiep) { uint64_t reg, nreg; uint64_t ihdl, cfg; uint64_t ino, nino; int error, cpuid; if (res == NULL) panic("%s: NULL interrupt resource!", __func__); if ((error = bus_get_resource(dev, SYS_RES_MEMORY, 0, ®, &nreg))) goto fail; if ((error = bus_get_resource(child, SYS_RES_IRQ, 0, &ino, &nino))) goto fail; cfg = SUN4V_REG_SPEC2CFG_HDL(reg); if (hv_intr_devino_to_sysino(cfg, (uint32_t)ino, &ihdl) != H_EOK) { error = ENXIO; goto fail; } cpuid = 0; if (hv_intr_settarget(ihdl, cpuid) != H_EOK) { error = ENXIO; goto fail; } if (hv_intr_setstate(ihdl, HV_INTR_IDLE_STATE) != H_EOK) { error = ENXIO; goto fail; } if (hv_intr_setenabled(ihdl, HV_INTR_ENABLED) != H_EOK) { error = ENXIO; goto fail; } if ((rman_get_flags(res) & RF_SHAREABLE) == 0) flags |= INTR_EXCL; /* We depend here on rman_activate_resource() being idempotent. */ if ((error = rman_activate_resource(res))) goto fail; error = inthand_add(device_get_nameunit(child), ihdl, filt, intr, arg, flags, cookiep); printf("inthandler added\n"); fail: return (error); }
/* * Currently this uses the really grody interface from kern/kern_intr.c * (which really doesn't belong in kern/anything.c). Eventually, all of * the code in kern_intr.c and machdep_intr.c should get moved here, since * this is going to be the official interface. */ static int nexus_setup_intr(device_t bus, device_t child, struct resource *irq, int flags, void (*ihand)(void *), void *arg, void **cookiep) { intrmask_t *mask; driver_t *driver; int error, icflags; /* somebody tried to setup an irq that failed to allocate! */ if (irq == NULL) panic("nexus_setup_intr: NULL irq resource!"); *cookiep = 0; if (irq->r_flags & RF_SHAREABLE) icflags = 0; else icflags = INTR_EXCL; driver = device_get_driver(child); switch (flags) { case INTR_TYPE_TTY: mask = &tty_imask; break; case (INTR_TYPE_TTY | INTR_TYPE_FAST): mask = &tty_imask; icflags |= INTR_FAST; break; case INTR_TYPE_BIO: mask = &bio_imask; break; case INTR_TYPE_NET: mask = &net_imask; break; case INTR_TYPE_CAM: mask = &cam_imask; break; case INTR_TYPE_MISC: mask = 0; break; default: panic("still using grody create_intr interface"); } /* * We depend here on rman_activate_resource() being idempotent. */ error = rman_activate_resource(irq); if (error) return (error); *cookiep = inthand_add(device_get_nameunit(child), irq->r_start, ihand, arg, mask, icflags); if (*cookiep == NULL) error = EINVAL; /* XXX ??? */ return (error); }
static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, driver_intr_t *intr, void *arg, void **cookiep) { int error; if (res == NULL) panic("nexus_setup_intr: NULL interrupt resource!"); if ((res->r_flags & RF_SHAREABLE) == 0) flags |= INTR_EXCL; /* * We depend here on rman_activate_resource() being idempotent. */ error = rman_activate_resource(res); if (error) return (error); error = inthand_add(device_get_nameunit(child), res->r_start, intr, arg, flags, cookiep); return (error); }