Fixes for sys/dev/sound/pci/t4dwave.c

Brock Johnson wildefire at isentry.homelinux.org
Thu Oct 28 13:00:45 PDT 2004


Taken as is from FreeBSD revs 1.45 and 1.46
This lets my laptop load the snd_t4dwave module without locking it up
Index: sys/dev/sound/pci/t4dwave.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/sound/pci/t4dwave.c,v
retrieving revision 1.3
diff -u -r1.3 t4dwave.c
--- sys/dev/sound/pci/t4dwave.c	7 Aug 2003 21:17:13 -0000	1.3
+++ sys/dev/sound/pci/t4dwave.c	26 Oct 2004 04:17:18 -0000
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/sound/pci/t4dwave.c,v 1.9.2.11 2002/10/22 08:27:13 cognet Exp $
- * $DragonFly: src/sys/dev/sound/pci/t4dwave.c,v 1.3 2003/08/07 21:17:13 dillon Exp $
+ * $DragonFly$
  */
 
 #include <dev/sound/pcm/sound.h>
@@ -34,7 +34,7 @@
 #include <bus/pci/pcireg.h>
 #include <bus/pci/pcivar.h>
 
-SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/t4dwave.c,v 1.3 2003/08/07 21:17:13 dillon Exp $");
+SND_DECLARE_FILE("$DragonFly$");
 /* -------------------------------------------------------------------- */
 
 #define TDX_PCI_ID 	0x20001023
@@ -45,6 +45,16 @@
 #define TR_DEFAULT_BUFSZ 	0x1000
 #define TR_TIMEOUT_CDC	0xffff
 #define TR_MAXPLAYCH	4
+/*
+ * Though, it's not clearly documented in trident datasheet, trident
+ * audio cards can't handle DMA addresses located above 1GB. The LBA
+ * (loop begin address) register which holds DMA base address is 32bits
+ * register.
+ * But the MSB 2bits are used for other purposes(I guess it is really
+ * bad idea). This effectivly limits the DMA address space up to 1GB.
+ */
+#define TR_MAXADDR	((1 << 30) - 1)
+
 
 struct tr_info;
 
@@ -486,7 +496,7 @@
 	ch->buffer = b;
 	ch->parent = tr;
 	ch->channel = c;
-	if (sndbuf_alloc(ch->buffer, tr->parent_dmat, tr->bufsz) == -1)
+	if (sndbuf_alloc(ch->buffer, tr->parent_dmat, tr->bufsz) != 0)
 		return NULL;
 
 	return ch;
@@ -594,7 +604,7 @@
 	ch->buffer = b;
 	ch->parent = tr;
 	ch->channel = c;
-	if (sndbuf_alloc(ch->buffer, tr->parent_dmat, tr->bufsz) == -1)
+	if (sndbuf_alloc(ch->buffer, tr->parent_dmat, tr->bufsz) != 0)
 		return NULL;
 
 	return ch;
@@ -852,7 +862,7 @@
 	}
 
 	if (bus_dma_tag_create(/*parent*/NULL, /*alignment*/2, /*boundary*/0,
-		/*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
+		/*lowaddr*/TR_MAXADDR,
 		/*highaddr*/BUS_SPACE_MAXADDR,
 		/*filter*/NULL, /*filterarg*/NULL,
 		/*maxsize*/tr->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,




More information about the Submit mailing list