Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24441
b: refs/heads/master
c: 641f71f
h: refs/heads/master
i:
  24439: d90e980
v: v3
  • Loading branch information
Matt Mackall authored and Linus Torvalds committed Mar 28, 2006
1 parent 451ad13 commit 3a49a81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 63732c2f37093d63102d53e70866cf87bf0c0479
refs/heads/master: 641f71f5f6ed251959ef8f88b1d0edc6ef7a4632
41 changes: 12 additions & 29 deletions trunk/arch/x86_64/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,42 +504,25 @@ unsigned long long sched_clock(void)

static unsigned long get_cmos_time(void)
{
unsigned int timeout = 1000000, year, mon, day, hour, min, sec;
unsigned char uip = 0, this = 0;
unsigned int year, mon, day, hour, min, sec;
unsigned long flags;
unsigned extyear = 0;

/*
* The Linux interpretation of the CMOS clock register contents: When the
* Update-In-Progress (UIP) flag goes from 1 to 0, the RTC registers show the
* second which has precisely just started. Waiting for this can take up to 1
* second, we timeout approximately after 2.4 seconds on a machine with
* standard 8.3 MHz ISA bus.
*/

spin_lock_irqsave(&rtc_lock, flags);

while (timeout && (!uip || this)) {
uip |= this;
this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP;
timeout--;
}

/*
* Here we are safe to assume the registers won't change for a whole
* second, so we just go ahead and read them.
*/
sec = CMOS_READ(RTC_SECONDS);
min = CMOS_READ(RTC_MINUTES);
hour = CMOS_READ(RTC_HOURS);
day = CMOS_READ(RTC_DAY_OF_MONTH);
mon = CMOS_READ(RTC_MONTH);
year = CMOS_READ(RTC_YEAR);

do {
sec = CMOS_READ(RTC_SECONDS);
min = CMOS_READ(RTC_MINUTES);
hour = CMOS_READ(RTC_HOURS);
day = CMOS_READ(RTC_DAY_OF_MONTH);
mon = CMOS_READ(RTC_MONTH);
year = CMOS_READ(RTC_YEAR);
#ifdef CONFIG_ACPI
if (acpi_fadt.revision >= FADT2_REVISION_ID && acpi_fadt.century)
extyear = CMOS_READ(acpi_fadt.century);
if (acpi_fadt.revision >= FADT2_REVISION_ID &&
acpi_fadt.century)
extyear = CMOS_READ(acpi_fadt.century);
#endif
} while (sec != CMOS_READ(RTC_SECONDS));

spin_unlock_irqrestore(&rtc_lock, flags);

Expand Down

0 comments on commit 3a49a81

Please sign in to comment.