diff options
author | marius <marius@FreeBSD.org> | 2009-02-10 21:51:33 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2009-02-10 21:51:33 +0000 |
commit | 840503d8f650fa1fda4580c8850b8293c9339bed (patch) | |
tree | 4996ad24f1bfd9f6d3adb86810e907d1834f9d1a /sys/sparc64 | |
parent | 9618354cad5d7984141563788baae57610de7d27 (diff) | |
download | FreeBSD-src-840503d8f650fa1fda4580c8850b8293c9339bed.zip FreeBSD-src-840503d8f650fa1fda4580c8850b8293c9339bed.tar.gz |
Improve r185008 so the streaming cache is only flushed when
a mapping actually met the threshold.
Diffstat (limited to 'sys/sparc64')
-rw-r--r-- | sys/sparc64/include/bus_private.h | 7 | ||||
-rw-r--r-- | sys/sparc64/sparc64/iommu.c | 12 |
2 files changed, 11 insertions, 8 deletions
diff --git a/sys/sparc64/include/bus_private.h b/sys/sparc64/include/bus_private.h index 9e5ab08..fb6f8d3 100644 --- a/sys/sparc64/include/bus_private.h +++ b/sys/sparc64/include/bus_private.h @@ -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); diff --git a/sys/sparc64/sparc64/iommu.c b/sys/sparc64/sparc64/iommu.c index cc1179d..88ab2c9 100644 --- a/sys/sparc64/sparc64/iommu.c +++ b/sys/sparc64/sparc64/iommu.c @@ -822,7 +822,7 @@ iommu_dvmamap_destroy(bus_dma_tag_t dt, bus_dmamap_t map) } /* - * 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 dt, struct iommu_state *is, 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 dt, struct iommu_state *is, 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 dt, struct iommu_state *is, 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_dmamap_t map, bus_dmasync_op_t op) /* 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); |