Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/arm32 bus_dmamem_map: honour BUS_DMA_PREFETCHAB...



details:   https://anonhg.NetBSD.org/src/rev/39c1f63bd042
branches:  trunk
changeset: 460825:39c1f63bd042
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Nov 05 09:57:47 2019 +0000

description:
bus_dmamem_map: honour BUS_DMA_PREFETCHABLE hint

diffstat:

 sys/arch/arm/arm32/bus_dma.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r a668596bc5ca -r 39c1f63bd042 sys/arch/arm/arm32/bus_dma.c
--- a/sys/arch/arm/arm32/bus_dma.c      Tue Nov 05 04:09:51 2019 +0000
+++ b/sys/arch/arm/arm32/bus_dma.c      Tue Nov 05 09:57:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.116 2019/08/24 11:51:26 jmcneill Exp $   */
+/*     $NetBSD: bus_dma.c,v 1.117 2019/11/05 09:57:47 jmcneill Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.116 2019/08/24 11:51:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.117 2019/11/05 09:57:47 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1426,6 +1426,7 @@
                    pa < (segs[curseg].ds_addr + segs[curseg].ds_len);
                    pa += PAGE_SIZE, va += PAGE_SIZE, size -= PAGE_SIZE) {
                        bool uncached = (flags & BUS_DMA_COHERENT);
+                       bool prefetchable = (flags & BUS_DMA_PREFETCHABLE);
 #ifdef DEBUG_DMA
                        printf("wiring p%lx to v%lx", pa, va);
 #endif /* DEBUG_DMA */
@@ -1443,8 +1444,14 @@
                                uncached = false;
                        }
 
+                       u_int pmap_flags = PMAP_WIRED;
+                       if (prefetchable)
+                               pmap_flags |= PMAP_WRITE_COMBINE;
+                       else if (uncached)
+                               pmap_flags |= PMAP_NOCACHE;
+
                        pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE,
-                           PMAP_WIRED | (uncached ? PMAP_NOCACHE : 0));
+                           pmap_flags);
                }
        }
        pmap_update(pmap_kernel());



Home | Main Index | Thread Index | Old Index