Source-Changes-HG archive

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

[src/uebayasi-xip]: src/sys/arch/powerpc/ibm4xx Support XIP; look up "device"...



details:   https://anonhg.NetBSD.org/src/rev/b1a1f335bfee
branches:  uebayasi-xip
changeset: 751764:b1a1f335bfee
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Wed Aug 11 13:46:28 2010 +0000

description:
Support XIP; look up "device" vm_physseg for managed pages.  Initialize
vm_physseg MD part.

diffstat:

 sys/arch/powerpc/ibm4xx/pmap.c |  58 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 50 insertions(+), 8 deletions(-)

diffs (95 lines):

diff -r ab4ddd59357f -r b1a1f335bfee sys/arch/powerpc/ibm4xx/pmap.c
--- a/sys/arch/powerpc/ibm4xx/pmap.c    Wed Aug 11 13:33:03 2010 +0000
+++ b/sys/arch/powerpc/ibm4xx/pmap.c    Wed Aug 11 13:46:28 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.60.2.3 2010/04/30 14:39:42 uebayasi Exp $   */
+/*     $NetBSD: pmap.c,v 1.60.2.4 2010/08/11 13:46:28 uebayasi Exp $   */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.60.2.3 2010/04/30 14:39:42 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.60.2.4 2010/08/11 13:46:28 uebayasi Exp $");
+
+#include "opt_xip.h"
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -192,10 +194,15 @@
 {
        int bank, pg;
 
+#ifdef XIP
+       bank = vm_physseg_find_device(atop(pa), &pg);
+       if (bank != -1)
+               return &VM_PHYSDEV_PTR(bank)->pmseg.pvent[pg];
+#endif
        bank = vm_physseg_find(atop(pa), &pg);
-       if (bank == -1)
-               return NULL;
-       return &VM_PHYSMEM_PTR(bank)->pmseg.pvent[pg];
+       if (bank != -1)
+               return &VM_PHYSMEM_PTR(bank)->pmseg.pvent[pg];
+       return NULL;
 }
 
 static inline char *
@@ -203,10 +210,15 @@
 {
        int bank, pg;
 
+#ifdef XIP
+       bank = vm_physseg_find_device(atop(pa), &pg);
+       if (bank != -1)
+               return &VM_PHYSDEV_PTR(bank)->pmseg.attrs[pg];
+#endif
        bank = vm_physseg_find(atop(pa), &pg);
-       if (bank == -1)
-               return NULL;
-       return &VM_PHYSMEM_PTR(bank)->pmseg.attrs[pg];
+       if (bank != -1)
+               return &VM_PHYSMEM_PTR(bank)->pmseg.attrs[pg];
+       return NULL;
 }
 
 /*
@@ -487,6 +499,36 @@
            IPL_VM);
 }
 
+void
+pmap_physseg_init(struct vm_physseg *seg)
+{
+       size_t npages;
+       vsize_t sz;
+       struct pv_entry *pv;
+       char *attr;
+
+       npages = seg->end - seg->start + 1;
+       sz = (vsize_t)((sizeof(struct pv_entry) + 1) * npages);
+       sz = round_page(sz);
+       pv = (void *)uvm_km_alloc(kernel_map, sz, 0, UVM_KMF_WIRED | UVM_KMF_ZERO);
+       attr = (void *)(pv + npages);
+
+       seg->pmseg.pvent = pv;
+       seg->pmseg.attrs = attr;
+}
+
+void
+pmap_physseg_fini(struct vm_physseg *seg)
+{
+       size_t npages;
+       vsize_t sz;
+
+       npages = seg->end - seg->start + 1;
+       sz = (vsize_t)((sizeof(struct pv_entry) + 1) * npages);
+       sz = round_page(sz);
+       uvm_km_free(kernel_map, (vaddr_t)seg->pmseg.pvent, sz, UVM_KMF_WIRED);
+}
+
 /*
  * How much virtual space is available to the kernel?
  */



Home | Main Index | Thread Index | Old Index