]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/asm-x86/time.h
x86: merge the TSC cpu-freq code
[mirror_ubuntu-bionic-kernel.git] / include / asm-x86 / time.h
CommitLineData
ee238e5c
GOC
1#ifndef _ASMX86_TIME_H
2#define _ASMX86_TIME_H
3
ee238e5c 4extern void hpet_time_init(void);
d3561b7f 5
fe599f9f 6#include <asm/mc146818rtc.h>
ee238e5c
GOC
7#ifdef CONFIG_X86_32
8#include <linux/efi.h>
d3561b7f
RR
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
ee238e5c
GOC
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
e30fab3a 48
d3561b7f
RR
49#ifdef CONFIG_PARAVIRT
50#include <asm/paravirt.h>
51#else /* !CONFIG_PARAVIRT */
52
53#define get_wallclock() native_get_wallclock()
54#define set_wallclock(x) native_set_wallclock(x)
e30fab3a 55#define choose_time_init() hpet_time_init
d3561b7f
RR
56
57#endif /* CONFIG_PARAVIRT */
58
59#endif