Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm32 Move from arm32/arm32. s/vm_offset_t/vad...



details:   https://anonhg.NetBSD.org/src/rev/fbf605023530
branches:  trunk
changeset: 504490:fbf605023530
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Mar 04 05:08:09 2001 +0000

description:
Move from arm32/arm32.  s/vm_offset_t/vaddr_t/g

diffstat:

 sys/arch/arm/arm32/pmap.c |  2771 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 2771 insertions(+), 0 deletions(-)

diffs (truncated from 2775 to 300 lines):

diff -r 54cff8b5831d -r fbf605023530 sys/arch/arm/arm32/pmap.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/arm32/pmap.c Sun Mar 04 05:08:09 2001 +0000
@@ -0,0 +1,2771 @@
+/*     $NetBSD: pmap.c,v 1.1 2001/03/04 05:08:09 matt Exp $    */
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1994-1998 Mark Brinicombe.
+ * Copyright (c) 1994 Brini.
+ * All rights reserved.
+ *
+ * This code is derived from software written for Brini by Mark Brinicombe
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by Mark Brinicombe.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ *
+ * RiscBSD kernel project
+ *
+ * pmap.c
+ *
+ * Machine dependant vm stuff
+ *
+ * Created      : 20/09/94
+ */
+
+/*
+ * Performance improvements, UVM changes, overhauls and part-rewrites
+ * were contributed by Neil A. Carson <neil%causality.com@localhost>.
+ */
+
+/*
+ * The dram block info is currently referenced from the bootconfig.
+ * This should be placed in a separate structure.
+ */
+
+/*
+ * Special compilation symbols
+ * PMAP_DEBUG          - Build in pmap_debug_level code
+ */
+    
+/* Include header files */
+
+#include "opt_pmap_debug.h"
+#include "opt_ddb.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/malloc.h>
+#include <sys/user.h>
+
+#include <uvm/uvm.h>
+
+#include <machine/bootconfig.h>
+#include <machine/bus.h>
+#include <machine/pmap.h>
+#include <machine/pcb.h>
+#include <machine/param.h>
+#include <machine/katelib.h>
+       
+#ifdef PMAP_DEBUG
+#define        PDEBUG(_lev_,_stat_) \
+       if (pmap_debug_level >= (_lev_)) \
+               ((_stat_))
+int pmap_debug_level = -2;
+#else  /* PMAP_DEBUG */
+#define        PDEBUG(_lev_,_stat_) /* Nothing */
+#endif /* PMAP_DEBUG */
+
+struct pmap     kernel_pmap_store;
+pmap_t          kernel_pmap;
+
+pagehook_t page_hook0;
+pagehook_t page_hook1;
+char *memhook;
+pt_entry_t msgbufpte;
+extern caddr_t msgbufaddr;
+
+#ifdef DIAGNOSTIC
+boolean_t pmap_initialized = FALSE;    /* Has pmap_init completed? */
+#endif
+
+TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist;
+
+int pv_nfree = 0;
+
+vm_size_t npages;
+
+extern vaddr_t physical_start;
+extern vaddr_t physical_freestart;
+extern vaddr_t physical_end;
+extern vaddr_t physical_freeend;
+extern unsigned int free_pages;
+extern int max_processes;
+
+vaddr_t virtual_start;
+vaddr_t virtual_end;
+
+vaddr_t avail_start;
+vaddr_t avail_end;
+
+extern pv_addr_t systempage;
+
+#define ALLOC_PAGE_HOOK(x, s) \
+       x.va = virtual_start; \
+       x.pte = (pt_entry_t *)pmap_pte(kernel_pmap, virtual_start); \
+       virtual_start += s; 
+
+/* Variables used by the L1 page table queue code */
+SIMPLEQ_HEAD(l1pt_queue, l1pt);
+struct l1pt_queue l1pt_static_queue;   /* head of our static l1 queue */
+int l1pt_static_queue_count;           /* items in the static l1 queue */
+int l1pt_static_create_count;          /* static l1 items created */
+struct l1pt_queue l1pt_queue;          /* head of our l1 queue */
+int l1pt_queue_count;                  /* items in the l1 queue */
+int l1pt_create_count;                 /* stat - L1's create count */
+int l1pt_reuse_count;                  /* stat - L1's reused count */
+
+/* Local function prototypes (not used outside this file) */
+pt_entry_t *pmap_pte __P((pmap_t pmap, vaddr_t va));
+int pmap_page_index __P((vaddr_t pa)); 
+void map_pagetable __P((vaddr_t pagetable, vaddr_t va,
+    vaddr_t pa, unsigned int flags));
+void pmap_copy_on_write __P((vaddr_t pa));
+void pmap_pinit __P((pmap_t));
+void pmap_release __P((pmap_t));
+
+/* Other function prototypes */
+extern void bzero_page __P((vaddr_t));
+extern void bcopy_page __P((vaddr_t, vaddr_t));
+
+struct l1pt *pmap_alloc_l1pt __P((void));
+static __inline void pmap_map_in_l1 __P((pmap_t pmap, vaddr_t va,
+     vaddr_t l2pa));
+
+#ifdef MYCROFT_HACK
+int mycroft_hack = 0;
+#endif
+
+/* Function to set the debug level of the pmap code */
+
+#ifdef PMAP_DEBUG
+void
+pmap_debug(level)
+       int level;
+{
+       pmap_debug_level = level;
+       printf("pmap_debug: level=%d\n", pmap_debug_level);
+}
+#endif /* PMAP_DEBUG */
+
+#include "isadma.h"
+
+#if NISADMA > 0
+/*
+ * Used to protect memory for ISA DMA bounce buffers.  If, when loading
+ * pages into the system, memory intersects with any of these ranges,
+ * the intersecting memory will be loaded into a lower-priority free list.
+ */
+bus_dma_segment_t *pmap_isa_dma_ranges;
+int pmap_isa_dma_nranges;
+
+boolean_t pmap_isa_dma_range_intersect __P((vaddr_t, vm_size_t,
+           vaddr_t *, vm_size_t *));
+
+/*
+ * Check if a memory range intersects with an ISA DMA range, and
+ * return the page-rounded intersection if it does.  The intersection
+ * will be placed on a lower-priority free list.
+ */
+boolean_t
+pmap_isa_dma_range_intersect(pa, size, pap, sizep)
+       vaddr_t pa;
+       vm_size_t size;
+       vaddr_t *pap;
+       vm_size_t *sizep;
+{
+       bus_dma_segment_t *ds;
+       int i;
+
+       if (pmap_isa_dma_ranges == NULL)
+               return (FALSE);
+
+       for (i = 0, ds = pmap_isa_dma_ranges;
+            i < pmap_isa_dma_nranges; i++, ds++) {
+               if (ds->ds_addr <= pa && pa < (ds->ds_addr + ds->ds_len)) {
+                       /*
+                        * Beginning of region intersects with this range.
+                        */
+                       *pap = trunc_page(pa);
+                       *sizep = round_page(min(pa + size,
+                           ds->ds_addr + ds->ds_len) - pa);
+                       return (TRUE);
+               }
+               if (pa < ds->ds_addr && ds->ds_addr < (pa + size)) {
+                       /*
+                        * End of region intersects with this range.
+                        */
+                       *pap = trunc_page(ds->ds_addr);
+                       *sizep = round_page(min((pa + size) - ds->ds_addr,
+                           ds->ds_len));
+                       return (TRUE);
+               }
+       }
+
+       /*
+        * No intersection found.
+        */
+       return (FALSE);
+}
+#endif /* NISADMA > 0 */
+
+/*
+ * Functions for manipluation pv_entry structures. These are used to keep a
+ * record of the mappings of virtual addresses and the associated physical
+ * pages.
+ */
+
+/*
+ * Allocate a new pv_entry structure from the freelist. If the list is
+ * empty allocate a new page and fill the freelist.
+ */
+struct pv_entry *
+pmap_alloc_pv()
+{
+       struct pv_page *pvp;
+       struct pv_entry *pv;
+       int i;
+
+       /*
+        * Do we have any free pv_entry structures left ?
+        * If not allocate a page of them
+        */
+
+       if (pv_nfree == 0) {
+               /* NOTE: can't lock kernel_map here */
+               MALLOC(pvp, struct pv_page *, NBPG, M_VMPVENT, M_WAITOK);
+               if (pvp == 0)
+                       panic("pmap_alloc_pv: kmem_alloc() failed");
+               pvp->pvp_pgi.pgi_freelist = pv = &pvp->pvp_pv[1];
+               for (i = NPVPPG - 2; i; i--, pv++)



Home | Main Index | Thread Index | Old Index