Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73900
b: refs/heads/master
c: bbbd999
h: refs/heads/master
v: v3
  • Loading branch information
David P. Reed authored and Thomas Gleixner committed Nov 17, 2007
1 parent a5740a0 commit 4aae354
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 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: c399da0d97e06803e51085ec076b63a3168aad1b
refs/heads/master: bbbd99955bfe84c9ae63f51db946a7bcd21f48be
30 changes: 18 additions & 12 deletions trunk/arch/x86/kernel/time_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,27 @@ unsigned long read_persistent_clock(void)
unsigned century = 0;

spin_lock_irqsave(&rtc_lock, flags);
/*
* if UIP is clear, then we have >= 244 microseconds before RTC
* registers will be updated. Spec sheet says that this is the
* reliable way to read RTC - registers invalid (off bus) during update
*/
while ((CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
cpu_relax();

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);

/* now read all RTC registers while stable with interrupts disabled */
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_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
acpi_gbl_FADT.century)
century = CMOS_READ(acpi_gbl_FADT.century);
if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
acpi_gbl_FADT.century)
century = CMOS_READ(acpi_gbl_FADT.century);
#endif
} while (sec != CMOS_READ(RTC_SECONDS));

spin_unlock_irqrestore(&rtc_lock, flags);

/*
Expand Down

0 comments on commit 4aae354

Please sign in to comment.