The branch main has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9054e296819f325da3b6a4da301eab853eee6757

commit 9054e296819f325da3b6a4da301eab853eee6757
Author:     Ed Maste <[email protected]>
AuthorDate: 2022-03-18 16:22:21 +0000
Commit:     Ed Maste <[email protected]>
CommitDate: 2022-09-15 14:07:23 +0000

    Retire ISA sound card DMA support
    
    As all ISA sound card drivers have been removed sndbuf_dma no longer
    serves any purpose.
    
    Reviewed by:    mav
    Relnotes:       Yes
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D34671
---
 sys/conf/files                   |   1 -
 sys/dev/sound/isa/sndbuf_dma.c   | 109 ---------------------------------------
 sys/dev/sound/pcm/buffer.h       |  10 ----
 sys/dev/sound/pcm/channel.c      |   9 ----
 sys/modules/sound/sound/Makefile |  20 -------
 5 files changed, 149 deletions(-)

diff --git a/sys/conf/files b/sys/conf/files
index d7949dc5a069..7633d45c5187 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -3103,7 +3103,6 @@ dev/smc/if_smc_fdt.c              optional smc fdt
 dev/snp/snp.c                  optional snp
 dev/sound/clone.c              optional sound
 dev/sound/unit.c               optional sound
-dev/sound/isa/sndbuf_dma.c     optional sound isa
 dev/sound/pci/als4000.c                optional snd_als4000 pci
 dev/sound/pci/atiixp.c         optional snd_atiixp pci
 dev/sound/pci/cmi.c            optional snd_cmi pci
