Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch * Move the code that cleans the XScale mini-data ca...
details: https://anonhg.NetBSD.org/src/rev/04c214a92199
branches: trunk
changeset: 525318:04c214a92199
user: thorpej <thorpej%NetBSD.org@localhost>
date: Tue Apr 09 23:44:00 2002 +0000
description:
* Move the code that cleans the XScale mini-data cache into its
own function.
* Add a new function which sets up the mini-data cache clean area
properly.
diffstat:
sys/arch/arm/arm/cpufunc_asm_xscale.S | 33 +++++++++++++-------------
sys/arch/arm/arm32/pmap.c | 38 +++++++++++++++++++++++++++++-
sys/arch/arm/include/arm32/pmap.h | 4 ++-
sys/arch/arm/include/cpufunc.h | 4 ++-
sys/arch/evbarm/iq80310/iq80310_machdep.c | 9 +++----
sys/arch/evbarm/iq80321/iq80321_machdep.c | 9 +++----
6 files changed, 67 insertions(+), 30 deletions(-)
diffs (221 lines):
diff -r 7c7f2da17e9e -r 04c214a92199 sys/arch/arm/arm/cpufunc_asm_xscale.S
--- a/sys/arch/arm/arm/cpufunc_asm_xscale.S Tue Apr 09 22:37:00 2002 +0000
+++ b/sys/arch/arm/arm/cpufunc_asm_xscale.S Tue Apr 09 23:44:00 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufunc_asm_xscale.S,v 1.12 2002/03/19 19:41:57 briggs Exp $ */
+/* $NetBSD: cpufunc_asm_xscale.S,v 1.13 2002/04/09 23:44:00 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -309,21 +309,6 @@
subs r1, r1, #32
bne 1b
-#ifdef CACHE_CLEAN_MINIDATA
- /*
- * Clean the mini-data cache.
- *
- * It's expected that we only use the mini-data cache for
- * kernel addresses, so there is no need to purge it on
- * context switch.
- */
- ldr r2, Lxscale_minidata_clean_addr
- ldmia r2, {r0, r1}
-1: ldr r3, [r0], #32
- subs r1, r1, #32
- bne 1b
-#endif
-
CPWAIT(r0)
mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */
@@ -333,6 +318,22 @@
XSCALE_CACHE_CLEAN_EPILOGUE
mov pc, lr
+/*
+ * Clean the mini-data cache.
+ *
+ * It's expected that we only use the mini-data cache for
+ * kernel addresses, so there is no need to purge it on
+ * context switch, and no need to prevent userspace access
+ * while we clean it.
+ */
+ENTRY(xscale_cache_clean_minidata)
+ ldr r2, Lxscale_minidata_clean_addr
+ ldmia r2, {r0, r1}
+1: ldr r3, [r0], #32
+ subs r1, r1, #32
+ bne 1b
+ mov pc, lr
+
ENTRY(xscale_cache_purgeID_E)
mcr p15, 0, r0, c7, c10, 1 /* clean D cache entry */
CPWAIT(r1)
diff -r 7c7f2da17e9e -r 04c214a92199 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Tue Apr 09 22:37:00 2002 +0000
+++ b/sys/arch/arm/arm32/pmap.c Tue Apr 09 23:44:00 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.86 2002/04/09 22:37:01 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.87 2002/04/09 23:44:01 thorpej Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
@@ -143,7 +143,7 @@
#include <machine/param.h>
#include <arm/arm32/katelib.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.86 2002/04/09 22:37:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.87 2002/04/09 23:44:01 thorpej Exp $");
#ifdef PMAP_DEBUG
#define PDEBUG(_lev_,_stat_) \
if (pmap_debug_level >= (_lev_)) \
@@ -3711,4 +3711,38 @@
pte_l2_s_cache_mode = L2_C;
}
#endif /* CPU_XSCALE_80200 */
+
+/*
+ * xscale_setup_minidata:
+ *
+ * Set up the mini-data cache clean area. We require the
+ * caller to allocate the right amount of physically and
+ * virtually contiguous space.
+ */
+void
+xscale_setup_minidata(vaddr_t l1pt, vaddr_t va, paddr_t pa)
+{
+ extern vaddr_t xscale_minidata_clean_addr;
+ extern vsize_t xscale_minidata_clean_size; /* already initialized */
+ pd_entry_t *pde = (pd_entry_t *) l1pt;
+ pt_entry_t *pte;
+ vsize_t size;
+
+ xscale_minidata_clean_addr = va;
+
+ /* Round it to page size. */
+ size = (xscale_minidata_clean_size + L2_S_OFFSET) & L2_S_FRAME;
+
+ for (; size != 0;
+ va += L2_S_SIZE, pa += L2_S_SIZE, size -= L2_S_SIZE) {
+ pte = (pt_entry_t *)
+ kernel_pt_lookup(pde[va >> L1_S_SHIFT] & L2_S_FRAME);
+ if (pte == NULL)
+ panic("xscale_setup_minidata: can't find L2 table for "
+ "VA 0x%08lx", va);
+ pte[(va >> PGSHIFT) & 0x3ff] = L2_S_PROTO | pa |
+ L2_S_PROT(PTE_KERNEL, VM_PROT_READ) |
+ L2_C | L2_XSCALE_T_TEX(TEX_XSCALE_X);
+ }
+}
#endif /* ARM_MMU_XSCALE == 1 */
diff -r 7c7f2da17e9e -r 04c214a92199 sys/arch/arm/include/arm32/pmap.h
--- a/sys/arch/arm/include/arm32/pmap.h Tue Apr 09 22:37:00 2002 +0000
+++ b/sys/arch/arm/include/arm32/pmap.h Tue Apr 09 23:44:00 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.49 2002/04/09 22:37:01 thorpej Exp $ */
+/* $NetBSD: pmap.h,v 1.50 2002/04/09 23:44:02 thorpej Exp $ */
/*
* Copyright (c 2002 Wasabi Systems, Inc.
@@ -286,6 +286,8 @@
#if defined(CPU_XSCALE_80200)
void pmap_pte_init_i80200(void);
#endif /* CPU_XSCALE_80200 */
+
+void xscale_setup_minidata(vaddr_t, vaddr_t, paddr_t);
#else
#define ARM_MMU_XSCALE 0
#endif
diff -r 7c7f2da17e9e -r 04c214a92199 sys/arch/arm/include/cpufunc.h
--- a/sys/arch/arm/include/cpufunc.h Tue Apr 09 22:37:00 2002 +0000
+++ b/sys/arch/arm/include/cpufunc.h Tue Apr 09 23:44:00 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufunc.h,v 1.19 2002/03/26 19:29:45 thorpej Exp $ */
+/* $NetBSD: cpufunc.h,v 1.20 2002/04/09 23:44:02 thorpej Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe.
@@ -355,6 +355,8 @@
void xscale_cache_cleanD __P((void));
void xscale_cache_cleanD_E __P((u_int entry));
+void xscale_cache_clean_minidata __P((void));
+
void xscale_cache_purgeID __P((void));
void xscale_cache_purgeID_E __P((u_int entry));
void xscale_cache_purgeD __P((void));
diff -r 7c7f2da17e9e -r 04c214a92199 sys/arch/evbarm/iq80310/iq80310_machdep.c
--- a/sys/arch/evbarm/iq80310/iq80310_machdep.c Tue Apr 09 22:37:00 2002 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310_machdep.c Tue Apr 09 23:44:00 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iq80310_machdep.c,v 1.37 2002/04/05 16:58:08 thorpej Exp $ */
+/* $NetBSD: iq80310_machdep.c,v 1.38 2002/04/09 23:44:03 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -327,7 +327,7 @@
u_int
initarm(void *arg)
{
- extern vaddr_t xscale_cache_clean_addr, xscale_minidata_clean_addr;
+ extern vaddr_t xscale_cache_clean_addr;
extern vsize_t xscale_minidata_clean_size;
int loop;
int loop1;
@@ -514,7 +514,6 @@
/* Allocate enough pages for cleaning the Mini-Data cache. */
KASSERT(xscale_minidata_clean_size <= NBPG);
valloc_pages(minidataclean, 1);
- xscale_minidata_clean_addr = minidataclean.pv_va;
#ifdef VERBOSE_INIT_ARM
printf("IRQ stack: p0x%08lx v0x%08lx\n", irqstack.pv_pa,
@@ -608,8 +607,8 @@
L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
/* Map the Mini-Data cache clean area. */
- pmap_map_chunk(l1pagetable, minidataclean.pv_va, minidataclean.pv_pa,
- NBPG, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+ xscale_setup_minidata(l1pagetable, minidataclean.pv_va,
+ minidataclean.pv_pa);
/* Map the page table that maps the kernel pages */
pmap_map_entry(l1pagetable, kernel_ptpt.pv_va, kernel_ptpt.pv_pa,
diff -r 7c7f2da17e9e -r 04c214a92199 sys/arch/evbarm/iq80321/iq80321_machdep.c
--- a/sys/arch/evbarm/iq80321/iq80321_machdep.c Tue Apr 09 22:37:00 2002 +0000
+++ b/sys/arch/evbarm/iq80321/iq80321_machdep.c Tue Apr 09 23:44:00 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iq80321_machdep.c,v 1.4 2002/04/05 16:58:09 thorpej Exp $ */
+/* $NetBSD: iq80321_machdep.c,v 1.5 2002/04/09 23:44:03 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -344,7 +344,7 @@
u_int
initarm(void *arg)
{
- extern vaddr_t xscale_cache_clean_addr, xscale_minidata_clean_addr;
+ extern vaddr_t xscale_cache_clean_addr;
extern vsize_t xscale_minidata_clean_size;
int loop;
int loop1;
@@ -507,7 +507,6 @@
/* Allocate enough pages for cleaning the Mini-Data cache. */
KASSERT(xscale_minidata_clean_size <= NBPG);
valloc_pages(minidataclean, 1);
- xscale_minidata_clean_addr = minidataclean.pv_va;
#ifdef VERBOSE_INIT_ARM
printf("IRQ stack: p0x%08lx v0x%08lx\n", irqstack.pv_pa,
@@ -601,8 +600,8 @@
L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
/* Map the Mini-Data cache clean area. */
- pmap_map_chunk(l1pagetable, minidataclean.pv_va, minidataclean.pv_pa,
- NBPG, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+ xscale_setup_minidata(l1pagetable, minidataclean.pv_va,
+ minidataclean.pv_pa);
/* Map the page table that maps the kernel pages */
pmap_map_entry(l1pagetable, kernel_ptpt.pv_va, kernel_ptpt.pv_pa,
Home |
Main Index |
Thread Index |
Old Index