Module: xenomai-2.6 Branch: master Commit: d78573752e6a95327c49ea16d437cd127e506220 URL: http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=d78573752e6a95327c49ea16d437cd127e506220
Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org> Date: Sat Apr 27 23:20:18 2013 +0200 hal/powerpc: move __xn_rdtsc definition to asm/tsc.h --- include/asm-powerpc/Makefile.am | 2 +- include/asm-powerpc/Makefile.in | 2 +- include/asm-powerpc/syscall.h | 27 +------------------ include/asm-powerpc/tsc.h | 56 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 28 deletions(-) diff --git a/include/asm-powerpc/Makefile.am b/include/asm-powerpc/Makefile.am index 7c198df..745d803 100644 --- a/include/asm-powerpc/Makefile.am +++ b/include/asm-powerpc/Makefile.am @@ -1,6 +1,6 @@ includesubdir = $(includedir)/asm-powerpc includesub_HEADERS = arith.h atomic.h atomic_asm.h calibration.h features.h \ - fptest.h hal.h syscall.h system.h wrappers.h + fptest.h hal.h syscall.h system.h tsc.h wrappers.h SUBDIRS = bits diff --git a/include/asm-powerpc/Makefile.in b/include/asm-powerpc/Makefile.in index 6733456..7a175b8 100644 --- a/include/asm-powerpc/Makefile.in +++ b/include/asm-powerpc/Makefile.in @@ -283,7 +283,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ includesubdir = $(includedir)/asm-powerpc includesub_HEADERS = arith.h atomic.h atomic_asm.h calibration.h features.h \ - fptest.h hal.h syscall.h system.h wrappers.h + fptest.h hal.h syscall.h system.h tsc.h wrappers.h SUBDIRS = bits all: all-recursive diff --git a/include/asm-powerpc/syscall.h b/include/asm-powerpc/syscall.h index b116101..b5fd8cd 100644 --- a/include/asm-powerpc/syscall.h +++ b/include/asm-powerpc/syscall.h @@ -24,6 +24,7 @@ #define _XENO_ASM_POWERPC_SYSCALL_H #include <asm-generic/xenomai/syscall.h> +#include <asm/xenomai/tsc.h> #define __xn_mux_code(shifted_id,op) ((op << 24)|shifted_id|(__xn_sys_mux & 0xffff)) #define __xn_mux_shifted_id(id) ((id << 16) & 0xff0000) @@ -151,32 +152,6 @@ static inline int __xn_interrupted_p(struct pt_regs *regs) #define XENOMAI_SKINCALL4(id,op,a1,a2,a3,a4) XENOMAI_DO_SYSCALL(4,id,op,a1,a2,a3,a4) #define XENOMAI_SKINCALL5(id,op,a1,a2,a3,a4,a5) XENOMAI_DO_SYSCALL(5,id,op,a1,a2,a3,a4,a5) -static inline unsigned long long __xn_rdtsc(void) -#if defined(__powerpc64__) -{ - unsigned long long t; - - __asm__ __volatile__("mftb %0\n":"=r"(t)); - return t; -} -#else /* !__powerpc64__ */ -{ - union { - unsigned long long t; - unsigned long v[2]; - } u; - unsigned long __tbu; - - __asm__ __volatile__("1: mfspr %0,269\n" - "mfspr %1,268\n" - "mfspr %2,269\n" - "cmpw %2,%0\n" - "bne- 1b\n":"=r"(u.v[0]), - "=r"(u.v[1]), "=r"(__tbu)); - return u.t; -} -#endif /* __powerpc64__ */ - #endif /* __KERNEL__ */ #endif /* !_XENO_ASM_POWERPC_SYSCALL_H */ diff --git a/include/asm-powerpc/tsc.h b/include/asm-powerpc/tsc.h new file mode 100644 index 0000000..51e3ff7 --- /dev/null +++ b/include/asm-powerpc/tsc.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2001,2002,2003,2004 Philippe Gerum <r...@xenomai.org>. + * + * 64-bit PowerPC adoption + * copyright (C) 2005 Taneli Vähäkangas and Heikki Lindholm + * + * Xenomai is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * Xenomai is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Xenomai; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef _XENO_ASM_POWERPC_TSC_H +#define _XENO_ASM_POWERPC_TSC_H + +#ifndef __KERNEL__ + +static inline unsigned long long __xn_rdtsc(void) +#if defined(__powerpc64__) +{ + unsigned long long t; + + __asm__ __volatile__("mftb %0\n":"=r"(t)); + return t; +} +#else /* !__powerpc64__ */ +{ + union { + unsigned long long t; + unsigned long v[2]; + } u; + unsigned long __tbu; + + __asm__ __volatile__("1: mfspr %0,269\n" + "mfspr %1,268\n" + "mfspr %2,269\n" + "cmpw %2,%0\n" + "bne- 1b\n":"=r"(u.v[0]), + "=r"(u.v[1]), "=r"(__tbu)); + return u.t; +} +#endif /* __powerpc64__ */ + +#endif /* __KERNEL__ */ + +#endif /* _XENO_ASM_POWERPC_TSC_H */ _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git