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 Remove duplicate code in iommu_dvmamap_...



details:   https://anonhg.NetBSD.org/src/rev/84d5363857e7
branches:  trunk
changeset: 538664:84d5363857e7
user:      petrov <petrov%NetBSD.org@localhost>
date:      Thu Oct 24 23:24:01 2002 +0000

description:
Remove duplicate code in iommu_dvmamap_sync.

diffstat:

 sys/arch/sparc64/dev/iommu.c |  50 ++++++-------------------------------------
 1 files changed, 7 insertions(+), 43 deletions(-)

diffs (83 lines):

diff -r 7ec193f0334d -r 84d5363857e7 sys/arch/sparc64/dev/iommu.c
--- a/sys/arch/sparc64/dev/iommu.c      Thu Oct 24 23:08:07 2002 +0000
+++ b/sys/arch/sparc64/dev/iommu.c      Thu Oct 24 23:24:01 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iommu.c,v 1.61 2002/10/16 11:05:11 martin Exp $        */
+/*     $NetBSD: iommu.c,v 1.62 2002/10/24 23:24:01 petrov Exp $        */
 
 /*
  * Copyright (c) 2001, 2002 Eduardo Horvath
@@ -915,29 +915,24 @@
         * We only support one DMA segment; supporting more makes this code
         * too unwieldy.
         */
-#ifdef DIAGNOSTIC
        if (map->dm_nsegs > 1)
                panic("iommu_dvmamap_sync: %d segments", map->dm_nsegs);
-#endif
 
-       if (ops & BUS_DMASYNC_PREREAD) {
-               DPRINTF(IDB_SYNC,
-                   ("iommu_dvmamap_sync: syncing va %p len %lu "
-                    "BUS_DMASYNC_PREREAD\n", (void *)(u_long)va, (u_long)len));
+       DPRINTF(IDB_SYNC,
+           ("iommu_dvmamap_sync: syncing va %p len %lu "
+            "ops 0x%x\n", (void *)(u_long)va, (u_long)len, ops));
 
+       if (ops & (BUS_DMASYNC_PREREAD | BUS_DMASYNC_POSTWRITE)) {
                /* Nothing to do */;
        }
-       if (ops & BUS_DMASYNC_POSTREAD) {
+
+       if (ops & (BUS_DMASYNC_POSTREAD | BUS_DMASYNC_PREWRITE)) {
 #ifdef DIAGNOSTIC
                if (va < is->is_dvmabase || va >= is->is_dvmaend)
                        panic("iommu_dvmamap_sync: invalid dva %lx", va);
 #endif
                tte = is->is_tsb[IOTSBSLOT(va, is->is_tsbsize)];
 
-               DPRINTF(IDB_SYNC,
-                   ("iommu_dvmamap_sync: syncing va %p len %lu "
-                    "BUS_DMASYNC_POSTREAD\n", (void *)(u_long)va, (u_long)len));
-
                /* if we have a streaming buffer, flush it here first */
                if ((tte & IOTTE_STREAM) && sb->sb_flush) {
                        vaend = (va + len + PGOFSET) & ~PGOFSET;
@@ -952,37 +947,6 @@
                        iommu_strbuf_flush_done(sb);
                }
        }
-       if (ops & BUS_DMASYNC_PREWRITE) {
-#ifdef DIAGNOSTIC
-               if (va < is->is_dvmabase || va >= is->is_dvmaend)
-                       panic("iommu_dvmamap_sync: invalid dva %lx", va);
-#endif
-               tte = is->is_tsb[IOTSBSLOT(va, is->is_tsbsize)];
-
-               DPRINTF(IDB_SYNC,
-                   ("iommu_dvmamap_sync: syncing va %p len %lu "
-                    "BUS_DMASYNC_PREWRITE\n", (void *)(u_long)va, (u_long)len));
-
-               /* if we have a streaming buffer, flush it here first */
-               if ((tte & IOTTE_STREAM) && sb->sb_flush) {
-                       vaend = (va + len + PGOFSET) & ~PGOFSET;
-
-                       for (va &= ~PGOFSET; va <= vaend; va += NBPG) {
-                               DPRINTF(IDB_BUSDMA,
-                                       ("iommu_dvmamap_sync: flushing va %p\n",
-                                        (void *)(u_long)va));
-                               iommu_strbuf_flush(sb, va);
-                       }
-
-                       iommu_strbuf_flush_done(sb);
-               }
-       }
-       if (ops & BUS_DMASYNC_POSTWRITE) {
-               DPRINTF(IDB_SYNC,
-                   ("iommu_dvmamap_sync: syncing va %p len %lu "
-                    "BUS_DMASYNC_POSTWRITE\n", (void *)(u_long)va, (u_long)len));
-               /* Nothing to do */;
-       }
 }
 
 int



Home | Main Index | Thread Index | Old Index