Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/dev Improve legibility and iommu_dvmamap_sy...
details: https://anonhg.NetBSD.org/src/rev/ecab58073459
branches: trunk
changeset: 504187:ecab58073459
user: eeh <eeh%NetBSD.org@localhost>
date: Sat Feb 24 18:49:06 2001 +0000
description:
Improve legibility and iommu_dvmamap_sync().
diffstat:
sys/arch/sparc64/dev/iommu.c | 45 +++++++++++++++++++++++++++----------------
1 files changed, 28 insertions(+), 17 deletions(-)
diffs (117 lines):
diff -r 05cfbbf81544 -r ecab58073459 sys/arch/sparc64/dev/iommu.c
--- a/sys/arch/sparc64/dev/iommu.c Sat Feb 24 18:10:23 2001 +0000
+++ b/sys/arch/sparc64/dev/iommu.c Sat Feb 24 18:49:06 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iommu.c,v 1.30 2001/02/06 19:04:57 eeh Exp $ */
+/* $NetBSD: iommu.c,v 1.31 2001/02/24 18:49:06 eeh Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@@ -140,7 +140,9 @@
#define DPRINTF(l, s)
#endif
-static int iommu_strbuf_flush __P((struct iommu_state *));
+#define iommu_strbuf_flush(i,v) bus_space_write_8((i)->is_bustag, \
+ (bus_space_handle_t)(u_long)&(i)->is_sb->strbuf_pgflush, 0, (v))
+static int iommu_strbuf_flush_done __P((struct iommu_state *));
/*
* initialise the UltraSPARC IOMMU (SBUS or PCI):
@@ -305,9 +307,8 @@
/* Is the streamcache flush really needed? */
if (is->is_sb) {
- bus_space_write_8(is->is_bustag, (bus_space_handle_t)(u_long)
- &is->is_sb->strbuf_pgflush, 0, va);
- iommu_strbuf_flush(is);
+ iommu_strbuf_flush(is, va);
+ iommu_strbuf_flush_done(is);
}
DPRINTF(IDB_IOMMU, ("Clearing TSB slot %d for va %p\n",
(int)IOTSBSLOT(va,is->is_tsbsize), (void *)(u_long)va));
@@ -357,10 +358,9 @@
(void *)(u_long)&is->is_tsb[IOTSBSLOT(va,is->is_tsbsize)],
(long)(is->is_tsb[IOTSBSLOT(va,is->is_tsbsize)]),
(u_long)len));
- bus_space_write_8(is->is_bustag, (bus_space_handle_t)(u_long)
- &is->is_sb->strbuf_pgflush, 0, va);
+ iommu_strbuf_flush(is, va);
if (len <= NBPG)
- iommu_strbuf_flush(is);
+ iommu_strbuf_flush_done(is);
DPRINTF(IDB_IOMMU, ("iommu_remove: flushed va %p TSB[%lx]@%p=%lx, %lu bytes left\n",
(void *)(u_long)va, (long)IOTSBSLOT(va,is->is_tsbsize),
(void *)(u_long)&is->is_tsb[IOTSBSLOT(va,is->is_tsbsize)],
@@ -382,7 +382,7 @@
}
static int
-iommu_strbuf_flush(is)
+iommu_strbuf_flush_done(is)
struct iommu_state *is;
{
struct timeval cur, flushtimeout;
@@ -424,7 +424,7 @@
cur = flushtimeout;
BUMPTIME(&flushtimeout, 500000); /* 1/2 sec */
- DPRINTF(IDB_IOMMU, ("iommu_strbuf_flush: flush = %lx at va = %lx pa = %lx now=%lx:%lx until = %lx:%lx\n",
+ DPRINTF(IDB_IOMMU, ("iommu_strbuf_flush_done: flush = %lx at va = %lx pa = %lx now=%lx:%lx until = %lx:%lx\n",
(long)is->is_flush, (long)&is->is_flush,
(long)is->is_flushpa, cur.tv_sec, cur.tv_usec,
flushtimeout.tv_sec, flushtimeout.tv_usec));
@@ -436,7 +436,7 @@
#ifdef DIAGNOSTIC
if (!ldxa(is->is_flushpa, ASI_PHYS_CACHED)) {
- printf("iommu_strbuf_flush: flush timeout %p at %p\n",
+ printf("iommu_strbuf_flush_done: flush timeout %p at %p\n",
(void *)(u_long)is->is_flush,
(void *)(u_long)is->is_flushpa); /* panic? */
#ifdef DDB
@@ -444,7 +444,7 @@
#endif
}
#endif
- DPRINTF(IDB_IOMMU, ("iommu_strbuf_flush: flushed\n"));
+ DPRINTF(IDB_IOMMU, ("iommu_strbuf_flush_done: flushed\n"));
return (is->is_flush);
}
@@ -810,11 +810,9 @@
DPRINTF(IDB_BUSDMA,
("iommu_dvmamap_sync: flushing va %p, %lu "
"bytes left\n", (void *)(u_long)va, (u_long)len));
- bus_space_write_8(is->is_bustag,
- (bus_space_handle_t)(u_long)
- &is->is_sb->strbuf_pgflush, 0, va);
+ iommu_strbuf_flush(is, va);
if (len <= NBPG) {
- iommu_strbuf_flush(is);
+ iommu_strbuf_flush_done(is);
len = 0;
} else
len -= NBPG;
@@ -825,7 +823,20 @@
DPRINTF(IDB_BUSDMA,
("iommu_dvmamap_sync: syncing va %p len %lu "
"BUS_DMASYNC_PREWRITE\n", (void *)(u_long)va, (u_long)len));
- /* Nothing to do */;
+ /* if we have a streaming buffer, flush it here first */
+ if (is->is_sb)
+ while (len > 0) {
+ DPRINTF(IDB_BUSDMA,
+ ("iommu_dvmamap_sync: flushing va %p, %lu "
+ "bytes left\n", (void *)(u_long)va, (u_long)len));
+ iommu_strbuf_flush(is, va);
+ if (len <= NBPG) {
+ iommu_strbuf_flush_done(is);
+ len = 0;
+ } else
+ len -= NBPG;
+ va += NBPG;
+ }
}
if (ops & BUS_DMASYNC_POSTWRITE) {
DPRINTF(IDB_BUSDMA,
Home |
Main Index |
Thread Index |
Old Index