Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Move the calls to uvm_page_physload() out of pmap_b...



details:   https://anonhg.NetBSD.org/src/rev/c04f9193c8d5
branches:  trunk
changeset: 534622:c04f9193c8d5
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jul 31 00:20:51 2002 +0000

description:
Move the calls to uvm_page_physload() out of pmap_bootstrap() and
into platform-specific initialization code, giving platform-specific
code control over which free list a given chunk of memory gets put
onto.

Changes are essentially mechanical.  Test compiled for all ARM
platforms, test booted on Intel IQ80321 and Shark.

Discussed some time ago on port-arm.

diffstat:

 sys/arch/acorn32/acorn32/rpc_machdep.c           |  25 ++++++-
 sys/arch/arm/arm32/pmap.c                        |  82 +-----------------------
 sys/arch/arm/include/arm32/pmap.h                |   5 +-
 sys/arch/cats/cats/cats_machdep.c                |  78 ++++++++++++++++++++++-
 sys/arch/evbarm/integrator/integrator_machdep.c  |  10 ++-
 sys/arch/evbarm/iq80310/iq80310_machdep.c        |  10 ++-
 sys/arch/evbarm/iq80321/iq80321_machdep.c        |  10 ++-
 sys/arch/evbarm/ixm1200/ixm1200_machdep.c        |  10 ++-
 sys/arch/hpcarm/hpcarm/hpc_machdep.c             |  18 ++++-
 sys/arch/netwinder/netwinder/netwinder_machdep.c |  78 ++++++++++++++++++++++-
 sys/arch/shark/ofw/ofw.c                         |  77 +++++++++++++++++++++-
 11 files changed, 303 insertions(+), 100 deletions(-)

diffs (truncated from 646 to 300 lines):

diff -r 69300f8626eb -r c04f9193c8d5 sys/arch/acorn32/acorn32/rpc_machdep.c
--- a/sys/arch/acorn32/acorn32/rpc_machdep.c    Tue Jul 30 23:57:34 2002 +0000
+++ b/sys/arch/acorn32/acorn32/rpc_machdep.c    Wed Jul 31 00:20:51 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_machdep.c,v 1.37 2002/07/30 16:16:38 thorpej Exp $ */
+/*     $NetBSD: rpc_machdep.c,v 1.38 2002/07/31 00:20:51 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.37 2002/07/30 16:16:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpc_machdep.c,v 1.38 2002/07/31 00:20:51 thorpej Exp $");
 
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -936,11 +936,30 @@
        undefined_init();
        console_flush();
 
+       /* Load memory into UVM. */
+#ifdef VERBOSE_INIT_ARM
+       printf("page ");
+#endif
+       uvm_setpagesize();      /* initialize PAGE_SIZE-dependent variables */
+       for (loop = 0; loop < bootconfig.dramblocks; loop++) {
+               paddr_t start = (paddr_t)bootconfig.dram[loop].address;
+               paddr_t end = start + (bootconfig.dram[loop].pages * NBPG);
+
+               if (start < physical_freestart)
+                       start = physical_freestart;
+               if (end > physical_freeend)
+                       end = physical_freeend;
+
+               /* XXX Consider DMA range intersection checking. */
+
+               uvm_page_physload(atop(start), atop(end),
+                   atop(start), atop(end), VM_FREELIST_DEFAULT);
+       }
+
        /* Boot strap pmap telling it where the kernel page table is */
 #ifdef VERBOSE_INIT_ARM
        printf("pmap ");
 #endif
-       uvm_setpagesize();      /* initialize PAGE_SIZE-dependent variables */
        pmap_bootstrap((pd_entry_t *)kernel_l1pt.pv_va, kernel_ptpt);
        console_flush();
 
diff -r 69300f8626eb -r c04f9193c8d5 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Tue Jul 30 23:57:34 2002 +0000
+++ b/sys/arch/arm/arm32/pmap.c Wed Jul 31 00:20:51 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.101 2002/07/30 16:16:39 thorpej Exp $       */
+/*     $NetBSD: pmap.c,v 1.102 2002/07/31 00:20:52 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.101 2002/07/30 16:16:39 thorpej Exp $");        
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.102 2002/07/31 00:20:52 thorpej Exp $");        
 #ifdef PMAP_DEBUG
 #define        PDEBUG(_lev_,_stat_) \
        if (pmap_debug_level >= (_lev_)) \
@@ -293,9 +293,7 @@
 __inline static void pmap_clearbit __P((struct vm_page *, unsigned int));
 
 extern paddr_t physical_start;
-extern paddr_t physical_freestart;
 extern paddr_t physical_end;
-extern paddr_t physical_freeend;
 extern unsigned int free_pages;
 extern int max_processes;
 
@@ -424,7 +422,7 @@
  * return the page-rounded intersection if it does.  The intersection
  * will be placed on a lower-priority free list.
  */
