Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc Implement HyperSPARC specific pmap_{zero, copy...



details:   https://anonhg.NetBSD.org/src/rev/fc4159ca980b
branches:  trunk
changeset: 485584:fc4159ca980b
user:      pk <pk%NetBSD.org@localhost>
date:      Mon May 01 14:06:41 2000 +0000

description:
Implement HyperSPARC specific pmap_{zero,copy}_page functions.

diffstat:

 sys/arch/sparc/include/pmap.h |   4 +-
 sys/arch/sparc/sparc/pmap.c   |  99 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 101 insertions(+), 2 deletions(-)

diffs (159 lines):

diff -r 0cc001660b5d -r fc4159ca980b sys/arch/sparc/include/pmap.h
--- a/sys/arch/sparc/include/pmap.h     Mon May 01 14:05:53 2000 +0000
+++ b/sys/arch/sparc/include/pmap.h     Mon May 01 14:06:41 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.45 2000/04/30 21:09:43 pk Exp $ */
+/*     $NetBSD: pmap.h,v 1.46 2000/05/01 14:06:43 pk Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -301,6 +301,7 @@
 boolean_t      pmap_clear_reference4m __P((struct vm_page *));
 void           pmap_copy_page4m __P((paddr_t, paddr_t));
 void           pmap_copy_page_viking_mxcc(paddr_t, paddr_t);
+void           pmap_copy_page_hypersparc(paddr_t, paddr_t);
 int            pmap_enter4m __P((pmap_t, vaddr_t, paddr_t, vm_prot_t,
                    int));
 boolean_t      pmap_extract4m __P((pmap_t, vaddr_t, paddr_t *));
@@ -313,6 +314,7 @@
 void           pmap_protect4m __P((pmap_t, vaddr_t, vaddr_t, vm_prot_t));
 void           pmap_zero_page4m __P((paddr_t));
 void           pmap_zero_page_viking_mxcc(paddr_t);
+void           pmap_zero_page_hypersparc(paddr_t);
 void           pmap_changeprot4m __P((pmap_t, vaddr_t, vm_prot_t, int));
 
 #endif /* defined SUN4M */
diff -r 0cc001660b5d -r fc4159ca980b sys/arch/sparc/sparc/pmap.c
--- a/sys/arch/sparc/sparc/pmap.c       Mon May 01 14:05:53 2000 +0000
+++ b/sys/arch/sparc/sparc/pmap.c       Mon May 01 14:06:41 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.158 2000/04/30 21:22:28 pk Exp $ */
+/*     $NetBSD: pmap.c,v 1.159 2000/05/01 14:06:41 pk Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -6622,6 +6622,9 @@
        setpgt4m(vpage_pte[0], SRMMU_TEINVALID);
 }
 
+/*
+ * Viking/MXCC specific version of pmap_zero_page
+ */
 void
 pmap_zero_page_viking_mxcc(pa)
        paddr_t pa;
@@ -6644,6 +6647,46 @@
 }
 
 /*
+ * HyperSPARC/RT625 specific version of pmap_zero_page
+ */
+void
+pmap_zero_page_hypersparc(pa)
+       paddr_t pa;
+{
+       caddr_t va;
+       int pte;
+       int offset;
+
+       /*
+        * We still have to map the page, since ASI_BLOCKFILL
+        * takes virtual addresses. This also means we have to
+        * consider cache aliasing; therefore we still need
+        * to flush the cache here. All we gain is the speed-up
+        * in zero-fill loop itself..
+        */
+       if (((pa & (PMAP_TNC_SRMMU & ~PMAP_NC)) == 0) && managed(pa)) {
+               /*
+                * The following might not be necessary since the page
+                * is being cleared because it is about to be allocated,
+                * i.e., is in use by no one.
+                */
+               if (CACHEINFO.c_vactype != VAC_NONE)
+                       pv_flushcache(pvhead(pa));
+       }
+       pte = SRMMU_TEPTE | SRMMU_PG_C | PPROT_N_RWX |
+               (atop(pa) << SRMMU_PPNSHIFT);
+
+       va = vpage[0];
+       setpgt4m(vpage_pte[0], pte);
+       for (offset = 0; offset < NBPG; offset += 32) {
+               sta(va + offset, ASI_BLOCKFILL, 0);
+       }
+       /* Remove temporary mapping */
+       tlb_flush_page(va);
+       setpgt4m(vpage_pte[0], SRMMU_TEINVALID);
+}
+
+/*
  * Copy the given MI physical source page to its destination.
  *
  * We avoid stomping on the cache as above (with same `XXX' note).
@@ -6689,6 +6732,9 @@
        setpgt4m(vpage_pte[1], SRMMU_TEINVALID);
 }
 
+/*
+ * Viking/MXCC specific version of pmap_copy_page
+ */
 void
 pmap_copy_page_viking_mxcc(src, dst)
        paddr_t src, dst;
@@ -6707,6 +6753,57 @@
                stda(MXCC_STREAM_DST, ASI_CONTROL, v2 | offset);
        }
 }
+
+/*
+ * HyperSPARC/RT625 specific version of pmap_copy_page
+ */
+void
+pmap_copy_page_hypersparc(src, dst)
+       paddr_t src, dst;
+{
+       caddr_t sva, dva;
+       int spte, dpte;
+       int offset;
+
+       /*
+        * We still have to map the pages, since ASI_BLOCKCOPY
+        * takes virtual addresses. This also means we have to
+        * consider cache aliasing; therefore we still need
+        * to flush the cache here. All we gain is the speed-up
+        * in copy loop itself..
+        */
+
+       if (managed(src)) {
+               if (CACHEINFO.c_vactype == VAC_WRITEBACK)
+                       pv_flushcache(pvhead(src));
+       }
+
+       spte = SRMMU_TEPTE | SRMMU_PG_C | PPROT_N_RX |
+               (atop(src) << SRMMU_PPNSHIFT);
+
+       if (managed(dst)) {
+               /* similar `might not be necessary' comment applies */
+               if (CACHEINFO.c_vactype != VAC_NONE)
+                       pv_flushcache(pvhead(dst));
+       }
+
+       dpte = SRMMU_TEPTE | SRMMU_PG_C | PPROT_N_RWX |
+               (atop(dst) << SRMMU_PPNSHIFT);
+
+       sva = vpage[0];
+       dva = vpage[1];
+       setpgt4m(vpage_pte[0], spte);
+       setpgt4m(vpage_pte[1], dpte);
+
+       for (offset = 0; offset < NBPG; offset += 32) {
+               sta(dva + offset, ASI_BLOCKCOPY, sva + offset);
+       }
+
+       tlb_flush_page(sva);
+       setpgt4m(vpage_pte[0], SRMMU_TEINVALID);
+       tlb_flush_page(dva);
+       setpgt4m(vpage_pte[1], SRMMU_TEINVALID);
+}
 #endif /* SUN4M */
 
 /*



Home | Main Index | Thread Index | Old Index