On Fri, Sep 01, 2017 at 01:23:35AM +0300, Artturi Alm wrote:
> Hi,
> 
> I was looking at /sys/sys/timetc.h:
> 46 struct timecounter {
>  47         timecounter_get_t       *tc_get_timecount;
>  48                 /*
>  49                  * This function reads the counter.  It is not required to
>  50                  * mask any unimplemented bits out, as long as they are
>  51                  * constant.
>  52                  */
> 
> "as long as they are constant."
> and came up w/diff below, because all of these return their fullest(32b):
> 
> 182 u_int
> 183 agtimer_get_timecount(struct timecounter *tc)
> 184 {
> 185         return agtimer_readcnt64();
> 
> 
> 216 u_int
> 217 amptimer_get_timecount(struct timecounter *tc)
> 218 {
> 219         struct amptimer_softc *sc = amptimer_timecounter.tc_priv;
> 220         return bus_space_read_4(sc->sc_iot, sc->sc_ioh, GTIMER_CNT_LOW);
> 
> 
> 437 u_int
> 438 gptimer_get_timecount(struct timecounter *tc)
> 439 {
> 440         return bus_space_read_4(gptimer_iot, gptimer_ioh1, GP_TCRR);
> 
> 
> tbh., i didn't have time to read kern_tc.c to see if it does really matter,
> i think not, and it's obvious that this isn't critical or it'd be known by
> now i guess, or if this does count as a bug at all, but i see no value in
> stealing the msb from these tc sources :)
> 
> -Artturi
> 

Do i really need to reference datasheets, or would someone explain to me
the value of this MSB robbing?

-Artturi

> 
> diff --git a/sys/arch/arm/cortex/agtimer.c b/sys/arch/arm/cortex/agtimer.c
> index 8d622c058a4..160e22e6949 100644
> --- a/sys/arch/arm/cortex/agtimer.c
> +++ b/sys/arch/arm/cortex/agtimer.c
> @@ -46,7 +46,7 @@ int32_t agtimer_frequency = TIMER_FREQUENCY;
>  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
>  };
>  
>  #define MAX_ARM_CPUS 8
> diff --git a/sys/arch/arm/cortex/amptimer.c b/sys/arch/arm/cortex/amptimer.c
> index 81880c1574a..66f0ccfed64 100644
> --- a/sys/arch/arm/cortex/amptimer.c
> +++ b/sys/arch/arm/cortex/amptimer.c
> @@ -67,7 +67,7 @@ int32_t amptimer_frequency = TIMER_FREQUENCY;
>  u_int amptimer_get_timecount(struct timecounter *);
>  
>  static struct timecounter amptimer_timecounter = {
> -     amptimer_get_timecount, NULL, 0x7fffffff, 0, "amptimer", 0, NULL
> +     amptimer_get_timecount, NULL, 0xffffffff, 0, "amptimer", 0, NULL
>  };
>  
>  #define MAX_ARM_CPUS 8
> diff --git a/sys/arch/armv7/omap/gptimer.c b/sys/arch/armv7/omap/gptimer.c
> index e5fd9965ded..a2e3e4e97a2 100644
> --- a/sys/arch/armv7/omap/gptimer.c
> +++ b/sys/arch/armv7/omap/gptimer.c
> @@ -118,7 +118,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
> +     gptimer_get_timecount, NULL, 0xffffffff, 0, "gptimer", 0, NULL
>  };
>  
>  volatile u_int32_t nexttickevent;

Reply via email to