Source-Changes-HG archive

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

[src/yamt-km]: src/sys/arch/mvme68k change kernel va layout, following mac68k.



details:   https://anonhg.NetBSD.org/src/rev/a5efc17ad988
branches:  yamt-km
changeset: 573363:a5efc17ad988
user:      yamt <yamt%NetBSD.org@localhost>
date:      Wed Feb 23 10:23:37 2005 +0000

description:
change kernel va layout, following mac68k.

diffstat:

 sys/arch/mvme68k/include/vmparam.h        |   4 +-
 sys/arch/mvme68k/mvme68k/pmap_bootstrap.c |  94 +++++++++++++-----------------
 2 files changed, 42 insertions(+), 56 deletions(-)

diffs (254 lines):

diff -r 3a1141e2aadd -r a5efc17ad988 sys/arch/mvme68k/include/vmparam.h
--- a/sys/arch/mvme68k/include/vmparam.h        Wed Feb 23 10:14:24 2005 +0000
+++ b/sys/arch/mvme68k/include/vmparam.h        Wed Feb 23 10:23:37 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vmparam.h,v 1.25 2003/08/07 16:28:41 agc Exp $ */
+/*     $NetBSD: vmparam.h,v 1.25.10.1 2005/02/23 10:23:37 yamt Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -165,7 +165,7 @@
 #define VM_MAXUSER_ADDRESS     ((vaddr_t)0xFFF00000)
 #define VM_MAX_ADDRESS         ((vaddr_t)0xFFF00000)
 #define VM_MIN_KERNEL_ADDRESS  ((vaddr_t)0)
-#define VM_MAX_KERNEL_ADDRESS  ((vaddr_t)0xFFFFF000)
+#define VM_MAX_KERNEL_ADDRESS  ((vaddr_t)(0-PAGE_SIZE*NPTEPG*2))
 
 /* virtual sizes (bytes) for various kernel submaps */
 #define VM_PHYS_SIZE           (USRIOSIZE*PAGE_SIZE)
