| 283 | } |
| 284 | |
| 285 | static int |
| 286 | apb_setup_intr(device_t bus, device_t child, struct resource *ires, |
| 287 | int flags, driver_filter_t *filt, driver_intr_t *handler, |
| 288 | void *arg, void **cookiep) |
| 289 | { |
| 290 | struct apb_softc *sc = device_get_softc(bus); |
| 291 | struct intr_event *event; |
| 292 | int irq, error; |
| 293 | |
| 294 | irq = rman_get_start(ires); |
| 295 | |
| 296 | if (irq > APB_IRQ_END) |
| 297 | panic("%s: bad irq %d", __func__, irq); |
| 298 | |
| 299 | event = sc->sc_eventstab[irq]; |
| 300 | if (event == NULL) { |
| 301 | error = intr_event_create(&event, (void *)irq, 0, irq, |
| 302 | apb_mask_irq, apb_unmask_irq, |
| 303 | NULL, NULL, |
| 304 | "apb intr%d:", irq); |
| 305 | |
| 306 | if (error == 0) { |
| 307 | sc->sc_eventstab[irq] = event; |
| 308 | sc->sc_intr_counter[irq] = |
| 309 | mips_intrcnt_create(event->ie_name); |
| 310 | } |
| 311 | else |
| 312 | return (error); |
| 313 | } |
| 314 | |
| 315 | intr_event_add_handler(event, device_get_nameunit(child), filt, |
| 316 | handler, arg, intr_priority(flags), flags, cookiep); |
| 317 | mips_intrcnt_setname(sc->sc_intr_counter[irq], event->ie_fullname); |
| 318 | |
| 319 | apb_unmask_irq((void*)irq); |
| 320 | |
| 321 | return (0); |
| 322 | } |
| 323 | |
| 324 | static int |
| 325 | apb_teardown_intr(device_t dev, device_t child, struct resource *ires, |
nothing calls this directly
no test coverage detected