|
|
|
|
|
|
|
|
|
|
xen-ppc-devel
[XenPPC] [xenppc-unstable] [POWERPC][XEN] Make many of the timbase routi
# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID d9e8012184b8cb65fe70baaa3c8cd1c6d0a60f55
# Parent 9624fbe4b206ff39f422962b65adeeae90ff519d
[POWERPC][XEN] Make many of the timbase routine static inline
Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
xen/arch/powerpc/time.c | 34 ----------------------------------
xen/include/asm-powerpc/time.h | 38 ++++++++++++++++++++++++++++++++++++--
2 files changed, 36 insertions(+), 36 deletions(-)
diff -r 9624fbe4b206 -r d9e8012184b8 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 9624fbe4b206 -r d9e8012184b8 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-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [XenPPC] [xenppc-unstable] [POWERPC][XEN] Make many of the timbase routine static inline,
Xen patchbot-xenppc-unstable <=
|
|
|
|
|