Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/broadcom Simplify by using PMAP_NOCACHE



details:   https://anonhg.NetBSD.org/src/rev/888d5ed0d8e1
branches:  trunk
changeset: 783945:888d5ed0d8e1
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Jan 13 06:10:25 2013 +0000

description:
Simplify by using PMAP_NOCACHE

diffstat:

 sys/arch/arm/broadcom/bcm2835_space.c |  18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diffs (48 lines):

diff -r f53579dc3607 -r 888d5ed0d8e1 sys/arch/arm/broadcom/bcm2835_space.c
--- a/sys/arch/arm/broadcom/bcm2835_space.c     Sun Jan 13 04:39:28 2013 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_space.c     Sun Jan 13 06:10:25 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_space.c,v 1.2 2013/01/10 21:57:38 jmcneill Exp $       */
+/*     $NetBSD: bcm2835_space.c,v 1.3 2013/01/13 06:10:25 skrll 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.2 2013/01/10 21:57:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.3 2013/01/13 06:10:25 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -285,8 +285,8 @@
 {
        u_long startpa, endpa, pa;
        vaddr_t va;
-       pt_entry_t *pte;
        const struct pmap_devmap *pd;
+       int pmap_flags;
 
        if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) {
                /* Device was statically mapped. */
@@ -306,16 +306,10 @@
 
        *bshp = (bus_space_handle_t)(va + (bpa - startpa));
 
+       pmap_flags = (flag & BUS_SPACE_MAP_CACHEABLE) ? 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, 0);
-               if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0) {
-                       pte = vtopte(va);
-                       *pte &= ~L2_S_CACHE_MASK;
-                       PTE_SYNC(pte);
-                       /* XXX: pmap_kenter_pa() also does PTE_SYNC(). a bit of
-                        *      waste.
-                        */
-               }
+               pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE,
+                   pmap_flags);
        }
        pmap_update(pmap_kernel());
 



Home | Main Index | Thread Index | Old Index