diff options
| author | ad <ad@NetBSD.org> | 2007-12-03 15:33:00 +0000 |
|---|---|---|
| committer | ad <ad@NetBSD.org> | 2007-12-03 15:33:00 +0000 |
| commit | 4b293a84e10d4252c834c13e4cd7dd403a91ff9c (patch) | |
| tree | 80186a10f864a618ac26a1a09d030e46cfb59b45 /sys/dev | |
| parent | af3b65635ecc364f5a4d81eb36b75398367d5abd (diff) | |
Interrupt handling changes, in discussion since February:
- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/audio_if.h | 7 | ||||
| -rw-r--r-- | sys/dev/dec/dzkbd.c | 5 | ||||
| -rw-r--r-- | sys/dev/ebus/cs4231_ebus.c | 54 | ||||
| -rw-r--r-- | sys/dev/marvell/gt.c | 10 | ||||
| -rw-r--r-- | sys/dev/marvell/gti2c.c | 6 | ||||
| -rw-r--r-- | sys/dev/marvell/gtpci.c | 10 | ||||
| -rw-r--r-- | sys/dev/mvme/vme_two_isr.c | 10 | ||||
| -rw-r--r-- | sys/dev/qbus/dhu.c | 11 | ||||
| -rw-r--r-- | sys/dev/sbus/cs4231_sbus.c | 42 | ||||
| -rw-r--r-- | sys/dev/sbus/dbri.c | 42 | ||||
| -rw-r--r-- | sys/dev/sbus/dbrivar.h | 3 |
11 files changed, 138 insertions, 62 deletions
diff --git a/sys/dev/audio_if.h b/sys/dev/audio_if.h index 032b4ca9648..adb94cd1b82 100644 --- a/sys/dev/audio_if.h +++ b/sys/dev/audio_if.h @@ -1,4 +1,4 @@ -/* $NetBSD: audio_if.h,v 1.63 2007/03/04 06:01:41 christos Exp $ */ +/* $NetBSD: audio_if.h,v 1.64 2007/12/03 15:34:31 ad Exp $ */ /* * Copyright (c) 1994 Havard Eidnes. @@ -271,11 +271,6 @@ int audioprint(void *, const char *); #define ISDEVAUDIOCTL(x) (AUDIODEV((x)) == AUDIOCTL_DEVICE) #define ISDEVMIXER(x) (AUDIODEV((x)) == MIXER_DEVICE) -#if !defined(__i386__) && !defined(__arm32__) && !defined(IPL_AUDIO) -#define splaudio splbio /* XXX */ -#define IPL_AUDIO IPL_BIO /* XXX */ -#endif - /* * USB Audio specification defines 12 channels: * L R C LFE Ls Rs Lc Rc S Sl Sr T diff --git a/sys/dev/dec/dzkbd.c b/sys/dev/dec/dzkbd.c index fee15177aa8..ae7bb375c0e 100644 --- a/sys/dev/dec/dzkbd.c +++ b/sys/dev/dec/dzkbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: dzkbd.c,v 1.19 2007/10/19 11:59:40 ad Exp $ */ +/* $NetBSD: dzkbd.c,v 1.20 2007/12/03 15:34:31 ad Exp $ */ /* * Copyright (c) 1992, 1993 @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dzkbd.c,v 1.19 2007/10/19 11:59:40 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dzkbd.c,v 1.20 2007/12/03 15:34:31 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: dzkbd.c,v 1.19 2007/10/19 11:59:40 ad Exp $"); #include <sys/ioctl.h> #include <sys/syslog.h> #include <sys/malloc.h> +#include <sys/intr.h> #include <dev/wscons/wsconsio.h> #include <dev/wscons/wskbdvar.h> diff --git a/sys/dev/ebus/cs4231_ebus.c b/sys/dev/ebus/cs4231_ebus.c index 6f082bf7d32..d84d75eab5d 100644 --- a/sys/dev/ebus/cs4231_ebus.c +++ b/sys/dev/ebus/cs4231_ebus.c @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231_ebus.c,v 1.23 2007/10/19 11:59:40 ad Exp $ */ +/* $NetBSD: cs4231_ebus.c,v 1.24 2007/12/03 15:34:32 ad Exp $ */ /* * Copyright (c) 2002 Valeriy E. Ushakov @@ -28,16 +28,17 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cs4231_ebus.c,v 1.23 2007/10/19 11:59:40 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cs4231_ebus.c,v 1.24 2007/12/03 15:34:32 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/errno.h> #include <sys/device.h> #include <sys/malloc.h> +#include <sys/cpu.h> #include <machine/autoconf.h> -#include <sys/cpu.h> + #include <dev/ebus/ebusreg.h> #include <dev/ebus/ebusvar.h> @@ -60,6 +61,8 @@ int cs4231_ebus_debug = 0; struct cs4231_ebus_softc { struct cs4231_softc sc_cs4231; + void *sc_pint; + void *sc_rint; bus_space_tag_t sc_bt; bus_space_handle_t sc_pdmareg; /* playback DMA */ bus_space_handle_t sc_cdmareg; /* record DMA */ @@ -69,6 +72,9 @@ struct cs4231_ebus_softc { void cs4231_ebus_attach(struct device *, struct device *, void *); int cs4231_ebus_match(struct device *, struct cfdata *, void *); +static void cs4231_ebus_pint(void *); +static void cs4231_ebus_rint(void *); + CFATTACH_DECL(audiocs_ebus, sizeof(struct cs4231_ebus_softc), cs4231_ebus_match, cs4231_ebus_attach, NULL, NULL); @@ -128,7 +134,8 @@ static int cs4231_ebus_trigger_transfer(struct cs4231_softc *, static void cs4231_ebus_dma_advance(struct cs_transfer *, bus_space_tag_t, bus_space_handle_t); static int cs4231_ebus_dma_intr(struct cs_transfer *, - bus_space_tag_t, bus_space_handle_t); + bus_space_tag_t, bus_space_handle_t, + void *); static int cs4231_ebus_intr(void *); @@ -164,6 +171,11 @@ cs4231_ebus_attach(struct device *parent, struct device *self, void *aux) sc->sc_bustag = ebsc->sc_bt = ea->ea_bustag; sc->sc_dmatag = ea->ea_dmatag; + ebsc->sc_pint = softint_establish(SOFTINT_SERIAL, + cs4231_ebus_pint, ebsc); + ebsc->sc_rint = softint_establish(SOFTINT_SERIAL, + cs4231_ebus_rint, ebsc); + /* * These are the register we get from the prom: * - CS4231 registers @@ -203,7 +215,7 @@ cs4231_ebus_attach(struct device *parent, struct device *self, void *aux) /* establish interrupt channels */ for (i = 0; i < ea->ea_nintr; ++i) bus_intr_establish(ea->ea_bustag, - ea->ea_intr[i], IPL_AUDIO, + ea->ea_intr[i], IPL_SCHED, cs4231_ebus_intr, ebsc); cs4231_common_attach(sc, bh); @@ -437,7 +449,7 @@ cs4231_ebus_halt_input(void *addr) static int cs4231_ebus_dma_intr(struct cs_transfer *t, bus_space_tag_t dt, - bus_space_handle_t dh) + bus_space_handle_t dh, void *sih) { uint32_t csr; #ifdef AUDIO_DEBUG @@ -475,7 +487,7 @@ cs4231_ebus_dma_intr(struct cs_transfer *t, bus_space_tag_t dt, /* call audio(9) framework while DMA is chugging along */ if (t->t_intr != NULL) - (*t->t_intr)(t->t_arg); + softint_schedule(sih); return 1; } @@ -517,15 +529,15 @@ cs4231_ebus_intr(void *arg) ret = 0; - if (cs4231_ebus_dma_intr(&sc->sc_capture, - ebsc->sc_bt, ebsc->sc_cdmareg) != 0) + if (cs4231_ebus_dma_intr(&sc->sc_capture, ebsc->sc_bt, + ebsc->sc_cdmareg, ebsc->sc_rint) != 0) { ++sc->sc_intrcnt.ev_count; ret = 1; } - if (cs4231_ebus_dma_intr(&sc->sc_playback, - ebsc->sc_bt, ebsc->sc_pdmareg) != 0) + if (cs4231_ebus_dma_intr(&sc->sc_playback, ebsc->sc_bt, + ebsc->sc_pdmareg, ebsc->sc_pint) != 0) { ++sc->sc_intrcnt.ev_count; ret = 1; @@ -533,3 +545,23 @@ cs4231_ebus_intr(void *arg) return ret; } + +static void +cs4231_ebus_pint(void *cookie) +{ + struct cs4231_softc *sc = cookie; + struct cs_transfer *t = &sc->sc_playback; + + if (t->t_intr != NULL) + (*t->t_intr)(t->t_arg); +} + +static void +cs4231_ebus_rint(void *cookie) +{ + struct cs4231_softc *sc = cookie; + struct cs_transfer *t = &sc->sc_capture; + + if (t->t_intr != NULL) + (*t->t_intr)(t->t_arg); +} diff --git a/sys/dev/marvell/gt.c b/sys/dev/marvell/gt.c index bdc40e12a5c..fee6af058af 100644 --- a/sys/dev/marvell/gt.c +++ b/sys/dev/marvell/gt.c @@ -1,4 +1,4 @@ -/* $NetBSD: gt.c,v 1.14 2007/10/19 12:00:33 ad Exp $ */ +/* $NetBSD: gt.c,v 1.15 2007/12/03 15:34:32 ad Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.14 2007/10/19 12:00:33 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.15 2007/12/03 15:34:32 ad Exp $"); #include "opt_marvell.h" #include "locators.h" @@ -563,7 +563,7 @@ gt_comm_intr_enb(struct gt_softc *gt) gt_write(gt, GT_CommUnitIntr_Mask, GT_CommUnitIntr_DFLT); (void)gt_read(gt, GT_CommUnitIntr_ErrAddr); - intr_establish(IRQ_COMM, IST_LEVEL, IPL_GTERR, gt_comm_intr, gt); + intr_establish(IRQ_COMM, IST_LEVEL, IPL_VM, gt_comm_intr, gt); printf("%s: Comm Unit irpt at %d\n", gt->gt_dev.dv_xname, IRQ_COMM); } @@ -626,7 +626,7 @@ gt_ecc_intr_enb(struct gt_softc *gt) (void)gt_read(gt, GT_ECC_Addr); /* read last! */ gt_write(gt, GT_ECC_Addr, 0); /* clear irpt */ - intr_establish(IRQ_ECC, IST_LEVEL, IPL_GTERR, gt_ecc_intr, gt); + intr_establish(IRQ_ECC, IST_LEVEL, IPL_VM, gt_ecc_intr, gt); printf("%s: ECC irpt at %d\n", gt->gt_dev.dv_xname, IRQ_ECC); } #endif /* GT_ECC */ @@ -923,7 +923,7 @@ gt_devbus_intr_enb(struct gt_softc *gt) (void)gt_read(gt, GT_DEVBUS_ERR_ADDR); /* clear addr */ gt_write(gt, GT_ECC_Addr, 0); /* clear irpt */ - intr_establish(IRQ_DEV, IST_LEVEL, IPL_GTERR, gt_devbus_intr, gt); + intr_establish(IRQ_DEV, IST_LEVEL, IPL_VM, gt_devbus_intr, gt); printf("%s: Device Bus Error irpt at %d\n", gt->gt_dev.dv_xname, IRQ_DEV); } diff --git a/sys/dev/marvell/gti2c.c b/sys/dev/marvell/gti2c.c index 325bf4d0980..904cc7e56f1 100644 --- a/sys/dev/marvell/gti2c.c +++ b/sys/dev/marvell/gti2c.c @@ -1,4 +1,4 @@ -/* $NetBSD: gti2c.c,v 1.6 2007/10/19 12:00:33 ad Exp $ */ +/* $NetBSD: gti2c.c,v 1.7 2007/12/03 15:34:32 ad Exp $ */ /* * Copyright (c) 2005 Brocade Communcations, inc. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gti2c.c,v 1.6 2007/10/19 12:00:33 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gti2c.c,v 1.7 2007/12/03 15:34:32 ad Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -267,7 +267,7 @@ gt_i2c_attach(struct device *parent, struct device *self, void *aux) sc->sc_i2c.ic_read_byte = gt_i2c_read_byte; sc->sc_i2c.ic_write_byte = gt_i2c_write_byte; - intr_establish(IRQ_I2C, IST_LEVEL, IPL_I2C, gt_i2c_intr, sc); + intr_establish(IRQ_I2C, IST_LEVEL, IPL_VM, gt_i2c_intr, sc); evcnt_attach_dynamic(&sc->sc_ev_intr, EVCNT_TYPE_INTR, NULL, sc->sc_dev.dv_xname, "intr"); diff --git a/sys/dev/marvell/gtpci.c b/sys/dev/marvell/gtpci.c index 0965535575c..d83713f77f3 100644 --- a/sys/dev/marvell/gtpci.c +++ b/sys/dev/marvell/gtpci.c @@ -1,4 +1,4 @@ -/* $NetBSD: gtpci.c,v 1.16 2007/10/19 12:00:33 ad Exp $ */ +/* $NetBSD: gtpci.c,v 1.17 2007/12/03 15:34:32 ad Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.16 2007/10/19 12:00:33 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.17 2007/12/03 15:34:32 ad Exp $"); #include "opt_marvell.h" #include <sys/param.h> @@ -287,11 +287,11 @@ gtpci_attach(struct device *parent, struct device *self, void *aux) (void)gtpci_read(gtpc, PCI_ERROR_ADDRESS_LOW(gtpc->gtpc_busno)); if (gtpc->gtpc_host) { intr_establish(pci_irqs[gtpc->gtpc_busno][0], IST_LEVEL, - IPL_GTERR, gtpci_error_intr, pc); + IPL_VM, gtpci_error_intr, pc); intr_establish(pci_irqs[gtpc->gtpc_busno][1], IST_LEVEL, - IPL_GTERR, gtpci_error_intr, pc); + IPL_VM, gtpci_error_intr, pc); intr_establish(pci_irqs[gtpc->gtpc_busno][2], IST_LEVEL, - IPL_GTERR, gtpci_error_intr, pc); + IPL_VM, gtpci_error_intr, pc); aprint_normal("%s: %s%d error interrupts at irqs %s, %s, %s\n", pc->pc_parent->dv_xname, "pci", busno, intr_string(pci_irqs[gtpc->gtpc_busno][0]), diff --git a/sys/dev/mvme/vme_two_isr.c b/sys/dev/mvme/vme_two_isr.c index a9c6b126cc9..ce60dfda555 100644 --- a/sys/dev/mvme/vme_two_isr.c +++ b/sys/dev/mvme/vme_two_isr.c @@ -1,4 +1,4 @@ -/* $NetBSD: vme_two_isr.c,v 1.7 2007/10/19 12:00:37 ad Exp $ */ +/* $NetBSD: vme_two_isr.c,v 1.8 2007/12/03 15:34:32 ad Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vme_two_isr.c,v 1.7 2007/10/19 12:00:37 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vme_two_isr.c,v 1.8 2007/12/03 15:34:32 ad Exp $"); #include "vmetwo.h" @@ -86,7 +86,9 @@ static struct vme_two_handler { sizeof(struct vme_two_handler)) static int vmetwo_local_isr_trampoline(void *); +#ifdef notyet static void vmetwo_softintr_assert(void); +#endif static struct vmetwo_softc *vmetwo_sc; @@ -217,9 +219,11 @@ vmetwo_intr_init(struct vmetwo_softc *sc) #endif /* Setup hardware assisted soft interrupts */ +#ifdef notyet vmetwo_intr_establish(sc, 1, 1, VME2_VEC_SOFT0, 1, (int (*)(void *))softintr_dispatch, NULL, NULL); _softintr_chipset_assert = vmetwo_softintr_assert; +#endif } static int @@ -428,9 +432,11 @@ vmetwo_intr_disestablish(csc, lvl, vec, last, evcnt) splx(s); } +#ifdef notyet static void vmetwo_softintr_assert(void) { vme2_lcsr_write(vmetwo_sc, VME2LCSR_SOFTINT_SET, VME2_SOFTINT_SET(0)); } +#endif diff --git a/sys/dev/qbus/dhu.c b/sys/dev/qbus/dhu.c index 0f67db54688..2822e19e8d1 100644 --- a/sys/dev/qbus/dhu.c +++ b/sys/dev/qbus/dhu.c @@ -1,4 +1,4 @@ -/* $NetBSD: dhu.c,v 1.50 2007/11/19 18:51:49 ad Exp $ */ +/* $NetBSD: dhu.c,v 1.51 2007/12/03 15:34:32 ad Exp $ */ /* * Copyright (c) 2003, Hugh Graham. * Copyright (c) 1992, 1993 @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dhu.c,v 1.50 2007/11/19 18:51:49 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dhu.c,v 1.51 2007/12/03 15:34:32 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -438,9 +438,6 @@ dhuopen(dev, flag, mode, l) if (line >= sc->sc_lines) return ENXIO; - if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp)) - return (EBUSY); - mutex_spin_enter(&tty_lock); if (sc->sc_type == IS_DHU) { /* CSR 3:0 must be 0 */ @@ -452,6 +449,10 @@ dhuopen(dev, flag, mode, l) sc->sc_dhu[line].dhu_modem = DHU_READ_WORD(DHU_UBA_STAT); tp = sc->sc_dhu[line].dhu_tty; + + if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp)) + return (EBUSY); + tp->t_oproc = dhustart; tp->t_param = dhuparam; tp->t_hwiflow = dhuiflow; diff --git a/sys/dev/sbus/cs4231_sbus.c b/sys/dev/sbus/cs4231_sbus.c index 4a7b5d4288e..863dea20d26 100644 --- a/sys/dev/sbus/cs4231_sbus.c +++ b/sys/dev/sbus/cs4231_sbus.c @@ -1,7 +1,7 @@ -/* $NetBSD: cs4231_sbus.c,v 1.35 2007/10/19 12:01:10 ad Exp $ */ +/* $NetBSD: cs4231_sbus.c,v 1.36 2007/12/03 15:34:33 ad Exp $ */ /*- - * Copyright (c) 1998, 1999, 2002 The NetBSD Foundation, Inc. + * Copyright (c) 1998, 1999, 2002, 2007 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cs4231_sbus.c,v 1.35 2007/10/19 12:01:10 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cs4231_sbus.c,v 1.36 2007/12/03 15:34:33 ad Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -47,7 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: cs4231_sbus.c,v 1.35 2007/10/19 12:01:10 ad Exp $"); #include <sys/errno.h> #include <sys/device.h> #include <sys/malloc.h> - #include <sys/bus.h> #include <sys/intr.h> @@ -79,6 +78,8 @@ int cs4231_sbus_debug = 0; struct cs4231_sbus_softc { struct cs4231_softc sc_cs4231; + void *sc_pint; + void *sc_rint; struct sbusdev sc_sd; /* sbus device */ bus_space_tag_t sc_bt; /* DMA controller tag */ bus_space_handle_t sc_bh; /* DMA controller registers */ @@ -87,6 +88,8 @@ struct cs4231_sbus_softc { static int cs4231_sbus_match(struct device *, struct cfdata *, void *); static void cs4231_sbus_attach(struct device *, struct device *, void *); +static void cs4231_sbus_pint(void *); +static void cs4231_sbus_rint(void *); CFATTACH_DECL(audiocs_sbus, sizeof(struct cs4231_sbus_softc), cs4231_sbus_match, cs4231_sbus_attach, NULL, NULL); @@ -165,6 +168,11 @@ cs4231_sbus_attach(struct device *parent, struct device *self, void *aux) sbsc->sc_bt = sc->sc_bustag = sa->sa_bustag; sc->sc_dmatag = sa->sa_dmatag; + sbsc->sc_pint = softint_establish(SOFTINT_SERIAL, + cs4231_sbus_pint, sbsc); + sbsc->sc_rint = softint_establish(SOFTINT_SERIAL, + cs4231_sbus_rint, sbsc); + /* * Map my registers in, if they aren't already in virtual * address space. @@ -192,7 +200,7 @@ cs4231_sbus_attach(struct device *parent, struct device *self, void *aux) /* Establish interrupt channel */ if (sa->sa_nintr) bus_intr_establish(sa->sa_bustag, - sa->sa_pri, IPL_AUDIO, + sa->sa_pri, IPL_SCHED, cs4231_sbus_intr, sbsc); audio_attach_mi(&audiocs_sbus_hw_if, sbsc, &sc->sc_ad1848.sc_dev); @@ -536,7 +544,7 @@ cs4231_sbus_intr(void *arg) APC_DMA_CNC, dmasize); if (t->t_intr != NULL) - (*t->t_intr)(t->t_arg); + softint_schedule(sbsc->sc_rint); ++t->t_intrcnt.ev_count; served = 1; } @@ -560,7 +568,7 @@ cs4231_sbus_intr(void *arg) } if (t->t_intr != NULL) - (*t->t_intr)(t->t_arg); + softint_schedule(sbsc->sc_pint); ++t->t_intrcnt.ev_count; served = 1; } @@ -578,4 +586,24 @@ cs4231_sbus_intr(void *arg) return 1; } +static void +cs4231_sbus_pint(void *cookie) +{ + struct cs4231_softc *sc = cookie; + struct cs_transfer *t = &sc->sc_playback; + + if (t->t_intr != NULL) + (*t->t_intr)(t->t_arg); +} + +static void +cs4231_sbus_rint(void *cookie) +{ + struct cs4231_softc *sc = cookie; + struct cs_transfer *t = &sc->sc_capture; + + if (t->t_intr != NULL) + (*t->t_intr)(t->t_arg); +} + #endif /* NAUDIO > 0 */ diff --git a/sys/dev/sbus/dbri.c b/sys/dev/sbus/dbri.c index 804113b3b14..2ac6c34ed26 100644 --- a/sys/dev/sbus/dbri.c +++ b/sys/dev/sbus/dbri.c @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.16 2007/10/19 12:01:10 ad Exp $ */ +/* $NetBSD: dbri.c,v 1.17 2007/12/03 15:34:33 ad Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de) @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.16 2007/10/19 12:01:10 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.17 2007/12/03 15:34:33 ad Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -54,7 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.16 2007/10/19 12:01:10 ad Exp $"); #include <sys/malloc.h> #include <sys/proc.h> #include <sys/kernel.h> - #include <sys/bus.h> #include <sys/intr.h> @@ -109,6 +108,7 @@ static void dbri_config_interrupts(struct device *); /* interrupt handler */ static int dbri_intr(void *); +static void dbri_softint(void *); /* supporting subroutines */ static int dbri_init(struct dbri_softc *); @@ -282,7 +282,7 @@ dbri_attach_sbus(struct device *parent, struct device *self, void *aux) struct sbus_attach_args *sa = aux; bus_space_handle_t ioh; bus_size_t size; - int error, rseg, pwr; + int error, rseg, pwr, i; char *ver = &sa->sa_name[9]; sc->sc_iot = sa->sa_bustag; @@ -308,6 +308,11 @@ dbri_attach_sbus(struct device *parent, struct device *self, void *aux) sc->sc_powerstate = 1; } + for (i = 0; i < DBRI_NUM_DESCRIPTORS; i++) { + sc->sc_desc[i].softint = softint_establish(SOFTINT_SERIAL, + dbri_softint, &sc->sc_desc[i]); + } + if (sa->sa_npromvaddrs) ioh = (bus_space_handle_t)sa->sa_promvaddrs[0]; else { @@ -370,7 +375,7 @@ dbri_attach_sbus(struct device *parent, struct device *self, void *aux) sbus_establish(&sc->sc_sd, &sc->sc_dev); - bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_AUDIO, dbri_intr, + bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_SCHED, dbri_intr, sc); sc->sc_locked = 0; @@ -503,6 +508,15 @@ dbri_intr(void *hdl) return (1); } +static void +dbri_softint(void *cookie) +{ + struct dbri_desc *dd = cookie; + + if (dd->callback != NULL) + dd->callback(dd->callback_args); +} + static int dbri_init(struct dbri_softc *sc) { @@ -586,7 +600,7 @@ dbri_command_send(struct dbri_softc *sc, volatile u_int32_t *cmd) int maxloops = 1000000; int x; - x = splaudio(); + x = splsched(); sc->sc_locked--; @@ -677,10 +691,8 @@ dbri_process_interrupt(struct dbri_softc *sc, int32_t i) td = sc->sc_pipe[channel].desc; dd = &sc->sc_desc[td]; - if (dd->callback != NULL) { - dd->callback(dd->callback_args); - } else - DPRINTF("!"); + if (dd->callback != NULL) + softint_schedule(dd->softint); break; } case DBRI_INTR_FXDT: /* fixed data change */ @@ -710,7 +722,7 @@ dbri_process_interrupt(struct dbri_softc *sc, int32_t i) dd = &sc->sc_desc[td]; if (dd->callback != NULL) - dd->callback(dd->callback_args); + softint_schedule(dd->softint); break; } case DBRI_INTR_UNDR: @@ -1180,7 +1192,7 @@ pipe_reset(struct dbri_softc *sc, int pipe) #if 0 if (dd->callback) - (*dd->callback)(dd->callback_args); + softint_schedule(dd->softint); #endif sc->sc_pipe[pipe].desc = -1; @@ -1311,7 +1323,7 @@ setup_ring_xmit(struct dbri_softc *sc, int pipe, int which, int num, int blksz, dd->callback = callback; dd->callback_args = callback_args; - x = splaudio(); + x = splsched(); /* the pipe shouldn't be active */ if (pipe_active(sc, pipe)) { @@ -1402,7 +1414,7 @@ setup_ring_recv(struct dbri_softc *sc, int pipe, int which, int num, int blksz, dd->callback = callback; dd->callback_args = callback_args; - x = splaudio(); + x = splsched(); /* the pipe shouldn't be active */ if (pipe_active(sc, pipe)) { @@ -2185,7 +2197,7 @@ dbri_powerhook(int why, void *cookie) int s; dbri_bring_up(sc); - s = splaudio(); + s = splsched(); cmd = dbri_command_lock(sc); *(cmd++) = DBRI_CMD(DBRI_COMMAND_SDP, 0, sc->sc_pipe[4].sdp | diff --git a/sys/dev/sbus/dbrivar.h b/sys/dev/sbus/dbrivar.h index 5c5c89c352e..d4fc1d144fe 100644 --- a/sys/dev/sbus/dbrivar.h +++ b/sys/dev/sbus/dbrivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: dbrivar.h,v 1.7 2007/07/12 22:58:50 macallan Exp $ */ +/* $NetBSD: dbrivar.h,v 1.8 2007/12/03 15:34:33 ad Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de) @@ -111,6 +111,7 @@ struct dbri_desc { size_t len; void (*callback)(void *); void *callback_args; + void *softint; }; struct dbri_dma { |
