]> Zhao Yanbai Git Server - minix.git/commitdiff
arm timer fix 58/658/2
authorBen Gras <ben@minix3.org>
Wed, 19 Jun 2013 09:39:05 +0000 (11:39 +0200)
committerBen Gras <ben@minix3.org>
Wed, 19 Jun 2013 11:11:32 +0000 (13:11 +0200)
. set 'done' once initialized so 32-bit read frc works,
  thanks to keesj
. make sure the software-implemented upper 32 bit of the 64-bit
  "tsc" value works OK by adding an assert in one of its calls

Change-Id: I5ce24fea919f4610c6a86ac7ec9f04b1815620c2

kernel/arch/earm/arch_clock.c
kernel/arch/earm/omap_timer.c

index 0235e1d1a3ebd4c6569e936391fa81c1e420c86f..8a0e7b1d4b5833af7d10c9b8cdaf629f48df9e3e 100644 (file)
@@ -10,6 +10,8 @@
 #include "kernel/glo.h"
 #include "kernel/profile.h"
 
+#include <assert.h>
+
 
 #include "kernel/spinlock.h"
 
@@ -61,6 +63,7 @@ void context_stop(struct proc * p)
        u64_t * __tsc_ctr_switch = get_cpulocal_var_ptr(tsc_ctr_switch);
 
        read_tsc_64(&tsc);
+       assert(tsc >= *__tsc_ctr_switch);
        tsc_delta = tsc - *__tsc_ctr_switch;
        p->p_cycles += tsc_delta;
 
index ca458a43864230b7972422c55ec359c6a42a319d..8f742e66df6e1bebdd6791f7f217c18d9daea019 100644 (file)
@@ -198,6 +198,7 @@ void omap3_frclock_init(void)
     /* Start timer */
     mmio_set(fr_timer.base + fr_timer.regs->TCLR,
             OMAP3_TCLR_OVF_TRG|OMAP3_TCLR_AR|OMAP3_TCLR_ST|OMAP3_TCLR_PRE);
+    done = 1;
 }
 
 void omap3_frclock_stop()