Re: Pegasos dmesg

Izumi Tsutsui <[email protected]>
Newsgroups gmane.os.netbsd.ports.ofppc
Message-ID <[email protected]>
I wrote:

> I'm afraid most PCI audio device drivers lack for
> byteswap ops against DMA descriptors for big endian machines.

How about this patch?
(though this driver still lacks bus_dmamap_sync(9) calls)
---
Izumi Tsutsui

Index: auich.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/auich.c,v
retrieving revision 1.123
diff -u -r1.123 auich.c
--- auich.c	6 Jan 2008 12:56:20 -0000	1.123
+++ auich.c	14 Jan 2008 05:57:28 -0000
@@ -1351,8 +1351,9 @@
 
 	for (qptr = 0; qptr < ICH_DMALIST_MAX; qptr++) {
 		q = &ring->dmalist[qptr];
-		q->base = ring->p;
-		q->len = (blksize >> sc->sc_sample_shift) | ICH_DMAF_IOC;
+		q->base = htole32(ring->p);
+		q->len =
+		    htole32((blksize >> sc->sc_sample_shift) | ICH_DMAF_IOC);
 
 		ring->p += blksize;
 		if (ring->p >= ring->end)
@@ -1378,12 +1379,14 @@
 
 	while (qptr != nqptr) {
 		q = &ring->dmalist[qptr];
-		q->base = ring->p;
-		q->len = (blksize >> sc->sc_sample_shift) | ICH_DMAF_IOC;
+		q->base = htole32(ring->p);
+		q->len =
+		    htole32((blksize >> sc->sc_sample_shift) | ICH_DMAF_IOC);
 
 		DPRINTF(ICH_DEBUG_INTR,
 		    ("auich_intr: %p, %p = %x @ 0x%x\n",
-		    &ring->dmalist[qptr], q, q->len, q->base));
+		    &ring->dmalist[qptr], q,
+		    le32toh(q->len), le32toh(q->base)));
 
 		ring->p += blksize;
 		if (ring->p >= ring->end)
@@ -1642,8 +1645,8 @@
 		printf("auich_calibrate: bad address %p\n", temp_buffer);
 		return;
 	}
-	sc->pcmi.dmalist[0].base = DMAADDR(p);
-	sc->pcmi.dmalist[0].len = (bytes >> sc->sc_sample_shift);
+	sc->pcmi.dmalist[0].base = htole32(DMAADDR(p));
+	sc->pcmi.dmalist[0].len = htole32(bytes >> sc->sc_sample_shift);
 
 	/*
 	 * our data format is stereo, 16 bit so each sample is 4 bytes.

---
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.