svn commit: r188456 - in head/sys/sparc64: include sparc64
Marius Strobl
marius at FreeBSD.org
Tue Feb 10 13:51:34 PST 2009
Author: marius
Date: Tue Feb 10 21:51:33 2009
New Revision: 188456
URL: http://svn.freebsd.org/changeset/base/188456
Log:
Improve r185008 so the streaming cache is only flushed when
a mapping actually met the threshold.
Modified:
head/sys/sparc64/include/bus_private.h
head/sys/sparc64/sparc64/iommu.c
Modified: head/sys/sparc64/include/bus_private.h
==============================================================================
--- head/sys/sparc64/include/bus_private.h Tue Feb 10 21:48:42 2009 (r188455)
+++ head/sys/sparc64/include/bus_private.h Tue Feb 10 21:51:33 2009 (r188456)
@@ -66,9 +66,10 @@ struct bus_dmamap {
int dm_flags; /* (p) */
};
-/* Flag values. */
-#define DMF_LOADED 1 /* Map is loaded */
-#define DMF_COHERENT 2 /* Coherent mapping requested */
+/* Flag values */
+#define DMF_LOADED (1 << 0) /* Map is loaded. */
+#define DMF_COHERENT (1 << 1) /* Coherent mapping requested. */
+#define DMF_STREAMED (1 << 2) /* Streaming cache used. */
int sparc64_dma_alloc_map(bus_dma_tag_t dmat, bus_dmamap_t *mapp);
void sparc64_dma_free_map(bus_dma_tag_t dmat, bus_dmamap_t map);
Modified: head/sys/sparc64/sparc64/iommu.c
==============================================================================
--- head/sys/sparc64/sparc64/iommu.c Tue Feb 10 21:48:42 2009 (r188455)
+++ head/sys/sparc64/sparc64/iommu.c Tue Feb 10 21:51:33 2009 (r188456)
@@ -822,7 +822,7 @@ iommu_dvmamap_destroy(bus_dma_tag_t dt,
}
/*
- * IOMMU DVMA operations, common to PCI and SBus.
+ * IOMMU DVMA operations, common to PCI and SBus
*/
static int
iommu_dvmamap_load_buffer(bus_dma_tag_t dt, struct iommu_state *is,
@@ -833,8 +833,8 @@ iommu_dvmamap_load_buffer(bus_dma_tag_t
bus_size_t sgsize, esize;
vm_offset_t vaddr, voffs;
vm_paddr_t curaddr;
- int error, sgcnt, firstpg, stream;
pmap_t pmap = NULL;
+ int error, firstpg, sgcnt;
KASSERT(buflen != 0, ("%s: buflen == 0!", __func__));
if (buflen > dt->dt_maxsize)
@@ -855,7 +855,9 @@ iommu_dvmamap_load_buffer(bus_dma_tag_t
sgcnt = *segp;
firstpg = 1;
- stream = iommu_use_streaming(is, map, buflen);
+ map->dm_flags &= ~DMF_STREAMED;
+ map->dm_flags |= iommu_use_streaming(is, map, buflen) != 0 ?
+ DMF_STREAMED : 0;
for (; buflen > 0; ) {
/*
* Get the physical address for this page.
@@ -876,7 +878,7 @@ iommu_dvmamap_load_buffer(bus_dma_tag_t
vaddr += sgsize;
iommu_enter(is, trunc_io_page(dvmaddr), trunc_io_page(curaddr),
- stream, flags);
+ (map->dm_flags & DMF_STREAMED) != 0, flags);
/*
* Chop the chunk up into segments of at most maxsegsz, but try
@@ -1141,7 +1143,7 @@ iommu_dvmamap_sync(bus_dma_tag_t dt, bus
/* XXX This is probably bogus. */
if ((op & BUS_DMASYNC_PREREAD) != 0)
membar(Sync);
- if ((map->dm_flags & DMF_COHERENT) == 0 && IOMMU_HAS_SB(is) &&
+ if ((map->dm_flags & DMF_STREAMED) != 0 &&
((op & BUS_DMASYNC_POSTREAD) != 0 ||
(op & BUS_DMASYNC_PREWRITE) != 0)) {
IS_LOCK(is);
More information about the svn-src-head
mailing list