Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Add some byteswap ops around DMA descriptors for...
details: https://anonhg.NetBSD.org/src/rev/eb2acf6b417e
branches: trunk
changeset: 566891:eb2acf6b417e
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun May 23 11:37:25 2004 +0000
description:
Add some byteswap ops around DMA descriptors for big endian machines.
Tested on macppc by matthew green.
XXX This driver completely lacks bus_dmamap_sync(9) ops.
diffstat:
sys/dev/pci/emuxki.c | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diffs (64 lines):
diff -r 0d6baa0fe785 -r eb2acf6b417e sys/dev/pci/emuxki.c
--- a/sys/dev/pci/emuxki.c Sun May 23 11:18:28 2004 +0000
+++ b/sys/dev/pci/emuxki.c Sun May 23 11:37:25 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emuxki.c,v 1.33 2004/04/23 21:13:06 itojun Exp $ */
+/* $NetBSD: emuxki.c,v 1.34 2004/05/23 11:37:25 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.33 2004/04/23 21:13:06 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.34 2004/05/23 11:37:25 tsutsui Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -739,7 +739,7 @@
silentpage = DMAADDR(sc->silentpage) << 1;
ptb = KERNADDR(sc->ptb);
for (i = 0; i < EMU_MAXPTE; i++)
- ptb[i] = silentpage | i;
+ ptb[i] = htole32(silentpage | i);
/* Write PTB address and set TCB to none */
emuxki_write(sc, 0, EMU_PTB, DMAADDR(sc->ptb));
@@ -860,12 +860,12 @@
numblocks++;
for (i = 0; i < EMU_MAXPTE; i++)
- if ((ptb[i] & EMU_CHAN_MAP_PTE_MASK) == silentpage) {
+ if ((le32toh(ptb[i]) & EMU_CHAN_MAP_PTE_MASK) == silentpage) {
/* We look for a free PTE */
s = splaudio();
for (j = 0; j < numblocks; j++)
- if ((ptb[i + j] & EMU_CHAN_MAP_PTE_MASK)
- != silentpage)
+ if ((le32toh(ptb[i + j])
+ & EMU_CHAN_MAP_PTE_MASK) != silentpage)
break;
if (j == numblocks) {
if ((mem = emuxki_mem_new(sc, i,
@@ -875,9 +875,8 @@
}
for (j = 0; j < numblocks; j++)
ptb[i + j] =
- (((DMAADDR(mem->dmamem) +
- j * EMU_PTESIZE)) << 1)
- | (i + j);
+ htole32((((DMAADDR(mem->dmamem) +
+ j * EMU_PTESIZE)) << 1) | (i + j));
LIST_INSERT_HEAD(&(sc->mem), mem, next);
splx(s);
return (KERNADDR(mem->dmamem));
@@ -2050,7 +2049,7 @@
numblocks++;
for (i = 0; i < numblocks; i++)
ptb[mem->ptbidx + i] =
- silentpage | (mem->ptbidx + i);
+ htole32(silentpage | (mem->ptbidx + i));
}
LIST_REMOVE(mem, next);
splx(s);
Home |
Main Index |
Thread Index |
Old Index