time.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef _ASM_X86_TIME_H
  2. #define _ASM_X86_TIME_H
  3. extern void hpet_time_init(void);
  4. #include <asm/mc146818rtc.h>
  5. #ifdef CONFIG_X86_32
  6. #include <linux/efi.h>
  7. static inline unsigned long native_get_wallclock(void)
  8. {
  9. unsigned long retval;
  10. if (efi_enabled)
  11. retval = efi_get_time();
  12. else
  13. retval = mach_get_cmos_time();
  14. return retval;
  15. }
  16. static inline int native_set_wallclock(unsigned long nowtime)
  17. {
  18. int retval;
  19. if (efi_enabled)
  20. retval = efi_set_rtc_mmss(nowtime);
  21. else
  22. retval = mach_set_rtc_mmss(nowtime);
  23. return retval;
  24. }
  25. #else
  26. extern void native_time_init_hook(void);
  27. static inline unsigned long native_get_wallclock(void)
  28. {
  29. return mach_get_cmos_time();
  30. }
  31. static inline int native_set_wallclock(unsigned long nowtime)
  32. {
  33. return mach_set_rtc_mmss(nowtime);
  34. }
  35. #endif
  36. extern void time_init(void);
  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. extern unsigned long __init calibrate_cpu(void);
  45. #endif /* _ASM_X86_TIME_H */