Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jun 2007 02:17:19 GMT
From:      Ryan Beasley <ryanb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 121886 for review
Message-ID:  <200706180217.l5I2HJr4008075@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=121886

Change 121886 by ryanb@ryanb_yuki on 2007/06/18 02:16:56

	Integrate from -CURRENT.
	
	Haven't tested build yet.  (Minor merging required.)  Will test that on
	-CURRENT box next.  (Presumably after the new gcc import, can no longer
	build -CURRENT from a 6.2-R machine.)

Affected files ...

.. //depot/projects/soundsystem/src/sys/dev/sound/clone.c#1 branch
.. //depot/projects/soundsystem/src/sys/dev/sound/clone.h#1 branch
.. //depot/projects/soundsystem/src/sys/dev/sound/isa/ad1816.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/isa/ess.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/isa/mss.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/isa/sb16.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/isa/sb8.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/midi/midi.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/als4000.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/atiixp.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/au88x0.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/aureal.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/cmi.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/cs4281.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/csa.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/csapcm.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/ds1.c#6 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/emu10k1.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/emu10kx-pcm.c#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/emu10kx.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/envy24.c#6 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/envy24.h#2 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/envy24ht.c#6 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/envy24ht.h#2 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/es137x.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/fm801.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/hda/hdac.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/hda/hdac_private.h#2 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/ich.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/maestro.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/maestro3.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/neomagic.c#2 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/solo.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/spicds.c#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/spicds.h#2 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/t4dwave.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/via8233.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/via82c686.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pci/vibes.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/ac97.c#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/ac97.h#2 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/ac97_patch.c#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/ac97_patch.h#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/buffer.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/buffer.h#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/channel.c#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/channel.h#2 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/dsp.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/dsp.h#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/feeder.c#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/feeder_fmt.c#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/feeder_rate.c#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/feeder_volume.c#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/mixer.c#2 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/mixer.h#2 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/sndstat.c#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/sound.c#5 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/sound.h#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/vchan.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/pcm/vchan.h#2 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/sbus/cs4231.c#3 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/unit.c#1 branch
.. //depot/projects/soundsystem/src/sys/dev/sound/unit.h#1 branch
.. //depot/projects/soundsystem/src/sys/dev/sound/usb/uaudio.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/usb/uaudio_pcm.c#4 integrate
.. //depot/projects/soundsystem/src/sys/dev/sound/version.h#1 branch
.. //depot/projects/soundsystem/src/sys/modules/sound/sound/Makefile#2 integrate
.. //depot/projects/soundsystem/src/usr.sbin/mixer/mixer.8#2 integrate

Differences ...

==== //depot/projects/soundsystem/src/sys/dev/sound/isa/ad1816.c#5 (text+ko) ====

@@ -33,7 +33,7 @@
 
 #include "mixer_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/ad1816.c,v 1.42 2007/03/15 16:41:25 ariff Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/ad1816.c,v 1.45 2007/06/17 06:10:40 ariff Exp $");
 
 struct ad1816_info;
 
@@ -318,7 +318,7 @@
 	ch->parent = ad1816;
 	ch->channel = c;
 	ch->buffer = b;
-	if (sndbuf_alloc(ch->buffer, ad1816->parent_dmat, ad1816->bufsize) != 0)
+	if (sndbuf_alloc(ch->buffer, ad1816->parent_dmat, 0, ad1816->bufsize) != 0)
 		return NULL;
 	return ch;
 }
@@ -411,7 +411,7 @@
     	struct ad1816_info *ad1816 = ch->parent;
     	int wr, reg;
 
-	if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+	if (!PCMTRIG_COMMON(go))
 		return 0;
 
 	sndbuf_dma(ch->buffer, go);
@@ -598,9 +598,7 @@
 	struct ad1816_info *ad1816;
     	char status[SND_STATUSLEN], status2[SND_STATUSLEN];
 
-	ad1816 = (struct ad1816_info *)malloc(sizeof *ad1816, M_DEVBUF, M_NOWAIT | M_ZERO);
-	if (!ad1816) return ENXIO;
-
+	ad1816 = malloc(sizeof(*ad1816), M_DEVBUF, M_WAITOK | M_ZERO);
 	ad1816->lock = snd_mtxcreate(device_get_nameunit(dev),
 	    "snd_ad1816 softc");
 	ad1816->io_rid = 2;

==== //depot/projects/soundsystem/src/sys/dev/sound/isa/ess.c#4 (text+ko) ====

