Module Name:    src
Committed By:   mrg
Date:           Sun Nov 20 10:48:55 UTC 2011

Modified Files:
        src/sys/dev/sbus [jmcneill-audiomp3]: dbri.c dbrivar.h

Log Message:
port to audiomp:  update allocm/freem, and add get_locks() support.
bots on my ss20, but i haven't really tested it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.6.1 src/sys/dev/sbus/dbri.c
cvs rdiff -u -r1.12 -r1.12.10.1 src/sys/dev/sbus/dbrivar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sbus/dbri.c
diff -u src/sys/dev/sbus/dbri.c:1.33 src/sys/dev/sbus/dbri.c:1.33.6.1
--- src/sys/dev/sbus/dbri.c:1.33	Wed Mar  9 05:40:11 2011
+++ src/sys/dev/sbus/dbri.c	Sun Nov 20 10:48:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbri.c,v 1.33 2011/03/09 05:40:11 macallan Exp $	*/
+/*	$NetBSD: dbri.c,v 1.33.6.1 2011/11/20 10:48:54 mrg Exp $	*/
 
 /*
  * Copyright (C) 1997 Rudolf Koenig ([email protected])
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.33 2011/03/09 05:40:11 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.33.6.1 2011/11/20 10:48:54 mrg Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -43,11 +43,11 @@ __KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.3
 #include <sys/systm.h>
 #include <sys/errno.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
 #include <sys/proc.h>
 #include <sys/kernel.h>
 #include <sys/bus.h>
 #include <sys/intr.h>
+#include <sys/kmem.h>
 
 #include <dev/sbus/sbusvar.h>
 #include <sparc/sparc/auxreg.h>
@@ -156,9 +156,10 @@ static int	dbri_trigger_output(void *, v
     void (*)(void *), void *, const struct audio_params *);
 static int	dbri_trigger_input(void *, void *, void *, int,
     void (*)(void *), void *, const struct audio_params *);
+static void	dbri_get_locks(void *, kmutex_t **, kmutex_t **);
 
-static void	*dbri_malloc(void *, int, size_t, struct malloc_type *, int);
-static void	dbri_free(void *, void *, struct malloc_type *);
+static void	*dbri_malloc(void *, int, size_t);
+static void	dbri_free(void *, void *, size_t);
 static paddr_t	dbri_mappage(void *, void *, off_t, int);
 static void	dbri_set_power(struct dbri_softc *, int);
 static void	dbri_bring_up(struct dbri_softc *);
@@ -175,32 +176,25 @@ struct audio_device dbri_device = {
 };
 
 struct audio_hw_if dbri_hw_if = {
-	dbri_open,
-	dbri_close,
-	NULL,	/* drain */
-	dbri_query_encoding,
-	dbri_set_params,
-	dbri_round_blocksize,
-	NULL,	/* commit_settings */
-	NULL,	/* init_output */
-	NULL,	/* init_input */
-	NULL,	/* start_output */
-	NULL,	/* start_input */
-	dbri_halt_output,
-	dbri_halt_input,
-	NULL,	/* speaker_ctl */
-	dbri_getdev,
-	NULL,	/* setfd */
-	dbri_set_port,
-	dbri_get_port,
-	dbri_query_devinfo,
-	dbri_malloc,
-	dbri_free,
-	dbri_round_buffersize,
-	dbri_mappage,
-	dbri_get_props,
-	dbri_trigger_output,
-	dbri_trigger_input
+	.open			= dbri_open,
+	.close			= dbri_close,
+	.query_encoding		= dbri_query_encoding,
+	.set_params		= dbri_set_params,
+	.round_blocksize	= dbri_round_blocksize,
+	.halt_output		= dbri_halt_output,
+	.halt_input		= dbri_halt_input,
+	.getdev			= dbri_getdev,
+	.set_port		= dbri_set_port,
+	.get_port		= dbri_get_port,
+	.query_devinfo		= dbri_query_devinfo,
+	.allocm			= dbri_malloc,
+	.freem			= dbri_free,
+	.round_buffersize	= dbri_round_buffersize,
+	.mappage		= dbri_mappage,
+	.get_props		= dbri_get_props,
+	.trigger_output		= dbri_trigger_output,
+	.trigger_input		= dbri_trigger_input,
+	.get_locks		= dbri_get_locks,
 };
 
 CFATTACH_DECL_NEW(dbri, sizeof(struct dbri_softc),
@@ -370,6 +364,9 @@ dbri_attach_sbus(device_t parent, device
 	sc->sc_dmabase = sc->sc_dmamap->dm_segs[0].ds_addr;
 	sc->sc_bufsiz = size;
 
+	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
+
 	bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_SCHED, dbri_intr,
 	    sc);
 
@@ -2049,6 +2046,14 @@ dbri_trigger_input(void *hdl, void *star
 	return 0;
 }
 
+static void
+dbri_get_locks(void *opaque, kmutex_t **intr, kmutex_t **thread)
+{
+	struct dbri_softc *sc = opaque;
+
+	*intr = &sc->sc_intr_lock;
+	*thread = &sc->sc_lock;
+}
 
 static uint32_t
 reverse_bytes(uint32_t b, int len)
@@ -2075,7 +2080,7 @@ reverse_bytes(uint32_t b, int len)
 }
 
 static void *
-dbri_malloc(void *v, int dir, size_t s, struct malloc_type *mt, int flags)
+dbri_malloc(void *v, int dir, size_t s)
 {
 	struct dbri_softc *sc = v;
 	struct dbri_desc *dd = &sc->sc_desc[sc->sc_desc_used];
@@ -2116,7 +2121,7 @@ dbri_malloc(void *v, int dir, size_t s, 
 }
 
 static void
-dbri_free(void *v, void *p, struct malloc_type *mt)
+dbri_free(void *v, void *p, size_t size)
 {
 	struct dbri_softc *sc = v;
 	struct dbri_desc *dd;

Index: src/sys/dev/sbus/dbrivar.h
diff -u src/sys/dev/sbus/dbrivar.h:1.12 src/sys/dev/sbus/dbrivar.h:1.12.10.1
--- src/sys/dev/sbus/dbrivar.h:1.12	Tue Jan 11 00:49:50 2011
+++ src/sys/dev/sbus/dbrivar.h	Sun Nov 20 10:48:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbrivar.h,v 1.12 2011/01/11 00:49:50 macallan Exp $	*/
+/*	$NetBSD: dbrivar.h,v 1.12.10.1 2011/11/20 10:48:54 mrg Exp $	*/
 
 /*
  * Copyright (C) 1997 Rudolf Koenig ([email protected])
@@ -166,6 +166,9 @@ struct dbri_softc {
 	struct audio_params sc_params;
 
 	struct dbri_dma	*sc_dma;
+
+	kmutex_t	sc_lock;
+	kmutex_t	sc_intr_lock;
 };
 
 #define dbri_dma_off(member, elem)	\

Reply via email to