Module: xenomai-2.6
Branch: master
Commit: 4239877f1c0c48b27f2b9958b1258982f75a6bd8
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=4239877f1c0c48b27f2b9958b1258982f75a6bd8

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Thu Sep  6 01:14:14 2012 +0200

hal/x86: use I-pipe core API rev 2 for tsc

Now that this API revision is the standard for Xenomai 2.6.2, use it.

---

 include/asm-x86/features_32.h |    4 +++-
 include/asm-x86/hal_32.h      |   12 +++++++-----
 ksrc/arch/x86/hal_32.c        |   10 +++++-----
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/include/asm-x86/features_32.h b/include/asm-x86/features_32.h
index d837c0e..351b14b 100644
--- a/include/asm-x86/features_32.h
+++ b/include/asm-x86/features_32.h
@@ -23,6 +23,7 @@
 #include <asm-generic/xenomai/features.h>
 
 #ifdef __KERNEL__
+#include <asm/xenomai/wrappers.h>
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 /*
  * The kernel will deal dynamically with the actual SEP support
@@ -35,6 +36,7 @@
 #endif /* KERNEL_VERSION >= 2.6.0 */
 #else /* !__KERNEL__ */
 #define cpu_has_tsc 1
+#define IPIPE_CORE_APIREV 0
 #endif /* !__KERNEL__ */
 
 #define __xn_feat_x86_sep 0x00000001
@@ -43,7 +45,7 @@
 /* The ABI revision level we use on this arch. */
 #define XENOMAI_ABI_REV   4UL
 
-#ifdef CONFIG_X86_TSC
+#if defined(CONFIG_X86_TSC) || IPIPE_CORE_APIREV >= 2
 #define __xn_feat_x86_tsc_mask (cpu_has_tsc ? __xn_feat_x86_tsc : 0)
 #define XNARCH_HAVE_NONPRIV_TSC  1
 #else
diff --git a/include/asm-x86/hal_32.h b/include/asm-x86/hal_32.h
index 62dadc7..71ffa90 100644
--- a/include/asm-x86/hal_32.h
+++ b/include/asm-x86/hal_32.h
@@ -45,8 +45,10 @@
 #else
 # define RTHAL_TIMER_DEVICE            "pit"
 #endif
-#ifdef CONFIG_X86_TSC
-# define RTHAL_CLOCK_DEVICE            (cpu_has_tsc ? "tsc" : "pit")
+#if IPIPE_CORE_APIREV >= 2
+# define RTHAL_CLOCK_DEVICE            (ipipe_clock_name())
+#elif defined(CONFIG_X86_TSC)
+# define RTHAL_CLOCK_DEVICE            "tsc"
 #else
 # define RTHAL_CLOCK_DEVICE            "pit"
 #endif
@@ -135,19 +137,19 @@ static inline void rthal_release_control(void)
        rthal_smi_restore();
 }
 
-#ifdef CONFIG_X86_TSC
+#if defined(CONFIG_X86_TSC) || IPIPE_CORE_APIREV >= 2
 static inline unsigned long long rthal_rdtsc(void)
 {
        unsigned long long t;
        rthal_read_tsc(t);
        return t;
 }
-#else /* !CONFIG_X86_TSC */
+#else /* !CONFIG_X86_TSC && IPIPE_CORE_APIREV < 2 */
 #define RTHAL_8254_COUNT2LATCH  0xfffe
 void rthal_setup_8254_tsc(void);
 rthal_time_t rthal_get_8254_tsc(void);
 #define rthal_rdtsc() rthal_get_8254_tsc()
-#endif /* CONFIG_X86_TSC */
+#endif /* !CONFIG_X86_TSC && IPIPE_CORE_APIREV < 2 */
 
 static inline void rthal_timer_program_shot(unsigned long delay)
 {
diff --git a/ksrc/arch/x86/hal_32.c b/ksrc/arch/x86/hal_32.c
index 01c5439..1a362e7 100644
--- a/ksrc/arch/x86/hal_32.c
+++ b/ksrc/arch/x86/hal_32.c
@@ -282,7 +282,7 @@ void rthal_timer_release(int cpu)
 
 #endif /* !CONFIG_X86_LOCAL_APIC */
 
-#ifndef CONFIG_X86_TSC
+#if !defined(CONFIG_X86_TSC) && IPIPE_CORE_APIREV < 2
 
 static rthal_time_t rthal_tsc_8254;
 
@@ -337,7 +337,7 @@ rthal_time_t rthal_get_8254_tsc(void)
        return t;
 }
 
-#endif /* !CONFIG_X86_TSC */
+#endif /* !CONFIG_X86_TSC && IPIPE_CORE_APIREV < 2*/
 
 int rthal_arch_init(void)
 {
@@ -372,7 +372,7 @@ int rthal_arch_init(void)
 #endif /* !I-pipe core */
 
        if (rthal_cpufreq_arg == 0)
-#ifdef CONFIG_X86_TSC
+#if defined(CONFIG_X86_TSC) || IPIPE_CORE_APIREV >= 2
                /* FIXME: 4Ghz barrier is close... */
                rthal_cpufreq_arg = rthal_get_cpufreq();
 #else /* ! CONFIG_X86_TSC */
@@ -409,6 +409,6 @@ void rthal_arch_cleanup(void)
 
 EXPORT_SYMBOL_GPL(rthal_arch_init);
 EXPORT_SYMBOL_GPL(rthal_arch_cleanup);
-#ifndef CONFIG_X86_TSC
+#if !defined(CONFIG_X86_TSC) && IPIPE_CORE_APIREV < 2
 EXPORT_SYMBOL_GPL(rthal_get_8254_tsc);
-#endif /* !CONFIG_X86_TSC */
+#endif /* !CONFIG_X86_TSC && IPIPE_CORE_APIREV < 2 */


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to