[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [POWERPC][XEN] Make many of the timbase routine static inline



# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 94aa7e921ccd079035d62841ffca76aa804b0992
# Parent  18b3cbb04dc36d9bd6b760cc47901bce3a77fd48
[POWERPC][XEN] Make many of the timbase routine static inline

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 xen/arch/powerpc/time.c        |   34 ----------------------------------
 xen/include/asm-powerpc/time.h |   38 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 36 deletions(-)

diff -r 18b3cbb04dc3 -r 94aa7e921ccd xen/arch/powerpc/time.c
--- a/xen/arch/powerpc/time.c   Fri Sep 01 12:37:29 2006 -0400
+++ b/xen/arch/powerpc/time.c   Fri Sep 01 13:14:53 2006 -0400
@@ -34,40 +34,6 @@ unsigned long cpu_khz;
 unsigned long cpu_khz;
 unsigned int timebase_freq;
 
-u64 get_timebase(void)
-{
-    u64 s;
-
-#ifdef __PPC64__
-    s = mftb();
-#else
-    do {
-        unsigned up;
-        unsigned lo;
-        unsigned up2;
-
-        up = mftbu();
-        lo = mftbl();
-        up2 = mftbu();
-    } while (up1 != up2);
-    s = ((ulong)up << 32) | lo;
-#endif
-    return s;
-}
-
-static ulong ns_to_tb(ulong ns)
-{
-    return (ns * timebase_freq) / 1000000000ULL;
-}
-
-static ulong tb_to_ns(ulong tb)
-{
-    return tb * (1000000000ULL / timebase_freq);
-}
-
-/*
- * Return nanoseconds from time of boot
- */
 s_time_t get_s_time(void)
 {
     return tb_to_ns(get_timebase());
diff -r 18b3cbb04dc3 -r 94aa7e921ccd xen/include/asm-powerpc/time.h
--- a/xen/include/asm-powerpc/time.h    Fri Sep 01 12:37:29 2006 -0400
+++ b/xen/include/asm-powerpc/time.h    Fri Sep 01 13:14:53 2006 -0400
@@ -13,15 +13,19 @@
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005
+ * Copyright (C) IBM Corp. 2005, 2006
  *
  * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
+ *          Hollis Blanchard <jimix@xxxxxxxxxxxxxx>
  */
 
 #ifndef _ASM_TIME_H_
 #define _ASM_TIME_H_
 
 #include <xen/types.h>
+#include <xen/time.h>
+#include <xen/percpu.h>
+#include <asm/processor.h>
 
 extern unsigned int timebase_freq;
 #define CLOCK_TICK_RATE timebase_freq
@@ -29,7 +33,26 @@ extern unsigned int timebase_freq;
 #define watchdog_disable() ((void)0)
 #define watchdog_enable()  ((void)0)
 
-extern u64 get_timebase(void);
+static inline u64 get_timebase(void)
+{
+    u64 s;
+
+#ifdef __PPC64__
+    s = mftb();
+#else
+    do {
+        unsigned up;
+        unsigned lo;
+        unsigned up2;
+
+        up = mftbu();
+        lo = mftbl();
+        up2 = mftbu();
+    } while (up1 != up2);
+    s = ((ulong)up << 32) | lo;
+#endif
+    return s;
+}
 
 typedef u64 cycles_t;
 static inline cycles_t get_cycles(void)
@@ -39,4 +62,15 @@ static inline cycles_t get_cycles(void)
     return c;
 }
 
+#define __nano(s) ((s) * 1000000000ULL)
+
+static inline u64 ns_to_tb(u64 ns)
+{
+    return (ns * timebase_freq) / __nano(1);
+}
+
+static inline u64 tb_to_ns(u64 tb)
+{
+    return tb * (__nano(1) / timebase_freq);
+}
 #endif

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.