@@ -38,7 +38,7 @@
 
 #include "mixer_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/ess.c,v 1.38 2007/02/23 13:47:33 netchild Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/ess.c,v 1.42 2007/06/17 06:10:40 ariff Exp $");
 
 #define ESS_BUFFSIZE (4096)
 #define ABS(x) (((x) < 0)? -(x) : (x))
@@ -97,7 +97,8 @@
     	bus_dma_tag_t parent_dmat;
 
 	unsigned int bufsize;
-    	int type, duplex:1, newspeed:1;
+    	int type;
+	unsigned int duplex:1, newspeed:1;
     	u_long bd_flags;       /* board-specific flags */
     	struct ess_chinfo pch, rch;
 };
@@ -563,7 +564,7 @@
 	ch->parent = sc;
 	ch->channel = c;
 	ch->buffer = b;
-	if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsize) != 0)
+	if (sndbuf_alloc(ch->buffer, sc->parent_dmat, 0, sc->bufsize) != 0)
 		return NULL;
 	ch->dir = dir;
 	ch->hwch = 1;
@@ -610,7 +611,7 @@
 {
 	struct ess_chinfo *ch = data;
 
-	if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+	if (!PCMTRIG_COMMON(go))
 		return 0;
 
 	switch (go) {
@@ -808,10 +809,7 @@
     	char status[SND_STATUSLEN], buf[64];
 	int ver;
 
-    	sc = (struct ess_info *)malloc(sizeof *sc, M_DEVBUF, M_NOWAIT | M_ZERO);
-    	if (!sc)
-		return ENXIO;
-
+    	sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
 	sc->parent_dev = device_get_parent(dev);
 	sc->bufsize = pcm_getbuffersize(dev, 4096, ESS_BUFFSIZE, 65536);
     	if (ess_alloc_resources(sc, dev))

==== //depot/projects/soundsystem/src/sys/dev/sound/isa/mss.c#5 (text+ko) ====

@@ -29,7 +29,7 @@
 
 #include <dev/sound/pcm/sound.h>
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/mss.c,v 1.108 2007/03/15 16:41:25 ariff Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/mss.c,v 1.112 2007/06/17 06:10:40 ariff Exp $");
 
 /* board-specific include files */
 #include <dev/sound/isa/mss.h>
@@ -1152,7 +1152,7 @@
 	ch->channel = c;
 	ch->buffer = b;
 	ch->dir = dir;
-	if (sndbuf_alloc(ch->buffer, mss->parent_dmat, mss->bufsize) != 0)
+	if (sndbuf_alloc(ch->buffer, mss->parent_dmat, 0, mss->bufsize) != 0)
 		return NULL;
 	sndbuf_dmasetup(ch->buffer, (dir == PCMDIR_PLAY)? mss->drq1 : mss->drq2);
 	return ch;
@@ -1201,7 +1201,7 @@
 	struct mss_chinfo *ch = data;
 	struct mss_info *mss = ch->parent;
 
-	if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+	if (!PCMTRIG_COMMON(go))
 		return 0;
 
 	sndbuf_dma(ch->buffer, go);
@@ -1320,7 +1320,7 @@
 		goto mss_probe_end;
     	}
     	tmp &= 0x3f;
-    	if (!(tmp == 0x04 || tmp == 0x0f || tmp == 0x00)) {
+    	if (!(tmp == 0x04 || tmp == 0x0f || tmp == 0x00 || tmp == 0x05)) {
 		BVDDB(printf("No MSS signature detected on port 0x%lx (0x%x)\n",
 		     	rman_get_start(mss->io_base), tmpx));
 		goto no;
@@ -1979,10 +1979,7 @@
 {
 	struct mss_info *mss;
 
-	mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO);
-	if (!mss)
-	    return ENXIO;
-
+	mss = malloc(sizeof(*mss), M_DEVBUF, M_WAITOK | M_ZERO);
 	mss->io_rid = 0;
 	mss->conf_rid = -1;
 	mss->irq_rid = 0;

==== //depot/projects/soundsystem/src/sys/dev/sound/isa/sb16.c#4 (text+ko) ====

@@ -38,7 +38,7 @@
 
 #include "mixer_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/sb16.c,v 1.94 2007/02/23 13:47:33 netchild Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/sb16.c,v 1.97 2007/06/17 06:10:40 ariff Exp $");
 
 #define SB16_BUFFSIZE	4096
 #define PLAIN_SB16(x) ((((x)->bd_flags) & (BD_F_SB16|BD_F_SB16X)) == BD_F_SB16)
@@ -681,7 +681,7 @@
 	ch->buffer = b;
 	ch->dir = dir;
 
-	if (sndbuf_alloc(ch->buffer, sb->parent_dmat, sb->bufsize) != 0)
+	if (sndbuf_alloc(ch->buffer, sb->parent_dmat, 0, sb->bufsize) != 0)
 		return NULL;
 
 	return ch;
@@ -724,7 +724,7 @@
 	struct sb_chinfo *ch = data;
 	struct sb_info *sb = ch->parent;
 
-	if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+	if (!PCMTRIG_COMMON(go))
 		return 0;
 
 	if (go == PCMTRIG_START)
@@ -813,10 +813,7 @@
 	uintptr_t ver;
     	char status[SND_STATUSLEN], status2[SND_STATUSLEN];
 
-    	sb = (struct sb_info *)malloc(sizeof *sb, M_DEVBUF, M_NOWAIT | M_ZERO);
-    	if (!sb)
-		return ENXIO;
-
+    	sb = malloc(sizeof(*sb), M_DEVBUF, M_WAITOK | M_ZERO);
 	sb->parent_dev = device_get_parent(dev);
 	BUS_READ_IVAR(sb->parent_dev, dev, 1, &ver);
 	sb->bd_id = ver & 0x0000ffff;

==== //depot/projects/soundsystem/src/sys/dev/sound/isa/sb8.c#4 (text+ko) ====

@@ -38,7 +38,7 @@
 
 #include "mixer_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/sb8.c,v 1.83 2007/02/23 13:47:33 netchild Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/sb8.c,v 1.86 2007/06/17 06:10:41 ariff Exp $");
 
 #define SB_DEFAULT_BUFSZ	4096
 
@@ -599,7 +599,7 @@
 	ch->channel = c;
 	ch->dir = dir;
 	ch->buffer = b;
-	if (sndbuf_alloc(ch->buffer, sb->parent_dmat, sb->bufsize) != 0)
+	if (sndbuf_alloc(ch->buffer, sb->parent_dmat, 0, sb->bufsize) != 0)
 		return NULL;
 	sndbuf_dmasetup(ch->buffer, sb->drq);
 	return ch;
@@ -637,7 +637,7 @@
 {
 	struct sb_chinfo *ch = data;
 
-	if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+	if (!PCMTRIG_COMMON(go))
 		return 0;
 
 	sndbuf_dma(ch->buffer, go);
@@ -714,10 +714,7 @@
     	char status[SND_STATUSLEN];
 	uintptr_t ver;
 
-    	sb = (struct sb_info *)malloc(sizeof *sb, M_DEVBUF, M_NOWAIT | M_ZERO);
-    	if (!sb)
-		return ENXIO;
-
+    	sb = malloc(sizeof(*sb), M_DEVBUF, M_WAITOK | M_ZERO);
 	sb->parent_dev = device_get_parent(dev);
 	BUS_READ_IVAR(device_get_parent(dev), dev, 1, &ver);
 	sb->bd_id = ver & 0x0000ffff;

==== //depot/projects/soundsystem/src/sys/dev/sound/midi/midi.c#4 (text) ====

@@ -42,7 +42,7 @@
   */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/sound/midi/midi.c,v 1.23 2007/03/15 14:57:54 ariff Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/sound/midi/midi.c,v 1.24 2007/04/02 06:03:47 ariff Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -1453,14 +1453,18 @@
 	switch (type) {
 	case MOD_LOAD:
 		retval = midi_load();
+#if 0
 		if (retval == 0)
 			retval = seq_modevent(mod, type, data);
+#endif
 		break;
 
 	case MOD_UNLOAD:
 		retval = midi_unload();
+#if 0
 		if (retval == 0)
 			retval = seq_modevent(mod, type, data);
+#endif
 		break;
 
 	default:

==== //depot/projects/soundsystem/src/sys/dev/sound/pci/als4000.c#5 (text+ko) ====

@@ -42,7 +42,7 @@
 
 #include "mixer_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/als4000.c,v 1.24 2007/03/15 16:41:26 ariff Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/als4000.c,v 1.27 2007/06/17 06:10:41 ariff Exp $");
 
 /* Debugging macro's */
 #undef DEB
@@ -221,7 +221,7 @@
 	ch->buffer = b;
 	snd_mtxunlock(sc->lock);
 
-	if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) != 0)
+	if (sndbuf_alloc(ch->buffer, sc->parent_dmat, 0, sc->bufsz) != 0)
 		return NULL;
 
 	return ch;
@@ -391,14 +391,20 @@
 	struct	sc_chinfo *ch = data;
 	struct sc_info *sc = ch->parent;
 
+	if (!PCMTRIG_COMMON(go))
+		return 0;
+
 	snd_mtxlock(sc->lock);
 	switch(go) {
 	case PCMTRIG_START:
 		als_playback_start(ch);
 		break;
+	case PCMTRIG_STOP:
 	case PCMTRIG_ABORT:
 		als_playback_stop(ch);
 		break;
+	default:
+		break;
 	}
 	snd_mtxunlock(sc->lock);
 	return 0;
@@ -489,6 +495,7 @@
 	case PCMTRIG_START:
 		als_capture_start(ch);
 		break;
+	case PCMTRIG_STOP:
 	case PCMTRIG_ABORT:
 		als_capture_stop(ch);
 		break;
@@ -798,11 +805,7 @@
 	u_int32_t data;
 	char status[SND_STATUSLEN];
 
-	if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
-		device_printf(dev, "cannot allocate softc\n");
-		return ENXIO;
-	}
-
+	sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
 	sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_als4000 softc");
 	sc->dev = dev;
 

==== //depot/projects/soundsystem/src/sys/dev/sound/pci/atiixp.c#5 (text+ko) ====

@@ -63,7 +63,7 @@
 
 #include <dev/sound/pci/atiixp.h>
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/atiixp.c,v 1.12 2007/03/16 17:18:17 ariff Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/atiixp.c,v 1.18 2007/06/14 11:13:37 ariff Exp $");
 
 #define ATI_IXP_DMA_RETRY_MAX	100
 
@@ -459,7 +459,7 @@
 
 	atiixp_unlock(sc);
 
-	if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) == -1)
+	if (sndbuf_alloc(ch->buffer, sc->parent_dmat, 0, sc->bufsz) == -1)
 		return (NULL);
 
 	atiixp_lock(sc);
