Module Name: src Committed By: matt Date: Tue Jan 22 09:04:12 UTC 2013
Modified Files: src/sys/arch/arm/cortex: pl310.c Log Message: Don't "sync" atomic ops. Do sync after each range op. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/cortex/pl310.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/cortex/pl310.c diff -u src/sys/arch/arm/cortex/pl310.c:1.9 src/sys/arch/arm/cortex/pl310.c:1.10 --- src/sys/arch/arm/cortex/pl310.c:1.9 Wed Nov 28 22:48:13 2012 +++ src/sys/arch/arm/cortex/pl310.c Tue Jan 22 09:04:12 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pl310.c,v 1.9 2012/11/28 22:48:13 matt Exp $ */ +/* $NetBSD: pl310.c,v 1.10 2013/01/22 09:04:12 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.9 2012/11/28 22:48:13 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.10 2013/01/22 09:04:12 matt Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -195,11 +195,14 @@ arml2cc_attach(device_t parent, device_t } static inline void -arml2cc_cache_op(struct arml2cc_softc *sc, bus_size_t off, uint32_t val) +arml2cc_cache_op(struct arml2cc_softc *sc, bus_size_t off, uint32_t val, + bool wait) { arml2cc_write_4(sc, off, val); - while (arml2cc_read_4(sc, off) & 1) { - /* spin */ + if (wait) { + while (arml2cc_read_4(sc, off) & 1) { + /* spin */ + } } } @@ -215,7 +218,7 @@ arml2cc_cache_way_op(struct arml2cc_soft static inline void arml2cc_cache_sync(struct arml2cc_softc *sc) { - arml2cc_cache_op(sc, L2C_CACHE_SYNC, 0); + arml2cc_cache_op(sc, L2C_CACHE_SYNC, 0, true); } static inline void @@ -294,7 +297,7 @@ arml2cc_cache_range_op(paddr_t pa, psize return; } for (paddr_t segend = pa + seglen; pa < segend; pa += line_size) { - arml2cc_cache_op(sc, cache_op, pa); + arml2cc_cache_op(sc, cache_op, pa, false); } mutex_spin_exit(&sc->sc_lock); } @@ -305,6 +308,7 @@ arml2cc_sdcache_inv_range(vaddr_t va, pa { 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 @@ -312,6 +316,7 @@ arml2cc_sdcache_wb_range(vaddr_t va, pad { 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 @@ -319,4 +324,5 @@ arml2cc_sdcache_wbinv_range(vaddr_t va, { 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); }