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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sun Sep 23 16:41:12 2012 +0200

cobalt/arm: support any type of tsc emulation with I-pipe core patches

---

 include/asm-arm/bits/shadow.h |   57 ++++++++++++++++++++++++++++++++++++++--
 include/asm-arm/syscall.h     |    5 +++-
 2 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/include/asm-arm/bits/shadow.h b/include/asm-arm/bits/shadow.h
index 396aaaa..2fc09a6 100644
--- a/include/asm-arm/bits/shadow.h
+++ b/include/asm-arm/bits/shadow.h
@@ -72,9 +72,60 @@ int xnarch_local_syscall(unsigned long a1, unsigned long a2,
                if (error)
                        return error;
 
-               info.counter = RTHAL_TSC_INFO(&ipipe_info).u.fr.counter;
-               info.tsc_get =
-                       (__xn_rdtsc_t *)(((char *)&__ipipe_tsc_get) + 4);
+               switch (RTHAL_TSC_INFO(&ipipe_info).type) {
+               case IPIPE_TSC_TYPE_FREERUNNING:
+                       info.type = __XN_TSC_TYPE_FREERUNNING,
+                       info.counter = RTHAL_TSC_INFO(&ipipe_info).u.fr.counter;
+                       info.mask = RTHAL_TSC_INFO(&ipipe_info).u.fr.mask;
+                       info.tsc = RTHAL_TSC_INFO(&ipipe_info).u.fr.tsc;
+                       break;
+               case IPIPE_TSC_TYPE_DECREMENTER:
+                       info.type = __XN_TSC_TYPE_DECREMENTER,
+                       info.counter = 
RTHAL_TSC_INFO(&ipipe_info).u.dec.counter;
+                       info.mask = RTHAL_TSC_INFO(&ipipe_info).u.dec.mask;
+                       info.last_cnt = 
RTHAL_TSC_INFO(&ipipe_info).u.dec.last_cnt;
+                       info.tsc = RTHAL_TSC_INFO(&ipipe_info).u.dec.tsc;
+                       break;
+#ifdef IPIPE_TSC_TYPE_FREERUNNING_COUNTDOWN
+               case IPIPE_TSC_TYPE_FREERUNNING_COUNTDOWN:
+                       info.type = __XN_TSC_TYPE_FREERUNNING_COUNTDOWN,
+                       info.counter = RTHAL_TSC_INFO(&ipipe_info).u.fr.counter;
+                       info.mask = RTHAL_TSC_INFO(&ipipe_info).u.fr.mask;
+                       info.tsc = RTHAL_TSC_INFO(&ipipe_info).u.fr.tsc;
+                       break;
+#endif /* IPIPE_TSC_TYPE_FREERUNNING_COUNTDOWN */
+#ifdef IPIPE_TSC_TYPE_FREERUNNING_TWICE
+               case IPIPE_TSC_TYPE_FREERUNNING_TWICE:
+                       /*
+                        * Requires kuser, not backward compatible
+                        * with old xenomai versions
+                        */
+                       info.type = __XN_TSC_TYPE_KUSER,
+                       info.counter = RTHAL_TSC_INFO(&ipipe_info).u.fr.counter;
+                       info.mask = RTHAL_TSC_INFO(&ipipe_info).u.fr.mask;
+                       info.tsc = RTHAL_TSC_INFO(&ipipe_info).u.fr.tsc;
+                       break;
+#endif /* IPIPE_TSC_TYPE_FREERUNNING_TWICE */
+               default:
+#if IPIPE_CORE_APIREV >= 1
+                       /*
+                        * Newer tsc types, require kuser, not
+                        * backward compatible with old xenomai
+                        * versions
+                        */
+                       info.type = __XN_TSC_TYPE_KUSER;
+                       info.counter = (void *)
+                               RTHAL_TSC_INFO(&ipipe_info).u.counter_paddr;
+                       info.mask = RTHAL_TSC_INFO(&ipipe_info).u.mask;
+                       info.tsc = RTHAL_TSC_INFO(&ipipe_info).u.fr.tsc;
+                       break;
+#else
+                       return -EINVAL;
+#endif /* IPIPE_CORE_APIREV >= 1 */
+               case IPIPE_TSC_TYPE_NONE:
+                       return -ENOSYS;
+
+               }
 
                if (__xn_copy_to_user((void *)a2, &info, sizeof(info)))
                        return -EFAULT;
diff --git a/include/asm-arm/syscall.h b/include/asm-arm/syscall.h
index 0977681..7f5b8cd 100644
--- a/include/asm-arm/syscall.h
+++ b/include/asm-arm/syscall.h
@@ -233,8 +233,11 @@ static inline int __xn_interrupted_p(struct pt_regs *regs)
 typedef unsigned long long __xn_rdtsc_t(volatile unsigned *);
 
 struct __xn_tscinfo {
+       int type;               /* Must remain first member */
+       unsigned mask;
        volatile unsigned *counter;
-       __xn_rdtsc_t *tsc_get;
+       volatile unsigned *last_cnt; /* Only used by decrementers */
+       volatile unsigned long long *tsc;
 };
 
 #ifndef __KERNEL__


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

Reply via email to