Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm Add storage for an iommu cookie in bus_dmamap_t...



details:   https://anonhg.NetBSD.org/src/rev/926e3716ba93
branches:  trunk
changeset: 1023265:926e3716ba93
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Aug 30 22:56:26 2021 +0000

description:
Add storage for an iommu cookie in bus_dmamap_t and store untranslated CPU
address in bus_dma_segment_t.

diffstat:

 sys/arch/arm/arm32/bus_dma.c    |  9 ++++++---
 sys/arch/arm/include/bus_defs.h |  4 +++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diffs (69 lines):

diff -r fe7cf5988ff7 -r 926e3716ba93 sys/arch/arm/arm32/bus_dma.c
--- a/sys/arch/arm/arm32/bus_dma.c      Mon Aug 30 22:54:40 2021 +0000
+++ b/sys/arch/arm/arm32/bus_dma.c      Mon Aug 30 22:56:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.132 2021/02/07 10:47:40 skrll Exp $      */
+/*     $NetBSD: bus_dma.c,v 1.133 2021/08/30 22:56:26 jmcneill Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 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.132 2021/02/07 10:47:40 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.133 2021/08/30 22:56:26 jmcneill Exp $");
 
 #include <sys/param.h>
 
@@ -259,6 +259,7 @@
                /* new segment */
                segs[nseg].ds_addr = curaddr;
                segs[nseg].ds_len = sgsize;
+               segs[nseg]._ds_paddr = curaddr;
                segs[nseg]._ds_flags = _ds_flags;
                nseg++;
        }
@@ -1717,7 +1718,8 @@
         */
        m = TAILQ_FIRST(&mlist);
        curseg = 0;
-       lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m);
+       lastaddr = segs[curseg].ds_addr = segs[curseg]._ds_paddr =
+           VM_PAGE_TO_PHYS(m);
        segs[curseg].ds_len = PAGE_SIZE;
 #ifdef DEBUG_DMA
                printf("alloc: page %#lx\n", lastaddr);
@@ -1742,6 +1744,7 @@
                                return EFBIG;
                        }
                        segs[curseg].ds_addr = curaddr;
+                       segs[curseg]._ds_paddr = curaddr;
                        segs[curseg].ds_len = PAGE_SIZE;
                }
                lastaddr = curaddr;
diff -r fe7cf5988ff7 -r 926e3716ba93 sys/arch/arm/include/bus_defs.h
--- a/sys/arch/arm/include/bus_defs.h   Mon Aug 30 22:54:40 2021 +0000
+++ b/sys/arch/arm/include/bus_defs.h   Mon Aug 30 22:56:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_defs.h,v 1.16 2021/04/23 06:02:48 skrll Exp $      */
+/*     $NetBSD: bus_defs.h,v 1.17 2021/08/30 22:56:26 jmcneill Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -377,6 +377,7 @@
         * PRIVATE MEMBERS:
         */
        uint32_t        _ds_flags;      /* _BUS_DMAMAP_COHERENT */
+       paddr_t         _ds_paddr;      /* CPU address */
 };
 typedef struct arm32_bus_dma_segment   bus_dma_segment_t;
 
@@ -481,6 +482,7 @@
        struct vmspace  *_dm_vmspace;   /* vmspace that owns the mapping */
 
        void            *_dm_cookie;    /* cookie for bus-specific functions */
+       void            *_dm_iommu;     /* cookie for iommu functions */
 
        /*
         * PUBLIC MEMBERS: these are used by machine-independent code.



Home | Main Index | Thread Index | Old Index