Skip to content

Commit

Permalink
CONFIG/UCS/SYS: Check _ppc_get_timebase declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrygx committed Nov 2, 2021
1 parent 8f9b96b commit ac6bc97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion config/m4/sysdep.m4
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,19 @@ AC_CHECK_DECLS([ethtool_cmd_speed, SPEED_UNKNOWN], [], [],


#
# PowerPC query for TB frequency
# PowerPC query for getting TB frequency
#
AC_CHECK_DECLS([__ppc_get_timebase_freq], [], [], [#include <sys/platform/ppc.h>])
AC_CHECK_HEADERS([sys/platform/ppc.h])


#
# PowerPC query for getting TB
#
AC_CHECK_DECLS([__ppc_get_timebase], [], [], [#include <sys/platform/ppc.h>])
AC_CHECK_HEADERS([sys/platform/ppc.h])


#
# Google Testing framework
#
Expand Down
6 changes: 3 additions & 3 deletions src/ucs/arch/ppc64/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ BEGIN_C_DECLS

static inline uint64_t ucs_arch_read_hres_clock()
{
#ifndef HAVE_SYS_PLATFORM_PPC_H
#if HAVE_DECL___PPC_GET_TIMEBASE
return __ppc_get_timebase();
#else
uint64_t tb;
asm volatile ("mfspr %0, 268" : "=r" (tb));
return tb;
#else
return __ppc_get_timebase();
#endif
}

Expand Down

0 comments on commit ac6bc97

Please sign in to comment.