Commit 6954bee8 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[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: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent eaeae0cc
...@@ -517,6 +517,7 @@ static unsigned long get_cmos_time(void) ...@@ -517,6 +517,7 @@ static unsigned long get_cmos_time(void)
unsigned int timeout = 1000000, year, mon, day, hour, min, sec; unsigned int timeout = 1000000, year, mon, day, hour, min, sec;
unsigned char uip = 0, this = 0; unsigned char uip = 0, this = 0;
unsigned long flags; unsigned long flags;
unsigned extyear = 0;
/* /*
* The Linux interpretation of the CMOS clock register contents: When the * The Linux interpretation of the CMOS clock register contents: When the
...@@ -545,6 +546,11 @@ static unsigned long get_cmos_time(void) ...@@ -545,6 +546,11 @@ static unsigned long get_cmos_time(void)
mon = CMOS_READ(RTC_MONTH); mon = CMOS_READ(RTC_MONTH);
year = CMOS_READ(RTC_YEAR); year = CMOS_READ(RTC_YEAR);
#ifdef CONFIG_ACPI
if (acpi_fadt.revision >= FADT2_REVISION_ID && acpi_fadt.century)
extyear = CMOS_READ(acpi_fadt.century);
#endif
spin_unlock_irqrestore(&rtc_lock, flags); spin_unlock_irqrestore(&rtc_lock, flags);
/* /*
...@@ -559,11 +565,17 @@ static unsigned long get_cmos_time(void) ...@@ -559,11 +565,17 @@ static unsigned long get_cmos_time(void)
BCD_TO_BIN(mon); BCD_TO_BIN(mon);
BCD_TO_BIN(year); BCD_TO_BIN(year);
/* if (extyear) {
* x86-64 systems only exists since 2002. BCD_TO_BIN(extyear);
* This will work up to Dec 31, 2100 year += extyear;
*/ printk(KERN_INFO "Extended CMOS year: %d\n", extyear);
year += 2000; } else {
/*
* x86-64 systems only exists since 2002.
* This will work up to Dec 31, 2100
*/
year += 2000;
}
return mktime(year, mon, day, hour, min, sec); return mktime(year, mon, day, hour, min, sec);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment