mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 23:23:13 +00:00
Make kern.timecounter.hardware tunable
Noted and reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D29122
This commit is contained in:
committed by
Moyano, Gabriel
parent
c3fc52ec06
commit
2cf37001fc
@@ -273,6 +273,7 @@ SYSCTL_PROC(_kern_timecounter, OID_AUTO, alloweddeviation,
|
|||||||
volatile int rtc_generation = 1;
|
volatile int rtc_generation = 1;
|
||||||
|
|
||||||
static int tc_chosen; /* Non-zero if a specific tc was chosen via sysctl. */
|
static int tc_chosen; /* Non-zero if a specific tc was chosen via sysctl. */
|
||||||
|
static char tc_from_tunable[16];
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
static void tc_windup(struct bintime *new_boottimebin);
|
static void tc_windup(struct bintime *new_boottimebin);
|
||||||
@@ -1383,17 +1384,26 @@ tc_init(struct timecounter *tc)
|
|||||||
return;
|
return;
|
||||||
if (tc->tc_quality < 0)
|
if (tc->tc_quality < 0)
|
||||||
return;
|
return;
|
||||||
#endif /* __rtems__ */
|
if (tc_from_tunable[0] != '\0' &&
|
||||||
|
strcmp(tc->tc_name, tc_from_tunable) == 0) {
|
||||||
|
tc_chosen = 1;
|
||||||
|
tc_from_tunable[0] = '\0';
|
||||||
|
} else {
|
||||||
if (tc->tc_quality < timecounter->tc_quality)
|
if (tc->tc_quality < timecounter->tc_quality)
|
||||||
return;
|
return;
|
||||||
if (tc->tc_quality == timecounter->tc_quality &&
|
if (tc->tc_quality == timecounter->tc_quality &&
|
||||||
tc->tc_frequency < timecounter->tc_frequency)
|
tc->tc_frequency < timecounter->tc_frequency)
|
||||||
return;
|
return;
|
||||||
#ifndef __rtems__
|
}
|
||||||
(void)tc->tc_get_timecount(tc);
|
(void)tc->tc_get_timecount(tc);
|
||||||
#endif /* __rtems__ */
|
|
||||||
timecounter = tc;
|
timecounter = tc;
|
||||||
#ifdef __rtems__
|
#else /* __rtems__ */
|
||||||
|
if (tc->tc_quality < timecounter->tc_quality)
|
||||||
|
return;
|
||||||
|
if (tc->tc_quality == timecounter->tc_quality &&
|
||||||
|
tc->tc_frequency < timecounter->tc_frequency)
|
||||||
|
return;
|
||||||
|
timecounter = tc;
|
||||||
tc_windup(NULL);
|
tc_windup(NULL);
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
}
|
}
|
||||||
@@ -2224,6 +2234,9 @@ inittimehands(void *dummy)
|
|||||||
for (i = 1, thp = &ths[0]; i < timehands_count; thp = &ths[i++])
|
for (i = 1, thp = &ths[0]; i < timehands_count; thp = &ths[i++])
|
||||||
thp->th_next = &ths[i];
|
thp->th_next = &ths[i];
|
||||||
thp->th_next = &ths[0];
|
thp->th_next = &ths[0];
|
||||||
|
|
||||||
|
TUNABLE_STR_FETCH("kern.timecounter.hardware", tc_from_tunable,
|
||||||
|
sizeof(tc_from_tunable));
|
||||||
}
|
}
|
||||||
SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL);
|
SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user