Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/arch/arm/broadcom Pull up the following revisions, re...



details:   https://anonhg.NetBSD.org/src/rev/fa19987fa5e0
branches:  netbsd-8
changeset: 434571:fa19987fa5e0
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jan 16 14:21:10 2018 +0000

description:
Pull up the following revisions, requested by skrll in #408:

        sys/arch/arm/broadcom/bcm2835_space.c           1.12-1.13

Sync with armv7_generic_space.c
- big endian support (probably not needed)
- a4x subreagion/mmap support
- fix some a4x stream methods
- add UVM_KMF_COLORMATCH in bs_map when allocating KVA
- support BUS_SPACE_MAP_PREFETCHABLE

diffstat:

 sys/arch/arm/broadcom/bcm2835_space.c |  159 ++++++++++++++++++++-------------
 1 files changed, 94 insertions(+), 65 deletions(-)

diffs (truncated from 339 to 300 lines):

diff -r 8db3c1c7c44a -r fa19987fa5e0 sys/arch/arm/broadcom/bcm2835_space.c
--- a/sys/arch/arm/broadcom/bcm2835_space.c     Tue Jan 16 14:15:50 2018 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_space.c     Tue Jan 16 14:21:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_space.c,v 1.10 2016/02/02 13:55:50 skrll Exp $ */
+/*     $NetBSD: bcm2835_space.c,v 1.10.10.1 2018/01/16 14:21:10 martin Exp $   */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.10 2016/02/02 13:55:50 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.10.10.1 2018/01/16 14:21:10 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -51,6 +51,12 @@
 bs_protos(a4x);
 bs_protos(bs_notimpl);
 
+#if __ARMEB__
+#define NSWAP(n)       n ## _swap
+#else
+#define NSWAP(n)       n
+#endif
+
 struct bus_space bcm2835_bs_tag = {
        /* cookie */
        (void *) 0,
@@ -75,38 +81,38 @@
 
        /* read (single) */
        generic_bs_r_1,
-       generic_armv4_bs_r_2,
-       generic_bs_r_4,
+       NSWAP(generic_armv4_bs_r_2),
+       NSWAP(generic_bs_r_4),
        bs_notimpl_bs_r_8,
 
        /* read multiple */
        generic_bs_rm_1,
-       generic_armv4_bs_rm_2,
-       generic_bs_rm_4,
+       NSWAP(generic_armv4_bs_rm_2),
+       NSWAP(generic_bs_rm_4),
        bs_notimpl_bs_rm_8,
 
        /* read region */
        generic_bs_rr_1,
-       generic_armv4_bs_rr_2,
-       generic_bs_rr_4,
+       NSWAP(generic_armv4_bs_rr_2),
+       NSWAP(generic_bs_rr_4),
        bs_notimpl_bs_rr_8,
 
        /* write (single) */
        generic_bs_w_1,
-       generic_armv4_bs_w_2,
-       generic_bs_w_4,
+       NSWAP(generic_armv4_bs_w_2),
+       NSWAP(generic_bs_w_4),
        bs_notimpl_bs_w_8,
 
        /* write multiple */
        generic_bs_wm_1,
-       generic_armv4_bs_wm_2,
-       generic_bs_wm_4,
+       NSWAP(generic_armv4_bs_wm_2),
+       NSWAP(generic_bs_wm_4),
        bs_notimpl_bs_wm_8,
 
        /* write region */
        generic_bs_wr_1,
-       generic_armv4_bs_wr_2,
-       generic_bs_wr_4,
+       NSWAP(generic_armv4_bs_wr_2),
+       NSWAP(generic_bs_wr_4),
        bs_notimpl_bs_wr_8,
 
        /* set multiple */
@@ -117,8 +123,8 @@
 
        /* set region */
        generic_bs_sr_1,
-       generic_armv4_bs_sr_2,
-       bs_notimpl_bs_sr_4,
+       NSWAP(generic_armv4_bs_sr_2),
+       NSWAP(generic_bs_sr_4),
        bs_notimpl_bs_sr_8,
 
        /* copy */
@@ -130,38 +136,38 @@
 #ifdef __BUS_SPACE_HAS_STREAM_METHODS
        /* read (single) */
        generic_bs_r_1,
-       generic_armv4_bs_r_2,
-       generic_bs_r_4,
+       NSWAP(generic_armv4_bs_r_2),
+       NSWAP(generic_bs_r_4),
        bs_notimpl_bs_r_8,
 
        /* read multiple */
        generic_bs_rm_1,
-       generic_armv4_bs_rm_2,
-       generic_bs_rm_4,
+       NSWAP(generic_armv4_bs_rm_2),
+       NSWAP(generic_bs_rm_4),
        bs_notimpl_bs_rm_8,
 
        /* read region */
        generic_bs_rr_1,
-       generic_armv4_bs_rr_2,
-       generic_bs_rr_4,
+       NSWAP(generic_armv4_bs_rr_2),
+       NSWAP(generic_bs_rr_4),
        bs_notimpl_bs_rr_8,
 
        /* write (single) */
        generic_bs_w_1,
-       generic_armv4_bs_w_2,
-       generic_bs_w_4,
+       NSWAP(generic_armv4_bs_w_2),
+       NSWAP(generic_bs_w_4),
        bs_notimpl_bs_w_8,
 
        /* write multiple */
        generic_bs_wm_1,
-       generic_armv4_bs_wm_2,
-       generic_bs_wm_4,
+       NSWAP(generic_armv4_bs_wm_2),
+       NSWAP(generic_bs_wm_4),
        bs_notimpl_bs_wm_8,
 
        /* write region */
        generic_bs_wr_1,
-       generic_armv4_bs_wr_2,
-       generic_bs_wr_4,
+       NSWAP(generic_armv4_bs_wr_2),
+       NSWAP(generic_bs_wr_4),
        bs_notimpl_bs_wr_8,
 #endif
 };
