blob: 5f4fc3e02387358b8246de6d50eba15341155573 [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 hpet_time_init(void);
5
Thomas Gleixnerfe599f92008-01-30 13:30:26 +01006#include <asm/mc146818rtc.h>
Glauber de Oliveira Costaee238e52008-01-30 13:31:10 +01007#ifdef CONFIG_X86_32
8#include <linux/efi.h>
Rusty Russelld3561b72006-12-07 02:14:07 +01009
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
Glauber de Oliveira Costaee238e52008-01-30 13:31:10 +010034#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
Zachary Amsdene30fab32007-03-05 00:30:39 -080048
Jaswinder Singhcc038492008-07-21 21:52:51 +053049extern void time_init(void);
50
Rusty Russelld3561b72006-12-07 02:14:07 +010051#ifdef CONFIG_PARAVIRT
52#include <asm/paravirt.h>
Rusty Russelld3561b72006-12-07 02:14:07 +010053#else /* !CONFIG_PARAVIRT */
54
55#define get_wallclock() native_get_wallclock()
56#define set_wallclock(x) native_set_wallclock(x)
Zachary Amsdene30fab32007-03-05 00:30:39 -080057#define choose_time_init() hpet_time_init
Rusty Russelld3561b72006-12-07 02:14:07 +010058
59#endif /* CONFIG_PARAVIRT */
60
Alok Kataria8fbbc4b2008-07-01 11:43:34 -070061extern unsigned long __init calibrate_cpu(void);
62
Rusty Russelld3561b72006-12-07 02:14:07 +010063#endif