Source-Changes-HG archive

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

[src/trunk]: src/sys/arch * Add PTE_SYNC() and PTE_SYNC_RANGE() macros. Thes...



details:   https://anonhg.NetBSD.org/src/rev/7383cf7abe1a
branches:  trunk
changeset: 535540:7383cf7abe1a
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Aug 22 01:13:53 2002 +0000

description:
* Add PTE_SYNC() and PTE_SYNC_RANGE() macros.  These don't actually do
  anything yet.
* Use PTE_SYNC() and PTE_SYNC_RANGE() in some obvious places, i.e.
  where vtopte() is used.

diffstat:

 sys/arch/acorn32/acorn32/rpc_machdep.c    |   5 +++--
 sys/arch/acorn32/podulebus/esc.c          |   5 +++--
 sys/arch/acorn32/podulebus/sfas.c         |   3 ++-
 sys/arch/arm/arm32/bus_dma.c              |   3 ++-
 sys/arch/arm/arm32/db_interface.c         |   6 +++++-
 sys/arch/arm/arm32/pmap.c                 |  11 +++++++++--
 sys/arch/arm/arm32/vm_machdep.c           |   7 +++++--
 sys/arch/arm/include/arm32/pmap.h         |  14 +++++++++++++-
 sys/arch/arm/mainbus/mainbus_io.c         |   6 ++++--
 sys/arch/arm/sa11x0/sa11x0_io.c           |   6 ++++--
 sys/arch/evbarm/iq80310/obio_space.c      |   3 ++-
 sys/arch/evbarm/ixm1200/ixm1200_machdep.c |   3 ++-
 sys/arch/hpcarm/hpcarm/hpc_machdep.c      |   3 ++-
 sys/arch/shark/ofw/ofw.c                  |   7 +++++--
 sys/arch/shark/shark/ipkdb_glue.c         |   4 +++-
 15 files changed, 64 insertions(+), 22 deletions(-)

diffs (truncated from 392 to 300 lines):

diff -r 6b32993e3902 -r 7383cf7abe1a sys/arch/acorn32/acorn32/rpc_machdep.c
--- a/sys/arch/acorn32/acorn32/rpc_machdep.c    Thu Aug 22 01:03:41 2002 +0000
+++ b/sys/arch/acorn32/acorn32/rpc_machdep.c    Thu Aug 22 01:13:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_machdep.c,v 1.39 2002/08/21 18:34:31 thorpej Exp $ */
+/*     $NetBSD: rpc_machdep.c,v 1.40 2002/08/22 01:13:53 thorpej Exp $ */
 
 /*
  * Copyright (c) 2000-2001 Reinoud Zandijk.
@@ -55,7 +55,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: rpc_machdep.c,v 1.39 2002/08/21 18:34:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpc_machdep.c,v 1.40 2002/08/22 01:13:53 thorpej Exp $");
 
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -1112,6 +1112,7 @@
                pte = vtopte(sa110_cc_base + loop);
                *pte = L2_S_PROTO | kaddr |
                    L2_S_PROT(PTE_KERNEL, VM_PROT_READ) | pte_l2_s_cache_mode;
+               PTE_SYNC(pte);
        }
        sa1_cache_clean_addr = sa110_cc_base;
        sa1_cache_clean_size = CPU_SA110_CACHE_CLEAN_SIZE / 2;
diff -r 6b32993e3902 -r 7383cf7abe1a sys/arch/acorn32/podulebus/esc.c
--- a/sys/arch/acorn32/podulebus/esc.c  Thu Aug 22 01:03:41 2002 +0000
+++ b/sys/arch/acorn32/podulebus/esc.c  Thu Aug 22 01:13:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: esc.c,v 1.7 2002/04/05 16:58:02 thorpej Exp $  */
+/*     $NetBSD: esc.c,v 1.8 2002/08/22 01:13:54 thorpej Exp $  */
 
 /*
  * Copyright (c) 1995 Scott Stevens
@@ -55,7 +55,7 @@
 
 #include <sys/param.h>
 
-__RCSID("$NetBSD: esc.c,v 1.7 2002/04/05 16:58:02 thorpej Exp $");
+__RCSID("$NetBSD: esc.c,v 1.8 2002/08/22 01:13:54 thorpej Exp $");
 
 #include <sys/systm.h>
 #include <sys/device.h>
@@ -221,6 +221,7 @@
  */
        pte = vtopte((vaddr_t) dev->sc_bump_va);
        *pte &= ~L2_C;