-static boolean_t
+boolean_t
 pmap_isa_dma_range_intersect(paddr_t pa, psize_t size, paddr_t *pap,
     psize_t *sizep)
 {
@@ -973,8 +971,6 @@
  * to zero physical pages of memory.
  * It also initialises the start and end address of the kernel data space.
  */
-extern paddr_t physical_freestart;
-extern paddr_t physical_freeend;
 
 char *boot_head;
 
@@ -982,12 +978,6 @@
 pmap_bootstrap(pd_entry_t *kernel_l1pt, pv_addr_t kernel_ptpt)
 {
        pt_entry_t *pte;
-       int loop;
-       paddr_t start, end;
-#if NISADMA > 0
-       paddr_t istart;
-       psize_t isize;
-#endif
 
        pmap_kernel()->pm_pdir = kernel_l1pt;
        pmap_kernel()->pm_pptpt = kernel_ptpt.pv_pa;
@@ -998,72 +988,6 @@
        pmap_kernel()->pm_obj.uo_npages = 0;
        pmap_kernel()->pm_obj.uo_refs = 1;
 
-       loop = 0;
-       while (loop < bootconfig.dramblocks) {
-               start = (paddr_t)bootconfig.dram[loop].address;
-               end = start + (bootconfig.dram[loop].pages * NBPG);
-               if (start < physical_freestart)
-                       start = physical_freestart;
-               if (end > physical_freeend)
-                       end = physical_freeend;
-#if 0
-               printf("%d: %lx -> %lx\n", loop, start, end - 1);
-#endif
-#if NISADMA > 0
-               if (pmap_isa_dma_range_intersect(start, end - start,
-                   &istart, &isize)) {
-                       /*
-                        * Place the pages that intersect with the
-                        * ISA DMA range onto the ISA DMA free list.
-                        */
-#if 0
-                       printf("    ISADMA 0x%lx -> 0x%lx\n", istart,
-                           istart + isize - 1);
-#endif
-                       uvm_page_physload(atop(istart),
-                           atop(istart + isize), atop(istart),
-                           atop(istart + isize), VM_FREELIST_ISADMA);
-
-                       /*
-                        * Load the pieces that come before
-                        * the intersection into the default
-                        * free list.
-                        */
-                       if (start < istart) {
-#if 0
-                               printf("    BEFORE 0x%lx -> 0x%lx\n",
-                                   start, istart - 1);
-#endif
-                               uvm_page_physload(atop(start),
-                                   atop(istart), atop(start),
-                                   atop(istart), VM_FREELIST_DEFAULT);
-                       }
-
-                       /*
-                        * Load the pieces that come after
-                        * the intersection into the default
-                        * free list.
-                        */
-                       if ((istart + isize) < end) {
-#if 0
-                               printf("     AFTER 0x%lx -> 0x%lx\n",
-                                   (istart + isize), end - 1);
-#endif
-                               uvm_page_physload(atop(istart + isize),
-                                   atop(end), atop(istart + isize),
-                                   atop(end), VM_FREELIST_DEFAULT);
-                       }
-               } else {
-                       uvm_page_physload(atop(start), atop(end),
-                           atop(start), atop(end), VM_FREELIST_DEFAULT);
-               }
-#else  /* NISADMA > 0 */
-               uvm_page_physload(atop(start), atop(end),
-                   atop(start), atop(end), VM_FREELIST_DEFAULT);
-#endif /* NISADMA > 0 */
-               ++loop;
-       }
-
        virtual_avail = KERNEL_VM_BASE;
        virtual_end = KERNEL_VM_BASE + KERNEL_VM_SIZE;
 
diff -r 69300f8626eb -r c04f9193c8d5 sys/arch/arm/include/arm32/pmap.h
--- a/sys/arch/arm/include/arm32/pmap.h Tue Jul 30 23:57:34 2002 +0000
+++ b/sys/arch/arm/include/arm32/pmap.h Wed Jul 31 00:20:51 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.53 2002/04/12 21:52:48 thorpej Exp $        */
+/*     $NetBSD: pmap.h,v 1.54 2002/07/31 00:20:52 thorpej Exp $        */
 
 /*
  * Copyright (c 2002 Wasabi Systems, Inc.
@@ -207,6 +207,9 @@
 vsize_t        pmap_map_chunk(vaddr_t, vaddr_t, paddr_t, vsize_t, int, int);
 void   pmap_link_l2pt(vaddr_t, vaddr_t, pv_addr_t *);
 
+/* XXX This will go away. */
+boolean_t pmap_isa_dma_range_intersect(paddr_t, psize_t, paddr_t *, psize_t *);
+
 /*
  * Special page zero routine for use by the idle loop (no cache cleans). 
  */
diff -r 69300f8626eb -r c04f9193c8d5 sys/arch/cats/cats/cats_machdep.c
--- a/sys/arch/cats/cats/cats_machdep.c Tue Jul 30 23:57:34 2002 +0000
+++ b/sys/arch/cats/cats/cats_machdep.c Wed Jul 31 00:20:51 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cats_machdep.c,v 1.30 2002/07/30 16:16:41 thorpej Exp $        */
+/*     $NetBSD: cats_machdep.c,v 1.31 2002/07/31 00:20:52 thorpej Exp $        */
 
 /*
  * Copyright (c) 1997,1998 Mark Brinicombe.
@@ -42,6 +42,8 @@
 #include "opt_ddb.h"
 #include "opt_pmap_debug.h"
 
+#include "isadma.h"
+
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/systm.h>
@@ -738,9 +740,81 @@
        printf("undefined ");
        undefined_init();
 
+       /* Load memory into UVM. */
+       printf("page ");
+       uvm_setpagesize();      /* initialize PAGE_SIZE-dependent variables */
+
+       /* XXX Always one RAM block -- nuke the loop. */
+       for (loop = 0; loop < bootconfig.dramblocks; loop++) {
+               paddr_t start = (paddr_t)bootconfig.dram[loop].address;
+               paddr_t end = start + (bootconfig.dram[loop].pages * NBPG);
+#if NISADMA > 0
+               paddr_t istart, isize;
+#endif
+
+               if (start < physical_freestart)
+                       start = physical_freestart;
+               if (end > physical_freeend)
+                       end = physical_freeend;
+
+#if 0
+               printf("%d: %lx -> %lx\n", loop, start, end - 1);
+#endif
+
+#if NISADMA > 0
+               if (pmap_isa_dma_range_intersect(start, end - start,
+                                                &istart, &isize)) {
+                       /*
+                        * Place the pages that intersect with the
+                        * ISA DMA range onto the ISA DMA free list.
+                        */
+#if 0
+                       printf("    ISADMA 0x%lx -> 0x%lx\n", istart,
+                           istart + isize - 1);
+#endif
+                       uvm_page_physload(atop(istart),
+                           atop(istart + isize), atop(istart),
+                           atop(istart + isize), VM_FREELIST_ISADMA);
+
+                       /*
+                        * Load the pieces that come before the
+                        * intersection onto the default free list.
+                        */
+                       if (start < istart) {
+#if 0
+                               printf("    BEFORE 0x%lx -> 0x%lx\n",
+                                   start, istart - 1);
+#endif
+                               uvm_page_physload(atop(start),
+                                   atop(istart), atop(start),
+                                   atop(istart), VM_FREELIST_DEFAULT);
+                       }
+
+                       /*
+                        * Load the pieces that come after the
+                        * intersection onto the default free list.
+                        */
+                       if ((istart + isize) < end) {
+#if 0
+                               printf("     AFTER 0x%lx -> 0x%lx\n",
+                                   (istart + isize), end - 1);
+#endif
+                               uvm_page_physload(atop(istart + isize),
+                                   atop(end), atop(istart + isize), 
+                                   atop(end), VM_FREELIST_DEFAULT);
+                       }
+               } else {
+                       uvm_page_physload(atop(start), atop(end),
+                           atop(start), atop(end), VM_FREELIST_DEFAULT);
+               }
+#else /* NISADMA > 0 */
+               uvm_page_physload(atop(start), atop(end),
+                   atop(start), atop(end), VM_FREELIST_DEFAULT);
+#endif /* NISADMA > 0 */
+       }
+
        /* Boot strap pmap telling it where the kernel page table is */
        printf("pmap ");
-       uvm_setpagesize();      /* initialize PAGE_SIZE-dependent variables */
        pmap_bootstrap((pd_entry_t *)kernel_l1pt.pv_va, kernel_ptpt);



Home | Main Index | Thread Index | Old Index