diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86_64/kernel/time.c | 71 |
1 files changed, 32 insertions, 39 deletions
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index 25bc58aac2a5..7b56aa5b6c3f 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c | |||
@@ -251,8 +251,8 @@ static void set_rtc_mmss(unsigned long nowtime) | |||
251 | #endif | 251 | #endif |
252 | 252 | ||
253 | { | 253 | { |
254 | BIN_TO_BCD(real_seconds); | 254 | BIN_TO_BCD(real_seconds); |
255 | BIN_TO_BCD(real_minutes); | 255 | BIN_TO_BCD(real_minutes); |
256 | CMOS_WRITE(real_seconds, RTC_SECONDS); | 256 | CMOS_WRITE(real_seconds, RTC_SECONDS); |
257 | CMOS_WRITE(real_minutes, RTC_MINUTES); | 257 | CMOS_WRITE(real_minutes, RTC_MINUTES); |
258 | } | 258 | } |
@@ -289,12 +289,11 @@ unsigned long long monotonic_clock(void) | |||
289 | last_offset = vxtime.last; | 289 | last_offset = vxtime.last; |
290 | base = monotonic_base; | 290 | base = monotonic_base; |
291 | this_offset = hpet_readl(HPET_COUNTER); | 291 | this_offset = hpet_readl(HPET_COUNTER); |
292 | |||
293 | } while (read_seqretry(&xtime_lock, seq)); | 292 | } while (read_seqretry(&xtime_lock, seq)); |
294 | offset = (this_offset - last_offset); | 293 | offset = (this_offset - last_offset); |
295 | offset *=(NSEC_PER_SEC/HZ)/hpet_tick; | 294 | offset *=(NSEC_PER_SEC/HZ)/hpet_tick; |
296 | return base + offset; | 295 | return base + offset; |
297 | }else{ | 296 | } else { |
298 | do { | 297 | do { |
299 | seq = read_seqbegin(&xtime_lock); | 298 | seq = read_seqbegin(&xtime_lock); |
300 | 299 | ||
@@ -305,8 +304,6 @@ unsigned long long monotonic_clock(void) | |||
305 | offset = (this_offset - last_offset)*1000/cpu_khz; | 304 | offset = (this_offset - last_offset)*1000/cpu_khz; |
306 | return base + offset; | 305 | return base + offset; |
307 | } | 306 | } |
308 | |||
309 | |||
310 | } | 307 | } |
311 | EXPORT_SYMBOL(monotonic_clock); | 308 | EXPORT_SYMBOL(monotonic_clock); |
312 | 309 | ||
@@ -530,36 +527,35 @@ unsigned long get_cmos_time(void) | |||
530 | timeout--; | 527 | timeout--; |
531 | } | 528 | } |
532 | 529 | ||
533 | /* | 530 | /* |
534 | * Here we are safe to assume the registers won't change for a whole second, so | 531 | * Here we are safe to assume the registers won't change for a whole |
535 | * we just go ahead and read them. | 532 | * second, so we just go ahead and read them. |
536 | */ | 533 | */ |
537 | 534 | sec = CMOS_READ(RTC_SECONDS); | |
538 | sec = CMOS_READ(RTC_SECONDS); | 535 | min = CMOS_READ(RTC_MINUTES); |
539 | min = CMOS_READ(RTC_MINUTES); | 536 | hour = CMOS_READ(RTC_HOURS); |
540 | hour = CMOS_READ(RTC_HOURS); | 537 | day = CMOS_READ(RTC_DAY_OF_MONTH); |
541 | day = CMOS_READ(RTC_DAY_OF_MONTH); | 538 | mon = CMOS_READ(RTC_MONTH); |
542 | mon = CMOS_READ(RTC_MONTH); | 539 | year = CMOS_READ(RTC_YEAR); |
543 | year = CMOS_READ(RTC_YEAR); | ||
544 | 540 | ||
545 | spin_unlock_irqrestore(&rtc_lock, flags); | 541 | spin_unlock_irqrestore(&rtc_lock, flags); |
546 | 542 | ||
547 | /* | 543 | /* |
548 | * We know that x86-64 always uses BCD format, no need to check the config | 544 | * We know that x86-64 always uses BCD format, no need to check the |
549 | * register. | 545 | * config register. |
550 | */ | 546 | */ |
551 | 547 | ||
552 | BCD_TO_BIN(sec); | 548 | BCD_TO_BIN(sec); |
553 | BCD_TO_BIN(min); | 549 | BCD_TO_BIN(min); |
554 | BCD_TO_BIN(hour); | 550 | BCD_TO_BIN(hour); |
555 | BCD_TO_BIN(day); | 551 | BCD_TO_BIN(day); |
556 | BCD_TO_BIN(mon); | 552 | BCD_TO_BIN(mon); |
557 | BCD_TO_BIN(year); | 553 | BCD_TO_BIN(year); |
558 | 554 | ||
559 | /* | 555 | /* |
560 | * x86-64 systems only exists since 2002. | 556 | * x86-64 systems only exists since 2002. |
561 | * This will work up to Dec 31, 2100 | 557 | * This will work up to Dec 31, 2100 |
562 | */ | 558 | */ |
563 | year += 2000; | 559 | year += 2000; |
564 | 560 | ||
565 | return mktime(year, mon, day, hour, min, sec); | 561 | return mktime(year, mon, day, hour, min, sec); |
@@ -737,7 +733,7 @@ static __init int late_hpet_init(void) | |||
737 | unsigned int ntimer; | 733 | unsigned int ntimer; |
738 | 734 | ||
739 | if (!vxtime.hpet_address) | 735 | if (!vxtime.hpet_address) |
740 | return -1; | 736 | return -1; |
741 | 737 | ||
742 | memset(&hd, 0, sizeof (hd)); | 738 | memset(&hd, 0, sizeof (hd)); |
743 | 739 | ||
@@ -871,8 +867,6 @@ static struct irqaction irq0 = { | |||
871 | timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL | 867 | timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL |
872 | }; | 868 | }; |
873 | 869 | ||
874 | extern void __init config_acpi_tables(void); | ||
875 | |||
876 | void __init time_init(void) | 870 | void __init time_init(void) |
877 | { | 871 | { |
878 | char *timename; | 872 | char *timename; |
@@ -992,6 +986,10 @@ __setup("report_lost_ticks", time_setup); | |||
992 | static long clock_cmos_diff; | 986 | static long clock_cmos_diff; |
993 | static unsigned long sleep_start; | 987 | static unsigned long sleep_start; |
994 | 988 | ||
989 | /* | ||
990 | * sysfs support for the timer. | ||
991 | */ | ||
992 | |||
995 | static int timer_suspend(struct sys_device *dev, pm_message_t state) | 993 | static int timer_suspend(struct sys_device *dev, pm_message_t state) |
996 | { | 994 | { |
997 | /* | 995 | /* |
@@ -1034,7 +1032,6 @@ static struct sysdev_class timer_sysclass = { | |||
1034 | set_kset_name("timer"), | 1032 | set_kset_name("timer"), |
1035 | }; | 1033 | }; |
1036 | 1034 | ||
1037 | |||
1038 | /* XXX this driverfs stuff should probably go elsewhere later -john */ | 1035 | /* XXX this driverfs stuff should probably go elsewhere later -john */ |
1039 | static struct sys_device device_timer = { | 1036 | static struct sys_device device_timer = { |
1040 | .id = 0, | 1037 | .id = 0, |
@@ -1276,8 +1273,6 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1276 | } | 1273 | } |
1277 | #endif | 1274 | #endif |
1278 | 1275 | ||
1279 | |||
1280 | |||
1281 | static int __init nohpet_setup(char *s) | 1276 | static int __init nohpet_setup(char *s) |
1282 | { | 1277 | { |
1283 | nohpet = 1; | 1278 | nohpet = 1; |
@@ -1294,5 +1289,3 @@ static int __init notsc_setup(char *s) | |||
1294 | } | 1289 | } |
1295 | 1290 | ||
1296 | __setup("notsc", notsc_setup); | 1291 | __setup("notsc", notsc_setup); |
1297 | |||
1298 | |||