+       PTE_SYNC(pte);
        cpu_tlb_flushD();
        cpu_dcache_wbinv_range((vm_offset_t)dev->sc_bump_va, NBPG);
 
diff -r 6b32993e3902 -r 7383cf7abe1a sys/arch/acorn32/podulebus/sfas.c
--- a/sys/arch/acorn32/podulebus/sfas.c Thu Aug 22 01:03:41 2002 +0000
+++ b/sys/arch/acorn32/podulebus/sfas.c Thu Aug 22 01:13:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sfas.c,v 1.6 2002/04/05 16:58:02 thorpej Exp $ */
+/*     $NetBSD: sfas.c,v 1.7 2002/08/22 01:13:54 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995 Scott Stevens
@@ -205,6 +205,7 @@
  */
        pte = vtopte((vaddr_t) dev->sc_bump_va);
        *pte &= ~(L2_C | L2_B);
+       PTE_SYNC(pte);
        cpu_tlb_flushD();
        cpu_dcache_wbinv_range((vm_offset_t)dev->sc_bump_va, NBPG);
 
diff -r 6b32993e3902 -r 7383cf7abe1a sys/arch/arm/arm32/bus_dma.c
--- a/sys/arch/arm/arm32/bus_dma.c      Thu Aug 22 01:03:41 2002 +0000
+++ b/sys/arch/arm/arm32/bus_dma.c      Thu Aug 22 01:13:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.20 2002/08/17 05:14:10 briggs Exp $      */
+/*     $NetBSD: bus_dma.c,v 1.21 2002/08/22 01:13:54 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -716,6 +716,7 @@
                                cpu_drain_writebuf();
                                ptep = vtopte(va);
                                *ptep &= ~L2_S_CACHE_MASK;
+                               PTE_SYNC(ptep);
                                tlb_flush();
                        }
 #ifdef DEBUG_DMA
diff -r 6b32993e3902 -r 7383cf7abe1a sys/arch/arm/arm32/db_interface.c
--- a/sys/arch/arm/arm32/db_interface.c Thu Aug 22 01:03:41 2002 +0000
+++ b/sys/arch/arm/arm32/db_interface.c Thu Aug 22 01:13:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.21 2002/05/13 20:30:08 matt Exp $   */
+/*     $NetBSD: db_interface.c,v 1.22 2002/08/22 01:13:55 thorpej Exp $        */
 
 /* 
  * Copyright (c) 1996 Scott K. Stevens
@@ -219,6 +219,7 @@
 
                        tmppde = oldpde | L1_S_PROT_W;
                        *pde = tmppde;
+                       PTE_SYNC(pde);
                        break;
 
                case L1_TYPE_C:
@@ -229,6 +230,7 @@
                        oldpte = *pte;
                        tmppte = oldpte | L2_S_PROT_W;
                        *pte = tmppte;
+                       PTE_SYNC(pte);
                        break;
 
                default:
@@ -256,10 +258,12 @@
                switch (oldpde & L1_TYPE_MASK) {
                case L1_TYPE_S:
                        *pde = oldpde;
+                       PTE_SYNC(pde);
                        break;
 
                case L1_TYPE_C:
                        *pte = oldpte;
+                       PTE_SYNC(pte);
                        break;
                }
                cpu_tlb_flushD_SE(pgva);
diff -r 6b32993e3902 -r 7383cf7abe1a sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Thu Aug 22 01:03:41 2002 +0000
+++ b/sys/arch/arm/arm32/pmap.c Thu Aug 22 01:13:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.111 2002/08/21 21:22:52 thorpej Exp $       */
+/*     $NetBSD: pmap.c,v 1.112 2002/08/22 01:13:55 thorpej Exp $       */
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -143,7 +143,7 @@
 #include <machine/param.h>
 #include <arm/arm32/katelib.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.111 2002/08/21 21:22:52 thorpej Exp $");        
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.112 2002/08/22 01:13:55 thorpej Exp $");        
 #ifdef PMAP_DEBUG
 #define        PDEBUG(_lev_,_stat_) \
        if (pmap_debug_level >= (_lev_)) \
