From 8fb9a995cfd9d02bda816323c1b2e5a9b544fe7f Mon Sep 17 00:00:00 2001 From: Brian Feldman Date: Wed, 14 Apr 2004 14:57:49 +0000 Subject: [PATCH] The newpcm headers currently #define away INTR_MPSAFE and INTR_TYPE_AV because they bogusly check for defined(INTR_MPSAFE) -- something which never was a #define. Correct the definitions. This make INTR_TYPE_AV finally get used instead of the lower-priority INTR_TYPE_TTY, so it's quite possible some improvement will be had on sound driver performance. It would also make all the drivers marked INTR_MPSAFE actually run without Giant (which does seem to work for me), but: INTR_MPSAFE HAS BEEN REMOVED FROM EVERY SOUND DRIVER! It needs to be re-added on a case-by-case basis since there is no one who will vouch for which sound drivers, if any, willy actually operate correctly without Giant, since there hasn't been testing because of this bug disabling INTR_MPSAFE. Found by: "Yuriy Tsibizov" --- sys/dev/sound/isa/ad1816.c | 2 +- sys/dev/sound/isa/ess.c | 2 +- sys/dev/sound/isa/mss.c | 4 ++-- sys/dev/sound/isa/sb16.c | 2 +- sys/dev/sound/isa/sb8.c | 2 +- sys/dev/sound/isa/sbc.c | 2 +- sys/dev/sound/pci/cmi.c | 2 +- sys/dev/sound/pci/csa.c | 2 +- sys/dev/sound/pci/csapcm.c | 2 +- sys/dev/sound/pci/ds1.c | 2 +- sys/dev/sound/pci/emu10k1.c | 2 +- sys/dev/sound/pci/ich.c | 2 +- sys/dev/sound/pci/t4dwave.c | 2 +- sys/dev/sound/pcm/sound.h | 11 +++-------- 14 files changed, 17 insertions(+), 22 deletions(-) diff --git a/sys/dev/sound/isa/ad1816.c b/sys/dev/sound/isa/ad1816.c index 3de4804512a..398ce46b7dc 100644 --- a/sys/dev/sound/isa/ad1816.c +++ b/sys/dev/sound/isa/ad1816.c @@ -604,7 +604,7 @@ ad1816_attach(device_t dev) ad1816_init(ad1816, dev); if (mixer_init(dev, &ad1816mixer_class, ad1816)) goto no; - snd_setup_intr(dev, ad1816->irq, INTR_MPSAFE, ad1816_intr, ad1816, &ad1816->ih); + snd_setup_intr(dev, ad1816->irq, 0, ad1816_intr, ad1816, &ad1816->ih); if (bus_dma_tag_create(/*parent*/NULL, /*alignment*/2, /*boundary*/0, /*lowaddr*/BUS_SPACE_MAXADDR_24BIT, /*highaddr*/BUS_SPACE_MAXADDR, diff --git a/sys/dev/sound/isa/ess.c b/sys/dev/sound/isa/ess.c index fc49efd0e18..36a731a2d1f 100644 --- a/sys/dev/sound/isa/ess.c +++ b/sys/dev/sound/isa/ess.c @@ -841,7 +841,7 @@ ess_attach(device_t dev) if (sc->newspeed) ess_setmixer(sc, 0x71, 0x22); - snd_setup_intr(dev, sc->irq, INTR_MPSAFE, ess_intr, sc, &sc->ih); + snd_setup_intr(dev, sc->irq, 0, ess_intr, sc, &sc->ih); if (!sc->duplex) pcm_setflags(dev, pcm_getflags(dev) | SD_F_SIMPLEX); diff --git a/sys/dev/sound/isa/mss.c b/sys/dev/sound/isa/mss.c index 9e2eccecd0d..cb605e32bcb 100644 --- a/sys/dev/sound/isa/mss.c +++ b/sys/dev/sound/isa/mss.c @@ -1711,10 +1711,10 @@ mss_doattach(device_t dev, struct mss_info *mss) mixer_init(dev, (mss->bd_id == MD_YM0020)? &ymmix_mixer_class : &mssmix_mixer_class, mss); switch (mss->bd_id) { case MD_OPTI931: - snd_setup_intr(dev, mss->irq, INTR_MPSAFE, opti931_intr, mss, &mss->ih); + snd_setup_intr(dev, mss->irq, 0, opti931_intr, mss, &mss->ih); break; default: - snd_setup_intr(dev, mss->irq, INTR_MPSAFE, mss_intr, mss, &mss->ih); + snd_setup_intr(dev, mss->irq, 0, mss_intr, mss, &mss->ih); } if (pdma == rdma) pcm_setflags(dev, pcm_getflags(dev) | SD_F_SIMPLEX); diff --git a/sys/dev/sound/isa/sb16.c b/sys/dev/sound/isa/sb16.c index da82611d2e0..87683ce6431 100644 --- a/sys/dev/sound/isa/sb16.c +++ b/sys/dev/sound/isa/sb16.c @@ -803,7 +803,7 @@ sb16_attach(device_t dev) goto no; if (mixer_init(dev, &sb16mix_mixer_class, sb)) goto no; - if (snd_setup_intr(dev, sb->irq, INTR_MPSAFE, sb_intr, sb, &sb->ih)) + if (snd_setup_intr(dev, sb->irq, 0, sb_intr, sb, &sb->ih)) goto no; if (sb->bd_flags & BD_F_SB16X) diff --git a/sys/dev/sound/isa/sb8.c b/sys/dev/sound/isa/sb8.c index 877971e4b49..aba6821034b 100644 --- a/sys/dev/sound/isa/sb8.c +++ b/sys/dev/sound/isa/sb8.c @@ -716,7 +716,7 @@ sb_attach(device_t dev) goto no; if (mixer_init(dev, (sb->bd_id < 0x300)? &sbmix_mixer_class : &sbpromix_mixer_class, sb)) goto no; - if (snd_setup_intr(dev, sb->irq, INTR_MPSAFE, sb_intr, sb, &sb->ih)) + if (snd_setup_intr(dev, sb->irq, 0, sb_intr, sb, &sb->ih)) goto no; pcm_setflags(dev, pcm_getflags(dev) | SD_F_SIMPLEX); diff --git a/sys/dev/sound/isa/sbc.c b/sys/dev/sound/isa/sbc.c index 6abb5965c5b..3badd6579e7 100644 --- a/sys/dev/sound/isa/sbc.c +++ b/sys/dev/sound/isa/sbc.c @@ -430,7 +430,7 @@ sbc_attach(device_t dev) err = "setup_intr"; for (i = 0; i < IRQ_MAX; i++) { scp->ihl[i].parent = scp; - if (snd_setup_intr(dev, scp->irq[i], INTR_MPSAFE, sbc_intr, &scp->ihl[i], &scp->ih[i])) + if (snd_setup_intr(dev, scp->irq[i], 0, sbc_intr, &scp->ihl[i], &scp->ih[i])) goto bad; } diff --git a/sys/dev/sound/pci/cmi.c b/sys/dev/sound/pci/cmi.c index de5b38659e4..f029872f398 100644 --- a/sys/dev/sound/pci/cmi.c +++ b/sys/dev/sound/pci/cmi.c @@ -863,7 +863,7 @@ cmi_attach(device_t dev) sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid, RF_ACTIVE | RF_SHAREABLE); if (!sc->irq || - snd_setup_intr(dev, sc->irq, INTR_MPSAFE, cmi_intr, sc, &sc->ih)) { + snd_setup_intr(dev, sc->irq, 0, cmi_intr, sc, &sc->ih)) { device_printf(dev, "cmi_attach: Unable to map interrupt\n"); goto bad; } diff --git a/sys/dev/sound/pci/csa.c b/sys/dev/sound/pci/csa.c index 5b28ecd9882..409d1a0faa8 100644 --- a/sys/dev/sound/pci/csa.c +++ b/sys/dev/sound/pci/csa.c @@ -275,7 +275,7 @@ csa_attach(device_t dev) goto err_mem; /* Enable interrupt. */ - if (snd_setup_intr(dev, resp->irq, INTR_MPSAFE, csa_intr, scp, &scp->ih)) + if (snd_setup_intr(dev, resp->irq, 0, csa_intr, scp, &scp->ih)) goto err_intr; #if 0 if ((csa_readio(resp, BA0_HISR) & HISR_INTENA) == 0) diff --git a/sys/dev/sound/pci/csapcm.c b/sys/dev/sound/pci/csapcm.c index 47a2e072b09..1dc17d7313f 100644 --- a/sys/dev/sound/pci/csapcm.c +++ b/sys/dev/sound/pci/csapcm.c @@ -795,7 +795,7 @@ pcmcsa_attach(device_t dev) rman_get_start(resp->irq),PCM_KLDSTRING(snd_csa)); /* Enable interrupt. */ - if (snd_setup_intr(dev, resp->irq, INTR_MPSAFE, csa_intr, csa, &csa->ih)) { + if (snd_setup_intr(dev, resp->irq, 0, csa_intr, csa, &csa->ih)) { ac97_destroy(codec); csa_releaseres(csa, dev); return (ENXIO); diff --git a/sys/dev/sound/pci/ds1.c b/sys/dev/sound/pci/ds1.c index 443b15abbf1..1f689c97925 100644 --- a/sys/dev/sound/pci/ds1.c +++ b/sys/dev/sound/pci/ds1.c @@ -991,7 +991,7 @@ ds_pci_attach(device_t dev) sc->irqid = 0; sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid, RF_ACTIVE | RF_SHAREABLE); - if (!sc->irq || snd_setup_intr(dev, sc->irq, INTR_MPSAFE, ds_intr, sc, &sc->ih)) { + if (!sc->irq || snd_setup_intr(dev, sc->irq, 0, ds_intr, sc, &sc->ih)) { device_printf(dev, "unable to map interrupt\n"); goto bad; } diff --git a/sys/dev/sound/pci/emu10k1.c b/sys/dev/sound/pci/emu10k1.c index 2ef7aaece36..e017335b3bf 100644 --- a/sys/dev/sound/pci/emu10k1.c +++ b/sys/dev/sound/pci/emu10k1.c @@ -1944,7 +1944,7 @@ emu_pci_attach(device_t dev) sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, RF_ACTIVE | RF_SHAREABLE); if (!sc->irq || - snd_setup_intr(dev, sc->irq, INTR_MPSAFE, emu_intr, sc, &sc->ih)) { + snd_setup_intr(dev, sc->irq, 0, emu_intr, sc, &sc->ih)) { device_printf(dev, "unable to map interrupt\n"); goto bad; } diff --git a/sys/dev/sound/pci/ich.c b/sys/dev/sound/pci/ich.c index 2cb9118de7f..a1872171e57 100644 --- a/sys/dev/sound/pci/ich.c +++ b/sys/dev/sound/pci/ich.c @@ -745,7 +745,7 @@ ich_pci_attach(device_t dev) sc->irqid = 0; sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid, RF_ACTIVE | RF_SHAREABLE); - if (!sc->irq || snd_setup_intr(dev, sc->irq, INTR_MPSAFE, ich_intr, sc, &sc->ih)) { + if (!sc->irq || snd_setup_intr(dev, sc->irq, 0, ich_intr, sc, &sc->ih)) { device_printf(dev, "unable to map interrupt\n"); goto bad; } diff --git a/sys/dev/sound/pci/t4dwave.c b/sys/dev/sound/pci/t4dwave.c index a61be39b7bd..5e9ba9efdb1 100644 --- a/sys/dev/sound/pci/t4dwave.c +++ b/sys/dev/sound/pci/t4dwave.c @@ -845,7 +845,7 @@ tr_pci_attach(device_t dev) tr->irqid = 0; tr->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &tr->irqid, RF_ACTIVE | RF_SHAREABLE); - if (!tr->irq || snd_setup_intr(dev, tr->irq, INTR_MPSAFE, tr_intr, tr, &tr->ih)) { + if (!tr->irq || snd_setup_intr(dev, tr->irq, 0, tr_intr, tr, &tr->ih)) { device_printf(dev, "unable to map interrupt\n"); goto bad; } diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index 0ac69494643..7acdfc89fc4 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -77,18 +77,13 @@ #define USING_MUTEX #define USING_DEVFS +#else +#define INTR_TYPE_AV INTR_TYPE_TTY +#define INTR_MPSAFE 0 #endif #define SND_DYNSYSCTL -#ifndef INTR_MPSAFE -#define INTR_TYPE_AV INTR_TYPE_TTY -#endif - -#ifndef INTR_MPSAFE -#define INTR_MPSAFE 0 -#endif - struct pcm_channel; struct pcm_feeder; struct snd_dbuf;