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 Disable counter before updating cval/tval



details:   https://anonhg.NetBSD.org/src/rev/de6481fbe350
branches:  trunk
changeset: 457207:de6481fbe350
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jun 16 10:57:59 2019 +0000

description:
Disable counter before updating cval/tval

diffstat:

 sys/arch/arm/cortex/gtmr.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r e547baa638b8 -r de6481fbe350 sys/arch/arm/cortex/gtmr.c
--- a/sys/arch/arm/cortex/gtmr.c        Sun Jun 16 10:45:50 2019 +0000
+++ b/sys/arch/arm/cortex/gtmr.c        Sun Jun 16 10:57:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gtmr.c,v 1.39 2019/01/30 02:01:58 jmcneill Exp $       */
+/*     $NetBSD: gtmr.c,v 1.40 2019/06/16 10:57:59 jmcneill Exp $       */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.39 2019/01/30 02:01:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.40 2019/06/16 10:57:59 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -268,6 +268,9 @@
        if ((ctl & CNTCTL_ISTATUS) == 0)
                return 0;
 
+       arm_isb();
+       gtmr_cntv_ctl_write(0);
+
        const uint64_t now = gtmr_read_cntvct(sc);
        uint64_t delta = now - ci->ci_lastintr;
 
@@ -299,12 +302,16 @@
                delta = 0;
        }
 
+       arm_isb();
        if (ISSET(sc->sc_flags, GTMR_FLAG_SUN50I_A64_UNSTABLE_TIMER)) {
                gtmr_cntv_cval_write(now + sc->sc_autoinc - delta);
        } else {
                gtmr_cntv_tval_write(sc->sc_autoinc - delta);
        }
 
+       arm_isb();
+       gtmr_cntv_ctl_write(CNTCTL_ENABLE);
+
        ci->ci_lastintr = now;
 
 #ifdef DIAGNOSTIC



Home | Main Index | Thread Index | Old Index