@@ -173,7 +179,7 @@
        /* mapping/unmapping */
        bcm2835_bs_map,
        bcm2835_bs_unmap,
-       bcm2835_bs_subregion,
+       bcm2835_a4x_bs_subregion,
 
        /* allocation/deallocation */
        bcm2835_bs_alloc,       /* not implemented */
@@ -183,21 +189,21 @@
        bcm2835_bs_vaddr,
 
        /* mmap */
-       bs_notimpl_bs_mmap,
+       bcm2835_a4x_bs_mmap,
 
        /* barrier */
        bcm2835_bs_barrier,
 
        /* read (single) */
        a4x_bs_r_1,
-       a4x_bs_r_2,
-       a4x_bs_r_4,
+       NSWAP(a4x_bs_r_2),
+       NSWAP(a4x_bs_r_4),
        bs_notimpl_bs_r_8,
 
        /* read multiple */
        a4x_bs_rm_1,
-       a4x_bs_rm_2,
-       a4x_bs_rm_4,
+       NSWAP(a4x_bs_rm_2),
+       NSWAP(a4x_bs_rm_4),
        bs_notimpl_bs_rm_8,
 
        /* read region */
@@ -208,15 +214,16 @@
 
        /* write (single) */
        a4x_bs_w_1,
-       a4x_bs_w_2,
-       a4x_bs_w_4,
+       NSWAP(a4x_bs_w_2),
+       NSWAP(a4x_bs_w_4),
        bs_notimpl_bs_w_8,
 
        /* write multiple */
        a4x_bs_wm_1,
-       a4x_bs_wm_2,
-       a4x_bs_wm_4,
+       NSWAP(a4x_bs_wm_2),
+       NSWAP(a4x_bs_wm_4),
        bs_notimpl_bs_wm_8,
+
        /* write region */
        bs_notimpl_bs_wr_1,
        bs_notimpl_bs_wr_2,
@@ -243,39 +250,39 @@
 
 #ifdef __BUS_SPACE_HAS_STREAM_METHODS
        /* read (single) */
-       generic_bs_r_1,
-       generic_armv4_bs_r_2,
-       generic_bs_r_4,
+       a4x_bs_r_1,
+       NSWAP(a4x_bs_r_2),
+       NSWAP(a4x_bs_r_4),
        bs_notimpl_bs_r_8,
 
        /* read multiple */
-       generic_bs_rm_1,
-       generic_armv4_bs_rm_2,
-       generic_bs_rm_4,
+       a4x_bs_rm_1,
+       NSWAP(a4x_bs_rm_2),
+       NSWAP(a4x_bs_rm_4),
        bs_notimpl_bs_rm_8,
 
        /* read region */
-       generic_bs_rr_1,
-       generic_armv4_bs_rr_2,
-       generic_bs_rr_4,
+       bs_notimpl_bs_rr_1,
+       bs_notimpl_bs_rr_2,
+       bs_notimpl_bs_rr_4,
        bs_notimpl_bs_rr_8,
 
        /* write (single) */
-       generic_bs_w_1,
-       generic_armv4_bs_w_2,
-       generic_bs_w_4,
+       a4x_bs_w_1,
+       NSWAP(a4x_bs_w_2),
+       NSWAP(a4x_bs_w_4),
        bs_notimpl_bs_w_8,
 
        /* write multiple */
-       generic_bs_wm_1,
-       generic_armv4_bs_wm_2,
-       generic_bs_wm_4,
+       a4x_bs_wm_1,
+       NSWAP(a4x_bs_wm_2),
+       NSWAP(a4x_bs_wm_4),
        bs_notimpl_bs_wm_8,
 
        /* write region */
-       generic_bs_wr_1,
-       generic_armv4_bs_wr_2,
-       generic_bs_wr_4,
+       bs_notimpl_bs_wr_1,
+       bs_notimpl_bs_wr_2,
+       bs_notimpl_bs_wr_4,
        bs_notimpl_bs_wr_8,
 #endif
 
@@ -289,7 +296,6 @@
        u_long startpa, endpa, pa;
        vaddr_t va;
        const struct pmap_devmap *pd;
-       int pmap_flags;
        bool match = false;
 
        /* Attempt to find the PA device mapping */
@@ -322,16 +328,18 @@
        /* XXX use extent manager to check duplicate mapping */
 
        va = uvm_km_alloc(kernel_map, endpa - startpa, 0,
-           UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
+           UVM_KMF_VAONLY | UVM_KMF_NOWAIT | UVM_KMF_COLORMATCH);
        if (!va)
                return ENOMEM;
 
        *bshp = (bus_space_handle_t)(va + (pa - startpa));
 
-       pmap_flags = (flag & BUS_SPACE_MAP_CACHEABLE) ? 0 : PMAP_NOCACHE;
+       const int pmapflags =
+           (flag & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE))
+               ? 0
+               : PMAP_NOCACHE;
        for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
-               pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE,
-                   pmap_flags);
+               pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, pmapflags);
        }
        pmap_update(pmap_kernel());
 
@@ -364,7 +372,16 @@
 {
 
        *nbshp = bsh + offset;
-       return (0);
+       return 0;
+}
+
+int
+bcm2835_a4x_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,



Home | Main Index | Thread Index | Old Index