Source-Changes-HG archive

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

[src/uebayasi-xip]: src/sys/uvm Maintain not only arrays of struct vm_physseg...



details:   https://anonhg.NetBSD.org/src/rev/b3e5b02cdc59
branches:  uebayasi-xip
changeset: 751686:b3e5b02cdc59
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Tue Apr 27 08:32:47 2010 +0000

description:
Maintain not only arrays of struct vm_physseg, but also arrays of pointers
to struct vm_physseg.  This is need:

- to make the array change dynamically (unload), and

- to make the struct vm_physseg * object to be passed to device drivers as
  a cookie of a managed physical segment.

diffstat:

 sys/uvm/uvm_page.c |  30 ++++++++++++++++++++++++++++--
 sys/uvm/uvm_page.h |   6 ++++--
 2 files changed, 32 insertions(+), 4 deletions(-)

diffs (104 lines):

diff -r c0917b607e7e -r b3e5b02cdc59 sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c        Tue Apr 27 08:23:48 2010 +0000
+++ b/sys/uvm/uvm_page.c        Tue Apr 27 08:32:47 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.c,v 1.153.2.22 2010/04/27 04:32:44 uebayasi Exp $     */
+/*     $NetBSD: uvm_page.c,v 1.153.2.23 2010/04/27 08:32:47 uebayasi Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.22 2010/04/27 04:32:44 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.23 2010/04/27 08:32:47 uebayasi Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -103,9 +103,11 @@
 /* XXXUEBS make these array of pointers */
 /* XXXUEBS merge these two */
 
+struct vm_physseg *vm_physmem_ptrs[VM_PHYSSEG_MAX];
 struct vm_physseg vm_physmem[VM_PHYSSEG_MAX];
 int vm_nphysmem = 0;
 #ifdef DEVICE_PAGE
+struct vm_physseg *vm_physdev_ptrs[VM_PHYSSEG_MAX];
 struct vm_physseg vm_physdev[VM_PHYSSEG_MAX];
 int vm_nphysdev = 0;
 #endif
@@ -755,6 +757,8 @@
 static void
 uvm_page_physunload_common(struct vm_physseg * const);
 #endif
+static void
+uvm_page_physseg_init(void);
 static struct vm_physseg *
 uvm_physseg_insert(struct vm_physseg *, int,
     const paddr_t, const paddr_t);
@@ -815,6 +819,7 @@
     const paddr_t avail_start, const paddr_t avail_end, const int free_list)
 {
        struct vm_physseg *ps;
+       static int uvm_page_physseg_inited;
 
        if (uvmexp.pagesize == 0)
                panic("uvm_page_physload: page size not set!");
@@ -829,6 +834,12 @@
                    "\tincrease VM_PHYSSEG_MAX\n",
                    VM_PHYSSEG_MAX, (long long)start, (long long)end);
 
+       /* XXXUEBS too early to use RUN_ONCE(9)? */
+       if (uvm_page_physseg_inited == 0) {
+               uvm_page_physseg_inited = 1;
+               uvm_page_physseg_init();
+       }
+
        ps = uvm_physseg_insert(segs, nsegs, start, end);
        KASSERT(ps != NULL);
        ps->start = start;
@@ -837,6 +848,21 @@
        return ps;
 }
 
+static void
+uvm_page_physseg_init(void)
+{
+       int lcv;
+       
+       for (lcv = 0; lcv < VM_PHYSSEG_MAX; lcv++) {
+               vm_physmem_ptrs[lcv] = &vm_physmem[lcv];
+       }
+#ifdef DEVICE_PAGE
+       for (lcv = 0; lcv < VM_PHYSSEG_MAX; lcv++) {
+               vm_physdev_ptrs[lcv] = &vm_physdev[lcv];
+       }
+#endif
+}
+
 static struct vm_physseg *
 uvm_physseg_insert(struct vm_physseg *segs, int nsegs,
     const paddr_t start, const paddr_t end)
diff -r c0917b607e7e -r b3e5b02cdc59 sys/uvm/uvm_page.h
--- a/sys/uvm/uvm_page.h        Tue Apr 27 08:23:48 2010 +0000
+++ b/sys/uvm/uvm_page.h        Tue Apr 27 08:32:47 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.h,v 1.59.2.16 2010/04/27 08:23:48 uebayasi Exp $      */
+/*     $NetBSD: uvm_page.h,v 1.59.2.17 2010/04/27 08:32:47 uebayasi Exp $      */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -257,9 +257,11 @@
  * physical memory config is stored in vm_physmem.
  */
 
+extern struct vm_physseg *vm_physmem_ptrs[VM_PHYSSEG_MAX];
 extern struct vm_physseg vm_physmem[VM_PHYSSEG_MAX];
 extern int vm_nphysmem;
-#ifdef XIP
+#ifdef DEVICE_PAGE
+extern struct vm_physseg *vm_physdev_ptrs[VM_PHYSSEG_MAX];
 extern struct vm_physseg vm_physdev[VM_PHYSSEG_MAX];
 extern int vm_nphysdev;
 #endif



Home | Main Index | Thread Index | Old Index