Source-Changes-HG archive

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

[src/uebayasi-xip]: src/sys/uvm Define vm_physdev / vm_nphysdev, physical add...



details:   https://anonhg.NetBSD.org/src/rev/f90a28baaa0f
branches:  uebayasi-xip
changeset: 751548:f90a28baaa0f
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Tue Feb 09 09:07:34 2010 +0000

description:
Define vm_physdev / vm_nphysdev, physical address segment data for managed
device pages.

diffstat:

 sys/uvm/uvm_page.c |  43 ++++++++++++++++++++++++++++++++++++++++---
 sys/uvm/uvm_page.h |   9 ++++++++-
 2 files changed, 48 insertions(+), 4 deletions(-)

diffs (122 lines):

diff -r 90a0c481baa5 -r f90a28baaa0f sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c        Tue Feb 09 08:43:33 2010 +0000
+++ b/sys/uvm/uvm_page.c        Tue Feb 09 09:07:34 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.c,v 1.153.2.6 2010/02/09 08:43:33 uebayasi Exp $      */
+/*     $NetBSD: uvm_page.c,v 1.153.2.7 2010/02/09 09:07:34 uebayasi Exp $      */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,11 +71,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.6 2010/02/09 08:43:33 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.7 2010/02/09 09:07:34 uebayasi Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
 #include "opt_readahead.h"
+#include "opt_xip.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -98,9 +99,14 @@
 /*
  * physical memory config is stored in vm_physmem.
  */
+/* XXXUEBS make these array of pointers */
 
 struct vm_physseg vm_physmem[VM_PHYSSEG_MAX];  /* XXXCDC: uvm.physmem */
 int vm_nphysmem = 0;                           /* XXXCDC: uvm.nphysmem */
+#ifdef XIP
+struct vm_physseg vm_physdev[VM_PHYSSEG_MAX];  /* XXXCDC: uvm.physdev */
+int vm_nphysdev = 0;                           /* XXXCDC: uvm.nphysdev */
+#endif
 
 /*
  * Some supported CPUs in a given architecture don't support all
@@ -895,6 +901,16 @@
            pframe, NULL, offp);
 }
 
+#ifdef XIP
+int
+vm_physseg_find_device(paddr_t pframe, int *offp)
+{
+
+       return VM_PHYSSEG_FIND(vm_physdev, vm_nphysdev, VM_PHYSSEG_OP_PF,
+           pframe, NULL, offp);
+}
+#endif
+
 #if VM_PHYSSEG_MAX == 1
 static inline int
 vm_physseg_find_contig(struct vm_physseg *segs, int nsegs, int op,
@@ -1030,6 +1046,23 @@
        return(NULL);
 }
 
+#if 0
+#ifdef XIP
+struct vm_page *
+uvm_phys_to_vm_page_device(paddr_t pa)
+{
+       paddr_t pf = atop(pa);
+       int     off;
+       int     psi;
+
+       psi = vm_physseg_find_device(pf, &off);
+       if (psi != -1)
+               return(&vm_physdev[psi].pgs[off]);
+       return(NULL);
+}
+#endif
+#endif
+
 paddr_t
 uvm_vm_page_to_phys(const struct vm_page *pg)
 {
@@ -2036,7 +2069,11 @@
 uvm_pageismanaged(paddr_t pa)
 {
 
-       return (vm_physseg_find(atop(pa), NULL) != -1);
+       return
+#ifdef XIP
+           (vm_physseg_find_device(atop(pa), NULL) != -1) ||
+#endif
+           (vm_physseg_find(atop(pa), NULL) != -1);
 }
 
 /*
diff -r 90a0c481baa5 -r f90a28baaa0f sys/uvm/uvm_page.h
--- a/sys/uvm/uvm_page.h        Tue Feb 09 08:43:33 2010 +0000
+++ b/sys/uvm/uvm_page.h        Tue Feb 09 09:07:34 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.h,v 1.59.2.4 2010/02/09 08:43:33 uebayasi Exp $       */
+/*     $NetBSD: uvm_page.h,v 1.59.2.5 2010/02/09 09:07:34 uebayasi Exp $       */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -255,6 +255,10 @@
 
 extern struct vm_physseg vm_physmem[VM_PHYSSEG_MAX];
 extern int vm_nphysmem;
+#ifdef XIP
+extern struct vm_physseg vm_physdev[VM_PHYSSEG_MAX];
+extern int vm_nphysdev;
+#endif
 
 #define        vm_nphysseg     vm_nphysmem     /* XXX backward compat */
 
@@ -291,6 +295,9 @@
 int uvm_page_lookup_freelist(struct vm_page *);
 
 int vm_physseg_find(paddr_t, int *);
+#ifdef XIP
+int vm_physseg_find_device(paddr_t, int *);
+#endif
 struct vm_page *uvm_phys_to_vm_page(paddr_t);
 paddr_t uvm_vm_page_to_phys(const struct vm_page *);
 



Home | Main Index | Thread Index | Old Index