summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2000-05-19 15:41:52 +0000
committernyan <nyan@FreeBSD.org>2000-05-19 15:41:52 +0000
commit61405e3c6a0ec399d3c1d7e9d9361876599a7d7c (patch)
treec35009e393b73016767dc7acce0c89fe29881542
parent6ac8bb3941e2a536b2fa4041df0691071f7c04f7 (diff)
downloadFreeBSD-src-61405e3c6a0ec399d3c1d7e9d9361876599a7d7c.zip
FreeBSD-src-61405e3c6a0ec399d3c1d7e9d9361876599a7d7c.tar.gz
Supported the mss on PC-98 and Sound Blaster 98.
Submitted by: "T.Yamaoka" <taka@windows.squares.net>
-rw-r--r--sys/dev/sound/isa/mss.c15
-rw-r--r--sys/dev/sound/isa/mss.h8
-rw-r--r--sys/dev/sound/isa/sbc.c60
-rw-r--r--sys/dev/sound/pci/neomagic.c2
-rw-r--r--sys/dev/sound/pcm/sound.h2
-rw-r--r--sys/pc98/conf/GENERIC9
6 files changed, 93 insertions, 3 deletions
diff --git a/sys/dev/sound/isa/mss.c b/sys/dev/sound/isa/mss.c
index b076833..3094b9e 100644
--- a/sys/dev/sound/isa/mss.c
+++ b/sys/dev/sound/isa/mss.c
@@ -550,7 +550,11 @@ mss_probe(device_t dev)
rman_get_start(mss->io_base), tmpx));
goto no;
}
+#ifdef PC98
+ if (irq > 12) {
+#else
if (irq > 11) {
+#endif
printf("MSS: Bad IRQ %d\n", irq);
goto no;
}
@@ -835,6 +839,10 @@ ymf_test(device_t dev, struct mss_info *mss)
if (!j) {
bus_release_resource(dev, SYS_RES_IOPORT,
mss->conf_rid, mss->conf_base);
+#ifdef PC98
+ /* PC98 need this. I don't know reason why. */
+ bus_delete_resource(dev, SYS_RES_IOPORT, mss->conf_rid);
+#endif
mss->conf_base = 0;
continue;
}
@@ -856,16 +864,23 @@ mss_doattach(device_t dev, struct mss_info *mss)
mss_init(mss, dev);
if (flags & DV_F_TRUE_MSS) {
/* has IRQ/DMA registers, set IRQ and DMA addr */
+#ifdef PC98 /* CS423[12] in PC98 can use IRQ3,5,10,12 */
+ static char interrupt_bits[13] =
+ {-1, -1, -1, 0x08, -1, 0x10, -1, -1, -1, -1, 0x18, -1, 0x20};
+#else
static char interrupt_bits[12] =
{-1, -1, -1, -1, -1, 0x28, -1, 0x08, -1, 0x10, 0x18, 0x20};
+#endif
static char pdma_bits[4] = {1, 2, -1, 3};
static char valid_rdma[4] = {1, 0, -1, 0};
char bits;
if (!mss->irq || (bits = interrupt_bits[rman_get_start(mss->irq)]) == -1)
goto no;
+#ifndef PC98 /* CS423[12] in PC98 don't support this. */
io_wr(mss, 0, bits | 0x40); /* config port */
if ((io_rd(mss, 3) & 0x40) == 0) device_printf(dev, "IRQ Conflict?\n");
+#endif
/* Write IRQ+DMA setup */
if (pdma_bits[mss->pdma] == -1) goto no;
bits |= pdma_bits[mss->pdma];
diff --git a/sys/dev/sound/isa/mss.h b/sys/dev/sound/isa/mss.h
index a0a35bb..2491dbd 100644
--- a/sys/dev/sound/isa/mss.h
+++ b/sys/dev/sound/isa/mss.h
@@ -172,12 +172,20 @@ mixer_ent mix_devices[32][2] = {
MIX_NONE(SOUND_MIXER_VOLUME),
MIX_NONE(SOUND_MIXER_BASS),
MIX_NONE(SOUND_MIXER_TREBLE),
+#ifdef PC98 /* PC98's synth is assigned to AUX#2 */
+MIX_ENT(SOUND_MIXER_SYNTH, 4, 1, 0, 5, 5, 1, 0, 5),
+#else /* AT386's synth is assigned to AUX#1 */
MIX_ENT(SOUND_MIXER_SYNTH, 2, 1, 0, 5, 3, 1, 0, 5),
+#endif
MIX_ENT(SOUND_MIXER_PCM, 6, 1, 0, 6, 7, 1, 0, 6),
MIX_ENT(SOUND_MIXER_SPEAKER, 26, 1, 0, 4, 0, 0, 0, 0),
MIX_ENT(SOUND_MIXER_LINE, 18, 1, 0, 5, 19, 1, 0, 5),
MIX_ENT(SOUND_MIXER_MIC, 0, 0, 5, 1, 1, 0, 5, 1),
+#ifdef PC98 /* PC98's cd-audio is assigned to AUX#1 */
+MIX_ENT(SOUND_MIXER_CD, 2, 1, 0, 5, 3, 1, 0, 5),
+#else /* AT386's cd-audio is assigned to AUX#2 */
MIX_ENT(SOUND_MIXER_CD, 4, 1, 0, 5, 5, 1, 0, 5),
+#endif
MIX_ENT(SOUND_MIXER_IMIX, 13, 1, 2, 6, 0, 0, 0, 0),
MIX_NONE(SOUND_MIXER_ALTPCM),
MIX_NONE(SOUND_MIXER_RECLEV),
diff --git a/sys/dev/sound/isa/sbc.c b/sys/dev/sound/isa/sbc.c
index 5170e81..d21a898 100644
--- a/sys/dev/sound/isa/sbc.c
+++ b/sys/dev/sound/isa/sbc.c
@@ -86,6 +86,20 @@ static devclass_t sbc_devclass;
static int io_range[3] = {0x10, 0x2, 0x4};
+#ifdef PC98 /* I/O address table for PC98 */
+static bus_addr_t pcm_iat[] = {
+ 0x000, 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700,
+ 0x800, 0x900, 0xa00, 0xb00, 0xc00, 0xd00, 0xe00, 0xf00
+};
+static bus_addr_t midi_iat[] = {
+ 0x000, 0x100
+};
+static bus_addr_t opl_iat[] = {
+ 0x000, 0x100, 0x200, 0x300
+};
+static bus_addr_t *sb_iat[] = { pcm_iat, midi_iat, opl_iat };
+#endif
+
static int sb_rd(struct resource *io, int reg);
static void sb_wr(struct resource *io, int reg, u_int8_t val);
static int sb_dspready(struct resource *io);
@@ -234,9 +248,17 @@ sbc_probe(device_t dev)
int rid = 0, ver;
struct resource *io;
+#ifdef PC98
+ io = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid,
+ pcm_iat, 16, RF_ACTIVE);
+#else
io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0, ~0, 16, RF_ACTIVE);
+#endif
if (!io) goto bad;
+#ifdef PC98
+ isa_load_resourcev(io, pcm_iat, 16);
+#endif
if (sb_reset_dsp(io)) goto bad2;
ver = sb_identify_board(io);
if (ver == 0) goto bad2;
@@ -324,6 +346,20 @@ sbc_attach(device_t dev)
/* soft irq/dma configuration */
x = -1;
irq = rman_get_start(scp->irq[0]);
+#ifdef PC98
+ /* SB16 in PC98 use different IRQ table */
+ if (irq == 3) x = 1;
+ else if (irq == 5) x = 8;
+ else if (irq == 10) x = 2;
+ else if (irq == 12) x = 4;
+ if (x == -1) {
+ err = "bad irq (3/5/10/12 valid)";
+ goto bad;
+ }
+ else sb_setmixer(scp->io[0], IRQ_NR, x);
+ /* SB16 in PC98 use different dma setting */
+ sb_setmixer(scp->io[0], DMA_NR, dh == 0 ? 1 : 2);
+#else
if (irq == 5) x = 2;
else if (irq == 7) x = 4;
else if (irq == 9) x = 1;
@@ -334,6 +370,7 @@ sbc_attach(device_t dev)
}
else sb_setmixer(scp->io[0], IRQ_NR, x);
sb_setmixer(scp->io[0], DMA_NR, (1 << dh) | (1 << dl));
+#endif
device_printf(dev, "setting card to irq %d, drq %d", irq, dl);
if (dl != dh) printf(", %d", dh);
printf("\n");
@@ -463,13 +500,22 @@ sbc_alloc_resource(device_t bus, device_t child, int type, int *rid,
struct sbc_softc *scp;
int *alloced, rid_max, alloced_max;
struct resource **res;
+#ifdef PC98
+ int i;
+#endif
scp = device_get_softc(bus);
switch (type) {
case SYS_RES_IOPORT:
alloced = scp->io_alloced;
res = scp->io;
+#ifdef PC98
+ rid_max = 0;
+ for (i = 0; i < IO_MAX; i++)
+ rid_max += io_range[i];
+#else
rid_max = IO_MAX - 1;
+#endif
alloced_max = 1;
break;
case SYS_RES_DRQ:
@@ -570,9 +616,23 @@ alloc_resource(struct sbc_softc *scp)
for (i = 0 ; i < IO_MAX ; i++) {
if (scp->io[i] == NULL) {
+#ifdef PC98
+ scp->io_rid[i] = i > 0 ?
+ scp->io_rid[i - 1] + io_range[i - 1] : 0;
+ scp->io[i] = isa_alloc_resourcev(scp->dev,
+ SYS_RES_IOPORT,
+ &scp->io_rid[i],
+ sb_iat[i],
+ io_range[i],
+ RF_ACTIVE);
+ if (scp->io[i] != NULL)
+ isa_load_resourcev(scp->io[i], sb_iat[i],
+ io_range[i]);
+#else
scp->io_rid[i] = i;
scp->io[i] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[i],
0, ~0, io_range[i], RF_ACTIVE);
+#endif
if (i == 0 && scp->io[i] == NULL)
return (1);
scp->io_alloced[i] = 0;
diff --git a/sys/dev/sound/pci/neomagic.c b/sys/dev/sound/pci/neomagic.c
index 8c43d6b..622d9d7 100644
--- a/sys/dev/sound/pci/neomagic.c
+++ b/sys/dev/sound/pci/neomagic.c
@@ -349,7 +349,7 @@ nmchan_init(void *devinfo, snd_dbuf *b, pcm_channel *c, int dir)
ch = (dir == PCMDIR_PLAY)? &sc->pch : &sc->rch;
ch->buffer = b;
ch->buffer->bufsize = NM_BUFFSIZE;
- ch->buffer->buf = (u_int8_t *)(rman_get_bushandle(sc->buf) + chnbuf);
+ ch->buffer->buf = (u_int8_t *)(rman_get_start(sc->buf) + chnbuf);
if (bootverbose)
device_printf(sc->dev, "%s buf %p\n", (dir == PCMDIR_PLAY)?
"play" : "rec", ch->buffer->buf);
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
index 9520c29..9a32f2b 100644
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -59,8 +59,6 @@
#include <sys/buf.h>
#include <machine/clock.h> /* for DELAY */
#include <machine/resource.h>
-#include <machine/bus_memio.h>
-#include <machine/bus_pio.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <sys/mman.h>
diff --git a/sys/pc98/conf/GENERIC b/sys/pc98/conf/GENERIC
index bdf1e9a..ccd610a 100644
--- a/sys/pc98/conf/GENERIC
+++ b/sys/pc98/conf/GENERIC
@@ -287,6 +287,15 @@ device sn
#device joy0 at isa? port 0x04d2
+# The newpcm driver (use INSTEAD of snd0 and all VOXWARE drivers!).
+#
+# Windows Sound System
+#device pcm0 at isa? port 0xf40 irq 12 drq 1 flags 0x10000
+#
+# Sound Blaster 16 (This device need the bridge driver.)
+#device pcm
+#device sbc0 at isa? port 0x20d2 irq 10 drq 3
+
# Pseudo devices - the number indicates how many units to allocated.
pseudo-device loop # Network loopback
pseudo-device ether # Ethernet support
OpenPOWER on IntegriCloud