@@ -712,6 +712,9 @@
 	uint32_t value;
 	int pollticks;
 
+	if (!PCMTRIG_COMMON(go))
+		return (0);
+
 	atiixp_lock(sc);
 
 	switch (go) {
@@ -896,6 +899,7 @@
 		enable  = atiixp_rd(sc, ATI_REG_IER);
 		enable &= ~detected_codecs;
 		atiixp_wr(sc, ATI_REG_IER, enable);
+		wakeup(sc);
 	}
 
 	/* acknowledge */
@@ -957,7 +961,7 @@
 	atiixp_lock(sc);
 	val = sc->polling;
 	atiixp_unlock(sc);
-	err = sysctl_handle_int(oidp, &val, sizeof(val), req);
+	err = sysctl_handle_int(oidp, &val, 0, req);
 
 	if (err || req->newptr == NULL)
 		return (err);
@@ -1002,18 +1006,20 @@
 	polling = sc->polling;
 	sc->polling = 0;
 
-	/* wait for the interrupts to happen */
-	timeout = 100;
-	do {
-		msleep(sc, sc->lock, PWAIT, "ixpslp", 1);
-		if (sc->codec_not_ready_bits)
-			break;
-	} while (--timeout);
+	timeout = 10;
+	if (sc->codec_not_ready_bits == 0) {
+		/* wait for the interrupts to happen */
+		do {
+			msleep(sc, sc->lock, PWAIT, "ixpslp", max(hz / 10, 1));
+			if (sc->codec_not_ready_bits != 0)
+				break;
+		} while (--timeout);
+	}
 
 	sc->polling = polling;
 	atiixp_disable_interrupts(sc);
 