diff -r 3a1141e2aadd -r a5efc17ad988 sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
--- a/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c Wed Feb 23 10:14:24 2005 +0000
+++ b/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c Wed Feb 23 10:23:37 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.21 2003/08/07 16:28:43 agc Exp $  */
+/*     $NetBSD: pmap_bootstrap.c,v 1.21.10.1 2005/02/23 10:23:37 yamt Exp $    */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.21 2003/08/07 16:28:43 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.21.10.1 2005/02/23 10:23:37 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/kcore.h>
@@ -95,7 +95,7 @@
        paddr_t nextpa;
        paddr_t firstpa;
 {
-       paddr_t kstpa, kptpa, iiopa, kptmpa, lkptpa, p0upa;
+       paddr_t kstpa, kptpa, kptmpa, lkptpa, p0upa;
        u_int nptpages, kstsize;
        st_entry_t protoste, *ste;
        pt_entry_t protopte, *pte, *epte;
@@ -112,9 +112,6 @@
         *      kptpa           statically allocated
         *                      kernel PT pages         Sysptsize+ pages
         *
-        *      iiopa           internal IO space
-        *                      PT pages                iiomappages pages
-        *
         * [ Sysptsize is the number of pages of PT, iiomappages is the
         *   number of PTEs, hence we need to round the total to a page
         *   boundary with IO maps at the end. ]
@@ -139,17 +136,16 @@
                kstsize = 1;
        kstpa = nextpa;
        nextpa += kstsize * PAGE_SIZE;
-       kptpa = nextpa;
-       nptpages = RELOC(Sysptsize, int) +
-               (iiomappages + NPTEPG - 1) / NPTEPG;
-       nextpa += nptpages * PAGE_SIZE;
-       iiopa = nextpa - iiomappages * sizeof(pt_entry_t);
        kptmpa = nextpa;
        nextpa += PAGE_SIZE;
        lkptpa = nextpa;
        nextpa += PAGE_SIZE;
        p0upa = nextpa;
        nextpa += USPACE;
+       kptpa = nextpa;
+       nptpages = RELOC(Sysptsize, int) +
+               (iiomappages + NPTEPG - 1) / NPTEPG;
+       nextpa += nptpages * PAGE_SIZE;
 
        /*
         * Clear all PTEs to zero
@@ -201,11 +197,11 @@
                 * Initialize level 2 descriptors (which immediately
                 * follow the level 1 table).  We need:
                 *      NPTEPG / SG4_LEV3SIZE
-                * level 2 descriptors to map each of the nptpages+1
+                * level 2 descriptors to map each of the nptpages
                 * pages of PTEs.  Note that we set the "used" bit
                 * now to save the HW the expense of doing it.
                 */
-               num = (nptpages + 1) * (NPTEPG / SG4_LEV3SIZE);
+               num = nptpages * (NPTEPG / SG4_LEV3SIZE);
                pte = &((u_int *)kstpa)[SG4_LEV1SIZE];
                epte = &pte[num];
                protoste = kptpa | SG_U | SG_RW | SG_V;
@@ -234,9 +230,15 @@
                *ste = (u_int)pte | SG_U | SG_RW | SG_V;
                /*
                 * Now initialize the final portion of that block of
-                * descriptors to map the "last PT page".
+                * descriptors to map kptmpa and the "last PT page".
                 */
-               pte = &((u_int *)kstpa)[kstsize*NPTEPG - NPTEPG/SG4_LEV3SIZE];
+               pte = &((u_int *)kstpa)[kstsize*NPTEPG - NPTEPG/SG4_LEV3SIZE*2];
+               epte = &pte[NPTEPG/SG4_LEV3SIZE];
+               protoste = kptmpa | SG_U | SG_RW | SG_V;
+               while (pte < epte) {
+                       *pte++ = protoste;
+                       protoste += (SG4_LEV3SIZE * sizeof(st_entry_t));
+               }
                epte = &pte[NPTEPG/SG4_LEV3SIZE];
                protoste = lkptpa | SG_U | SG_RW | SG_V;
                while (pte < epte) {
@@ -247,7 +249,7 @@
                 * Initialize Sysptmap
                 */
                pte = (u_int *)kptmpa;
-               epte = &pte[nptpages+1];
+               epte = &pte[nptpages];
                protopte = kptpa | PG_RW | PG_CI | PG_U | PG_V;
                while (pte < epte) {
                        *pte++ = protopte;
@@ -256,22 +258,23 @@
                /*
                 * Invalidate all but the last remaining entry.
                 */
-               epte = &((u_int *)kptmpa)[NPTEPG-1];
+               epte = &((u_int *)kptmpa)[NPTEPG-2];
                while (pte < epte) {
                        *pte++ = PG_NV;
                }
+               *pte = kptmpa | PG_RW | PG_CI | PG_V;
+               pte++;
                *pte = lkptpa | PG_RW | PG_CI | PG_U | PG_V;
        } else
 #endif /* M68040 || M68060 */
        {
                /*
                 * Map the page table pages in both the HW segment table
-                * and the software Sysptmap.  Note that Sysptmap is also
-                * considered a PT page hence the +1.
+                * and the software Sysptmap.
                 */
                ste = (u_int *)kstpa;
                pte = (u_int *)kptmpa;
-               epte = &pte[nptpages+1];
+               epte = &pte[nptpages];
                protoste = kptpa | SG_RW | SG_V;
                protopte = kptpa | PG_RW | PG_CI | PG_V;
                while (pte < epte) {
@@ -281,17 +284,21 @@
                        protopte += PAGE_SIZE;
                }
                /*
-                * Invalidate all but the last remaining entries in both.
+                * Invalidate all but the last two remaining entries in both.
                 */
-               epte = &((u_int *)kptmpa)[NPTEPG-1];
+               epte = &((u_int *)kptmpa)[NPTEPG-2];
                while (pte < epte) {
                        *ste++ = SG_NV;
                        *pte++ = PG_NV;
                }
                /*
-                * Initialize the last to point to point to the page
+                * Initialize the last ones to point to Sysptmap and the page
                 * table page allocated earlier.
                 */
+               *ste = kptmpa | SG_RW | SG_V;
+               *pte = kptmpa | PG_RW | PG_CI | PG_V;
+               ste++;
+               pte++;
                *ste = lkptpa | SG_RW | SG_V;
                *pte = lkptpa | PG_RW | PG_CI | PG_V;
        }
@@ -357,13 +364,18 @@
        /*
         * Finally, validate the internal IO space PTEs (RW+CI).
         */
-       pte = (u_int *)iiopa;
-       epte = (u_int *)kptmpa;
+
+#define        PTE2VA(pte)     m68k_ptob(pte - ((pt_entry_t *)kptpa))
+
        protopte = RELOC(intiobase_phys, u_int) | PG_RW | PG_CI | PG_U | PG_V;
+       epte = &pte[iiomappages];
+       RELOC(intiobase, char *) = (char *)PTE2VA(pte);
+       RELOC(intiolimit, char *) = (char *)PTE2VA(epte);
        while (pte < epte) {
                *pte++ = protopte;
                protopte += PAGE_SIZE;
        }
+       RELOC(virtual_avail, vaddr_t) = PTE2VA(pte);
 
        /*
         * Calculate important exported kernel virtual addresses
@@ -383,16 +395,7 @@
         * Immediately follows `nptpages' of static kernel page table.
         */
        RELOC(Sysmap, pt_entry_t *) =
-               (pt_entry_t *)m68k_ptob(nptpages * NPTEPG);
-       /*
-        * intiobase, intiolimit: base and end of internal IO space.
-        * iiomappages pages prior to VMEbus IO space at end of static
-        * kernel page table.
-        */
-       RELOC(intiobase, char *) =
-           (char *)m68k_ptob(nptpages*NPTEPG - iiomappages);
-       RELOC(intiolimit, char *) =
-           (char *)m68k_ptob(nptpages*NPTEPG);
+           (pt_entry_t *)m68k_ptob((NPTEPG - 2) * NPTEPG);
 
        /*
         * Setup u-area for process 0.
@@ -485,8 +488,6 @@
 
        RELOC(mem_size, vsize_t) = m68k_ptob(RELOC(physmem, int));
 
-       RELOC(virtual_avail, vaddr_t) =
-               VM_MIN_KERNEL_ADDRESS + (vaddr_t)(nextpa - firstpa);
        RELOC(virtual_end, vaddr_t) = VM_MAX_KERNEL_ADDRESS;
 
        /*
@@ -526,13 +527,13 @@
                 * descriptor mask noting that we have used:
                 *      0:              level 1 table
                 *      1 to `num':     map page tables
-                *      MAXKL2SIZE-1:   maps last-page page table
+                *      MAXKL2SIZE-1:   maps kptmpa and last-page page table
                 */
                if (RELOC(mmutype, int) == MMU_68040) {
                        int num;
                        
                        kpm->pm_stfree = ~l2tobm(0);
-                       num = roundup((nptpages + 1) * (NPTEPG / SG4_LEV3SIZE),
+                       num = roundup(nptpages * (NPTEPG / SG4_LEV3SIZE),
                                      SG4_LEV2SIZE) / SG4_LEV2SIZE;
                        while (num)
                                kpm->pm_stfree &= ~l2tobm(num--);
@@ -562,18 +563,3 @@
                RELOC(virtual_avail, vaddr_t) = va;
        }
 }
-
-void
-pmap_init_md(void)
-{
-       vaddr_t addr;
-
-       addr = (vaddr_t) intiobase;
-       if (uvm_map(kernel_map, &addr,
-                   (intiotop_phys - intiobase_phys),
-                   NULL, UVM_UNKNOWN_OFFSET, 0,
-                   UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
-                               UVM_INH_NONE, UVM_ADV_RANDOM,
-                               UVM_FLAG_FIXED)) != 0)
-               panic("pmap_init_md: uvm_map failed");
-}



Home | Main Index | Thread Index | Old Index