| Glauber de Oliveira Costa | ee238e5 | 2008-01-30 13:31:10 +0100 | [diff] [blame] | 1 | #ifndef _ASMX86_TIME_H | 
|  | 2 | #define _ASMX86_TIME_H | 
| Rusty Russell | d3561b7 | 2006-12-07 02:14:07 +0100 | [diff] [blame] | 3 |  | 
| Glauber de Oliveira Costa | ee238e5 | 2008-01-30 13:31:10 +0100 | [diff] [blame] | 4 | extern void hpet_time_init(void); | 
|  | 5 |  | 
| Thomas Gleixner | fe599f9 | 2008-01-30 13:30:26 +0100 | [diff] [blame] | 6 | #include <asm/mc146818rtc.h> | 
| Glauber de Oliveira Costa | ee238e5 | 2008-01-30 13:31:10 +0100 | [diff] [blame] | 7 | #ifdef CONFIG_X86_32 | 
|  | 8 | #include <linux/efi.h> | 
| Rusty Russell | d3561b7 | 2006-12-07 02:14:07 +0100 | [diff] [blame] | 9 |  | 
|  | 10 | static 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 |  | 
|  | 22 | static 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 Costa | ee238e5 | 2008-01-30 13:31:10 +0100 | [diff] [blame] | 34 | #else | 
|  | 35 | extern void native_time_init_hook(void); | 
|  | 36 |  | 
|  | 37 | static inline unsigned long native_get_wallclock(void) | 
|  | 38 | { | 
|  | 39 | return mach_get_cmos_time(); | 
|  | 40 | } | 
|  | 41 |  | 
|  | 42 | static inline int native_set_wallclock(unsigned long nowtime) | 
|  | 43 | { | 
|  | 44 | return mach_set_rtc_mmss(nowtime); | 
|  | 45 | } | 
|  | 46 |  | 
|  | 47 | #endif | 
| Zachary Amsden | e30fab3 | 2007-03-05 00:30:39 -0800 | [diff] [blame] | 48 |  | 
| Rusty Russell | d3561b7 | 2006-12-07 02:14:07 +0100 | [diff] [blame] | 49 | #ifdef CONFIG_PARAVIRT | 
|  | 50 | #include <asm/paravirt.h> | 
| Rusty Russell | d3561b7 | 2006-12-07 02:14:07 +0100 | [diff] [blame] | 51 | #else /* !CONFIG_PARAVIRT */ | 
|  | 52 |  | 
|  | 53 | #define get_wallclock() native_get_wallclock() | 
|  | 54 | #define set_wallclock(x) native_set_wallclock(x) | 
| Zachary Amsden | e30fab3 | 2007-03-05 00:30:39 -0800 | [diff] [blame] | 55 | #define choose_time_init() hpet_time_init | 
| Rusty Russell | d3561b7 | 2006-12-07 02:14:07 +0100 | [diff] [blame] | 56 |  | 
|  | 57 | #endif /* CONFIG_PARAVIRT */ | 
|  | 58 |  | 
| Alok Kataria | 8fbbc4b | 2008-07-01 11:43:34 -0700 | [diff] [blame] | 59 | extern unsigned long __init calibrate_cpu(void); | 
|  | 60 |  | 
| Rusty Russell | d3561b7 | 2006-12-07 02:14:07 +0100 | [diff] [blame] | 61 | #endif |