-	if (timeout == 0) {
+	if (sc->codec_not_ready_bits == 0 && timeout == 0) {
 		device_printf(sc->dev,
 			"WARNING: timeout during codec detection; "
 			"codecs might be present but haven't interrupted\n");
@@ -1105,38 +1111,49 @@
 {
 	if (sc == NULL)
 		return;
+	if (sc->registered_channels != 0) {
+		atiixp_lock(sc);
+		sc->polling = 0;
+		callout_stop(&sc->poll_timer);
+		atiixp_unlock(sc);
+		callout_drain(&sc->poll_timer);
+	}
 	if (sc->codec) {
 		ac97_destroy(sc->codec);
 		sc->codec = NULL;
 	}
 	if (sc->ih) {
 		bus_teardown_intr(sc->dev, sc->irq, sc->ih);
-		sc->ih = 0;
+		sc->ih = NULL;
 	}
 	if (sc->reg) {
 		bus_release_resource(sc->dev, sc->regtype, sc->regid, sc->reg);
-		sc->reg = 0;
+		sc->reg = NULL;
 	}
 	if (sc->irq) {
 		bus_release_resource(sc->dev, SYS_RES_IRQ, sc->irqid, sc->irq);
-		sc->irq = 0;
+		sc->irq = NULL;
 	}
 	if (sc->parent_dmat) {
 		bus_dma_tag_destroy(sc->parent_dmat);
-		sc->parent_dmat = 0;
+		sc->parent_dmat = NULL;
 	}
-	if (sc->sgd_dmamap) {
+	if (sc->sgd_dmamap)
 		bus_dmamap_unload(sc->sgd_dmat, sc->sgd_dmamap);
-		sc->sgd_dmamap = 0;
+	if (sc->sgd_table) {
+		bus_dmamem_free(sc->sgd_dmat, sc->sgd_table, sc->sgd_dmamap);
+		sc->sgd_table = NULL;
 	}
+	sc->sgd_dmamap = NULL;
 	if (sc->sgd_dmat) {
 		bus_dma_tag_destroy(sc->sgd_dmat);
-		sc->sgd_dmat = 0;
+		sc->sgd_dmat = NULL;
 	}
 	if (sc->lock) {
 		snd_mtxfree(sc->lock);
 		sc->lock = NULL;
 	}
+	free(sc, M_DEVBUF);
 }
 
 static int
@@ -1164,11 +1181,7 @@
 	struct atiixp_info *sc;
 	int i;
 
-	if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
-		device_printf(dev, "cannot allocate softc\n");
-		return (ENXIO);
-	}
-
+	sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
 	sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_atiixp softc");
 	sc->dev = dev;
 
@@ -1303,7 +1316,6 @@
 		if (sc->st != 0 && sc->sh != 0)
 			atiixp_disable_interrupts(sc);
 		atiixp_release_resource(sc);
-		free(sc, M_DEVBUF);
 	}
 	return (0);
 }

