diff options
author | Henric Jungheim <henric@cvs.openbsd.org> | 2003-06-24 21:54:40 +0000 |
---|---|---|
committer | Henric Jungheim <henric@cvs.openbsd.org> | 2003-06-24 21:54:40 +0000 |
commit | 355b8560084501d10eae7686c8385754bc6c7072 (patch) | |
tree | d3bc0a5b778c1c6b51beb7fedae743f3fc436c13 /sys/arch | |
parent | 02503c73b4a809f21312fef8bf66cfe5d0f1a50f (diff) |
Add a "where" argument to the sparc64 interrupt code. This lets us
associate a name with each interrupt handler. This is not visible
outside the kernel (yet).
ok jason@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc64/dev/ce4231.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/com_ebus.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/comkbd_ebus.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/pci_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/pckbc_ebus.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/psycho.c | 101 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/sab.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/sbus.c | 39 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/schizo.c | 20 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/stp_sbus.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/zs.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc64/include/bus.h | 18 | ||||
-rw-r--r-- | sys/arch/sparc64/include/cpu.h | 38 | ||||
-rw-r--r-- | sys/arch/sparc64/include/intr.h | 37 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/machdep.c | 49 |
15 files changed, 182 insertions, 160 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); } |