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 Fix bitmask in A64 errata workaround and...



details:   https://anonhg.NetBSD.org/src/rev/c9b4fd0d2502
branches:  trunk
changeset: 447984:c9b4fd0d2502
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Jan 30 02:01:58 2019 +0000

description:
Fix bitmask in A64 errata workaround and write cval instead of tval on A64

diffstat:

 sys/arch/arm/cortex/gtmr.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (43 lines):

diff -r 2615bfdae75d -r c9b4fd0d2502 sys/arch/arm/cortex/gtmr.c
--- a/sys/arch/arm/cortex/gtmr.c        Wed Jan 30 02:00:02 2019 +0000
+++ b/sys/arch/arm/cortex/gtmr.c        Wed Jan 30 02:01:58 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gtmr.c,v 1.38 2018/11/15 17:15:52 jmcneill Exp $       */
+/*     $NetBSD: gtmr.c,v 1.39 2019/01/30 02:01:58 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.38 2018/11/15 17:15:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.39 2019/01/30 02:01:58 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -171,8 +171,8 @@
                u_int bits;
                do {
                        val = gtmr_cntvct_read();
-                       bits = val & __BITS(10,0);
-               } while (bits == 0 || bits == __BITS(10,0));
+                       bits = val & __BITS(9,0);
+               } while (bits == 0 || bits == __BITS(9,0));
                return val;
        }
 
@@ -298,7 +298,12 @@
        } else {
                delta = 0;
        }
-       gtmr_cntv_tval_write(sc->sc_autoinc - delta);
+
+       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);
+       }
 
        ci->ci_lastintr = now;
 



Home | Main Index | Thread Index | Old Index