]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
mips: do mips_sync() on sync operations to uncachable memory.
authoradrian <adrian@FreeBSD.org>
Sat, 31 Oct 2015 00:29:26 +0000 (00:29 +0000)
committeradrian <adrian@FreeBSD.org>
Sat, 31 Oct 2015 00:29:26 +0000 (00:29 +0000)
mips24k/mips74k document that we need an explicit SYNC so to order
things correctly, even with access to uncachable memory.
We were doing calls to SYNC in the cache ops (inv, wbinv) but we
weren't doing it for uncachable memory.

sys/mips/mips/busdma_machdep.c

index 247335e016b261078c6b4ce85ffaf068cae58559..d9eb9d48106559d09646e17b462f6a0b4bafc2c4 100644 (file)
@@ -1220,11 +1220,12 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)
        if (STAILQ_FIRST(&map->bpages))
                _bus_dmamap_sync_bp(dmat, map, op);
 
-       if (dmat->flags & BUS_DMA_COHERENT)
-               return;
-
-       if (map->flags & DMAMAP_UNCACHEABLE)
+       if ((dmat->flags & BUS_DMA_COHERENT) ||
+           (map->flags & DMAMAP_UNCACHEABLE)) {
+               if (op & BUS_DMASYNC_PREWRITE)
+                       mips_sync();
                return;
+       }
 
        aligned = (map->flags & DMAMAP_CACHE_ALIGNED) ? 1 : 0;