blob: 68779b048a3edba6f3371bb459735d8a170aec9f [file] [log] [blame]
Glauber de Oliveira Costaee238e52008-01-30 13:31:10 +01001#ifndef _ASMX86_TIME_H
2#define _ASMX86_TIME_H
Rusty Russelld3561b72006-12-07 02:14:07 +01003
Glauber de Oliveira Costaee238e52008-01-30 13:31:10 +01004extern void (*late_time_init)(void);
5extern void hpet_time_init(void);
6
Thomas Gleixnerfe599f92008-01-30 13:30:26 +01007#include <asm/mc146818rtc.h>
Glauber de Oliveira Costaee238e52008-01-30 13:31:10 +01008#ifdef CONFIG_X86_32
9#include <linux/efi.h>
Rusty Russelld3561b72006-12-07 02:14:07 +010010
11static inline unsigned long native_get_wallclock(void)
12{
13 unsigned long retval;
14
15 if (efi_enabled)
16 retval = efi_get_time();
17 else
18 retval = mach_get_cmos_time();
19
20 return retval;
21}
22
23static inline int native_set_wallclock(unsigned long nowtime)
24{
25 int retval;
26
27 if (efi_enabled)
28 retval = efi_set_rtc_mmss(nowtime);
29 else
30 retval = mach_set_rtc_mmss(nowtime);
31
32 return retval;
33}
34
Glauber de Oliveira Costaee238e52008-01-30 13:31:10 +010035#else
36extern void native_time_init_hook(void);
37
38static inline unsigned long native_get_wallclock(void)
39{
40 return mach_get_cmos_time();
41}
42
43static inline int native_set_wallclock(unsigned long nowtime)
44{
45 return mach_set_rtc_mmss(nowtime);
46}
47
48#endif
Zachary Amsdene30fab32007-03-05 00:30:39 -080049
Rusty Russelld3561b72006-12-07 02:14:07 +010050#ifdef CONFIG_PARAVIRT
51#include <asm/paravirt.h>
Rusty Russelld3561b72006-12-07 02:14:07 +010052#else /* !CONFIG_PARAVIRT */
53
54#define get_wallclock() native_get_wallclock()
55#define set_wallclock(x) native_set_wallclock(x)
Zachary Amsdene30fab32007-03-05 00:30:39 -080056#define choose_time_init() hpet_time_init
Rusty Russelld3561b72006-12-07 02:14:07 +010057
58#endif /* CONFIG_PARAVIRT */
59
60#endif