@@ -965,6 +965,7 @@
 
                *pte = L2_S_PROTO | spa |
                    L2_S_PROT(PTE_KERNEL, prot) | pte_l2_s_cache_mode;
+               PTE_SYNC(pte);
                cpu_tlb_flushID_SE(va);
                va += NBPG;
                spa += NBPG;
@@ -1305,6 +1306,7 @@
 
        *pte = L2_S_PROTO | VM_PAGE_TO_PHYS(pg) |
             L2_S_PROT(PTE_KERNEL, VM_PROT_READ|VM_PROT_WRITE);
+       PTE_SYNC(pte);
 #ifdef PMAP_ALIAS_DEBUG
     {
        int s = splhigh();
@@ -2871,12 +2873,15 @@
 
        *pte = L2_S_PROTO | pa |
            L2_S_PROT(PTE_KERNEL, prot) | pte_l2_s_cache_mode;
+       PTE_SYNC(pte);
 }
 
 void
 pmap_kremove(vaddr_t va, vsize_t len)
 {
        pt_entry_t *pte;
+       vaddr_t ova = va;
+       vaddr_t olen = len;
 
        for (len >>= PAGE_SHIFT; len > 0; len--, va += PAGE_SIZE) {
 
@@ -2910,6 +2915,7 @@
                *pte = 0;
                cpu_tlb_flushID_SE(va);
        }
+       PTE_SYNC_RANGE(vtopte(ova), olen >> PAGE_SHIFT);
 }
 
 /*
@@ -3641,6 +3647,7 @@
        pte = vtopte(vector_page);
 
        *pte = (*pte & ~L1_S_PROT_MASK) | L2_S_PROT(PTE_KERNEL, prot);
+       PTE_SYNC(pte);
        cpu_tlb_flushD_SE(vector_page);
        cpu_cpwait();
 }
diff -r 6b32993e3902 -r 7383cf7abe1a sys/arch/arm/arm32/vm_machdep.c
--- a/sys/arch/arm/arm32/vm_machdep.c   Thu Aug 22 01:03:41 2002 +0000
+++ b/sys/arch/arm/arm32/vm_machdep.c   Thu Aug 22 01:13:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.19 2002/08/09 23:44:17 thorpej Exp $  */
+/*     $NetBSD: vm_machdep.c,v 1.20 2002/08/22 01:13:55 thorpej Exp $  */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -291,7 +291,8 @@
        caddr_t from, to;
        size_t size;
 {
-       register pt_entry_t *fpte, *tpte;
+       pt_entry_t *fpte, *tpte;
+       size_t ptecnt = size >> PAGE_SHIFT;
 
        if (size % NBPG)
                panic("pagemove: size=%08lx", (u_long) size);
@@ -319,6 +320,8 @@
                *fpte++ = 0;
                size -= NBPG;
        }
+       PTE_SYNC_RANGE(vtopte((vaddr_t)from), ptecnt);
+       PTE_SYNC_RANGE(vtopte((vaddr_t)to), ptecnt);
        //cpu_tlb_flushD();
 }
 
