diff options
author | Andi Kleen <ak@suse.de> | 2006-03-25 10:30:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 12:10:55 -0500 |
commit | 6954bee829a037e4a3e06f7ecd7fc0466fadde41 (patch) | |
tree | 07f7db85079b99539ab6fc66c7482a960b52202c /arch/x86_64 | |
parent | eaeae0cc985fa1df753da7edc8d02635cbc1ba39 (diff) |
[PATCH] x86_64: Handle years beyond 2100
ACPIv2 has an official but optional way to get a date >2100. Use it.
But all the platforms I tested didn't seem to support it. But anyways
the x86-64 kernel should be ready for the 22nd century now. Actually i
shouldn't care about this because I will be dead by then @)
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64')
-rw-r--r-- | arch/x86_64/kernel/time.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index 86039baaaf18..2f7c21206574 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c | |||
@@ -517,6 +517,7 @@ static unsigned long get_cmos_time(void) | |||
517 | unsigned int timeout = 1000000, year, mon, day, hour, min, sec; | 517 | unsigned int timeout = 1000000, year, mon, day, hour, min, sec; |
518 | unsigned char uip = 0, this = 0; | 518 | unsigned char uip = 0, this = 0; |
519 | unsigned long flags; | 519 | unsigned long flags; |
520 | unsigned extyear = 0; | ||
520 | 521 | ||
521 | /* | 522 | /* |
522 | * The Linux interpretation of the CMOS clock register contents: When the | 523 | * The Linux interpretation of the CMOS clock register contents: When the |
@@ -545,6 +546,11 @@ static unsigned long get_cmos_time(void) | |||
545 | mon = CMOS_READ(RTC_MONTH); | 546 | mon = CMOS_READ(RTC_MONTH); |
546 | year = CMOS_READ(RTC_YEAR); | 547 | year = CMOS_READ(RTC_YEAR); |
547 | 548 | ||
549 | #ifdef CONFIG_ACPI | ||
550 | if (acpi_fadt.revision >= FADT2_REVISION_ID && acpi_fadt.century) | ||
551 | extyear = CMOS_READ(acpi_fadt.century); | ||
552 | #endif | ||
553 | |||
548 | spin_unlock_irqrestore(&rtc_lock, flags); | 554 | spin_unlock_irqrestore(&rtc_lock, flags); |
549 | 555 | ||
550 | /* | 556 | /* |
@@ -559,11 +565,17 @@ static unsigned long get_cmos_time(void) | |||
559 | BCD_TO_BIN(mon); | 565 | BCD_TO_BIN(mon); |
560 | BCD_TO_BIN(year); | 566 | BCD_TO_BIN(year); |
561 | 567 | ||
562 | /* | 568 | if (extyear) { |
563 | * x86-64 systems only exists since 2002. | 569 | BCD_TO_BIN(extyear); |
564 | * This will work up to Dec 31, 2100 | 570 | year += extyear; |
565 | */ | 571 | printk(KERN_INFO "Extended CMOS year: %d\n", extyear); |
566 | year += 2000; | 572 | } else { |
573 | /* | ||
574 | * x86-64 systems only exists since 2002. | ||
575 | * This will work up to Dec 31, 2100 | ||
576 | */ | ||
577 | year += 2000; | ||
578 | } | ||
567 | 579 | ||
568 | return mktime(year, mon, day, hour, min, sec); | 580 | return mktime(year, mon, day, hour, min, sec); |
569 | } | 581 | } |