==== //depot/projects/soundsystem/src/sys/dev/sound/pci/au88x0.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/sound/pci/au88x0.c,v 1.11 2007/02/23 13:47:34 netchild Exp $
+ * $FreeBSD: src/sys/dev/sound/pci/au88x0.c,v 1.13 2007/06/17 06:10:41 ariff Exp $
  */
 
 #include <dev/sound/pcm/sound.h>
@@ -332,7 +332,7 @@
 	struct au88x0_info *aui = arg;
 	struct au88x0_chan_info *auci = au88x0_channel(aui, dir);
 
-	if (sndbuf_alloc(buf, aui->aui_dmat, aui->aui_bufsize) != 0)
+	if (sndbuf_alloc(buf, aui->aui_dmat, 0, aui->aui_bufsize) != 0)
 		return (NULL);
 	auci->auci_aui = aui;
 	auci->auci_pcmchan = chan;
@@ -572,10 +572,7 @@
 	uint32_t config;
 	int error;
 
-	if ((aui = malloc(sizeof *aui, M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL) {
-		device_printf(dev, "failed to allocate softc\n");
-		return (ENXIO);
-	}
+	aui = malloc(sizeof(*aui), M_DEVBUF, M_WAITOK | M_ZERO);
 	aui->aui_dev = dev;
 
 	/* Model-specific parameters */

==== //depot/projects/soundsystem/src/sys/dev/sound/pci/aureal.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/aureal.c,v 1.33 2007/02/23 13:47:34 netchild Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/aureal.c,v 1.36 2007/06/17 06:10:41 ariff Exp $");
 
 /* PCI IDs of supported chips */
 #define AU8820_PCI_ID 0x000112eb
@@ -303,7 +303,7 @@
 	ch->channel = c;
 	ch->buffer = b;
 	ch->dir = dir;
-	if (sndbuf_alloc(ch->buffer, au->parent_dmat, AU_BUFFSIZE) != 0)
+	if (sndbuf_alloc(ch->buffer, au->parent_dmat, 0, AU_BUFFSIZE) != 0)
 		return NULL;
 	return ch;
 }
@@ -339,12 +339,12 @@
 	struct au_chinfo *ch = data;
 	struct au_info *au = ch->parent;
 
-	if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+	if (!PCMTRIG_COMMON(go))
 		return 0;
 
 	if (ch->dir == PCMDIR_PLAY) {
 		au_setadb(au, 0x11, (go)? 1 : 0);
-		if (!go) {
+		if (go != PCMTRIG_START) {
 			au_wr(au, 0, 0xf800, 0, 4);
 			au_wr(au, 0, 0xf804, 0, 4);
 			au_delroute(au, 0x58);
@@ -558,11 +558,7 @@
 	struct ac97_info *codec;
 	char 		status[SND_STATUSLEN];
 
-	if ((au = malloc(sizeof(*au), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
-		device_printf(dev, "cannot allocate softc\n");
-		return ENXIO;
-	}
-
+	au = malloc(sizeof(*au), M_DEVBUF, M_WAITOK | M_ZERO);
 	au->unit = device_get_unit(dev);
 
 	data = pci_read_config(dev, PCIR_COMMAND, 2);

==== //depot/projects/soundsystem/src/sys/dev/sound/pci/cmi.c#5 (text+ko) ====

@@ -53,7 +53,7 @@
 #include "mixer_if.h"
 #include "mpufoi_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/cmi.c,v 1.40 2007/03/15 16:41:26 ariff Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/cmi.c,v 1.44 2007/06/17 06:10:41 ariff Exp $");
 
 /* Supported chip ID's */
 #define CMI8338A_PCI_ID   0x010013f6
@@ -349,7 +349,7 @@
 	ch->spd        = DSP_DEFAULT_SPEED;
 	ch->buffer     = b;
 	ch->dma_active = 0;
-	if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) != 0) {
+	if (sndbuf_alloc(ch->buffer, sc->parent_dmat, 0, sc->bufsz) != 0) {
 		DEB(printf("cmichan_init failed\n"));
 		return NULL;
 	}
@@ -475,12 +475,16 @@
 	struct sc_chinfo	*ch = data;
 	struct sc_info		*sc = ch->parent;
 
+	if (!PCMTRIG_COMMON(go))
+		return 0;
+
 	snd_mtxlock(sc->lock);
 	if (ch->dir == PCMDIR_PLAY) {
 		switch(go) {
 		case PCMTRIG_START:
 			cmi_ch0_start(sc, ch);
 			break;
+		case PCMTRIG_STOP:
 		case PCMTRIG_ABORT:
 			cmi_ch0_stop(sc, ch);
 			break;
@@ -490,6 +494,7 @@
 		case PCMTRIG_START:
 			cmi_ch1_start(sc, ch);
 			break;
+		case PCMTRIG_STOP:
 		case PCMTRIG_ABORT:
 			cmi_ch1_stop(sc, ch);
 			break;
@@ -923,12 +928,7 @@
 	u_int32_t		data;
 	char			status[SND_STATUSLEN];
 
-	sc = malloc(sizeof(struct sc_info), M_DEVBUF, M_NOWAIT | M_ZERO);
-	if (sc == NULL) {
-		device_printf(dev, "cannot allocate softc\n");
-		return ENXIO;
-	}
-
+	sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
 	sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_cmi softc");
 	data = pci_read_config(dev, PCIR_COMMAND, 2);
 	data |= (PCIM_CMD_PORTEN|PCIM_CMD_BUSMASTEREN);
@@ -946,7 +946,8 @@
 	sc->st = rman_get_bustag(sc->reg);
 	sc->sh = rman_get_bushandle(sc->reg);
 
-	cmi_midiattach(sc);
+	if (0)
+		cmi_midiattach(sc);
 
 	sc->irqid = 0;
 	sc->irq   = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid,

==== //depot/projects/soundsystem/src/sys/dev/sound/pci/cs4281.c#4 (text+ko) ====

@@ -37,7 +37,7 @@
 
 #include <dev/sound/pci/cs4281.h>
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/cs4281.c,v 1.23 2007/02/23 13:47:34 netchild Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/cs4281.c,v 1.26 2007/06/17 06:10:41 ariff Exp $");
 
 #define CS4281_DEFAULT_BUFSZ 16384
 
@@ -314,7 +314,7 @@
     struct sc_chinfo *ch = (dir == PCMDIR_PLAY) ? &sc->pch : &sc->rch;
 
     ch->buffer = b;
-    if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) != 0) {
+    if (sndbuf_alloc(ch->buffer, sc->parent_dmat, 0, sc->bufsz) != 0) {
 	return NULL;
     }
     ch->parent = sc;
@@ -425,6 +425,7 @@
 	adcdac_prog(ch);
 	adcdac_go(ch, 1);
 	break;
+    case PCMTRIG_STOP:
     case PCMTRIG_ABORT:
 	adcdac_go(ch, 0);
 	break;
@@ -753,11 +754,7 @@
     u_int32_t data;
     char status[SND_STATUSLEN];
 
-    if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
-	device_printf(dev, "cannot allocate softc\n");
-	return ENXIO;
-    }
-
+    sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
     sc->dev = dev;
     sc->type = pci_get_devid(dev);
 

==== //depot/projects/soundsystem/src/sys/dev/sound/pci/csa.c#4 (text+ko) ====

@@ -48,7 +48,7 @@
 
 #include <gnu/dev/sound/pci/csaimg.h>
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/csa.c,v 1.36 2007/02/23 19:40:13 ariff Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/csa.c,v 1.37 2007/03/17 19:37:09 ariff Exp $");
 
 /* This is the pci device id. */
 #define CS4610_PCI_ID 0x60011013
@@ -339,23 +339,31 @@
 {
 	csa_res *resp;
 	sc_p scp;
+	struct sndcard_func *func;
 	int err;
 
 	scp = device_get_softc(dev);
 	resp = &scp->res;
 
-	err = 0;
-	if (scp->midi != NULL)
+	if (scp->midi != NULL) {
+		func = device_get_ivars(scp->midi);
 		err = device_delete_child(dev, scp->midi);
-	if (err)
-		return err;
-	scp->midi = NULL;
+		if (err != 0)
+			return err;
+		if (func != NULL)
+			free(func, M_DEVBUF);
+		scp->midi = NULL;
+	}
 
-	if (scp->pcm != NULL)
+	if (scp->pcm != NULL) {
+		func = device_get_ivars(scp->pcm);
 		err = device_delete_child(dev, scp->pcm);
-	if (err)
-		return err;
-	scp->pcm = NULL;
+		if (err != 0)
+			return err;
+		if (func != NULL)
+			free(func, M_DEVBUF);
+		scp->pcm = NULL;
+	}
 
 	bus_teardown_intr(dev, resp->irq, scp->ih);
 	bus_release_resource(dev, SYS_RES_IRQ, resp->irq_rid, resp->irq);

==== //depot/projects/soundsystem/src/sys/dev/sound/pci/csapcm.c#4 (text+ko) ====

@@ -38,7 +38,7 @@
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/csapcm.c,v 1.38 2007/02/23 13:47:34 netchild Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/csapcm.c,v 1.41 2007/06/17 06:10:41 ariff Exp $");
 
 /* Buffer size on dma transfer. Fixed for CS416x. */
 #define CS461x_BUFFSIZE   (4 * 1024)
@@ -534,7 +534,7 @@
 	ch->channel = c;
 	ch->buffer = b;
 	ch->dir = dir;
-	if (sndbuf_alloc(ch->buffer, csa->parent_dmat, CS461x_BUFFSIZE) != 0)
+	if (sndbuf_alloc(ch->buffer, csa->parent_dmat, 0, CS461x_BUFFSIZE) != 0)
 		return NULL;
 	return ch;
 }
@@ -569,7 +569,7 @@
 	struct csa_chinfo *ch = data;
 	struct csa_info *csa = ch->parent;
 
-	if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+	if (!PCMTRIG_COMMON(go))
 		return 0;
 
 	if (go == PCMTRIG_START) {
@@ -777,9 +777,7 @@
 	struct ac97_info *codec;
 	struct sndcard_func *func;
 
-	csa = malloc(sizeof(*csa), M_DEVBUF, M_NOWAIT | M_ZERO);
-	if (csa == NULL)
-		return (ENOMEM);
+	csa = malloc(sizeof(*csa), M_DEVBUF, M_WAITOK | M_ZERO);
 	unit = device_get_unit(dev);
 	func = device_get_ivars(dev);
 	csa->binfo = func->varinfo;

==== //depot/projects/soundsystem/src/sys/dev/sound/pci/ds1.c#6 (text+ko) ====

@@ -33,7 +33,7 @@
 #include <dev/sound/pci/ds1.h>
 #include <dev/sound/pci/ds1-fw.h>
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/ds1.c,v 1.49 2007/03/15 16:41:26 ariff Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/ds1.c,v 1.52 2007/06/17 06:10:41 ariff Exp $");
 
 /* -------------------------------------------------------------------- */
 
@@ -490,7 +490,7 @@
 	ch->fmt = AFMT_U8;
 	ch->spd = 8000;
 	ch->run = 0;
-	if (sndbuf_alloc(ch->buffer, sc->buffer_dmat, sc->bufsz) != 0)
+	if (sndbuf_alloc(ch->buffer, sc->buffer_dmat, 0, sc->bufsz) != 0)
 		return NULL;
 	else {
 		ch->lsnum = sc->pslotfree;
@@ -545,7 +545,7 @@
 	struct sc_info *sc = ch->parent;
 	int stereo;
 
-	if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+	if (!PCMTRIG_COMMON(go))
 		return 0;
 	stereo = (ch->fmt & AFMT_STEREO)? 1 : 0;
 	if (go == PCMTRIG_START) {
@@ -621,7 +621,7 @@
 	ch->dir = dir;
 	ch->fmt = AFMT_U8;
 	ch->spd = 8000;
-	if (sndbuf_alloc(ch->buffer, sc->buffer_dmat, sc->bufsz) != 0)
+	if (sndbuf_alloc(ch->buffer, sc->buffer_dmat, 0, sc->bufsz) != 0)
 		return NULL;
 	else {
 		ch->slot = (ch->num == DS1_RECPRIMARY)? sc->rbank + 2: sc->rbank;
@@ -673,7 +673,7 @@
 	struct sc_info *sc = ch->parent;
 	u_int32_t x;
 
-	if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+	if (!PCMTRIG_COMMON(go))
 		return 0;
 	if (go == PCMTRIG_START) {
 		ch->run = 1;
@@ -943,11 +943,7 @@
 	struct ac97_info *codec = NULL;
 	char 		status[SND_STATUSLEN];
 
-	if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
-		device_printf(dev, "cannot allocate softc\n");
-		return ENXIO;
-	}
-
+	sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
 	sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_ds1 softc");
 	sc->dev = dev;
 	subdev = (pci_get_subdevice(dev) << 16) | pci_get_subvendor(dev);

==== //depot/projects/soundsystem/src/sys/dev/sound/pci/emu10k1.c#5 (text+ko) ====

@@ -37,7 +37,7 @@
 #include <dev/sound/midi/mpu401.h>
 #include "mpufoi_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/emu10k1.c,v 1.65 2007/03/15 16:41:26 ariff Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/emu10k1.c,v 1.69 2007/06/17 06:10:42 ariff Exp $");
 
 /* -------------------------------------------------------------------- */
 
@@ -87,7 +87,7 @@
 
 struct emu_voice {
 	int vnum;
-	int b16:1, stereo:1, busy:1, running:1, ismaster:1;
+	unsigned int b16:1, stereo:1, busy:1, running:1, ismaster:1;
 	int speed;
 	int start, end, vol;
 	int fxrt1;	/* FX routing */
@@ -795,7 +795,7 @@
 	struct sc_pchinfo *ch = data;
 	struct sc_info *sc = ch->parent;
 
-	if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+	if (!PCMTRIG_COMMON(go))
 		return 0;
 
 	snd_mtxlock(sc->lock);
@@ -895,7 +895,7 @@
 		break;
 	}
 	sc->rnum++;
-	if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) != 0)
+	if (sndbuf_alloc(ch->buffer, sc->parent_dmat, 0, sc->bufsz) != 0)
 		return NULL;
 	else {
 		snd_mtxlock(sc->lock);
@@ -958,6 +958,9 @@
 	struct sc_info *sc = ch->parent;
 	u_int32_t val, sz;
 
+	if (!PCMTRIG_COMMON(go))
+		return 0;
+
 	switch(sc->bufsz) {
 	case 4096:
 		sz = ADCBS_BUFSIZE_4096;
@@ -1981,11 +1984,7 @@
 	int i, gotmic;
 	char status[SND_STATUSLEN];
 
-	if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
-		device_printf(dev, "cannot allocate softc\n");
-		return ENXIO;
-	}
-
+	sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
 	sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_emu10k1 softc");
 	sc->dev = dev;
 	sc->type = pci_get_devid(dev);

==== //depot/projects/soundsystem/src/sys/dev/sound/pci/emu10kx-pcm.c#3 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/sound/pci/emu10kx-pcm.c,v 1.7 2007/03/15 16:41:26 ariff Exp $
+ * $FreeBSD: src/sys/dev/sound/pci/emu10kx-pcm.c,v 1.10 2007/06/17 06:10:42 ariff Exp $
  */
 
 #include <sys/param.h>
@@ -513,8 +513,9 @@
 	struct emu_pcm_pchinfo *ch = c_devinfo;
 	struct emu_pcm_info *sc = ch->pcm;
 
-	if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+	if (!PCMTRIG_COMMON(go))
 		return (0);
+
 	snd_mtxlock(sc->lock); /* XXX can we trigger on parallel threads ? */
 	if (go == PCMTRIG_START) {
 		emu_vsetup(ch->master, ch->fmt, ch->spd);
@@ -602,7 +603,7 @@
 	ch->irqmask = INTE_ADCBUFENABLE;
 	ch->iprmask = IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL;
 
-	if (sndbuf_alloc(ch->buffer, emu_gettag(sc->card), sc->bufsz) != 0)
+	if (sndbuf_alloc(ch->buffer, emu_gettag(sc->card), 0, sc->bufsz) != 0)
 		return (NULL);
 	else {
 		emu_wrptr(sc->card, 0, ch->basereg, sndbuf_getbufaddr(ch->buffer));

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706180217.l5I2HJr4008075>