summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2000-07-19 09:04:39 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2000-07-19 09:04:39 +0000
commit95e5668693c7f774aa2f93825ad52c79cd663b74 (patch)
tree559c9ef95f49d713944fc7ba6e39b521b77bca3c /sys/dev/pci
parent6ba815eb3bb9a95ac4a413913881c7b0c1ede5c9 (diff)
As in NetBSD, added direction to allocm/round_buffer_size APIs.
Accomplished by adding functions to audio_hw_if instead of redoing current ones so as to minimize need to change drivers. For Neomagic, tell the AC97 subsystem that we don't support reads.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/eso.c46
-rw-r--r--sys/dev/pci/neo.c47
2 files changed, 43 insertions, 50 deletions
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);
}