diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2015-06-25 20:05:12 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2015-06-25 20:05:12 +0000 |
commit | 859c35ac9f58a3d4ab5ae9d64db6e1dced61dcc9 (patch) | |
tree | 454052031dfda61555972393640994eae48a6692 /sys/dev/isa | |
parent | 3ce1fe06a687eaa98d138be292758318142c9f97 (diff) |
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')
-rw-r--r-- | sys/dev/isa/gus.c | 51 | ||||
-rw-r--r-- | sys/dev/isa/gusvar.h | 6 |
2 files changed, 44 insertions, 13 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. diff --git a/sys/dev/isa/gusvar.h b/sys/dev/isa/gusvar.h index 3dc11ebd0f3..eb28efac411 100644 --- a/sys/dev/isa/gusvar.h +++ b/sys/dev/isa/gusvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: gusvar.h,v 1.7 2008/11/21 16:06:36 robert Exp $ */ +/* $OpenBSD: gusvar.h,v 1.8 2015/06/25 20:05:11 ratchov Exp $ */ /* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */ /*- @@ -370,6 +370,10 @@ int gusmax_mixer_get_port(void *, mixer_ctrl_t *); int gus_mixer_query_devinfo(void *, mixer_devinfo_t *); int gusmax_mixer_query_devinfo(void *, mixer_devinfo_t *); int gus_query_encoding(void *, struct audio_encoding *); +void *gus_malloc(void *, int, size_t, int, int); +void gus_free(void *, void *, int); +size_t gus_round(void *, int, size_t); +paddr_t gus_mappage(void *, void *, off_t, int); int gus_get_props(void *); int gusmax_get_props(void *); |