time.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef _ASMX86_TIME_H
  2. #define _ASMX86_TIME_H
  3. extern void (*late_time_init)(void);
  4. extern void hpet_time_init(void);
  5. #include <asm/mc146818rtc.h>
  6. #ifdef CONFIG_X86_32
  7. #include <linux/efi.h>
  8. static inline unsigned long native_get_wallclock(void)
  9. {
  10. unsigned long retval;
  11. if (efi_enabled)
  12. retval = efi_get_time();
  13. else
  14. retval = mach_get_cmos_time();
  15. return retval;
  16. }
  17. static inline int native_set_wallclock(unsigned long nowtime)
  18. {
  19. int retval;
  20. if (efi_enabled)
  21. retval = efi_set_rtc_mmss(nowtime);
  22. else
  23. retval = mach_set_rtc_mmss(nowtime);
  24. return retval;
  25. }
  26. #else
  27. extern void native_time_init_hook(void);
  28. static inline unsigned long native_get_wallclock(void)
  29. {
  30. return mach_get_cmos_time();
  31. }
  32. static inline int native_set_wallclock(unsigned long nowtime)
  33. {
  34. return mach_set_rtc_mmss(nowtime);
  35. }
  36. #endif
  37. #ifdef CONFIG_PARAVIRT
  38. #include <asm/paravirt.h>
  39. #else /* !CONFIG_PARAVIRT */
  40. #define get_wallclock() native_get_wallclock()
  41. #define set_wallclock(x) native_set_wallclock(x)
  42. #define choose_time_init() hpet_time_init
  43. #endif /* CONFIG_PARAVIRT */
  44. #endif