There is the strong suspicion that the 0x7fffffff mask in the various
armv7 timecounters was simply copied from powerpc, and that these really
are full 32-bit counters.

I wanted to verify this from the data sheets, but I'm insufficiently
familiar with the ARM ecosystem to locate those.

Back in September 2017, Artturi Alm proposed the very same change
here but failed to make himself heard.


Index: arch/arm/cortex/agtimer.c
===================================================================
RCS file: /cvs/src/sys/arch/arm/cortex/agtimer.c,v
retrieving revision 1.9
diff -u -p -r1.9 agtimer.c
--- arch/arm/cortex/agtimer.c   11 Aug 2018 10:42:42 -0000      1.9
+++ arch/arm/cortex/agtimer.c   12 Jul 2020 16:13:22 -0000
@@ -46,7 +46,7 @@ int32_t agtimer_frequency = TIMER_FREQUE
 u_int agtimer_get_timecount(struct timecounter *);
 
 static struct timecounter agtimer_timecounter = {
-       agtimer_get_timecount, NULL, 0x7fffffff, 0, "agtimer", 0, NULL
+       agtimer_get_timecount, NULL, 0xffffffff, 0, "agtimer", 0, NULL
 };
 
 struct agtimer_pcpu_softc {
Index: arch/arm/cortex/amptimer.c
===================================================================
RCS file: /cvs/src/sys/arch/arm/cortex/amptimer.c,v
retrieving revision 1.7
diff -u -p -r1.7 amptimer.c
--- arch/arm/cortex/amptimer.c  6 Jul 2020 13:33:06 -0000       1.7
+++ arch/arm/cortex/amptimer.c  12 Jul 2020 16:13:37 -0000
@@ -67,7 +67,7 @@ int32_t amptimer_frequency = TIMER_FREQU
 u_int amptimer_get_timecount(struct timecounter *);
 
 static struct timecounter amptimer_timecounter = {
-       amptimer_get_timecount, NULL, 0x7fffffff, 0, "amptimer", 0, NULL, 0
+       amptimer_get_timecount, NULL, 0xffffffff, 0, "amptimer", 0, NULL, 0
 };
 
 #define MAX_ARM_CPUS   8
Index: arch/armv7/omap/gptimer.c
===================================================================
RCS file: /cvs/src/sys/arch/armv7/omap/gptimer.c,v
retrieving revision 1.8
diff -u -p -r1.8 gptimer.c
--- arch/armv7/omap/gptimer.c   6 Jul 2020 13:33:07 -0000       1.8
+++ arch/armv7/omap/gptimer.c   12 Jul 2020 15:53:06 -0000
@@ -117,7 +117,7 @@ int gptimer_irq = 0;
 u_int gptimer_get_timecount(struct timecounter *);
 
 static struct timecounter gptimer_timecounter = {
-       gptimer_get_timecount, NULL, 0x7fffffff, 0, "gptimer", 0, NULL, 0
+       gptimer_get_timecount, NULL, 0xffffffff, 0, "gptimer", 0, NULL, 0
 };
 
 volatile u_int32_t nexttickevent;
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to