summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/audio.c30
-rw-r--r--sys/dev/audio_if.h11
-rw-r--r--sys/dev/pci/eso.c46
-rw-r--r--sys/dev/pci/neo.c47
4 files changed, 70 insertions, 64 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index b8c47d0fe95..94bc734083b 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio.c,v 1.22 2000/05/24 13:44:17 ho Exp $ */
+/* $OpenBSD: audio.c,v 1.23 2000/07/19 09:04:37 csapuntz Exp $ */
/* $NetBSD: audio.c,v 1.105 1998/09/27 16:43:56 christos Exp $ */
/*
@@ -142,7 +142,7 @@ int audio_drain __P((struct audio_softc *));
void audio_clear __P((struct audio_softc *));
static __inline void audio_pint_silence __P((struct audio_softc *, struct audio_ringbuffer *, u_char *, int));
-int audio_alloc_ring __P((struct audio_softc *, struct audio_ringbuffer *, int));
+int audio_alloc_ring __P((struct audio_softc *, struct audio_ringbuffer *, int, int));
void audio_free_ring __P((struct audio_softc *, struct audio_ringbuffer *));
int audioprint __P((void *, const char *));
@@ -260,13 +260,13 @@ audioattach(parent, self, aux)
sc->hw_hdl = hdlp;
sc->sc_dev = parent;
- error = audio_alloc_ring(sc, &sc->sc_pr, AU_RING_SIZE);
+ error = audio_alloc_ring(sc, &sc->sc_pr, AUMODE_PLAY, AU_RING_SIZE);
if (error) {
sc->hw_if = 0;
printf("audio: could not allocate play buffer\n");
return;
}
- error = audio_alloc_ring(sc, &sc->sc_rr, AU_RING_SIZE);
+ error = audio_alloc_ring(sc, &sc->sc_rr, AUMODE_RECORD, AU_RING_SIZE);
if (error) {
audio_free_ring(sc, &sc->sc_pr);
sc->hw_if = 0;
@@ -311,6 +311,8 @@ audioattach(parent, self, aux)
for(mi.index = 0; ; mi.index++) {
if (hwp->query_devinfo(hdlp, &mi) != 0)
break;
+ if (mi.type == AUDIO_MIXER_CLASS)
+ continue;
au_check_ports(sc, &sc->sc_inports, &mi, iclass,
AudioNsource, AudioNrecord, itable);
au_check_ports(sc, &sc->sc_outports, &mi, oclass,
@@ -534,9 +536,10 @@ audio_print_params(s, p)
#endif
int
-audio_alloc_ring(sc, r, bufsize)
+audio_alloc_ring(sc, r, direction, bufsize)
struct audio_softc *sc;
struct audio_ringbuffer *r;
+ int direction;
int bufsize;
{
struct audio_hw_if *hw = sc->hw_if;
@@ -544,16 +547,21 @@ audio_alloc_ring(sc, r, bufsize)
/*
* Alloc DMA play and record buffers
*/
- ROUNDSIZE(bufsize);
if (bufsize < AUMINBUF)
bufsize = AUMINBUF;
+ ROUNDSIZE(bufsize);
if (hw->round_buffersize)
- bufsize = hw->round_buffersize(hdl, bufsize);
+ bufsize = hw->round_buffersize(hdl, direction, bufsize);
+ else if (hw->round_buffersize_old)
+ bufsize = hw->round_buffersize_old(hdl, bufsize);
r->bufsize = bufsize;
if (hw->allocm)
- r->start = hw->allocm(hdl, r->bufsize, M_DEVBUF, M_WAITOK);
+ r->start = hw->allocm(hdl, direction, r->bufsize, M_DEVBUF,
+ M_WAITOK);
+ else if (hw->allocm_old)
+ r->start = hw->allocm_old(hdl, r->bufsize, M_DEVBUF, M_WAITOK);
else
- r->start = malloc(bufsize, M_DEVBUF, M_WAITOK);
+ r->start = malloc(bufsize, M_DEVBUF, M_WAITOK);
if (r->start == 0)
return ENOMEM;
return 0;
@@ -565,9 +573,9 @@ audio_free_ring(sc, r)
struct audio_ringbuffer *r;
{
if (sc->hw_if->freem) {
- sc->hw_if->freem(sc->hw_hdl, r->start, M_DEVBUF);
+ sc->hw_if->freem(sc->hw_hdl, r->start, M_DEVBUF);
} else {
- free(r->start, M_DEVBUF);
+ free(r->start, M_DEVBUF);
}
}
diff --git a/sys/dev/audio_if.h b/sys/dev/audio_if.h
index ba2d5cef311..6c5bb994862 100644
--- a/sys/dev/audio_if.h
+++ b/sys/dev/audio_if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio_if.h,v 1.10 2000/05/24 13:44:17 ho Exp $ */
+/* $OpenBSD: audio_if.h,v 1.11 2000/07/19 09:04:37 csapuntz Exp $ */
/* $NetBSD: audio_if.h,v 1.24 1998/01/10 14:07:25 tv Exp $ */
/*
@@ -112,9 +112,11 @@ struct audio_hw_if {
int (*query_devinfo)__P((void *, mixer_devinfo_t *));
/* Allocate/free memory for the ring buffer. Usually malloc/free. */
- void *(*allocm)__P((void *, unsigned long, int, int));
+ /* The _old interfaces have been deprecated and will not be
+ called in newer kernels if the new interfaces are present */
+ void *(*allocm_old)__P((void *, unsigned long, int, int));
void (*freem)__P((void *, void *, int));
- unsigned long (*round_buffersize)__P((void *, unsigned long));
+ unsigned long (*round_buffersize_old)__P((void *, unsigned long));
int (*mappage)__P((void *, void *, int, int));
int (*get_props)__P((void *)); /* device properties */
@@ -123,6 +125,9 @@ struct audio_hw_if {
void (*)(void *), void *, struct audio_params *));
int (*trigger_input)__P((void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *));
+
+ void *(*allocm)__P((void *, int, size_t, int, int));
+ size_t (*round_buffersize)__P((void *, int, size_t));
};
struct audio_attach_args {
diff --git a/sys/dev/pci/eso.c b/sys/dev/pci/eso.c
index 43c1df56119..077db30c9a9 100644
--- a/sys/dev/pci/eso.c
+++ b/sys/dev/pci/eso.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eso.c,v 1.9 2000/04/03 21:13:48 deraadt Exp $ */
+/* $OpenBSD: eso.c,v 1.10 2000/07/19 09:04:38 csapuntz Exp $ */
/* $NetBSD: eso.c,v 1.3 1999/08/02 17:37:43 augustss Exp $ */
/*
@@ -131,17 +131,9 @@ HIDE int eso_getdev __P((void *, struct audio_device *));
HIDE int eso_set_port __P((void *, mixer_ctrl_t *));
HIDE int eso_get_port __P((void *, mixer_ctrl_t *));
HIDE int eso_query_devinfo __P((void *, mixer_devinfo_t *));
-#ifdef __OpenBSD__
-void * eso_allocm __P((void *, u_long, int, int));
-#else
HIDE void * eso_allocm __P((void *, int, size_t, int, int));
-#endif
HIDE void eso_freem __P((void *, void *, int));
-#ifdef __OpenBSD__
-u_long eso_round_buffersize __P((void *, u_long));
-#else
HIDE size_t eso_round_buffersize __P((void *, int, size_t));
-#endif
HIDE int eso_mappage __P((void *, void *, int, int));
HIDE int eso_get_props __P((void *));
HIDE int eso_trigger_output __P((void *, void *, void *, int,
@@ -169,13 +161,25 @@ HIDE struct audio_hw_if eso_hw_if = {
eso_set_port,
eso_get_port,
eso_query_devinfo,
+#ifdef __OpenBSD__
+ 0,
+#else
eso_allocm,
+#endif
eso_freem,
+#ifdef __OpenBSD__
+ 0,
+#else
eso_round_buffersize,
+#endif
eso_mappage,
eso_get_props,
eso_trigger_output,
- eso_trigger_input
+ eso_trigger_input,
+#ifdef __OpenBSD__
+ eso_allocm,
+ eso_round_buffersize
+#endif
};
HIDE const char * const eso_rev2model[] = {
@@ -1507,18 +1511,10 @@ eso_freemem(sc, ed)
}
HIDE void *
-#ifdef __OpenBSD__
-eso_allocm(hdl, size, type, flags)
-#else
eso_allocm(hdl, direction, size, type, flags)
-#endif
void *hdl;
-#ifdef __OpenBSD__
- u_long size;
-#else
int direction;
size_t size;
-#endif
int type, flags;
{
struct eso_softc *sc = hdl;
@@ -1535,14 +1531,11 @@ eso_allocm(hdl, direction, size, type, flags)
* take care of that ourselves. The second channel DMA controller
* doesn't have that restriction, however.
*/
-#ifdef __OpenBSD__
- boundary = 0x10000;
-#else
if (direction == AUMODE_RECORD)
boundary = 0x10000;
else
boundary = 0;
-#endif
+
error = eso_allocmem(sc, size, 32, boundary, flags, ed);
if (error) {
@@ -1574,20 +1567,11 @@ eso_freem(hdl, addr, type)
}
}
-#ifdef __OpenBSD__
-u_long
-eso_round_buffersize(hdl, bufsize)
-#else
HIDE size_t
eso_round_buffersize(hdl, direction, bufsize)
-#endif
void *hdl;
-#ifdef __OpenBSD__
- u_long bufsize;
-#else
int direction;
size_t bufsize;
-#endif
{
/* 64K restriction: ISA at eleven? */
diff --git a/sys/dev/pci/neo.c b/sys/dev/pci/neo.c
index f753ed53b20..4d9b6309570 100644
--- a/sys/dev/pci/neo.c
+++ b/sys/dev/pci/neo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neo.c,v 1.3 2000/04/14 03:56:50 csapuntz Exp $ */
+/* $OpenBSD: neo.c,v 1.4 2000/07/19 09:04:37 csapuntz Exp $ */
/*
* Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
@@ -153,8 +153,6 @@ struct neo_softc {
u_int32_t pwmark;
u_int32_t rwmark;
- int mallocIdx;
-
struct ac97_codec_if *codec_if;
struct ac97_host_if host_if;
};
@@ -198,11 +196,11 @@ int neo_attach_codec __P((void *sc, struct ac97_codec_if *));
int neo_read_codec __P((void *sc, u_int8_t a, u_int16_t *d));
int neo_write_codec __P((void *sc, u_int8_t a, u_int16_t d));
void neo_reset_codec __P((void *sc));
+enum ac97_host_flags neo_flags_codec __P((void *sc));
int neo_query_devinfo __P((void *, mixer_devinfo_t *));
-void *neo_malloc __P((void *, u_long, int, int));
+void *neo_malloc __P((void *, int, size_t, int, int));
void neo_free __P((void *, void *, int));
-u_long neo_round_buffersize __P((void *, u_long));
-int neo_mappage __P((void *, void *, int, int));
+size_t neo_round_buffersize __P((void *, int, size_t));
int neo_get_props __P((void *));
void neo_set_mixer __P((struct neo_softc *sc, int a, int d));
@@ -272,13 +270,16 @@ struct audio_hw_if neo_hw_if = {
neo_mixer_set_port,
neo_mixer_get_port,
neo_query_devinfo,
- neo_malloc,
+ NULL, /* neo_malloc_old, */
neo_free,
- neo_round_buffersize,
+ NULL, /* neo_round_buffersize_old, */
0, /* neo_mappage, */
neo_get_props,
neo_trigger_output,
neo_trigger_input,
+ neo_malloc,
+ neo_round_buffersize,
+
};
/* -------------------------------------------------------------------- */
@@ -608,7 +609,8 @@ neo_attach(parent, self, aux)
sc->host_if.read = neo_read_codec;
sc->host_if.write = neo_write_codec;
sc->host_if.reset = neo_reset_codec;
-
+ sc->host_if.flags = neo_flags_codec;
+
if ((error = ac97_attach(&sc->host_if)) != 0)
return;
@@ -718,6 +720,13 @@ neo_reset_codec(sc)
}
+enum ac97_host_flags
+neo_flags_codec(sc)
+ void *sc;
+{
+ return (AC97_HOST_DONT_READ);
+}
+
int
neo_open(addr, flags)
void *addr;
@@ -1035,22 +1044,21 @@ neo_query_devinfo(addr, dip)
}
void *
-neo_malloc(addr, size, pool, flags)
+neo_malloc(addr, direction, size, pool, flags)
void *addr;
- u_long size;
+ int direction;
+ size_t size;
int pool, flags;
{
struct neo_softc *sc = addr;
void *rv = 0;
- switch (sc->mallocIdx) {
- case 0:
+ switch (direction) {
+ case AUMODE_PLAY:
rv = (char *)sc->bufioh + sc->pbuf;
- sc->mallocIdx++;
break;
- case 1:
+ case AUMODE_RECORD:
rv = (char *)sc->bufioh + sc->rbuf;
- sc->mallocIdx++;
break;
default:
break;
@@ -1068,10 +1076,11 @@ neo_free(addr, ptr, pool)
return;
}
-u_long
-neo_round_buffersize(addr, size)
+size_t
+neo_round_buffersize(addr, direction, size)
void *addr;
- u_long size;
+ int direction;
+ size_t size;
{
return (NM_BUFFSIZE);
}