git: 92e6b4712b53 - main - Retire broken snd_ds1 and snd_maestro drivers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 19 Mar 2022 00:35:24 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=92e6b4712b53d105c0b63e8792da9f28f044bb23
commit 92e6b4712b53d105c0b63e8792da9f28f044bb23
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-03-18 20:34:05 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-03-19 00:33:19 +0000
Retire broken snd_ds1 and snd_maestro drivers
In 2012 joel@ reported[1] that these were not functional, and they do
not appear to have been fixed since.
[1] https://lists.freebsd.org/pipermail/freebsd-multimedia/2012-January/012751.html
Reported by: joel
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
---
ObsoleteFiles.inc | 4 +
share/man/man4/Makefile | 2 -
share/man/man4/pcm.4 | 6 -
share/man/man4/snd_ds1.4 | 76 --
share/man/man4/snd_maestro.4 | 81 --
sys/conf/NOTES | 4 -
sys/conf/files | 2 -
sys/dev/sound/driver.c | 2 -
sys/dev/sound/pci/ds1.c | 1103 ----------------
sys/dev/sound/pci/ds1.h | 147 ---
sys/dev/sound/pci/maestro.c | 2043 -----------------------------
sys/dev/sound/pci/maestro_reg.h | 382 ------
sys/modules/sound/driver/Makefile | 5 +-
sys/modules/sound/driver/ds1/Makefile | 9 -
sys/modules/sound/driver/maestro/Makefile | 9 -
15 files changed, 6 insertions(+), 3869 deletions(-)
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index c59d6464c63e..6daff798a1b3 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -52,6 +52,10 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20200318: snd_ds1 and snd_maestro drivers removed
+OLD_FILES+=usr/share/man/man4/snd_ds1.4.gz
+OLD_FILES+=usr/share/man/man4/snd_maestro.4.gz
+
# 20220307: remove 330.news
OLD_FILES+=etc/periodic/daily/330.news
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 7e847065994b..251b09081b34 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -505,7 +505,6 @@ MAN= aac.4 \
snd_cmi.4 \
snd_cs4281.4 \
snd_csa.4 \
- snd_ds1.4 \
snd_emu10k1.4 \
snd_emu10kx.4 \
snd_envy24.4 \
@@ -518,7 +517,6 @@ MAN= aac.4 \
snd_hdspe.4 \
snd_ich.4 \
snd_maestro3.4 \
- snd_maestro.4 \
snd_mss.4 \
snd_neomagic.4 \
snd_sbc.4 \
diff --git a/share/man/man4/pcm.4 b/share/man/man4/pcm.4
index ea128c46a900..a4e20decf2b6 100644
--- a/share/man/man4/pcm.4
+++ b/share/man/man4/pcm.4
@@ -91,8 +91,6 @@ The following bridge device drivers are available:
.It
.Xr snd_davbus 4 (enabled by default on powerpc)
.It
-.Xr snd_ds1 4
-.It
.Xr snd_emu10k1 4
.It
.Xr snd_emu10kx 4 (enabled by default on amd64, i386)
@@ -115,8 +113,6 @@ The following bridge device drivers are available:
.It
.Xr snd_ich 4 (enabled by default on amd64, i386)
.It
-.Xr snd_maestro 4
-.It
.Xr snd_maestro3 4
.It
.Xr snd_mss 4
@@ -710,7 +706,6 @@ A device node is not created properly.
.Xr snd_cs4281 4 ,
.Xr snd_csa 4 ,
.Xr snd_davbus 4 ,
-.Xr snd_ds1 4 ,
.Xr snd_emu10k1 4 ,
.Xr snd_emu10kx 4 ,
.Xr snd_envy24 4 ,
@@ -722,7 +717,6 @@ A device node is not created properly.
.Xr snd_hda 4 ,
.Xr snd_hdspe 4 ,
.Xr snd_ich 4 ,
-.Xr snd_maestro 4 ,
.Xr snd_maestro3 4 ,
.Xr snd_mss 4 ,
.Xr snd_neomagic 4 ,
diff --git a/share/man/man4/snd_ds1.4 b/share/man/man4/snd_ds1.4
deleted file mode 100644
index e462e2eece63..000000000000
--- a/share/man/man4/snd_ds1.4
+++ /dev/null
@@ -1,76 +0,0 @@
-.\" Copyright (c) 2004 Atte Peltomaki
-.\" 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 18, 2022
-.Dt SND_DS1 4
-.Os
-.Sh NAME
-.Nm snd_ds1
-.Nd "Yamaha DS-1 PCI bridge device driver"
-.Sh SYNOPSIS
-To compile this driver into the kernel, place the following lines in your
-kernel configuration file:
-.Bd -ragged -offset indent
-.Cd "device sound"
-.Cd "device snd_ds1"
-.Ed
-.Pp
-Alternatively, to load the driver as a module at boot time, place the
-following line in
-.Xr loader.conf 5 :
-.Bd -literal -offset indent
-snd_ds1_load="YES"
-.Ed
-.Sh DESCRIPTION
-The
-.Nm
-bridge driver allows the generic audio driver
-.Xr sound 4
-to attach to the Yamaha DS-1 sound card.
-.Sh HARDWARE
-The
-.Nm
-driver supports the following sound cards:
-.Pp
-.Bl -bullet -compact
-.It
-Yamaha DS-1
-.It
-Yamaha DS-1E
-.El
-.Sh SEE ALSO
-.Xr sound 4
-.Sh HISTORY
-The
-.Nm
-device driver first appeared in
-.Fx 4.1 .
-.Pp
-This driver will be removed in
-.Fx 14 .
-Users who require it may have better luck with the audio/oss port or package.
-.Sh AUTHORS
-.An Cameron Grant Aq Mt cg@FreeBSD.org
diff --git a/share/man/man4/snd_maestro.4 b/share/man/man4/snd_maestro.4
deleted file mode 100644
index c9c2f969bfa7..000000000000
--- a/share/man/man4/snd_maestro.4
+++ /dev/null
@@ -1,81 +0,0 @@
-.\" Copyright (c) 2004 Jorge Mario G. Mazo
-.\" 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 18, 2022
-.Dt SND_MAESTRO 4
-.Os
-.Sh NAME
-.Nm snd_maestro
-.Nd "ESS Maestro bridge device driver"
-.Sh SYNOPSIS
-To compile this driver into the kernel, place the following lines in your
-kernel configuration file:
-.Bd -ragged -offset indent
-.Cd "device sound"
-.Cd "device snd_maestro"
-.Ed
-.Pp
-Alternatively, to load the driver as a module at boot time, place the
-following line in
-.Xr loader.conf 5 :
-.Bd -literal -offset indent
-snd_maestro_load="YES"
-.Ed
-.Sh DESCRIPTION
-The
-.Nm
-bridge driver allows the generic audio driver
-.Xr sound 4
-to attach to ESS Maestro based sound chips.
-This chipset is very popular in notebook computers, but it is
-also very used in a wide selection of cheap OEM sound cards.
-.Sh HARDWARE
-The
-.Nm
-driver supports the following PCI sound cards:
-.Pp
-.Bl -bullet -compact
-.It
-ESS Technology Maestro-1
-.It
-ESS Technology Maestro-2
-.It
-ESS Technology Maestro-2E
-.El
-.Sh SEE ALSO
-.Xr snd_maestro3 4 ,
-.Xr sound 4
-.Sh HISTORY
-The
-.Nm
-device driver first appeared in
-.Fx 4.2 .
-.Pp
-This driver will be removed in
-.Fx 14 .
-.Sh AUTHORS
-This manual page was written by
-.An Jorge Mario G. Mazo Aq Mt jgutie11@eafit.edu.co .
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 5b64b212165c..178134f46ee5 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -2041,7 +2041,6 @@ device sound
# snd_cs4281: Crystal Semiconductor CS4281 PCI.
# snd_csa: Crystal Semiconductor CS461x/428x PCI. (except
# 4281)
-# snd_ds1: Yamaha DS-1 PCI.
# snd_emu10k1: Creative EMU10K1 PCI and EMU10K2 (Audigy) PCI.
# snd_emu10kx: Creative SoundBlaster Live! and Audigy
# snd_envy24: VIA Envy24 and compatible, needs snd_spicds.
@@ -2057,7 +2056,6 @@ device sound
# snd_ich: Intel ICH AC'97 and some more audio controllers
# embedded in a chipset, for example nVidia
# nForce controllers.
-# snd_maestro: ESS Technology Maestro-1/2x PCI.
# snd_maestro3: ESS Technology Maestro-3/Allegro PCI.
# snd_mss: Microsoft Sound System ISA PnP/non-PnP.
# snd_neomagic: Neomagic 256 AV/ZX PCI.
@@ -2082,7 +2080,6 @@ device snd_atiixp
device snd_cmi
device snd_cs4281
device snd_csa
-device snd_ds1
device snd_emu10k1
device snd_emu10kx
device snd_envy24
@@ -2094,7 +2091,6 @@ device snd_gusc
device snd_hda
device snd_hdspe
device snd_ich
-device snd_maestro
device snd_maestro3
device snd_mss
device snd_neomagic
diff --git a/sys/conf/files b/sys/conf/files
index e3d4e0f01b03..57bd2693f532 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -3103,7 +3103,6 @@ dev/sound/pci/cmi.c optional snd_cmi pci
dev/sound/pci/cs4281.c optional snd_cs4281 pci
dev/sound/pci/csa.c optional snd_csa pci
dev/sound/pci/csapcm.c optional snd_csa pci
-dev/sound/pci/ds1.c optional snd_ds1 pci
dev/sound/pci/emu10k1.c optional snd_emu10k1 pci
dev/sound/pci/emu10kx.c optional snd_emu10kx pci
dev/sound/pci/emu10kx-pcm.c optional snd_emu10kx pci
@@ -3113,7 +3112,6 @@ dev/sound/pci/envy24ht.c optional snd_envy24ht pci
dev/sound/pci/es137x.c optional snd_es137x pci
dev/sound/pci/fm801.c optional snd_fm801 pci
dev/sound/pci/ich.c optional snd_ich pci
-dev/sound/pci/maestro.c optional snd_maestro pci
dev/sound/pci/maestro3.c optional snd_maestro3 pci
dev/sound/pci/neomagic.c optional snd_neomagic pci
dev/sound/pci/solo.c optional snd_solo pci
diff --git a/sys/dev/sound/driver.c b/sys/dev/sound/driver.c
index 06833430edb4..fab67a4591d2 100644
--- a/sys/dev/sound/driver.c
+++ b/sys/dev/sound/driver.c
@@ -65,7 +65,6 @@ MODULE_DEPEND(snd_driver, snd_cmi, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_cs4281, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_csa, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_csapcm, 1, 1, 1);
-MODULE_DEPEND(snd_driver, snd_ds1, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_emu10kx, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_envy24, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_envy24ht, 1, 1, 1);
@@ -75,7 +74,6 @@ MODULE_DEPEND(snd_driver, snd_fm801, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_gusc, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_hda, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_ich, 1, 1, 1);
-MODULE_DEPEND(snd_driver, snd_maestro, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_maestro3, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_mss, 1, 1, 1);
MODULE_DEPEND(snd_driver, snd_neomagic, 1, 1, 1);
diff --git a/sys/dev/sound/pci/ds1.c b/sys/dev/sound/pci/ds1.c
deleted file mode 100644
index d9641b632051..000000000000
--- a/sys/dev/sound/pci/ds1.c
+++ /dev/null
@@ -1,1103 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2000 Cameron Grant <cg@freebsd.org>
- * 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, WHETHERIN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef HAVE_KERNEL_OPTION_HEADERS
-#include "opt_snd.h"
-#endif
-
-#include <dev/sound/pcm/sound.h>
-#include <dev/sound/pcm/ac97.h>
-
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-
-#include <dev/sound/pci/ds1.h>
-#include <dev/sound/pci/ds1-fw.h>
-
-SND_DECLARE_FILE("$FreeBSD$");
-
-/* -------------------------------------------------------------------- */
-
-#define DS1_CHANS 4
-#define DS1_RECPRIMARY 0
-#define DS1_IRQHZ ((48000 << 8) / 256)
-#define DS1_BUFFSIZE 4096
-
-struct pbank {
- volatile u_int32_t Format;
- volatile u_int32_t LoopDefault;
- volatile u_int32_t PgBase;
- volatile u_int32_t PgLoop;
- volatile u_int32_t PgLoopEnd;
- volatile u_int32_t PgLoopFrac;
- volatile u_int32_t PgDeltaEnd;
- volatile u_int32_t LpfKEnd;
- volatile u_int32_t EgGainEnd;
- volatile u_int32_t LchGainEnd;
- volatile u_int32_t RchGainEnd;
- volatile u_int32_t Effect1GainEnd;
- volatile u_int32_t Effect2GainEnd;
- volatile u_int32_t Effect3GainEnd;
- volatile u_int32_t LpfQ;
- volatile u_int32_t Status;
- volatile u_int32_t NumOfFrames;
- volatile u_int32_t LoopCount;
- volatile u_int32_t PgStart;
- volatile u_int32_t PgStartFrac;
- volatile u_int32_t PgDelta;
- volatile u_int32_t LpfK;
- volatile u_int32_t EgGain;
- volatile u_int32_t LchGain;
- volatile u_int32_t RchGain;
- volatile u_int32_t Effect1Gain;
- volatile u_int32_t Effect2Gain;
- volatile u_int32_t Effect3Gain;
- volatile u_int32_t LpfD1;
- volatile u_int32_t LpfD2;
-};
-
-struct rbank {
- volatile u_int32_t PgBase;
- volatile u_int32_t PgLoopEnd;
- volatile u_int32_t PgStart;
- volatile u_int32_t NumOfLoops;
-};
-
-struct sc_info;
-
-/* channel registers */
-struct sc_pchinfo {
- int run, spd, dir, fmt;
- struct snd_dbuf *buffer;
- struct pcm_channel *channel;
- volatile struct pbank *lslot, *rslot;
- int lsnum, rsnum;
- struct sc_info *parent;
-};
-
-struct sc_rchinfo {
- int run, spd, dir, fmt, num;
- struct snd_dbuf *buffer;
- struct pcm_channel *channel;
- volatile struct rbank *slot;
- struct sc_info *parent;
-};
-
-/* device private data */
-struct sc_info {
- device_t dev;
- u_int32_t type, rev;
- u_int32_t cd2id, ctrlbase;
-
- bus_space_tag_t st;
- bus_space_handle_t sh;
- bus_dma_tag_t buffer_dmat, control_dmat;
- bus_dmamap_t map;
-
- struct resource *reg, *irq;
- int regid, irqid;
- void *ih;
- struct mtx *lock;
-
- void *regbase;
- u_int32_t *pbase, pbankbase, pbanksize;
- volatile struct pbank *pbank[2 * 64];
- volatile struct rbank *rbank;
- int pslotfree, currbank, pchn, rchn;
- unsigned int bufsz;
-
- struct sc_pchinfo pch[DS1_CHANS];
- struct sc_rchinfo rch[2];
-};
-
-struct {
- u_int32_t dev, subdev;
- char *name;
- u_int32_t *mcode;
-} ds_devs[] = {
- {0x00041073, 0, "Yamaha DS-1 (YMF724)", CntrlInst},
- {0x000d1073, 0, "Yamaha DS-1E (YMF724F)", CntrlInst1E},
- {0x00051073, 0, "Yamaha DS-1? (YMF734)", CntrlInst},
- {0x00081073, 0, "Yamaha DS-1? (YMF737)", CntrlInst},
- {0x00201073, 0, "Yamaha DS-1? (YMF738)", CntrlInst},
- {0x00061073, 0, "Yamaha DS-1? (YMF738_TEG)", CntrlInst},
- {0x000a1073, 0x00041073, "Yamaha DS-1 (YMF740)", CntrlInst},
- {0x000a1073, 0x000a1073, "Yamaha DS-1 (YMF740B)", CntrlInst},
- {0x000a1073, 0x53328086, "Yamaha DS-1 (YMF740I)", CntrlInst},
- {0x000a1073, 0, "Yamaha DS-1 (YMF740?)", CntrlInst},
- {0x000c1073, 0, "Yamaha DS-1E (YMF740C)", CntrlInst1E},
- {0x00101073, 0, "Yamaha DS-1E (YMF744)", CntrlInst1E},
- {0x00121073, 0, "Yamaha DS-1E (YMF754)", CntrlInst1E},
- {0, 0, NULL, NULL}
-};
-
-/* -------------------------------------------------------------------- */
-
-/*
- * prototypes
- */
-
-/* stuff */
-static int ds_init(struct sc_info *);
-static void ds_intr(void *);
-
-/* talk to the card */
-static u_int32_t ds_rd(struct sc_info *, int, int);
-static void ds_wr(struct sc_info *, int, u_int32_t, int);
-
-/* -------------------------------------------------------------------- */
-
-static u_int32_t ds_recfmt[] = {
- SND_FORMAT(AFMT_U8, 1, 0),
- SND_FORMAT(AFMT_U8, 2, 0),
- SND_FORMAT(AFMT_S8, 1, 0),
- SND_FORMAT(AFMT_S8, 2, 0),
- SND_FORMAT(AFMT_S16_LE, 1, 0),
- SND_FORMAT(AFMT_S16_LE, 2, 0),
- SND_FORMAT(AFMT_U16_LE, 1, 0),
- SND_FORMAT(AFMT_U16_LE, 2, 0),
- 0
-};
-static struct pcmchan_caps ds_reccaps = {4000, 48000, ds_recfmt, 0};
-
-static u_int32_t ds_playfmt[] = {
- SND_FORMAT(AFMT_U8, 1, 0),
- SND_FORMAT(AFMT_U8, 2, 0),
- /* SND_FORMAT(AFMT_S16_LE, 1, 0), */
- SND_FORMAT(AFMT_S16_LE, 2, 0),
- 0
-};
-static struct pcmchan_caps ds_playcaps = {4000, 96000, ds_playfmt, 0};
-
-/* -------------------------------------------------------------------- */
-/* Hardware */
-static u_int32_t
-ds_rd(struct sc_info *sc, int regno, int size)
-{
- switch (size) {
- case 1:
- return bus_space_read_1(sc->st, sc->sh, regno);
- case 2:
- return bus_space_read_2(sc->st, sc->sh, regno);
- case 4:
- return bus_space_read_4(sc->st, sc->sh, regno);
- default:
- return 0xffffffff;
- }
-}
-
-static void
-ds_wr(struct sc_info *sc, int regno, u_int32_t data, int size)
-{
- switch (size) {
- case 1:
- bus_space_write_1(sc->st, sc->sh, regno, data);
- break;
- case 2:
- bus_space_write_2(sc->st, sc->sh, regno, data);
- break;
- case 4:
- bus_space_write_4(sc->st, sc->sh, regno, data);
- break;
- }
-}
-
-static void
-wrl(struct sc_info *sc, u_int32_t *ptr, u_int32_t val)
-{
- *(volatile u_int32_t *)ptr = val;
- bus_space_barrier(sc->st, sc->sh, 0, 0, BUS_SPACE_BARRIER_WRITE);
-}
-
-/* -------------------------------------------------------------------- */
-/* ac97 codec */
-static int
-ds_cdbusy(struct sc_info *sc, int sec)
-{
- int i, reg;
-
- reg = sec? YDSXGR_SECSTATUSADR : YDSXGR_PRISTATUSADR;
- i = YDSXG_AC97TIMEOUT;
- while (i > 0) {
- if (!(ds_rd(sc, reg, 2) & 0x8000))
- return 0;
- i--;
- }
- return ETIMEDOUT;
-}
-
-static u_int32_t
-ds_initcd(kobj_t obj, void *devinfo)
-{
- struct sc_info *sc = (struct sc_info *)devinfo;
- u_int32_t x;
-
- x = pci_read_config(sc->dev, PCIR_DSXGCTRL, 1);
- if (x & 0x03) {
- pci_write_config(sc->dev, PCIR_DSXGCTRL, x & ~0x03, 1);
- pci_write_config(sc->dev, PCIR_DSXGCTRL, x | 0x03, 1);
- pci_write_config(sc->dev, PCIR_DSXGCTRL, x & ~0x03, 1);
- /*
- * The YMF740 on some Intel motherboards requires a pretty
- * hefty delay after this reset for some reason... Otherwise:
- * "pcm0: ac97 codec init failed"
- * Maybe this is needed for all YMF740's?
- * 400ms and 500ms here seem to work, 300ms does not.
- *
- * do it for all chips -cg
- */
- DELAY(500000);
- }
-
- return ds_cdbusy(sc, 0)? 0 : 1;
-}
-
-static int
-ds_rdcd(kobj_t obj, void *devinfo, int regno)
-{
- struct sc_info *sc = (struct sc_info *)devinfo;
- int sec, cid, i;
- u_int32_t cmd, reg;
-
- sec = regno & 0x100;
- regno &= 0xff;
- cid = sec? (sc->cd2id << 8) : 0;
- reg = sec? YDSXGR_SECSTATUSDATA : YDSXGR_PRISTATUSDATA;
- if (sec && cid == 0)
- return 0xffffffff;
-
- cmd = YDSXG_AC97READCMD | cid | regno;
- ds_wr(sc, YDSXGR_AC97CMDADR, cmd, 2);
-
- if (ds_cdbusy(sc, sec))
- return 0xffffffff;
-
- if (sc->type == 11 && sc->rev < 2)
- for (i = 0; i < 600; i++)
- ds_rd(sc, reg, 2);
-
- return ds_rd(sc, reg, 2);
-}
-
-static int
-ds_wrcd(kobj_t obj, void *devinfo, int regno, u_int32_t data)
-{
- struct sc_info *sc = (struct sc_info *)devinfo;
- int sec, cid;
- u_int32_t cmd;
-
- sec = regno & 0x100;
- regno &= 0xff;
- cid = sec? (sc->cd2id << 8) : 0;
- if (sec && cid == 0)
- return ENXIO;
-
- cmd = YDSXG_AC97WRITECMD | cid | regno;
- cmd <<= 16;
- cmd |= data;
- ds_wr(sc, YDSXGR_AC97CMDDATA, cmd, 4);
-
- return ds_cdbusy(sc, sec);
-}
-
-static kobj_method_t ds_ac97_methods[] = {
- KOBJMETHOD(ac97_init, ds_initcd),
- KOBJMETHOD(ac97_read, ds_rdcd),
- KOBJMETHOD(ac97_write, ds_wrcd),
- KOBJMETHOD_END
-};
-AC97_DECLARE(ds_ac97);
-
-/* -------------------------------------------------------------------- */
-
-static void
-ds_enadsp(struct sc_info *sc, int on)
-{
- u_int32_t v, i;
-
- v = on? 1 : 0;
- if (on) {
- ds_wr(sc, YDSXGR_CONFIG, 0x00000001, 4);
- } else {
- if (ds_rd(sc, YDSXGR_CONFIG, 4))
- ds_wr(sc, YDSXGR_CONFIG, 0x00000000, 4);
- i = YDSXG_WORKBITTIMEOUT;
- while (i > 0) {
- if (!(ds_rd(sc, YDSXGR_CONFIG, 4) & 0x00000002))
- break;
- i--;
- }
- }
-}
-
-static volatile struct pbank *
-ds_allocpslot(struct sc_info *sc)
-{
- int slot;
-
- if (sc->pslotfree > 63)
- return NULL;
- slot = sc->pslotfree++;
- return sc->pbank[slot * 2];
-}
-
-static int
-ds_initpbank(volatile struct pbank *pb, int ch, int stereo, int b16, u_int32_t rate, bus_addr_t base, u_int32_t len)
-{
- u_int32_t lv[] = {1, 1, 0, 0, 0};
- u_int32_t rv[] = {1, 0, 1, 0, 0};
- u_int32_t e1[] = {0, 0, 0, 0, 0};
- u_int32_t e2[] = {1, 0, 0, 1, 0};
- u_int32_t e3[] = {1, 0, 0, 0, 1};
- int ss, i;
- u_int32_t delta;
-
- struct {
- int rate, fK, fQ;
- } speedinfo[] = {
- { 100, 0x00570000, 0x35280000},
- { 2000, 0x06aa0000, 0x34a70000},
- { 8000, 0x18b20000, 0x32020000},
- {11025, 0x20930000, 0x31770000},
- {16000, 0x2b9a0000, 0x31390000},
- {22050, 0x35a10000, 0x31c90000},
- {32000, 0x3eaa0000, 0x33d00000},
-/* {44100, 0x04646000, 0x370a0000},
-*/ {48000, 0x40000000, 0x40000000},
- };
-
- ss = b16? 1 : 0;
- ss += stereo? 1 : 0;
- delta = (65536 * rate) / 48000;
- i = 0;
- while (i < 7 && speedinfo[i].rate < rate)
- i++;
-
- pb->Format = stereo? 0x00010000 : 0;
- pb->Format |= b16? 0 : 0x80000000;
- pb->Format |= (stereo && (ch == 2 || ch == 4))? 0x00000001 : 0;
- pb->LoopDefault = 0;
- pb->PgBase = base;
- pb->PgLoop = 0;
- pb->PgLoopEnd = len >> ss;
- pb->PgLoopFrac = 0;
- pb->Status = 0;
- pb->NumOfFrames = 0;
- pb->LoopCount = 0;
- pb->PgStart = 0;
- pb->PgStartFrac = 0;
- pb->PgDelta = pb->PgDeltaEnd = delta << 12;
- pb->LpfQ = speedinfo[i].fQ;
- pb->LpfK = pb->LpfKEnd = speedinfo[i].fK;
- pb->LpfD1 = pb->LpfD2 = 0;
- pb->EgGain = pb->EgGainEnd = 0x40000000;
- pb->LchGain = pb->LchGainEnd = lv[ch] * 0x40000000;
- pb->RchGain = pb->RchGainEnd = rv[ch] * 0x40000000;
- pb->Effect1Gain = pb->Effect1GainEnd = e1[ch] * 0x40000000;
- pb->Effect2Gain = pb->Effect2GainEnd = e2[ch] * 0x40000000;
- pb->Effect3Gain = pb->Effect3GainEnd = e3[ch] * 0x40000000;
-
- return 0;
-}
-
-static void
-ds_enapslot(struct sc_info *sc, int slot, int go)
-{
- wrl(sc, &sc->pbase[slot + 1], go? (sc->pbankbase + 2 * slot * sc->pbanksize) : 0);
- /* printf("pbase[%d] = 0x%x\n", slot + 1, go? (sc->pbankbase + 2 * slot * sc->pbanksize) : 0); */
-}
-
-static void
-ds_setuppch(struct sc_pchinfo *ch)
-{
- int stereo, b16, c, sz;
- bus_addr_t addr;
-
- stereo = (AFMT_CHANNEL(ch->fmt) > 1)? 1 : 0;
- b16 = (ch->fmt & AFMT_16BIT)? 1 : 0;
- c = stereo? 1 : 0;
- addr = sndbuf_getbufaddr(ch->buffer);
- sz = sndbuf_getsize(ch->buffer);
-
- ds_initpbank(ch->lslot, c, stereo, b16, ch->spd, addr, sz);
- ds_initpbank(ch->lslot + 1, c, stereo, b16, ch->spd, addr, sz);
- ds_initpbank(ch->rslot, 2, stereo, b16, ch->spd, addr, sz);
- ds_initpbank(ch->rslot + 1, 2, stereo, b16, ch->spd, addr, sz);
-}
-
-static void
-ds_setuprch(struct sc_rchinfo *ch)
-{
- struct sc_info *sc = ch->parent;
- int stereo, b16, i, sz, pri;
- u_int32_t x, y;
- bus_addr_t addr;
-
- stereo = (AFMT_CHANNEL(ch->fmt) > 1)? 1 : 0;
- b16 = (ch->fmt & AFMT_16BIT)? 1 : 0;
- addr = sndbuf_getbufaddr(ch->buffer);
- sz = sndbuf_getsize(ch->buffer);
- pri = (ch->num == DS1_RECPRIMARY)? 1 : 0;
-
- for (i = 0; i < 2; i++) {
- ch->slot[i].PgBase = addr;
- ch->slot[i].PgLoopEnd = sz;
- ch->slot[i].PgStart = 0;
- ch->slot[i].NumOfLoops = 0;
- }
- x = (b16? 0x00 : 0x01) | (stereo? 0x02 : 0x00);
- y = (48000 * 4096) / ch->spd;
- y--;
- /* printf("pri = %d, x = %d, y = %d\n", pri, x, y); */
- ds_wr(sc, pri? YDSXGR_ADCFORMAT : YDSXGR_RECFORMAT, x, 4);
- ds_wr(sc, pri? YDSXGR_ADCSLOTSR : YDSXGR_RECSLOTSR, y, 4);
-}
-
-/* -------------------------------------------------------------------- */
-/* play channel interface */
-static void *
-ds1pchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
-{
- struct sc_info *sc = devinfo;
- struct sc_pchinfo *ch;
-
- KASSERT(dir == PCMDIR_PLAY, ("ds1pchan_init: bad direction"));
-
- ch = &sc->pch[sc->pchn++];
- ch->buffer = b;
- ch->parent = sc;
- ch->channel = c;
- ch->dir = dir;
- ch->fmt = SND_FORMAT(AFMT_U8, 1, 0);
- ch->spd = 8000;
- ch->run = 0;
- if (sndbuf_alloc(ch->buffer, sc->buffer_dmat, 0, sc->bufsz) != 0)
- return NULL;
- else {
- ch->lsnum = sc->pslotfree;
- ch->lslot = ds_allocpslot(sc);
- ch->rsnum = sc->pslotfree;
- ch->rslot = ds_allocpslot(sc);
- ds_setuppch(ch);
- return ch;
- }
-}
-
-static int
-ds1pchan_setformat(kobj_t obj, void *data, u_int32_t format)
-{
- struct sc_pchinfo *ch = data;
-
- ch->fmt = format;
-
- return 0;
-}
-
-static u_int32_t
-ds1pchan_setspeed(kobj_t obj, void *data, u_int32_t speed)
-{
- struct sc_pchinfo *ch = data;
-
- ch->spd = speed;
-
- return speed;
-}
-
-static u_int32_t
-ds1pchan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
-{
- struct sc_pchinfo *ch = data;
- struct sc_info *sc = ch->parent;
- int drate;
-
- /* irq rate is fixed at 187.5hz */
- drate = ch->spd * sndbuf_getalign(ch->buffer);
- blocksize = roundup2((drate << 8) / DS1_IRQHZ, 4);
- sndbuf_resize(ch->buffer, sc->bufsz / blocksize, blocksize);
-
- return blocksize;
-}
-
-/* semantic note: must start at beginning of buffer */
-static int
-ds1pchan_trigger(kobj_t obj, void *data, int go)
-{
- struct sc_pchinfo *ch = data;
- struct sc_info *sc = ch->parent;
- int stereo;
-
- if (!PCMTRIG_COMMON(go))
- return 0;
- stereo = (AFMT_CHANNEL(ch->fmt) > 1)? 1 : 0;
- if (go == PCMTRIG_START) {
- ch->run = 1;
- ds_setuppch(ch);
- ds_enapslot(sc, ch->lsnum, 1);
- ds_enapslot(sc, ch->rsnum, stereo);
- snd_mtxlock(sc->lock);
- ds_wr(sc, YDSXGR_MODE, 0x00000003, 4);
- snd_mtxunlock(sc->lock);
- } else {
- ch->run = 0;
- /* ds_setuppch(ch); */
- ds_enapslot(sc, ch->lsnum, 0);
- ds_enapslot(sc, ch->rsnum, 0);
- }
-
- return 0;
-}
-
-static u_int32_t
-ds1pchan_getptr(kobj_t obj, void *data)
-{
- struct sc_pchinfo *ch = data;
- struct sc_info *sc = ch->parent;
- volatile struct pbank *bank;
- int ss;
- u_int32_t ptr;
-
- ss = (AFMT_CHANNEL(ch->fmt) > 1)? 1 : 0;
- ss += (ch->fmt & AFMT_16BIT)? 1 : 0;
-
- bank = ch->lslot + sc->currbank;
- /* printf("getptr: %d\n", bank->PgStart << ss); */
- ptr = bank->PgStart;
- ptr <<= ss;
- return ptr;
-}
-
-static struct pcmchan_caps *
-ds1pchan_getcaps(kobj_t obj, void *data)
-{
- return &ds_playcaps;
-}
-
-static kobj_method_t ds1pchan_methods[] = {
- KOBJMETHOD(channel_init, ds1pchan_init),
- KOBJMETHOD(channel_setformat, ds1pchan_setformat),
- KOBJMETHOD(channel_setspeed, ds1pchan_setspeed),
- KOBJMETHOD(channel_setblocksize, ds1pchan_setblocksize),
- KOBJMETHOD(channel_trigger, ds1pchan_trigger),
- KOBJMETHOD(channel_getptr, ds1pchan_getptr),
- KOBJMETHOD(channel_getcaps, ds1pchan_getcaps),
- KOBJMETHOD_END
-};
-CHANNEL_DECLARE(ds1pchan);
-
-/* -------------------------------------------------------------------- */
-/* record channel interface */
-static void *
-ds1rchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
-{
- struct sc_info *sc = devinfo;
- struct sc_rchinfo *ch;
-
- KASSERT(dir == PCMDIR_REC, ("ds1rchan_init: bad direction"));
-
- ch = &sc->rch[sc->rchn];
- ch->num = sc->rchn++;
- ch->buffer = b;
- ch->parent = sc;
*** 3119 LINES SKIPPED ***