summaryrefslogtreecommitdiffstats
path: root/sys/dev/isa/gus.c
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2015-06-25 20:05:11 +0000
committerratchov <ratchov@openbsd.org>2015-06-25 20:05:11 +0000
commit64a4b7dc6be63a481d6a41a1c4714991a3e6cadf (patch)
tree8be696db390ce060bd6eb1bb925ce27497f9c625 /sys/dev/isa/gus.c
parentAlign the three variants of Remote.pm. (diff)
downloadwireguard-openbsd-64a4b7dc6be63a481d6a41a1c4714991a3e6cadf.tar.xz
wireguard-openbsd-64a4b7dc6be63a481d6a41a1c4714991a3e6cadf.zip
Cards with revision < 10 (qemu rev is 0), have no ad1848 chip and
don't attach the ad1848 driver. But the "malloc" method of gus_hw_if is ad1848_malloc() which assumes a ad1848 is attached (and expect the softc pointer to be a struct ad1848_softc, but get a gus_softc pointer instead). Implement, the missing gus_{malloc,free,mappage,...} routines. Add the missing mtx_{enter,leave} calls, as we're at it. Found by mlarkin. ok mlarkin
Diffstat (limited to 'sys/dev/isa/gus.c')
-rw-r--r--sys/dev/isa/gus.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/sys/dev/isa/gus.c b/sys/dev/isa/gus.c
index cc16c8ca3b1..70881f89edc 100644
--- a/sys/dev/isa/gus.c
+++ b/sys/dev/isa/gus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gus.c,v 1.42 2015/05/11 06:46:21 ratchov Exp $ */
+/* $OpenBSD: gus.c,v 1.43 2015/06/25 20:05:11 ratchov Exp $ */
/* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
/*-
@@ -287,10 +287,10 @@ struct audio_hw_if gus_hw_if = {
gus_mixer_set_port,
gus_mixer_get_port,
gus_mixer_query_devinfo,
- ad1848_malloc,
- ad1848_free,
- ad1848_round,
- ad1848_mappage,
+ gus_malloc,
+ gus_free,
+ gus_round,
+ gus_mappage,
gus_get_props,
NULL,
@@ -510,11 +510,9 @@ gus_dma_output(void *addr, void *buf, int size, void (*intr)(void *), void *arg)
int flags;
DMAPRINTF(("gus_dma_output %d @ %p\n", size, buf));
- mtx_enter(&audio_lock);
if (size != sc->sc_blocksize) {
DPRINTF(("gus_dma_output reqsize %d not sc_blocksize %d\n",
size, sc->sc_blocksize));
- mtx_leave(&audio_lock);
return EINVAL;
}
@@ -538,7 +536,6 @@ gus_dma_output(void *addr, void *buf, int size, void (*intr)(void *), void *arg)
size &= 1;
}
if (size == 0) {
- mtx_leave(&audio_lock);
return 0;
}
@@ -579,7 +576,6 @@ gus_dma_output(void *addr, void *buf, int size, void (*intr)(void *), void *arg)
#endif
gusdmaout(sc, flags, boarddma, (caddr_t) buffer, size);
- mtx_leave(&audio_lock);
return 0;
}
@@ -2179,12 +2175,10 @@ gus_dma_input(void *addr, void *buf, int size, void (*callback)(void *),
u_char dmac;
DMAPRINTF(("gus_dma_input called\n"));
- mtx_enter(&audio_lock);
/*
* Sample SIZE bytes of data from the card, into buffer at BUF.
*/
if (sc->sc_precision == 16) {
- mtx_leave(&audio_lock);
return EINVAL; /* XXX */
}
@@ -2214,7 +2208,6 @@ gus_dma_input(void *addr, void *buf, int size, void (*callback)(void *),
DMAPRINTF(("gus_dma_input returning\n"));
- mtx_leave(&audio_lock);
return 0;
}
@@ -3160,6 +3153,40 @@ gus_query_encoding(void *addr, struct audio_encoding *fp)
return (0);
}
+void *
+gus_malloc(void *addr, int direction, size_t size, int pool, int flags)
+{
+ struct gus_softc *sc = addr;
+ int drq;
+
+ if (direction == AUMODE_PLAY)
+ drq = sc->sc_drq;
+ else
+ drq = sc->sc_recdrq;
+
+ return isa_malloc(sc->sc_isa, drq, size, pool, flags);
+}
+
+void
+gus_free(void *addr, void *ptr, int pool)
+{
+ isa_free(ptr, pool);
+}
+
+size_t
+gus_round(void *addr, int direction, size_t size)
+{
+ if (size > MAX_ISADMA)
+ size = MAX_ISADMA;
+ return size;
+}
+
+paddr_t
+gus_mappage(void *addr, void *mem, off_t off, int prot)
+{
+ return isa_mappage(mem, off, prot);
+}
+
/*
* Setup the ICS mixer in "transparent" mode: reset everything to a sensible
* level. Levels as suggested by GUS SDK code.