Skip to content

Commit 77286a4

Browse files
committed
opal/sys: Introduce OPAL_HAVE_SYS_TIMER_GET_FREQ macro
... to avoid using an architecture name macro in `opal/mca/timer/linux/timer_linux_component.c`. The function name `opal_sys_timer_freq` is also changed for consistency with `opal_sys_timer_get_cycles`. Signed-off-by: KAWASHIMA Takahiro <t-kawashima@jp.fujitsu.com>
1 parent f2c108b commit 77286a4

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

opal/include/opal/sys/arm64/timer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ opal_sys_timer_get_cycles(void)
3131

3232

3333
static inline opal_timer_t
34-
opal_sys_timer_freq(void)
34+
opal_sys_timer_get_freq(void)
3535
{
3636
opal_timer_t freq;
3737
__asm__ __volatile__ ("mrs %0, CNTFRQ_EL0" : "=r" (freq));
3838
return (opal_timer_t)(freq);
3939
}
4040

4141
#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 1
42+
#define OPAL_HAVE_SYS_TIMER_GET_FREQ 1
4243

4344
#endif /* ! OPAL_SYS_ARCH_TIMER_H */

opal/include/opal/sys/timer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ BEGIN_C_DECLS
9898

9999
typedef long opal_timer_t;
100100
#endif
101+
102+
#ifndef OPAL_HAVE_SYS_TIMER_GET_FREQ
103+
#define OPAL_HAVE_SYS_TIMER_GET_FREQ 0
104+
#endif
101105
#endif
102106

103107
#ifndef OPAL_HAVE_SYS_TIMER_IS_MONOTONIC

opal/mca/timer/linux/timer_linux_component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ static int opal_timer_linux_find_freq(void)
117117

118118
opal_timer_linux_freq = 0;
119119

120-
#if OPAL_ASSEMBLY_ARCH == OPAL_ARM64
121-
opal_timer_linux_freq = opal_sys_timer_freq();
120+
#if OPAL_HAVE_SYS_TIMER_GET_FREQ
121+
opal_timer_linux_freq = opal_sys_timer_get_freq();
122122
#endif
123123

124124
if (0 == opal_timer_linux_freq) {

0 commit comments

Comments
 (0)