aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2009-09-09 22:48:56 -0400
committerThomas Gleixner <tglx@linutronix.de>2009-09-16 08:34:50 -0400
commit7bd867dfb4e0357e06a3211ab2bd0e714110def3 (patch)
treefb66f4944f655ba594a7ae98f640e2310a389559 /arch/x86/include
parent54e2603f1a85b9725aa13518d69148b6e7061aa9 (diff)
x86: Move get/set_wallclock to x86_platform_ops
get/set_wallclock() have already a set of platform dependent implementations (default, EFI, paravirt). MRST will add another variant. Moving them to platform ops simplifies the existing code and minimizes the effort to integrate new variants. Signed-off-by: Feng Tang <feng.tang@intel.com> LKML-Reference: <new-submission> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/paravirt.h10
-rw-r--r--arch/x86/include/asm/paravirt_types.h4
-rw-r--r--arch/x86/include/asm/time.h50
-rw-r--r--arch/x86/include/asm/x86_init.h4
4 files changed, 4 insertions, 64 deletions
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index 1e458a553303..a69ae87bd7d8 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -24,16 +24,6 @@ static inline void load_sp0(struct tss_struct *tss,
24 PVOP_VCALL2(pv_cpu_ops.load_sp0, tss, thread); 24 PVOP_VCALL2(pv_cpu_ops.load_sp0, tss, thread);
25} 25}
26 26
27static inline unsigned long get_wallclock(void)
28{
29 return PVOP_CALL0(unsigned long, pv_time_ops.get_wallclock);
30}
31
32static inline int set_wallclock(unsigned long nowtime)
33{
34 return PVOP_CALL1(int, pv_time_ops.set_wallclock, nowtime);
35}
36
37/* The paravirtualized CPUID instruction. */ 27/* The paravirtualized CPUID instruction. */
38static inline void __cpuid(unsigned int *eax, unsigned int *ebx, 28static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
39 unsigned int *ecx, unsigned int *edx) 29 unsigned int *ecx, unsigned int *edx)
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index 0d812e592e3b..c25d5e3bdf9c 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -88,10 +88,6 @@ struct pv_lazy_ops {
88}; 88};
89 89
90struct pv_time_ops { 90struct pv_time_ops {
91 /* Set and set time of day */
92 unsigned long (*get_wallclock)(void);
93 int (*set_wallclock)(unsigned long);
94
95 unsigned long long (*sched_clock)(void); 91 unsigned long long (*sched_clock)(void);
96 unsigned long (*get_tsc_khz)(void); 92 unsigned long (*get_tsc_khz)(void);
97}; 93};
diff --git a/arch/x86/include/asm/time.h b/arch/x86/include/asm/time.h
index 9c5608b21c27..7bdec4e9b739 100644
--- a/arch/x86/include/asm/time.h
+++ b/arch/x86/include/asm/time.h
@@ -4,57 +4,7 @@
4extern void hpet_time_init(void); 4extern void hpet_time_init(void);
5 5
6#include <asm/mc146818rtc.h> 6#include <asm/mc146818rtc.h>
7#ifdef CONFIG_X86_32
8#include <linux/efi.h>
9
10static inline unsigned long native_get_wallclock(void)
11{
12 unsigned long retval;
13
14 if (efi_enabled)
15 retval = efi_get_time();
16 else
17 retval = mach_get_cmos_time();
18
19 return retval;
20}
21
22static inline int native_set_wallclock(unsigned long nowtime)
23{
24 int retval;
25
26 if (efi_enabled)
27 retval = efi_set_rtc_mmss(nowtime);
28 else
29 retval = mach_set_rtc_mmss(nowtime);
30
31 return retval;
32}
33
34#else
35extern void native_time_init_hook(void);
36
37static inline unsigned long native_get_wallclock(void)
38{
39 return mach_get_cmos_time();
40}
41
42static inline int native_set_wallclock(unsigned long nowtime)
43{
44 return mach_set_rtc_mmss(nowtime);
45}
46
47#endif
48 7
49extern void time_init(void); 8extern void time_init(void);
50 9
51#ifdef CONFIG_PARAVIRT
52#include <asm/paravirt.h>
53#else /* !CONFIG_PARAVIRT */
54
55#define get_wallclock() native_get_wallclock()
56#define set_wallclock(x) native_set_wallclock(x)
57
58#endif /* CONFIG_PARAVIRT */
59
60#endif /* _ASM_X86_TIME_H */ 10#endif /* _ASM_X86_TIME_H */
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index b6c89428137d..2c756fd4ab0e 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -114,9 +114,13 @@ struct x86_cpuinit_ops {
114/** 114/**
115 * struct x86_platform_ops - platform specific runtime functions 115 * struct x86_platform_ops - platform specific runtime functions
116 * @calibrate_tsc: calibrate TSC 116 * @calibrate_tsc: calibrate TSC
117 * @get_wallclock: get time from HW clock like RTC etc.
118 * @set_wallclock: set time back to HW clock
117 */ 119 */
118struct x86_platform_ops { 120struct x86_platform_ops {
119 unsigned long (*calibrate_tsc)(void); 121 unsigned long (*calibrate_tsc)(void);
122 unsigned long (*get_wallclock)(void);
123 int (*set_wallclock)(unsigned long nowtime);
120}; 124};
121 125
122extern struct x86_init_ops x86_init; 126extern struct x86_init_ops x86_init;