diff options
31 files changed, 234 insertions, 204 deletions
diff --git a/sys/arch/sparc64/dev/ce4231.c b/sys/arch/sparc64/dev/ce4231.c index 47c27582d83..b2019b81182 100644 --- a/sys/arch/sparc64/dev/ce4231.c +++ b/sys/arch/sparc64/dev/ce4231.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ce4231.c,v 1.14 2003/06/02 20:02:49 jason Exp $ */ +/* $OpenBSD: ce4231.c,v 1.15 2003/06/24 21:54:39 henric Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -247,13 +247,13 @@ ce4231_attach(parent, self, aux) } sc->sc_cih = bus_intr_establish(sc->sc_bustag, ea->ea_intrs[0], - IPL_AUDIO, 0, ce4231_cintr, sc); + IPL_AUDIO, 0, ce4231_cintr, sc, self->dv_xname); if (sc->sc_cih == NULL) { printf(": couldn't establish capture interrupt\n"); return; } sc->sc_pih = bus_intr_establish(sc->sc_bustag, ea->ea_intrs[1], - IPL_AUDIO, 0, ce4231_pintr, sc); + IPL_AUDIO, 0, ce4231_pintr, sc, self->dv_xname); if (sc->sc_pih == NULL) { printf(": couldn't establish play interrupt1\n"); return; diff --git a/sys/arch/sparc64/dev/com_ebus.c b/sys/arch/sparc64/dev/com_ebus.c index 1afdc6553c8..94af5918362 100644 --- a/sys/arch/sparc64/dev/com_ebus.c +++ b/sys/arch/sparc64/dev/com_ebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com_ebus.c,v 1.8 2003/02/17 01:29:20 henric Exp $ */ +/* $OpenBSD: com_ebus.c,v 1.9 2003/06/24 21:54:39 henric Exp $ */ /* $NetBSD: com_ebus.c,v 1.6 2001/07/24 19:27:10 eeh Exp $ */ /* @@ -143,7 +143,7 @@ com_ebus_attach(parent, self, aux) for (i = 0; i < ea->ea_nintrs; i++) bus_intr_establish(sc->sc_iot, ea->ea_intrs[i], - IPL_TTY, 0, comintr, sc); + IPL_TTY, 0, comintr, sc, self->dv_xname); /* Figure out if we're the console. */ com_is_input = (ea->ea_node == OF_instance_to_package(OF_stdin())); diff --git a/sys/arch/sparc64/dev/comkbd_ebus.c b/sys/arch/sparc64/dev/comkbd_ebus.c index a163e4e782a..d4d375bd12b 100644 --- a/sys/arch/sparc64/dev/comkbd_ebus.c +++ b/sys/arch/sparc64/dev/comkbd_ebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: comkbd_ebus.c,v 1.13 2003/06/02 20:02:49 jason Exp $ */ +/* $OpenBSD: comkbd_ebus.c,v 1.14 2003/06/24 21:54:39 henric Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -228,7 +228,7 @@ comkbd_attach(parent, self, aux) } sc->sc_ih = bus_intr_establish(sc->sc_iot, - ea->ea_intrs[0], IPL_TTY, 0, comkbd_intr, sc); + ea->ea_intrs[0], IPL_TTY, 0, comkbd_intr, sc, self->dv_xname); if (sc->sc_ih == NULL) { printf(": can't get hard intr\n"); return; diff --git a/sys/arch/sparc64/dev/pci_machdep.c b/sys/arch/sparc64/dev/pci_machdep.c index c4c01bd2cbe..867053bd25a 100644 --- a/sys/arch/sparc64/dev/pci_machdep.c +++ b/sys/arch/sparc64/dev/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.13 2003/05/16 06:59:12 henric Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.14 2003/06/24 21:54:39 henric Exp $ */ /* $NetBSD: pci_machdep.c,v 1.22 2001/07/20 00:07:13 eeh Exp $ */ /* @@ -460,7 +460,7 @@ pci_intr_establish(pc, ih, level, func, arg, what) DPRINTF(SPDB_INTR, ("pci_intr_establish: ih %lu; level %d", (u_long)ih, level)); - cookie = bus_intr_establish(pp->pp_memt, ih, level, 0, func, arg); + cookie = bus_intr_establish(pp->pp_memt, ih, level, 0, func, arg, what); DPRINTF(SPDB_INTR, ("; returning handle %p\n", cookie)); return (cookie); diff --git a/sys/arch/sparc64/dev/pckbc_ebus.c b/sys/arch/sparc64/dev/pckbc_ebus.c index b0cf2e79125..ccfcffdc1e5 100644 --- a/sys/arch/sparc64/dev/pckbc_ebus.c +++ b/sys/arch/sparc64/dev/pckbc_ebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbc_ebus.c,v 1.4 2003/06/02 20:02:49 jason Exp $ */ +/* $OpenBSD: pckbc_ebus.c,v 1.5 2003/06/24 21:54:39 henric Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -143,14 +143,14 @@ pckbc_ebus_attach(parent, self, aux) psc->intr_establish = pckbc_ebus_intr_establish; sc->sc_irq[0] = bus_intr_establish(ea->ea_iotag, ea->ea_intrs[0], - IPL_TTY, 0, pckbcintr, psc); + IPL_TTY, 0, pckbcintr, psc, self->dv_xname); if (sc->sc_irq[0] == NULL) { printf(": couldn't get intr0\n"); return; } sc->sc_irq[1] = bus_intr_establish(ea->ea_iotag, ea->ea_intrs[1], - IPL_TTY, 0, pckbcintr, psc); + IPL_TTY, 0, pckbcintr, psc, self->dv_xname); if (sc->sc_irq[1] == NULL) { printf(": couldn't get intr1\n"); return; diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c index 20524916018..9584ae4a8ba 100644 --- a/sys/arch/sparc64/dev/psycho.c +++ b/sys/arch/sparc64/dev/psycho.c @@ -1,4 +1,4 @@ -/* $OpenBSD: psycho.c,v 1.36 2003/06/11 03:16:12 henric Exp $ */ +/* $OpenBSD: psycho.c,v 1.37 2003/06/24 21:54:39 henric Exp $ */ /* $NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp $ */ /* @@ -101,7 +101,7 @@ paddr_t psycho_bus_mmap(bus_space_tag_t, bus_space_tag_t, bus_addr_t, off_t, int _psycho_bus_map(bus_space_tag_t, bus_space_tag_t, bus_addr_t, bus_size_t, int, bus_space_handle_t *); void *psycho_intr_establish(bus_space_tag_t, bus_space_tag_t, int, int, int, - int (*)(void *), void *); + int (*)(void *), void *, const char *); int psycho_dmamap_create(bus_dma_tag_t, bus_dma_tag_t, bus_size_t, int, bus_size_t, bus_size_t, int, bus_dmamap_t *); @@ -1066,7 +1066,7 @@ psycho_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp) */ void * psycho_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int ihandle, - int level, int flags, int (*handler)(void *), void *arg) + int level, int flags, int (*handler)(void *), void *arg, const char *what) { struct psycho_pbm *pp = t->cookie; struct psycho_softc *sc = pp->pp_sc; @@ -1076,11 +1076,6 @@ psycho_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int ihandle, int ino; long vec = INTVEC(ihandle); - ih = (struct intrhand *) - malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - /* * Hunt through all the interrupt mapping regs to look for our * interrupt vector. @@ -1106,62 +1101,52 @@ psycho_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int ihandle, level = 2; } - if ((flags & BUS_INTR_ESTABLISH_SOFTINTR) == 0) { + if (flags & BUS_INTR_ESTABLISH_SOFTINTR) + goto found; - DPRINTF(PDB_INTR, - ("\npsycho: intr %lx: %p\nHunting for IRQ...\n", - (long)ino, intrlev[ino])); + DPRINTF(PDB_INTR, + ("\npsycho: intr %lx: %p\nHunting for IRQ...\n", + (long)ino, intrlev[ino])); + + /* Hunt thru obio first */ + for (intrmapptr = psycho_psychoreg_vaddr(sc, scsi_int_map), + intrclrptr = psycho_psychoreg_vaddr(sc, scsi_clr_int); + intrmapptr < (volatile u_int64_t *) + psycho_psychoreg_vaddr(sc, ffb0_int_map); + intrmapptr++, intrclrptr++) { + if (INTINO(*intrmapptr) == ino) + goto found; + } - /* Hunt thru obio first */ - for (intrmapptr = psycho_psychoreg_vaddr(sc, scsi_int_map), - intrclrptr = psycho_psychoreg_vaddr(sc, scsi_clr_int); - intrmapptr < (volatile u_int64_t *) - psycho_psychoreg_vaddr(sc, ffb0_int_map); - intrmapptr++, intrclrptr++) { - if (INTINO(*intrmapptr) == ino) - goto found; - } + /* Now do PCI interrupts */ + for (intrmapptr = psycho_psychoreg_vaddr(sc, pcia_slot0_int), + intrclrptr = psycho_psychoreg_vaddr(sc, pcia0_clr_int[0]); + intrmapptr <= (volatile u_int64_t *) + psycho_psychoreg_vaddr(sc, pcib_slot3_int); + intrmapptr++, intrclrptr += 4) { + /* Skip PCI-A Slot 2 and PCI-A Slot 3 on psycho's */ + if (sc->sc_mode == PSYCHO_MODE_PSYCHO && + (intrmapptr == + psycho_psychoreg_vaddr(sc, pcia_slot2_int) || + intrmapptr == + psycho_psychoreg_vaddr(sc, pcia_slot3_int))) + continue; - /* Now do PCI interrupts */ - for (intrmapptr = psycho_psychoreg_vaddr(sc, pcia_slot0_int), - intrclrptr = psycho_psychoreg_vaddr(sc, pcia0_clr_int[0]); - intrmapptr <= (volatile u_int64_t *) - psycho_psychoreg_vaddr(sc, pcib_slot3_int); - intrmapptr++, intrclrptr += 4) { - /* Skip PCI-A Slot 2 and PCI-A Slot 3 on psycho's */ - if (sc->sc_mode == PSYCHO_MODE_PSYCHO && - (intrmapptr == - psycho_psychoreg_vaddr(sc, pcia_slot2_int) || - intrmapptr == - psycho_psychoreg_vaddr(sc, pcia_slot3_int))) - continue; - - if (((*intrmapptr ^ vec) & 0x3c) == 0) { - intrclrptr += vec & 0x3; - goto found; - } + if (((*intrmapptr ^ vec) & 0x3c) == 0) { + intrclrptr += vec & 0x3; + goto found; } - printf("Cannot find interrupt vector %lx\n", vec); - return (NULL); - - found: - /* Register the map and clear intr registers */ - ih->ih_map = intrmapptr; - ih->ih_clr = intrclrptr; } -#ifdef NOT_DEBUG - if (psycho_debug & PDB_INTR) { - long i; - - for (i = 0; i < 500000000; i++) - continue; + printf("Cannot find interrupt vector %lx\n", vec); + return (NULL); + +found: + ih = bus_intr_allocate(t0, handler, arg, ino | sc->sc_ign, level, + intrmapptr, intrclrptr, what); + if (ih == NULL) { + printf("Cannot allocate interrupt vector %lx\n", vec); + return (NULL); } -#endif - - ih->ih_fun = handler; - ih->ih_arg = arg; - ih->ih_pil = level; - ih->ih_number = ino | sc->sc_ign; DPRINTF(PDB_INTR, ( "\ninstalling handler %p arg %p with number %x pil %u", diff --git a/sys/arch/sparc64/dev/sab.c b/sys/arch/sparc64/dev/sab.c index a7f70360925..fc22a641db7 100644 --- a/sys/arch/sparc64/dev/sab.c +++ b/sys/arch/sparc64/dev/sab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sab.c,v 1.12 2003/06/02 20:02:49 jason Exp $ */ +/* $OpenBSD: sab.c,v 1.13 2003/06/24 21:54:39 henric Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -252,7 +252,7 @@ sab_attach(parent, self, aux) BUS_SPACE_SET_FLAGS(sc->sc_bt, sc->sc_bh, BSHDB_NO_ACCESS); sc->sc_ih = bus_intr_establish(sc->sc_bt, ea->ea_intrs[0], - IPL_TTY, 0, sab_intr, sc); + IPL_TTY, 0, sab_intr, sc, self->dv_xname); if (sc->sc_ih == NULL) { printf(": can't map interrupt\n"); return; diff --git a/sys/arch/sparc64/dev/sbus.c b/sys/arch/sparc64/dev/sbus.c index 6cddc5c68ce..b5c811a1ced 100644 --- a/sys/arch/sparc64/dev/sbus.c +++ b/sys/arch/sparc64/dev/sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sbus.c,v 1.19 2003/06/18 17:33:35 miod Exp $ */ +/* $OpenBSD: sbus.c,v 1.20 2003/06/24 21:54:39 henric Exp $ */ /* $NetBSD: sbus.c,v 1.46 2001/10/07 20:30:41 eeh Exp $ */ /*- @@ -151,7 +151,8 @@ static void *sbus_intr_establish(bus_space_tag_t, bus_space_tag_t, int, /*`device class' priority*/ int, /*flags*/ int (*)(void *), /*handler*/ - void *); /*handler arg*/ + void *, /*handler arg*/ + const char *); /*what*/ /* autoconfiguration driver */ @@ -644,21 +645,18 @@ sbus_get_intr(struct sbus_softc *sc, int node, struct sbus_intr **ipp, int *np, */ void * sbus_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int pri, int level, - int flags, int (*handler)(void *), void *arg) + int flags, int (*handler)(void *), void *arg, const char *what) { struct sbus_softc *sc = t->cookie; struct sysioreg *sysio; struct intrhand *ih; + volatile u_int64_t *map = NULL; + volatile u_int64_t *clr = NULL; int ipl; long vec = pri; sysio = bus_space_vaddr(sc->sc_bustag, sc->sc_bh); - ih = (struct intrhand *) - malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - if ((flags & BUS_INTR_ESTABLISH_SOFTINTR) != 0) ipl = 1 << vec; else if ((vec & SBUS_INTR_COMPAT) != 0) @@ -682,16 +680,16 @@ sbus_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int pri, int level, bus_space_handle_t maph; int slot = INTSLOT(pri); - ih->ih_map = &(&sysio->sbus_slot0_int)[slot]; - ih->ih_clr = &sysio->sbus0_clr_int[vec]; + map = &(&sysio->sbus_slot0_int)[slot]; + clr = &sysio->sbus0_clr_int[vec]; #ifdef DEBUG if (sbus_debug & SDB_INTR) { - int64_t intrmap = *ih->ih_map; + int64_t intrmap = *map; printf("SBUS %lx IRQ as %llx in slot %d\n", (long)vec, (long long)intrmap, slot); printf("\tmap addr %p clr addr %p\n", - ih->ih_map, ih->ih_clr); + map, clr); } #endif /* Enable the interrupt */ @@ -705,7 +703,7 @@ sbus_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int pri, int level, * to the appropriate offset from sc->sc_bustag and * sc->sc_bh. */ - bus_space_map(sc->sc_bustag, (bus_addr_t)ih->ih_map, 8, + bus_space_map(sc->sc_bustag, (bus_addr_t)map, 8, BUS_SPACE_MAP_PROMADDRESS, &maph); bus_space_write_8(sc->sc_bustag, maph, 0, vec); } else { @@ -725,9 +723,9 @@ sbus_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int pri, int level, ("OBIO %lx IRQ as %lx in slot %d\n", vec, (long)intrmap, i)); /* Register the map and clear intr registers */ - ih->ih_map = &intrptr[i]; + map = &intrptr[i]; intrptr = (int64_t *)&sysio->scsi_clr_int; - ih->ih_clr = &intrptr[i]; + clr = &intrptr[i]; /* Enable the interrupt */ intrmap |= INTMAP_V; /* @@ -739,7 +737,7 @@ sbus_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int pri, int level, * sc->sc_bh. */ bus_space_map(sc->sc_bustag, - (bus_addr_t)ih->ih_map, 8, + (bus_addr_t)map, 8, BUS_SPACE_MAP_PROMADDRESS, &maph); bus_space_write_8(sc->sc_bustag, maph, 0, (u_long)intrmap); @@ -751,11 +749,12 @@ sbus_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int pri, int level, if (sbus_debug & SDB_INTR) { long i; for (i = 0; i < 400000000; i++); } #endif - ih->ih_fun = handler; - ih->ih_arg = arg; - ih->ih_number = vec; - ih->ih_pil = ipl; + ih = bus_intr_allocate(t0, handler, arg, vec, ipl, map, clr, what); + if (ih == NULL) + return (ih); + intr_establish(ih->ih_pil, ih); + return (ih); } diff --git a/sys/arch/sparc64/dev/schizo.c b/sys/arch/sparc64/dev/schizo.c index b810b820fb1..fdffac2237b 100644 --- a/sys/arch/sparc64/dev/schizo.c +++ b/sys/arch/sparc64/dev/schizo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: schizo.c,v 1.15 2003/06/11 03:16:12 henric Exp $ */ +/* $OpenBSD: schizo.c,v 1.16 2003/06/24 21:54:39 henric Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -82,7 +82,7 @@ paddr_t schizo_bus_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int); int _schizo_bus_map(bus_space_tag_t, bus_space_tag_t, bus_addr_t, bus_size_t, int, bus_space_handle_t *); void *_schizo_intr_establish(bus_space_tag_t, bus_space_tag_t, int, int, int, - int (*)(void *), void *); + int (*)(void *), void *, const char *); paddr_t _schizo_bus_mmap(bus_space_tag_t, bus_space_tag_t, bus_addr_t, off_t, int, int); int schizo_dmamap_create(bus_dma_tag_t, bus_dma_tag_t, bus_size_t, int, @@ -437,7 +437,7 @@ _schizo_bus_mmap(bus_space_tag_t t, bus_space_tag_t t0, bus_addr_t paddr, void * _schizo_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int ihandle, - int level, int flags, int (*handler)(void *), void *arg) + int level, int flags, int (*handler)(void *), void *arg, const char *what) { struct schizo_pbm *pbm = t->cookie; struct intrhand *ih = NULL; @@ -445,11 +445,6 @@ _schizo_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int ihandle, int ino; long vec = INTVEC(ihandle); - ih = (struct intrhand *)malloc(sizeof(struct intrhand), M_DEVBUF, - M_NOWAIT); - if (ih == NULL) - return (NULL); - vec = INTVEC(ihandle); ino = INTINO(vec); @@ -468,11 +463,10 @@ _schizo_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int ihandle, intrclrptr = &pbmreg->iclr[ino]; } - ih->ih_map = intrmapptr; - ih->ih_clr = intrclrptr; - ih->ih_fun = handler; - ih->ih_pil = level; - ih->ih_number = ino; + ih = bus_intr_allocate(t0, handler, arg, ino, level, intrmapptr, + intrclrptr, what); + if (ih == NULL) + return (NULL); intr_establish(ih->ih_pil, ih); diff --git a/sys/arch/sparc64/dev/stp_sbus.c b/sys/arch/sparc64/dev/stp_sbus.c index ff6173e5a2c..13070497042 100644 --- a/sys/arch/sparc64/dev/stp_sbus.c +++ b/sys/arch/sparc64/dev/stp_sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stp_sbus.c,v 1.2 2003/06/23 19:47:03 jason Exp $ */ +/* $OpenBSD: stp_sbus.c,v 1.3 2003/06/24 21:54:39 henric Exp $ */ /* $NetBSD: stp4020.c,v 1.23 2002/06/01 23:51:03 lukem Exp $ */ /*- @@ -166,10 +166,10 @@ stpattach(parent, self, aux) * the lower level for PC card I/O. */ bus_intr_establish(sa->sa_bustag, sa->sa_intr[1].sbi_pri, - IPL_NONE, 0, stp4020_statintr, sc); + IPL_NONE, 0, stp4020_statintr, sc, self->dv_xname); bus_intr_establish(sa->sa_bustag, sa->sa_intr[0].sbi_pri, - IPL_NONE, 0, stp4020_iointr, sc); + IPL_NONE, 0, stp4020_iointr, sc, self->dv_xname); stpattach_common(sc, sa->sa_frequency); } diff --git a/sys/arch/sparc64/dev/zs.c b/sys/arch/sparc64/dev/zs.c index 76f7643a15a..5c3f822fc68 100644 --- a/sys/arch/sparc64/dev/zs.c +++ b/sys/arch/sparc64/dev/zs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zs.c,v 1.12 2003/02/17 01:29:20 henric Exp $ */ +/* $OpenBSD: zs.c,v 1.13 2003/06/24 21:54:39 henric Exp $ */ /* $NetBSD: zs.c,v 1.29 2001/05/30 15:24:24 lukem Exp $ */ /*- @@ -375,7 +375,9 @@ zs_attach(zsc, zsd, pri) * to the interrupt handlers aren't used. Note, we only do this * once since both SCCs interrupt at the same level and vector. */ - bus_intr_establish(zsc->zsc_bustag, pri, IPL_SERIAL, 0, zshard, zsc); + if (bus_intr_establish(zsc->zsc_bustag, pri, IPL_SERIAL, 0, zshard, + zsc, zsc->zsc_dev.dv_xname) == NULL) + panic("zsattach: could not establish interrupt"); if (!(zsc->zsc_softintr = softintr_establish(softpri, zssoft, zsc))) panic("zsattach: could not establish soft interrupt"); diff --git a/sys/arch/sparc64/include/bus.h b/sys/arch/sparc64/include/bus.h index e30b876c509..a86c87c0812 100644 --- a/sys/arch/sparc64/include/bus.h +++ b/sys/arch/sparc64/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.15 2003/03/06 08:26:08 henric Exp $ */ +/* $OpenBSD: bus.h,v 1.16 2003/06/24 21:54:39 henric Exp $ */ /* $NetBSD: bus.h,v 1.31 2001/09/21 15:30:41 wiz Exp $ */ /*- @@ -221,7 +221,8 @@ struct sparc_bus_space_tag { void *(*sparc_intr_establish)(bus_space_tag_t, bus_space_tag_t, int, int, int, - int (*)(void *), void *); + int (*)(void *), void *, + const char *); }; @@ -282,7 +283,18 @@ void *bus_intr_establish( see machine/intr.h*/ int, /*flags*/ int (*)(void *), /*handler*/ - void *); /*handler arg*/ + void *, /*handler arg*/ + const char *); /*what*/ +void *bus_intr_allocate( + bus_space_tag_t, + int (*)(void *), /*handler*/ + void *, /*handler arg*/ + int, /*number*/ + int, /*pil*/ + volatile u_int64_t *, /*map*/ + volatile u_int64_t *, /*clr*/ + const char *); /*what*/ +void bus_intr_free(void *); void bus_space_render_tag( bus_space_tag_t, char *, diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h index 9b28cfedc7f..e706dd0b77e 100644 --- a/sys/arch/sparc64/include/cpu.h +++ b/sys/arch/sparc64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.21 2003/06/02 23:27:56 millert Exp $ */ +/* $OpenBSD: cpu.h,v 1.22 2003/06/24 21:54:39 henric Exp $ */ /* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */ /* @@ -74,7 +74,6 @@ #include <machine/psl.h> #include <machine/reg.h> #include <machine/intr.h> -#include <sparc64/sparc64/intreg.h> /*#include <sys/sched.h> */ @@ -194,15 +193,8 @@ union sir { #define SIR_CLOCK 1 #endif -extern struct intrhand soft01intr, soft01net, soft01clock; - -#if 0 -#define setsoftint() send_softint(-1, IPL_SOFTINT, &soft01intr) -#define setsoftnet() send_softint(-1, IPL_SOFTNET, &soft01net) -#else void setsoftint(void); void setsoftnet(void); -#endif extern int want_ast; @@ -234,29 +226,6 @@ extern int want_resched; /* resched() was called */ extern struct proc *fpproc; /* FPU owner */ extern int foundfpu; /* true => we have an FPU */ -/* - * Interrupt handler chains. Interrupt handlers should return 0 for - * ``not me'' or 1 (``I took care of it''). intr_establish() inserts a - * handler into the list. The handler is called with its (single) - * argument, or with a pointer to a clockframe if ih_arg is NULL. - */ -struct intrhand { - int (*ih_fun)(void *); - void *ih_arg; - short ih_number; /* interrupt number */ - /* the H/W provides */ - char ih_pil; /* interrupt priority */ - volatile char ih_busy; /* handler is on list */ - struct intrhand *ih_next; /* global list */ - struct intrhand *ih_pending; /* pending list */ - volatile u_int64_t *ih_map; /* Interrupt map reg */ - volatile u_int64_t *ih_clr; /* clear interrupt reg */ -}; -extern struct intrhand *intrhand[]; -extern struct intrhand *intrlev[MAXINTNUM]; - -void intr_establish(int level, struct intrhand *); - /* disksubr.c */ struct dkbad; int isbad(struct dkbad *bt, int, int, int); @@ -275,13 +244,8 @@ void savefpstate(struct fpstate64 *); void loadfpstate(struct fpstate64 *); u_int64_t probeget(paddr_t, int, int); int probeset(paddr_t, int, int, u_int64_t); -#if 0 -void write_all_windows(void); -void write_user_windows(void); -#else #define write_all_windows() __asm __volatile("flushw" : : ) #define write_user_windows() __asm __volatile("flushw" : : ) -#endif void proc_trampoline(void); struct pcb; void snapshot(struct pcb *); diff --git a/sys/arch/sparc64/include/intr.h b/sys/arch/sparc64/include/intr.h index 6a979f16b46..fd50694c938 100644 --- a/sys/arch/sparc64/include/intr.h +++ b/sys/arch/sparc64/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.5 2002/06/11 05:01:17 art Exp $ */ +/* $OpenBSD: intr.h,v 1.6 2003/06/24 21:54:39 henric Exp $ */ /* $NetBSD: intr.h,v 1.8 2001/01/14 23:50:30 thorpej Exp $ */ /*- @@ -37,6 +37,39 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _SPARC64_INTR_H_ +#define _SPARC64_INTR_H_ + +#ifndef _SPARC64_INTREG_H_ +#include <sparc64/sparc64/intreg.h> +#endif + +/* + * Interrupt handler chains. Interrupt handlers should return 0 for + * ``not me'' or 1 (``I took care of it''). intr_establish() inserts a + * handler into the list. The handler is called with its (single) + * argument, or with a pointer to a clockframe if ih_arg is NULL. + */ +struct intrhand { + int (*ih_fun)(void *); + void *ih_arg; + short ih_number; /* interrupt number */ + /* the H/W provides */ + char ih_pil; /* interrupt priority */ + volatile char ih_busy; /* handler is on list */ + struct intrhand *ih_next; /* global list */ + struct intrhand *ih_pending; /* pending list */ + volatile u_int64_t *ih_map; /* interrupt map reg */ + volatile u_int64_t *ih_clr; /* clear interrupt reg */ + u_int64_t ih_count; /* # of interrupts */ + const void *ih_bus; /* parent bus */ + char ih_name[1]; /* device name */ +}; + +extern struct intrhand *intrlev[MAXINTNUM]; + +void intr_establish(int, struct intrhand *); + /* XXX - arbitrary numbers; no interpretation is defined yet */ #define IPL_NONE 0 /* nothing */ #define IPL_SOFTINT 1 /* softint */ @@ -63,3 +96,5 @@ softintr_disestablish(void *cookie); void softintr_schedule(void *cookie); + +#endif /* _SPARC64_INTR_H_ */ diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index 6ca80ad2130..54789636e26 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.64 2003/06/16 20:46:14 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.65 2003/06/24 21:54:39 henric Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -1653,7 +1653,7 @@ int sparc_bus_subregion(bus_space_tag_t, bus_space_tag_t, bus_space_handle_t, paddr_t sparc_bus_mmap(bus_space_tag_t, bus_space_tag_t, bus_addr_t, off_t, int, int); void *sparc_mainbus_intr_establish(bus_space_tag_t, bus_space_tag_t, int, int, - int, int (*)(void *), void *); + int, int (*)(void *), void *, const char *); void sparc_bus_barrier(bus_space_tag_t, bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_size_t, int); int sparc_bus_alloc(bus_space_tag_t, bus_space_tag_t, bus_addr_t, bus_addr_t, @@ -1892,21 +1892,52 @@ bus_space_probe(bus_space_tag_t tag, bus_addr_t paddr, bus_size_t size, return (result); } - void * -sparc_mainbus_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int pil, - int level, int flags, int (*handler)(void *), void *arg) +bus_intr_allocate(bus_space_tag_t t, int (*handler)(void *), void *arg, + int number, int pil, + volatile u_int64_t *mapper, volatile u_int64_t *clearer, + const char *what) { struct intrhand *ih; + size_t namelen = strlen(what) + 1; ih = (struct intrhand *) - malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT); + malloc(sizeof(struct intrhand) + namelen - 1, M_DEVBUF, M_NOWAIT); if (ih == NULL) return (NULL); + memset(ih, 0, sizeof(struct intrhand) + namelen); + ih->ih_fun = handler; ih->ih_arg = arg; - intr_establish(pil, ih); + ih->ih_number = number; + ih->ih_pil = pil; + ih->ih_map = mapper; + ih->ih_clr = clearer; + ih->ih_bus = t; + strlcpy(ih->ih_name, what, namelen); + + return (ih); +} + +void +bus_intr_free(void *arg) +{ + free(arg, M_DEVBUF); +} + +void * +sparc_mainbus_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int number, + int pil, int flags, int (*handler)(void *), void *arg, const char *what) +{ + struct intrhand *ih; + + ih = bus_intr_allocate(t0, handler, arg, number, pil, NULL, NULL, what); + if (ih == NULL) + return (NULL); + + intr_establish(ih->ih_pil, ih); + return (ih); } @@ -2114,13 +2145,13 @@ bus_space_mmap(bus_space_tag_t t, bus_addr_t a, off_t o, int p, int f) void * bus_intr_establish(bus_space_tag_t t, int p, int l, int f, int (*h)(void *), - void *a) + void *a, const char *w) { const bus_space_tag_t t0 = t; void *ret; _BS_PRECALL(t, sparc_intr_establish); - ret = _BS_CALL(t, sparc_intr_establish)(t, t0, p, l, f, h, a); + ret = _BS_CALL(t, sparc_intr_establish)(t, t0, p, l, f, h, a, w); _BS_POSTCALL; return (ret); } diff --git a/sys/dev/sbus/apio.c b/sys/dev/sbus/apio.c index b2e65a7d780..808fd3d62e0 100644 --- a/sys/dev/sbus/apio.c +++ b/sys/dev/sbus/apio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apio.c,v 1.4 2003/06/02 18:32:41 jason Exp $ */ +/* $OpenBSD: apio.c,v 1.5 2003/06/24 21:54:38 henric Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -228,7 +228,7 @@ lpt_apio_attach(parent, self, aux) sc->sc_lpt.sc_ioh = aaa->aaa_ioh; sc->sc_clk_h = aaa->aaa_clkh; sc->sc_ih = bus_intr_establish(aaa->aaa_iot, aaa->aaa_pri, - IPL_TTY, 0, lpt_apio_intr, sc); + IPL_TTY, 0, lpt_apio_intr, sc, self->dv_xname); if (sc->sc_ih == NULL) { printf(": cannot allocate intr\n"); return; diff --git a/sys/dev/sbus/asio.c b/sys/dev/sbus/asio.c index c2394929b6a..1c7b9eb29c1 100644 --- a/sys/dev/sbus/asio.c +++ b/sys/dev/sbus/asio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asio.c,v 1.7 2003/06/02 18:32:41 jason Exp $ */ +/* $OpenBSD: asio.c,v 1.8 2003/06/24 21:54:38 henric Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -232,7 +232,7 @@ com_asio_attach(parent, self, aux) sc->sc_frequency = BAUD_BASE; sc->sc_ih = bus_intr_establish(aaa->aaa_iot, aaa->aaa_pri, - IPL_TTY, 0, comintr, sc); + IPL_TTY, 0, comintr, sc, self->dv_xname); if (sc->sc_ih == NULL) { printf(": cannot allocate intr\n"); return; diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c index 8d120d24635..c4019da229f 100644 --- a/sys/dev/sbus/be.c +++ b/sys/dev/sbus/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.11 2003/06/02 18:32:41 jason Exp $ */ +/* $OpenBSD: be.c,v 1.12 2003/06/24 21:54:38 henric Exp $ */ /* $NetBSD: be.c,v 1.26 2001/03/20 15:39:20 pk Exp $ */ /*- @@ -297,7 +297,7 @@ beattach(parent, self, aux) /* Establish interrupt handler */ if (sa->sa_nintr == 0 || bus_intr_establish(sa->sa_bustag, sa->sa_pri, - IPL_NET, 0, beintr, sc) == NULL) { + IPL_NET, 0, beintr, sc, self->dv_xname) == NULL) { printf(": no interrupt established\n"); return; } diff --git a/sys/dev/sbus/cgsix.c b/sys/dev/sbus/cgsix.c index d737489d7c2..93d78cd4588 100644 --- a/sys/dev/sbus/cgsix.c +++ b/sys/dev/sbus/cgsix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgsix.c,v 1.42 2003/06/18 17:35:30 miod Exp $ */ +/* $OpenBSD: cgsix.c,v 1.43 2003/06/24 21:54:38 henric Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -195,7 +195,7 @@ cgsixattach(parent, self, aux) } if ((sc->sc_ih = bus_intr_establish(sa->sa_bustag, sa->sa_pri, - IPL_TTY, 0, cgsix_intr, sc)) == NULL) { + IPL_TTY, 0, cgsix_intr, sc, self->dv_xname)) == NULL) { printf(": couldn't establish interrupt, pri %d\n", sa->sa_pri); goto fail_intr; } diff --git a/sys/dev/sbus/cs4231.c b/sys/dev/sbus/cs4231.c index ff093244ad7..af2abf21fd2 100644 --- a/sys/dev/sbus/cs4231.c +++ b/sys/dev/sbus/cs4231.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cs4231.c,v 1.19 2003/06/02 18:32:41 jason Exp $ */ +/* $OpenBSD: cs4231.c,v 1.20 2003/06/24 21:54:38 henric Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -239,7 +239,7 @@ cs4231_attach(parent, self, aux) } if (bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_AUDIO, 0, - cs4231_intr, sc) == NULL) { + cs4231_intr, sc, self->dv_xname) == NULL) { printf(": couldn't establish interrupt, pri %d\n", sa->sa_pri); return; } diff --git a/sys/dev/sbus/dma_sbus.c b/sys/dev/sbus/dma_sbus.c index c884d43a0f7..3d61c25ffca 100644 --- a/sys/dev/sbus/dma_sbus.c +++ b/sys/dev/sbus/dma_sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma_sbus.c,v 1.9 2003/06/05 12:27:03 deraadt Exp $ */ +/* $OpenBSD: dma_sbus.c,v 1.10 2003/06/24 21:54:38 henric Exp $ */ /* $NetBSD: dma_sbus.c,v 1.5 2000/07/09 20:57:42 pk Exp $ */ /*- @@ -101,7 +101,8 @@ void *dmabus_intr_establish( int, /*`device class' level*/ int, /*flags*/ int (*)(void *), /*handler*/ - void *); /*handler arg*/ + void *, /*handler arg*/ + const char *); /*what*/ static bus_space_tag_t dma_alloc_bustag(struct dma_softc *sc); @@ -254,7 +255,8 @@ dmabus_intr_establish( int level, int flags, int (*handler)(void *), - void *arg) + void *arg, + const char *what) { struct lsi64854_softc *sc = t->cookie; @@ -269,10 +271,12 @@ dmabus_intr_establish( for (t = t->parent; t; t = t->parent) { if (t->sparc_intr_establish != NULL) return ((*t->sparc_intr_establish) - (t, t0, pri, level, flags, handler, arg)); + (t, t0, pri, level, flags, handler, arg, what)); } + panic("dmabus_intr_establish: no handler found"); + return (NULL); } diff --git a/sys/dev/sbus/esp_sbus.c b/sys/dev/sbus/esp_sbus.c index 4ff890a7e6f..92df84fa857 100644 --- a/sys/dev/sbus/esp_sbus.c +++ b/sys/dev/sbus/esp_sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: esp_sbus.c,v 1.12 2003/03/27 16:43:28 jason Exp $ */ +/* $OpenBSD: esp_sbus.c,v 1.13 2003/06/24 21:54:38 henric Exp $ */ /* $NetBSD: esp_sbus.c,v 1.14 2001/04/25 17:53:37 bouyer Exp $ */ /*- @@ -537,7 +537,7 @@ espattach(esc, gluep) /* Establish interrupt channel */ icookie = bus_intr_establish(esc->sc_bustag, esc->sc_pri, IPL_BIO, 0, - ncr53c9x_intr, sc); + ncr53c9x_intr, sc, sc->sc_dev.dv_xname); /* register interrupt stats */ evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt); diff --git a/sys/dev/sbus/if_hme_sbus.c b/sys/dev/sbus/if_hme_sbus.c index 7d0cb7375d4..a262f0a2307 100644 --- a/sys/dev/sbus/if_hme_sbus.c +++ b/sys/dev/sbus/if_hme_sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_hme_sbus.c,v 1.4 2003/02/17 01:29:20 henric Exp $ */ +/* $OpenBSD: if_hme_sbus.c,v 1.5 2003/06/24 21:54:38 henric Exp $ */ /* $NetBSD: if_hme_sbus.c,v 1.6 2001/02/28 14:52:48 mrg Exp $ */ /*- @@ -207,5 +207,5 @@ hmeattach_sbus(parent, self, aux) /* Establish interrupt handler */ if (sa->sa_nintr != 0) (void)bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_NET, 0, - hme_intr, sc); + hme_intr, sc, self->dv_xname); } diff --git a/sys/dev/sbus/if_le.c b/sys/dev/sbus/if_le.c index d1b863f5621..02699192cb7 100644 --- a/sys/dev/sbus/if_le.c +++ b/sys/dev/sbus/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.7 2002/05/13 19:45:51 jason Exp $ */ +/* $OpenBSD: if_le.c,v 1.8 2003/06/24 21:54:38 henric Exp $ */ /* $NetBSD: if_le.c,v 1.17 2001/05/30 11:46:35 mrg Exp $ */ /*- @@ -263,5 +263,5 @@ leattach_sbus(parent, self, aux) /* Establish interrupt handler */ if (sa->sa_nintr != 0) (void)bus_intr_establish(lesc->sc_bustag, sa->sa_pri, - IPL_NET, 0, am7990_intr, sc); + IPL_NET, 0, am7990_intr, sc, self->dv_xname); } diff --git a/sys/dev/sbus/if_le_lebuffer.c b/sys/dev/sbus/if_le_lebuffer.c index d4fcadce659..11f04c30f9e 100644 --- a/sys/dev/sbus/if_le_lebuffer.c +++ b/sys/dev/sbus/if_le_lebuffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le_lebuffer.c,v 1.2 2002/05/13 18:16:38 jason Exp $ */ +/* $OpenBSD: if_le_lebuffer.c,v 1.3 2003/06/24 21:54:38 henric Exp $ */ /* $NetBSD: if_le_lebuffer.c,v 1.10 2002/03/11 16:00:56 pk Exp $ */ /*- @@ -197,5 +197,5 @@ leattach_lebuffer(parent, self, aux) /* Establish interrupt handler */ if (sa->sa_nintr != 0) (void)bus_intr_establish(lesc->sc_bustag, sa->sa_pri, - IPL_NET, 0, am7990_intr, sc); + IPL_NET, 0, am7990_intr, sc, self->dv_xname); } diff --git a/sys/dev/sbus/if_le_ledma.c b/sys/dev/sbus/if_le_ledma.c index b0168411f2d..c376aa14bed 100644 --- a/sys/dev/sbus/if_le_ledma.c +++ b/sys/dev/sbus/if_le_ledma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le_ledma.c,v 1.8 2003/05/14 23:35:31 miod Exp $ */ +/* $OpenBSD: if_le_ledma.c,v 1.9 2003/06/24 21:54:38 henric Exp $ */ /* $NetBSD: if_le_ledma.c,v 1.14 2001/05/30 11:46:35 mrg Exp $ */ /*- @@ -434,7 +434,7 @@ leattach_ledma(parent, self, aux) /* Establish interrupt handler */ if (sa->sa_nintr != 0) (void)bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_NET, 0, - am7990_intr, sc); + am7990_intr, sc, self->dv_xname); am7990_config(&lesc->sc_am7990); diff --git a/sys/dev/sbus/isp_sbus.c b/sys/dev/sbus/isp_sbus.c index d1183f8fa76..d996af57688 100644 --- a/sys/dev/sbus/isp_sbus.c +++ b/sys/dev/sbus/isp_sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isp_sbus.c,v 1.5 2003/02/17 01:29:21 henric Exp $ */ +/* $OpenBSD: isp_sbus.c,v 1.6 2003/06/24 21:54:38 henric Exp $ */ /* $NetBSD: isp_sbus.c,v 1.46 2001/09/26 20:53:14 eeh Exp $ */ /* @@ -252,7 +252,7 @@ isp_sbus_attach(struct device *parent, struct device *self, void *aux) /* Establish interrupt channel */ bus_intr_establish(sbc->sbus_bustag, sbc->sbus_pri, IPL_BIO, 0, - isp_sbus_intr, sbc); + isp_sbus_intr, sbc, self->dv_xname); sbus_establish(&sbc->sbus_sd, &sbc->sbus_isp.isp_osinfo._dev); /* diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c index 33b3ba90856..6ca73ea9deb 100644 --- a/sys/dev/sbus/magma.c +++ b/sys/dev/sbus/magma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magma.c,v 1.7 2003/03/27 17:39:05 jason Exp $ */ +/* $OpenBSD: magma.c,v 1.8 2003/06/24 21:54:38 henric Exp $ */ /* * magma.c * @@ -366,7 +366,7 @@ magma_attach(parent, dev, aux) return; } sc->sc_ih = bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_TTY, 0, - magma_hard, sc); + magma_hard, sc, dev->dv_xname); if (sc->sc_ih == NULL) { printf(": failed to establish interrupt\n"); bus_space_unmap(sc->sc_bustag, sc->sc_iohandle, diff --git a/sys/dev/sbus/qe.c b/sys/dev/sbus/qe.c index f269db1417f..2dc9a75177e 100644 --- a/sys/dev/sbus/qe.c +++ b/sys/dev/sbus/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.12 2003/06/02 18:32:41 jason Exp $ */ +/* $OpenBSD: qe.c,v 1.13 2003/06/24 21:54:38 henric Exp $ */ /* $NetBSD: qe.c,v 1.16 2001/03/30 17:30:18 christos Exp $ */ /*- @@ -246,8 +246,8 @@ qeattach(parent, self, aux) qestop(sc); /* Note: no interrupt level passed */ - if (bus_intr_establish(sa->sa_bustag, 0, IPL_NET, 0, qeintr, sc) == - NULL) { + if (bus_intr_establish(sa->sa_bustag, 0, IPL_NET, 0, qeintr, sc, + self->dv_xname) == NULL) { printf(": no interrupt established\n"); return; } diff --git a/sys/dev/sbus/qec.c b/sys/dev/sbus/qec.c index 4a9d7213468..69da81a219b 100644 --- a/sys/dev/sbus/qec.c +++ b/sys/dev/sbus/qec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qec.c,v 1.6 2003/03/27 17:39:05 jason Exp $ */ +/* $OpenBSD: qec.c,v 1.7 2003/06/24 21:54:38 henric Exp $ */ /* $NetBSD: qec.c,v 1.12 2000/12/04 20:12:55 fvdl Exp $ */ /*- @@ -72,7 +72,8 @@ void * qec_intr_establish( int, /*`device class' interrupt level*/ int, /*flags*/ int (*)(void *), /*handler*/ - void *); /*arg*/ + void *, /*arg*/ + const char *); /*what*/ struct cfattach qec_ca = { sizeof(struct qec_softc), qecmatch, qecattach @@ -286,7 +287,7 @@ qec_bus_map(t, t0, addr, size, flags, hp) } void * -qec_intr_establish(t, t0, pri, level, flags, handler, arg) +qec_intr_establish(t, t0, pri, level, flags, handler, arg, what) bus_space_tag_t t; bus_space_tag_t t0; int pri; @@ -294,6 +295,7 @@ qec_intr_establish(t, t0, pri, level, flags, handler, arg) int flags; int (*handler)(void *); void *arg; + const char *what; { struct qec_softc *sc = t->cookie; @@ -310,15 +312,15 @@ qec_intr_establish(t, t0, pri, level, flags, handler, arg) pri = sc->sc_intr->sbi_pri; } - if (t->parent == 0 || t->parent->sparc_bus_mmap == 0) { - printf("\nebus_bus_mmap: invalid parent"); - return (NULL); - } + for (t = t->parent; t; t = t->parent) { + if (t->sparc_intr_establish != NULL) + return ((*t->sparc_intr_establish) + (t, t0, pri, level, flags, handler, arg, what)); + } - t = t->parent; + panic("qec_intr_extablish): no handler found"); - return ((*t->sparc_intr_establish)(t, t0, pri, level, flags, - handler, arg)); + return (NULL); } void diff --git a/sys/dev/sbus/spif.c b/sys/dev/sbus/spif.c index e88f1f2b823..b843270d029 100644 --- a/sys/dev/sbus/spif.c +++ b/sys/dev/sbus/spif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spif.c,v 1.7 2003/06/02 18:32:41 jason Exp $ */ +/* $OpenBSD: spif.c,v 1.8 2003/06/24 21:54:38 henric Exp $ */ /* * Copyright (c) 1999-2002 Jason L. Wright (jason@thought.net) @@ -216,14 +216,16 @@ spifattach(parent, self, aux) } sc->sc_ppcih = bus_intr_establish(sa->sa_bustag, - sa->sa_intr[PARALLEL_INTR].sbi_pri, IPL_TTY, 0, spifppcintr, sc); + sa->sa_intr[PARALLEL_INTR].sbi_pri, IPL_TTY, 0, spifppcintr, sc, + self->dv_xname); if (sc->sc_ppcih == NULL) { printf(": failed to establish ppc interrupt\n"); goto fail_unmapregs; } sc->sc_stcih = bus_intr_establish(sa->sa_bustag, - sa->sa_intr[SERIAL_INTR].sbi_pri, IPL_TTY, 0, spifstcintr, sc); + sa->sa_intr[SERIAL_INTR].sbi_pri, IPL_TTY, 0, spifstcintr, sc, + self->dv_xname); if (sc->sc_stcih == NULL) { printf(": failed to establish stc interrupt\n"); goto fail_unmapregs; |