diff --git a/sys/dev/sound/isa/sndbuf_dma.c b/sys/dev/sound/isa/sndbuf_dma.c
deleted file mode 100644
index 9d41c5292970..000000000000
--- a/sys/dev/sound/isa/sndbuf_dma.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 1999 Cameron Grant <[email protected]>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef HAVE_KERNEL_OPTION_HEADERS
-#include "opt_snd.h"
-#endif
-
-#include <dev/sound/pcm/sound.h>
-
-#include <isa/isavar.h>
-
-SND_DECLARE_FILE("$FreeBSD$");
-
-int
-sndbuf_dmasetup(struct snd_dbuf *b, struct resource *drq)
-{
-       /* should do isa_dma_acquire/isa_dma_release here */
-       if (drq == NULL) {
-               b->dmachan = -1;
-       } else {
-               sndbuf_setflags(b, SNDBUF_F_DMA, 1);
-               b->dmachan = rman_get_start(drq);
-       }
-       return 0;
-}
-
-int
-sndbuf_dmasetdir(struct snd_dbuf *b, int dir)
-{
-       KASSERT(b, ("sndbuf_dmasetdir called with b == NULL"));
-       KASSERT(sndbuf_getflags(b) & SNDBUF_F_DMA, ("sndbuf_dmasetdir called on 
non-ISA buffer"));
-
-       b->dir = (dir == PCMDIR_PLAY)? ISADMA_WRITE : ISADMA_READ;
-       return 0;
-}
-
-void
-sndbuf_dma(struct snd_dbuf *b, int go)
-{
-       KASSERT(b, ("sndbuf_dma called with b == NULL"));
-       KASSERT(sndbuf_getflags(b) & SNDBUF_F_DMA, ("sndbuf_dma called on 
non-ISA buffer"));
-
-       switch (go) {
-       case PCMTRIG_START:
-               /* isa_dmainit(b->chan, size); */
-               isa_dmastart(b->dir | ISADMA_RAW, b->buf, b->bufsize, 
b->dmachan);
-               break;
-
-       case PCMTRIG_STOP:
-       case PCMTRIG_ABORT:
-               isa_dmastop(b->dmachan);
-               isa_dmadone(b->dir | ISADMA_RAW, b->buf, b->bufsize, 
b->dmachan);
-               break;
-       }
-
-       DEB(printf("buf 0x%p ISA DMA %s, channel %d\n",
-               b,
-               (go == PCMTRIG_START)? "started" : "stopped",
-               b->dmachan));
-}
-
-int
-sndbuf_dmaptr(struct snd_dbuf *b)
-{
-       int i;
-
-       KASSERT(b, ("sndbuf_dmaptr called with b == NULL"));
-       KASSERT(sndbuf_getflags(b) & SNDBUF_F_DMA, ("sndbuf_dmaptr called on 
non-ISA buffer"));
-
-       if (!sndbuf_runsz(b))
-               return 0;
-       i = isa_dmastatus(b->dmachan);
-       KASSERT(i >= 0, ("isa_dmastatus returned %d", i));
-       return b->bufsize - i;
-}
-
-void
-sndbuf_dmabounce(struct snd_dbuf *b)
-{
-       KASSERT(b, ("sndbuf_dmabounce called with b == NULL"));
-       KASSERT(sndbuf_getflags(b) & SNDBUF_F_DMA, ("sndbuf_dmabounce called on 
non-ISA buffer"));
-
-       /* tell isa_dma to bounce data in/out */
-}
diff --git a/sys/dev/sound/pcm/buffer.h b/sys/dev/sound/pcm/buffer.h
index 74a684b9a4ac..66b71dcefc2a 100644
--- a/sys/dev/sound/pcm/buffer.h
+++ b/sys/dev/sound/pcm/buffer.h
@@ -28,12 +28,8 @@
  * $FreeBSD$
  */
 
-#define SND_DMA(b) (sndbuf_getflags((b)) & SNDBUF_F_DMA)
 #define SNDBUF_LOCKASSERT(b)
 
-#define        SNDBUF_F_DMA            0x00000001
-#define        SNDBUF_F_XRUN           0x00000002
-#define        SNDBUF_F_RUNNING        0x00000004
 #define        SNDBUF_F_MANAGED        0x00000008
 
 #define SNDBUF_NAMELEN 48
@@ -125,12 +121,6 @@ int sndbuf_feed(struct snd_dbuf *from, struct snd_dbuf 
*to, struct pcm_channel *
 u_int32_t sndbuf_getflags(struct snd_dbuf *b);
 void sndbuf_setflags(struct snd_dbuf *b, u_int32_t flags, int on);
 
-int sndbuf_dmasetup(struct snd_dbuf *b, struct resource *drq);
-int sndbuf_dmasetdir(struct snd_dbuf *b, int dir);
-void sndbuf_dma(struct snd_dbuf *b, int go);
-int sndbuf_dmaptr(struct snd_dbuf *b);
-void sndbuf_dmabounce(struct snd_dbuf *b);
-
 #ifdef OSSV4_EXPERIMENT
 void sndbuf_getpeaks(struct snd_dbuf *b, int *lp, int *rp);
 #endif
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 065bf6ee2c5c..95a29b29d797 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -29,8 +29,6 @@
  * SUCH DAMAGE.
  */
 
-#include "opt_isa.h"
-
 #ifdef HAVE_KERNEL_OPTION_HEADERS
 #include "opt_snd.h"
 #endif
@@ -2191,17 +2189,10 @@ chn_syncstate(struct pcm_channel *c)
 int
 chn_trigger(struct pcm_channel *c, int go)
 {
-#ifdef DEV_ISA
-       struct snd_dbuf *b = c->bufhard;
-#endif
        struct snddev_info *d = c->parentsnddev;
        int ret;
 
        CHN_LOCKASSERT(c);
-#ifdef DEV_ISA
-       if (SND_DMA(b) && (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD))
-               sndbuf_dmabounce(b);
-#endif
        if (!PCMTRIG_COMMON(go))
                return (CHANNEL_TRIGGER(c->methods, c->devinfo, go));
 
diff --git a/sys/modules/sound/sound/Makefile b/sys/modules/sound/sound/Makefile
index adbc14a38020..647b9f324f9f 100644
--- a/sys/modules/sound/sound/Makefile
+++ b/sys/modules/sound/sound/Makefile
@@ -34,24 +34,4 @@ CLEANFILES+= feeder_eq_gen.h feeder_rate_gen.h 
snd_fxdiv_gen.h
 
 EXPORT_SYMS=   YES     # XXX evaluate
 
-.if ${MACHINE_CPUARCH} != "i386" && ${MACHINE_CPUARCH} != "amd64"
-# Create an empty opt_isa.h in order to keep kmod.mk from linking in an
-# existing one from KERNBUILDDIR which possibly has DEV_ISA defined so
-# sound.ko is always built without isadma support.
-opt_isa.h:
-       :> ${.TARGET}
-.else
-.if !defined(KERNBUILDDIR)
-SRCS+= sndbuf_dma.c
-
-opt_isa.h:
-       echo "#define DEV_ISA 1" > ${.TARGET}
-.else
-DEV_ISA!= sed -n '/DEV_ISA/p' ${KERNBUILDDIR}/opt_isa.h
-.if !empty(DEV_ISA)
-SRCS+= sndbuf_dma.c
-.endif
-.endif
-.endif
-
 .include <bsd.kmod.mk>

Reply via email to