Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/cortex simplify cache range op
details: https://anonhg.NetBSD.org/src/rev/1eec4c1efd82
branches: trunk
changeset: 784906:1eec4c1efd82
user: matt <matt%NetBSD.org@localhost>
date: Wed Feb 13 23:10:58 2013 +0000
description:
simplify cache range op
diffstat:
sys/arch/arm/cortex/pl310.c | 27 ++++++++++-----------------
1 files changed, 10 insertions(+), 17 deletions(-)
diffs (69 lines):
diff -r 944c2cd9b941 -r 1eec4c1efd82 sys/arch/arm/cortex/pl310.c
--- a/sys/arch/arm/cortex/pl310.c Wed Feb 13 23:09:39 2013 +0000
+++ b/sys/arch/arm/cortex/pl310.c Wed Feb 13 23:10:58 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pl310.c,v 1.10 2013/01/22 09:04:12 matt Exp $ */
+/* $NetBSD: pl310.c,v 1.11 2013/02/13 23:10:58 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.10 2013/01/22 09:04:12 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.11 2013/02/13 23:10:58 matt Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -287,20 +287,16 @@
pa -= off;
}
len = roundup2(len, line_size);
- off = pa & PAGE_MASK;
- for (const paddr_t endpa = pa + len; pa < endpa; off = 0) {
- psize_t seglen = min(len, PAGE_SIZE - off);
-
- mutex_spin_enter(&sc->sc_lock);
- if (!sc->sc_enabled) {
- mutex_spin_exit(&sc->sc_lock);
- return;
- }
- for (paddr_t segend = pa + seglen; pa < segend; pa += line_size) {
- arml2cc_cache_op(sc, cache_op, pa, false);
- }
+ mutex_spin_enter(&sc->sc_lock);
+ if (__predict_false(!sc->sc_enabled)) {
mutex_spin_exit(&sc->sc_lock);
+ return;
}
+ for (const paddr_t endpa = pa + len; pa < endpa; pa += line_size) {
+ arml2cc_cache_op(sc, cache_op, pa, false);
+ }
+ arml2cc_cache_sync(sc);
+ mutex_spin_exit(&sc->sc_lock);
}
static void
@@ -308,7 +304,6 @@
{
atomic_inc_64(&arml2cc_sc->sc_ev_inv.ev_count);
arml2cc_cache_range_op(pa, len, L2C_INV_PA);
- arml2cc_cache_sync(arml2cc_sc);
}
static void
@@ -316,7 +311,6 @@
{
atomic_inc_64(&arml2cc_sc->sc_ev_wb.ev_count);
arml2cc_cache_range_op(pa, len, L2C_CLEAN_PA);
- arml2cc_cache_sync(arml2cc_sc);
}
static void
@@ -324,5 +318,4 @@
{
atomic_inc_64(&arml2cc_sc->sc_ev_wbinv.ev_count);
arml2cc_cache_range_op(pa, len, L2C_CLEAN_INV_PA);
- arml2cc_cache_sync(arml2cc_sc);
}
Home |
Main Index |
Thread Index |
Old Index