/* * Set up an interrupt handler to start being called. * XXX PRONE TO RACE CONDITIONS, UGLY, 'INTERESTING' INSERTION ALGORITHM. */ void * isa_intr_establish(isa_chipset_tag_t ic, int irq, int type, int level, int (*ih_fun)(void *), void *ih_arg, char *ih_what) { int evtch; evtch = bind_pirq_to_evtch(irq); if (evtch == -1) return NULL; return (void *)pirq_establish(irq, evtch, ih_fun, ih_arg, level); }
void * pci_intr_establish(pci_chipset_tag_t pcitag, pci_intr_handle_t intrh, int level, int (*func)(void *), void *arg) { char evname[16]; #if NIOAPIC > 0 struct ioapic_softc *pic; if (intrh.pirq & APIC_INT_VIA_APIC) { pic = ioapic_find(APIC_IRQ_APIC(intrh.pirq)); if (pic == NULL) { printf("pci_intr_establish: bad ioapic %d\n", APIC_IRQ_APIC(intrh.pirq)); return NULL; } snprintf(evname, sizeof(evname), "%s pin %d", device_xname(pic->sc_dev), APIC_IRQ_PIN(intrh.pirq)); } else #endif snprintf(evname, sizeof(evname), "irq%d", intrh.pirq); return (void *)pirq_establish(intrh.pirq & 0xff, intrh.evtch, func, arg, level, evname); }
void * pci_intr_establish(pci_chipset_tag_t pcitag, pci_intr_handle_t intrh, int level, int (*func)(void *), void *arg, char *what) { return (void *)pirq_establish(intrh.pirq, intrh.evtch, func, arg, level); }