diff -r 6b32993e3902 -r 7383cf7abe1a sys/arch/arm/include/arm32/pmap.h
--- a/sys/arch/arm/include/arm32/pmap.h Thu Aug 22 01:03:41 2002 +0000
+++ b/sys/arch/arm/include/arm32/pmap.h Thu Aug 22 01:13:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.56 2002/08/09 23:08:39 thorpej Exp $        */
+/*     $NetBSD: pmap.h,v 1.57 2002/08/22 01:13:55 thorpej Exp $        */
 
 /*
  * Copyright (c 2002 Wasabi Systems, Inc.
@@ -231,6 +231,18 @@
 #define vtophys(va) \
        ((*vtopte(va) & L2_S_FRAME) | ((vaddr_t) (va) & L2_S_OFFSET))
 
+#if 0 /* Not yet... */
+#define        PTE_SYNC(pte) \
+       cpu_dcache_wb_range((vaddr_t)(pte), sizeof(pt_entry_t))
+
+#define        PTE_SYNC_RANGE(pte, cnt) \
+       cpu_dcache_wb_range((vaddr_t)(pte), (cnt) << 2) /* * sizeof(...) */
+#else
+#define        PTE_SYNC(pte)                   (void)(pte)
+
+#define        PTE_SYNC_RANGE(pte, cnt)        (void)(pte), (void)(cnt)
+#endif
+
 #define        l1pte_valid(pde)        ((pde) != 0)
 #define        l1pte_section_p(pde)    (((pde) & L1_TYPE_MASK) == L1_TYPE_S)
 #define        l1pte_page_p(pde)       (((pde) & L1_TYPE_MASK) == L1_TYPE_C)
diff -r 6b32993e3902 -r 7383cf7abe1a sys/arch/arm/mainbus/mainbus_io.c
--- a/sys/arch/arm/mainbus/mainbus_io.c Thu Aug 22 01:03:41 2002 +0000
+++ b/sys/arch/arm/mainbus/mainbus_io.c Thu Aug 22 01:13:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus_io.c,v 1.10 2002/04/09 22:37:02 thorpej Exp $  */
+/*     $NetBSD: mainbus_io.c,v 1.11 2002/08/22 01:13:56 thorpej Exp $  */
 
 /*
  * Copyright (c) 1997 Mark Brinicombe.
@@ -162,8 +162,10 @@
        for(pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
                pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
                pte = vtopte(va);
-               if (cacheable == 0)
+               if (cacheable == 0) {
                        *pte &= ~L2_S_CACHE_MASK;
+                       PTE_SYNC(pte);
+               }
        }
        pmap_update(pmap_kernel());
 
diff -r 6b32993e3902 -r 7383cf7abe1a sys/arch/arm/sa11x0/sa11x0_io.c
--- a/sys/arch/arm/sa11x0/sa11x0_io.c   Thu Aug 22 01:03:41 2002 +0000
+++ b/sys/arch/arm/sa11x0/sa11x0_io.c   Thu Aug 22 01:13:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sa11x0_io.c,v 1.8 2002/05/03 03:32:54 thorpej Exp $    */
+/*     $NetBSD: sa11x0_io.c,v 1.9 2002/08/22 01:13:56 thorpej Exp $    */
 
 /*
  * Copyright (c) 1997 Mark Brinicombe.
@@ -167,8 +167,10 @@
        for(pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
                pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
                pte = vtopte(va);
-               if (cacheable == 0)
+               if (cacheable == 0) {
                        *pte &= ~L2_S_CACHE_MASK;
+                       PTE_SYNC(pte);
+               }
        }
        pmap_update(pmap_kernel());
 
diff -r 6b32993e3902 -r 7383cf7abe1a sys/arch/evbarm/iq80310/obio_space.c
--- a/sys/arch/evbarm/iq80310/obio_space.c      Thu Aug 22 01:03:41 2002 +0000
+++ b/sys/arch/evbarm/iq80310/obio_space.c      Thu Aug 22 01:13:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obio_space.c,v 1.6 2002/04/12 19:02:31 thorpej Exp $   */
+/*     $NetBSD: obio_space.c,v 1.7 2002/08/22 01:13:57 thorpej Exp $   */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -171,6 +171,7 @@
                        pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
                        pte = vtopte(va);



Home | Main Index | Thread Index | Old Index