* If @p r references a MIPS interrupt mapped by the MIPS32 interrupt * controller, handle interrupt activation internally. * * Otherwise, delegate directly to intr_activate_irq(). */
| 549 | * Otherwise, delegate directly to intr_activate_irq(). |
| 550 | */ |
| 551 | int |
| 552 | mips_pic_activate_intr(device_t child, struct resource *r) |
| 553 | { |
| 554 | struct mips_pic_intr *intr; |
| 555 | int error; |
| 556 | |
| 557 | /* Is this one of our shared MIPS interrupts? */ |
| 558 | if ((intr = mips_pic_find_intr(r)) == NULL) { |
| 559 | /* Delegate to standard INTRNG activation */ |
| 560 | return (intr_activate_irq(child, r)); |
| 561 | } |
| 562 | |
| 563 | /* Bump consumer count and request activation if required */ |
| 564 | mtx_lock(&mips_pic_mtx); |
| 565 | if (intr->consumers == UINT_MAX) { |
| 566 | mtx_unlock(&mips_pic_mtx); |
| 567 | return (ENOMEM); |
| 568 | } |
| 569 | |
| 570 | if (intr->consumers == 0) { |
| 571 | if ((error = intr_activate_irq(child, r))) { |
| 572 | mtx_unlock(&mips_pic_mtx); |
| 573 | return (error); |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | intr->consumers++; |
| 578 | mtx_unlock(&mips_pic_mtx); |
| 579 | |
| 580 | return (0); |
| 581 | } |
| 582 | |
| 583 | /** |
| 584 | * If @p r references a MIPS interrupt mapped by the MIPS32 interrupt |
no test coverage detected