Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Collapse map_entry{, ro, nc}() into a single pmap_map...
details: https://anonhg.NetBSD.org/src/rev/13fd3ead516d
branches: trunk
changeset: 522479:13fd3ead516d
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Feb 20 02:32:56 2002 +0000
description:
Collapse map_entry{,ro,nc}() into a single pmap_map_entry() that
takes a prot and a "cacheable" indicator.
diffstat:
sys/arch/acorn32/acorn32/rpc_machdep.c | 38 +++++++++--------
sys/arch/arm/arm32/arm32_machdep.c | 51 +----------------------
sys/arch/arm/arm32/pmap.c | 25 ++++++++++-
sys/arch/arm/include/arm32/machdep.h | 5 +-
sys/arch/arm/include/arm32/pmap.h | 3 +-
sys/arch/cats/cats/cats_machdep.c | 36 +++++++++------
sys/arch/evbarm/integrator/integrator_machdep.c | 37 +++++++++-------
sys/arch/evbarm/iq80310/iq80310_machdep.c | 28 +++++++----
sys/arch/hpcarm/hpcarm/hpc_machdep.c | 46 +++++++++++---------
sys/arch/netwinder/netwinder/netwinder_machdep.c | 34 ++++++++------
sys/arch/shark/ofw/ofw.c | 53 +++++++++++++----------
11 files changed, 181 insertions(+), 175 deletions(-)
diffs (truncated from 697 to 300 lines):
diff -r 4019f3feb045 -r 13fd3ead516d sys/arch/acorn32/acorn32/rpc_machdep.c
--- a/sys/arch/acorn32/acorn32/rpc_machdep.c Wed Feb 20 01:49:59 2002 +0000
+++ b/sys/arch/acorn32/acorn32/rpc_machdep.c Wed Feb 20 02:32:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rpc_machdep.c,v 1.17 2002/02/20 00:10:15 thorpej Exp $ */
+/* $NetBSD: rpc_machdep.c,v 1.18 2002/02/20 02:32:56 thorpej Exp $ */
/*
* Copyright (c) 2000-2001 Reinoud Zandijk.
@@ -57,7 +57,7 @@
#include <sys/param.h>
-__RCSID("$NetBSD: rpc_machdep.c,v 1.17 2002/02/20 00:10:15 thorpej Exp $");
+__RCSID("$NetBSD: rpc_machdep.c,v 1.18 2002/02/20 02:32:56 thorpej Exp $");
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -187,9 +187,6 @@
extern void consinit __P((void));
void map_pagetable __P((vm_offset_t pt, vm_offset_t va, vm_offset_t pa));
-void map_entry __P((vm_offset_t pt, vm_offset_t va, vm_offset_t pa));
-void map_entry_nc __P((vm_offset_t pt, vm_offset_t va, vm_offset_t pa));
-void map_entry_ro __P((vm_offset_t pt, vm_offset_t va, vm_offset_t pa));
vm_size_t map_chunk __P((vm_offset_t pd, vm_offset_t pt, vm_offset_t va,
vm_offset_t pa, vm_size_t size, u_int acc,
u_int flg));
@@ -756,8 +753,8 @@
PD_SIZE, AP_KRW, 0);
/* Map the page table that maps the kernel pages */
- map_entry_nc(l2pagetable, kernel_ptpt.pv_pa - physical_start,
- kernel_ptpt.pv_pa);
+ pmap_map_entry(l2pagetable, kernel_ptpt.pv_pa - physical_start,
+ kernel_ptpt.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
/* Now we fill in the L2 pagetable for the VRAM */
@@ -784,18 +781,22 @@
*/
/* The -2 is slightly bogus, it should be -log2(sizeof(pt_entry_t)) */
l2pagetable = kernel_ptpt.pv_pa;
- map_entry_nc(l2pagetable, (KERNEL_BASE >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_KERNEL]);
- map_entry_nc(l2pagetable, (PROCESS_PAGE_TBLS_BASE >> (PGSHIFT-2)),
- kernel_ptpt.pv_pa);
- map_entry_nc(l2pagetable, (VMEM_VBASE >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMEM]);
- map_entry_nc(l2pagetable, (0x00000000 >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_SYS]);
+ pmap_map_entry(l2pagetable, (KERNEL_BASE >> (PGSHIFT-2)),
+ kernel_pt_table[KERNEL_PT_KERNEL], VM_PROT_READ|VM_PROT_WRITE,
+ PTE_NOCACHE);
+ pmap_map_entry(l2pagetable, (PROCESS_PAGE_TBLS_BASE >> (PGSHIFT-2)),
+ kernel_ptpt.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
+ pmap_map_entry(l2pagetable, (VMEM_VBASE >> (PGSHIFT-2)),
+ kernel_pt_table[KERNEL_PT_VMEM], VM_PROT_READ|VM_PROT_WRITE,
+ PTE_NOCACHE);
+ pmap_map_entry(l2pagetable, (0x00000000 >> (PGSHIFT-2)),
+ kernel_pt_table[KERNEL_PT_SYS], VM_PROT_READ|VM_PROT_WRITE,
+ PTE_NOCACHE);
for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; ++loop) {
- map_entry_nc(l2pagetable, ((KERNEL_VM_BASE +
+ pmap_map_entry(l2pagetable, ((KERNEL_VM_BASE +
(loop * 0x00400000)) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMDATA + loop]);
+ kernel_pt_table[KERNEL_PT_VMDATA + loop],
+ VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
}
/*
@@ -803,7 +804,8 @@
* of the virtual memory map.
*/
l2pagetable = kernel_pt_table[KERNEL_PT_SYS];
- map_entry(l2pagetable, 0x0000000, systempage.pv_pa);
+ pmap_map_entry(l2pagetable, 0x0000000, systempage.pv_pa,
+ VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
/* Map the core memory needed before autoconfig */
loop = 0;
diff -r 4019f3feb045 -r 13fd3ead516d sys/arch/arm/arm32/arm32_machdep.c
--- a/sys/arch/arm/arm32/arm32_machdep.c Wed Feb 20 01:49:59 2002 +0000
+++ b/sys/arch/arm/arm32/arm32_machdep.c Wed Feb 20 02:32:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_machdep.c,v 1.13 2002/02/20 00:10:17 thorpej Exp $ */
+/* $NetBSD: arm32_machdep.c,v 1.14 2002/02/20 02:32:57 thorpej Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -251,55 +251,6 @@
return(size);
}
-/* cats versions have larger 2 l2pt's next to each other */
-void
-map_entry(pagetable, va, pa)
- vaddr_t pagetable;
- vaddr_t va;
- paddr_t pa;
-{
-#ifndef cats
- ((pt_entry_t *)pagetable)[((va >> PGSHIFT) & 0x000003ff)] =
- L2_PTE((pa & PG_FRAME), AP_KRW);
-#else
- ((pt_entry_t *)pagetable)[((va >> PGSHIFT) & 0x000007ff)] =
- L2_PTE((pa & PG_FRAME), AP_KRW);
-#endif
-}
-
-
-void
-map_entry_nc(pagetable, va, pa)
- vaddr_t pagetable;
- vaddr_t va;
- paddr_t pa;
-{
-#ifndef cats
- ((pt_entry_t *)pagetable)[((va >> PGSHIFT) & 0x000003ff)] =
- L2_PTE_NC_NB((pa & PG_FRAME), AP_KRW);
-#else
- ((pt_entry_t *)pagetable)[((va >> PGSHIFT) & 0x000007ff)] =
- L2_PTE_NC_NB((pa & PG_FRAME), AP_KRW);
-#endif
-}
-
-
-void
-map_entry_ro(pagetable, va, pa)
- vaddr_t pagetable;
- vaddr_t va;
- paddr_t pa;
-{
-#ifndef cats
- ((pt_entry_t *)pagetable)[((va >> PGSHIFT) & 0x000003ff)] =
- L2_PTE((pa & PG_FRAME), AP_KR);
-#else
- ((pt_entry_t *)pagetable)[((va >> PGSHIFT) & 0x000007ff)] =
- L2_PTE((pa & PG_FRAME), AP_KR);
-#endif
-}
-
-
/*
* void cpu_startup(void)
*
diff -r 4019f3feb045 -r 13fd3ead516d sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Wed Feb 20 01:49:59 2002 +0000
+++ b/sys/arch/arm/arm32/pmap.c Wed Feb 20 02:32:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.40 2002/02/20 00:10:17 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.41 2002/02/20 02:32:57 thorpej Exp $ */
/*
* Copyright (c) 2001 Richard Earnshaw
@@ -142,7 +142,7 @@
#include <machine/param.h>
#include <arm/arm32/katelib.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.40 2002/02/20 00:10:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41 2002/02/20 02:32:57 thorpej Exp $");
#ifdef PMAP_DEBUG
#define PDEBUG(_lev_,_stat_) \
if (pmap_debug_level >= (_lev_)) \
@@ -3739,3 +3739,24 @@
pde[va >> PDSHIFT] = L1_SEC(pa & PD_MASK,
cache == PTE_CACHE ? pte_cache_mode : 0);
}
+
+/*
+ * pmap_map_entry:
+ *
+ * Create a single page mapping.
+ */
+void
+pmap_map_entry(vaddr_t l2pt, vaddr_t va, paddr_t pa, int prot, int cache)
+{
+ pt_entry_t *pte = (pt_entry_t *) l2pt;
+ pt_entry_t ap = (prot & VM_PROT_WRITE) ? AP_KRW : AP_KR;
+ pt_entry_t fl = (cache == PTE_CACHE) ? pte_cache_mode : 0;
+
+ KASSERT(((va | pa) & PGOFSET) == 0);
+
+#ifdef cats /* XXXJRT */
+ pte[(va >> PGSHIFT) & 0x7ff] = L2_SPTE(pa & PG_FRAME, ap, fl);
+#else
+ pte[(va >> PGSHIFT) & 0x3ff] = L2_SPTE(pa & PG_FRAME, ap, fl);
+#endif
+}
diff -r 4019f3feb045 -r 13fd3ead516d sys/arch/arm/include/arm32/machdep.h
--- a/sys/arch/arm/include/arm32/machdep.h Wed Feb 20 01:49:59 2002 +0000
+++ b/sys/arch/arm/include/arm32/machdep.h Wed Feb 20 02:32:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.h,v 1.4 2002/02/20 00:10:18 thorpej Exp $ */
+/* $NetBSD: machdep.h,v 1.5 2002/02/20 02:32:57 thorpej Exp $ */
#ifndef _ARM32_BOOT_MACHDEP_H_
#define _ARM32_BOOT_MACHDEP_H_
@@ -12,9 +12,6 @@
void dumpsys __P((void));
void map_pagetable(vaddr_t, vaddr_t, paddr_t);
-void map_entry(vaddr_t, vaddr_t, paddr_t);
-void map_entry_nc(vaddr_t, vaddr_t, paddr_t);
-void map_entry_ro(vaddr_t, vaddr_t, paddr_t);
vsize_t map_chunk(vaddr_t, vaddr_t, vaddr_t, paddr_t, vsize_t,
u_int, u_int);
diff -r 4019f3feb045 -r 13fd3ead516d sys/arch/arm/include/arm32/pmap.h
--- a/sys/arch/arm/include/arm32/pmap.h Wed Feb 20 01:49:59 2002 +0000
+++ b/sys/arch/arm/include/arm32/pmap.h Wed Feb 20 02:32:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.24 2002/02/20 00:10:18 thorpej Exp $ */
+/* $NetBSD: pmap.h,v 1.25 2002/02/20 02:32:58 thorpej Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@@ -187,6 +187,7 @@
/* Bootstrapping routines. */
void pmap_map_section(vaddr_t, vaddr_t, paddr_t, int, int);
+void pmap_map_entry(vaddr_t, vaddr_t, paddr_t, int, int);
/*
* Special page zero routine for use by the idle loop (no cache cleans).
diff -r 4019f3feb045 -r 13fd3ead516d sys/arch/cats/cats/cats_machdep.c
--- a/sys/arch/cats/cats/cats_machdep.c Wed Feb 20 01:49:59 2002 +0000
+++ b/sys/arch/cats/cats/cats_machdep.c Wed Feb 20 02:32:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cats_machdep.c,v 1.16 2002/02/20 00:10:18 thorpej Exp $ */
+/* $NetBSD: cats_machdep.c,v 1.17 2002/02/20 02:32:58 thorpej Exp $ */
/*
* Copyright (c) 1997,1998 Mark Brinicombe.
@@ -611,7 +611,8 @@
#endif
/* Map the boot arguments page */
- map_entry_ro(l2pagetable, ebsabootinfo.bt_vargp, ebsabootinfo.bt_pargp);
+ pmap_map_entry(l2pagetable, ebsabootinfo.bt_vargp,
+ ebsabootinfo.bt_pargp, VM_PROT_READ, PTE_CACHE);
/* Map the stack pages */
map_chunk(0, l2pagetable, irqstack.pv_va, irqstack.pv_pa,
@@ -626,7 +627,8 @@
PD_SIZE, AP_KRW, 0);
/* Map the page table that maps the kernel pages */
- map_entry_nc(l2pagetable, kernel_ptpt.pv_pa, kernel_ptpt.pv_pa);
+ pmap_map_entry(l2pagetable, kernel_ptpt.pv_pa, kernel_ptpt.pv_pa,
+ VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
/*
* Map entries in the page table used to map PTE's
@@ -634,26 +636,32 @@
*/
/* The -2 is slightly bogus, it should be -log2(sizeof(pt_entry_t)) */
l2pagetable = kernel_ptpt.pv_pa;
- map_entry_nc(l2pagetable, (KERNEL_BASE >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_KERNEL]);
- map_entry_nc(l2pagetable, ((KERNEL_BASE +0x00400000) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_KERNEL2]);
+ pmap_map_entry(l2pagetable, (KERNEL_BASE >> (PGSHIFT-2)),
+ kernel_pt_table[KERNEL_PT_KERNEL],
+ VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
+ pmap_map_entry(l2pagetable, ((KERNEL_BASE +0x00400000) >> (PGSHIFT-2)),
+ kernel_pt_table[KERNEL_PT_KERNEL2],
+ VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
- map_entry_nc(l2pagetable, (PROCESS_PAGE_TBLS_BASE >> (PGSHIFT-2)),
- kernel_ptpt.pv_pa);
- map_entry_nc(l2pagetable, (0x00000000 >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_SYS]);
+ pmap_map_entry(l2pagetable, (PROCESS_PAGE_TBLS_BASE >> (PGSHIFT-2)),
+ kernel_ptpt.pv_pa,
+ VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
+ pmap_map_entry(l2pagetable, (0x00000000 >> (PGSHIFT-2)),
+ kernel_pt_table[KERNEL_PT_SYS],
+ VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; ++loop)
- map_entry_nc(l2pagetable, ((KERNEL_VM_BASE +
+ pmap_map_entry(l2pagetable, ((KERNEL_VM_BASE +
(loop * 0x00400000)) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMDATA + loop]);
+ kernel_pt_table[KERNEL_PT_VMDATA + loop],
+ VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
/*
* Map the system page in the kernel page table for the bottom 1Meg
* of the virtual memory map.
*/
l2pagetable = kernel_pt_table[KERNEL_PT_SYS];
- map_entry(l2pagetable, 0x00000000, systempage.pv_pa);
+ pmap_map_entry(l2pagetable, 0x00000000, systempage.pv_pa,
+ VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
/* Map the core memory needed before autoconfig */
loop = 0;
diff -r 4019f3feb045 -r 13fd3ead516d sys/arch/evbarm/integrator/integrator_machdep.c
Home |
Main Index |
Thread Index |
Old Index