time.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _ASMX86_TIME_H
  2. #define _ASMX86_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. #ifdef CONFIG_PARAVIRT
  37. #include <asm/paravirt.h>
  38. #else /* !CONFIG_PARAVIRT */
  39. #define get_wallclock() native_get_wallclock()
  40. #define set_wallclock(x) native_set_wallclock(x)
  41. #define choose_time_init() hpet_time_init
  42. #endif /* CONFIG_PARAVIRT */
  43. extern unsigned long __init calibrate_cpu(void);
  44. #endif